Widget Config Reference
Config
url: https://api.0xgen.io/v1/:code/config
method: GET
params:
// The success response example:
{
"code": 200,
"data": {
"dexes": [
{
"name": "openOcean",
"amount": "1614773503060146858429"
},
{
"name": "1inch",
"amount": "1614222924617714762008"
}
],
"maxOutAmount": "1614773503060146858429",
"minOutAmount": "1614222924617714762008",
"inToken": {
"symbol": "BNB",
"name": "Binance Coin",
"address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"decimals": 18
},
"outToken": {
"symbol": "1INCH",
"name": "1INCH Token",
"address": "0x111111111117dc0aa78b770fa6a738034120c302",
"decimals": 18
},
"inAmount": "5000000000000000000"
}
}
method: get
params:
parameter
type
example
description
code
string
test
you need contract
example:
request: https://api.0xgen.io/v1/test/config
response:
{
"code": 200,
"data": [
{
"tokenList": [
{
"id": 1230,
"code": "tether",
"name": "Tether USD",
"address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
"decimals": 6,
"symbol": "USDT",
"icon": "//s3.0xgen.io/images/1638171782127_827514804605747.png",
"chain": "arbitrum",
"createtime": "2021-11-24T08:56:35.000Z",
"hot": "02",
"sort": "2021-11-24T08:56:55.000Z",
"chainId": 42161
},
{
"id": 1231,
"code": "usd-coin",
"name": "USD Coin",
"address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
"decimals": 6,
"symbol": "USDC",
"icon": "//s3.0xgen.io/images/1637744329482_9981818339876964.png",
"chain": "arbitrum",
"createtime": "2021-11-24T08:59:02.000Z",
"hot": "01",
"sort": "2022-04-18T10:53:28.000Z",
"chainId": 42161
},
...
],
"from": {
"id": 1290,
"code": "ethereum",
"name": "ETH",
"address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"decimals": 18,
"symbol": "ETH",
"icon": "//s3.0xgen.io/images/1638168890910_08380754794247047.png",
"chain": "arbitrum",
"createtime": "2021-11-29T06:54:54.000Z",
"hot": "01",
"sort": "2022-04-18T10:53:22.000Z",
"chainId": 42161
},
"to": {
"id": 1231,
"code": "usd-coin",
"name": "USD Coin",
"address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
"decimals": 6,
"symbol": "USDC",
"icon": "//s3.0xgen.io/images/1637744329482_9981818339876964.png",
"chain": "arbitrum",
"createtime": "2021-11-24T08:59:02.000Z",
"hot": "01",
"sort": "2022-04-18T10:53:28.000Z",
"chainId": 42161
},
"chain": "arbitrum",
"chainId": "42161",
"symbol": "ETH",
"address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"decimals": 18,
"rpcUrl": "https://arb1.arbitrum.io/rpc",
"blockExplorerUrl": "https://arbiscan.io/tx/",
"name": "Arbitrum",
"code": "arbitrum",
"ids": "ethereum"
},
...]
}
Custom Mode
If you choose to integrate an iframe from https://app.0xgen.io, some wallets (Phantom, Sollet, Solflare) might not work properly.
To address this issue, you can configure your server nginx like below, and the frontend iframe config should be the same as the 0xgen widget.
Step 1 - Config nginx
server {
listen 80;
server_name app.0xgen.net;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host "app.0xgen.io";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 20m;
location / {
proxy_pass https://app.0xgen.io;
}
}
Step 2 - Config Front-end (for example: 0xgen.net)
<script>
document.domain = "0xgen.net";
</script>
<iframe src="https://app.0xgen.net?domain=0xgen.net"></iframe>
Last updated