This repository was archived by the owner on Feb 23, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,16 @@ class WalletAction {
4646 this . _store . wallet . seedVerify [ index ] = word ;
4747 }
4848
49+ /**
50+ * Set the restore seed input by the seed word and
51+ * seed index.
52+ * @param {string } options.word The seed word
53+ * @param {number } options.index The seed index
54+ */
55+ setRestoreSeed ( { word, index } ) {
56+ this . _store . wallet . restoreSeed [ index ] = word ;
57+ }
58+
4959 //
5060 // Wallet Password actions
5161 //
@@ -87,6 +97,14 @@ class WalletAction {
8797 this . _store . wallet . passwordVerify = password ;
8898 }
8999
100+ /**
101+ * Set whether or not we're restoring the wallet.
102+ * @param {boolean } options.restoring Whether or not we're restoring.
103+ */
104+ setRestoringWallet ( { restoring } ) {
105+ this . _store . wallet . restoring = restoring ;
106+ }
107+
90108 //
91109 // Wallet actions
92110 //
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ export class Store {
4040 password : '' ,
4141 passwordVerify : '' ,
4242 seedVerify : [ '' , '' , '' ] ,
43+ restoring : false ,
44+ restoreSeed : Array ( 24 ) . fill ( '' ) ,
4345 } ,
4446 transactions : [ ] ,
4547 selectedTransaction : null ,
Original file line number Diff line number Diff line change @@ -87,6 +87,13 @@ describe('Action Wallet Unit Tests', () => {
8787 } ) ;
8888 } ) ;
8989
90+ describe ( 'setRestoringWallet()' , ( ) => {
91+ it ( 'should clear attributes' , ( ) => {
92+ wallet . setRestoringWallet ( { restoring : true } ) ;
93+ expect ( store . wallet . restoring , 'to equal' , true ) ;
94+ } ) ;
95+ } ) ;
96+
9097 describe ( 'init()' , ( ) => {
9198 it ( 'should generate seed and navigate to onboarding' , async ( ) => {
9299 grpc . sendUnlockerCommand . withArgs ( 'GenSeed' ) . resolves ( {
@@ -228,6 +235,14 @@ describe('Action Wallet Unit Tests', () => {
228235 } ) ;
229236 } ) ;
230237
238+
239+ describe ( 'setRestoreSeed()' , ( ) => {
240+ it ( 'should clear attributes' , ( ) => {
241+ wallet . setRestoreSeed ( { word : 'foo' , index : 1 } ) ;
242+ expect ( store . wallet . restoreSeed [ 1 ] , 'to equal' , 'foo' ) ;
243+ } ) ;
244+ } ) ;
245+
231246 describe ( 'initInitialDeposit()' , ( ) => {
232247 it ( 'should navigate to new address screen if address is non-null' , ( ) => {
233248 store . walletAddress = 'non-null-addr' ;
You can’t perform that action at this time.
0 commit comments