@metamask/keyring-internal-api
Version:
MetaMask Keyring Internal API
765 lines • 27.2 kB
text/typescript
import { BtcAccountType, EthAccountType, SolAccountType } from "@metamask/keyring-api";
import type { Infer, Struct } from "@metamask/superstruct";
export type InternalAccountType = EthAccountType | BtcAccountType | SolAccountType;
export declare const InternalAccountMetadataStruct: Struct<{
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
}>;
export declare const InternalEthEoaAccountStruct: Struct<{
type: "eip155:eoa";
id: string;
options: Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
address: string;
scopes: import("@metamask/keyring-api").EthScope.Eoa[];
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
address: import("@metamask/superstruct").Struct<string, null>;
type: import("@metamask/superstruct").Struct<"eip155:eoa", "eip155:eoa">;
scopes: import("@metamask/superstruct").Struct<import("@metamask/keyring-api").EthScope.Eoa[], import("@metamask/superstruct").Struct<import("@metamask/keyring-api").EthScope.Eoa, import("@metamask/keyring-api").EthScope.Eoa>>;
methods: import("@metamask/superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("@metamask/superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTransaction: "eth_signTransaction";
eth_signTypedData_v1: "eth_signTypedData_v1";
eth_signTypedData_v3: "eth_signTypedData_v3";
eth_signTypedData_v4: "eth_signTypedData_v4";
}>>;
id: import("@metamask/superstruct").Struct<string, null>;
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
}, null>;
}>;
export declare const InternalEthErc4337AccountStruct: Struct<{
type: "eip155:erc4337";
id: string;
options: Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
address: string;
scopes: `${string}:${string}`[];
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
address: import("@metamask/superstruct").Struct<string, null>;
type: import("@metamask/superstruct").Struct<"eip155:erc4337", "eip155:erc4337">;
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
methods: import("@metamask/superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[], import("@metamask/superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation", {
personal_sign: "personal_sign";
eth_sign: "eth_sign";
eth_signTypedData_v1: "eth_signTypedData_v1";
eth_signTypedData_v3: "eth_signTypedData_v3";
eth_signTypedData_v4: "eth_signTypedData_v4";
eth_prepareUserOperation: "eth_prepareUserOperation";
eth_patchUserOperation: "eth_patchUserOperation";
eth_signUserOperation: "eth_signUserOperation";
}>>;
id: import("@metamask/superstruct").Struct<string, null>;
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
}, null>;
}>;
export declare const InternalBtcP2pkhAccountStruct: Struct<{
type: "bip122:p2pkh";
id: string;
options: Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
address: string;
scopes: `${string}:${string}`[];
methods: "sendBitcoin"[];
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
address: import("@metamask/superstruct").Struct<string, null>;
type: import("@metamask/superstruct").Struct<"bip122:p2pkh", "bip122:p2pkh">;
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
sendBitcoin: "sendBitcoin";
}>>;
id: import("@metamask/superstruct").Struct<string, null>;
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
}, null>;
}>;
export declare const InternalBtcP2shAccountStruct: Struct<{
type: "bip122:p2sh";
id: string;
options: Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
address: string;
scopes: `${string}:${string}`[];
methods: "sendBitcoin"[];
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
address: import("@metamask/superstruct").Struct<string, null>;
type: import("@metamask/superstruct").Struct<"bip122:p2sh", "bip122:p2sh">;
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
sendBitcoin: "sendBitcoin";
}>>;
id: import("@metamask/superstruct").Struct<string, null>;
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
}, null>;
}>;
export declare const InternalBtcP2wpkhAccountStruct: Struct<{
type: "bip122:p2wpkh";
id: string;
options: Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
address: string;
scopes: `${string}:${string}`[];
methods: "sendBitcoin"[];
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
address: import("@metamask/superstruct").Struct<string, null>;
type: import("@metamask/superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
sendBitcoin: "sendBitcoin";
}>>;
id: import("@metamask/superstruct").Struct<string, null>;
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
}, null>;
}>;
export declare const InternalBtcP2trAccountStruct: Struct<{
type: "bip122:p2tr";
id: string;
options: Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
address: string;
scopes: `${string}:${string}`[];
methods: "sendBitcoin"[];
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
address: import("@metamask/superstruct").Struct<string, null>;
type: import("@metamask/superstruct").Struct<"bip122:p2tr", "bip122:p2tr">;
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
sendBitcoin: "sendBitcoin";
}>>;
id: import("@metamask/superstruct").Struct<string, null>;
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
}, null>;
}>;
export declare const InternalSolDataAccountStruct: Struct<{
type: "solana:data-account";
id: string;
options: Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
address: string;
scopes: `${string}:${string}`[];
methods: import("@metamask/keyring-api").SolMethod[];
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
address: import("@metamask/superstruct").Struct<string, null>;
type: import("@metamask/superstruct").Struct<"solana:data-account", "solana:data-account">;
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
methods: import("@metamask/superstruct").Struct<import("@metamask/keyring-api").SolMethod[], import("@metamask/superstruct").Struct<import("@metamask/keyring-api").SolMethod, {
sendAndConfirmTransaction: import("@metamask/keyring-api").SolMethod.SendAndConfirmTransaction;
signAndSendTransaction: import("@metamask/keyring-api").SolMethod.SignAndSendTransaction;
signTransaction: import("@metamask/keyring-api").SolMethod.SignTransaction;
signMessage: import("@metamask/keyring-api").SolMethod.SignMessage;
signIn: import("@metamask/keyring-api").SolMethod.SignIn;
}>>;
id: import("@metamask/superstruct").Struct<string, null>;
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
}, null>;
}>;
export type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;
export type InternalEthErc4337Account = Infer<typeof InternalEthErc4337AccountStruct>;
export type InternalBtcP2pkhAccount = Infer<typeof InternalBtcP2pkhAccountStruct>;
export type InternalBtcP2shAccount = Infer<typeof InternalBtcP2shAccountStruct>;
export type InternalBtcP2wpkhAccount = Infer<typeof InternalBtcP2wpkhAccountStruct>;
export type InternalBtcP2trAccount = Infer<typeof InternalBtcP2trAccountStruct>;
export type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;
export declare const InternalAccountStructs: Record<string, Struct<InternalEthEoaAccount> | Struct<InternalEthErc4337Account> | Struct<InternalBtcP2pkhAccount> | Struct<InternalBtcP2shAccount> | Struct<InternalBtcP2wpkhAccount> | Struct<InternalBtcP2trAccount> | Struct<InternalSolDataAccount>>;
export type InternalAccountTypes = InternalEthEoaAccount | InternalEthErc4337Account | InternalBtcP2pkhAccount | InternalBtcP2shAccount | InternalBtcP2wpkhAccount | InternalBtcP2trAccount | InternalSolDataAccount;
export declare const InternalAccountStruct: Struct<{
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account";
id: string;
options: Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
};
metadata: {
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}, {
metadata: Struct<{
name: string;
importTime: number;
keyring: {
type: string;
};
nameLastUpdatedAt?: number;
snap?: {
name: string;
id: string;
enabled: boolean;
};
lastSelected?: number;
}, {
name: Struct<string, null>;
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
name: string;
id: string;
enabled: boolean;
}, {
id: Struct<string, null>;
enabled: Struct<boolean, null>;
name: Struct<string, null>;
}>;
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
importTime: Struct<number, null>;
keyring: Struct<{
type: string;
}, {
type: Struct<string, null>;
}>;
}>;
id: import("@metamask/superstruct").Struct<string, null>;
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account", {
"eip155:eoa": "eip155:eoa";
"eip155:erc4337": "eip155:erc4337";
"bip122:p2pkh": "bip122:p2pkh";
"bip122:p2sh": "bip122:p2sh";
"bip122:p2wpkh": "bip122:p2wpkh";
"bip122:p2tr": "bip122:p2tr";
"solana:data-account": "solana:data-account";
"any:account": "any:account";
}>;
address: import("@metamask/superstruct").Struct<string, null>;
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
entropy?: {
type: "mnemonic";
id: string;
derivationPath: string;
groupIndex: number;
} | {
type: "private-key";
};
exportable?: boolean;
}, null>;
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
}>;
/**
* Internal account representation.
*
* This type is used internally by MetaMask to add additional metadata to the
* account object. It's should not be used by external applications.
*/
export type InternalAccount = Infer<typeof InternalAccountStruct>;
//# sourceMappingURL=types.d.mts.map