API Reference
Complete API reference for the Hinkal iOS SDK.
The SDK exposes free functions as Mobile-prefixed Swift symbols, and a stateful surface through two classes: MobileClient (connection and session) and MobileHinkal (operations). Data crosses the boundary as JSON strings and primitives.
The framework is generated by gomobile, so a failing call takes a trailing error: NSErrorPointer out-parameter rather than Swift throws. Signatures below show throws for readability; at the call site pass error: &err (or wrap with the call helper from Getting Started).
MobileClient
The entry point. Create it, connect a wallet, then obtain the operations handle.
MobileNewClient
func MobileNewClient() -> MobileClient?Creates a client with default configuration. Use MobileNewClientWithConfig(_:) to pass a JSON config.
connect
func connect(_ host: MobileHostWalletProtocol?) throws -> StringRuns the session handshake: the wallet signs a message that unlocks the shielded account. Returns the connected wallet address.
connectSolana
func connectSolana(_ host: MobileHostSolanaSignerProtocol?, chainID: Int64) throws -> StringConnects a Solana wallet.
connectTron
func connectTron(_ host: MobileHostTronSignerProtocol?, chainID: Int64) throws -> StringConnects a Tron wallet.
connect(withPrivateKey:chainID64:)
func connect(withPrivateKey privateKeyHex: String?, chainID64: Int64, error: NSErrorPointer) -> StringHeadless EVM connect for tests and backends. Solana/Tron variants: connect(withSolanaPrivateKey:chainID:), connect(withTronPrivateKey:chainID:).
hinkal
func hinkal() -> MobileHinkal?Returns the operations handle for deposits, transfers, and the rest.
disconnect
func disconnect() throwsClears the session.
getFeeStructureJSON
func getFeeStructureJSON(_ chainID64: Int64, feeTokenAddr: String?, tokenAddrsJSON: String?,
actionID: String?, callsJSON: String?, variableRateWei: String?,
solanaParamsJSON: String?, error: NSErrorPointer) -> StringBuilds a fee structure for an operation. Pass the result as feeStructureJSON to a spend.
calculateTotalFee / calculateWithdrawalAmount
func calculateTotalFee(_ amountWei: String?, feeStructureJSON: String?, error: NSErrorPointer) -> String
func calculateWithdrawalAmount(_ amountWithFeeWei: String?, feeStructureJSON: String?, error: NSErrorPointer) -> StringFee math helpers: total fee for an amount, and the net withdrawal amount after fees.
getGasTokenSymbols
func getGasTokenSymbols(_ chainID64: Int64, error: NSErrorPointer) -> StringReturns the gas token symbols for a chain.
MobileHinkal
Obtained from client.hinkal(). All amounts are base units (wei); token and amount lists are JSON-array strings.
Deposits
deposit
func deposit(_ chainID: Int64, tokenAddrsJSON: String?, amountsWeiJSON: String?,
preEstimateGas: Bool, returnTxData: Bool) throws -> StringPublic to private. Signed and broadcast through your host wallet. Returns the transaction hash (or tx data when returnTxData is true).
deposit(forOther:)
func deposit(forOther chainID: Int64, tokenAddrsJSON: String?, amountsWeiJSON: String?,
recipientInfo: String?, preEstimateGas: Bool, returnTxData: Bool) throws -> StringDeposit into another user's shielded balance. recipientInfo is their recipient-info string (from getRecipientInfo).
depositSolana / depositSolanaForOther
func depositSolana(_ chainID: Int64, tokenAddr: String?, amountWei: String?, returnTxData: Bool) throws -> String
func depositSolanaForOther(_ chainID: Int64, tokenAddr: String?, amountWei: String?,
recipientInfo: String?, returnTxData: Bool) throws -> StringSolana deposit variants (single token).
prooflessDeposit
func prooflessDeposit(_ chainID: Int64, tokenAddrsJSON: String?, amountsWeiJSON: String?,
stealthAddressStructuresJSON: String?, createBlockedUtxos: Bool,
feeStructureJSON: String?, orderID: String?, returnTxData: Bool) throws -> StringDeposit that defers proof generation (used by scheduled deposit-and-withdraw flows). See also prooflessDepositWithPublicFee(...).
Withdrawals & Transfers
withdraw
func withdraw(_ chainID: Int64, tokenAddrsJSON: String?, amountsWeiJSON: String?,
recipient: String?, relayerOff: Bool, feeToken: String?,
feeStructureJSON: String?) throws -> StringPrivate to public, via a Hinkal relayer. Returns the transaction hash.
transfer
func transfer(_ chainID: Int64, tokenAddrsJSON: String?, amountsWeiJSON: String?,
recipient: String?, feeToken: String?, feeStructureJSON: String?) throws -> StringPrivate to private (to another Hinkal user's private balance). recipient is a Hinkal private address.
withdrawStuckUtxos
func withdrawStuckUtxos(_ chainID: Int64, tokenAddr: String?, recipientAddress: String?) throws -> StringRecovers UTXOs left stuck by an interrupted deposit-and-withdraw.
Swaps
swap / swapSolana
func swap(_ chainID: Int64, tokenAddrsJSON: String?, amountsWeiJSON: String?,
actionID: String?, swapData: String?, feeToken: String?,
feeStructureJSON: String?) throws -> String
func swapSolana(_ chainID: Int64, tokenAddrsJSON: String?, amountsWeiJSON: String?,
swapData: String?, feeToken: String?, feeStructureJSON: String?) throws -> StringSwap one token for another inside the shielded balance. Quote first with getEvmSwapPrices(...) / getSolanaSwapPrices(...).
getEvmSwapPrices / getSolanaSwapPrices
func getEvmSwapPrices(_ chainID: Int64, inAmount: String?, inTokenAddr: String?, outTokenAddr: String?) throws -> String
func getSolanaSwapPrices(_ chainID: Int64, inAmount: String?, inTokenAddr: String?, outTokenAddr: String?) throws -> StringReturns a swap quote (JSON) including the swapData you pass into swap.
Cross-chain
bridgePrivate(toPrivate:)
func bridgePrivate(toPrivate sourceChainID: Int64, sourceTokenAddr: String?,
destChainID: Int64, destTokenAddr: String?, amount: String?,
vaultAddress: String?, slippage: Double, feeToken: String?) throws -> 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
func createReceiveAddress(_ chainID: Int64, forceFresh: Bool) throws -> 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 bridgePrivate(toPrivate:). 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
func depositAndWithdraw(_ chainID: Int64, tokenAddr: String?, recipientAmountsJSON: String?,
recipientAddressesJSON: String?, scheduleTimeSec: Int64,
feeStructureJSON: String?, preEstimateGas: Bool) throws -> String
func depositAndBridge(_ chainID: Int64, tokenAddr: String?, recipientsJSON: String?,
scheduleTimeSec: Int64, feeStructureJSON: String?, preEstimateGas: Bool) throws -> String
func nearDepositAndBridge(_ chainID: Int64, tokenAddr: String?, recipientAmountsJSON: String?,
recipientAddressesJSON: String?, paramsJSON: String?,
scheduleTimeSec: Int64, feeStructureJSON: String?) throws -> StringPublic-to-public and cross-chain routes. scheduleTimeSec schedules the second leg; poll checkSendTransactionStatus(...) with the scheduleId from the result.
getDepositAndBridgeQuote / depositAndBridgeWithQuote
func getDepositAndBridgeQuote(_ chainID: Int64, tokenAddr: String?, destinationChainID: Int64,
destinationTokenAddr: String?, sendAmountsJSON: String?,
recipientAddressesJSON: String?, slippagePercent: Double,
scheduleTimeSec: Int64) throws -> String
func depositAndBridgeWithQuote(_ chainID: Int64, tokenAddr: String?, quoteJSON: String?,
scheduleTimeSec: Int64, feeStructureJSON: String?) throws -> 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
func getStuckBridgeBalances(_ chainIDsJSON: String?) throws -> String
func recoverStuckBridgeBalance(_ balanceJSON: String?, recipientAddress: String?) throwsFunds left by a failed bridge or swap; "" checks all chains. Pass an entry back unchanged to recover it.
Claimable UTXOs & status
claimUtxo / fetchClaimableUtxos
func claimUtxo(_ chainID: Int64, tokenAddr: String?, handle: String?,
feeStructureJSON: String?, claimableSignature: String?) throws -> String
func fetchClaimableUtxos(_ chainID: Int64, ethAddress: String?, signature: String?,
isSolanaLedger: Bool, txMessageForSolanaLedger: String?) throws -> StringList and claim claimable UTXOs (gift-style transfers).
checkSendTransactionStatus
func checkSendTransactionStatus(_ scheduleID: String?) throws -> StringPolls the status of a scheduled send (deposit-and-withdraw / bridge).
emporiumOp
func emporiumOp(_ contract: String?, callDataString: String?, invokeWallet: Bool, valueWei: String?) throws -> StringExecutes an arbitrary contract call through the shielded account (advanced).
Balances & identity
getTotalBalance
func getTotalBalance(_ chainID: Int64, userKeysSignature: String?, ethAddress: String?,
resetCache: Bool, useBlockedUtxos: Bool) throws -> StringShielded balance per token (JSON). Pass resetCache: true to re-scan after a fund-moving operation.
getStuckShieldedBalances
func getStuckShieldedBalances(_ chainID: Int64, userKeysSignature: String?, ethAddress: String?) throws -> StringFunds stuck in unspendable UTXOs. Recover with withdrawStuckUtxos.
getRecipientInfo / getShieldedPublicKey / getSolanaPublicKey
func getRecipientInfo() throws -> String
func getShieldedPublicKey() throws -> String
func getSolanaPublicKey() throws -> StringIdentity accessors. getRecipientInfo returns the Hinkal private address to share for incoming private transfers.
getSupportedChains
func getSupportedChains() throws -> StringSupported chains for the connected identity (JSON).
initUserKeys(withSignature:) / initUserKeysFromSeedPhrases
func initUserKeys(withSignature signature: String?)
func initUserKeysFromSeedPhrases(_ seedPhrasesJSON: String?) throwsDerive the shielded identity from a signature or from seed phrases.
MobileHostWalletProtocol
The protocol your app implements so the SDK can sign without holding the key. Most methods use an error: NSErrorPointer out-parameter; only switchChain is throws.
protocol MobileHostWalletProtocol {
func address(_ error: NSErrorPointer) -> String
func chainID() -> Int64
func personalSign(_ message: String?, error: NSErrorPointer) -> String
func sendTransaction(_ toHex: String?, dataHex: String?, valueDec: String?,
gasLimit: Int64, error: NSErrorPointer) -> String
func switchChain(_ chainID: Int64) throws
}For Solana and Tron, implement MobileHostSolanaSignerProtocol or MobileHostTronSignerProtocol (their publicKey/address use the error: out-parameter; the signing methods are throws and return non-optional Data).
Module Functions
Amounts
func MobileAmountToWei(_ chainID: Int64, _ tokenAddr: String?, _ amount: String?) throws -> String
func MobileAmountFromWei(_ chainID: Int64, _ tokenAddr: String?, _ amountWei: String?) throws -> String
func MobileAmountWithPrecision(_ chainID: Int64, _ tokenAddr: String?, _ amountWei: String?, _ precision: Int64) throws -> StringHuman to wei and back; MobileAmountWithPrecision formats to a fixed number of decimals.
Tokens
func MobileGetTokensJSON(_ chainID: Int64) throws -> String
func MobileResolveTokensJSON(_ chainID: Int64, _ tokenAddrsJSON: String?) throws -> String
func MobileResolveTokensLenientJSON(_ chainID: Int64, _ tokenAddrsJSON: String?) throws -> String
func MobileGetSwapQuotesJSON(_ chainID64: Int64, _ inAmount: String?, _ inTokenAddr: String?, _ outTokenAddr: String?) throws -> StringToken catalog, resolution, and aggregated swap quotes. MobileGetSwapQuotesJSON 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 MobileGetLifiBridgeQuoteJSON. Related helpers: MobileGetOKXQuoteJSON (Solana quote directly), MobileGetExternalSwapAddress (external action address for an action id).
Chains
func MobileSupportedChainsJSON() throws -> String
func MobileAllSupportedChainsJSON() throws -> String
func MobileWalletSupportedChainsJSON() throws -> String
func MobileBridgeSupportedChainsJSON() throws -> String
func MobileChainIDsJSON() throws -> String
func MobileNetworkJSON(_ chainID: Int64) throws -> String
func MobileNetworkRegistryJSON() throws -> String
func MobileHinkalWrapperAddress(_ chainID: Int64) throws -> String
func MobileSolanaChainID() -> Int64
func MobileTronChainID() -> Int64
func MobileSolanaNativeTokenAddress() -> StringChain predicates (return Bool, no throw):
func MobileIsEvmChain(_ chainID: Int64) -> Bool
func MobileIsSolanaChain(_ chainID: Int64) -> Bool
func MobileIsTronChain(_ chainID: Int64) -> Bool
func MobileIsHinkalSupportedChain(_ chainID: Int64) -> Bool
func MobileIsBridgeSupportedChain(_ chainID: Int64) -> BoolBridge quotes
func MobileGetLifiBridgeQuoteJSON(...) throws -> String
func MobileGetNearIntentsQuoteJSON(...) throws -> String
func MobileGetNearIntentsTokensJSON(...) throws -> String
func MobileBridgeDestinationChainsJSON(_ sourceChainID: Int64) throws -> StringQuotes and destination lists for cross-chain bridging.
Addresses & keys
func MobileIsValidPrivateAddress(_ address: String?) -> Bool
func MobileNewUserKeys(_ signature: String?) -> MobileUserKeys?
func MobileUserKeysFromNullifyingKey(_ nullifyingKey: String?) -> MobileUserKeys?
func MobileGetRecipientInfoFromSignature(_ signature: String?) throws -> String
func MobileGetStealthAddressStructureFromSignature(_ signature: String?) throws -> String
func MobileNewStealthAddressStructureJSON(_ privateAddress: String?) throws -> StringValidate private addresses and derive keys / stealth-address structures from a signature.