From 048b941bf4cd0e0434effa1710d4b4133c5860ab Mon Sep 17 00:00:00 2001 From: Mykola Date: Sun, 19 Jan 2020 21:34:25 -0800 Subject: [PATCH] Move checksum script to ts --- package.json | 2 +- script/{erc20_to_checksum.js => erc20_to_checksum.ts} | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) rename script/{erc20_to_checksum.js => erc20_to_checksum.ts} (69%) diff --git a/package.json b/package.json index 6a2371743..9f53ba5ef 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "test": "npm run cleanup && jest", "cleanup": "find ./.. -iname '.DS_Store' -type f -delete", "update-bep2": "npm run cleanup && node ./script/updateBEP2", - "checksum-erc20": "npm run cleanup && node ./script/erc20_to_checksum", + "checksum-erc20": "npm run cleanup && ts-node ./script/erc20_to_checksum", "list": "npm run cleanup && ts-node ./script/gen_list", "gen:info": "ts-node ./script/gen_info", "resize": "npm run cleanup && ts-node ./script/resize_images", diff --git a/script/erc20_to_checksum.js b/script/erc20_to_checksum.ts similarity index 69% rename from script/erc20_to_checksum.js rename to script/erc20_to_checksum.ts index 768f586c6..72561fa19 100644 --- a/script/erc20_to_checksum.js +++ b/script/erc20_to_checksum.ts @@ -3,17 +3,14 @@ const fs = require('fs') const path = require('path') const Web3 = require('web3') const web3 = new Web3('ws://localhost:8546'); +import { ethSidechains, readDirSync } from "../src/test/helpers" -const readdirSync = path => fs.readdirSync(path) - -const cheinsAddressesToChecksum = ["classic", "poa", "tomochain", "gochain", "wanchain", "thundertoken", "ethereum"] - -cheinsAddressesToChecksum.forEach(chain => { +ethSidechains.forEach(chain => { const assetsPath = path.resolve(`${__dirname}/../blockchains/${chain}/assets`) - const chainAddresses = readdirSync(assetsPath) + const chainAddresses = readDirSync(assetsPath) chainAddresses.forEach(addr => { - isChecksum = web3.utils.checkAddressChecksum(addr) + const isChecksum = web3.utils.checkAddressChecksum(addr) if (!isChecksum) { console.log(`Address ${addr} not in checksum`)