Private Send Bridge
POST /private-send-bridge is a Private Send where recipients are paid in another token, on another chain, or both. The caller deposits public tokens; after the deposit confirms, the enclave privately pays each recipient through a bridge or swap route. The on-chain link between sender and recipients is never visible.
The source chain decides the route:
| Source chain | Route | How each recipient is paid |
|---|---|---|
| EVM | LI.FI | The enclave runs the LI.FI bridge or swap from a temporary wallet |
| Solana, TRON | NEAR Intents | The enclave privately sends to a NEAR Intents deposit address; NEAR delivers the destination token |
| Endpoint | Purpose |
|---|---|
GET /get-private-send-bridge-quote | Quote the route and the expected amount per recipient |
POST /private-send-bridge | Prepare the order from the quote; returns the deposit transaction |
GET /private-send-bridge/{orderId} | Track the order |
GET /stuck-bridge-balance | List funds left by a failed bridge or swap |
POST /recover-stuck-bridge-balance | Recover those funds to a public address |
Authentication, broadcasting the deposit and polling work as in Private Send. The code below uses its helpers (createSession, signPayload, buildActionBinding, pollOrder) and post from Examples.
Complete integration
async function privateSendBridge(
wallet,
provider,
chainId,
tokenAddress,
destinationChainId,
destinationTokenAddress,
recipients, // [{ address, amount }] — addresses on the destination chain, amounts in source token units
) {
// 1. Authenticate — normal mode session
const session = await createSession(wallet);
// 2. Quote
const params = new URLSearchParams({
sessionId: session.sessionId,
nonce: randomUUID(),
chainId: String(chainId),
destinationChainId: String(destinationChainId),
inputTokenAddress: tokenAddress,
outputTokenAddress: destinationTokenAddress,
});
recipients.forEach(({ address, amount }) => {
params.append('recipientAddresses', address);
params.append('amounts', amount);
});
const queryString = params.toString();
const quoteRes = await fetch(`${BASE_URL}/get-private-send-bridge-quote?${queryString}`, {
headers: {
'x-hinkal-request-signature': signPayload(
session.privateKey,
`${buildActionBinding('GET', '/get-private-send-bridge-quote')}\n${queryString}`,
),
},
});
const { quote, expectedAmounts } = await quoteRes.json(); // show expectedAmounts to the user
// 3. Prepare the order — destination, recipients and amounts must match the quote
const body = {
sessionId: session.sessionId,
nonce: randomUUID(),
chainId,
tokenAddress,
destinationChainId,
destinationTokenAddress,
recipients,
quote,
timestamp: Date.now(),
};
const order = await post('/private-send-bridge', body, {
'x-hinkal-request-signature': signPayload(
session.privateKey,
`${buildActionBinding('POST', '/private-send-bridge')}\n${JSON.stringify(body)}`,
),
});
// 4. Approve if required, then sign and broadcast the deposit (EVM)
if (order.approvalAddress) {
const token = new ethers.Contract(tokenAddress, ERC20_ABI, wallet);
await (await token.approve(order.approvalAddress, BigInt(order.amountIn))).wait();
}
const tx = ethers.Transaction.from('0x' + Buffer.from(order.serializedTx, 'base64').toString('hex'));
tx.nonce = await provider.getTransactionCount(wallet.address, 'pending');
await provider.send('eth_sendRawTransaction', [await wallet.signTransaction(tx)]);
// 5. Poll — pollOrder from Private Send with the /private-send-bridge URL and binding (see Step 4)
return pollOrder(session, order.orderId);
}Step 1 - Get a quote
GET /get-private-send-bridge-quote is a read endpoint. Sign the query string with the "GET /get-private-send-bridge-quote" binding (see Authentication).
| Query parameter | Required | Description |
|---|---|---|
sessionId, nonce | Yes | Session and per-request UUID, as for every read endpoint |
chainId | Yes | Source chain |
destinationChainId | Yes | Chain the recipients are paid on. Can equal chainId for a same-chain swap |
inputTokenAddress | Yes | Source token |
outputTokenAddress | Yes | Token the recipients receive. Must differ from inputTokenAddress when the chains are the same |
recipientAddresses | Yes | Recipient address on the destination chain. Repeat the key once per recipient |
amounts | Yes | Amount per recipient as a positive integer in the source token's smallest unit. Repeat once per recipient, in the same order |
slippagePercentage | No | Maximum slippage, 0 to 10. If omitted: 1% for NEAR Intents; for LI.FI 0.7%, or 1.5% for a recipient amount under $10 |
txCompletionTime | No | Unix timestamp in seconds for a scheduled send. It is stored in the quote |
Response:
{
"success": true,
"quote": "<quote>",
"expectedAmounts": ["9985000"],
"nonce": "ff3ce3a6-0808-4c94-a735-76dd415e4664"
}quote- the quote as a JSON string. Pass it toPOST /private-send-bridgeunchanged. It includes the route calldata, so it can be tens of KB.expectedAmounts- expected amount per recipient in the destination token's smallest unit, in request order.
Step 2 - Prepare the order
| Body field | Required | Description |
|---|---|---|
sessionId, nonce | Yes | Session and per-request UUID |
chainId | Yes | Source chain, as in the quote |
tokenAddress | Yes | Source token, as in the quote |
destinationChainId | Yes | As in the quote |
destinationTokenAddress | Yes | As in the quote |
recipients | Yes | [{ address, amount }] with the same recipients and amounts as the quote |
quote | Yes | The quote string from Step 1 |
ref | No | Referral code (must be a whitelisted referral identifier) |
Normal mode signs the body with the "POST /private-send-bridge" binding. EIP-712 mode signs the PrivateSendBridge typed data (EVM/TRON) or plain-text message (Solana); see Authentication.
The response has the same fields as POST /private-send: orderId, approvalAddress, serializedTx, amountIn, amountOut, fee, txData, nonce. amountIn and fee are in the source token. amountOut is the total of the quote's expectedAmounts in the destination token, so amountIn - amountOut is not the fee. Recipients can receive less than amountOut by up to the slippage.
A quote:
- expires 10 minutes after it is issued,
- is bound to the session's address,
chainIdandtokenAddress, - fixes
destinationChainId,destinationTokenAddress, recipients and amounts - the body must match them, - carries
txCompletionTime- the body has notxCompletionTimefield.
Step 3 - Approve and broadcast the deposit
Same as Private Send, Step 3: approve amountIn to approvalAddress when it is set, then sign and broadcast serializedTx.
LI.FI can charge a fee in the native token:
- ERC20 source: the deposit transaction's
valueincludes that fee, so the wallet needs that much native token on top of gas.amountInandfeedo not include it. - Native-token source:
amountInandfeeinclude it.
Step 4 - Poll the order status
Use pollOrder from Private Send, Step 4 with /private-send-bridge/${orderId} as the URL and buildActionBinding("GET", "/private-send-bridge/:orderId") as the binding. Order statuses and per-recipient statuses are the same as in Private Send.
Each scheduledTransactions[].txHash is the source-chain transaction that starts the recipient's payout: the LI.FI call, or the transfer to the NEAR Intents deposit address.
GET /private-send/{orderId} returns 404 for bridge orders, and GET /private-send-bridge/{orderId} returns 404 for private-send orders.
Recover funds from a failed bridge
When a bridge or swap fails after the payout transaction and is refunded, the refund does not go to the recipient. It lands here:
| Route | Where the refund lands | When it is listed |
|---|---|---|
| LI.FI | A temporary wallet on the source chain | When the refund arrives. Temporary wallets created in the last 3 minutes are skipped, so funds still in transit are not listed |
| NEAR Intents | The sender's NEAR Intents account | After NEAR refunds the deposit. An unfilled deposit is refunded after the quote deadline: 20 minutes after the scheduled send time, or after the quote for an immediate send |
If the deposit confirmed but the withdraw transaction never ran or reverted, the funds are stuck UTXOs instead: use GET /stuck-utxo-balance and POST /withdraw-stuck-utxos.
Check stuck balances
GET /stuck-bridge-balance is a read endpoint. Sign the query string with the "GET /stuck-bridge-balance" binding.
| Query parameter | Required | Description |
|---|---|---|
sessionId, nonce | Yes | Session and per-request UUID, as for every read endpoint |
chainId | Yes | Chain to check |
const params = new URLSearchParams({ sessionId: session.sessionId, nonce: randomUUID(), chainId: String(chainId) });
const queryString = params.toString();
const res = await fetch(`${BASE_URL}/stuck-bridge-balance?${queryString}`, {
headers: {
'x-hinkal-request-signature': signPayload(
session.privateKey,
`${buildActionBinding('GET', '/stuck-bridge-balance')}\n${queryString}`,
),
},
});
const { balances } = await res.json();Response:
{
"success": true,
"balances": [{ "chainId": 8453, "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "balance": "9985000" }],
"nonce": "5f0e8c1a-1d2b-4c3e-9f4a-7b6c5d4e3f21"
}balances- one entry per token: the total stuck amount onchainIdin the token's smallest unit, before recovery fees. NEAR Intents refunds are included for Solana and TRON.- Temporary-wallet tokens are listed only when they have a USD value and are not flagged as spam or volatile.
Recover
POST /recover-stuck-bridge-balance recovers every stuck balance of tokenAddress on chainId, one after another, and sends it to recipientAddress. The recovery fee is deducted from each recovered amount.
| Body field | Required | Description |
|---|---|---|
sessionId, nonce | Yes | Session and per-request UUID |
chainId | Yes | Chain the funds are stuck on |
tokenAddress | Yes | Token to recover, from GET /stuck-bridge-balance |
recipientAddress | Yes | Public address on chainId that receives the funds |
Normal mode signs the body with the "POST /recover-stuck-bridge-balance" binding. EIP-712 mode signs the RecoverStuckBridgeBalance typed data (EVM/TRON) or plain-text message (Solana); see Authentication.
const body = {
sessionId: session.sessionId,
nonce: randomUUID(),
chainId,
tokenAddress: balances[0].tokenAddress,
recipientAddress: wallet.address,
timestamp: Date.now(),
};
const result = await post('/recover-stuck-bridge-balance', body, {
'x-hinkal-request-signature': signPayload(
session.privateKey,
`${buildActionBinding('POST', '/recover-stuck-bridge-balance')}\n${JSON.stringify(body)}`,
),
});Response:
{
"success": true,
"recoveredCount": 1,
"recoveredAmount": "9985000",
"failedCount": 0,
"errors": [],
"nonce": "8a7b6c5d-4e3f-4a1b-9c2d-1e0f9a8b7c6d"
}recoveredCount- number of stuck balances recovered.recoveredAmount- total of the recovered balances in the token's smallest unit, before recovery fees.failedCount,errors- balances that could not be recovered, with their error messages. Call the endpoint again to retry them.
If none of the balances can be recovered, the endpoint returns 500 with the first message in error and all messages in errors.