diff options
| author | Adam Soltys <[email protected]> | 2026-02-14 15:46:01 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-14 15:46:01 -0800 |
| commit | 526b21bc668c453250ebce8dece9ba330bac0133 (patch) | |
| tree | 5e9c84a2cca6b4a5766c6cdc9f33f6c62f5776f3 /lib/invoices.ts | |
| parent | 843c343db567cd224dadf347ac16736bdc8b24a8 (diff) | |
| download | coinos-server-526b21bc668c453250ebce8dece9ba330bac0133.tar.gz coinos-server-526b21bc668c453250ebce8dece9ba330bac0133.zip | |
custodial ark sends
Diffstat (limited to 'lib/invoices.ts')
| -rw-r--r-- | lib/invoices.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts index bf6c511e..f7bb6897 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -69,9 +69,25 @@ export const generate = async ({ invoice, user }) => { let path; let paymentHash; - if (account.type === "ark") { + if (type === PaymentType.ark && account.type !== "ark") { + // Custodial account receiving via Ark: use vault's ark address + const accounts = await db.lRange(`${user.id}:accounts`, 0, -1); + let vaultAddress; + for (const accId of accounts) { + const acc = await g(`account:${accId}`); + if (acc?.type === "ark" && acc.arkAddress) { + vaultAddress = acc.arkAddress; + break; + } + } + if (!vaultAddress) fail("No ark vault found"); + text = vaultAddress; + hash = id; + await s(`custodial-ark-invoice:${vaultAddress}`, id); + } else if (account.type === "ark") { type = PaymentType.ark; text = account.arkAddress; + hash = id; } else if (account.seed || (account.pubkey && account.fingerprint)) { type = PaymentType.bitcoin; const nextIndex = account.nextIndex || 0; |
