OSDN Git Service

Add the recovery api for the restore wallet by seed.
authorZhiting Lin <zlin035@uottawa.ca>
Wed, 7 Nov 2018 02:19:22 +0000 (10:19 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Wed, 7 Nov 2018 02:19:22 +0000 (10:19 +0800)
src/features/initialization/actions.js
src/sdk/api/backUp.js

index b7df25d..803ba41 100644 (file)
@@ -86,8 +86,21 @@ const restoreMnemonic = (data, success) => {
       .then((resp) => {
         if (resp.status === 'fail') {
           throw resp
+        }else{
+          return chainClient().backUp.recovery({
+            xpub: resp.data.xpub
+          })
+            .then((resp) => {
+              if (resp.status === 'fail') {
+                throw resp
+              }
+
+              dispatch(success)
+            })
+            .catch((err) => {
+              throw err
+            })
         }
-        dispatch(success)
       })
       .catch((err) => {
         throw err
index ab44aab..16a60ee 100644 (file)
@@ -12,6 +12,11 @@ const backUp = (client) => {
       cb
     ),
 
+    recovery: (opts = {}, cb) => shared.tryCallback(
+      client.request('/recovery-wallet', opts),
+      cb
+    ),
+
     rescan: (cb) => shared.tryCallback(
       client.request('/rescan-wallet'),
       cb