@@ -49,7 +49,34 @@ export const useChainUtils = (chainName: string) => {
4949 } ;
5050
5151 const getAssetByDenom = ( denom : CoinDenom ) : Asset => {
52- return allAssets . find ( ( asset ) => asset . base === denom ) as Asset ;
52+ const asset = allAssets . find ( ( asset ) => asset . base === denom ) ;
53+
54+ // Fallback for hyperweb native token if not found in asset lists
55+ if ( ! asset && denom === 'uhyper' && chainName === 'hyperweb' ) {
56+ return {
57+ base : 'uhyper' ,
58+ name : 'Hyperweb' ,
59+ display : 'hyper' ,
60+ symbol : 'HYPER' ,
61+ denomUnits : [
62+ {
63+ denom : 'uhyper' ,
64+ exponent : 0 ,
65+ } ,
66+ {
67+ denom : 'hyper' ,
68+ exponent : 6 ,
69+ } ,
70+ ] ,
71+ logoURIs : {
72+ png : '' ,
73+ svg : '' ,
74+ } ,
75+ typeAsset : 'sdk.coin' ,
76+ } as unknown as Asset ;
77+ }
78+
79+ return asset as Asset ;
5380 } ;
5481
5582 const denomToSymbol = ( denom : CoinDenom ) : CoinSymbol => {
@@ -77,8 +104,15 @@ export const useChainUtils = (chainName: string) => {
77104 } ;
78105
79106 const getExponentByDenom = ( denom : CoinDenom ) : Exponent => {
107+ // Special handling for hyperweb native token
108+ if ( denom === 'uhyper' ) {
109+ return 6 ;
110+ }
111+
80112 const asset = getAssetByDenom ( denom ) ;
81- const unit = asset ?. denomUnits . find ( ( { denom } ) => denom === asset . display ) ;
113+ const unit = asset ?. denomUnits ?. find (
114+ ( { denom } ) => denom === asset . display
115+ ) ;
82116 return unit ?. exponent || 0 ;
83117 } ;
84118
@@ -98,6 +132,11 @@ export const useChainUtils = (chainName: string) => {
98132 } ;
99133
100134 const getChainName = ( ibcDenom : CoinDenom ) => {
135+ // Special handling for hyperweb native token
136+ if ( ibcDenom === 'uhyper' && chainName === 'hyperweb' ) {
137+ return chainName ;
138+ }
139+
101140 if ( nativeAssets . find ( ( asset ) => asset . base === ibcDenom ) ) {
102141 return chainName ;
103142 }
@@ -109,8 +148,13 @@ export const useChainUtils = (chainName: string) => {
109148 } ;
110149
111150 const getPrettyChainName = ( ibcDenom : CoinDenom ) => {
112- const chainName = getChainName ( ibcDenom ) ;
113- const chain = chains . find ( ( chain ) => chain . chainName === chainName ) ;
151+ // Special handling for hyperweb native token
152+ if ( ibcDenom === 'uhyper' && chainName === 'hyperweb' ) {
153+ return 'Hyperweb Devnet' ;
154+ }
155+
156+ const resolvedChainName = getChainName ( ibcDenom ) ;
157+ const chain = chains . find ( ( chain ) => chain . chainName === resolvedChainName ) ;
114158 if ( ! chain ) throw Error ( 'chain not found' ) ;
115159 return chain . prettyName ;
116160 } ;
0 commit comments