# Bridging to another network

Source: https://soheil.fi/developers/docs/bridging/

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 `toChainId` set to the destination. The answer has `type: "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

```bash
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](https://soheil.fi/developers/docs/execute/)).

## 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](https://soheil.fi/developers/docs/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`).
-   `toToken` is an asset the bridge carries: USDC, USDT, ETH and the like. `fromToken` can 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`.
