Feature/bridged token indicator (#138)
* Add script to retrieve bridget tokens list; add bridged token indicator to HRC20, HRC721, HRC1155 tokens list * Set isBridged flag on erc tokens updatespull/141/head
parent
a4f22389a9
commit
ac53dd3cfa
@ -0,0 +1,19 @@ |
|||||||
|
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) |
||||||
|
} |
||||||
|
})() |
File diff suppressed because one or more lines are too long
@ -1 +1,5 @@ |
|||||||
|
import { default as bridgeTokens } from "src/config/bridgeTokensMap.json"; |
||||||
|
|
||||||
export const config = {} |
export const config = {} |
||||||
|
|
||||||
|
export const bridgeTokensMap: Record<string, string> = bridgeTokens || {} |
||||||
|
Loading…
Reference in new issue