Skip to content

Commit 4775cf6

Browse files
authored
Merge pull request #25 from hyperweb-io/ibc-coingecko_id
solve the coingeckoId issue
2 parents c386659 + 5084e72 commit 4775cf6

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

examples/ibc-asset-list/hooks/queries/usePrices.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ type CoinGeckoUSD = { usd: number };
88
type CoinGeckoUSDResponse = Record<CoinGeckoId, CoinGeckoUSD>;
99

1010
const getAssetsWithGeckoIds = (assets: Asset[]) => {
11-
return assets // .filter((asset) => !!asset?.coingeckoId);
11+
return assets.filter((asset) => !!asset?.coingeckoId);
1212
};
1313

1414
const getGeckoIds = (assets: Asset[]) => {
15-
return assets.map((asset) => asset.coingeckoId ?? asset.name.toLowerCase()) as string[];
15+
return assets.map((asset) => asset.coingeckoId) as string[];
1616
};
1717

1818
const formatPrices = (
1919
prices: CoinGeckoUSDResponse,
2020
assets: Asset[]
2121
): Record<string, number> => {
2222
return Object.entries(prices).reduce((priceHash, cur) => {
23-
const denom = assets.find((asset) => asset.coingeckoId === cur[0] || asset.name.toLowerCase() === cur[0])!.base;
23+
const denom = assets.find((asset) => asset.coingeckoId === cur[0])!.base;
2424
return { ...priceHash, [denom]: cur[1].usd };
2525
}, {});
2626
};

examples/ibc-asset-list/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"dependencies": {
2121
"@chain-registry/assets": "^1.70.32",
2222
"@chain-registry/types": "^0.50.13",
23+
"@chain-registry/v2": "^1.71.132",
2324
"@cosmjs/stargate": "^0.32.3",
2425
"@emotion/react": "11.10.6",
2526
"@emotion/styled": "11.10.6",

examples/ibc-asset-list/yarn.lock

+17
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ __metadata:
142142
languageName: node
143143
linkType: hard
144144

145+
"@chain-registry/v2-types@npm:^0.53.77":
146+
version: 0.53.77
147+
resolution: "@chain-registry/v2-types@npm:0.53.77"
148+
checksum: 10c0/b7b0b7d3ca9436706c8143a8f6cd322f5e663675bae5d08e5da065a1d4f0bf0e9163b931dbf887e8a44567fe797e571f94f6b0d2dc0e6379819827d6a9345e8d
149+
languageName: node
150+
linkType: hard
151+
145152
"@chain-registry/v2@npm:1.71.71":
146153
version: 1.71.71
147154
resolution: "@chain-registry/v2@npm:1.71.71"
@@ -160,6 +167,15 @@ __metadata:
160167
languageName: node
161168
linkType: hard
162169

170+
"@chain-registry/v2@npm:^1.71.132":
171+
version: 1.71.132
172+
resolution: "@chain-registry/v2@npm:1.71.132"
173+
dependencies:
174+
"@chain-registry/v2-types": "npm:^0.53.77"
175+
checksum: 10c0/1d5cd51546e36f211b1248e52c52345a073dd91233e58bbcce5e0ac7decf666f32782bfa9a335a89501be7832a523c964dcd36b84c0cedd36bbcf6fbe59b0dd9
176+
languageName: node
177+
linkType: hard
178+
163179
"@confio/ics23@npm:^0.6.8":
164180
version: 0.6.8
165181
resolution: "@confio/ics23@npm:0.6.8"
@@ -1073,6 +1089,7 @@ __metadata:
10731089
dependencies:
10741090
"@chain-registry/assets": "npm:^1.70.32"
10751091
"@chain-registry/types": "npm:^0.50.13"
1092+
"@chain-registry/v2": "npm:^1.71.132"
10761093
"@cosmjs/stargate": "npm:^0.32.3"
10771094
"@emotion/react": "npm:11.10.6"
10781095
"@emotion/styled": "npm:11.10.6"

0 commit comments

Comments
 (0)