Get Call Data

Generate the complete calldata required to execute a token swap transaction on-chain. This API prepares the encoded calldata based on the selected route, amount, tokens, slippage, and fee configurations. It supports both same-chain and cross-chain swaps and includes optional permit data for approvals. Check out the getCallData API template script for implementation details.

POST
/vpc/v1/get-call-data

Authorization

x-authorization-secret<token>

Trade Service Secret (set this to the value of TRADE_SERVICE_SECRET from .env)

In: header

Request Body

application/jsonRequired
routeIdRequiredstring
fromTokenRequiredstring
fromChainRequiredstring
toTokenRequiredstring
toChainRequiredstring
sameChainFeestring
sameChainFeeCollectorstring
crossChainFeestring
crossChainFeeCollectorstring
fromAmountRequiredstring
toTokenAmountMinimumRequiredstring
slippagestring
fromUserWalletAddressRequiredstring
toUserWalletAddressRequiredstring
permitDatastring
permitSignaturestring
curl -X POST "https://okto-trade-service.oktostage.com//vpc/v1/get-call-data" \
  -H "x-authorization-secret: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "routeId": "80c5a9e7-92a8-49f8-ac55-21f883bf8bc3",
    "fromToken": "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
    "fromChain": "eip155:8453",
    "toToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
    "toChain": "eip155:42161",
    "sameChainFee": "10",
    "sameChainFeeCollector": "0x2c2505D0E21f32F38bCEBeca1C331ab4069bBCb9",
    "crossChainFee": "10",
    "crossChainFeeCollector": "0x2c2505D0E21f32F38bCEBeca1C331ab4069bBCb9",
    "fromAmount": "1",
    "toTokenAmountMinimum": "1000",
    "slippage": "5",
    "fromUserWalletAddress": "0x2c2505D0E21f32F38bCEBeca1C331ab4069bBCb9",
    "toUserWalletAddress": "0x2c2505D0E21f32F38bCEBeca1C331ab4069bBCb9",
    "permitData": "{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"PermitBatchTransferFrom\":[{\"name\":\"permitted\",\"type\":\"TokenPermissions[]\"},{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"nonce\",\"type\":\"uint256\"},{\"name\":\"deadline\",\"type\":\"uint256\"}],\"TokenPermissions\":[{\"name\":\"token\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"}]},\"primaryType\":\"PermitBatchTransferFrom\",\"domain\":{\"name\":\"Permit2\",\"chainId\":8453,\"verifyingContract\":\"0x000000000022D473030F116dDEE9F6B43aC78BA3\"},\"message\":{\"deadline\":\"1740749617\",\"nonce\":\"3250162946\",\"permitted\":[{\"amount\":\"1000\",\"token\":\"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2\"}],\"spender\":\"0xd33a607f1c54e76770C21E40A560E411706ca448\"}}",
    "permitSignature": "0x"
  }'

Fetched

{
  "routeId": "80c5a9e7-92a8-49f8-ac55-21f883bf8bc3",
  "priceImpact": "0",
  "isPriceImpactCalculated": true,
  "tokenPrices": {},
  "feeCharged": true,
  "outputAmount": "",
  "steps": [
    {
      "type": "transaction",
      "metadata": {
        "serviceType": "bridge",
        "transactionType": "init",
        "protocol": "Okto_ULL",
        "aggregatorName": "Okto_ULL"
      },
      "chainId": "9400de12-efc6-3e69-ab02-0eaf5aaf21e5",
      "txnData": {
        "to": "0xd33a607f1c54e76770C21E40A560E411706ca448",
        "from": "0x2c2505D0E21f32F38bCEBeca1C331ab4069bBCb9",
        "gasPrice": "0",
        "gasLimit": 0,
        "value": "0x0",
        "data": "0x1af715cb0000000000000000000000000000000000000000000000000000000000000040...",
        "chainId": "8453",
        "transactionCost": "0",
        "l1GasCost": "0"
      },
      "intentCalldata": {}
    }
  ],
  "orderTypedData": "string",
  "routeExpiry": ""
}