Skip to content

Commit

Permalink
fix some syntax error and typo error (#165)
Browse files Browse the repository at this point in the history
* chores: Fix typo - intiia -> initia

* fix some syntax error

* fix: remove this duplicated type

* fix: remove some unused imports or declaration
  • Loading branch information
dima-safin-2025 authored Jul 23, 2024
1 parent ff16e97 commit 5dc3007
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/utility/chain_registry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export function setFileProperty(chainName, file, property, value) {
let json = readJsonFile(filePath);
json[property] = value;
writeJsonFile(filePath, json);
return;
}
}
}
Expand All @@ -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];
}
Expand All @@ -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);
}
}
}

Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/utility/sync_images.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand All @@ -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();
Expand All @@ -80,7 +76,7 @@ function createImagesArray(){
logo_URIs: logo_URIs,
images: images,
hasUpdated: false
}
};

//console.log(imageContainingObject);
newImageContainingObject = compareImages(imageContainingObject);
Expand All @@ -107,7 +103,7 @@ function createImagesArray(){
logo_URIs: logo_URIs,
images: images,
hasUpdated: false
}
};

//console.log(imageContainingObject);
newImageContainingObject = compareImages(imageContainingObject);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -290,4 +286,4 @@ function main(){
overwriteLogoURIs();
}

main()
main();
2 changes: 1 addition & 1 deletion _packages/initia-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 2 additions & 5 deletions _packages/types/src/types/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,9 @@ export interface Chain {
}[];
};
images?: (
| {
{
[k: string]: unknown;
}
| {
[k: string]: unknown;
}
}
)[];
logo_URIs?: {
png?: string;
Expand Down

0 comments on commit 5dc3007

Please sign in to comment.