# Rest API

**Quote**

<mark style="color:green;">`Get`</mark> <http://xxxx.bridge/v2/quote?network=xxxx>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name                                                                                                                                                                                             | Type   | Description                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------------------------------------------- |
| `partnerFee`                                                                                                                                                                                     | string | Including the handling fees charged by JetonBridge and third-party partner fees |
| `srcChainId`                                                                                                                                                                                     | number | Original  chain Id                                                              |
| <p><code>srcToken{</code></p><p> <code>chainId,</code></p><p> <code>decimals,</code></p><p> <code>symbol,</code></p><p> <code>name,</code></p><p> <code>address</code><br><code>}</code></p>     | struct | Original chain token                                                            |
| `srcTokenAmount`                                                                                                                                                                                 | string | Number of cross chain operations with decimal                                   |
| `desChainId`                                                                                                                                                                                     | number | The ID of the target chain                                                      |
| <p><code>destToken{</code></p><p> <code>chainId,</code></p><p> <code>decimals,</code></p><p> <code>symbol,</code></p><p> <code>name,</code></p><p> <code>address</code></p><p><code>}</code></p> | struct | Target chain token                                                              |

**Response**

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

```json
{
  code: 200,
  msg: 'Success',
  data:{
      "allowanceTarget": "0xBEdB227947500b8d12d803C4dB77aC3336Ac4198",
      "contractAddress": "0xF81CC2e1C891147510F31777f6a853f58E4cDc64",
      "partnerFee": "2147565568030",
      "routers": [
        {
          "srcChainId": 1,
          "srcToken": {
            "decimals": 6,
            "symbol": "USDC",
            "name": "USDC",
            "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
          },
          "srcTokenAmount": "1000000",
          "destChainId": 137,
          "destToken": {
            "decimals": 6,
            "symbol": "USDC",
            "name": "USDC",
            "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
          },
          "bridgeInfo": {
            "bridgeName": "stargate",
            "srcChainId": 1,
            "srcBridgeToken": {
              "chainId": 1,
              "decimals": 6,
              "symbol": "USDC",
              "name": "USDC",
              "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
            },
            "destChainId": 137,
            "destBridgeToken": {
              "chainId": 137,
              "decimals": 6,
              "symbol": "USDC",
              "name": "USDC",
              "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
            },
            "srcBridgeTokenAmount": "1000000",
            "destBridgeTokenAmount": "998537",
            "bridgeFeeToken": {
              "chainId": 137,
              "decimals": 6,
              "symbol": "USDC",
              "name": "USDC",
              "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
            },
            "bridgeFeeAmount": "1463",
            "destGasFeeToken": {
              "chainId": 1,
              "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
              "decimals": 18,
              "symbol": "ETH",
              "name": "ETH",
              "isNative": true
            },
            "destGasFeeAmount": "0", 
            "depositMin": "0", 
            "depositMax": "0" 
          },
          "minReceiveAmount": "998537",
          "jetonFeeToken": {
            "chainId": 1,
            "decimals": 6,
            "symbol": "USDC",
            "name": "USDC",
            "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
          },
          "jetonFeeAmount": "3000",
          "estimatedTransferTimeMin": "100", 
          "estimatedTransferTimeMax": "120"
        }
      ]
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

**Encode**

<mark style="color:green;">`POST`</mark> <http://xxxx.bridge/v2/encode?network=xxxx>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name              | Type   | Description                                                                                |
| ----------------- | ------ | ------------------------------------------------------------------------------------------ |
| `allowanceTarget` | string | Contract requiring token approve                                                           |
| `beneficiary`     | string | Target chain to chain address                                                              |
| `contractAddress` | string | Interactive contracts can be transmitted or not transmitted                                |
| `partnerFee`      | string | Third party fees                                                                           |
| `permits`         | list   | Regarding the signature of miner fee permission and cross chain token permission signature |
| `referrerAddress` | string | Third party recommender fees                                                               |
| `router`          | struct | Cross chain bridge routing path                                                            |
| `userAddress`     | string | The address of the initiator user                                                          |

**Response**

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

```json
{
  from: '0xC88aE97BDD25366eCe0b9CB78c179674295D0425',
  to: '0x7D60c5A9CFFC091CdeD4fDDcB4ae7c007151fb97',
  value: '0',
  data: '0x1771fa39000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003c01e6457a96778f3f243613a90ecb04124f33cd6d50ab4ca2aa05beffb158685d000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000089000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f000000000000000000000000000000000000000000000000000000000005ad20000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003800000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000055d398326f99059ff775485246999027b319795500000000000000000000000000000000000000000000000000d5a81a1425b00000000000000000000000000067e795740ff8a28a0c8b1e7dbcecdfd797e6090f00000000000000000000000067e795740ff8a28a0c8b1e7dbcecdfd797e6090f000000000000000000000000f405b9ba64143e125d14019d3147145267c059ea0000000000000000000000000000000000000000000000000000000066b46e1e0000000000000000000000000000000000000000000000000000013889c400000000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000473776674000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f000000000000000000000000000000000000000000000000000000000005ad200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000d5a81a1425b00000000000000000000000000000000000000000000000000000000000000000095553445428425343290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30783637453739353734304646386132386130633862314537444243656364466437393745363039306600000000000000000000000000000000000000000000'
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}
