From f558b2ec48c00a2c6b6b6d85e01a0b80df16c5ab Mon Sep 17 00:00:00 2001 From: YJ Date: Wed, 17 Apr 2019 19:29:30 +0200 Subject: [PATCH] Restore Account from JSON with Appropriate crypto type (#117) * json restore with appropriate crypto type * check if array --- packages/ui-keyring/src/Keyring.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ui-keyring/src/Keyring.ts b/packages/ui-keyring/src/Keyring.ts index c88deac0..5c87add4 100644 --- a/packages/ui-keyring/src/Keyring.ts +++ b/packages/ui-keyring/src/Keyring.ts @@ -201,8 +201,9 @@ export class Keyring extends Base implements KeyringStruct { } restoreAccount (json: KeyringPair$Json, password: string): KeyringPair { + const type = Array.isArray(json.encoding.content) ? json.encoding.content[1] : 'ed25519'; const pair = createPair( - this.keyring.type, + type, { // FIXME Just for the transition period (ignoreChecksum) publicKey: this.decodeAddress(json.address, true)