diff --git a/mobile.go b/mobile.go index 52f7f0b..8bdb84b 100644 --- a/mobile.go +++ b/mobile.go @@ -1,6 +1,9 @@ package panthalassa -import "errors" +import ( + "errors" + "github.com/Bit-Nation/panthalassa/keyManager" +) var p *panthalassa @@ -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 {