Hinkal Mobile SDK
Performance
Guidance for keeping the SDK responsive in a mobile app.
Off the main thread
SDK operations do network and proof work. Call them off the main thread and update the UI on the main actor:
let txHash = try call {
hinkal.deposit(chainId, tokenAddrsJSON: tokens, amountsWeiJSON: amounts,
preEstimateGas: true, returnTxData: false, error: &$0)
}Cache balances
getTotalBalance scans UTXOs. Cache the result and only re-scan when needed:
- Read with
resetCache: falsefor normal UI reads. - Pass
resetCache: trueafter a deposit, withdrawal, transfer, or swap.
Reuse the client and session
A session lasts across many operations. Create the MobileClient once, connect once, and reuse the MobileHinkal handle - avoid reconnecting per operation.
Batch where possible
Because tokens and amounts are JSON arrays, deposit multiple tokens in a single call rather than issuing separate deposits.