From a358c8b276a4b225b899abb58d8372794095b905 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 20 Mar 2019 16:01:26 +0100 Subject: [PATCH] Fix keyring type determiniation (load) (#375) --- packages/keyring/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/keyring/src/index.ts b/packages/keyring/src/index.ts index 904904acf..819e0d26e 100644 --- a/packages/keyring/src/index.ts +++ b/packages/keyring/src/index.ts @@ -95,11 +95,11 @@ export default class Keyring implements KeyringInstance { * of an account backup), and then generates a keyring pair from it that it passes to * `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value. */ - addFromJson ({ address, encoded, encoding: { type, version }, meta }: KeyringPair$Json): KeyringPair { - const keytype = version === '0' || !Array.isArray(type) + addFromJson ({ address, encoded, encoding: { content, version }, meta }: KeyringPair$Json): KeyringPair { + const type = version === '0' || !Array.isArray(content) ? this.type - : type[1]; - return this.addFromAddress(address, meta, hexToU8a(encoded), keytype); + : content[1]; + return this.addFromAddress(address, meta, hexToU8a(encoded), type); } /**