How it Works
- Instant Recording: The moment the Stellar network accepts a transaction, Sorokit saves the hash, address, and contract metadata to the browser’s
localStorage. - Automatic Recovery: When the
SorokitProvidermounts (such as after a page reload), it scans for any pending transactions in the storage. - Background Polling: If pending transactions are found, Sorokit automatically resumes polling the network in the background to find their outcome.
- Cache Sync: Once a recovered transaction completes, Sorokit invalidates the relevant queries. This ensures the user’s balance and contract data update automatically, even if the user is on a different page than where they started the transaction.
User Experience Benefits
- No Ghost Transactions: Users will not be left wondering if their transaction went through after a refresh.
- Consistent UI: Your app’s data remains the source of truth regardless of browser lifecycle events.
- Automatic Clean-up: Once a transaction settles or becomes too old (over 10 minutes), it is automatically removed from the local storage to keep the browser environment clean.
Developer Integration
There is no manual code required to enable this feature. It is built into the core logic ofuseContractSend and SorokitProvider.
- Every transaction sent via
useContractSendis automatically tracked. - Tracking begins the millisecond the
SUBMITTINGstate is reached. - Tracking ends only when a final
SUCCESSorERRORis determined.

