@@ -12,7 +12,6 @@ import { useAtom, useAtomValue } from "jotai";
1212import { createPenumbraClient } from "@penumbra-zone/client" ;
1313import { ViewService } from "@penumbra-zone/protobuf" ;
1414import { bech32mAddress } from "@penumbra-zone/bech32m/penumbra" ;
15- import { TransparentAddressRequest } from "@penumbra-zone/protobuf/penumbra/view/v1/view_pb" ;
1615import { Chain , ChainType } from "@skip-go/client" ;
1716import {
1817 getCosmosWalletInfo ,
@@ -285,37 +284,25 @@ const handlePenumbraNetwork = (
285284 throw new Error ( "Prax wallet is not supported" ) ;
286285 } ,
287286 getAddress : async ( { praxWallet } ) => {
288- const penumbraWalletIndex = praxWallet ?. index ;
289- const sourceChainID = praxWallet ?. sourceChainID ;
287+ const penumbraSubaccountIndex = praxWallet ?. index ;
290288 const prax_id = "lkpmkhpnhknhmibgnmmhdhgdilepfghe" ;
291289 const prax_origin = `chrome-extension://${ prax_id } ` ;
292290 const client = createPenumbraClient ( prax_origin ) ;
293291 try {
294292 await client . connect ( ) ;
295293 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.
311297 const ephemeralAddress = await viewService . ephemeralAddress ( {
312298 addressIndex : {
313- account : penumbraWalletIndex ? penumbraWalletIndex : 0 ,
299+ // This is the subaccount of the wallet.
300+ // Default is zero.
301+ account : penumbraSubaccountIndex ? penumbraSubaccountIndex : 0 ,
314302 } ,
315303 } ) ;
316304 if ( ! ephemeralAddress . address ) throw new Error ( "No address found" ) ;
317305 return { address : bech32mAddress ( ephemeralAddress . address ) } ;
318- }
319306 } catch ( error ) {
320307 console . error ( error ) ;
321308 throw error ;
0 commit comments