diff --git a/packages/keyring-api/src/api/account-options.test.ts b/packages/keyring-api/src/api/account-options.test.ts index 1dd55686..b6c8f128 100644 --- a/packages/keyring-api/src/api/account-options.test.ts +++ b/packages/keyring-api/src/api/account-options.test.ts @@ -99,4 +99,27 @@ describe('api', () => { `At path: entropy.type -- Expected the literal \`"mnemonic"\`, but received: "${options.entropy.type}"`, ); }); + + it('throws if options.entropy.type is Hardware (not implemented)', () => { + const options = { + entropy: { type: KeyringAccountEntropyTypeOption.Hardware }, + }; + + expect(() => assert(options, KeyringAccountOptionsStruct)).toThrow( + `At path: entropy.type -- Expected the literal \`"mnemonic"\`, but received: "${KeyringAccountEntropyTypeOption.Hardware}"`, + ); + }); + + it('throws if options.entropy.type is Hardware with additional fields', () => { + const options = { + entropy: { + type: KeyringAccountEntropyTypeOption.Hardware, + deviceId: 'some-device-id', + }, + }; + + expect(() => assert(options, KeyringAccountOptionsStruct)).toThrow( + `At path: entropy.type -- Expected the literal \`"mnemonic"\`, but received: "${KeyringAccountEntropyTypeOption.Hardware}"`, + ); + }); }); diff --git a/packages/keyring-api/src/api/account-options.ts b/packages/keyring-api/src/api/account-options.ts index a8fbbeb2..cc9c0270 100644 --- a/packages/keyring-api/src/api/account-options.ts +++ b/packages/keyring-api/src/api/account-options.ts @@ -25,6 +25,11 @@ export enum KeyringAccountEntropyTypeOption { */ PrivateKey = 'private-key', + /** + * Indicates that the account was created from a hardware wallet. + */ + Hardware = 'hardware', + /** * Indicates that the account was created with custom, keyring-specific entropy. * This is an opaque type where the entropy source is managed internally by the keyring.