From fddfe10f84908c058e239b93985dfe02ba37df04 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 14 Mar 2026 04:49:54 +0000 Subject: slow down ark checks --- lib/ark.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/ark.ts') diff --git a/lib/ark.ts b/lib/ark.ts index 5f695f6e..d24b0bc1 100644 --- a/lib/ark.ts +++ b/lib/ark.ts @@ -36,7 +36,7 @@ const getWallet = async () => { let refreshing = false; let lastRefresh = 0; -const REFRESH_COOLDOWN = 30_000; +const REFRESH_COOLDOWN = 300_000; let failedBoardingOutpoints = new Set(); const FAILED_BOARDING_KEY = "ark:failedBoardingOutpoints"; const loadFailedOutpoints = async () => { @@ -66,6 +66,7 @@ export const refreshArkWallet = async (force = false) => { lastRefresh = now; const w = await getWallet(); const balance = await w.getBalance(); + cachedArkBalance = balance; const manager = new VtxoManager(w); const provider = new RestArkProvider(config.ark.arkServerUrl); const info = await provider.getInfo(); @@ -184,8 +185,8 @@ export const refreshArkWallet = async (force = false) => { }; // Initial check after 60s startup delay; retry every 60s to catch ark rounds -setTimeout(refreshArkWallet, 60_000); -setInterval(() => refreshArkWallet(), 60_000); +setTimeout(refreshArkWallet, 300_000); +setInterval(() => refreshArkWallet(), 300_000); export const sendArk = async (address: string, amount: number) => { @@ -219,10 +220,9 @@ export const getArkAddress = async () => { return w.getAddress(); }; -export const getArkBalance = async () => { - const w = await getWallet(); - return w.getBalance(); -}; +let cachedArkBalance: any = null; + +export const getArkBalance = () => cachedArkBalance; export const verifyArkVtxo = async (hash: string) => { const { bech32m } = await import("@scure/base"); -- cgit v1.2.3