|
5 | 5 |
|
6 | 6 | import { observe, when } from 'mobx'; |
7 | 7 | import { toBuffer, parseSat, checkHttpStatus, nap, poll } from '../helper'; |
8 | | -import { MIN_PASSWORD_LENGTH, NOTIFICATION_DELAY, RATE_DELAY } from '../config'; |
| 8 | +import { |
| 9 | + MIN_PASSWORD_LENGTH, |
| 10 | + NOTIFICATION_DELAY, |
| 11 | + RATE_DELAY, |
| 12 | + RECOVERY_WINDOW, |
| 13 | +} from '../config'; |
9 | 14 | import * as log from './log'; |
10 | 15 |
|
11 | 16 | class WalletAction { |
@@ -181,21 +186,28 @@ class WalletAction { |
181 | 186 | * screen. |
182 | 187 | * @param {string} options.walletPassword The user chosen password |
183 | 188 | * @param {Array} options.seedMnemonic The seed words to generate the wallet |
| 189 | + * @param {number} options.recoveryWindow The number of addresses to recover |
184 | 190 | * @return {Promise<undefined>} |
185 | 191 | */ |
186 | | - async initWallet({ walletPassword, seedMnemonic }) { |
| 192 | + async initWallet({ walletPassword, seedMnemonic, recoveryWindow = 0 }) { |
187 | 193 | try { |
188 | 194 | await this._grpc.sendUnlockerCommand('InitWallet', { |
189 | 195 | wallet_password: toBuffer(walletPassword), |
190 | 196 | cipher_seed_mnemonic: seedMnemonic, |
| 197 | + recovery_window: recoveryWindow, |
191 | 198 | }); |
192 | 199 | this._store.walletUnlocked = true; |
193 | 200 | this._nav.goSeedSuccess(); |
194 | 201 | } catch (err) { |
195 | | - this._notification.display({ msg: 'Initializing wallet failed', err }); |
| 202 | + this._notification.display({ |
| 203 | + type: 'error', |
| 204 | + msg: `Initializing wallet failed: ${err.details}`, |
| 205 | + }); |
196 | 206 | } |
197 | 207 | } |
198 | 208 |
|
| 209 | + } |
| 210 | + |
199 | 211 | /** |
200 | 212 | * Check the password input by the user by attempting to unlock the wallet. |
201 | 213 | * @return {Promise<undefined>} |
|
0 commit comments