Swap
Relays a swap within the shielded balance, using swap calldata obtained from GET /get-swap-data.
EVM: feeToken is the input token. feeAmount is optional (computed server-side if omitted). Authorized by a normal mode session (secp256k1 request signature, bound to "POST /swap") or an EIP-712 Swap typed-data signature.
Solana: feeToken is not used — the server always uses tokenAddresses[1] (the output token) as the fee token; any value passed is ignored. The relay fee is computed automatically; feeAmount is only needed to lock in an exact amount already returned by GET /get-fee (with mintFrom = inputTokenAddress). Exactly two token addresses are required: [inputToken, outputToken]. Authorized by a normal mode session (secp256k1 request signature, bound to "POST /swap") or an EIP-712 mode session with a per-transaction ed25519 plain-text signature (primary type Swap).
tokenAddresses and amounts for a swap:
Index 0: input token address, amount is negative (tokens leaving shielded balance)
Index 1: output token address, amount is positive (tokens entering shielded balance)
Required for normal mode sessions: hex-encoded compact secp256k1 signature secp256k1_sign(SHA256(binding + "\n" + JSON.stringify(body))), where binding is "POST <routePath>" for this endpoint. Omit for EIP-712 mode sessions — include signature in the request body instead. See Authentication for the full signing scheme.
EIP-712 or ed25519 signature (EIP-712 mode only)
[inputTokenAddress, outputTokenAddress]
[negativeInputAmount, positiveOutputAmount]
External action id string returned by GET /get-swap-data (e.g. "Lifi", "Okx")
Swap calldata returned by GET /get-swap-data
Fee token for EVM swaps (typically the input token). Not used on Solana — the server always uses tokenAddresses[1]; any value passed is ignored.
Optional — omit it and the server computes the fee automatically. Pass it only to lock in a fee amount already quoted from GET /get-fee.
Relayed transaction hash
Validation error
Invalid signature or reused nonce
Request nonce already consumed. Each nonce is single-use; generate a fresh UUID for every request.
Server error
POST /swap HTTP/1.1
Host: api.hinkal.io
Content-Type: application/json
Accept: */*
Content-Length: 617
{
"sessionId": "ffd74231-0672-48c7-bd82-9f72a803578b",
"nonce": "2101c451-9c9a-4899-b66f-bccaf671920f",
"chainId": 10,
"tokenAddresses": [
"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
"0x94b008aA00579c1307b0EF2c499aD98a8ce58e58"
],
"amounts": [
"-1000000",
"998500"
],
"externalActionId": "Lifi",
"swapData": "0x6af479b200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000094b008aa00579c1307b0ef2c499ad98a8ce58e5800000000000000000000000000000000000000000000000000000000000f4240...",
"feeToken": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85"
}{
"success": true,
"txHash": "0x3f1a9c8b7e2d5f4a6c1b3e5d7f9a2b4c6e8d1f3a5b7c9e2f4a6b8c1d3e5f7a9b",
"nonce": "2101c451-9c9a-4899-b66f-bccaf671920f"
}Last updated