diff options
| author | Adam Soltys <[email protected]> | 2024-11-16 23:33:25 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-11-16 23:33:25 -0800 |
| commit | 76c0a2a00eaa4f6b77cb34290e207c78fea971f8 (patch) | |
| tree | f5e032434c97950d8dfa5302dff377ee875371a5 /lib | |
| parent | 4f5617ca59141a8bf64e131a8b2e6d39aa9cab4c (diff) | |
| download | coinos-server-76c0a2a00eaa4f6b77cb34290e207c78fea971f8.tar.gz coinos-server-76c0a2a00eaa4f6b77cb34290e207c78fea971f8.zip | |
bolt12 pay
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/payments.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/payments.ts b/lib/payments.ts index 4a394469..ae36725b 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -425,10 +425,11 @@ export const sendLightning = async ({ fail("Invalid amount"); } - let total = amount; + const total = amount; const decoded = await ln.decode(pr); - const { amount_msat } = decoded; - if (amount_msat) total = Math.round(amount_msat / 1000); + const amount_msat = decoded.type.includes("bolt12") + ? decoded.invoice_amount_msat + : decoded.amount_msat; if (maxfee) maxfee = parseInt(maxfee); if (maxfee < 0) fail("Max fee cannot be negative"); |
