@metamask/account-api
Version:
MetaMask Account API
23 lines • 738 B
JavaScript
/**
* Checks if an account is BIP-44 compatible.
*
* @param account - The account to be tested.
* @returns True if the account is BIP-44 compatible.
*/
export 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.
*/
export function assertIsBip44Account(account) {
if (!isBip44Account(account)) {
throw new Error('Account is not BIP-44 compatible');
}
}
//# sourceMappingURL=bip44.mjs.map