@metamask/keyring-api
Version:
MetaMask Keyring API
128 lines • 5.07 kB
text/typescript
import { type Infer } from "@metamask/superstruct";
/**
* Struct for {@link KeyringCapabilities}.
*/
export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").Struct<{
scopes: `${string}:${string}`[];
bip44?: {
derivePath: boolean;
deriveIndex: boolean;
discover: boolean;
};
privateKey?: {
importFormats?: {
encoding: "hexadecimal" | "base58";
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
}[];
exportFormats?: {
encoding: "hexadecimal" | "base58";
}[];
};
}, {
/**
* List of CAIP-2 chain IDs that this keyring supports.
*/
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
/**
* BIP-44 capabilities supported by this keyring.
*/
bip44: import("@metamask/superstruct").ExactOptionalStruct<{
derivePath: boolean;
deriveIndex: boolean;
discover: boolean;
}, {
/**
* Whether the keyring supports deriving accounts from a specific BIP-44 path.
*/
derivePath: import("@metamask/superstruct").Struct<boolean, null>;
/**
* Whether the keyring supports deriving accounts from a BIP-44 account index.
*/
deriveIndex: import("@metamask/superstruct").Struct<boolean, null>;
/**
* Whether the keyring supports BIP-44 account discovery.
*/
discover: import("@metamask/superstruct").Struct<boolean, null>;
}>;
/**
* Private key capabilities supported by this keyring.
*/
privateKey: import("@metamask/superstruct").ExactOptionalStruct<{
importFormats?: {
encoding: "hexadecimal" | "base58";
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
}[];
exportFormats?: {
encoding: "hexadecimal" | "base58";
}[];
}, {
/**
* List of supported formats for importing private keys.
*/
importFormats: import("@metamask/superstruct").ExactOptionalStruct<{
encoding: "hexadecimal" | "base58";
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
}[], import("@metamask/superstruct").Struct<{
encoding: "hexadecimal" | "base58";
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
}, {
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
hexadecimal: "hexadecimal";
base58: "base58";
}>;
type: import("@metamask/superstruct").ExactOptionalStruct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "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";
"tron:eoa": "tron:eoa";
"any:account": "any:account";
}>;
}>>;
/**
* List of supported formats for exporting private keys.
*/
exportFormats: import("@metamask/superstruct").ExactOptionalStruct<{
encoding: "hexadecimal" | "base58";
}[], import("@metamask/superstruct").Struct<{
encoding: "hexadecimal" | "base58";
}, {
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
hexadecimal: "hexadecimal";
base58: "base58";
}>;
}>>;
}>;
}>;
/**
* Type representing the capabilities supported by a keyring.
*
* @example
* ```ts
* const capabilities: KeyringCapabilities = {
* scopes: ['bip122:_'],
* bip44: {
* derivePath: true,
* deriveIndex: true,
* discover: true,
* },
* privateKey: {
* importFormats: [
* { encoding: 'base58', type: 'bip122:p2sh' },
* { encoding: 'base58', type: 'bip122:p2tr' },
* { encoding: 'base58', type: 'bip122:p2pkh' },
* { encoding: 'base58', type: 'bip122:p2wpkh' },
* ],
* exportFormats: [
* { encoding: 'base58' },
* { encoding: 'base58' },
* ],
* },
* };
* ```
*/
export type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;
//# sourceMappingURL=keyring-capabilities.d.cts.map