You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
explorer-v2-frontend/scripts/updateBridgeTokensList.js

20 lines
717 B

const fs = require('fs');
const fetch = require('node-fetch');
const outputFileName = 'src/config/bridgeTokensMap.json';
(async function updateTokens () {
try {
console.log('Getting tokens list using bridge API...')
const response = await fetch('https://be4.bridge.hmny.io/tokens/?page=0&size=1000');
const { content: tokensList } = await response.json();
const tokensMap = {}
tokensList.forEach(item => {
tokensMap[item.hrc20Address.toLowerCase()] = item.symbol
})
await fs.writeFileSync(outputFileName, JSON.stringify(tokensMap))
console.log(`${tokensList.length} bridge tokens successfully written to '${outputFileName}'`)
} catch (err) {
console.error(err)
}
})()