Skip to content

Commit edcc1a6

Browse files
Unify payment methods into single pay() function
Replace payLnurl(), payBolt11(), and payBolt12Offer() with a single pay() method that auto-detects the destination type using bitcoin_payment_instructions. Supported destinations: - BOLT12 offers (lno...) - LNURL (lnurl...) - Lightning addresses (user@domain) - Zero-amount BOLT11 invoices This is a breaking change: BOLT11 invoices with pre-set amounts are no longer supported through this API. The design enforces that the caller always specifies the amount, which: - Simplifies the API surface (one method instead of three) - Ensures consistent amount handling across all payment types - Protects against malicious LNURL services returning wrong amounts The amount_msat parameter is now always required.
1 parent 7811573 commit edcc1a6

2 files changed

Lines changed: 190 additions & 459 deletions

File tree

index.d.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,17 @@ export declare class MdkNode {
6767
description: string,
6868
expirySecs: number,
6969
): PaymentMetadata
70-
payLnurl(lnurl: string, amountMsat: number, waitForPaymentSecs?: number | undefined | null): string
71-
payBolt11(bolt11Invoice: string): string
72-
payBolt12Offer(bolt12OfferString: string, amountMsat: number, waitForPaymentSecs?: number | undefined | null): string
70+
/**
71+
* Unified payment method that auto-detects the destination type.
72+
*
73+
* Only supports variable-amount destinations where we set the amount:
74+
* - BOLT12 offers (lno...)
75+
* - LNURL (lnurl...)
76+
* - Lightning addresses (user@domain)
77+
* - Zero-amount BOLT11 invoices
78+
*
79+
* BOLT11 invoices with embedded amounts are rejected - use a variable-amount
80+
* destination instead. The amountMsat parameter is always required.
81+
*/
82+
pay(destination: string, amountMsat: number, waitForPaymentSecs?: number | undefined | null): string
7383
}

0 commit comments

Comments
 (0)