@@ -61,24 +61,27 @@ export const SharedWallet = (): JSX.Element => {
61
61
if ( isSharedWallet ) setBackgroundPage ( ) ;
62
62
} , [ isSharedWallet , setBackgroundPage ] ) ;
63
63
64
- const handleCreateWallet = async ( data : CreateWalletParams ) => {
65
- const activeWalletId = cardanoWallet . source . wallet . walletId ;
64
+ const handleCreateWallet = useCallback (
65
+ async ( data : CreateWalletParams ) => {
66
+ const activeWalletId = cardanoWallet . source . wallet . walletId ;
66
67
67
- try {
68
- await createInMemorySharedWallet ( {
69
- name : data . name ,
70
- chainId : Wallet . Cardano . ChainIds [ environmentName ] ,
71
- ownSignerWalletId : activeWalletId ,
72
- quorumRules : data . quorumRules ,
73
- coSigners : data . coSigners
74
- } ) ;
75
- } catch ( error : unknown ) {
76
- if ( error instanceof WalletConflictError ) {
77
- setIsWalletConflictModalVisible ( true ) ;
68
+ try {
69
+ await createInMemorySharedWallet ( {
70
+ name : data . name ,
71
+ chainId : Wallet . Cardano . ChainIds [ environmentName ] ,
72
+ ownSignerWalletId : activeWalletId ,
73
+ quorumRules : data . quorumRules ,
74
+ coSigners : data . coSigners
75
+ } ) ;
76
+ } catch ( error : unknown ) {
77
+ if ( error instanceof WalletConflictError ) {
78
+ setIsWalletConflictModalVisible ( true ) ;
79
+ }
80
+ throw error ;
78
81
}
79
- throw error ;
80
- }
81
- } ;
82
+ } ,
83
+ [ cardanoWallet . source . wallet . walletId , environmentName , createInMemorySharedWallet ]
84
+ ) ;
82
85
83
86
const generateKey = useCallback (
84
87
async ( enteredPassword ?: string ) => {
@@ -97,6 +100,7 @@ export const SharedWallet = (): JSX.Element => {
97
100
) ;
98
101
99
102
const navigateToRoot = useCallback ( ( ) => history . push ( walletRoutePaths . sharedWallet . root ) , [ history ] ) ;
103
+ const navigateToAppHome = useCallback ( ( ) => setBackgroundPage ( ) , [ setBackgroundPage ] ) ;
100
104
101
105
return (
102
106
< >
@@ -131,7 +135,7 @@ export const SharedWallet = (): JSX.Element => {
131
135
walletKind = { isHardwareWallet ? 'cold' : 'hot' }
132
136
activeWalletName = { walletInfo ?. name || '' }
133
137
initialWalletName = { initialWalletName }
134
- navigateToAppHome = { ( ) => setBackgroundPage ( ) }
138
+ navigateToAppHome = { navigateToAppHome }
135
139
exitTheFlow = { navigateToRoot }
136
140
sharedWalletKey = { sharedWalletKey }
137
141
onCreateSharedWallet = { handleCreateWallet }
@@ -174,7 +178,7 @@ export const SharedWallet = (): JSX.Element => {
174
178
} }
175
179
sharedKeys = { sharedWalletKey }
176
180
exitTheFlow = { navigateToRoot }
177
- navigateToAppHome = { ( ) => setBackgroundPage ( ) }
181
+ navigateToAppHome = { navigateToAppHome }
178
182
onImportJsonError = { async ( ) =>
179
183
await analytics . sendEventToPostHog ( PostHogAction . SharedWalletsLocateWalletImportJsonError )
180
184
}
0 commit comments