> For the complete documentation index, see [llms.txt](https://docs.transit.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.transit.finance/reference/api-reference/transit-swap-cross.md).

# Transit Swap Cross

> chains supported (fromChainID & toChainID):

* Ethereum: 1
* BSC: 56
* OkExchain: 66
* HECO: 128
* Matic: 137
* Fantom: 250
* KCC: 321
* AVAX: 43114
* TRON: 95500

> bridge supported:

* ANYSWAP
* METAPATH
* CBRIDGE

## Tokens API

## Cross Tokens List

<mark style="color:blue;">`GET`</mark> `https://aggserver.transit.finance/v3/cross/common/list`

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "result": 0,
    "message": "success",
    "data": {
        "bridgers": [
            "ISWAP",
            "METAPATH"
        ],
        "chains": {
            "ISWAP":[],
            "METAPATH":[]
        },
        "tokens":{
            "ISWAP":[],
            "METAPATH":[]
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Swap API

## Transit Swap API for Cross

<mark style="color:blue;">`GET`</mark> `https://aggserver.transit.finance/v3/cross/swap`

#### Query Parameters

| Name                                          | Type    | Description                                 |
| --------------------------------------------- | ------- | ------------------------------------------- |
| toChainID<mark style="color:red;">\*</mark>   | integer | chainID for cross to chain                  |
| decimal0                                      | integer | Decimals of the token0                      |
| token0<mark style="color:red;">\*</mark>      | string  | Contract address of a token on fromChain    |
| fromChainID<mark style="color:red;">\*</mark> | integer | chainID for cross from chain                |
| to                                            | string  | Recipient token1 on toChain                 |
| amountIn                                      | integer | Amount of a token to cross swap             |
| bridge<mark style="color:red;">\*</mark>      | string  | Use bridge of cross                         |
| token1<mark style="color:red;">\*</mark>      | string  | Contract address of a token on toChain      |
| decimal1                                      | integer | Decimals of the token1                      |
| channel                                       | string  | "default"、"web"、"android"、"ios"、"extension" |
| issuer                                        | string  | Sender of transaction push                  |

{% tabs %}
{% tab title="200: OK cross-chain swap data for EVM" %}

```javascript
{
    "result": 0,
    "message": "success",
    "data": {
        "token0": "",
        "token1": "",
        "chainID": "",
        "destChainID": "",
        "amountIn": "",
        "to": "",
        "price": ,
        "fee": "",
        "relayerFee":"",
        "feeRate": "",
        "amountOut": "",
        "crossPool": "",
        "router": "",
        "exchange": "",
        "data": ""
    }
    
}
```

{% endtab %}

{% tab title="200: OK cross-chain swap data for TRON Format" %}

```javascript
{
    "result": 0,
    "message": "success",
    "data": {
        "token0": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
        "token1": "0x55d398326f99059ff775485246999027b3197955",
        "chainID": "95500",
        "destChainID": "56",
        "amountIn": "31000000",
        "to": "",
        "price": "-",
        "fee": "0.44252000",
        "relayerFee":"",
        "feeRate": "-",
        "amountOut": "30557480427023319814",
        "crossPool": "-",
        "router": "TFHc9qsQCiepyyUQynnVVrQwMxZ37Fi15N",
        "exchange": "iswap",
        "data": {
            "contract": "TFHc9qsQCiepyyUQynnVVrQwMxZ37Fi15N",
            "fun": "otherswap(uint256,(address,address,address,uint256,uint256,uint256,bool,string,uint256),bytes)",
            "options": {
                "callValue": "0",
                "feeLimit": 100000000
            },
            "parameter": [
                {
                    "type": "uint256",
                    "value": "1"
                },
                {
                    "type": "tuple(address,address,address,uint256,uint256,uint256,bool,string,uint256)",
                    "value": [
                        "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
                        "0x55d398326f99059ff775485246999027b3197955",
                        "",
                        "31000000",
                        1,
                        4,
                        true,
                        "ios",
                        "56"
                    ]
                },
                {
                    "type": "bytes",
                    "value": "0x00...00"
                }
            ],
            "issuer": ""
        }
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Responses Details
{% endhint %}

* amountOut: cross-swap amountOut on toChain for token1
* router: Transit swap Router v3
* exchange: use bridge （anySwap or MetaPath)
* data: ABI data can be sent directly to router contract
* about 'relayerFee': if exchange is MetaPath, it'll be the number of token1

## Cross Order Callback API

If use 'MetaPath' to cross swap, it's better to request this api to speed up transactions.

## Order Callback

<mark style="color:blue;">`GET`</mark> `https://aggserver.transit.finance/v3/cross/order`

#### Query Parameters

| Name                                           | Type   | Description                                 |
| ---------------------------------------------- | ------ | ------------------------------------------- |
| bridge<mark style="color:red;">\*</mark>       | String |                                             |
| fromChainID<mark style="color:red;">\*</mark>  | String |                                             |
| toChainID<mark style="color:red;">\*</mark>    | String |                                             |
| token0<mark style="color:red;">\*</mark>       | String |                                             |
| token1<mark style="color:red;">\*</mark>       | String |                                             |
| to<mark style="color:red;">\*</mark>           | String |                                             |
| amountIn<mark style="color:red;">\*</mark>     | String |                                             |
| channel<mark style="color:red;">\*</mark>      | String |                                             |
| hash<mark style="color:red;">\*</mark>         | String | the hash of from chain's transaction        |
| amountOutMin<mark style="color:red;">\*</mark> | String | use the result data 'amountOut' of swap api |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "result": 0,
    "message": "success",
    "data": "" //order id
}
```

{% endtab %}
{% endtabs %}
