@metamask/multichain-account-service
Version:
Service to manage multichain accounts
101 lines • 3.85 kB
text/typescript
import { AccountWalletType } from "@metamask/account-api";
import type { Bip44Account, MultichainAccountWalletId, MultichainAccountWallet as MultichainAccountWalletDefinition } from "@metamask/account-api";
import type { AccountGroupId } from "@metamask/account-api";
import type { AccountProvider } from "@metamask/account-api";
import { type EntropySourceId, type KeyringAccount } from "@metamask/keyring-api";
import { MultichainAccountGroup } from "./MultichainAccountGroup.cjs";
/**
* A multichain account wallet that holds multiple multichain accounts (one multichain account per
* group index).
*/
export declare class MultichainAccountWallet<Account extends Bip44Account<KeyringAccount>> implements MultichainAccountWalletDefinition<Account> {
#private;
constructor({ providers, entropySource, }: {
providers: AccountProvider<Account>[];
entropySource: EntropySourceId;
});
/**
* Force wallet synchronization.
*
* This can be used if account providers got new accounts that the wallet
* doesn't know about.
*/
sync(): void;
/**
* Gets the multichain account wallet ID.
*
* @returns The multichain account wallet ID.
*/
get id(): MultichainAccountWalletId;
/**
* Gets the multichain account wallet type, which is always {@link AccountWalletType.Entropy}.
*
* @returns The multichain account wallet type.
*/
get type(): AccountWalletType.Entropy;
/**
* Gets the multichain account wallet entropy source.
*
* @returns The multichain account wallet entropy source.
*/
get entropySource(): EntropySourceId;
/**
* Gets multichain account for a given ID.
* The default group ID will default to the multichain account with index 0.
*
* @param id - Account group ID.
* @returns Account group.
*/
getAccountGroup(id: AccountGroupId): MultichainAccountGroup<Account> | undefined;
/**
* Gets all multichain accounts. Similar to {@link MultichainAccountWallet.getMultichainAccountGroups}.
*
* @returns The multichain accounts.
*/
getAccountGroups(): MultichainAccountGroup<Account>[];
/**
* Gets multichain account group for a given index.
*
* @param groupIndex - Multichain account index.
* @returns The multichain account associated with the given index.
*/
getMultichainAccountGroup(groupIndex: number): MultichainAccountGroup<Account> | undefined;
/**
* Gets all multichain account groups.
*
* @returns The multichain accounts.
*/
getMultichainAccountGroups(): MultichainAccountGroup<Account>[];
/**
* Gets next group index for this wallet.
*
* @returns The next group index of this wallet.
*/
getNextGroupIndex(): number;
/**
* Creates a multichain account group for a given group index.
*
* @param groupIndex - The group index to use.
* @throws If any of the account providers fails to create their accounts.
* @returns The multichain account group for this group index.
*/
createMultichainAccountGroup(groupIndex: number): Promise<MultichainAccountGroup<Account>>;
/**
* Creates the next multichain account group.
*
* @throws If any of the account providers fails to create their accounts.
* @returns The multichain account group for the next group index available.
*/
createNextMultichainAccountGroup(): Promise<MultichainAccountGroup<Account>>;
/**
* Align all multichain account groups.
*/
alignGroups(): Promise<void>;
/**
* Align a specific multichain account group.
*
* @param groupIndex - The group index to align.
*/
alignGroup(groupIndex: number): Promise<void>;
}
//# sourceMappingURL=MultichainAccountWallet.d.cts.map