Skip to content

Commit

Permalink
update router API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
PandaRR007 committed Sep 9, 2024
1 parent c1f981d commit 45a7683
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 47 deletions.
31 changes: 16 additions & 15 deletions butterswap/butter-api-for-routing/get-route.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@ GET get routes from 'tokenIn' to 'tokenOut', support both cross chain and same c

### **Params**

|Name|Location|Type| Required | Description |
|---|---|---|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|fromChainId|query|string| yes | source chain id, the supported chain ID list can be get from endpiont /supportedChainList |
|toChainId|query|string| yes | destination chain id |
|amount|query|string| yes | amount of source token | 1.0 |
|tokenInAddress|query|string| yes | address of source token, use 0x0000000000000000000000000000000000000000 for native token on most blockchains, T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb for native token on Tron |
|tokenOutAddress|query|string| yes | address of destination token |
|type|query|string| yes | swap type, one of "exactIn" and "exactOut" |
|slippage|query|string| yes | slippage of swap, a integer in range [0, 5000], e.g, 100 means 1%. For cross chain swap, the min slippage is 300 |
|receiver|query|string| no | receiver on destination chain, it is required when source chain is Solana |
| entrance | query | string | no | entrance of swap, ether entrance or referrer should be specified. It is required when source chain is Near, please contact us for applying your dedicated entrance |
| referrer | query | string | no | referrer of swap, ether entrance or referrer should be specified. If entrance is not provided, referrer is required |
|feeType|query|string| no | fee type when collecting fee, "0" for fixed fee, "1" for proportion fee, the default value is "1". This field is valid only when entrance is not provided |
|rateOrNativeFee|query|string| no | if fee type is "0", this is the fixed fee amount in native token, if fee type is "1", this is the proportion fee rate. This field is valid only when entrance is not provided' |
| Name |Location|Type| Required | Description |
|-----------------|---|---|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| fromChainId |query|string| yes | source chain id, the supported chain ID list can be get from endpiont /supportedChainList |
| toChainId |query|string| yes | destination chain id |
| amount |query|string| yes | amount of source token | 1.0 |
| tokenInAddress |query|string| yes | address of source token, use 0x0000000000000000000000000000000000000000 for native token on most blockchains, T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb for native token on Tron |
| tokenOutAddress |query|string| yes | address of destination token |
| type |query|string| yes | swap type, one of "exactIn" and "exactOut" |
| slippage |query|string| yes | slippage of swap, a integer in range [0, 5000], e.g, 100 means 1%. For cross chain swap, the min slippage is 150, for cross chain from/to TON, min slippage is 300 |
| receiver |query|string| no | receiver on destination chain, it is required when source chain is Solana |
| entrance | query | string | no | entrance of swap, ether entrance or referrer should be specified. It is required when source chain is Near, please contact us for applying your dedicated entrance |
| referrer | query | string | no | referrer of swap, ether entrance or referrer should be specified. If entrance is not provided, referrer is required |
| feeType |query|string| no | fee type when collecting fee, "0" for fixed fee, "1" for proportion fee, the default value is "1". This field is valid only when entrance is not provided |
| rateOrNativeFee |query|string| no | if fee type is "0", this is the fixed fee amount in native token, if fee type is "1", this is the proportion fee rate. This field is valid only when entrance is not provided' |
| caller | query | string | no | caller of butter router contract |

#### Request Example

```bash
GET /route?fromChainId=56&toChainId=22776&amount=1&tokenInAddress=0x0000000000000000000000000000000000000000&tokenOutAddress=0x0000000000000000000000000000000000000000&type=exactIn&slippage=100&entrance=<entrance>
GET /route?fromChainId=56&toChainId=22776&amount=1&tokenInAddress=0x0000000000000000000000000000000000000000&tokenOutAddress=0x0000000000000000000000000000000000000000&type=exactIn&slippage=150&entrance=<entrance>
```

### **Responses**
Expand Down
6 changes: 3 additions & 3 deletions butterswap/butter-api-for-routing/get-routeandswap.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ GET get best routes and generate swap transaction calldata to swap in Butter rou
| tokenInAddress | query | string | yes | address of source token, use 0x0000000000000000000000000000000000000000 for native token on most blockchains, T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb for native token on Tron |
| tokenOutAddress | query | string | yes | address of destination token |
| type | query | string | yes | swap type, one of "exactIn" and "exactOut" |
| slippage | query | string | yes | slippage of swap, a integer in range [0, 5000], e.g, 100 means 1%. For cross chain swap, the min slippage is 300 |
| slippage | query | string | yes | slippage of swap, a integer in range [0, 5000], e.g, 100 means 1%. For cross chain swap, the min slippage is 150, for cross chain from/to TON, min slippage is 300 |
| from | query | string | yes | sender address on source chain |
| receiver | query | string | yes | receiver address on destination chain |
| entrance | query | string | no | entrance of swap, ether entrance or referrer should be specified. It is required when source chain is Near, please contact us for applying your dedicated entrance |
| referrer | query | string | no | referrer of swap, ether entrance or referrer should be specified. If entrance is not provided, referrer is required |
| feeType | query | string | no | fee type when collecting fee, "0" for fixed fee, "1" for proportion fee, the default value is "1". This field is valid only when entrance is not provided |
| rateOrNativeFee | query | string | no | if fee type is "0", this is the fixed fee amount in native token, if fee type is "1", this is the proportion fee rate. This field is valid only when entrance is not provided' |
| callData | query | string | no | encoded call data if receiver is a contract |

