diff --git a/blockchains/ethereum/assets/0x5807CA447851C98569c567963B25B1C83D41BeBc/info.json b/blockchains/ethereum/assets/0x5807CA447851C98569c567963B25B1C83D41BeBc/info.json index 46f123f30..4f38be676 100644 --- a/blockchains/ethereum/assets/0x5807CA447851C98569c567963B25B1C83D41BeBc/info.json +++ b/blockchains/ethereum/assets/0x5807CA447851C98569c567963B25B1C83D41BeBc/info.json @@ -6,6 +6,6 @@ "description": "-", "website": "https://realt.co/product/10024-28-appoline-st-detroit-mi-48227/", "explorer": "https://etherscan.io/token/0x5807CA447851C98569c567963B25B1C83D41BeBc", - "status": "abandned", + "status": "abandoned", "id": "0x5807CA447851C98569c567963B25B1C83D41BeBc" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0x58a5d3e4873A75B07fB3c7CF477EeBc44ea73B3B/info.json b/blockchains/ethereum/assets/0x58a5d3e4873A75B07fB3c7CF477EeBc44ea73B3B/info.json index c2506856f..b0948a768 100644 --- a/blockchains/ethereum/assets/0x58a5d3e4873A75B07fB3c7CF477EeBc44ea73B3B/info.json +++ b/blockchains/ethereum/assets/0x58a5d3e4873A75B07fB3c7CF477EeBc44ea73B3B/info.json @@ -6,6 +6,6 @@ "description": "-", "website": "", "explorer": "https://etherscan.io/token/0x58a5d3e4873A75B07fB3c7CF477EeBc44ea73B3B", - "status": "abandonned", + "status": "abandoned", "id": "0x58a5d3e4873A75B07fB3c7CF477EeBc44ea73B3B" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0x6aCf5940974E2a935f3F4e4FEDAc798583eEE826/info.json b/blockchains/ethereum/assets/0x6aCf5940974E2a935f3F4e4FEDAc798583eEE826/info.json index 7c300a596..cbadda575 100644 --- a/blockchains/ethereum/assets/0x6aCf5940974E2a935f3F4e4FEDAc798583eEE826/info.json +++ b/blockchains/ethereum/assets/0x6aCf5940974E2a935f3F4e4FEDAc798583eEE826/info.json @@ -6,6 +6,6 @@ "description": "-", "website": "", "explorer": "https://etherscan.io/token/0x6aCf5940974E2a935f3F4e4FEDAc798583eEE826", - "status": "abandone", + "status": "abandoned", "id": "0x6aCf5940974E2a935f3F4e4FEDAc798583eEE826" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0x82b0E50478eeaFde392D45D1259Ed1071B6fDa81/info.json b/blockchains/ethereum/assets/0x82b0E50478eeaFde392D45D1259Ed1071B6fDa81/info.json index 18ac7059d..eb0a05102 100644 --- a/blockchains/ethereum/assets/0x82b0E50478eeaFde392D45D1259Ed1071B6fDa81/info.json +++ b/blockchains/ethereum/assets/0x82b0E50478eeaFde392D45D1259Ed1071B6fDa81/info.json @@ -6,6 +6,6 @@ "description": "This token has been deprecated and replaced with contract address 0xef6344de1fcfC5F48c30234C16c1389e8CdC572C", "website": "https://encrypgen.com", "explorer": "https://etherscan.io/token/0x82b0E50478eeaFde392D45D1259Ed1071B6fDa81", - "status": "inactive", + "status": "abandoned", "id": "0x82b0E50478eeaFde392D45D1259Ed1071B6fDa81" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0x9c197c4b58527fAAAb67CB35E3145166B23D242e/info.json b/blockchains/ethereum/assets/0x9c197c4b58527fAAAb67CB35E3145166B23D242e/info.json index 0d7e5cfdb..ae3a698e7 100644 --- a/blockchains/ethereum/assets/0x9c197c4b58527fAAAb67CB35E3145166B23D242e/info.json +++ b/blockchains/ethereum/assets/0x9c197c4b58527fAAAb67CB35E3145166B23D242e/info.json @@ -6,6 +6,6 @@ "description": "HNB aims to build a decentralized blockchain network where individuals and enterprises can exchange products and services with trust and security.", "website": "https://hnb.eco", "explorer": "https://etherscan.io/token/0x9c197c4b58527fAAAb67CB35E3145166B23D242e", - "status": "abadoned", + "status": "abandoned", "id": "0x9c197c4b58527fAAAb67CB35E3145166B23D242e" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0xdD6Bf56CA2ada24c683FAC50E37783e55B57AF9F/info.json b/blockchains/ethereum/assets/0xdD6Bf56CA2ada24c683FAC50E37783e55B57AF9F/info.json index e1e469723..5f33ce868 100644 --- a/blockchains/ethereum/assets/0xdD6Bf56CA2ada24c683FAC50E37783e55B57AF9F/info.json +++ b/blockchains/ethereum/assets/0xdD6Bf56CA2ada24c683FAC50E37783e55B57AF9F/info.json @@ -6,6 +6,6 @@ "description": "-", "website": "", "explorer": "https://etherscan.io/token/0xdD6Bf56CA2ada24c683FAC50E37783e55B57AF9F", - "status": "bandoned", + "status": "abandoned", "id": "0xdD6Bf56CA2ada24c683FAC50E37783e55B57AF9F" } \ No newline at end of file diff --git a/script/generic/asset-infos.ts b/script/generic/asset-infos.ts index cb2941fbf..0e8c588b5 100644 --- a/script/generic/asset-infos.ts +++ b/script/generic/asset-infos.ts @@ -9,6 +9,7 @@ import { arrayDiff } from "./types"; import { isValidJSON, readJsonFile, writeJsonFile } from "../generic/json"; import { ActionInterface, CheckStepInterface } from "../generic/interface"; import { CoinType } from "@trustwallet/wallet-core"; +import { isValidStatusValue } from "../generic/status-values"; import * as bluebird from "bluebird"; const requiredKeys = ["name", "type", "symbol", "decimals", "description", "website", "explorer", "status", "id"]; @@ -38,12 +39,12 @@ function isAssetInfoValid(info: unknown, path: string, address: string, chain: s // type if (chainFromAssetType(info['type'].toUpperCase()) !== chain ) { - return [`Incorrect value for type '${info['type']}' '${chain}' '${path}`, "", fixedInfo]; + return [`Incorrect value for type '${info['type']}' '${chain}' ${path}`, "", fixedInfo]; } if (info['type'] !== info['type'].toUpperCase()) { // type is correct value, but casing is wrong, fix if (checkOnly) { - return ["", `Wrong casing for type '${info['type']}' '${chain}' '${path}`, fixedInfo]; + return ["", `Wrong casing for type '${info['type']}' '${chain}' ${path}`, fixedInfo]; } // fix if (!fixedInfo) { fixedInfo = info; } @@ -54,16 +55,21 @@ function isAssetInfoValid(info: unknown, path: string, address: string, chain: s if (info['id'] != address) { if (checkOnly) { if (info['id'].toUpperCase() != address.toUpperCase()) { - return [`Incorrect value for id '${info['id']}' '${chain}' '${path}`, "", fixedInfo]; + return [`Incorrect value for id '${info['id']}' '${chain}' ${path}`, "", fixedInfo]; } // is is correct value, but casing is wrong - return ["", `Wrong casing for id '${info['id']}' '${chain}' '${path}`, fixedInfo]; + return ["", `Wrong casing for id '${info['id']}' '${chain}' ${path}`, fixedInfo]; } // fix if (!fixedInfo) { fixedInfo = info; } fixedInfo['id'] = address; } + // status + if (!isValidStatusValue(info['status'])) { + return [`Invalid value for status field, '${info['status']}'`, "", fixedInfo] + } + const isKeys2CorrectType = typeof info['description'] === "string" && info['description'] !== "" && // website should be set (exception description='-' marks empty infos) diff --git a/script/generic/status-values.ts b/script/generic/status-values.ts new file mode 100644 index 000000000..60bc7c6b1 --- /dev/null +++ b/script/generic/status-values.ts @@ -0,0 +1,16 @@ +// see https://developer.trustwallet.com/add_new_asset +const StatusValues: string[] = [ + 'active', + 'spam', + 'abandoned' +]; + +export function isValidStatusValue(value: string): boolean { + if (!value) { + return false; + } + if (!StatusValues.find(e => e === value)) { + return false; + } + return true; +} diff --git a/test/index.test.ts b/test/index.test.ts index f09f75b15..e4afa6cb9 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -21,6 +21,7 @@ import { reverseCase } from "../script/generic/types"; import { findImagesToFetch } from "../script/blockchain/binance"; +import { isValidStatusValue } from "../script/generic/status-values"; describe("Test eth-address helpers", () => { test(`Test isChecksum`, () => { @@ -134,3 +135,13 @@ describe("Test blockchain binance", () => { expect(findImagesToFetch([], []), `empty`).toEqual([]); }); }); + +describe("Test status-values", () => { + test(`Test status-values`, () => { + expect(isValidStatusValue("active")).toEqual(true); + expect(isValidStatusValue("abandoned")).toEqual(true); + expect(isValidStatusValue("invalidvalue")).toEqual(false); + expect(isValidStatusValue("ACTIVE")).toEqual(false); + expect(isValidStatusValue("")).toEqual(false); + }); +});