React Native SDK
Hinkal React Native SDK
Hinkal is a privacy middleware and smart-contract SDK for public blockchains that enables private transactions and settlement flows without changing wallets, custody, or chains.
@hinkal/react-native is a prebundled build of the Hinkal SDK for React Native and Expo. It includes the polyfills, shims, and worker runtime required on mobile - no custom Metro configuration is needed.
The SDK allows mobile wallets, dApps, and payment apps to integrate protocol-level privacy on Ethereum, Solana, Tron, Polygon, Base, Arbitrum, and Optimism.
With Hinkal SDK, developers can:
• Enable private sends between public wallets
• Perform private payments
• Route transactions through Hinkal’s privacy contracts without exposing sender, recipient, or amounts
• Maintain non-custodial control with optional compliance visibility via viewing keys
Compatibility
React Native
✅
v0.74+
Expo
✅
dev client or bare
Installation
npm install @hinkal/react-nativeOr, yarn:
Usage
HinkalProvider
Wrap your app with HinkalProvider before using any SDK function. It runs the React Native bootstrap and mounts the hidden WebView worker host.
Initialization
After the wallet is connected, initialize a Hinkal instance with your preferred provider helper.
Initializing the SDK creates a Hinkal object that encapsulates:
The user's private balances
Actions the user can perform, such as shielding (depositing), transfers, and swapping
Cryptographic keys for privacy-preserving operations
Each provider exposes three prepare helpers:
prepare*Hinkal- signs the Hinkal login message and initializes user keys (deterministic signers)prepare*HinkalWithEnclaveSignIn- signs in through the secure enclave and stabilizes identity for non-deterministic signers (smart contract wallets, some hardware wallets)prepare*HinkalFromSignature- initializes user keys from a previously stored signature
wagmi:
ethers.js:
Solana:
Tron:
The same WithEnclaveSignIn and FromSignature variants are available for each provider (for example, prepareWagmiHinkalWithEnclaveSignIn, prepareSolanaHinkalFromSignature).
The hinkalConfig is defined as follows:
Identity persistence
When a user connects their wallet, they sign a fixed login message to authenticate with Hinkal. That signature defines their Hinkal identity. Their private balances, transaction ability, and all private operations depend on it.
Most wallets return the same signature every time for the same message. Some do not. Smart contract wallets, certain hardware wallets, and other non-deterministic signers may produce a different signature on each login, even for the same address and message.
When that happens, a returning user appears as a new account. Funds deposited in an earlier session remain tied to the original identity and are not accessible from the new one.
Recommended approach: use prepare*HinkalWithEnclaveSignIn instead of prepare*Hinkal. It signs the login message, stores the first signature server-side through the secure enclave, and always initializes with the original identity on later sessions. Solana Ledger wallets are handled automatically.
Manual approach: if you manage identity yourself, call storeAndGetInitialSignature and then either initUserKeysWithSignature or prepare*HinkalFromSignature:
Parameters:
authSignature- signature from the current login sessionisSolanaLedger- set totruefor a Solana Ledger wallet. Defaults tofalsetxMessageForSolanaLedger- base64-encoded transaction message used for Solana Ledger authentication. Required whenisSolanaLedgeristrue
Typical flow with a stored signature:
Call this once per session, after wallet connection and before fetching balances or submitting transactions.
You do not need enclave sign-in if your wallet produces deterministic signatures for the same login message on every session - in that case, prepare*Hinkal is sufficient. It is also not needed if you persist the signature yourself via prepare*HinkalFromSignature, or if you use seed-phrase-based login through initUserKeysFromSeedPhrases.
Security
The stored signature is protected at every stage. Before leaving the client, the signature is encrypted with hybrid encryption. The payload is encrypted with a symmetric key, and that key is encrypted with the enclave's public key.
Inside the secure enclave, Google Cloud KMS decrypts the symmetric key. Only then is the signature decrypted. The plaintext signature never leaves the enclave unprotected.
At rest, only the encrypted signature and encrypted key are stored in the database. A caller cannot retrieve a stored signature by wallet address alone. Each request must include any valid signature that proves wallet ownership.
Requests that fail this check are rejected. The first signature stored for a given address is never replaced. Later logins only use a fresh signature to authenticate retrieval of the original.
Private Balance
Private balances are encrypted token holdings stored within the Hinkal protocol. Unlike regular blockchain balances that are publicly visible, private balances are hidden from external observers.
After initializing the Hinkal object and calling initUserKeys (or a prepare helper), fetch balances for a specific chain:
TokenBalance contains chainId, erc20Address, balance, and an optional timestamp.
For reactive UI updates, subscribe to balance changes with USD values:
Shielding: depositing funds to the private balance
Shielding moves tokens from a public blockchain address into a private, encrypted balance. Once shielded, tokens are no longer visible on-chain to external observers.
where:
chainId- target chainerc20Addresses- token contract addresses to depositamountChanges- corresponding deposit amounts in the token's smallest unitpreEstimateGas- if true (default), gas is estimated before executing the depositreturnTxData- if true, returns unsigned transaction data without executing. Defaults to false
On Solana, use depositSolana(chainId, erc20Address, amount).
To shield funds for another user's private address, use depositForOther (EVM/Tron) or depositSolanaForOther (Solana) with their recipientInfo string from getRecipientInfo().
Receiving funds to a public deposit address
A receive address is a normal public address that shields whatever is sent to it. You hand it out, the sender makes a plain transfer, and a relayer settles the balance into your private balance for a fee (a flat fee covering the settlement gas, quoted when the balance is settled, plus 0.25%).
The address is derived from your private key, so deriving one is free: a CREATE2 address on EVM and Tron, where nothing is deployed until it is settled, and a program-derived address on Solana, where nothing is deployed at all. The relayer must supply the exact recipient the address was derived from, so it can shield your funds or do nothing - it can never redirect them.
One address takes every supported token on every chain of its network: the factory address and init code are identical on all EVM chains, so an EVM address is the same everywhere. Tron and Solana are separate networks, each with an address of its own.
Available on Solana, and on any EVM or Tron chain with a receive vault factory deployed. Check first:
A vault address belongs to a network, not one chain. To hand out an address:
where:
network-ReceiveVaultNetwork.Evm,ReceiveVaultNetwork.TronorReceiveVaultNetwork.Solana, the network the address is forforceFresh- if true, claims a new address instead of returning the one already handed out for that network. Defaults to false
The returned ReceiveVaultRecord holds vaultAddress (the address to hand out, in the chain's native format) plus the terms it was derived from (index, network, version).
An address never expires and is reused: calling this again returns the same one until you ask for a fresh one. To list the addresses handed out so far, along with balances the relayer declined to shield:
Records are restored from the private key itself, so this works on a fresh device. A fund is blocked when the relayer will not settle it - the sender was flagged, the token cannot be shielded, or the payment could not be attributed (ReceiveVaultBlockReason).
Blocked funds are never lost: only the address's owner can move them, paying gas from their own wallet.
where:
record- the record the blocked fund came witherc20Address- token to sweep out of the addresschainId- chain the blocked balance sits onrecipientAddress- public address to send it toreturnTxData- if true, returns unsigned transaction data without executing. Defaults to false
Resolves to the transaction hash, and the funds land publicly at recipientAddress. With returnTxData, EVM and Tron return an unsigned transaction object; Solana returns a base64 legacy transaction with the fee payer and a recent blockhash already set, ready to sign and send.
Private Send to Public Address: withdrawing funds from the private balance
Private Send to Public Address sends tokens from a private balance to any public blockchain address without exposing the sender.
where:
recipientAddress- public address that receives the withdrawn fundsisRelayerOff- whenfalse, a relayer handles gas fees; whentrue, the user pays gas directlyfeeToken- optional token address used to pay protocol feesfeeStructureOverride- optional custom fee structure
Private Send to Private Address: transferring funds from private balance
Private Send to Private Address enables fully confidential transfers between shielded balances.
where:
recipientAddress- recipient's private address string fromgetRecipientInfo(). Pass it as-is; do not reformat. It is a comma-separated string with five components:stealthAddress- recipient's stealth address (hex,0xprefix, 64–66 characters)H0[0]- first coordinate of the H0 elliptic-curve pointH0[1]- second coordinate of the H0 elliptic-curve pointH1[1]- second coordinate of the H1 elliptic-curve pointencryptionKey- recipient's encryption public key (hex,0xprefix, 66 characters)
Private Send from Public to Public addresses
Private Send from Public to Public transfers tokens between two public addresses through Hinkal's privacy infrastructure. Tokens are shielded from the sender, then withdrawn to recipient public addresses on a relayer schedule.
where:
erc20Address- token contract address (single-token transfers only)recipientAmounts- amounts to send to each recipient in the token's smallest unitrecipientAddresses- public addresses that receive the fundstxCompletionTime- optional Unix timestamp in seconds by which all scheduled withdrawals must completefeeStructureOverride- optional custom fee structurepreEstimateGas- if true (default), gas is estimated before executing the deposit
The function returns:
Private Send with bridge or swap (quote-based)
Use getDepositAndBridgeQuote and depositAndBridgeWithQuote for a private send where recipients are paid in another token, on another chain, or both. The quote picks the route: NEAR Intents for Solana and Tron sources, LI.FI for EVM sources. Fetch the quote, show expectedAmounts to the user, then pass the same quote to execute the send.
where:
chainId,erc20Address- source chain and token, taken from the sender's public balancedestinationChainId,destinationErc20Address- chain and token the recipients receive. The chain can equalchainIdfor a same-chain swapsendAmounts- amount to send to each recipient, in the source token's smallest unitrecipientAddresses- public addresses on the destination chain that receive the funds, in the same order assendAmountsslippagePercent- optional maximum slippage in percent. If omitted: 1% for NEAR Intents; for LI.FI 0.7%, or 1.5% for a recipient amount under $10txCompletionTime- optional Unix timestamp in seconds for a scheduled send. Pass the same value todepositAndBridgeWithQuote
The function returns:
expectedAmounts- expected amount each recipient receives, in the destination token's smallest unit, in the same order asrecipientAddresseslifiRecipients/nearLegs- route data used bydepositAndBridgeWithQuote. Exactly one of them is set. Do not modify them
To execute the quote:
where:
chainId,erc20Address- must match the chain and token the quote was issued for, otherwise the call throwsquote- the object returned bygetDepositAndBridgeQuotetxCompletionTime- optional Unix timestamp in seconds, the same value used for the quotefeeStructureOverride- optional custom fee structure
The function returns DepositAndSendExtendedResult (depositTxHash and scheduleId), the same as depositAndWithdraw.
Example:
Execute the quote soon after fetching it: LI.FI calldata goes stale and NEAR Intents quotes have a deadline. Fetch a new quote if the user waits.
Checking scheduled send status
After depositAndWithdraw or depositAndBridge, fetch scheduled withdrawal status using the returned scheduleId:
Possible values for ScheduledTransactionStatus:
pending- scheduled, waiting for execution timeprocessing- relayer is submitting the withdrawal on-chainwaiting_for_relayer- relayer is busy; withdrawal is queuedsent_on_chain- submitted on-chain;txHashis availablecompleted- confirmed on-chainfailed- withdrawal transaction failed
Recovering funds from a failed bridge or swap
When a bridge or swap fails after the funds left the private balance and is refunded, the refund does not reach the recipient. It lands on a temporary wallet (LI.FI routes) or in the user's NEAR Intents account (NEAR Intents routes, used for Solana and Tron sources). List these balances with:
where:
chainIds- optional chains to check. Defaults to every supported chain. NEAR Intents refunds are checked only whenchainIdsis omitted or includes Solana or Tron
The function returns StuckBridgeBalance entries: a TemporaryWalletBalance (LI.FI) or a NearIntentsRefundBalance (NEAR Intents, has assetId). Each entry has token, balance (in the token's smallest unit) and, when a price is available, usdValue.
Temporary wallets created in the last 3 minutes are skipped, so funds still in transit are not listed
Temporary-wallet tokens are listed only when they have a USD value and are not flagged as spam or volatile
A
TemporaryWalletBalancecontains the temporary wallet's private key. Do not log these entries or send them anywhere
To recover one entry:
where:
balance- an entry returned bygetStuckBridgeBalances, unchangedrecipientAddress- optional public address on the entry's chain that receives the funds. Defaults to the connected wallet's address, or its Solana public key for a NEAR Intents refund on Solana
The recovery fee is deducted from the recovered amount. If a temporary wallet's balance does not cover it, the call throws Insufficient funds to cover recovery fees. Temporary wallets created by bridgePrivateToPrivate are shielded instead: into your private balance by default, or into the private balance of recipientAddress.
Example:
If the deposit confirmed but the withdraw transaction never ran or reverted, the funds are stuck in the private balance instead: use getStuckShieldedBalances and withdrawStuckUtxos.
Swapping tokens from the private balance
Getting swap quotes and calldata:
EVM chains - getEvmSwapPrices(chainId, inSwapAmount, inSwapTokenAddress, outSwapTokenAddress) returns a LI.FI quote ({ outSwapAmountValue, lifiDataValue }), or null when no route is found. LI.FI aggregates the underlying DEXs, so there is one quote per pair. Pass lifiDataValue as the swap calldata with ExternalActionId.Lifi.
Solana - getSolanaSwapPrices(...) returns an OKX quote ({ outSwapAmountValue, okxDataValue }). Pass okxDataValue to swap with ExternalActionId.Okx. Shielded Solana swaps route through OKX; LI.FI also supports Solana for Public (Proxy) account swaps and for cross-chain routes.
Interacting with smart contracts privately
Generate user operations with emporiumOp:
Stateless interactions (swaps, simple staking) use default invokeWallet: false.
Stateful interactions (reward tracking, voting power) require invokeWallet: true so the call runs from a persistent wallet address.
Supported Chains
Ethereum
1
✅ Live
Arbitrum
42161
✅ Live
Polygon
137
✅ Live
Base
8453
✅ Live
Tempo
4217
✅ Live
BNB
56
✅ Live
Robinhood
4663
✅ Live
Arc
5042
✅ Live
Solana
501
✅ Live
Tron
728126428
✅ Live
Arc Testnet
5042002
✅ Live
Tron Nile
3448148188
✅ Live
Last updated

