Skip to content

@armada/sdk / index / startAutoSync

Function: startAutoSync()

startAutoSync(run, options): () => void

Defined in: src/sync/auto-sync.ts:33

Drive run on a self-scheduling loop: fire once immediately, then re-schedule intervalMs after each run settles (never overlapping — the next tick waits for the current one). A throwing run does not kill the loop; it backs off exponentially from intervalMs up to maxBackoffMs, resetting to intervalMs on the next success. Returns a stop function that halts scheduling (an in-flight run finishes but never re-schedules); calling it more than once is safe.

Concurrency with manual runs is the caller's concern — wallet.sync() already coalesces overlapping runs, so a manual/post-tx refresh landing on top of a tick is safe.

Parameters

run

() => Promise<unknown>

options

AutoSyncOptions

Returns

() => void