Overview
The Deserialize API provides several endpoints for token swaps, market data, and account information on the 0G blockchain.
Base URL
https://evm-api.deserialize.xyz/:networkIdSupported Networks
The Deserialize API currently supports the following networks:
- 0G Mainnet (networkId: 0G)
- Base (networkId: BASE)
Get Quote
Request a quote for swapping tokens. This endpoint calculates the optimal route and expected output amount.
Request
POST
/quoteGet swap quoteRequest Example
json
{
"tokenA": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"dexId": "ALL",
"amountIn": "1000000000000000000"
}Response Example
json
{
"tokenA": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"amountIn": "1000000000000000000",
"amountOut": "2429260061494",
"tokenPrice": "2436.737744408513",
"routePlan": [
{
"tokenA": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"dexId": "ZERO_G",
"poolAddress": "0x224D0891D63Ca83e6DD98B4653C27034503a5E76",
"aToB": true,
"fee": 3000
}
],
"dexId": "ALL",
"dexFactory": "0x9bdcA5798E52e592A08e3b34d3F18EeF76Af7ef4",
"isNativeIn": true,
"isNativeOut": false
}Execute Swap
Execute a token swap transaction using a quote obtained from the quote endpoint.
Request
POST
/swapExecute swap transactionRequest Example
json
{
"publicKey": "0xe0918C56A2C7a216644B6d890c80d164417A70E3",
"quote": {
"tokenA": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"amountIn": "1000000000000000000",
"amountOut": "2429260061494",
"tokenPrice": "2436.737744408513",
"routePlan": [
{
"tokenA": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"dexId": "ZERO_G",
"poolAddress": "0x224D0891D63Ca83e6DD98B4653C27034503a5E76",
"aToB": true,
"fee": 3000
}
],
"dexId": "ALL",
"dexFactory": "0x9bdcA5798E52e592A08e3b34d3F18EeF76Af7ef4",
"isNativeIn": true,
"isNativeOut": false
},
"slippage": 1
"partnerFees": {
"fee": 50,
"recipient": "0x1234567890123456789012345678901234567890"
}
}Response Example
json
{
"transactions": [
{
"from": "0xe0918C56A2C7a216644B6d890c80d164417A70E3",
"to": "0x228864aeAAE12Ee8000D9543d9cCfB538F46Da3b",
"data": "0x5a18dddd00000000000000000000000000000000...",
"value": "1000000000000000000"
}
]
}Token List
Retrieve lists of available tokens on the platform.
Get Token Addresses
GET
/tokenListResponse Example
json
{
"result": [
"0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
"0x7bbc63d01ca42491c3e084c941c3e86e55951404",
"0x2c81a9883f9570266ab734a9671412e72e7a615d",
...
]
}Get Tokens with Details
GET
/tokenListWithDetailsResponse Example
json
{
"result": [
{
"address": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
"decimals": 18,
"symbol": "W0G",
"name": "Wrapped 0G",
"contractAddress": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c"
},
...
]
}Token Details
Get detailed information about a specific token.
GET
/tokenDetails/:tokenAddressExample Request
bash
GET /tokenDetails/0x1cd0690ff9a693f5ef2dd976660a8dafc81a109cResponse
json
{
"result": {
"address": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
"decimals": 18,
"symbol": "W0G",
"name": "Wrapped 0G",
"contractAddress": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c"
}
}Token Price
Get the current price of a token.
GET
/tokenPrice/:tokenAddressExample Request
bash
GET /tokenPrice/0x1cd0690ff9a693f5ef2dd976660a8dafc81a109cResponse
json
{
"result": 2.5629232
}Need help? Contact support or visit our developer community.