mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
[internal] Script restructuring/refactoring (#4070)
* Make non-mandatory action interface elements optional. * Remove one unused import * Scripts main renamed to entrypoint. * Script common rename to generic * Move generic scripts from action to generic. * Move chain-specific scripts to blockchain. Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
parent
242cb8aa44
commit
ec1fe7f6ee
|
@ -1,5 +1,5 @@
|
||||||
import { fail, warn, markdown } from "danger";
|
import { fail, warn, markdown } from "danger";
|
||||||
import { sanityCheckAll } from "./script/action/update-all";
|
import { sanityCheckAll } from "./script/generic/update-all";
|
||||||
|
|
||||||
sanityCheckAll().then(([errors, warnings]) => {
|
sanityCheckAll().then(([errors, warnings]) => {
|
||||||
errors.forEach(err => fail(err));
|
errors.forEach(err => fail(err));
|
||||||
|
|
10
package.json
10
package.json
|
@ -5,11 +5,11 @@
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"check": "ts-node ./script/main/check",
|
"check": "ts-node ./script/entrypoint/check",
|
||||||
"check-sanity": "ts-node ./script/main/check-sanity",
|
"check-sanity": "ts-node ./script/entrypoint/check-sanity",
|
||||||
"fix": "ts-node ./script/main/fix",
|
"fix": "ts-node ./script/entrypoint/fix",
|
||||||
"fix-sanity": "ts-node ./script/main/fix-sanity",
|
"fix-sanity": "ts-node ./script/entrypoint/fix-sanity",
|
||||||
"update": "ts-node ./script/main/update",
|
"update": "ts-node ./script/entrypoint/update",
|
||||||
"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx"
|
"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -4,16 +4,16 @@ import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import * as chalk from 'chalk';
|
import * as chalk from 'chalk';
|
||||||
import * as config from "../config";
|
import * as config from "../config";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { getChainAssetsPath } from "../common/repo-structure";
|
import { getChainAssetsPath } from "../generic/repo-structure";
|
||||||
import { Binance } from "../common/blockchains";
|
import { Binance } from "../generic/blockchains";
|
||||||
import { readDirSync } from "../common/filesystem";
|
import { readDirSync } from "../generic/filesystem";
|
||||||
import { readJsonFile } from "../common/json";
|
import { readJsonFile } from "../generic/json";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getChainAssetLogoPath,
|
getChainAssetLogoPath,
|
||||||
getChainDenylistPath
|
getChainDenylistPath
|
||||||
} from "../common/repo-structure";
|
} from "../generic/repo-structure";
|
||||||
|
|
||||||
const binanceChain = "binance";
|
const binanceChain = "binance";
|
||||||
const binanceUrlTokens2 = config.binanceUrlTokens2;
|
const binanceUrlTokens2 = config.binanceUrlTokens2;
|
||||||
|
@ -122,12 +122,6 @@ export class BinanceAction implements ActionInterface {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
async update(): Promise<void> {
|
async update(): Promise<void> {
|
||||||
// retrieve missing token images; BEP2 (bep8 not supported)
|
// retrieve missing token images; BEP2 (bep8 not supported)
|
||||||
const bep2InfoList = await retrieveBep2AssetList();
|
const bep2InfoList = await retrieveBep2AssetList();
|
|
@ -1,7 +1,7 @@
|
||||||
import { Cosmos } from "../common/blockchains";
|
import { Cosmos } from "../generic/blockchains";
|
||||||
import { getChainValidatorsAssets } from "../common/repo-structure";
|
import { getChainValidatorsAssets } from "../generic/repo-structure";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { isLowerCase } from "../common/types";
|
import { isLowerCase } from "../generic/types";
|
||||||
|
|
||||||
export class CosmosAction implements ActionInterface {
|
export class CosmosAction implements ActionInterface {
|
||||||
getName(): string { return "Cosmos chain"; }
|
getName(): string { return "Cosmos chain"; }
|
||||||
|
@ -31,12 +31,4 @@ export class CosmosAction implements ActionInterface {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
import { Kava } from "../common/blockchains";
|
import { Kava } from "../generic/blockchains";
|
||||||
import { getChainValidatorsAssets } from "../common/repo-structure";
|
import { getChainValidatorsAssets } from "../generic/repo-structure";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { isLowerCase } from "../common/types";
|
import { isLowerCase } from "../generic/types";
|
||||||
|
|
||||||
export class KavaAction implements ActionInterface {
|
export class KavaAction implements ActionInterface {
|
||||||
getName(): string { return "Kava chain"; }
|
getName(): string { return "Kava chain"; }
|
||||||
|
@ -31,12 +31,4 @@ export class KavaAction implements ActionInterface {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
import { Terra } from "../common/blockchains";
|
import { Terra } from "../generic/blockchains";
|
||||||
import { getChainValidatorsAssets } from "../common/repo-structure";
|
import { getChainValidatorsAssets } from "../generic/repo-structure";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { isLowerCase } from "../common/types";
|
import { isLowerCase } from "../generic/types";
|
||||||
|
|
||||||
export class TerraAction implements ActionInterface {
|
export class TerraAction implements ActionInterface {
|
||||||
getName(): string { return "Terra chain"; }
|
getName(): string { return "Terra chain"; }
|
||||||
|
@ -31,12 +31,4 @@ export class TerraAction implements ActionInterface {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -5,12 +5,12 @@ import {
|
||||||
getChainValidatorsPath,
|
getChainValidatorsPath,
|
||||||
getChainValidatorsListPath,
|
getChainValidatorsListPath,
|
||||||
getChainValidatorsAssets
|
getChainValidatorsAssets
|
||||||
} from "../common/repo-structure";
|
} from "../generic/repo-structure";
|
||||||
import { Tezos } from "../common/blockchains";
|
import { Tezos } from "../generic/blockchains";
|
||||||
import { readFileSync } from "../common/filesystem";
|
import { readFileSync } from "../generic/filesystem";
|
||||||
import { writeJsonFile } from "../common/json";
|
import { writeJsonFile } from "../generic/json";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { ValidatorModel } from "../common/validator-models";
|
import { ValidatorModel } from "../generic/validator-models";
|
||||||
|
|
||||||
interface BakingBadBaker {
|
interface BakingBadBaker {
|
||||||
address: string,
|
address: string,
|
||||||
|
@ -96,12 +96,6 @@ export class TezosAction implements ActionInterface {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
async update(): Promise<void> {
|
async update(): Promise<void> {
|
||||||
await gen_validators_tezos();
|
await gen_validators_tezos();
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { getChainAssetsPath } from "../common/repo-structure";
|
import { getChainAssetsPath } from "../generic/repo-structure";
|
||||||
import { Tron } from "../common/blockchains";
|
import { Tron } from "../generic/blockchains";
|
||||||
import { readDirSync, isPathExistsSync } from "../common/filesystem";
|
import { readDirSync, isPathExistsSync } from "../generic/filesystem";
|
||||||
import { getChainAssetLogoPath, getChainValidatorsAssets } from "../common/repo-structure";
|
import { getChainAssetLogoPath, getChainValidatorsAssets } from "../generic/repo-structure";
|
||||||
import { isLowerCase, isUpperCase } from "../common/types";
|
import { isLowerCase, isUpperCase } from "../generic/types";
|
||||||
import * as bluebird from "bluebird";
|
import * as bluebird from "bluebird";
|
||||||
|
|
||||||
export function isTRC10(str: string): boolean {
|
export function isTRC10(str: string): boolean {
|
||||||
|
@ -55,12 +55,4 @@ export class TronAction implements ActionInterface {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
import { Waves } from "../common/blockchains";
|
import { Waves } from "../generic/blockchains";
|
||||||
import { getChainValidatorsAssets } from "../common/repo-structure";
|
import { getChainValidatorsAssets } from "../generic/repo-structure";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { isLowerCase, isUpperCase } from "../common/types";
|
import { isLowerCase, isUpperCase } from "../generic/types";
|
||||||
|
|
||||||
export function isWavesAddress(address: string): boolean {
|
export function isWavesAddress(address: string): boolean {
|
||||||
return address.length == 35 &&
|
return address.length == 35 &&
|
||||||
|
@ -30,12 +30,4 @@ export class WavesAction implements ActionInterface {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import { sanityCheckAll } from "../action/update-all";
|
import { sanityCheckAll } from "../generic/update-all";
|
||||||
|
|
||||||
export async function main(): Promise<void> {
|
export async function main(): Promise<void> {
|
||||||
try {
|
try {
|
|
@ -1,4 +1,4 @@
|
||||||
import { sanityCheckAll, consistencyCheckAll } from "../action/update-all";
|
import { sanityCheckAll, consistencyCheckAll } from "../generic/update-all";
|
||||||
|
|
||||||
export async function main(): Promise<void> {
|
export async function main(): Promise<void> {
|
||||||
let returnCode = 0;
|
let returnCode = 0;
|
|
@ -1,4 +1,4 @@
|
||||||
import { sanityFixAll } from "../action/update-all";
|
import { sanityFixAll } from "../generic/update-all";
|
||||||
|
|
||||||
export async function main(): Promise<void> {
|
export async function main(): Promise<void> {
|
||||||
try {
|
try {
|
|
@ -1,4 +1,4 @@
|
||||||
import { sanityFixAll, consistencyFixAll } from "../action/update-all";
|
import { sanityFixAll, consistencyFixAll } from "../generic/update-all";
|
||||||
|
|
||||||
export async function main(): Promise<void> {
|
export async function main(): Promise<void> {
|
||||||
try {
|
try {
|
|
@ -1,4 +1,4 @@
|
||||||
import { updateAll } from "../action/update-all";
|
import { updateAll } from "../generic/update-all";
|
||||||
|
|
||||||
export async function main(): Promise<void> {
|
export async function main(): Promise<void> {
|
||||||
try {
|
try {
|
|
@ -1,18 +1,18 @@
|
||||||
import { chainsWithDenylist } from "../common/blockchains";
|
import { chainsWithDenylist } from "../generic/blockchains";
|
||||||
import {
|
import {
|
||||||
getChainAssetsList,
|
getChainAssetsList,
|
||||||
getChainAllowlistPath,
|
getChainAllowlistPath,
|
||||||
getChainDenylistPath
|
getChainDenylistPath
|
||||||
} from "../common/repo-structure";
|
} from "../generic/repo-structure";
|
||||||
import { readFileSync, writeFileSync } from "../common/filesystem";
|
import { readFileSync, writeFileSync } from "../generic/filesystem";
|
||||||
import {
|
import {
|
||||||
arrayDiff,
|
arrayDiff,
|
||||||
arrayDiffNocase,
|
arrayDiffNocase,
|
||||||
findCommonElementsOrDuplicates,
|
findCommonElementsOrDuplicates,
|
||||||
makeUnique
|
makeUnique
|
||||||
} from "../common/types";
|
} from "../generic/types";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { formatSortJson } from "../common/json";
|
import { formatSortJson } from "../generic/json";
|
||||||
import * as bluebird from "bluebird";
|
import * as bluebird from "bluebird";
|
||||||
|
|
||||||
async function checkUpdateAllowDenyList(chain: string, checkOnly: boolean ): Promise<[boolean, string[], string[]]> {
|
async function checkUpdateAllowDenyList(chain: string, checkOnly: boolean ): Promise<[boolean, string[], string[]]> {
|
||||||
|
@ -109,11 +109,7 @@ export class Allowlist implements ActionInterface {
|
||||||
return steps;
|
return steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
async consistencyFix(): Promise<void> {
|
async consistencyFix(): Promise<void> {
|
||||||
await bluebird.each(chainsWithDenylist, async (chain) => await checkUpdateAllowDenyList(chain, false));
|
await bluebird.each(chainsWithDenylist, async (chain) => await checkUpdateAllowDenyList(chain, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
import { getChainAssetInfoPath } from "./repo-structure";
|
import { getChainAssetInfoPath } from "./repo-structure";
|
||||||
import { readFileSync, isPathExistsSync } from "./filesystem";
|
import { readFileSync, isPathExistsSync } from "./filesystem";
|
||||||
import { arrayDiff } from "./types";
|
import { arrayDiff } from "./types";
|
||||||
import { isValidJSON } from "../common/json";
|
import { isValidJSON } from "../generic/json";
|
||||||
|
|
||||||
const requiredKeys = ["explorer", "name", "website", "short_description"];
|
const requiredKeys = ["explorer", "name", "website", "short_description"];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ethForkChains } from "../common/blockchains";
|
import { ethForkChains } from "../generic/blockchains";
|
||||||
import {
|
import {
|
||||||
getChainAssetsPath,
|
getChainAssetsPath,
|
||||||
getChainAssetsList,
|
getChainAssetsList,
|
||||||
|
@ -10,18 +10,18 @@ import {
|
||||||
logoExtension,
|
logoExtension,
|
||||||
logoFullName,
|
logoFullName,
|
||||||
getChainAssetLogoPath
|
getChainAssetLogoPath
|
||||||
} from "../common/repo-structure";
|
} from "../generic/repo-structure";
|
||||||
import { formatJsonFile } from "../common/json";
|
import { formatJsonFile } from "../generic/json";
|
||||||
import {
|
import {
|
||||||
getFileName,
|
getFileName,
|
||||||
getFileExt,
|
getFileExt,
|
||||||
gitMove,
|
gitMove,
|
||||||
readDirSync,
|
readDirSync,
|
||||||
isPathExistsSync,
|
isPathExistsSync,
|
||||||
} from "../common/filesystem";
|
} from "../generic/filesystem";
|
||||||
import { toChecksum } from "../common/eth-web3";
|
import { toChecksum } from "../generic/eth-web3";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { isAssetInfoOK } from "../common/asset-info";
|
import { isAssetInfoOK } from "../generic/asset-info";
|
||||||
import * as bluebird from "bluebird";
|
import * as bluebird from "bluebird";
|
||||||
|
|
||||||
async function formatInfos() {
|
async function formatInfos() {
|
||||||
|
@ -105,14 +105,8 @@ export class EthForks implements ActionInterface {
|
||||||
return steps;
|
return steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
async sanityFix(): Promise<void> {
|
async sanityFix(): Promise<void> {
|
||||||
await formatInfos();
|
await formatInfos();
|
||||||
await checkAddressChecksums();
|
await checkAddressChecksums();
|
||||||
}
|
}
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -1,22 +1,21 @@
|
||||||
import {
|
import {
|
||||||
readDirSync,
|
readDirSync,
|
||||||
isPathExistsSync
|
isPathExistsSync
|
||||||
} from "../common/filesystem";
|
} from "../generic/filesystem";
|
||||||
import { CheckStepInterface, ActionInterface } from "./interface";
|
import { CheckStepInterface, ActionInterface } from "../generic/interface";
|
||||||
import {
|
import {
|
||||||
chainsPath,
|
chainsPath,
|
||||||
getChainLogoPath,
|
getChainLogoPath,
|
||||||
getChainAssetsPath,
|
getChainAssetsPath,
|
||||||
getChainAssetPath,
|
getChainAssetPath,
|
||||||
getChainAssetLogoPath,
|
getChainAssetLogoPath,
|
||||||
getChainAssetInfoPath,
|
|
||||||
assetFolderAllowedFiles,
|
assetFolderAllowedFiles,
|
||||||
getChainFolderFilesList,
|
getChainFolderFilesList,
|
||||||
chainFolderAllowedFiles,
|
chainFolderAllowedFiles,
|
||||||
rootDirAllowedFiles
|
rootDirAllowedFiles
|
||||||
} from "../common/repo-structure";
|
} from "../generic/repo-structure";
|
||||||
import { isLogoOK } from "../common/image";
|
import { isLogoOK } from "../generic/image";
|
||||||
import { isLowerCase } from "../common/types";
|
import { isLowerCase } from "../generic/types";
|
||||||
import * as bluebird from "bluebird";
|
import * as bluebird from "bluebird";
|
||||||
|
|
||||||
const foundChains = readDirSync(chainsPath)
|
const foundChains = readDirSync(chainsPath)
|
||||||
|
@ -133,12 +132,4 @@ export class FoldersFiles implements ActionInterface {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -11,10 +11,10 @@ export interface ActionInterface {
|
||||||
// return check steps for sanity check (0, 1, or more)
|
// return check steps for sanity check (0, 1, or more)
|
||||||
getSanityChecks(): CheckStepInterface[];
|
getSanityChecks(): CheckStepInterface[];
|
||||||
// return check steps for consistenct check (0, 1, or more)
|
// return check steps for consistenct check (0, 1, or more)
|
||||||
getConsistencyChecks(): CheckStepInterface[];
|
getConsistencyChecks?(): CheckStepInterface[];
|
||||||
sanityFix(): Promise<void>;
|
sanityFix?(): Promise<void>;
|
||||||
consistencyFix(): Promise<void>;
|
consistencyFix?(): Promise<void>;
|
||||||
update(): Promise<void>;
|
update?(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum FixCheckMode {
|
export enum FixCheckMode {
|
|
@ -1,7 +1,7 @@
|
||||||
import { chainsPath } from "../common/repo-structure";
|
import { chainsPath } from "../generic/repo-structure";
|
||||||
import { findFiles } from "../common/filesystem";
|
import { findFiles } from "../generic/filesystem";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { isValidJSON } from "../common/json";
|
import { isValidJSON } from "../generic/json";
|
||||||
import * as bluebird from "bluebird";
|
import * as bluebird from "bluebird";
|
||||||
|
|
||||||
export class JsonAction implements ActionInterface {
|
export class JsonAction implements ActionInterface {
|
||||||
|
@ -27,12 +27,4 @@ export class JsonAction implements ActionInterface {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
sanityFix = null;
|
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -6,14 +6,14 @@ import {
|
||||||
getChainAssetLogoPath,
|
getChainAssetLogoPath,
|
||||||
getChainValidatorsListPath,
|
getChainValidatorsListPath,
|
||||||
getChainValidatorAssetLogoPath
|
getChainValidatorAssetLogoPath
|
||||||
} from "../common/repo-structure";
|
} from "../generic/repo-structure";
|
||||||
import {
|
import {
|
||||||
readDirSync,
|
readDirSync,
|
||||||
readFileSync,
|
readFileSync,
|
||||||
isPathExistsSync
|
isPathExistsSync
|
||||||
} from "../common/filesystem";
|
} from "../generic/filesystem";
|
||||||
import { checkResizeIfTooLarge } from "../common/image";
|
import { checkResizeIfTooLarge } from "../generic/image";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
|
|
||||||
// return name of large logo, or empty
|
// return name of large logo, or empty
|
||||||
async function checkDownsize(chains, checkOnly: boolean): Promise<string[]> {
|
async function checkDownsize(chains, checkOnly: boolean): Promise<string[]> {
|
||||||
|
@ -89,14 +89,8 @@ export class LogoSize implements ActionInterface {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
async sanityFix(): Promise<void> {
|
async sanityFix(): Promise<void> {
|
||||||
const foundChains = readDirSync(chainsPath);
|
const foundChains = readDirSync(chainsPath);
|
||||||
await checkDownsize(foundChains, false);
|
await checkDownsize(foundChains, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -1,17 +1,17 @@
|
||||||
import { BinanceAction } from "./binance";
|
import { BinanceAction } from "../blockchain/binance";
|
||||||
import { CosmosAction } from "./cosmos";
|
import { CosmosAction } from "../blockchain/cosmos";
|
||||||
import { EthForks } from "./eth-forks";
|
import { EthForks } from "../generic/eth-forks";
|
||||||
import { FoldersFiles } from "./folders-and-files";
|
import { FoldersFiles } from "../generic/folders-and-files";
|
||||||
import { JsonAction } from "./json";
|
import { JsonAction } from "../generic/json-format";
|
||||||
import { KavaAction } from "./kava";
|
import { KavaAction } from "../blockchain/kava";
|
||||||
import { LogoSize } from "./logo-size";
|
import { LogoSize } from "../generic/logo-size";
|
||||||
import { TerraAction } from "./terra";
|
import { TerraAction } from "../blockchain/terra";
|
||||||
import { TezosAction } from "./tezos";
|
import { TezosAction } from "../blockchain/tezos";
|
||||||
import { TronAction } from "./tron";
|
import { TronAction } from "../blockchain/tron";
|
||||||
import { Validators } from "./validators";
|
import { Validators } from "../generic/validators";
|
||||||
import { WavesAction } from "./waves";
|
import { WavesAction } from "../blockchain/waves";
|
||||||
import { Allowlist } from "./allowlists";
|
import { Allowlist } from "../generic/allowlists";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import * as chalk from 'chalk';
|
import * as chalk from 'chalk';
|
||||||
import * as bluebird from "bluebird";
|
import * as bluebird from "bluebird";
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { stakingChains } from "../common/blockchains";
|
import { stakingChains } from "../generic/blockchains";
|
||||||
import {
|
import {
|
||||||
getChainValidatorsListPath,
|
getChainValidatorsListPath,
|
||||||
getChainValidatorAssetLogoPath,
|
getChainValidatorAssetLogoPath,
|
||||||
getChainValidatorsAssets
|
getChainValidatorsAssets
|
||||||
} from "../common/repo-structure";
|
} from "../generic/repo-structure";
|
||||||
import { isPathExistsSync } from "../common/filesystem";
|
import { isPathExistsSync } from "../generic/filesystem";
|
||||||
import { formatSortJsonFile, readJsonFile } from "../common/json";
|
import { formatSortJsonFile, readJsonFile } from "../generic/json";
|
||||||
import { ActionInterface, CheckStepInterface } from "./interface";
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
||||||
import { isValidJSON } from "../common/json";
|
import { isValidJSON } from "../generic/json";
|
||||||
import { ValidatorModel } from "../common/validator-models";
|
import { ValidatorModel } from "../generic/validator-models";
|
||||||
import { isLogoOK } from "../common/image";
|
import { isLogoOK } from "../generic/image";
|
||||||
import * as bluebird from "bluebird";
|
import * as bluebird from "bluebird";
|
||||||
|
|
||||||
function formatValidators() {
|
function formatValidators() {
|
||||||
|
@ -94,13 +94,7 @@ export class Validators implements ActionInterface {
|
||||||
return steps;
|
return steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConsistencyChecks = null;
|
|
||||||
|
|
||||||
async sanityFix(): Promise<void> {
|
async sanityFix(): Promise<void> {
|
||||||
formatValidators();
|
formatValidators();
|
||||||
}
|
}
|
||||||
|
|
||||||
consistencyFix = null;
|
|
||||||
|
|
||||||
update = null;
|
|
||||||
}
|
}
|
|
@ -1,17 +1,17 @@
|
||||||
import {
|
import {
|
||||||
findDuplicates,
|
findDuplicates,
|
||||||
findCommonElementsOrDuplicates,
|
findCommonElementsOrDuplicates,
|
||||||
} from "../script/common/types";
|
} from "../script/generic/types";
|
||||||
import {
|
import {
|
||||||
isChecksum,
|
isChecksum,
|
||||||
toChecksum,
|
toChecksum,
|
||||||
isEthereumAddress
|
isEthereumAddress
|
||||||
} from "../script/common/eth-web3";
|
} from "../script/generic/eth-web3";
|
||||||
import {
|
import {
|
||||||
isDimensionTooLarge,
|
isDimensionTooLarge,
|
||||||
isDimensionOK,
|
isDimensionOK,
|
||||||
calculateTargetSize
|
calculateTargetSize
|
||||||
} from "../script/common/image";
|
} from "../script/generic/image";
|
||||||
import {
|
import {
|
||||||
sortElements,
|
sortElements,
|
||||||
makeUnique,
|
makeUnique,
|
||||||
|
@ -19,8 +19,8 @@ import {
|
||||||
arrayDiffNocase,
|
arrayDiffNocase,
|
||||||
arrayEqual,
|
arrayEqual,
|
||||||
reverseCase
|
reverseCase
|
||||||
} from "../script/common/types";
|
} from "../script/generic/types";
|
||||||
import { findImagesToFetch } from "../script/action/binance";
|
import { findImagesToFetch } from "../script/blockchain/binance";
|
||||||
|
|
||||||
describe("Test eth-web3 helpers", () => {
|
describe("Test eth-web3 helpers", () => {
|
||||||
test(`Test isChecksum`, () => {
|
test(`Test isChecksum`, () => {
|
||||||
|
@ -116,7 +116,7 @@ describe("Test type helpers", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Test action binance", () => {
|
describe("Test blockchain binance", () => {
|
||||||
test(`Test findImagesToFetch`, () => {
|
test(`Test findImagesToFetch`, () => {
|
||||||
const assetsInfoListNonexisting = [{asset: "A1", assetImg: "imgurl1"}, {asset: "A2", assetImg: "imgurl2"}];
|
const assetsInfoListNonexisting = [{asset: "A1", assetImg: "imgurl1"}, {asset: "A2", assetImg: "imgurl2"}];
|
||||||
const assetsInfoListExisting = [{asset: "BUSD-BD1", assetImg: "imgurlBUSD"}, {asset: "ETH-1C9", assetImg: "imgurlETH"}];
|
const assetsInfoListExisting = [{asset: "BUSD-BD1", assetImg: "imgurlBUSD"}, {asset: "ETH-1C9", assetImg: "imgurlETH"}];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user