From bc953b56f3908e3a557976b9029b617dad751755 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 26 Nov 2025 22:36:59 -0800 Subject: ark --- lib/invoices.ts | 21 ++++++++++----------- lib/utils.ts | 4 ++++ 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/invoices.ts b/lib/invoices.ts index 9666d217..6ddffe54 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -63,17 +63,16 @@ export const generate = async ({ invoice, user }) => { let text; let paymentHash; - 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; - } + if (account.type === "ark") { + type = PaymentType.ark; + text = account.arkAddress; + } else if (account.seed) { + 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 if (type === PaymentType.lightning) { let r; if (bolt11) { diff --git a/lib/utils.ts b/lib/utils.ts index add09782..878ef037 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -47,6 +47,10 @@ export const bip21 = (address, { amount, memo, tip, type }) => { return `${network}:${address}?${url.toString()}`; }; +export const getAccount = async (id) => { + return g(`account:${id}`); +} + export const getUser = async (username, fields = undefined) => { if (username === "undefined") fail("invalid user"); const k = username?.replace(/\s/g, "").toLowerCase(); -- cgit v1.2.3