Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit ad92127

Browse files
Add recovery window const to config and initWallet.
1 parent 89564f0 commit ad92127

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/action/wallet.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55

66
import { observe, when } from 'mobx';
77
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';
914
import * as log from './log';
1015

1116
class WalletAction {
@@ -181,21 +186,28 @@ class WalletAction {
181186
* screen.
182187
* @param {string} options.walletPassword The user chosen password
183188
* @param {Array} options.seedMnemonic The seed words to generate the wallet
189+
* @param {number} options.recoveryWindow The number of addresses to recover
184190
* @return {Promise<undefined>}
185191
*/
186-
async initWallet({ walletPassword, seedMnemonic }) {
192+
async initWallet({ walletPassword, seedMnemonic, recoveryWindow = 0 }) {
187193
try {
188194
await this._grpc.sendUnlockerCommand('InitWallet', {
189195
wallet_password: toBuffer(walletPassword),
190196
cipher_seed_mnemonic: seedMnemonic,
197+
recovery_window: recoveryWindow,
191198
});
192199
this._store.walletUnlocked = true;
193200
this._nav.goSeedSuccess();
194201
} 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+
});
196206
}
197207
}
198208

209+
}
210+
199211
/**
200212
* Check the password input by the user by attempting to unlock the wallet.
201213
* @return {Promise<undefined>}

src/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports.PREFIX_URI = `${prefixName}:`;
1919
module.exports.DEFAULT_ROUTE = 'Welcome';
2020
module.exports.MIN_PASSWORD_LENGTH = 8;
2121
module.exports.MAX_LOG_LENGTH = 10000;
22+
module.exports.RECOVERY_WINDOW = 250;
2223

2324
module.exports.UNITS = {
2425
sat: { display: 'SAT', displayLong: 'Satoshi', denominator: 1 },

0 commit comments

Comments
 (0)