From 6e0cb4603200e494228e788c43793bc3ee4956ca Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 26 Feb 2026 14:11:24 -0800 Subject: lint remotely --- .github/workflows/lint.yml | 8 +++++++- .husky/pre-commit | 1 - src/lib/ark.ts | 31 +++++++++++++++++++++---------- src/lib/utils.ts | 3 ++- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c7c9dd41..23049352 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,6 +10,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref || github.ref_name }} + token: ${{ secrets.GITHUB_TOKEN }} - uses: oven-sh/setup-bun@v2 - run: bun install --frozen-lockfile - - run: bun run lint + - run: bun run lint:fix + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "style: auto-fix lint & formatting" diff --git a/.husky/pre-commit b/.husky/pre-commit index ea5a55b6..e69de29b 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +0,0 @@ -bunx lint-staged 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