trustwallet-assets/script/updateBEP2.js
Viktor Radchenko d64a55e925 New repo format. Big changes (#502)
* Add checksum address to tezos validators

* Rename tron validators and assets

* Optimised images with calibre/image-actions

* Uppercase BNB coins

* Rename waves

* Checksum TT addresses

* Checksum POA addresses

* Checksum ETC addresses

* Checksum Ethreum and POA addresses

* Add ethereum-checksum-address

* Add BEP2 logos

* remove

* Fix Ethereum test

* Checksum Tomo

* Checksum Wanchain

* Update ALGO logo

* Update test

* Update readme

* Remove callisto from verify tokens

* Update logo.png

* Rename tezos

* Add web3

* Add new BEP2 images

* Uppercase blacklist BEp2

* pdate fetchin opensea nft addreses

* test

* new

* to checksum

* Update package

* Exclude callisto from test

* Checksum the rest

* To checksum script

* remove

* remove

* remove

* Add

* Add jest

* Use jest

* Breezecoin (BRZE)

* Test using Jest

* Remove mongoose

* Update scritps

* 999

* Move dep to dev

* Optimised images with calibre/image-actions

* Uppercase

* To checksum

* new

* Add babel

* Checksum

* Move helper meethods to sepaarate file for future reuse

* rename vthor

* Move js => typescript

* Add ts-node

* Add default lists

* Init blacklist

* Fetch opensea assets

* Add more helpers

* fethc opensea nonerc20 for blacklist

* Add list command

* script: checksum BEP2

* Rename to ts

* Remove old blacklist

* Update whitelist and blacklist

* Remove tezos validator due to end of service

Closes https://github.com/trustwallet/assets/issues/581

* script: generate white and black lists

* Add Stakenow to Tezos

* Arch Crypton Game (ARCG)

* Optimised images with calibre/image-actions

* Update list

* many updates

* Optimised images with calibre/image-actions

* Add daps

* Optimised images with calibre/image-actions

* Update Ethereum blacklist

* Utilize trustwallet/types

* Remove duplicate

* Reflex (RFX)

* Remove lowercased
2019-11-08 10:55:40 -08:00

39 lines
1.3 KiB
JavaScript

const axios = require("axios")
const bluebird = require("bluebird")
const fs = require("fs")
const path = require("path")
const chalk = require('chalk')
;(async () => {
const { assetInfoList } = await axios.get(`https://explorer.binance.org/api/v1/assets?page=1&rows=1000`).then(r => r.data)
await bluebird.each(assetInfoList, async ({ asset, assetImg }) => {
if (assetImg) {
const binanceDir = path.join(__dirname, `../blockchains/binance`)
const imagePath = `${binanceDir}/assets/${asset}/logo.png`
if (fs.existsSync(imagePath)) {
console.log(chalk.green(`${asset}`))
} else {
console.log(chalk.red(`${asset}`))
fs.mkdir(`${binanceDir}/assets/${asset}`, err => {
if (err && err.code != `EEXIST`) throw err
})
await fetchImage(assetImg).then(buffer => {
buffer.pipe(fs.createWriteStream(imagePath))
})
}
}
})
function fetchImage(url) {
return axios.get(url, { responseType: "stream" }).then(r => r.data).catch(err => {
throw `Error fetchImage: ${url} ${err.message}`
})
}
})().catch(err => {
console.error(err)
process.exit(1)
})