When a transaction occurs in the wallet, the corresponding address will have asset changes. You can call the POST /api/v5/waas/asset/get-assets
API to view the asset changes.
//Define parameters
const postAssetsBody = {
walletId: '13886e05-1265-4b79-8ac3-b7ab46211001',
chainIds: '["1"]',
};
//Define auxiliary function
const postAssetsData = async () => {
const apiRequestUrl = getRequestUrl(
apiBaseUrl,
'/api/v5/waas/asset/get-assets'
);
return fetch(apiRequestUrl, {
method: 'post',
headers: headersParams,
body: JSON.stringify(postAssetsBody),
})
.then((res) => res.json())
.then((res) => {
return res;
});
};
const { data: assetsData } = await postAssetsData();
When querying assets, you will receive the following response:
{
"code": 0,
"msg": "success",
"data": [{
"tokenAssets": [{
"address": "0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2",
"chainId": "1",
"coinId": "814",
"symbol": "OKB",
"balance": "146.800887"
}, {
"address": "0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2",
"chainId": "1",
"coinId": "3",
"symbol": "ETH",
"balance": "0.014814"
}],
"nftAssets": {
"networkValuations": [{
"chainId": "66",
"name": "OKTC",
"valuation": "0.002098114901256717"
}],
"valuationSum": "0.002098114901256717"
}
}]
}