| caller | query | string | no | caller of butter router contract |

### Request Example

```bash
GET /routeAndSwap?fromChainId=56&toChainId=22776&amount=1&tokenInAddress=0x0000000000000000000000000000000000000000&tokenOutAddress=0x0000000000000000000000000000000000000000&type=exactIn&slippage=100&entrance=<entrance>&from=0x2D4C407BBe49438ED859fe965b140dcF1aaB71a9&receiver=0x2D4C407BBe49438ED859fe965b140dcF1aaB71a9
GET /routeAndSwap?fromChainId=56&toChainId=22776&amount=1&tokenInAddress=0x0000000000000000000000000000000000000000&tokenOutAddress=0x0000000000000000000000000000000000000000&type=exactIn&slippage=150&entrance=<entrance>&from=0x2D4C407BBe49438ED859fe965b140dcF1aaB71a9&receiver=0x2D4C407BBe49438ED859fe965b140dcF1aaB71a9
```

### **Responses**
Expand Down
47 changes: 25 additions & 22 deletions butterswap/butter-api-for-routing/get-supportedchainlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,39 @@ GET /supportedChainList
   59144,
   534352,
   42161,
   1360104473493505,
   10
]
}
```

#### Butter Chain ID explanation

| Chain Id | Blockchain Name |
| ---------------- | ----------------------- |
| 1 | Ethereum |
| 137 | Polygon Mainnet |
| 56 | BNB Smart Chain Mainnet |
| 1030 | Conflux eSpace |
| Chain Id | Blockchain Name |
|-----------------|-------------------------|
| 1 | Ethereum |
| 137 | Polygon Mainnet |
| 56 | BNB Smart Chain Mainnet |
| 1030 | Conflux eSpace |
| 1360100178526209 | Near Protocol |
| 22776 | MAP Protocol |
| 728126428 | Tron |
| 8217 | Klaytn Mainnet Cypress |
| 1501 | BEVM Canary |
| 4200 | Merlin Mainnet |
| 2649 | AILayer |
| 8453 | Base |
| 81457 | Blast |
| 324 | zkSync Mainnet |
| 223 | B2 Mainnet |
| 810180 | zkLink Nova Mainnet |
| 5000 | Mantle |
| 59144 | Linea |
| 534352 | Scroll |
| 42161 | Arbitrum One |
| 10 | OP Mainnet |
| 22776 | MAP Protocol |
| 728126428 | Tron |
| 8217 | Klaytn Mainnet Cypress |
| 1501 | BEVM Canary |
| 4200 | Merlin Mainnet |
| 2649 | AILayer |
| 8453 | Base |
| 81457 | Blast |
| 324 | zkSync Mainnet |
| 223 | B2 Mainnet |
| 810180 | zkLink Nova Mainnet |
| 5000 | Mantle |
| 59144 | Linea |
| 534352 | Scroll |
| 42161 | Arbitrum One |
| 10 | OP Mainnet |
| 1360104473493505 | TON |
| 197710212031 | Solana |



Expand Down
14 changes: 7 additions & 7 deletions butterswap/butter-api-for-routing/get-swap.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ GET generated swap transaction calldata to swap in Butter router

#### Params

| Name | Location | Type | Required | Description |
| -------- | -------- | ------ | -------- | ----------------------------------------------------------------- |
| hash | query | string | yes | the route hash returned by /route |
| slippage | query | string | yes | slippage of swap, a integer in rang \[0, 5000], e.g, 100 means 1% |
| from | query | string | yes | sender address on source chain |
| receiver | query | string | yes | receiver address on destination chain |
| callData | query | string | no | encoded call data if receiver is a contract |
| Name | Location | Type | Required | Description |
| -------- | -------- | ------ | -------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| hash | query | string | yes | the route hash returned by /route |
| slippage | query | string | yes | slippage of swap, a integer in rang \[0, 5000], e.g, 100 means 1%. For cross chain swap, the min slippage is 150, for cross chain from/to TON, min slippage is 300 |
| from | query | string | yes | sender address on source chain |
| receiver | query | string | yes | receiver address on destination chain |
| callData | query | string | no | encoded call data if receiver is a contract |

### Request Example

Expand Down

0 comments on commit 45a7683

Please sign in to comment.