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 from a coroutine on a background dispatcher and update the UI on the main thread:
viewModelScope.launch(Dispatchers.IO) {
val txHash = hinkal.deposit(chainId, tokens, amounts, true, false)
withContext(Dispatchers.Main) { updateUi(txHash) }
}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 Client once, connect once, and reuse the Hinkal 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.