@@ -7,7 +7,7 @@ import type {
7
7
Thunk ,
8
8
AccountKeys ,
9
9
AccountState ,
10
- SpendingPassword
10
+ UnlockWalletPassword
11
11
} from '../reducers/types' ;
12
12
import type {
13
13
Amount ,
@@ -39,40 +39,40 @@ import {
39
39
import routes from '../constants/routes.json' ;
40
40
41
41
export type SetKeysAction = { type : 'SET_KEYS' } & AccountKeys ;
42
- export type SetKeysWithSpendingPasswordAction = {
43
- type : 'SET_SPENDING_PASSWORD '
44
- } & SpendingPassword ;
42
+ export type SetKeysWithUnlockWalletPasswordAction = {
43
+ type : 'SET_UNLOCK_WALLET_PASSWORD '
44
+ } & UnlockWalletPassword ;
45
45
export const SET_KEYS = 'SET_KEYS' ;
46
- export const SET_SPENDING_PASSWORD = 'SET_SPENDING_PASSWORD ' ;
46
+ export const SET_UNLOCK_WALLET_PASSWORD = 'SET_UNLOCK_WALLET_PASSWORD ' ;
47
47
48
48
export function setAccount (
49
49
privateKey : string ,
50
- spendingPassword : ?string
50
+ unlockWalletPassword : ?string
51
51
) : Thunk < SetKeysAction > {
52
52
return function setAccountThunk ( dispatch ) {
53
53
return getAccountFromPrivateKey ( privateKey ) . then ( keys =>
54
- curry ( initializeKeysAndRedirect ) ( dispatch , keys , spendingPassword )
54
+ curry ( initializeKeysAndRedirect ) ( dispatch , keys , unlockWalletPassword )
55
55
) ;
56
56
} ;
57
57
}
58
58
59
59
export function setKeysWithUnlockWalletPassword (
60
- spendingPassword : ?string = ''
60
+ unlockWalletPassword : ?string = ''
61
61
) : Thunk < SetKeysAction > {
62
62
return function setKeysWithUnlockWalletPasswordThunk ( dispatch ) {
63
- const accountKeys = readEncryptedAccountInfo ( spendingPassword ) ;
63
+ const accountKeys = readEncryptedAccountInfo ( unlockWalletPassword ) ;
64
64
if ( accountKeys ) {
65
- const spendingPasswordKeys = {
65
+ const unlockWalletPasswordKeys = {
66
66
walletId : 'wallet01' ,
67
- spendingPassword
67
+ unlockWalletPassword
68
68
} ;
69
69
dispatch ( {
70
- type : SET_SPENDING_PASSWORD ,
71
- ...spendingPasswordKeys
70
+ type : SET_UNLOCK_WALLET_PASSWORD ,
71
+ ...unlockWalletPasswordKeys
72
72
} ) ;
73
73
74
74
return getAccountFromPrivateKey ( accountKeys . privateKey ) . then ( keys =>
75
- curry ( initializeKeysAndRedirect ) ( dispatch , keys , spendingPassword )
75
+ curry ( initializeKeysAndRedirect ) ( dispatch , keys , unlockWalletPassword )
76
76
) ;
77
77
}
78
78
throw new Error ( 'Invalid password' ) ;
@@ -113,14 +113,14 @@ export function setAccountFromPrivateKey(
113
113
const initializeKeysAndRedirect = (
114
114
dispatch : Dispatch ,
115
115
keys : AccountKeys ,
116
- spendingPassword : ?string = ''
116
+ unlockWalletPassword : ?string = ''
117
117
) => {
118
118
dispatch ( {
119
119
type : SET_KEYS ,
120
120
...keys
121
121
} ) ;
122
122
123
- saveEncryptedAccountInfo ( spendingPassword , keys ) ;
123
+ saveEncryptedAccountInfo ( unlockWalletPassword , keys ) ;
124
124
125
125
return Promise . all ( [
126
126
dispatch ( updateAccountTransactions ( ) ) ,
@@ -137,13 +137,13 @@ const initializeKeysAndRedirect = (
137
137
export function setAccountFromMnemonic (
138
138
mnemonicPhrase : string ,
139
139
mnemonicPassword : string ,
140
- spendingPassword : ?string
140
+ unlockWalletPassword : ?string
141
141
) : Thunk < SetKeysAction > {
142
142
if ( isValidMnemonic ( mnemonicPhrase ) ) {
143
143
const seed = createSeedFromMnemonic ( mnemonicPhrase , mnemonicPassword ) ;
144
144
return function setAccountThunk ( dispatch ) {
145
145
return getAccountFromSeed ( seed ) . then ( keys =>
146
- curry ( initializeKeysAndRedirect ) ( dispatch , keys , spendingPassword )
146
+ curry ( initializeKeysAndRedirect ) ( dispatch , keys , unlockWalletPassword )
147
147
) ;
148
148
} ;
149
149
}
0 commit comments