aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-09 01:19:33 -0800
committerAdam Soltys <[email protected]>2026-02-09 01:19:33 -0800
commit6f933c6e989f934364a276815826364fec5a85b4 (patch)
tree54e5b7818250a8cadcbb20111f24c9a5ee4bc674 /lib
parent3cde20ead47bf2fc895ea37789b824098b984f7a (diff)
downloadcoinos-server-6f933c6e989f934364a276815826364fec5a85b4.tar.gz
coinos-server-6f933c6e989f934364a276815826364fec5a85b4.zip
ark fixes
Diffstat (limited to 'lib')
-rw-r--r--lib/ark.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/ark.ts b/lib/ark.ts
index 44fa4fdd..00ea4db4 100644
--- a/lib/ark.ts
+++ b/lib/ark.ts
@@ -30,3 +30,16 @@ export const getArkBalance = async () => {
const w = await getWallet();
return w.getBalance();
};
+
+export const verifyArkVtxo = async (hash: string) => {
+ const { bech32m } = await import("@scure/base");
+ const serverAddr = await getArkAddress();
+ const decoded = bech32m.decode(serverAddr, 1023);
+ const words = new Uint8Array(bech32m.fromWords(decoded.words));
+ const vtxoHex = Buffer.from(words.slice(33, 65)).toString("hex");
+ const r = await fetch(
+ `http://arkd:7070/v1/indexer/vtxos?scripts=5120${vtxoHex}&spendable_only=true`,
+ );
+ const { vtxos } = await r.json();
+ return vtxos?.some((v: any) => v.outpoint?.txid === hash) ?? false;
+};