From d27cea5d805d8cf5f0b77659a538c2bc1d751d56 Mon Sep 17 00:00:00 2001 From: dima-safin-2025 Date: Thu, 11 Jul 2024 16:02:32 +0800 Subject: [PATCH 1/4] chores: Fix typo - intiia -> initia --- _packages/initia-registry/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_packages/initia-registry/README.md b/_packages/initia-registry/README.md index 384d16b..89ab27b 100644 --- a/_packages/initia-registry/README.md +++ b/_packages/initia-registry/README.md @@ -11,7 +11,7 @@ npm install @initia/initia-registry Fetch data from initia-registry: ```typescript -import { assets, chains, ibc } from "@intiia/initia-registry"; +import { assets, chains, ibc } from "@initia/initia-registry"; import { Chain } from "@initia/initia-registry-types"; const assetList: Chain = assets.find( From fe203dc09fac53d9d4227268eeb1699094675469 Mon Sep 17 00:00:00 2001 From: dima-safin-2025 Date: Thu, 11 Jul 2024 16:50:07 +0800 Subject: [PATCH 2/4] fix some syntax error --- .github/workflows/utility/chain_registry.mjs | 22 +++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/utility/chain_registry.mjs b/.github/workflows/utility/chain_registry.mjs index 1908b61..24df811 100644 --- a/.github/workflows/utility/chain_registry.mjs +++ b/.github/workflows/utility/chain_registry.mjs @@ -192,7 +192,6 @@ export function setFileProperty(chainName, file, property, value) { let json = readJsonFile(filePath); json[property] = value; writeJsonFile(filePath, json); - return; } } } @@ -218,13 +217,8 @@ export function getIBCFileProperty(chainName1, chainName2, property) { export function getAssetProperty(chainName, baseDenom, property) { const assets = getFileProperty(chainName, "assetlist", "assets"); if(assets) { - let selectedAsset; - assets.forEach((asset) => { - if(asset.base == baseDenom) { - selectedAsset = asset; - return; - } - }); + const selectedAsset = assets.find(asset => asset.base === baseDenom); + if(selectedAsset) { return selectedAsset[property]; } @@ -234,13 +228,11 @@ export function getAssetProperty(chainName, baseDenom, property) { export function setAssetProperty(chainName, baseDenom, property, value) { const assets = getFileProperty(chainName, "assetlist", "assets"); if(assets) { - assets.forEach((asset) => { - if(asset.base == baseDenom) { - asset[property] = value; - setFileProperty(chainName, "assetlist", "assets", assets); - return; - } - }); + const asset = assets.find(asset => asset.base === baseDenom); + if (asset) { + asset[property] = value; + setFileProperty(chainName, "assetlist", "assets", assets); + } } } From 71c53ea79feaa941bf82500a944b594062af4139 Mon Sep 17 00:00:00 2001 From: dima-safin-2025 Date: Wed, 17 Jul 2024 13:06:31 +0800 Subject: [PATCH 3/4] fix: remove this duplicated type --- _packages/types/src/types/Chain.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/_packages/types/src/types/Chain.ts b/_packages/types/src/types/Chain.ts index 93e4ff7..9471c86 100644 --- a/_packages/types/src/types/Chain.ts +++ b/_packages/types/src/types/Chain.ts @@ -170,12 +170,9 @@ export interface Chain { }[]; }; images?: ( - | { + { [k: string]: unknown; - } - | { - [k: string]: unknown; - } + } )[]; logo_URIs?: { png?: string; From 31375c8142df1fe00aa5664239212ee3dca2f198 Mon Sep 17 00:00:00 2001 From: dima-safin-2025 Date: Wed, 17 Jul 2024 14:38:16 +0800 Subject: [PATCH 4/4] fix: remove some unused imports or declaration --- .github/workflows/utility/sync_images.mjs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/utility/sync_images.mjs b/.github/workflows/utility/sync_images.mjs index 2f001a0..211eee1 100644 --- a/.github/workflows/utility/sync_images.mjs +++ b/.github/workflows/utility/sync_images.mjs @@ -52,9 +52,6 @@ // // write changes to chain_reg - -import * as fs from 'fs'; -import * as path from 'path'; import * as chain_reg from './chain_registry.mjs'; function createImagesArray(){ @@ -63,7 +60,6 @@ function createImagesArray(){ // get list of assets, iterate each asset // record the logo_URIs and images properties - let chainFiles = []; let newImageContainingObject; let chains = chain_reg.getChains(); @@ -80,7 +76,7 @@ function createImagesArray(){ logo_URIs: logo_URIs, images: images, hasUpdated: false - } + }; //console.log(imageContainingObject); newImageContainingObject = compareImages(imageContainingObject); @@ -107,7 +103,7 @@ function createImagesArray(){ logo_URIs: logo_URIs, images: images, hasUpdated: false - } + }; //console.log(imageContainingObject); newImageContainingObject = compareImages(imageContainingObject); @@ -260,7 +256,7 @@ function overwriteLogoURIs(chain_name, base_denom){ let logo_URIs = { png: images?.[0]?.png, svg: images?.[0]?.svg - } + }; if(images) { if(images[0].png || images[0].svg) { chain_reg.setFileProperty(chainName, "chain", "logo_URIs", logo_URIs); @@ -274,7 +270,7 @@ function overwriteLogoURIs(chain_name, base_denom){ let logo_URIs = { png: images?.[0]?.png, svg: images?.[0]?.svg - } + }; if(images) { if(images[0].png || images[0].svg) { chain_reg.setAssetProperty(assetPointer.chain_name, assetPointer.base_denom, "logo_URIs", logo_URIs); @@ -290,4 +286,4 @@ function main(){ overwriteLogoURIs(); } -main() \ No newline at end of file +main(); \ No newline at end of file