@@ -2,7 +2,7 @@ import { useMemo } from 'react';
22import { useWalletManager } from '@interchain-kit/react' ;
33import { Asset , AssetList } from '@chain-registry/types' ;
44import { asset_lists as ibcAssetLists } from '@chain-registry/assets' ;
5- import { assets as chainAssets , ibc } from 'chain-registry' ;
5+ import { assetLists as chainAssets , ibcData as ibc } from 'chain-registry' ;
66import { Coin } from '@interchainjs/react/types' ;
77import BigNumber from 'bignumber.js' ;
88
@@ -18,14 +18,14 @@ export const useChainUtils = (chainName: string) => {
1818 starshipData ?. v1 ?? { } ;
1919
2020 const isStarshipChain = starshipChains . some (
21- ( chain ) => chain . chain_name === chainName
21+ ( chain ) => chain . chainName === chainName
2222 ) ;
2323
2424 const filterAssets = ( assetList : AssetList [ ] ) : Asset [ ] => {
2525 return (
2626 assetList
27- . find ( ( { chain_name } ) => chain_name === chainName )
28- ?. assets ?. filter ( ( { type_asset } ) => type_asset !== 'ics20' ) || [ ]
27+ . find ( ( { chainName } ) => chainName === chainName )
28+ ?. assets ?. filter ( ( { typeAsset } ) => typeAsset !== 'ics20' ) || [ ]
2929 ) ;
3030 } ;
3131
@@ -66,7 +66,7 @@ export const useChainUtils = (chainName: string) => {
6666 ( asset ) =>
6767 asset . symbol === symbol &&
6868 ( ! chainName ||
69- asset . traces ?. [ 0 ] . counterparty . chain_name . toLowerCase ( ) ===
69+ asset . traces ?. [ 0 ] . counterparty . chainName . toLowerCase ( ) ===
7070 chainName . toLowerCase ( ) )
7171 ) ;
7272 const base = asset ?. base ;
@@ -78,7 +78,7 @@ export const useChainUtils = (chainName: string) => {
7878
7979 const getExponentByDenom = ( denom : CoinDenom ) : Exponent => {
8080 const asset = getAssetByDenom ( denom ) ;
81- const unit = asset . denom_units . find ( ( { denom } ) => denom === asset . display ) ;
81+ const unit = asset . denomUnits . find ( ( { denom } ) => denom === asset . display ) ;
8282 return unit ?. exponent || 0 ;
8383 } ;
8484
@@ -102,7 +102,7 @@ export const useChainUtils = (chainName: string) => {
102102 return chainName ;
103103 }
104104 const asset = ibcAssets . find ( ( asset ) => asset . base === ibcDenom ) ;
105- const ibcChainName = asset ?. traces ?. [ 0 ] . counterparty . chain_name ;
105+ const ibcChainName = asset ?. traces ?. [ 0 ] . counterparty . chainName ;
106106 if ( ! ibcChainName )
107107 throw Error ( 'chainName not found for ibcDenom: ' + ibcDenom ) ;
108108 return ibcChainName ;
@@ -140,15 +140,15 @@ export const useChainUtils = (chainName: string) => {
140140
141141 let ibcInfo = ibc . find (
142142 ( i ) =>
143- i . chain_1 . chain_name === fromChainName &&
144- i . chain_2 . chain_name === toChainName
143+ i . chain1 . chainName === fromChainName &&
144+ i . chain2 . chainName === toChainName
145145 ) ;
146146
147147 if ( ! ibcInfo ) {
148148 ibcInfo = ibc . find (
149149 ( i ) =>
150- i . chain_1 . chain_name === toChainName &&
151- i . chain_2 . chain_name === fromChainName
150+ i . chain1 . chainName === toChainName &&
151+ i . chain2 . chainName === fromChainName
152152 ) ;
153153 flipped = true ;
154154 }
@@ -157,9 +157,9 @@ export const useChainUtils = (chainName: string) => {
157157 throw new Error ( 'cannot find IBC info' ) ;
158158 }
159159
160- const key = flipped ? 'chain_2 ' : 'chain_1 ' ;
161- const sourcePort = ibcInfo . channels [ 0 ] [ key ] . port_id ;
162- const sourceChannel = ibcInfo . channels [ 0 ] [ key ] . channel_id ;
160+ const key = flipped ? 'chain2 ' : 'chain1 ' ;
161+ const sourcePort = ibcInfo . channels [ 0 ] [ key ] . portId ;
162+ const sourceChannel = ibcInfo . channels [ 0 ] [ key ] . channelId ;
163163
164164 return { sourcePort, sourceChannel } ;
165165 } ;
0 commit comments