aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ark.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-24 13:01:02 -0800
committerAdam Soltys <[email protected]>2026-02-24 13:01:02 -0800
commitdb59579a2efa8416f78c855faa7d7e62048447e5 (patch)
tree28444081de0120f21f7596198937bdd52fe43495 /src/lib/ark.ts
parent7eec7ac0b322b510b4e2cedef62422b6043d6405 (diff)
downloadcoinos-ui-db59579a2efa8416f78c855faa7d7e62048447e5.tar.gz
coinos-ui-db59579a2efa8416f78c855faa7d7e62048447e5.zip
lint
Diffstat (limited to 'src/lib/ark.ts')
-rw-r--r--src/lib/ark.ts22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/lib/ark.ts b/src/lib/ark.ts
index a3939a40..82d1ccce 100644
--- a/src/lib/ark.ts
+++ b/src/lib/ark.ts
@@ -104,7 +104,11 @@ export const syncTransactions = async (aid: string) => {
if (arkSending) return;
const p = _syncTransactions(aid);
syncPromise = p;
- try { return await p; } finally { if (syncPromise === p) syncPromise = null; }
+ try {
+ return await p;
+ } finally {
+ if (syncPromise === p) syncPromise = null;
+ }
};
export const vtxoKey = (v: { txid: string; vout: number }) => `${v.txid}:${v.vout}`;
@@ -131,9 +135,7 @@ let syncPromise: Promise<any> | null = null;
const withTimeout = <T>(promise: Promise<T>, ms: number, label: string) =>
Promise.race([
promise,
- new Promise<T>((_, reject) =>
- setTimeout(() => reject(new Error(`${label} timed out`)), ms),
- ),
+ new Promise<T>((_, reject) => setTimeout(() => reject(new Error(`${label} timed out`)), ms)),
]);
export const sendArk = async (address: string, amount: number) => {
@@ -158,21 +160,13 @@ export const sendArk = async (address: string, amount: number) => {
}
let txid;
try {
- txid = await withTimeout(
- wallet.sendBitcoin({ address, amount }),
- 45_000,
- "Ark send",
- );
+ txid = await withTimeout(wallet.sendBitcoin({ address, amount }), 45_000, "Ark send");
} catch (e: any) {
if (e?.message?.includes("VTXO_ALREADY_REGISTERED")) {
await wallet.settle();
const vtxos = await wallet.getVtxos({ spendableOnly: false });
if (vtxos?.length) addProcessedVtxos(vtxos.map(vtxoKey));
- txid = await withTimeout(
- wallet.sendBitcoin({ address, amount }),
- 45_000,
- "Ark send retry",
- );
+ txid = await withTimeout(wallet.sendBitcoin({ address, amount }), 45_000, "Ark send retry");
} else {
throw e;
}