diff options
| author | Adam Soltys <[email protected]> | 2025-11-26 10:56:20 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-06 08:57:26 -0800 |
| commit | 2a408a3a7486464296e4e7f996fc2140a664d407 (patch) | |
| tree | d2855fef7c52bdb0758523dea50c2853d2d305f0 /lib/invoices.ts | |
| parent | 9089698e8df9d0c09c165c45eb6b05335a818699 (diff) | |
| download | coinos-server-2a408a3a7486464296e4e7f996fc2140a664d407.tar.gz coinos-server-2a408a3a7486464296e4e7f996fc2140a664d407.zip | |
ark
Diffstat (limited to 'lib/invoices.ts')
| -rw-r--r-- | lib/invoices.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts index ad0b604e..9666d217 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -22,6 +22,7 @@ export const generate = async ({ invoice, user }) => { expiry, fiat, id, + hash, tip, amount, items = [], @@ -59,11 +60,21 @@ export const generate = async ({ invoice, user }) => { if (!id) id = v4(); - let hash; let text; let paymentHash; - if (type === PaymentType.lightning) { + if (account.seed) { + if (type !== PaymentType.ark) { + type = PaymentType.bitcoin; + const node = rpc({ ...config[type], wallet: aid }); + hash = await node.getNewAddress({ address_type }); + text = bip21(hash, invoice); + + ({ hdkeypath: path } = await node.getAddressInfo(hash)); + } else { + text = hash; + } + } else if (type === PaymentType.lightning) { let r; if (bolt11) { const { id: nodeid } = await ln.getinfo(); |
