API Reference
Complete API reference for the Hinkal Android SDK.
The SDK exposes free functions as static methods on Mobile, and a stateful surface through two classes: Client (connection and session) and Hinkal (operations), in the io.hinkal.mobile package. Data crosses the boundary as JSON strings and primitives; native methods declare throws Exception.
Client
The entry point. Create it, connect a wallet, then obtain the operations handle.
newClient
fun newClient(): ClientCreates a client with default configuration. Use newClientWithConfig(configJSON) to pass a JSON config.
connect
fun connect(host: HostWallet): StringRuns the session handshake: the wallet signs a message that unlocks the shielded account. Returns the connected wallet address.
connectSolana / connectTron
fun connectSolana(host: HostSolanaSigner, chainID: Long): String
fun connectTron(host: HostTronSigner, chainID: Long): StringConnect a Solana or Tron wallet.
connectWithPrivateKey
fun connectWithPrivateKey(privateKeyHex: String, chainID64: Long): StringHeadless EVM connect for tests and backends. Also connectWithSolanaPrivateKey(...), connectWithTronPrivateKey(...).
hinkal
fun hinkal(): HinkalReturns the operations handle for deposits, transfers, and the rest.
disconnect
fun disconnect()Clears the session.
getFeeStructureJSON
fun getFeeStructureJSON(chainID64: Long, feeTokenAddr: String, tokenAddrsJSON: String,
actionID: String, callsJSON: String, variableRateWei: String,
solanaParamsJSON: String): StringBuilds a fee structure for an operation. Pass the result as feeStructureJSON to a spend.
calculateTotalFee / calculateWithdrawalAmount
fun calculateTotalFee(amountWei: String, feeStructureJSON: String): String
fun calculateWithdrawalAmount(amountWithFeeWei: String, feeStructureJSON: String): StringFee math helpers.
getGasTokenSymbols
fun getGasTokenSymbols(chainID64: Long): StringReturns the gas token symbols for a chain.
Hinkal
Obtained from client.hinkal(). All amounts are base units (wei); token and amount lists are JSON-array strings.
Deposits
deposit
fun deposit(chainID: Long, tokenAddrsJSON: String, amountsWeiJSON: String,
preEstimateGas: Boolean, returnTxData: Boolean): StringPublic to private. Signed and broadcast through your host wallet. Returns the transaction hash (or tx data when returnTxData is true).
depositForOther
fun depositForOther(chainID: Long, tokenAddrsJSON: String, amountsWeiJSON: String,
recipientInfo: String, preEstimateGas: Boolean, returnTxData: Boolean): StringDeposit into another user's shielded balance. recipientInfo is their recipient-info string (from getRecipientInfo).
depositSolana / depositSolanaForOther
fun depositSolana(chainID: Long, tokenAddr: String, amountWei: String, returnTxData: Boolean): String
fun depositSolanaForOther(chainID: Long, tokenAddr: String, amountWei: String,
recipientInfo: String, returnTxData: Boolean): StringSolana deposit variants (single token).
prooflessDeposit
fun prooflessDeposit(chainID: Long, tokenAddrsJSON: String, amountsWeiJSON: String,
stealthAddressStructuresJSON: String, createBlockedUtxos: Boolean,
feeStructureJSON: String, orderID: String, returnTxData: Boolean): StringDeposit that defers proof generation (scheduled deposit-and-withdraw flows). See also prooflessDepositWithPublicFee(...).
Withdrawals & Transfers
withdraw
fun withdraw(chainID: Long, tokenAddrsJSON: String, amountsWeiJSON: String,
recipient: String, relayerOff: Boolean, feeToken: String,
feeStructureJSON: String): StringPrivate to public, via a Hinkal relayer. Returns the transaction hash.
transfer
fun transfer(chainID: Long, tokenAddrsJSON: String, amountsWeiJSON: String,
recipient: String, feeToken: String, feeStructureJSON: String): StringPrivate to private (to another Hinkal user's shielded balance). recipient is a Hinkal private address.
withdrawStuckUtxos
fun withdrawStuckUtxos(chainID: Long, tokenAddr: String, recipientAddress: String): StringRecovers UTXOs left stuck by an interrupted deposit-and-withdraw.
Swaps
swap / swapSolana
fun swap(chainID: Long, tokenAddrsJSON: String, amountsWeiJSON: String,
actionID: String, swapData: String, feeToken: String, feeStructureJSON: String): String
fun swapSolana(chainID: Long, tokenAddrsJSON: String, amountsWeiJSON: String,
swapData: String, feeToken: String, feeStructureJSON: String): StringSwap one token for another inside the shielded balance. Quote first with getEvmSwapPrices(...) / getSolanaSwapPrices(...).
getEvmSwapPrices / getSolanaSwapPrices
fun getEvmSwapPrices(chainID: Long, inAmount: String, inTokenAddr: String, outTokenAddr: String): String
fun getSolanaSwapPrices(chainID: Long, inAmount: String, inTokenAddr: String, outTokenAddr: String): StringReturns a swap quote (JSON) including the swapData you pass into swap.
Cross-chain
bridgePrivateToPrivate
fun bridgePrivateToPrivate(sourceChainID: Long, sourceTokenAddr: String, destChainID: Long,
destTokenAddr: String, amount: String, vaultAddress: String,
slippage: Double, feeToken: String): StringMoves shielded value from one chain to another (private to private). The funds land in a Hinkal deposit address on the destination chain, and the relayer shields them from there. Pass an empty vaultAddress to bridge to your own deposit address, or another Hinkal deposit address to bridge to its owner; any other address is rejected. An empty vaultAddress works only when both chains are in the same network family (EVM to EVM, for example). Between EVM, Solana and Tron, pass a deposit address explicitly, created with createReceiveAddress on the destination chain from a session connected to a wallet there; otherwise the call throws vaultAddress is required to bridge from <source> to <destination>.
createReceiveAddress
fun createReceiveAddress(chainID: Long, forceFresh: Boolean): StringReturns the caller's Hinkal deposit address on chainID as JSON (vaultAddress, index, network, expiry, version). It reuses the newest unexpired one unless forceFresh is true. To receive a private-to-private bridge from someone else, share its vaultAddress; they pass it as vaultAddress to bridgePrivateToPrivate. Deposit addresses are valid for 14 days after creation (expiry, unix seconds). Before sharing one, call again with forceFresh = true if expiry is less than 30 minutes away, so the bridge completes before it expires.
depositAndWithdraw / depositAndBridge / nearDepositAndBridge
fun depositAndWithdraw(chainID: Long, tokenAddr: String, recipientAmountsJSON: String,
recipientAddressesJSON: String, scheduleTimeSec: Long,
feeStructureJSON: String, preEstimateGas: Boolean): String
fun depositAndBridge(chainID: Long, tokenAddr: String, recipientsJSON: String,
scheduleTimeSec: Long, feeStructureJSON: String, preEstimateGas: Boolean): String
fun nearDepositAndBridge(chainID: Long, tokenAddr: String, recipientAmountsJSON: String,
recipientAddressesJSON: String, paramsJSON: String,
scheduleTimeSec: Long, feeStructureJSON: String): StringPublic-to-public and cross-chain routes. scheduleTimeSec schedules the second leg; poll checkSendTransactionStatus(...) with the scheduleId from the result.
getDepositAndBridgeQuote / depositAndBridgeWithQuote
fun getDepositAndBridgeQuote(chainID: Long, tokenAddr: String, destinationChainID: Long,
destinationTokenAddr: String, sendAmountsJSON: String,
recipientAddressesJSON: String, slippagePercent: Double,
scheduleTimeSec: Long): String
fun depositAndBridgeWithQuote(chainID: Long, tokenAddr: String, quoteJSON: String,
scheduleTimeSec: Long, feeStructureJSON: String): StringQuote, then run a public-to-public send across tokens, chains, or both. Pass the returned quoteJSON back unchanged; a negative slippagePercent uses the default.
getStuckBridgeBalances / recoverStuckBridgeBalance
fun getStuckBridgeBalances(chainIDsJSON: String): String
fun recoverStuckBridgeBalance(balanceJSON: String, recipientAddress: String)Funds left by a failed bridge or swap; "" checks all chains. Pass an entry back unchanged to recover it.
Claimables & status
claimUtxo / fetchClaimableUtxos
fun claimUtxo(chainID: Long, tokenAddr: String, handle: String,
feeStructureJSON: String, claimableSignature: String): String
fun fetchClaimableUtxos(chainID: Long, ethAddress: String, signature: String,
isSolanaLedger: Boolean, txMessageForSolanaLedger: String): StringList and claim claimable UTXOs (gift-style transfers).
checkSendTransactionStatus
fun checkSendTransactionStatus(scheduleID: String): StringPolls the status of a scheduled send.
emporiumOp
fun emporiumOp(contract: String, callDataString: String, invokeWallet: Boolean, valueWei: String): StringExecutes an arbitrary contract call through the private account (advanced).
waitForTransaction
fun waitForTransaction(chainID: Long, txHash: String, confirmations: Long, timeoutSec: Long): BooleanWaits for a transaction to reach the given confirmations, up to timeoutSec.
Balances & identity
getTotalBalance
fun getTotalBalance(chainID: Long, userKeysSignature: String, ethAddress: String,
resetCache: Boolean, useBlockedUtxos: Boolean): StringShielded balance per token (JSON). Pass resetCache = true to re-scan after a fund-moving operation.
getStuckShieldedBalances
fun getStuckShieldedBalances(chainID: Long, userKeysSignature: String, ethAddress: String): StringFunds stuck in unspendable UTXOs. Recover with withdrawStuckUtxos.
getRecipientInfo / getShieldedPublicKey / getSolanaPublicKey
fun getRecipientInfo(): String
fun getShieldedPublicKey(): String
fun getSolanaPublicKey(): StringIdentity accessors. getRecipientInfo returns the Hinkal private address to share for incoming private transfers.
getSupportedChains
fun getSupportedChains(): StringSupported chains for the connected identity (JSON).
initUserKeysWithSignature / initUserKeysFromSeedPhrases
fun initUserKeysWithSignature(signature: String)
fun initUserKeysFromSeedPhrases(seedPhrasesJSON: String)Derive the shielded identity from a signature or from seed phrases.
HostWallet
The interface your app implements so the SDK can sign without holding the key.
interface HostWallet {
fun address(): String
fun chainID(): Long
fun personalSign(message: String): String
fun sendTransaction(toHex: String, dataHex: String, valueDec: String, gasLimit: Long): String
fun switchChain(chainID: Long)
}For Solana and Tron, implement HostSolanaSigner (publicKey, signMessage(ByteArray), signTransaction(ByteArray)) or HostTronSigner (address, signMessage(String), signTxHash(ByteArray)).
Module Functions
Static methods on Mobile.
Amounts
fun amountToWei(chainID: Long, tokenAddr: String, amount: String): String
fun amountFromWei(chainID: Long, tokenAddr: String, amountWei: String): String
fun amountWithPrecision(chainID: Long, tokenAddr: String, amountWei: String, precision: Long): StringHuman to wei and back; amountWithPrecision formats to a fixed number of decimals.
Tokens
fun getTokensJSON(chainID: Long): String
fun resolveTokensJSON(chainID: Long, tokenAddrsJSON: String): String
fun resolveTokensLenientJSON(chainID: Long, tokenAddrsJSON: String): String
fun getSwapQuotesJSON(chainID64: Long, inAmount: String, inTokenAddr: String, outTokenAddr: String): StringToken catalog, resolution, and aggregated swap quotes. getSwapQuotesJSON picks the right provider per chain - LI.FI on EVM chains, OKX for shielded Solana swaps. LI.FI also covers Solana itself, used for cross-chain routes via getLifiBridgeQuoteJSON. Related helpers: getOKXQuoteJSON (Solana quote directly), getExternalSwapAddress (external action address for an action id).
Chains
fun supportedChainsJSON(): String
fun allSupportedChainsJSON(): String
fun walletSupportedChainsJSON(): String
fun bridgeSupportedChainsJSON(): String
fun chainIDsJSON(): String
fun networkJSON(chainID: Long): String
fun networkRegistryJSON(): String
fun hinkalWrapperAddress(chainID: Long): String
fun solanaChainID(): Long
fun tronChainID(): Long
fun solanaNativeTokenAddress(): StringChain predicates (return Boolean):
fun isEvmChain(chainID: Long): Boolean
fun isSolanaChain(chainID: Long): Boolean
fun isTronChain(chainID: Long): Boolean
fun isHinkalSupportedChain(chainID: Long): Boolean
fun isBridgeSupportedChain(chainID: Long): BooleanBridge quotes
fun getLifiBridgeQuoteJSON(sourceChainID: Long, destinationChainID: Long, sourceTokenAddr: String,
destinationTokenAddr: String, amount: String, slippage: Double,
fromAddress: String, toAddress: String): String
fun getNearIntentsQuoteJSON(requestJSON: String): String
fun getNearIntentsTokensJSON(): String
fun bridgeDestinationChainsJSON(sourceChainID: Long): StringQuotes and destination lists for cross-chain bridging.
Addresses & keys
fun isValidPrivateAddress(address: String): Boolean
fun newUserKeys(signature: String): UserKeys
fun userKeysFromNullifyingKey(nullifyingKey: String): UserKeys
fun getRecipientInfoFromSignature(signature: String): String
fun getStealthAddressStructureFromSignature(signature: String): String
fun newStealthAddressStructureJSON(privateAddress: String): StringValidate private addresses and derive keys / stealth-address structures from a signature.