loadTinOwnerBalanceV1 to build the connected owner’s balance view. The SDK validates the TIP registry account, unlocks the owner’s encrypted seed locally with wallet approval, and reconstructs balances from finalized TCAP activity.
Before you start
- Build the workspace SDK and connect the wallet that owns the registered TIN. The wallet must support
signMessage. - Configure a Solana RPC for the selected TSN deployment with access to finalized accounts, address signature history and raw transactions.
- Supply an authenticated
TinOwnerIdentityClientor theregistry,programIdanddisplayNamefrom your verified owner context. The SDK checks registry ownership, the registered wallet commitment and the current GPRU keys on chain.
post(path, body) for /owner-tin-identity-challenge and /owner-tin-identity. The XP reference application serves those routes under /api/tsn/sdk, with the active wallet session and CSRF headers. They belong to the application backend. The one-time lookup signature goes to that service, while the reusable seed-access signature and decrypted seed stay on the device. Owner balance API
Load and display the balance
Copy the example into your app and call it when the owner opens or refreshes the balance view. TypeScript exampletokenBalances entry, using its mint, decimals and the example’s displayBalance. The SDK returns balanceBaseUnits as a decimal string. Format it with integer arithmetic to preserve precision. The remaining response fields are latestGlobalSequence, latestOwnerSequence and actionCount.
On a cold session the wallet can prompt for identity lookup and local seed access. The opted-in cache reuses the verified identity context and seed-access signature in device memory. It clears on wallet disconnect or account change when the adapter exposes those events. Call clearTinOwnerBalanceAccessV1(wallet) at application logout. Access and cache functions
Handle unavailable history
Show an empty balance view only after a successful read returns an emptytokenBalances array. If the call rejects, show Balance unavailable. An interrupted RPC scan, unsupported receipt, invalid owner context or changing shared root can all prevent recovery. Refresh against a current finalized snapshot after the error, or use an RPC with complete history for the deployment.
The current reader bounds its scan to 100 pages of up to 100 address signatures and validates that the decoded credit and TIN-to-TIN transitions reach the finalized root in order. If it cannot reconstruct that history within the bound, the read fails. Chain history API