@metamask/keyring-api
Version:
MetaMask Keyring API
109 lines • 3.67 kB
text/typescript
import type { Infer } from "@metamask/superstruct";
/**
* Supported Ethereum account types.
*/
export declare enum EthAccountType {
Eoa = "eip155:eoa",
Erc4337 = "eip155:erc4337"
}
/**
* Supported Bitcoin account types.
*/
export declare enum BtcAccountType {
P2pkh = "bip122:p2pkh",
P2sh = "bip122:p2sh",
P2wpkh = "bip122:p2wpkh",
P2tr = "bip122:p2tr"
}
/**
* Supported Solana account types.
*/
export declare enum SolAccountType {
DataAccount = "solana:data-account"
}
/**
* A generic account type. It can be used to represent any account type that is
* not covered by the other account types. It only applies to non-EVM chains.
*/
export declare enum AnyAccountType {
Account = "any:account"
}
/**
* Supported account types.
*/
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}` | `${AnyAccountType.Account}`;
/**
* A struct which represents a Keyring account object. It is abstract enough to
* be used with any blockchain. Specific blockchain account types should extend
* this struct.
*
* See {@link KeyringAccount}.
*/
export declare const KeyringAccountStruct: import("@metamask/superstruct").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;
};
address: string;
scopes: `${string}:${string}`[];
methods: string[];
}, {
/**
* Account ID (UUIDv4).
*/
id: import("@metamask/superstruct").Struct<string, null>;
/**
* Account type.
*/
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";
}>;
/**
* Account main address.
*/
address: import("@metamask/superstruct").Struct<string, null>;
/**
* Account supported scopes (CAIP-2 chain IDs).
*/
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
/**
* Account options.
*/
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>;
/**
* Account supported methods.
*/
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
}>;
/**
* Keyring Account type represents an account and its properties from the
* point of view of the keyring.
*/
export type KeyringAccount = Infer<typeof KeyringAccountStruct>;
//# sourceMappingURL=account.d.mts.map