For the complete documentation index, see llms.txt. This page is also available as Markdown.

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 -> String

Runs 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 -> String

Connects a Solana wallet.

connectTron

func connectTron(_ host: MobileHostTronSignerProtocol?, chainID: Int64) throws -> String

Connects a Tron wallet.

connect(withPrivateKey:chainID64:)

Headless EVM connect for tests and backends. Solana/Tron variants: connect(withSolanaPrivateKey:chainID:), connect(withTronPrivateKey:chainID:).

hinkal

Returns the operations handle for deposits, transfers, and the rest.

disconnect

Clears the session.

getFeeStructureJSON

Builds a fee structure for an operation. Pass the result as feeStructureJSON to a spend.

calculateTotalFee / calculateWithdrawalAmount

Fee math helpers: total fee for an amount, and the net withdrawal amount after fees.

getGasTokenSymbols

Returns 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

Public to private. Signed and broadcast through your host wallet. Returns the transaction hash (or tx data when returnTxData is true).

deposit(forOther:)

Deposit into another user's shielded balance. recipientInfo is their recipient-info string (from getRecipientInfo).

depositSolana / depositSolanaForOther

Solana deposit variants (single token).

prooflessDeposit

Deposit that defers proof generation (used by scheduled deposit-and-withdraw flows). See also prooflessDepositWithPublicFee(...).

Withdrawals & Transfers

withdraw

Private to public, via a Hinkal relayer. Returns the transaction hash.

transfer

Private to private (to another Hinkal user's private balance). recipient is a Hinkal private address.

withdrawStuckUtxos

Recovers UTXOs left stuck by an interrupted deposit-and-withdraw.

Swaps

swap / swapSolana

Swap one token for another inside the shielded balance. Quote first with getEvmSwapPrices(...) / getSolanaSwapPrices(...).

getEvmSwapPrices / getSolanaSwapPrices

Returns a swap quote (JSON) including the swapData you pass into swap.

Cross-chain

bridgePrivate(toPrivate:)

Moves shielded value from one chain to another (private to private).

depositAndWithdraw / depositAndBridge / nearDepositAndBridge

Public-to-public and cross-chain routes. scheduleTimeSec schedules the second leg; poll checkSendTransactionStatus(...).

Claimable UTXOs & status

claimUtxo / fetchClaimableUtxos

List and claim claimable UTXOs (gift-style transfers).

checkSendTransactionStatus

Polls the status of a scheduled send (deposit-and-withdraw / bridge).

emporiumOp

Executes an arbitrary contract call through the shielded account (advanced).

Balances & identity

getTotalBalance

Shielded balance per token (JSON). Pass resetCache: true to re-scan after a fund-moving operation.

getStuckShieldedBalances

Funds stuck in unspendable UTXOs. Recover with withdrawStuckUtxos.

getRecipientInfo / getShieldedPublicKey / getSolanaPublicKey

Identity accessors. getRecipientInfo returns the Hinkal private address to share for incoming private transfers.

getSupportedChains

Supported chains for the connected identity (JSON).

initUserKeys(withSignature:) / initUserKeysFromSeedPhrases

Derive 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.

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

Human to wei and back; MobileAmountWithPrecision formats to a fixed number of decimals.

Tokens

Token catalog, resolution, and aggregated swap quotes. DEX-specific quote helpers also exist: MobileGetOneInchQuoteJSON, MobileGetOdosQuoteJSON, MobileGetOKXQuoteJSON, MobileGetUniswapQuoteJSON, MobileGetExternalSwapAddress.

Chains

Chain predicates (return Bool, no throw):

Bridge quotes

Quotes and destination lists for cross-chain bridging.

Addresses & keys

Validate private addresses and derive keys / stealth-address structures from a signature.

Last updated