Hinkal Mobile SDK
Wallet Integration
The SDK never holds a private key. Your app implements a host signer interface for its wallet type, and the SDK calls it to read the address and request signatures.
HostWallet (EVM)
class WalletHost(private val wallet: YourWalletImplementation) : HostWallet {
override fun address(): String = wallet.address
override fun chainID(): Long = wallet.chainId
override fun personalSign(message: String): String = wallet.personalSign(message)
override fun sendTransaction(toHex: String, dataHex: String, valueDec: String, gasLimit: Long): String =
wallet.sendTransaction(toHex, dataHex, valueDec, gasLimit)
override fun switchChain(chainID: Long) = wallet.switchChain(chainID)
}| Method | Purpose |
|---|---|
address | The wallet's public address. |
chainID | The wallet's current chain id. |
personalSign | EIP-191 personal_sign of a message. |
sendTransaction | Sign and broadcast a transaction; returns the tx hash. |
switchChain | Switch the wallet to another chain. |
HostSolanaSigner
class SolanaHost(private val wallet: YourSolanaWallet) : HostSolanaSigner {
override fun publicKey(): String = wallet.publicKey
override fun signMessage(message: ByteArray): ByteArray = wallet.signMessage(message)
override fun signTransaction(tx: ByteArray): ByteArray = wallet.signTransaction(tx)
}HostTronSigner
class TronHost(private val wallet: YourTronWallet) : HostTronSigner {
override fun address(): String = wallet.address
override fun signMessage(message: String): ByteArray = wallet.signMessage(message)
override fun signTxHash(txHash: ByteArray): ByteArray = wallet.signTxHash(txHash)
}Connecting
client.connect(WalletHost(yourWallet)) // EVM
client.connectSolana(SolanaHost(yourWallet), solanaChainId) // Solana
client.connectTron(TronHost(yourWallet), tronChainId) // TronBest Practices
1. Never let the key reach the SDK
The host only returns an address and signatures. Keep the private key in your wallet/keystore; the SDK never asks for it.
2. Let signing failures throw
Host methods declare throws Exception. If signing fails, throw - do not return an empty string, which the SDK would treat as a valid signature.
override fun personalSign(message: String): String = wallet.personalSign(message) // throws on failure3. Match the host to the chain
Implement HostWallet for EVM, HostSolanaSigner for Solana, HostTronSigner for Tron, and connect with the matching method.