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

let supported = try call { MobileSupportedChainsJSON(&$0) }   // JSON of supported chains
let isEvm = MobileIsEvmChain(chainId)                         // Bool helpers do not throw

Related helpers: MobileAllSupportedChainsJSON(), MobileWalletSupportedChainsJSON(), MobileBridgeSupportedChainsJSON(), MobileIsTronChain(_:), MobileIsSolanaChain(_:), MobileNetworkJSON(_:).

Connecting per chain type

  • EVM: client.connect(host) with a MobileHostWalletProtocol
  • Solana: client.connectSolana(host, chainID: chainId) with a MobileHostSolanaSignerProtocol
  • Tron: client.connectTron(host, chainID: chainId) with a MobileHostTronSignerProtocol

Bridging

Move shielded value from one chain to another:

let txHash = try call {
    hinkal.bridgePrivateToPrivate(
        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.

if MobileIsSolanaChain(chainId) { /* connectSolana */ }
else if MobileIsTronChain(chainId) { /* connectTron */ }
else { /* connect (EVM) */ }

2. Confirm a chain is supported

guard MobileIsHinkalSupportedChain(chainId) else { return }

3. Set slippage for bridges

bridgePrivate(toPrivate:) 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.