@metamask/multichain-account-service
Version:
Service to manage multichain accounts
306 lines • 10.6 kB
text/typescript
import type { Bip44Account } from "@metamask/account-api";
import type { DiscoveredAccount, EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
import { EthMethod } from "@metamask/keyring-api";
import { KeyringTypes } from "@metamask/keyring-controller";
import type { InternalAccount } from "@metamask/keyring-internal-api";
import type { SnapId } from "@metamask/snaps-sdk";
export declare const ETH_EOA_METHODS: readonly [EthMethod.PersonalSign, EthMethod.Sign, EthMethod.SignTransaction, EthMethod.SignTypedDataV1, EthMethod.SignTypedDataV3, EthMethod.SignTypedDataV4];
export declare const MOCK_SNAP_1: {
id: string;
name: string;
enabled: boolean;
manifest: {
proposedName: string;
};
};
export declare const MOCK_SNAP_2: {
id: string;
name: string;
enabled: boolean;
manifest: {
proposedName: string;
};
};
export declare const MOCK_ENTROPY_SOURCE_1 = "mock-keyring-id-1";
export declare const MOCK_ENTROPY_SOURCE_2 = "mock-keyring-id-2";
export declare const MOCK_MNEMONIC = "abandon ability able about above absent absorb abstract absurd abuse access accident";
export declare const MOCK_HD_KEYRING_1: {
type: KeyringTypes;
metadata: {
id: string;
name: string;
};
accounts: string[];
};
export declare const MOCK_HD_KEYRING_2: {
type: KeyringTypes;
metadata: {
id: string;
name: string;
};
accounts: string[];
};
/** Used when tests need ensureReady to resolve (SnapAccountService waits for Snap keyring). */
export declare const MOCK_SNAP_KEYRING: {
type: KeyringTypes;
metadata: {
id: string;
name: string;
};
accounts: never[];
};
export declare const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount>;
export declare const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount>;
export declare const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount>;
export declare const MOCK_XLM_ACCOUNT_1: Bip44Account<InternalAccount>;
export declare const MOCK_TRX_ACCOUNT_1: Bip44Account<InternalAccount>;
export declare const MOCK_SOL_DISCOVERED_ACCOUNT_1: DiscoveredAccount;
export declare const MOCK_TRX_DISCOVERED_ACCOUNT_1: DiscoveredAccount;
export declare const MOCK_XLM_DISCOVERED_ACCOUNT_1: DiscoveredAccount;
export declare const MOCK_BTC_P2TR_DISCOVERED_ACCOUNT_1: DiscoveredAccount;
export declare const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount>;
export declare const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount>;
export declare const MOCK_SNAP_ACCOUNT_1: Bip44Account<{
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
id: string;
options: Record<string, import("@metamask/snaps-sdk").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
} | {
type: "custom";
} | undefined;
exportable?: boolean | undefined;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
snap?: {
id: string;
} | undefined;
nameLastUpdatedAt?: number | undefined;
lastSelected?: number | undefined;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}>;
export declare const MOCK_SNAP_ACCOUNT_2: InternalAccount;
export declare const MOCK_SNAP_ACCOUNT_3: Bip44Account<{
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
id: string;
options: Record<string, import("@metamask/snaps-sdk").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
} | {
type: "custom";
} | undefined;
exportable?: boolean | undefined;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
snap?: {
id: string;
} | undefined;
nameLastUpdatedAt?: number | undefined;
lastSelected?: number | undefined;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}>;
export declare const MOCK_SNAP_ACCOUNT_4: Bip44Account<{
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
id: string;
options: Record<string, import("@metamask/snaps-sdk").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
} | {
type: "custom";
} | undefined;
exportable?: boolean | undefined;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
snap?: {
id: string;
} | undefined;
nameLastUpdatedAt?: number | undefined;
lastSelected?: number | undefined;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}>;
export declare const MOCK_HARDWARE_ACCOUNT_1: InternalAccount;
export declare function isInternalAccount(account: KeyringAccount): account is InternalAccount;
export declare function asKeyringAccount<Account extends KeyringAccount>(account: Account): KeyringAccount;
export declare class MockAccountBuilder<Account extends KeyringAccount> {
#private;
constructor(account: Account);
static from<Account extends KeyringAccount>(account: Account): MockAccountBuilder<Account>;
withId(id: InternalAccount['id']): this;
withUuid(): this;
withAddress(address: string): this;
withAddressSuffix(suffix: string): this;
withEntropySource(entropySource: EntropySourceId): this;
withGroupIndex(groupIndex: number): this;
withSnapId(snapId: SnapId): this;
get(): Account;
}
export declare const MOCK_WALLET_1_ENTROPY_SOURCE = "mock-keyring-id-1";
export declare const MOCK_WALLET_1_EVM_ACCOUNT: Bip44Account<{
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
id: string;
options: Record<string, import("@metamask/snaps-sdk").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
} | {
type: "custom";
} | undefined;
exportable?: boolean | undefined;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
snap?: {
id: string;
} | undefined;
nameLastUpdatedAt?: number | undefined;
lastSelected?: number | undefined;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}>;
export declare const MOCK_WALLET_1_SOL_ACCOUNT: Bip44Account<{
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
id: string;
options: Record<string, import("@metamask/snaps-sdk").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
} | {
type: "custom";
} | undefined;
exportable?: boolean | undefined;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
snap?: {
id: string;
} | undefined;
nameLastUpdatedAt?: number | undefined;
lastSelected?: number | undefined;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}>;
export declare const MOCK_WALLET_1_BTC_P2WPKH_ACCOUNT: Bip44Account<{
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
id: string;
options: Record<string, import("@metamask/snaps-sdk").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
} | {
type: "custom";
} | undefined;
exportable?: boolean | undefined;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
snap?: {
id: string;
} | undefined;
nameLastUpdatedAt?: number | undefined;
lastSelected?: number | undefined;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}>;
export declare const MOCK_WALLET_1_BTC_P2TR_ACCOUNT: Bip44Account<{
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
id: string;
options: Record<string, import("@metamask/snaps-sdk").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
} | {
type: "custom";
} | undefined;
exportable?: boolean | undefined;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
snap?: {
id: string;
} | undefined;
nameLastUpdatedAt?: number | undefined;
lastSelected?: number | undefined;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}>;
export declare function mockAsInternalAccount(account: KeyringAccount): InternalAccount;
//# sourceMappingURL=accounts.d.mts.map