BETA

ChainHilt is in beta. Use at your own discretion.

chainhilt

Bridge

Bridge tokens from your agent

ChainHilt asks Circle CCTP, Across, deBridge, Relay, Socket and LayerZero for routes, ranks them by what arrives, and returns the approval and bridge transactions for your wallet to sign. Comparing routes costs $0.001, preparing the transactions $0.01, and each status lookup $0.001.

How a bridge runs

  1. Compare routes ($0.001)

    Send POST /api/v1/bridge/simulate through your x402 client. It needs no wallet authorization. Pass senderAddress so providers quote for that wallet.

    POST https://chainhilt.ai/api/v1/bridge/simulate
    
    {
      "sourceAmount": "10000000",
      "sourceChainId": 8453,
      "targetChainId": 999,
      "sourceToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "targetToken": "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
      "targetType": "hyperCore",
      "hyperCoreBalance": "perps",
      "senderAddress": "0xE4934BB19E0B97109033dBfDcCc6957E32F9Cc60"
    }

    Routes come best first by what arrives, net of fees paid in the native token. Each has its estimated and minimum target amounts and its fees, plus a duration and an expiry when the provider gives them.

  2. Authorize

    Once the user picks a route, call the wallet's authorize_request with the exact execute request: method, URL and JSON body.

  3. Execute ($0.01)

    Send the request with the header it returned. adapterId names the chosen route, and minTargetAmount and maxNativeFee are the bounds the user accepted.

    POST https://chainhilt.ai/api/v1/bridge/execute
    X-ChainHilt-Authorization: <from authorize_request>
    
    {
      "sourceAmount": "10000000",
      "sourceChainId": 8453,
      "targetChainId": 999,
      "sourceToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "targetToken": "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
      "targetType": "hyperCore",
      "hyperCoreBalance": "perps",
      "senderAddress": "0xE4934BB19E0B97109033dBfDcCc6957E32F9Cc60",
      "adapterId": "across",
      "recipientAddress": "0xE4934BB19E0B97109033dBfDcCc6957E32F9Cc60",
      "minTargetAmount": "9944085",
      "maxNativeFee": "0"
    }

    Execute quotes again. If the fresh quote delivers less or charges more native fee, it returns 409 with the new amounts and no actions. Otherwise the actions are an approval of exactly sourceAmount when needed, then the bridge transaction.

    Ethereum USDT and a few other tokens refuse to change one nonzero allowance to another, so for them an approval to 0 comes first and there are three actions. The wallet skips that reset when there is no allowance to clear.

  4. Sign and send

    Pass all the actions' nonce and hashes to process_action in one call, right away. Each action's verification.expiresAt says when the wallet stops accepting it: 10 minutes after execute, or the route's expiry if that comes sooner (two minutes for deBridge).

  5. Track it ($0.001 a lookup)

    Poll GET /api/v1/bridge/status?adapter=…&sourceChainId=…&txHash=… with the bridge transaction's hash every 10 to 15 seconds, until it is filled, refunded or failed. LayerZero and Relay also need the providerRef that execute returned. not_found is normal for up to a minute.

Before you sign

  • Bridges are not reversible. Confirm the route's minimum received, fees and any estimated duration with the user, not just the estimated amount.
  • sourceAmount is exactly what leaves the wallet, in the token's smallest unit, and fees come out of it. Fees in the native token, such as deBridge's flat fee, are paid on top, so keep enough for them and for gas.
  • Bridges deliver only to the sending wallet: recipientAddress is your own address.
  • Tokens can change on the way, for example USDC on Base to ETH on Arbitrum. Across, Relay, deBridge and Socket swap as part of the bridge; Circle CCTP moves only USDC, and LayerZero only the same asset.
  • Quotes move between calls. Unless the user wants exact bounds, pass the route's minTargetAmount less about 0.5%, and its native fees plus about 20% as maxNativeFee.

Bridging USDC to Hyperliquid (targetChainId: 999 with HyperEVM USDC) credits the HyperCore perps balance by default, ready to trade. deBridge, Socket and LayerZero can't deliver there and return an error.

Endpoints

Bridge endpoints and their prices
EndpointPriceWhat it does
POST /api/v1/bridge/simulate$0.001Compare bridge routes, best first: tokens, estimated and minimum target amounts, fees by token, duration, expiry and the approval each route needs.
POST /api/v1/bridge/execute$0.01Prepare the selected bridge route as ordered unsigned transactions: an exact-amount ERC-20 approval when needed (after an approval to 0 for tokens like Ethereum USDT), then the bridge transaction.
GET /api/v1/bridge/status$0.001Look up a bridge after its transaction was sent, by the adapter that built it and the hash of the bridge transaction on the source chain; layerzero and relay also need the providerRef that bridge/execute returned (0x and 64 hex characters).

Next