@metamask/account-api
Version:
MetaMask Account API
27 lines • 895 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBip44Account = isBip44Account;
exports.assertIsBip44Account = assertIsBip44Account;
/**
* Checks if an account is BIP-44 compatible.
*
* @param account - The account to be tested.
* @returns True if the account is BIP-44 compatible.
*/
function isBip44Account(account) {
// To be BIP-44 compatible, we just check for the entropy type (the
// the `entropy` shape will be inferred automatically).
return account.options.entropy?.type === 'mnemonic';
}
/**
* Asserts a keyring account is BIP-44 compatible.
*
* @param account - Keyring account to check.
* @throws If the keyring account is not compatible.
*/
function assertIsBip44Account(account) {
if (!isBip44Account(account)) {
throw new Error('Account is not BIP-44 compatible');
}
}
//# sourceMappingURL=bip44.cjs.map
;