Skip to main content

Usage

Parameters

syncTransfers / syncTransfersAsync accept an object with:

Return Value

SyncOnChainTransfersResponse

Example Implementation

How It Works

  1. Calls POST /transactions/sync-on-chain on the backend
  2. Backend reads the wallet’s ERC-20 Transfer events from Starknet (USDC, USDT, ETH and STRK), newest blocks first, then older history back to the wallet’s creation
  3. Compares with existing DB records by transaction hash
  4. Saves new transfers to the Transaction table (read-through cache)
  5. Returns { synced, total }
  6. Invalidates useGetTransactionList cache so new transfers appear immediately
After sync, useGetTransactionList returns both SDK-initiated transfers AND external receives.

When to Use

  • On wallet load: Sync once when user opens their wallet to discover any external receives
  • Pull-to-refresh: Let users manually trigger sync
  • After receiving funds: If user expects incoming funds from an external wallet
Synced transfers are cached in the database, and the backend remembers which blocks it already read for each wallet. Subsequent calls only read new blocks.

Limitations

  • Only discovers USDC, USDT, ETH and STRK transfers. USDC.e and WBTC use an older event format that cannot be filtered by wallet, so they are not synced. Contract interactions without transfers are not synced either.
  • One transaction is stored once, even if it moves several tokens.
  • The first sync of an old wallet reads its history over several calls (each call has a time budget); new transfers show up on the first call. Avoid calling sync on every render.