From 6e0cb4603200e494228e788c43793bc3ee4956ca Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 26 Feb 2026 14:11:24 -0800 Subject: lint remotely --- src/lib/ark.ts | 31 +++++++++++++++++++++---------- src/lib/utils.ts | 3 ++- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'src/lib') diff --git a/src/lib/ark.ts b/src/lib/ark.ts index 6685f3ab..15d96e3a 100644 --- a/src/lib/ark.ts +++ b/src/lib/ark.ts @@ -65,18 +65,13 @@ export const subscribeToAsp = (onEvent: () => void) => { if (!res.ok) throw new Error(`ASP subscribe failed: ${res.statusText}`); ({ subscriptionId: subId } = await res.json()); - es = new EventSource( - `${arkServerUrl}/v1/indexer/script/subscription/${subId}`, - ); + es = new EventSource(`${arkServerUrl}/v1/indexer/script/subscription/${subId}`); es.onmessage = (event) => { try { const data = JSON.parse(event.data); console.log("[ark] SSE event:", data); - if ( - data.event?.newVtxos?.length > 0 || - data.event?.spentVtxos?.length > 0 - ) { + if (data.event?.newVtxos?.length > 0 || data.event?.spentVtxos?.length > 0) { onEvent(); } } catch (e) { @@ -249,7 +244,10 @@ export const sendArk = async (address: string, amount: number) => { try { txid = await withTimeout(wallet.sendBitcoin({ address, amount }), 45_000, "Ark send"); } catch (e: any) { - if (e?.message?.includes("VTXO_ALREADY_REGISTERED") || e?.message?.includes("VTXO_ALREADY_SPENT")) { + if ( + e?.message?.includes("VTXO_ALREADY_REGISTERED") || + e?.message?.includes("VTXO_ALREADY_SPENT") + ) { console.log("ark send: stale VTXOs, recreating wallet and retrying"); walletInstance = undefined; walletKey = undefined; @@ -257,7 +255,11 @@ export const sendArk = async (address: string, amount: number) => { if (!sendWallet) throw new Error("Ark wallet not available after refresh"); const vtxos = await sendWallet.getVtxos({ spendableOnly: false }); if (vtxos?.length) addProcessedVtxos(vtxos.map(vtxoKey)); - txid = await withTimeout(sendWallet.sendBitcoin({ address, amount }), 45_000, "Ark send retry"); + txid = await withTimeout( + sendWallet.sendBitcoin({ address, amount }), + 45_000, + "Ark send retry", + ); } else { throw e; } @@ -266,7 +268,16 @@ export const sendArk = async (address: string, amount: number) => { // Verify the send actually changed the balance const postBalance = await sendWallet.getBalance(); const postSendTotal = (postBalance.available || 0) + (postBalance.preconfirmed || 0); - console.log("ark send: pre-balance", preSendTotal, "post-balance", postSendTotal, "amount", amount, "txid", txid); + console.log( + "ark send: pre-balance", + preSendTotal, + "post-balance", + postSendTotal, + "amount", + amount, + "txid", + txid, + ); if (postSendTotal >= preSendTotal) { throw new Error("Send failed: balance unchanged after sendBitcoin"); } diff --git a/src/lib/utils.ts b/src/lib/utils.ts index dc239739..4bf96d6e 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -332,7 +332,8 @@ export const f = ( maximumFractionDigits = 2, ) => { const cur = currency || "USD"; - const l = typeof locale === "function" ? (locale as () => string)() : locale || localeMap[cur] || "en-US"; + const l = + typeof locale === "function" ? (locale as () => string)() : locale || localeMap[cur] || "en-US"; const region = l.length >= 2 ? l.slice(-2) : ""; const currencyDisplay = region && cur.startsWith(region) ? "narrowSymbol" : "symbol"; return new Intl.NumberFormat(l, { -- cgit v1.2.3