Create Swap Parameters for a Trade
POST/swap/swapcallparameters
Create Swap Parameters for a Trade
Request
Query Parameters
apiKey stringrequired
(Required) Your Public API key
Example: {{publicKey}}
- application/json
Body
currencyIn string
currencyOut string
amountIn string
recipient string
slippageTolerance string
deadline string
Responses
- 201
Created
- application/json
- Schema
- Example (from schema)
- example-0
- example-1
Schema
object
{}
Successful Response
{
"data": {
"info": {
"inputAmount": "1",
"outputAmount": "965.616",
"route": [
"WETH",
"USDC"
],
"inputToken": "WETH",
"outputToken": "USDC",
"executionPrice": "965.617",
"nextMidPrice": "722.082",
"priceImpact": "25.612"
},
"trade": {
"route": {
"pairs": [
{
"liquidityToken": {
"decimals": 18,
"symbol": "UNI-V2",
"name": "Uniswap V2",
"chainId": 122,
"address": "0x20a680D69a5aE2677B8CF43aBF63aAD6D8d5119A"
},
"tokenAmounts": [
{
"numerator": [
-491531807
],
"denominator": [
1000000
],
"currency": {
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
},
"token": {
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
}
},
{
"numerator": [
-2070596893,
682205361
],
"denominator": [
-1486618624,
232830643
],
"currency": {
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
},
"token": {
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
}
}
]
}
],
"path": [
{
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
},
{
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
}
],
"midPrice": {
"numerator": [
-491531807
],
"denominator": [
-2070596893,
682205361
],
"baseCurrency": {
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
},
"quoteCurrency": {
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
},
"scalar": {
"numerator": [
-1486618624,
232830643
],
"denominator": [
1000000
]
}
},
"input": {
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
},
"output": {
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
}
},
"tradeType": 0,
"inputAmount": {
"numerator": [
-1486618624,
232830643
],
"denominator": [
-1486618624,
232830643
],
"currency": {
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
},
"token": {
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
}
},
"outputAmount": {
"numerator": [
965616800
],
"denominator": [
1000000
],
"currency": {
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
},
"token": {
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
}
},
"executionPrice": {
"numerator": [
965616800
],
"denominator": [
-1486618624,
232830643
],
"baseCurrency": {
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
},
"quoteCurrency": {
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
},
"scalar": {
"numerator": [
-1486618624,
232830643
],
"denominator": [
1000000
]
}
},
"nextMidPrice": {
"numerator": [
-1457148607
],
"denominator": [
737751779,
915036005
],
"baseCurrency": {
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether on Fuse",
"chainId": 122,
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"tokenInfo": {
"name": "Wrapped Ether on Fuse",
"address": "0xd8Bf72f3e163B9CF0C73dFdCC316417A5ac20670",
"symbol": "WETH",
"decimals": 18,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
},
"tags": []
},
"quoteCurrency": {
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin on Fuse",
"chainId": 122,
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"tokenInfo": {
"name": "USD Coin on Fuse",
"address": "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5",
"symbol": "USDC",
"decimals": 6,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
"tags": []
},
"scalar": {
"numerator": [
-1486618624,
232830643
],
"denominator": [
1000000
]
}
},
"priceImpact": {
"numerator": [
856059488,
1380480455,
-336661329,
549156708,
8387887
],
"denominator": [
1479278592,
1664736159,
977444823,
944423004,
32750022
]
}
}
}
}
Error Response
{
"error": {
"code": 1,
"message": "Pool is out of liquidity"
}
}
Loading...