Usage
Parameters
syncTransfers / syncTransfersAsync accept an object with:
Return Value
SyncOnChainTransfersResponse
Example Implementation
How It Works
- Calls
POST /transactions/sync-on-chainon the backend - Backend reads the wallet’s ERC-20
Transferevents from Starknet (USDC, USDT, ETH and STRK), newest blocks first, then older history back to the wallet’s creation - Compares with existing DB records by transaction hash
- Saves new transfers to the
Transactiontable (read-through cache) - Returns
{ synced, total } - Invalidates
useGetTransactionListcache so new transfers appear immediately
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.
Related
- useGetTransactionList — Read the transaction list (includes synced transfers)
- useGetTransaction — Get a single transaction by hash
- useGetTransactionStatus — Poll transaction status
