@metamask/multichain-account-service
Version:
Service to manage multichain accounts
51 lines • 2.08 kB
text/typescript
/// <reference types="jest" />
import type { KeyringAccount } from "@metamask/keyring-api";
import type { KeyringCapabilities } from "@metamask/keyring-api/v2";
import { GroupIndexRange } from "../utils.mjs";
export type MockAccountProvider = {
mockAccounts: KeyringAccount[];
accounts: Set<KeyringAccount['id']>;
capabilities: KeyringCapabilities;
constructor: jest.Mock;
alignAccounts: jest.Mock;
init: jest.Mock;
resyncAccounts: jest.Mock;
getAccount: jest.Mock;
getAccounts: jest.Mock;
createAccounts: jest.Mock;
deleteAccount: jest.Mock;
discoverAccounts: jest.Mock;
isAccountCompatible: jest.Mock;
isAligned: jest.Mock;
getName: jest.Mock;
isEnabled: boolean;
isDisabled: jest.Mock;
setEnabled: jest.Mock;
};
export declare function makeMockAccountProvider(accounts?: KeyringAccount[]): MockAccountProvider;
export declare function setupBip44AccountProvider({ name, accounts, mocks, index, }: {
name?: string;
mocks?: MockAccountProvider;
accounts: KeyringAccount[];
filter?: (account: KeyringAccount) => boolean;
index?: number;
}): MockAccountProvider;
/**
* Helper to mock a single createAccounts call while updating the provider's
* internal state so subsequent getAccount/getAccounts can resolve the accounts.
*
* @param provider - The mock provider whose createAccounts call to mock.
* @param created - The accounts to be returned and persisted in the mock state.
*/
export declare function mockCreateAccountsOnce(provider: MockAccountProvider, created: KeyringAccount[]): void;
/**
* Helper to convert a group index range to an array of group indices, inclusive of the
* start and end indices.
*
* @param range - The range.
* @param range.from - The starting index of the range (inclusive).
* @param range.to - The ending index of the range (inclusive).
* @returns An array of group indices from `from` to `to`, inclusive.
*/
export declare function toGroupIndexRangeArray({ from, to, }: GroupIndexRange): number[];
//# sourceMappingURL=providers.d.mts.map