aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-01 12:45:52 -0800
committerAdam Soltys <[email protected]>2026-03-01 12:45:52 -0800
commit5db704c583904a941e4a99f9c43fef2128207e92 (patch)
treed9c096acbcecadd1bc8bf5f64ca28fa6c62148a7
parent51e01eb2dc6e7976963c31b9349c4e621c535874 (diff)
downloadcoinos-server-5db704c583904a941e4a99f9c43fef2128207e92.tar.gz
coinos-server-5db704c583904a941e4a99f9c43fef2128207e92.zip
wallet check
-rw-r--r--lib/ark.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/ark.ts b/lib/ark.ts
index 25d39d4d..23824a62 100644
--- a/lib/ark.ts
+++ b/lib/ark.ts
@@ -115,13 +115,15 @@ export const sendArk = async (address: string, amount: number) => {
setTimeout(() => reject(new Error("Ark send timed out")), 60000),
);
const send = async () => {
- const w = await getWallet();
+ let w = await getWallet();
try {
return await w.sendBitcoin({ address, amount });
} catch (e: any) {
- if (/insufficient funds/i.test(e.message)) {
- l("ark send got insufficient funds, refreshing wallet and retrying");
+ if (/insufficient funds/i.test(e.message) || /VTXO_RECOVERABLE/i.test(e.message) || /VTXO_ALREADY_SPENT/i.test(e.message) || /VTXO_ALREADY_REGISTERED/i.test(e.message)) {
+ l("ark send failed:", e.message, "— recreating wallet and retrying");
+ wallet = null;
await refreshArkWallet(true);
+ w = await getWallet();
return w.sendBitcoin({ address, amount });
}
throw e;