diff --git a/blockchains/ethereum/assets/0x839961692c56270b73538F9906f8736fC1DA4fA6/logo.png b/blockchains/ethereum/assets/0x839961692c56270b73538F9906f8736fC1DA4fA6/logo.png new file mode 100644 index 000000000..4538255b0 Binary files /dev/null and b/blockchains/ethereum/assets/0x839961692c56270b73538F9906f8736fC1DA4fA6/logo.png differ diff --git a/script/arrange_files.ts b/script/arrange_files.ts index 5d868546e..079c2c29b 100644 --- a/script/arrange_files.ts +++ b/script/arrange_files.ts @@ -1,21 +1,24 @@ import * as fs from "fs" const isImage = require("is-image"); import { + Ethereum, + chainsFolderPath, ethSidechains, getChainAssetPath, getChainAssetsPath, + getChainPath, getFileExt, getFileName, + getRootDirFilesList, isChecksum, + isEthereumAddress, isPathDir, logo, logoExtension, makeDirIfDoestExist, readDirSync, - toChecksum, - getRootDirFilesList, rootDirAllowedFiles, - isEthereumAddress + toChecksum, } from "../src/test/helpers" ethSidechains.forEach(chain => { @@ -49,3 +52,20 @@ getRootDirFilesList().forEach(async file => { fs.renameSync(`./${file}`, `${ethreumAssetsPath}/${checksum}/${logo}`) } }); + +// Moves blockchains/0xXX...XX.png => assets/blockchains/ethereum/0xXX...XX/logo.png +readDirSync(chainsFolderPath).forEach(async chainFile => { + const chainPath = getChainPath(chainFile) + const isDir = isPathDir(chainPath) + + if (!isDir) { + const checksum = toChecksum(getFileName(chainFile)) + const chainAssetsPath = getChainAssetsPath(Ethereum) + + if (isChecksum(checksum) && getFileExt(chainFile).toLocaleLowerCase() === logoExtension) { + await makeDirIfDoestExist(chainAssetsPath, checksum) + const newPath = `${chainAssetsPath}/${checksum}/${logo}` + fs.renameSync(chainPath, newPath) + } + } +}) diff --git a/src/test/helpers.ts b/src/test/helpers.ts index 973fa255b..dc79fd76a 100644 --- a/src/test/helpers.ts +++ b/src/test/helpers.ts @@ -106,7 +106,7 @@ export const isChecksum = (address: string): boolean => web3.utils.checkAddressC export const toChecksum = (address: string): string => web3.utils.toChecksumAddress(address) export const getBinanceBEP2Symbols = async () => axios.get(`https://dex-atlantic.binance.org/api/v1/tokens?limit=1000`).then(res => res.data.map(({ symbol }) => symbol)) -export const getFileName = (fileName: string): string => path.basename(fileName, path.extname(fileName)) +export const getFileName = (name: string): string => path.basename(name, path.extname(name)) export const getFileExt = (name: string): string => name.slice((Math.max(0, name.lastIndexOf(".")) || Infinity) + 1) export const isTRC10 = (str: string): boolean => (/^\d+$/.test(str)) diff --git a/src/test/index.test.ts b/src/test/index.test.ts index 7e9ac9240..3073ab5be 100644 --- a/src/test/index.test.ts +++ b/src/test/index.test.ts @@ -125,7 +125,7 @@ describe(`Test "blockchains" folder`, () => { }) describe(`Check "binace" folder`, () => { - it("Asset must exist on chain and", async () => { + it("Asset must exist on chain", async () => { const tokenSymbols = await getBinanceBEP2Symbols() const assets = readDirSync(getChainAssetsPath(Binance))