[Internal] Tag values config in typed file (#6016)

* Tag values config in typed file.

* Lint fix

Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
Adam R 2021-03-22 11:33:21 +01:00 committed by GitHub
parent ee8d3c8e4f
commit 6b22d924be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 42 deletions

View File

@ -1,16 +1,16 @@
import { readJsonFile } from "../generic/json";
const tags: any = readJsonFile("script/tags.json") as any;
import { TagValues } from "../tags-config";
export function isValidTagValue(value: string): boolean {
//console.log(`isValidTagValue ${value}`);
if (!value) {
return false;
}
if (!(value in tags)) {
const tag = TagValues.find(t => t.id === value);
if (!tag) {
return false;
}
//console.log(`TAG ${tags[value]['name']}`);
//console.log(`TAG ${tag.name}`);
return true;
}

53
script/tags-config.ts Normal file
View File

@ -0,0 +1,53 @@
export interface TagDescription {
id: string;
name: string;
description: string;
}
export const TagValues: TagDescription[] = [
{
id: "stablecoin",
name: "Stablecoin",
description: "Tokens that are fixed to an external asset, e.g. the US dollar."
},
{
id: "wrapped",
name: "Wrapped",
description: "Tokens that are wrapped or peg representation of digital assets. Excluded stablecoins"
},
{
id: "synthetics",
name: "Synthetics",
description: "Synthetic assets created to track the value of another asset"
},
{
id: "nft",
name: "NFT",
description: "Non-fungible tokens or tokens associated with the NFT ecosystem."
},
{
id: "governance",
name: "Governance",
description: "Tokens that used to participate in the governance process of the project."
},
{
id: "defi",
name: "DeFi",
description: "Tokens that are used for variety of decentralized financial applications."
},
{
id: "staking",
name: "Staking",
description: "Tokens that are used for staking to receive rewards."
},
{
id: "staking-native",
name: "Staking Native",
description: "Coins/Blockchains that are used for staking to secure the network to receive rewards."
},
{
id: "privacy",
name: "Privacy",
description: "Privacy tokens."
},
];

View File

@ -1,38 +0,0 @@
{
"stablecoin": {
"name": "Stablecoin",
"description": "Tokens that are fixed to an external asset, e.g. the US dollar."
},
"wrapped": {
"name": "Wrapped",
"description": "Tokens that are wrapped or peg representation of digital assets. Excluded stablecoins"
},
"synthetics": {
"name": "Synthetics",
"description": "Synthetic assets created to track the value of another asset"
},
"nft": {
"name": "NFT",
"description": "Non-fungible tokens or tokens associated with the NFT ecosystem."
},
"governance": {
"name": "Governance",
"description": "Tokens that used to participate in the governance process of the project."
},
"defi": {
"name": "DeFi",
"description": "Tokens that are used for variety of decentralized financial applications."
},
"staking": {
"name": "Staking",
"description": "Tokens that are used for staking to receive rewards."
},
"staking-native": {
"name": "Staking Native",
"description": "Coins/Blockchains that are used for staking to secure the network to receive rewards."
},
"privacy": {
"name": "Privacy",
"description": "Privacy tokens."
}
}