Call GET /api/v5/waas/blockchain/get-all-chains
to get all currently supported chains, such as Bitcoin, Ethereum, etc.
//Define helper function
const getAllowanceData = async () => {
const apiRequestUrl = getRequestUrl(
apiBaseUrl,
'/api/v5/waas/blockchain/get-all-chains'
);
return fetch(apiRequestUrl, {
method: 'get',
headers: headersParams,
})
.then((res) => res.json())
.then((res) => {
return res;
});
};
When the call is successful, the following information is returned (an example for Ethereum is given).
{
"code": 0,
"data": [{
"name": "Ethereum",
"logoUrl": "http://www.eth.org/eth.png",
"shortName": "ETH",
"enableGas": true,
"coinId": "3",
"chainId": "1"
}],
"msg": "success"
}
You can call the GET /api/v5/waas/asset/get-all-coins
API to get information about all supported currencies, including main chain coins (such as ETH) and tokens issued on the chain (such as USDT). Depending on the parameters, this API can return default supported currencies and project-custom added currencies. In this example, we will return all currencies supported by the platform.
//1. Define your parameters
const getAllcoinsParams = {
type: 0,
};
//2. Define auxiliary functions
const getAllcoinsData = async () => {
const apiRequestUrl = getRequestUrl(
apiBaseUrl,
'api/v5/waas/asset/get-all-coins',
getAllcoinsParams
);
return fetch(apiRequestUrl, {
method: 'get',
headers: headersParams,
})
.then((res) => res.json())
.then((res) => {
return res;
});
};
const { data: allcoinsData } = await getAllcoinsData();
When the call is successful, the following information is returned (an example for Ethereum-related currencies).
{
"code": 0,
"data": [{
"chainId": 1,
"coinId": 3,
"decimals": 18,
"logoUrl": "https://static.coinall.ltd/cdn/wallet/logo/ETH-20220328.png",
"name": "Ethereum",
"symbol": "ETH",
"tokenAddress": "",
"updateTime": 1543198579776
}, {
"chainId": 61,
"coinId": 4,
"decimals": 18,
"logoUrl": "https://static.coinall.ltd/cdn/wallet/logo/ETC.png",
"name": "Ethereum Classic",
"symbol": "ETC",
"tokenAddress": "",
"updateTime": 1543198579776
}],
"msg": "success"
}