GET /swap
GET generated swap transaction calldata to swap in Butter router
Request Parameters
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
swapCaller
query
string
no
swap caller address, e.g., the smart contract address who calls butter rotuer, or the user account who directly calls butter router
Request Example
GET /swap?hash=0x286081342b93d276381a8cf4b43990e3a522fb25d0c50c3467dce7ff4543c92c&slippage=100&from=0x2D4C407BBe49438ED859fe965b140dcF1aaB71a9&receiver=0x2D4C407BBe49438ED859fe965b140dcF1aaB71a9
Responses Structure
The response contains the following fields:
errno
number
message
string
Response message. If the request was successful it is success
, otherwise it gives corresponding error message.
data
array
Contains data on the swap transaction details.
data
Field
data
FieldThe data
field contains an array with one or more transactions data on source blockchain. Each item has the following fields:
to
string
The account address which the user interacts with on source chain.
data
string
The encoded transaction data. This field is optional for some blockchains.
value
string
The native token amount to be transferred to the 'to' address.
chainId
string
Source chain Id.
method
string
The contract method the user calls. This field is optional for some blockchains.
args
array
The detailed arguments information of the method, including type and value.
Response Examples
get swap transaction calldata successfully
200 Response
{
"errno": 0,
"message": "success",
"data": [
{
"to": "0xEE030ec6F4307411607E55aCD08e628Ae6655B86",
"data": "0x6e1537da00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004d0e30db00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000014ff0309a8f2a9d9afe040d990bba4ef3512e3288800000000000000000000000000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200aee9ba7040d778922a763ce8a50948d61aff50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000000000000000000000000000004380e789051b7c6b00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000aa301070448385cfaac5913a67b16c4392944a8f000000000000000000000000aa301070448385cfaac5913a67b16c4392944a8f0000000000000000000000000000000000000000000000000dd4b49c140cc00000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000404efa0646500000000000000000000000000000000000000000000000000000000000000200000000000000000000000002170ed0880ac9a755fd29b2688956bd959f933f8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000000000000000000000000000004380e789051b7c6b00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd400000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd40000000000000000000000000000000000000000000000000b10907cdcd7000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002b2170ed0880ac9a755fd29b2688956bd959f933f80001f4bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b971ef87ede563556b2ed4b1c0b0019111dd85d2000000000000000000000000b971ef87ede563556b2ed4b1c0b0019111dd85d200000000000000000000000000000000000000000000000002c4241f3735c00000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002b2170ed0880ac9a755fd29b2688956bd959f933f80001f4bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000200aee9ba7040d778922a763ce8a50948d61aff50000000000000000000000000000000000000000000000000000000000000000",
"value": "0x0de0b6b3a7640000",
"chainId": "1",
"method": "swapAndBridge",
"args": [
{
"type": "bytes32",
"value": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"type": "address",
"value": "0x2D4C407BBe49438ED859fe965b140dcF1aaB71a9"
},
{
"type": "address",
"value": "0x0000000000000000000000000000000000000000"
},
{
"type": "uint256",
"value": "1000000000000000000"
},
{
"type": "bytes",
"value": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004d0e30db000000000000000000000000000000000000000000000000000000000"
},
{
"type": "bytes",
"value": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000014ff0309a8f2a9d9afe040d990bba4ef3512e3288800000000000000000000000000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200aee9ba7040d778922a763ce8a50948d61aff50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000000000000000000000000000004380e789051b7c6b00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000aa301070448385cfaac5913a67b16c4392944a8f000000000000000000000000aa301070448385cfaac5913a67b16c4392944a8f0000000000000000000000000000000000000000000000000dd4b49c140cc00000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000404efa0646500000000000000000000000000000000000000000000000000000000000000200000000000000000000000002170ed0880ac9a755fd29b2688956bd959f933f8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a90000000000000000000000000000000000000000000000004380e789051b7c6b00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd400000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd40000000000000000000000000000000000000000000000000b10907cdcd7000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002b2170ed0880ac9a755fd29b2688956bd959f933f80001f4bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b971ef87ede563556b2ed4b1c0b0019111dd85d2000000000000000000000000b971ef87ede563556b2ed4b1c0b0019111dd85d200000000000000000000000000000000000000000000000002c4241f3735c00000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002b2170ed0880ac9a755fd29b2688956bd959f933f80001f4bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
},
{
"type": "bytes",
"value": "0x"
},
{
"type": "bytes",
"value": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000200aee9ba7040d778922a763ce8a50948d61aff50000000000000000000000000000000000000000000000000000000000000000"
}
]
}
]
}
fail to get swap transaction calldata
200 Response
{
"errno": <error code>,
"message": <detailed error message>
}
Note: error code can be found in here
Last updated