Default
Returns a graph-based routing plan for swap request. The plan includes detailed routes through various liquidity sources and can optionally include encoded calldata for immediate execution.
Integer ID of the blockchain
1
Address of sell token. For native tokens, use either
0x0000000000000000000000000000000000000000
or 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
0x853d955acef822db058eb8505911ed77f175b99e
Address of buy token. For native tokens, use either
0x0000000000000000000000000000000000000000
or 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
0x1f9840a85d5af5bf1d1762f925bdaddc4201f984
Amount of sellToken to sell (in base units). Exactly one of sellAmount or buyAmount must be provided.
10000000000000000000000
Amount of buyToken to buy (in base units). Exactly one of sellAmount or buyAmount must be provided.
1000000000000000000
Whether to use market maker RFQ liquidity
false
Example: false
Router contract unique name
default-router
Example: swapnet-router
Possible values: Whether to include calldata in the response
false
Example: false
User's wallet address. Required when includeCalldata=true
0x11b86991c6218b36c1d19d4a2e9eb0ce3606eb49
Slippage tolerance (0.01 = 1%). Required when includeCalldata=true
0.01
Your API key
your-api-key-here
Successful swap routing response
Bad request - Invalid parameters
Internal server error
GET /api/v1.0/swap?chainId=1&sellToken=text&buyToken=text&apiKey=text HTTP/1.1
Host: app.swap-net.xyz
Accept: */*
{
"aggregator": "swapnet",
"router": "default-router",
"sell": {
"referenceId": 7,
"amount": "10000000000000000000000"
},
"buy": {
"referenceId": 6,
"amount": "1034955025987043448356"
},
"nativeTokenUsdPrice": 4622.638914277432,
"tokens": [
{
"referenceId": 7,
"address": "0x853d955acef822db058eb8505911ed77f175b99e",
"name": "Frax",
"symbol": "FRAX",
"decimals": 18,
"usdPrice": 0.9985832349359104
},
{
"referenceId": 6,
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"name": "Uniswap",
"symbol": "UNI",
"decimals": 18,
"usdPrice": 9.632281172169868
}
],
"routes": [
{
"address": "0xc63b0708e2f7e69cb8a1df0e1389a98c35a76d52",
"name": "UniswapV3",
"details": {
"fee": 500
},
"fromTokens": [
{
"referenceId": 7,
"amount": "10000000000000000000000"
}
],
"toTokens": [
{
"referenceId": 6,
"amount": "1034955025987043448356"
}
]
}
]
}
Returns a list of example tokens for trading on the specified chain. Notice that this is not a full list of tradable tokens.
Integer ID of the blockchain
1
Your API key
your-api-key-here
Successful tokens response
Bad request - Invalid parameters
Internal server error
GET /api/v1.0/tokens?chainId=1&apiKey=text HTTP/1.1
Host: app.swap-net.xyz
Accept: */*
[
{
"address": "0x853d955acef822db058eb8505911ed77f175b99e",
"name": "Frax",
"symbol": "FRAX",
"decimals": 18,
"metadata": {
"logoURI": "https://example.com/frax.png"
}
},
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"name": "Uniswap",
"symbol": "UNI",
"decimals": 18,
"metadata": {
"logoURI": "https://example.com/uni.png"
}
}
]
Returns a list of blockchain networks supported by the SwapNet aggregator.
Your API key
your-api-key-here
Successful chains response
Bad request - Invalid parameters
Internal server error
GET /api/v1.0/chains?apiKey=text HTTP/1.1
Host: app.swap-net.xyz
Accept: */*
[
{
"chainId": 1,
"name": "Ethereum"
},
{
"chainId": 137,
"name": "Polygon"
},
{
"chainId": 42161,
"name": "Arbitrum One"
}
]
Returns detailed information about a specific blockchain network, including supported routers, liquidity sources, and key token addresses.
Integer ID of the blockchain
1
Your API key
your-api-key-here
Successful chain info response
Bad request - Invalid parameters
Internal server error
GET /api/v1.0/chainInfo?chainId=1&apiKey=text HTTP/1.1
Host: app.swap-net.xyz
Accept: */*
{
"chainId": 1,
"name": "Ethereum",
"usdTokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"wrappedNativeTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"routers": [
{
"name": "default-router",
"liquiditySources": [
"UniswapV2",
"UniswapV3",
"SushiswapV2"
],
"deployedAddress": "0x616000e384Ef1C2B52f5f3A88D57a3B64F23757e",
"hasEncoder": true
}
]
}