@@ -20,6 +20,7 @@ import { currentTimePlusTwoDaysRounded } from '../ibc-out';
20
20
import { EncodeObject } from '@cosmjs/proto-signing' ;
21
21
import { MsgTransfer } from 'osmo-query/ibc/applications/transfer/v1/tx' ;
22
22
import { parseRevisionNumberFromChainId } from './parse-revision-number-from-chain-id' ;
23
+ import { bech32ChainIds } from '../shared.ts' ;
23
24
24
25
export interface IbcInSlice {
25
26
selectedChain ?: ChainInfo ;
@@ -64,7 +65,7 @@ export const createIbcInSlice = (): SliceCreator<IbcInSlice> => (set, get) => {
64
65
address : undefined ,
65
66
setAddress : async ( ) => {
66
67
const { selectedChain, account } = get ( ) . ibcIn ;
67
- const penumbraAddress = await getPenumbraAddress ( account , selectedChain ?. chainName ) ;
68
+ const penumbraAddress = await getPenumbraAddress ( account , selectedChain ?. chainId ) ;
68
69
if ( penumbraAddress ) {
69
70
set ( state => {
70
71
state . ibcIn . address = penumbraAddress ;
@@ -132,25 +133,19 @@ const getExplorerPage = (txHash: string, chainId?: string) => {
132
133
return txPage . replace ( '${txHash}' , txHash ) ;
133
134
} ;
134
135
135
- /**
136
- * For Noble specifically we need to use a Bech32 encoding rather than Bech32m,
137
- * because Noble currently has a middleware that decodes as Bech32.
138
- * Noble plans to change this at some point in the future but until then we need
139
- * to use a special encoding just for Noble specifically.
140
- */
141
- const bech32Chains = [ 'noble' , 'nobletestnet' ] ;
142
- const getCompatibleBech32 = ( chainName : string , address : Address ) : string => {
143
- return bech32Chains . includes ( chainName ) ? bech32CompatAddress ( address ) : bech32mAddress ( address ) ;
136
+ const getCompatibleBech32 = ( chainId : string , address : Address ) : string => {
137
+ return bech32ChainIds . includes ( chainId ) ? bech32CompatAddress ( address ) : bech32mAddress ( address ) ;
144
138
} ;
139
+
145
140
export const getPenumbraAddress = async (
146
141
account : number ,
147
- chainName ?: string ,
142
+ chainId ?: string ,
148
143
) : Promise < string | undefined > => {
149
- if ( ! chainName ) {
144
+ if ( ! chainId ) {
150
145
return undefined ;
151
146
}
152
147
const receiverAddress = await getAddrByIndex ( account , true ) ;
153
- return getCompatibleBech32 ( chainName , receiverAddress ) ;
148
+ return getCompatibleBech32 ( chainId , receiverAddress ) ;
154
149
} ;
155
150
156
151
const estimateFee = async ( {
@@ -201,7 +196,7 @@ async function execute(
201
196
throw new Error ( 'Penumbra chain id could not be retrieved' ) ;
202
197
}
203
198
204
- const penumbraAddress = await getPenumbraAddress ( account , selectedChain . chainName ) ;
199
+ const penumbraAddress = await getPenumbraAddress ( account , selectedChain . chainId ) ;
205
200
if ( ! penumbraAddress ) {
206
201
throw new Error ( 'Penumbra address not available' ) ;
207
202
}
0 commit comments