@integraledger/lcp/lightning
The exports of @integraledger/lcp/lightning.
Interfaces
Bolt11
Properties
LnMppChoice
Properties
| Property | Type | Description |
|---|---|---|
challenge | MppChallenge & object | - |
returnInvoice? | string | session only: the payer's return invoice, a BOLT11 invoice with no amount, which the open action registers. |
LnMppUnsigned
Properties
Methods
complete()
complete(
preimage):Refusal|MppCredential
Parameters
| Parameter | Type |
|---|---|
preimage | string |
Returns
LnRef
The read keys recorded at claim: the invoice's payment hash as lowercase hex, and when the payment can land.
Properties
LnUnsigned
Properties
| Property | Type | Description |
|---|---|---|
request | object | The payer's node pays exactly this invoice. |
request.invoice | string | - |
request.kind | "bolt11-pay" | - |
Methods
complete()
complete(
preimage):Refusal|LnPaymentPayload
Parameters
| Parameter | Type |
|---|---|
preimage | string |
Returns
Type Aliases
LnMppPairing
LnMppPairing = typeof
LN_CHARGE| typeofLN_SESSION
LnNetwork
LnNetwork =
"lnbtc:000000000019d6689c085ae165831e93"|"lnbtc:000000000933ea01ad0ee984209779ba"
CAIP-2 for Lightning: lnbtc: and the first 32 hex digits of the Bitcoin network's genesis block hash.
LnPaymentPayload
LnPaymentPayload =
object
Properties
| Property | Type |
|---|---|
accepted | PaymentRequirements |
extensions? | PaymentRequired["extensions"] |
payload | object |
payload.preimage | string |
resource? | PaymentRequired["resource"] |
x402Version | 2 |
Variables
chargeLightning
constchargeLightning:Readonly<{advertise: (doc,h,link,offer,agreementUrl?) =>Refusal|MppChallenge[];advertiseBeforeCarrier: (doc,h,link,offer,agreementUrl?) =>Refusal|MppChallenge[];bound: (presented) =>Promise<`0x${string}`|Refusal>;build: (choice,h) =>Promise<Refusal|LnMppUnsigned>;carrier:string;claims:boolean;id:"mpp/charge/lightning";pattern:LcpPattern;read: (doc) =>Refusal| {agreement?:string;h:`0x${string}`;link:string;offer: {challenges:MppChallenge[]; }; };reference: (presented) =>Promise<Refusal|LnRef>;tie: (options) => ["mpp", {challenges:MppChallenge[]; }];unplaced: (c) =>MppChallenge; }>
exactLnbtc
constexactLnbtc:Readonly<{advertise: (doc,h,link,offer,agreementUrl?) =>Refusal|PaymentRequired;advertiseBeforeCarrier: (doc,h,link,offer,agreementUrl?) =>Refusal|PaymentRequired;bound: (presented) =>Promise<`0x${string}`|Refusal>;build: (c,h) =>Promise<Refusal|LnUnsigned>;carrier:"extra.invoice#m";claims:boolean;id:"x402/exact/lnbtc";pattern:LcpPattern;read: (doc) =>Refusal|X402Read;reference: (presented) =>Promise<Refusal|LnRef>;tie: (accepts,request) => ["x402", {accepts: readonlyPaymentRequirements[];request:RequestCommitment; }];unplaced: (option) =>PaymentRequirements; }>
exactLnbtcNamed
constexactLnbtcNamed:Readonly<{advertise: (doc,h,link,offer,agreementUrl?) =>Refusal|PaymentRequired;bound: (presented) =>Promise<`0x${string}`|Refusal>;build: (c,h) =>Promise<Refusal|LnUnsigned>;carrier:null;claims:boolean;id:"x402/exact/lnbtc/invoice-named";pattern:LcpPattern;read: (doc) =>Refusal|X402Read;reference: (presented) =>Promise<Refusal|LnRef>;tie: (accepts,request) => ["x402", {accepts: readonlyPaymentRequirements[];request:RequestCommitment; }];unplaced: (option) =>PaymentRequirements; }>
sessionLightning
constsessionLightning:Readonly<{advertise: (doc,h,link,offer,agreementUrl?) =>Refusal|MppChallenge[];advertiseBeforeCarrier: (doc,h,link,offer,agreementUrl?) =>Refusal|MppChallenge[];bound: (presented) =>Promise<`0x${string}`|Refusal>;build: (choice,h) =>Promise<Refusal|LnMppUnsigned>;carrier:string;channel:Readonly<{boundWithin: (_presented) =>Promise<`0x${string}`|Refusal>;kind: (presented) =>"open"|"close"|Refusal|"within";ref: (presented) =>Promise<Refusal| {channel:string;network:string; }>;until: (_presented) =>number|undefined; }>;claims:boolean;id:"mpp/session/lightning";pattern:LcpPattern;read: (doc) =>Refusal| {agreement?:string;h:`0x${string}`;link:string;offer: {challenges:MppChallenge[]; }; };reference: (presented) =>Promise<Refusal|LnRef>;tie: (options) => ["mpp", {challenges:MppChallenge[]; }];unplaced: (c) =>MppChallenge; }>
Functions
atrNamesInvoice()
atrNamesInvoice(
atr,invoice):boolean
True when the ATR's bytes are one JSON object whose x402 slot's accepts holds an option whose
extra.invoice is exactly invoice. Only that slot is read.
Parameters
| Parameter | Type |
|---|---|
atr | Uint8Array |
invoice | string |
Returns
boolean
decodeBolt11()
Decodes a BOLT11 invoice without its length limit, up to 8 KiB. The signature is not verified.
Parameters
| Parameter | Type |
|---|---|
invoice | string |
Returns
invoiceH()
invoiceH(
b,field):`0x${string}`|Refusal
The one 32-byte h or m field of an invoice, as the hash it carries.
Parameters
| Parameter | Type |
|---|---|
b | Bolt11 |
field | "h" | "m" |
Returns
`0x${string}` | Refusal
lnbtcPairingOf()
lnbtcPairingOf(
option):"x402/exact/lnbtc"|"x402/exact/lnbtc/invoice-named"|undefined
Which of the two x402 Lightning pairings an option belongs to: by whether its invoice has an m field. An option
whose extra has no invoice is the offer the seller sends before its node writes the invoice, so it is
x402/exact/lnbtc; an invoice-named option carries its invoice at issue.
Parameters
| Parameter | Type |
|---|---|
option | unknown |
Returns
"x402/exact/lnbtc" | "x402/exact/lnbtc/invoice-named" | undefined
Last updated on