diff options
| author | Adam Soltys <[email protected]> | 2026-02-24 13:18:42 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-24 13:18:42 -0800 |
| commit | ad7b09b43323d0ffc0a8ddabb43e4838a184c697 (patch) | |
| tree | fbf2a59f81771b2938f474c8e7b35a497d2960e4 /lib/ark.ts | |
| parent | 9e97e040617bfa0b40150c0eba298bf186bbeeaf (diff) | |
| download | coinos-server-ad7b09b43323d0ffc0a8ddabb43e4838a184c697.tar.gz coinos-server-ad7b09b43323d0ffc0a8ddabb43e4838a184c697.zip | |
formatting
Diffstat (limited to 'lib/ark.ts')
| -rw-r--r-- | lib/ark.ts | 29 |
1 files changed, 5 insertions, 24 deletions
@@ -2,13 +2,7 @@ import { EventSource } from "eventsource"; if (!globalThis.EventSource) globalThis.EventSource = EventSource; import config from "$config"; -import { - SingleKey, - Wallet, - Ramps, - RestArkProvider, - VtxoManager, -} from "@arkade-os/sdk"; +import { SingleKey, Wallet, Ramps, RestArkProvider, VtxoManager } from "@arkade-os/sdk"; import { l, warn } from "$lib/logging"; let wallet: any; @@ -31,9 +25,7 @@ const failedBoardingOutpoints = new Set<string>(); 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 refreshArkWallet = async (force = false) => { @@ -58,11 +50,7 @@ export const refreshArkWallet = async (force = false) => { // Recover swept/expired VTXOs if (balance.recoverable > 0) { try { - const txid = await withTimeout( - manager.recoverVtxos(), - 60_000, - "ark recovery", - ); + const txid = await withTimeout(manager.recoverVtxos(), 60_000, "ark recovery"); l("ark recovered swept vtxos, txid:", txid); } catch (e: any) { warn("ark vtxo recovery failed:", e.message); @@ -74,11 +62,7 @@ export const refreshArkWallet = async (force = false) => { const expiring = await manager.getExpiringVtxos(); if (expiring.length > 0) { l("ark renewing", expiring.length, "expiring vtxos"); - const txid = await withTimeout( - manager.renewVtxos(), - 60_000, - "ark renewal", - ); + const txid = await withTimeout(manager.renewVtxos(), 60_000, "ark renewal"); l("ark renewed vtxos, txid:", txid); } } catch (e: any) { @@ -98,10 +82,7 @@ export const refreshArkWallet = async (force = false) => { const outpointKey = (u: any) => `${u.txid}:${u.vout}`; const sorted = [...confirmed] .filter((u: any) => !failedBoardingOutpoints.has(outpointKey(u))) - .sort( - (a: any, b: any) => - (b.status?.block_height || 0) - (a.status?.block_height || 0), - ); + .sort((a: any, b: any) => (b.status?.block_height || 0) - (a.status?.block_height || 0)); for (const utxo of sorted) { try { |
