Token update procedure script (#1285)

* Add socials param if doesn't exist

* Igonre text files

* Update command

* Contract upgrade procedure

* Checksum ERC20 addresses [skip ci]

* Optimised images with calibre/image-actions

* Update list again

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Mykola 2020-02-21 14:01:03 -08:00 committed by GitHub
parent 00e30bcb95
commit 08efad8571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 145 additions and 33 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ node_modules/
.idea
.vscode/
*~
*.txt

View File

@ -28,7 +28,11 @@ Token repository [https://github.com/trustwallet/assets](https://github.com/trus
7. Crypto price providers map: [CoinMarketCap](https://github.com/trustwallet/assets/blob/master/pricing/coinmarketcap/mapping.json)
8. Coming soon: token info
8. Token and coin info
9. Smart contract deprecation/upgrade [read more](#Update-or-remove-existing-asset)
10. Coming soon: Coin pop up notification https://github.com/trustwallet/assets/issues/1274
<center><img src='https://raw.githubusercontent.com/trustwallet/assets/master/media/trust-wallet.png'></center>
@ -40,9 +44,27 @@ Token repository [https://github.com/trustwallet/assets](https://github.com/trus
2. Get familiar with [folder strcture](#repository-structure), will give you understanding where asset should be placed
3. [Add asset guide](#how-to-add-asset)
### Update or remove existing asset
### Update and remove existing asset
Whenever you updating or deleting asset on behalf of asset owner or just found outdated information, please provide link to the source saying about changes. That will help to speed up review process
Whenever you updating or deleting asset on behalf of asset owner or just found outdated information, please provide link to the source saying about changes. That will help to speed up review process.
This instruction wil be helpwull if you want to:
1. Update information about smart contract
2. (Depreate)[#What-is-smart-contract-deprication] or update contract address
Smart contract address update procedure:
1. Rename old contract address in coreponding coin folder to new contract e.g:
1. Remove smart contract e.g:
```bash
`rm -r ./blockchains/<COIN>/assets/<OLD_CONTRACT_ADDRESS>/`
`rm -r ./blockchains/ethereum/assets/0x19fFfd124CD9089E21026d10dA97f8cD6B442Bff/`
```
2. Commit changes and make PR
## Image Requirements
@ -87,6 +109,7 @@ Whenever you updating or deleting asset on behalf of asset owner or just found o
│ │ └──assets
│ │ │ └──0x0a2D9370cF74Da3FD3dF5d764e394Ca8205C50B6 // address folder
│ │ │ └──logo.png // address logo
| | | └──info.json // info related to contract
│ │ └──info
│ │ └──logo.png // coin logo
| |
@ -94,14 +117,17 @@ Whenever you updating or deleting asset on behalf of asset owner or just found o
│ │ └──assets
│ │ │ └──ONE-5F9
│ │ │ └──logo.png
| | | └──info.json
│ │ └──info
│ │ └──logo.png
| └──tron
│ | └──assets
│ | │ └──1002000
│ | │ | └──logo.png
| | | | └──info.json
| | | └──TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
| | | └──logo.png
| | | └──info.json
| | |
│ | └──info
│ | └──logo.png
@ -175,6 +201,12 @@ Both clients, Android and iOS keep old image cache for up to 7 days. In order to
### Why i don't see my token in search after PR was merged ?
After PR was merged, set of cron workers will update token status normally with in 10 minutes and sometimes up to 30 minutes and token became visible in search result.
### What is smart contract deprication (removal)
A process of removing smart contract information such as (token logo and info) from this repository.
Removed contract address will be added to the blacklist and, as a result, will no longer be present in token search results inside the TW app.
Why would you want to do this ?.
You are contract owner or just good samaritan who noticed contract to be no longer "active" and was an upgrade and abandoned by owning organization, involved in a scam, mimicking by its name or/and symbol a real contract. All facts must be supported with a link to any resource proving these statements.
## How to use it? (For Developers)
Base URL for token image:
```js

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -411,6 +411,7 @@
"0x238f2d6787DaCB6045d72B0Ec6626DE0ff7C3107",
"0x239ec890C0ae862aEc500dE5fd18515fb9Ebf8D8",
"0x24077BDcEA4F64442e1695616EAf5AF461b44580",
"0x2425433ECAc0ee6776B1D881eB380Adac3006dDb",
"0x24449346f2F8d6C874754b73904157DcCc5dA404",
"0x2454E7473b14Cb5757f764822Da57cD1dC1b6069",
"0x246fc23e1c0DFF674283582B2C71c492f47ab62c",
@ -523,6 +524,7 @@
"0x2E6caf50CEEC531d60818cd85029C2cf3a398842",
"0x2E7570255AC8c449217FB15405Fac01f5408D114",
"0x2E954cFc5cb4F089f5F3d7331449861249106D85",
"0x2EBDa5103Af19A994b96a44f0c0aC5571Ff039f7",
"0x2EE6D1a3ba4e80a61BdFB48a90d40a5CeF455326",
"0x2f1d835FdC8b59E03828D9b7F0b91B046b40f5BC",
"0x2F2774bC73C11A825d782Ab50B96AF728Db07478",
@ -714,6 +716,7 @@
"0x3Ffb992E0346278519164c04d401ae0321f83731",
"0x4006A717B390Ff7cCc4350228c12902a3274f53A",
"0x4008De4E758Bf2d066640ff8c469365782816AF8",
"0x400F3C85D2B50Ac0AccEd459d75b27CE51B620eF",
"0x403B19cFBe5Db07E6Ed73F0eBB8068Be34813236",
"0x4063D6a1EB9e0810Af9E4fE597caB49e1744ea65",
"0x40763Da43e6F657F6faA7CD17fe09FF80d30b710",
@ -775,6 +778,7 @@
"0x4576BEdA526E010c8713B0Edbf98caAe8B27524f",
"0x4580a6F8fceAd131405eAC9e80601c71EC01D2D5",
"0x45862289631b8935DC124eA26e035EEE03bC8382",
"0x45a21B21c1D28aEA5e455154fE626C7Dd7ae5BD0",
"0x45d69621413ABb627058dD2c55E68E2CB5197d4C",
"0x45d9036500877CAf5c777641aBdD1A73B51e2A5A",
"0x45f3a5f26654158faDef0ED19A55E88424fD914B",
@ -788,6 +792,7 @@
"0x46eda14F419bE11384F2bdA783d12577A786Ec49",
"0x46f45A7c51e25b2766dc90C52bAE2Dac09428C51",
"0x46fbCfd32eA671CAa21897C09072CB6cb44C0bc9",
"0x470174b60778503B741b7e27D96BE8636f0AF279",
"0x4707EF4a68a54F266e268d43E160592D8b924eE7",
"0x472bEDd0F4De2573BaE522546940c93Ae37C5b21",
"0x47344543C4c8887cE86F6c4AD8C253457B1b9697",
@ -1530,6 +1535,7 @@
"0x85D56d0f39B1250DE7642f1e63D25a7b62DBbfe8",
"0x85d613dEaeB4791182fff0C5395f3366bDfE0aE9",
"0x85d960d4a22C1DA47e9F1272EE02F5d023B562FE",
"0x85e076361cc813A908Ff672F9BAd1541474402b2",
"0x85e419B74C3d1c72ec05fC09E781dFe8EBb5e72D",
"0x85e4cd785887cAd7C6bE93F2f34d5fA683f9BfCD",
"0x85ed0aA9e6f025401dE93078C17Dd83F4691e38E",
@ -1593,6 +1599,7 @@
"0x8aFA4Feff8B5676Bcd76341ad1bA3038245F2596",
"0x8b42772bD32Ea6782Dc89ec2488b8D27501AC84A",
"0x8b50585AB60eD248ee7493ebCAEf7d99bf5B6a1B",
"0x8B63C8A2D68dEfdaAdd8094240b2dc6E564EB946",
"0x8B7a1505D3f7Dff5dCF9D2524155372626F19150",
"0x8b802e9A4A1e16159661817707e3601Cda30F6B7",
"0x8b8AbA3a57e89445d88734565D6ed96e1c301dfd",
@ -2180,6 +2187,7 @@
"0xbc8182a035e40FA640078CA347399b086f59947A",
"0xBc85ee5e575597558e69A43C846894083E30797C",
"0xbC92abeE522870e255b5C3d77709a64B55604072",
"0xbCa7eeEd1faDD22AD8E1eB4fCCF8C221922AF875",
"0xbCc1cea95A1cC7f79404664Bef9A9671bdc12174",
"0xbcd5AF129A14120ce86A1265Bb573731B71BC4d6",
"0xBCE981c214FB0D87112eDD383d9E9a0fce5A59Ea",
@ -2454,6 +2462,7 @@
"0xd3551ab3018Edb9e1c1111e966CCefFdf625a730",
"0xD35ce1c4e1e1863d3A2f71cA14Cae52F0Df152DB",
"0xD3a6967214a24dE0a230c66aFe0a47fB2Ee1Bd83",
"0xD3Acc6204D4e00d094d80B5Bf46aAf497B5984A2",
"0xD3B353421FC5048AD38f7581097951bb9D6C52FF",
"0xD3c22F8020066B46441e957bA18b6C73561d28E3",
"0xd3c6b3B0f0DB3890e4Ce4D2a3f97cf3BF0642c92",
@ -2511,6 +2520,7 @@
"0xd7FBD072CF99146aBcffA0ff4AcF51b866a70433",
"0xD828956233931F8b1C19Eb8CB14b81a86Ff88BE2",
"0xD8633D2847c473198EAE58C49a85515b782045Cf",
"0xd8647E70c096999327f813Cb9f3e49811C2220fA",
"0xd875021bebD5A4e677ac642B64C9872B769386E2",
"0xd8a7c7Daed6E7fD480D4cea3Af336A97411FE25c",
"0xD8C1174D949b562aACbcd1cBC71Fe598D7907309",

View File

@ -463,6 +463,7 @@
"0x19ea194d71e2dC4179fF0FdBB5666FcA77C4730E",
"0x19ea630bCBc1a511a16e65b6ECd447c92E1C087c",
"0x19fd68eC7AE71562f9288032797ef4401ddEA0a9",
"0x19fFfd124CD9089E21026d10dA97f8cD6B442Bff",
"0x1A0B3B603F650b2C4f474f0E817091874020Ef38",
"0x1A0c31837EdB132a9312841B9527E6307db13509",
"0x1A0F2aB46EC630F9FD638029027b552aFA64b94c",
@ -1280,6 +1281,7 @@
"0x464BADdcE9BD32581a7d59D9Bb8350c7C7764668",
"0x464eBE77c293E473B48cFe96dDCf88fcF7bFDAC0",
"0x4672bAD527107471cB5067a887f4656D585a8A31",
"0x467Bccd9d29f223BcE8043b84E8C8B282827790F",
"0x4689a4e169eB39cC9078C0940e21ff1Aa8A39B9C",
"0x46ae264Bf6d9Dc6Dd84c31064551f961c67a755c",
"0x46b9Ad944d1059450Da1163511069C718F699D31",
@ -1787,6 +1789,7 @@
"0x61f7f75552A8d961718B4eAaae10DEfc4D29a28c",
"0x62050D57CB395239972Dc9A0D6c1bA273b45a416",
"0x621d78f2EF2fd937BFca696CabaF9A779F59B3Ed",
"0x6226caA1857AFBc6DFB6ca66071Eb241228031A1",
"0x622CD54dEb2bB7A051515192417109bcF3fe098f",
"0x622dFfCc4e83C64ba959530A5a5580687a57581b",
"0x623aFE103Fb8d189B56311E4CE9956Ec0989b412",
@ -2376,7 +2379,6 @@
"0x85D7d752C380F7B2BF61878386474778782207FB",
"0x85Dd50BB40b7770564d35D71B0C6EAf3ec1d9603",
"0x85df09a6aAE0337d10A70CC3f079E9Eb9b66ef10",
"0x85e076361cc813A908Ff672F9BAd1541474402b2",
"0x85eF130106f3e3BE4D9F53eDd2E6ff713272e7dc",
"0x85Fc58443F809bEA3e1fb70A84F582FE84d624Ce",
"0x85FCfD9438E4c071fcba6cf415c5FFef276d5064",

View File

@ -8,5 +8,6 @@
"url": ""
}
],
"data_source": "crowd"
"data_source": "crowd",
"socials": []
}

View File

@ -24,4 +24,4 @@
}
],
"data_source": "crowd"
}
}

View File

@ -3,7 +3,7 @@
"website": "https://nebulas.io",
"source_code": "https://github.com/nebulasio",
"white_paper": "https://nebulas.io/docs/NebulasWhitepaper.pdf",
"short_description": "Nebulas is a decentralized platform which provides a search framework for all blockchains. Nebulas is a next generation public blockchain, aiming for a continuously improving ecosystem.",
"short_description": "Nebulas is a decentralized platform which provides a search framework for all blockchains. Nebulas is a next generation public blockchain, aiming for a continuously improving ecosystem.",
"description": "Nebulas describes itself as an autonomous metanet, which focuses on on-chain data, interactions, and collaboration. Its hyper-mapped structural metadata can reportedly handle increasingly complex on-chain data and describe these interactions. On 15 April 2019, the team released Nebulas NOVA, a blockchain network with native on-chain incentive. After Nebulas NOVA goes live, developers and users will be able to participate in the development of the Nebulas ecosystem to realize its vision - let everyone benefit fairly from decentralized collaboration. To facilitate ecosystem development, asset management, and promote the “autonomous metanet”, the founding team of Nebulas will form the “Nebulas Community Group” together with the community. The Nebulas Community Group comprises 3 organizations - Nebulas Council, Nebulas Foundation, and Nebulas Technical Committee. These organizations will supervise each other and support the sustainable development of Nebulas.",
"explorers": [
{

View File

@ -9,11 +9,11 @@
"cleanup": "find ./.. -iname '.DS_Store' -type f -delete",
"update-bep2": "npm run cleanup && node ./script/updateBEP2",
"checksum-erc20": "npm run cleanup && ts-node ./script/erc20_to_checksum",
"list": "npm run cleanup && ts-node ./script/gen_list",
"gen:info": "ts-node ./script/gen_info",
"gen:list": "npm run cleanup && ts-node ./script/gen_list",
"gen:info": "npm run cleanup && ts-node ./script/gen_info",
"resize": "npm run cleanup && ts-node ./script/resize_images",
"map:cmc": "ts-node ./pricing/coinmarketcap/script",
"magic": "npm run update-bep2 && npm run checksum-erc20 && npm run resize && npm run list && npm t"
"magic": "npm run update-bep2 && npm run checksum-erc20 && npm run resize && npm run gen:list && npm t"
},
"repository": {
"type": "git",

View File

@ -2632,7 +2632,7 @@
{
"coin": 60,
"type": "token",
"token_id": "0x85e076361cc813A908Ff672F9BAd1541474402b2",
"token_id": "0x467Bccd9d29f223BcE8043b84E8C8B282827790F",
"id": 2394
},
{
@ -8134,7 +8134,7 @@
{
"coin": 60,
"type": "token",
"token_id": "0xdE1289e68aD9e65Ccf50D800C0CEC2D514B80A40",
"token_id": "0x42566cFEFC853c232117EbA4413e45782a72715d",
"id": 3998
},
{
@ -8253,12 +8253,6 @@
"token_id": "COS-2E4",
"id": 4036
},
{
"coin": 60,
"type": "token",
"token_id": "0xB879DA8b24c9b8685dE8526cF492E954f165D74b",
"id": 4038
},
{
"coin": 60,
"type": "token",
@ -10115,5 +10109,23 @@
"type": "token",
"token_id": "0x02b1669bC9EE893edAFf3cADfD326A294d643f99",
"id": 5232
},
{
"coin": 60,
"type": "token",
"token_id": "0x19fFfd124CD9089E21026d10dA97f8cD6B442Bff",
"id": 5247
},
{
"coin": 60,
"type": "token",
"token_id": "0x4F34adfff48CEB4Af2f3b2253CdFdcC99c9053F4",
"id": 5248
},
{
"coin": 60,
"type": "token",
"token_id": "0x6226caA1857AFBc6DFB6ca66071Eb241228031A1",
"id": 5251
}
]

View File

@ -5,14 +5,24 @@ const chalk = require('chalk')
const fs = require("fs")
const path = require('path')
const constants = require('bip44-constants')
import { readFileSync, getChainAssetLogoPath, isPathExistsSync, getChainName, makeDirSync, getChainAssetPath} from "../../src/test/helpers";
import {
readFileSync,
getChainAssetLogoPath,
isPathExistsSync,
getChainName,
makeDirSync,
getChainAssetPath,
ethSidechains,
getChainBlacklist,
getChainWhitelist,
} from "../../src/test/helpers";
import { TickerType, mapTiker, PlatformType } from "../../src/test/models";
import { CoinType } from "@trustwallet/types";
// Steps required to run this:
// 1. (Optional) CMC API key already setup, use yours if needed. Install script deps "npm i" if hasn't been run before.
// 2. Pull down tokens repo https://github.com/trustwallet/assets and point COIN_IMAGE_BASE_PATH and TOKEN_IMAGE_BASE_PATH to it.
// 3. Run: npm run update-tokens.
// 3. Run: `npm run gen:list`
const CMC_PRO_API_KEY = `df781835-e5f4-4448-8b0a-fe31402ab3af` // Free Basic Plan api key is enough to run script
const CMC_LATEST_BASE_URL = `https://pro-api.coinmarketcap.com/v1/global-metrics/quotes/latest?`
@ -20,6 +30,8 @@ const CONTRACTS_PATH = path.join(__dirname, 'mapping.json')
const wstream = fs.createWriteStream(CONTRACTS_PATH)
const typeToken = TickerType.Token
const typeCoin = TickerType.Coin
const mappedChainsBlacklistAssets = {} // {ethereum: {<0x...>: ""},}
const mappedChainsWhitelistAssets = {} // {ethereum: {<0x...>: ""},}
const custom: mapTiker[] = [
{coin: 60, "type": typeToken, "token_id": "0x6758B7d441a9739b98552B373703d8d3d14f9e62", "id": 2548}, // POA ERC20 on Foundation (POA20)
@ -41,11 +53,13 @@ const custom: mapTiker[] = [
{"coin": 60, "type": typeToken, "token_id": "0x5Cf04716BA20127F1E2297AdDCf4B5035000c9eb", "id": 2780}, // NKN (NKN)
{"coin": 714, "type": typeToken, "token_id": "CHZ-ECD", "id": 4066}, // Chilz (BEP-2)
{"coin": 60, "type": typeToken, "token_id": "0xdF1D6405df92d981a2fB3ce68F6A03baC6C0E41F", "id": 3816}, // VERA (VRA)
{"coin": 60, "type": typeToken, "token_id": "0x467Bccd9d29f223BcE8043b84E8C8B282827790F", "id": 2394}, // Telcoin (TEL)
// {"coin": 60, "type": typeToken, "token_id": "XXX", "id": XXX}, // XXX (XXX)
]
const permanentRemove = [
"0x17280DA053596E097604839C61A2eF5efb7d493f" // old Jobchain (JOB)
"0x17280DA053596E097604839C61A2eF5efb7d493f", // old Jobchain (JOB)
"0x85e076361cc813A908Ff672F9BAd1541474402b2", // old Telcoin (TEL)
]
const allContracts: mapTiker[] = [] // Temp storage for mapped assets
@ -55,6 +69,7 @@ let bnbOriginalSymbolToSymbol = {} // e.g: WISH: WISH-2D5
run()
async function run() {
await initState()
try {
const totalCrypto = await getTotalActiveCryptocurrencies()
await setBinanceTokens()
@ -172,6 +187,28 @@ async function processCoin(coin) {
// })
}
// Iniitalize state necessary for faster data looup during script run
async function initState () {
await mapChainsAssetsLists()
}
async function mapChainsAssetsLists() {
ethSidechains.forEach(chain => {
Object.assign(mappedChainsWhitelistAssets, {[chain]: {}})
Object.assign(mappedChainsBlacklistAssets, {[chain]: {}})
const whiteList = getChainWhitelist(chain)
const blackList = getChainBlacklist(chain)
whiteList.forEach(addr => {
Object.assign(mappedChainsWhitelistAssets[chain], {[addr]: ""})
})
blackList.forEach(addr => {
Object.assign(mappedChainsBlacklistAssets[chain], {[addr]: ""})
})
})
}
function addCustom() {
custom.forEach(c => {
addToContractsList(c)
@ -218,11 +255,11 @@ const getImageURL = (id: string | number): string => `https://s2.coinmarketcap.c
async function getImageIfMissing(chain: string, address: string, id: string) {
try {
const logoPath = getChainAssetLogoPath(chain, String(address))
const logoFolderPath = getChainAssetPath(chain, address)
if (!isPathExistsSync(logoPath)) {
if (!isPathExistsSync(logoPath) && !isAddressInBlackList(chain, address)) {
const imageStream = await fetchImage(getImageURL(id))
if (imageStream) {
const logoFolderPath = getChainAssetPath(chain, address)
if(!isPathExistsSync(logoFolderPath)) {
makeDirSync(logoFolderPath)
}
@ -237,6 +274,11 @@ async function getImageIfMissing(chain: string, address: string, id: string) {
}
}
function isAddressInBlackList(chain: string, address: string): boolean {
return mappedChainsBlacklistAssets[chain].hasOwnProperty(address)
}
async function fetchImage(url: string) {
try {
return axios.get(url, {
@ -272,7 +314,6 @@ async function setBinanceTokens () {
return acm
}, {})
bnbOriginalSymbolToSymbol = data.reduce((acm, token) => {
log(`Token symbol ${token.original_symbol}:${token.symbol}`)
acm[token.original_symbol] = token.symbol
return acm
}, {})
@ -281,7 +322,7 @@ async function setBinanceTokens () {
function readBEP2() {
// Fetch https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?CMC_PRO_API_KEY=YOUR_KEYc&limit=5000 and store full response
// in file
// in file
const validatorsList = JSON.parse(readFileSync("./pricing/coinmarketcap/cryptocurrency_map.json"))
return validatorsList.data
}

View File

@ -53,16 +53,17 @@ bluebird.mapSeries(readDirSync(chainsFolderPath), (chain: string) => {
}
const infoList: InfoList = JSON.parse(readFileSync(chainInfoPath))
// Add "handle" property to each social element
let newSocials = []
infoList.socials.forEach(social => {
const handle = "handle"
if (nestedProperty.hasOwn(social, handle)) {
nestedProperty.set(social, handle, getHandle(social.url))
newSocials.push(social)
}
})
if ("socials" in infoList) {
infoList.socials.forEach(social => {
const handle = "handle"
if (nestedProperty.hasOwn(social, handle)) {
nestedProperty.set(social, handle, getHandle(social.url))
newSocials.push(social)
}
})
}
nestedProperty.set(infoList, "socials", newSocials)
writeToInfo(chainInfoPath, infoList)
})

View File

@ -51,6 +51,18 @@ export const getChainValidatorsAssetsPath = (chain: string): string => `${getCha
export const getChainValidatorAssetLogoPath = (chain: string, asset: string): string => `${getChainValidatorsAssetsPath(chain)}/${asset}/${logo}`
export const getChainWhitelistPath = (chain: string): string => `${chainsFolderPath}/${chain}/${whiteList}`
export const getChainBlacklistPath = (chain: string): string => `${chainsFolderPath}/${chain}/${blackList}`
export const getChainWhitelist = (chain: string): string[] => {
if (isChainWhitelistExistSync(chain)) {
return JSON.parse(readFileSync(getChainWhitelistPath(chain)))
}
return []
}
export const getChainBlacklist = (chain: string): string[] => {
if (isChainBlacklistExistSync(chain)) {
return JSON.parse(readFileSync(getChainBlacklistPath(chain)))
}
return []
}
export const readDirSync = (path: string): string[] => fs.readdirSync(path)
export const makeDirSync = (path: string) => fs.mkdirSync(path)