Skip to main content

Portefeuilles pris en charge

PortefeuilleInstallationAuto-gardeNotes
Blinkintégré❌ custodialConfiguration la plus simple, API GraphQL
Alby Hubintégré✅ option auto-hébergéeAPI REST, supporte son propre Hub
Personnaliséinterface L402WalletApportez votre propre portefeuille

BlinkWallet

Configuration

  1. Inscrivez-vous sur blink.sv
  2. Accédez à Dashboard → API Keys → créez une clé
  3. Copiez votre Wallet ID depuis le tableau de bord
export BLINK_API_KEY="your-api-key"
export BLINK_WALLET_ID="your-wallet-id"

Node.js

import { BlinkWallet } from "l402-kit";

const wallet = new BlinkWallet(
  process.env.BLINK_API_KEY!,
  process.env.BLINK_WALLET_ID!,
);

Python

from l402kit.wallets import BlinkWallet

wallet = BlinkWallet(
    api_key=os.environ["BLINK_API_KEY"],
    wallet_id=os.environ["BLINK_WALLET_ID"],
)

Comment ça fonctionne

Appelle l’API GraphQL de Blink avec la mutation lnInvoicePaymentSend. Retourne le preImage de la transaction réglée.

AlbyWallet

Configuration

  1. Créez un compte sur getalby.com
  2. Accédez à Settings → Access Tokens → créez un jeton avec la portée payments:send
  3. (Facultatif) Exécutez votre propre Alby Hub pour l’auto-garde
export ALBY_TOKEN="your-access-token"
# Facultatif — uniquement nécessaire pour un Hub auto-hébergé :
export ALBY_HUB_URL="https://your-hub.example.com"

Node.js

import { AlbyWallet } from "l402-kit";

// Alby cloud
const wallet = new AlbyWallet(process.env.ALBY_TOKEN!);

// Hub auto-hébergé
const wallet = new AlbyWallet(
  process.env.ALBY_TOKEN!,
  process.env.ALBY_HUB_URL,  // optional base URL
);

Python

from l402kit.wallets import AlbyWallet

# Alby cloud
wallet = AlbyWallet(os.environ["ALBY_TOKEN"])

# Hub auto-hébergé
wallet = AlbyWallet(
    access_token=os.environ["ALBY_TOKEN"],
    base_url=os.environ.get("ALBY_HUB_URL", "https://api.getalby.com"),
)

Comment ça fonctionne

Appelle POST /payments/bolt11 sur l’API REST d’Alby Hub avec un jeton Bearer. Retourne le payment_preimage de la réponse.

Portefeuille personnalisé

Implémentez l’interface L402Wallet pour utiliser n’importe quel portefeuille Lightning :
import type { L402Wallet } from "l402-kit";

class PhoenixWallet implements L402Wallet {
  async payInvoice(bolt11: string): Promise<{ preimage: string }> {
    const res = await fetch("http://localhost:9740/payinvoice", {
      method: "POST",
      body: new URLSearchParams({ invoice: bolt11 }),
    });
    const data = await res.json();
    return { preimage: data.paymentPreimage };
  }
}
L’interface requiert une seule méthode :
MéthodeTypeScriptPython
Payer une facture BOLT11payInvoice(bolt11): Promise<{ preimage: string }>pay_invoice(bolt11: str) -> str

Choisir un portefeuille

  • Tests / prototypage → Blink (custodial, configuration instantanée, offre gratuite)
  • Agent en production, contrôle maximal → Alby Hub auto-hébergé (non-custodial, API REST)
  • Débit élevé / frais réduits → Phoenix via L402Wallet personnalisé (non-custodial, ACINQ)
  • Entreprise → LNbits auto-hébergé via un portefeuille personnalisé