diff options
| author | Adam Soltys <[email protected]> | 2025-01-15 16:32:23 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-01-15 16:32:23 -0800 |
| commit | d850e1c2f616ac5707a1d1be015b0bcdf08bf308 (patch) | |
| tree | c0082b4aa382f3dadc9707ee9c59e358d299e752 /lib | |
| parent | 5d2c06457d018ef75c0fc4fa5fd4e9af266f19d8 (diff) | |
| download | coinos-server-d850e1c2f616ac5707a1d1be015b0bcdf08bf308.tar.gz coinos-server-d850e1c2f616ac5707a1d1be015b0bcdf08bf308.zip | |
default to blech32 for liquid
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/invoices.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts index b158592c..d121353c 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -13,7 +13,7 @@ const lq = rpc(config.liquid); export const generate = async ({ invoice, user }) => { let { - address_type = "bech32", + address_type, bolt11, aid, currency, @@ -32,6 +32,7 @@ export const generate = async ({ invoice, user }) => { secret, } = invoice; + amount = parseInt(amount || 0); tip = parseInt(tip) || null; @@ -101,9 +102,11 @@ export const generate = async ({ invoice, user }) => { await s(`invoice:${r.offer_id}`, id); } else if (type === types.bitcoin) { + address_type ||= "bech32" hash = await bc.getNewAddress({ address_type }); text = bip21(hash, invoice); } else if (type === types.liquid) { + address_type ||= "blech32" hash = await lq.getNewAddress({ address_type }); text = bip21(hash, invoice); } else if (type === types.internal) { @@ -118,6 +121,7 @@ export const generate = async ({ invoice, user }) => { invoice = { amount, aid, + address_type, created: Date.now(), currency, hash, |
