bridge

Create Bridge Swap Transaction with Approval

Generates both token approval and swap transactions in a single call with configurable slippage protection.

💡 Compute Unit Value: 110 (Fixed)

post/defi/v1/bridge/swap-with-approval

Request

  • Base URL
    https://svc.blockdaemon.com
  • URL
    https://svc.blockdaemon.com/defi/v1/bridge/swap-with-approval
  • Auth
    API key in header X-API-Key

Request body

bridgeId'600' | '300' | '400' | '100' | '500'

The unique ID to specify the bridge protocol for routing cross-chain queries or transactions. Find more here.

srcChainIdstring

The unique chain ID to specify the source chain. Find more here.

dstChainIdstring required

The unique chain ID to specify the destination chain. Find more here.

srcTokenSymbolstring

Symbol of the token to swap.

dstTokenSymbolstring

Symbol of the token to be received after the swap.

srcTokenAddressstring

Contract address of the source (input) token on the source chain. For EVM chains, use a checksummed hex address (e.g., 0x...). Either srcTokenAddress or srcTokenSymbol must be provided.

dstTokenAddressstring

Contract address of the destination (output) token on the destination chain. For EVM chains, use a checksummed hex address (e.g., 0x...). Either dstTokenAddress or dstTokenSymbol must be provided.

amountInstring required

Amount of the input token to provide, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: to swap 1 WETH (18 decimals), use "1000000000000000000"; to swap 1 USDC (6 decimals), use "1000000".

amountOutMinstring

Minimum acceptable output amount in the token's smallest denomination (base units). Provides slippage protection — the transaction reverts if the output falls below this value. Set to "0" to disable slippage protection. Examples: to require at least 0.99 USDC (6 decimals), use "990000"; to require at least 0.99 WETH (18 decimals), use "990000000000000000".

fromstring required

Blockchain address of the token sender. For EVM chains, use a checksummed hex address (e.g., 0xABCDEF...). This address must hold sufficient balance of the input token and will sign the transaction.

tostring required

Blockchain address of the token recipient. For EVM chains, use a checksummed hex address (e.g., 0xABCDEF...). Output tokens are delivered to this address after the swap.

gasPrioritystring

Specifies the priority level for gas fees (e.g., 'low', 'medium', or 'high'), which influences the transaction speed and cost.

slippagestring

Maximum acceptable slippage as a percentage of the swap value. Valid range: 0 to 100 (e.g., 1 = up to 1% slippage). Defaults to 1. The transaction reverts if the output deviates more than this percentage from the quoted price.

enableFeeboolean

Flag to include a basis points fee transaction alongside the main transaction when set to true.

batchOption'EIP-5792' | 'EIP-7702'

Transaction batching standard to use. Supported values: 'EIP-5792' (wallet-level batching via wallet_sendCalls) or 'EIP-7702' (EOA code delegation via batcherContract). Requires batcherContract when using EIP-7702.

batcherContractstring

The EOA address of the batcher that will be used to execute the transaction when using EIP-7702 batching. If not provided, the default batcher contract for the chain will be used.

simulateboolean

When true, dry-runs the transaction batch via eth_simulateV1 and returns a simulate field with status and error on each transaction.

gasstring

Maximum number of gas units to allocate for the transaction, as an integer string (e.g., '200000'). If omitted, gas is estimated automatically. Note: this is gas units, not wei or gwei.

srcChainSymbolstring

Symbol of the source chain.

Example request

{
  "bridgeId": "600",
  "srcChainId": "1",
  "dstChainId": "1",
  "srcTokenSymbol": "usdt",
  "dstTokenSymbol": "ETH",
  "srcTokenAddress": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "dstTokenAddress": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "amountIn": "1000000000000000000",
  "amountOutMin": "0",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "gasPriority": "low",
  "slippage": "10",
  "enableFee": false,
  "batchOption": "EIP-5792",
  "batcherContract": "0x9c933f9d2efd76ce25b0d3dde84d3f94e78a50ca",
  "simulate": false,
  "gas": "100000",
  "srcChainSymbol": "ETH"
}

Response

Successful response

statusnumber

Numeric status code indicating success or failure of the API call

msgstring

Human-readable message describing the API result or error

Example response

{
  "status": 200,
  "msg": "success",
  "data": [
    {
      "chainId": "1",
      "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
      "to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "value": "0",
      "gas": "900000",
      "data": "0x095ea7b30000000000000000000000008731d54e9d02c286767d56ac03e8037c07e01e980000000000000000000000000000000000000000000000000000000000002710",
      "nonce": 0,
      "referenceId": "fdd8054bbd7f42d59692b35e7e7141c0"
    },
    {
      "chainId": "1",
      "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
      "to": "0x8731d54E9D02c286767d56ac03e8037C07e01e98",
      "value": "336014619161195",
      "gas": "900000",
      "data": "0x9fbf10fc000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a67e9b68c41b0f26184d64c26e0b2b81466e599400000000000000000000000000000000000000000000000000000000000027100000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014a67e9b68c41b0f26184d64c26e0b2b81466e59940000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "gasPrice": "1588879231",
      "nonce": 1,
      "referenceId": "fdd8054bbd7f42d59692b35e7e7141c0"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.