@@ -12,7 +12,6 @@ import { useAtom, useAtomValue } from "jotai";
12
12
import { createPenumbraClient } from "@penumbra-zone/client" ;
13
13
import { ViewService } from "@penumbra-zone/protobuf" ;
14
14
import { bech32mAddress } from "@penumbra-zone/bech32m/penumbra" ;
15
- import { TransparentAddressRequest } from "@penumbra-zone/protobuf/penumbra/view/v1/view_pb" ;
16
15
import { Chain , ChainType } from "@skip-go/client" ;
17
16
import {
18
17
getCosmosWalletInfo ,
@@ -285,37 +284,25 @@ const handlePenumbraNetwork = (
285
284
throw new Error ( "Prax wallet is not supported" ) ;
286
285
} ,
287
286
getAddress : async ( { praxWallet } ) => {
288
- const penumbraWalletIndex = praxWallet ?. index ;
289
- const sourceChainID = praxWallet ?. sourceChainID ;
287
+ const penumbraSubaccountIndex = praxWallet ?. index ;
290
288
const prax_id = "lkpmkhpnhknhmibgnmmhdhgdilepfghe" ;
291
289
const prax_origin = `chrome-extension://${ prax_id } ` ;
292
290
const client = createPenumbraClient ( prax_origin ) ;
293
291
try {
294
292
await client . connect ( ) ;
295
293
const viewService = client . service ( ViewService ) ;
296
- // To deposit into penumbra, we generate an ephemeral address
297
- // this is a randomized address that is generated for each deposit.
298
- //
299
- // Noble Mainnet is the exception to this rule.
300
- // If the chain is noble-1, we use a transparent address.
301
- // This means that the address is the same for all deposits.
302
- //
303
- // Note: once Noble upgrades their network, this special casing can be removed.
304
- // And all addresses can be ephemeral with bech32m encoding.
305
- if ( sourceChainID === "noble-1" ) {
306
- const address = await viewService . transparentAddress ( new TransparentAddressRequest ( { } ) ) ;
307
- if ( ! address . address ) throw new Error ( "No address found" ) ;
308
- // The view service did the work of encoding the address for us.
309
- return { address : address . encoding } ;
310
- } else {
294
+ // To deposit into penumbra, we generate an "ephemeral address",
295
+ // this is an address that is generated for each deposit,
296
+ // randomized each time, but tied to the same wallet.
311
297
const ephemeralAddress = await viewService . ephemeralAddress ( {
312
298
addressIndex : {
313
- account : penumbraWalletIndex ? penumbraWalletIndex : 0 ,
299
+ // This is the subaccount of the wallet.
300
+ // Default is zero.
301
+ account : penumbraSubaccountIndex ? penumbraSubaccountIndex : 0 ,
314
302
} ,
315
303
} ) ;
316
304
if ( ! ephemeralAddress . address ) throw new Error ( "No address found" ) ;
317
305
return { address : bech32mAddress ( ephemeralAddress . address ) } ;
318
- }
319
306
} catch ( error ) {
320
307
console . error ( error ) ;
321
308
throw error ;
0 commit comments