@metamask/multichain-account-service
Version:
Service to manage multichain accounts
39 lines • 2.07 kB
text/typescript
import { type AccountProvider, type Bip44Account } from "@metamask/account-api";
import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
import type { KeyringMetadata, KeyringSelector } from "@metamask/keyring-controller";
import type { MultichainAccountServiceMessenger } from "../types.mjs";
/**
* Asserts a keyring account is BIP-44 compatible.
*
* @param account - Keyring account to check.
* @throws If the keyring account is not compatible.
*/
export declare function assertIsBip44Account(account: KeyringAccount): asserts account is Bip44Account<KeyringAccount>;
/**
* Asserts that a list of keyring accounts are all BIP-44 compatible.
*
* @param accounts - Keyring accounts to check.
* @throws If any of the keyring account is not compatible.
*/
export declare function assertAreBip44Accounts(accounts: KeyringAccount[]): asserts accounts is Bip44Account<KeyringAccount>[];
export declare abstract class BaseAccountProvider implements AccountProvider<Bip44Account<KeyringAccount>> {
#private;
protected readonly messenger: MultichainAccountServiceMessenger;
constructor(messenger: MultichainAccountServiceMessenger);
getAccounts(): Bip44Account<KeyringAccount>[];
getAccount(id: Bip44Account<KeyringAccount>['id']): Bip44Account<KeyringAccount>;
protected withKeyring<SelectedKeyring, CallbackResult = void>(selector: KeyringSelector, operation: ({ keyring, metadata, }: {
keyring: SelectedKeyring;
metadata: KeyringMetadata;
}) => Promise<CallbackResult>): Promise<CallbackResult>;
abstract isAccountCompatible(account: Bip44Account<KeyringAccount>): boolean;
abstract createAccounts({ entropySource, groupIndex, }: {
entropySource: EntropySourceId;
groupIndex: number;
}): Promise<Bip44Account<KeyringAccount>[]>;
abstract discoverAndCreateAccounts({ entropySource, groupIndex, }: {
entropySource: EntropySourceId;
groupIndex: number;
}): Promise<Bip44Account<KeyringAccount>[]>;
}
//# sourceMappingURL=BaseAccountProvider.d.mts.map