aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-11-26 22:36:59 -0800
committerAdam Soltys <[email protected]>2026-02-06 08:58:10 -0800
commitbc953b56f3908e3a557976b9029b617dad751755 (patch)
tree6e65399fd615c6cf5c7e9382b212a707531e4886 /lib
parente95e3b8e35a858cc200de6c0b74e3e172e4f6d6e (diff)
downloadcoinos-server-bc953b56f3908e3a557976b9029b617dad751755.tar.gz
coinos-server-bc953b56f3908e3a557976b9029b617dad751755.zip
ark
Diffstat (limited to 'lib')
-rw-r--r--lib/invoices.ts19
-rw-r--r--lib/utils.ts4
2 files changed, 13 insertions, 10 deletions
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);
+ 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 {
- text = hash;
- }
+ ({ 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();