aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-11-26 10:56:20 -0800
committerAdam Soltys <[email protected]>2026-02-06 08:57:26 -0800
commit2a408a3a7486464296e4e7f996fc2140a664d407 (patch)
treed2855fef7c52bdb0758523dea50c2853d2d305f0 /lib
parent9089698e8df9d0c09c165c45eb6b05335a818699 (diff)
downloadcoinos-server-2a408a3a7486464296e4e7f996fc2140a664d407.tar.gz
coinos-server-2a408a3a7486464296e4e7f996fc2140a664d407.zip
ark
Diffstat (limited to 'lib')
-rw-r--r--lib/db.ts2
-rw-r--r--lib/invoices.ts15
-rw-r--r--lib/types.ts1
3 files changed, 15 insertions, 3 deletions
diff --git a/lib/db.ts b/lib/db.ts
index 12e89757..91770824 100644
--- a/lib/db.ts
+++ b/lib/db.ts
@@ -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",