mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
Add CHALLENGE-CLG Logo (#2316)
* Add CHALLENGE-CLG Logo * Add script that moves file to correct location Co-authored-by: Mykola <kolya182@gmail.com>
This commit is contained in:
parent
18aaf49f1a
commit
20bb9c155c
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
|
@ -1,21 +1,24 @@
|
||||||
import * as fs from "fs"
|
import * as fs from "fs"
|
||||||
const isImage = require("is-image");
|
const isImage = require("is-image");
|
||||||
import {
|
import {
|
||||||
|
Ethereum,
|
||||||
|
chainsFolderPath,
|
||||||
ethSidechains,
|
ethSidechains,
|
||||||
getChainAssetPath,
|
getChainAssetPath,
|
||||||
getChainAssetsPath,
|
getChainAssetsPath,
|
||||||
|
getChainPath,
|
||||||
getFileExt,
|
getFileExt,
|
||||||
getFileName,
|
getFileName,
|
||||||
|
getRootDirFilesList,
|
||||||
isChecksum,
|
isChecksum,
|
||||||
|
isEthereumAddress,
|
||||||
isPathDir,
|
isPathDir,
|
||||||
logo,
|
logo,
|
||||||
logoExtension,
|
logoExtension,
|
||||||
makeDirIfDoestExist,
|
makeDirIfDoestExist,
|
||||||
readDirSync,
|
readDirSync,
|
||||||
toChecksum,
|
|
||||||
getRootDirFilesList,
|
|
||||||
rootDirAllowedFiles,
|
rootDirAllowedFiles,
|
||||||
isEthereumAddress
|
toChecksum,
|
||||||
} from "../src/test/helpers"
|
} from "../src/test/helpers"
|
||||||
|
|
||||||
ethSidechains.forEach(chain => {
|
ethSidechains.forEach(chain => {
|
||||||
|
@ -49,3 +52,20 @@ getRootDirFilesList().forEach(async file => {
|
||||||
fs.renameSync(`./${file}`, `${ethreumAssetsPath}/${checksum}/${logo}`)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
@ -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 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 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 getFileExt = (name: string): string => name.slice((Math.max(0, name.lastIndexOf(".")) || Infinity) + 1)
|
||||||
|
|
||||||
export const isTRC10 = (str: string): boolean => (/^\d+$/.test(str))
|
export const isTRC10 = (str: string): boolean => (/^\d+$/.test(str))
|
||||||
|
|
|
@ -125,7 +125,7 @@ describe(`Test "blockchains" folder`, () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe(`Check "binace" 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 tokenSymbols = await getBinanceBEP2Symbols()
|
||||||
const assets = readDirSync(getChainAssetsPath(Binance))
|
const assets = readDirSync(getChainAssetsPath(Binance))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user