trustwallet-assets/script/gen_list.ts

62 lines
1.9 KiB
TypeScript
Raw Normal View History

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 18:55:41 +00:00
const fs = require('fs')
import { getOpenseaCollectionAddresses } from "./opesea_contrats"
import {
Ethereum, Classic, POA, TomoChain, GoChain, Wanchain, ThunderCore,
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 18:55:41 +00:00
getChainAssetsPath,
readDirSync,
readFileSync,
isChainWhitelistExistSync,
isChainBlacklistExistSync,
getChainWhitelistPath,
getChainBlacklistPath,
writeFileSync,
sortDesc,
getUnique,
mapList
} from '../src/test/helpers'
const assetsChains = [Ethereum, Classic, POA, TomoChain, GoChain, Wanchain, ThunderCore]
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 18:55:41 +00:00
assetsChains.forEach(async chain => {
const assets = readDirSync(getChainAssetsPath(chain))
const whitelistPath = getChainWhitelistPath(chain)
const blacklistPath = getChainBlacklistPath(chain)
//Create inital lists if they do not exists
if (!isChainWhitelistExistSync(chain)) {
writeFileSync(whitelistPath, `[]`)
}
if (!isChainBlacklistExistSync(chain)) {
writeFileSync(blacklistPath, `[]`)
}
const currentWhitelist = JSON.parse(readFileSync(whitelistPath))
const currentBlacklist = JSON.parse(readFileSync(blacklistPath))
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 18:55:41 +00:00
let newBlackList = []
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 18:55:41 +00:00
// Some chains required pulling lists from other sources
switch (chain) {
case Ethereum:
const nftList = await getOpenseaCollectionAddresses()
newBlackList = currentBlacklist.concat(nftList)
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 18:55:41 +00:00
break;
default:
break;
}
const removedAssets = getRemovedAddressesFromAssets(assets, currentWhitelist)
newBlackList = newBlackList.concat(removedAssets)
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 18:55:41 +00:00
fs.writeFileSync(whitelistPath, JSON.stringify(sortDesc(assets), null, 4))
fs.writeFileSync(blacklistPath, JSON.stringify(getUnique(sortDesc(newBlackList)), null, 4))
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 18:55:41 +00:00
})
function getRemovedAddressesFromAssets(assets: string[], whiteList: string[]): string[] {
const mappedAssets = mapList(assets)
const removed = whiteList.filter(a => !mappedAssets.hasOwnProperty(a))
return removed
}