Skip to content

Commit

Permalink
[recover] added method to start panthalassa from mnemonic
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Lenz committed May 2, 2018
1 parent db033cf commit 3f9c07e
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion mobile.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package panthalassa

import "errors"
import (
"errors"
"github.com/Bit-Nation/panthalassa/keyManager"
)

var p *panthalassa

Expand All @@ -22,6 +25,27 @@ func NewPanthalassa(accountStore, pw string) error {
return nil
}

//Open Panthalassa from account store and mnemonic
func NewPanthalassaFromMnemonic(accountStore, mnemonic string) error {

if p != nil {
return errors.New("you need to call Stop first in order to destroy the old instance")
}

km, err := keyManager.OpenWithMnemonic(accountStore, mnemonic)

if err != nil {
return err
}

p = &panthalassa{
km: km,
}

return nil

}

//Stop the current panthalassa instnace
func Stop() error {

Expand Down

0 comments on commit 3f9c07e

Please sign in to comment.