@@ -6,14 +6,13 @@ import {
6
6
import { Mina } from '@palladxyz/mina-core'
7
7
import { getSessionPersistence } from '@palladxyz/persistence'
8
8
import { Button , cn , Input , Label } from '@palladxyz/ui'
9
- import { useKeyAgentStore } from '@palladxyz/vault'
9
+ import { KeyAgents , useVault } from '@palladxyz/vault'
10
10
import { useMemo , useState } from 'react'
11
11
import { useForm } from 'react-hook-form'
12
12
import { useNavigate } from 'react-router-dom'
13
13
14
14
import { WizardLayout } from '../../common/components'
15
15
import { ViewHeading } from '../../common/components/ViewHeading'
16
- import { useWalletUi } from '../../common/hooks/useWalletUi'
17
16
import { useAppStore } from '../../common/store/app'
18
17
import { useOnboardingStore } from '../../common/store/onboarding'
19
18
@@ -22,7 +21,7 @@ const getConfirmationIndex = () => {
22
21
}
23
22
24
23
export const MnemonicConfirmationView = ( ) => {
25
- const { restoreWallet } = useWalletUi ( )
24
+ const restoreWallet = useVault ( ( state ) => state . restoreWallet )
26
25
const [ confirmationIndex ] = useState ( getConfirmationIndex ( ) )
27
26
const setVaultStateInitialized = useAppStore (
28
27
( state ) => state . setVaultStateInitialized
@@ -51,8 +50,7 @@ export const MnemonicConfirmationView = () => {
51
50
if ( ! spendingPassword ) return
52
51
if ( ! mnemonic ) return
53
52
getSessionPersistence ( ) . setItem ( 'spendingPassword' , spendingPassword )
54
- useKeyAgentStore . destroy ( )
55
- useKeyAgentStore . persist . rehydrate ( )
53
+ await useVault . persist . rehydrate ( )
56
54
// TODO: Add await in UI when user clicks restore wallet
57
55
const restoreArgs : MinaSpecificArgs = {
58
56
network : Network . Mina ,
@@ -63,12 +61,14 @@ export const MnemonicConfirmationView = () => {
63
61
await restoreWallet (
64
62
new MinaPayload ( ) ,
65
63
restoreArgs ,
66
- Mina . Networks . MAINNET ,
64
+ Mina . Networks . DEVNET ,
67
65
{
68
66
mnemonicWords : mnemonic . split ( ' ' ) ,
69
67
getPassphrase : async ( ) => Buffer . from ( spendingPassword )
70
68
} ,
71
- walletName //this is the keyAgentName
69
+ walletName ,
70
+ KeyAgents . InMemory ,
71
+ 'Test'
72
72
)
73
73
setVaultStateInitialized ( )
74
74
return navigate ( '/onboarding/finish' )
0 commit comments