Hinkal Mobile SDK

Multi-Chain

The SDK works across TRON, Solana, and EVM chains. Chain helpers let you discover supported chains and branch on chain type, and bridge operations move shielded value between chains.

Discovering chains

val supported = Mobile.supportedChainsJSON()   // JSON of supported chains
val isEvm = Mobile.isEvmChain(chainId)

Related helpers: Mobile.allSupportedChainsJSON(), Mobile.walletSupportedChainsJSON(), Mobile.bridgeSupportedChainsJSON(), Mobile.isTronChain(...), Mobile.isSolanaChain(...), Mobile.networkJSON(...).

Connecting per chain type

  • EVM: client.connect(HostWallet)
  • Solana: client.connectSolana(HostSolanaSigner, chainID)
  • Tron: client.connectTron(HostTronSigner, chainID)

Bridging

Move shielded value from one chain to another:

let txHash = try call {
    hinkal.bridgePrivate(
        toPrivate: sourceChainId,
        sourceTokenAddr: sourceToken,
        destChainID: destChainId,
        destTokenAddr: destToken,
        amount: amountWei,
        vaultAddress: vaultAddress, // "" = your own deposit address (same network family only)
        slippage: 0.007, // 0.7%
        feeToken: sourceToken,
        error: &$0
    )
}

For public routes across chains, see getDepositAndBridgeQuote(...) and depositAndBridgeWithQuote(...), or depositAndBridge(...) and nearDepositAndBridge(...), in the API Reference.

Best Practices

1. Branch on chain type before connecting

Pick the connect method by chain type so you pass the right host signer.

when {
    Mobile.isSolanaChain(chainId) -> { /* connectSolana */ }
    Mobile.isTronChain(chainId) -> { /* connectTron */ }
    else -> { /* connect (EVM) */ }
}

2. Confirm a chain is supported

if (!Mobile.isHinkalSupportedChain(chainId)) return

3. Set slippage for bridges

bridgePrivateToPrivate takes a slippage as a decimal fraction (e.g. 0.007 = 0.7%, the default when 0; 0.5 would mean 50%). Use a value your users accept; too tight may fail on volatile routes.