diff --git a/blockchains/ethereum/assets/0x0c2e3bbc4646c872a3F5A745D2902aFFda82C58a/logo.png b/blockchains/ethereum/assets/0x0c2e3bbc4646c872a3F5A745D2902aFFda82C58a/logo.png new file mode 100644 index 000000000..e1dec32b5 Binary files /dev/null and b/blockchains/ethereum/assets/0x0c2e3bbc4646c872a3F5A745D2902aFFda82C58a/logo.png differ diff --git a/script/arrange_files.ts b/script/arrange_files.ts index 079c2c29b..f43249126 100644 --- a/script/arrange_files.ts +++ b/script/arrange_files.ts @@ -19,6 +19,7 @@ import { readDirSync, rootDirAllowedFiles, toChecksum, + isDirContainLogo } from "../src/test/helpers" ethSidechains.forEach(chain => { @@ -53,19 +54,29 @@ getRootDirFilesList().forEach(async file => { } }); -// Moves blockchains/0xXX...XX.png => assets/blockchains/ethereum/0xXX...XX/logo.png -readDirSync(chainsFolderPath).forEach(async chainFile => { - const chainPath = getChainPath(chainFile) +readDirSync(chainsFolderPath).forEach(async chainDir => { + const chainPath = getChainPath(chainDir) const isDir = isPathDir(chainPath) + const ethereumAssetsPath = getChainAssetsPath(Ethereum) + // Moves blockchains/0xXX...XX.png => assets/blockchains/ethereum/0xXX...XX/logo.png 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}` + const checksum = toChecksum(getFileName(chainDir)) + + if (isChecksum(checksum) && getFileExt(chainDir).toLocaleLowerCase() === logoExtension) { + await makeDirIfDoestExist(ethereumAssetsPath, checksum) + const newPath = `${ethereumAssetsPath}/${checksum}/${logo}` fs.renameSync(chainPath, newPath) } } + + // Moves blockchains/0xXX...XX/logo.png => assets/blockchains/ethereum/0xXX...XX/logo.png + if (isDir && isDirContainLogo(chainPath)) { + const checksum = toChecksum(getFileName(chainDir)) + await makeDirIfDoestExist(ethereumAssetsPath, checksum) + const newPath = `${ethereumAssetsPath}/${checksum}` + fs.renameSync(chainPath, newPath) + } }) + + diff --git a/src/test/helpers.ts b/src/test/helpers.ts index dc79fd76a..fe199c161 100644 --- a/src/test/helpers.ts +++ b/src/test/helpers.ts @@ -92,6 +92,7 @@ export const getRootDirFilesList = (): string[] => readDirSync(root) export const readDirSync = (path: string): string[] => fs.readdirSync(path) export const makeDirSync = (path: string) => fs.mkdirSync(path) export const isPathExistsSync = (path: string): boolean => fs.existsSync(path) +export const isDirContainLogo = (path: string): boolean => fs.existsSync(`${path}/${logo}`) export const isChainWhitelistExistSync = (chain: string): boolean => isPathExistsSync(getChainWhitelistPath(chain)) export const isChainBlacklistExistSync = (chain: string): boolean => isPathExistsSync(getChainBlacklistPath(chain)) export const isChainInfoExistSync = (chain: string): boolean => isPathExistsSync(getChainInfoPath(chain))