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 | |
| parent | 9089698e8df9d0c09c165c45eb6b05335a818699 (diff) | |
| download | coinos-server-2a408a3a7486464296e4e7f996fc2140a664d407.tar.gz coinos-server-2a408a3a7486464296e4e7f996fc2140a664d407.zip | |
ark
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/db.ts | 2 | ||||
| -rw-r--r-- | lib/invoices.ts | 15 | ||||
| -rw-r--r-- | lib/types.ts | 1 |
3 files changed, 15 insertions, 3 deletions
@@ -1,7 +1,7 @@ import config from "$config"; +import { err, warn } from "$lib/logging"; import { fail, sleep } from "$lib/utils"; import { createClient, defineScript } from "redis"; -import { warn, err } from "$lib/logging"; const DEBIT = ` local balanceKey = KEYS[1] 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(); diff --git a/lib/types.ts b/lib/types.ts index e878dfb8..ad58bf38 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -46,6 +46,7 @@ export interface User { } export enum PaymentType { + ark = "ark", internal = "internal", bitcoin = "bitcoin", lightning = "lightning", |
