Bridging to another network
Send a token to another of our networks with the same request and one transaction: the recipient is paid there within seconds, or the sender is refunded.
How it works
- Quote with
toChainIdset to the destination. The answer hastype: "bridge"and the one transaction to sign on the source network. - That transaction goes to our contract, like a swap: it takes the router's fee and yours from the amount, in the token sent, swaps the rest first when the bridge does not carry that token, and deposits it for the transfer.
- A relayer pays the recipient on the destination, usually within seconds (
estimatedDurationSeconds).
Request
curl "https://api.soheil.fi/v1/quote?fromChainId=8453&toChainId=42161\
&fromToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\
&toToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831\
&fromAmount=100000000&fromAddress=0xYourUser" \
-H "x-api-key: sk_xxxxxxxx_…"Approve and send exactly as for a swap (Sending the transaction).
What arrives
toAmount is exactly what reaches the recipient on toChainId, after every fee; toAmountMin is the same: a transfer is paid in full or refunded, never in part. toToken is the token on the destination network.
Refunds
If nobody fills the transfer in time, it is refunded automatically to the sender (fromAddress) on the source network. The refund never goes to our contract, and nobody has to claim it.
Following it
Ask Trade status with the source network and the transaction hash: PENDING / WAITING_FILL until it is paid, then DONE with receiving set to the payout on the destination, or REFUNDED.
What works today
- Between the router's networks (
GET /v1/chains). toTokenis an asset the bridge carries: USDC, USDT, ETH and the like.fromTokencan be any token: when it is not the same asset, our contract swaps it first on the source network, in the same transaction.- After a swap, the bridge takes exactly the swap's minimum: whatever the swap returns above it goes back to the sender on the source network, in that asset. Other pairs answer
NO_ROUTE.