@metamask/keyring-snap-client
Version:
MetaMask Keyring Snap clients
40 lines • 2.27 kB
text/typescript
import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, Balance, TransactionsPage, Pagination, ResolvedAccountAddress, CaipChainId, CaipAssetType, CaipAssetTypeOrId, EntropySourceId, DiscoveredAccount } from "@metamask/keyring-api";
import type { JsonRpcRequest } from "@metamask/keyring-utils";
import type { Json } from "@metamask/utils";
export type Sender = {
send(request: JsonRpcRequest): Promise<Json>;
};
export declare class KeyringClient implements Keyring {
#private;
/**
* Create a new instance of `KeyringClient`.
*
* @param sender - The `Sender` instance to use to send requests to the snap.
*/
constructor(sender: Sender);
/**
* Send a request to the snap and return the response.
*
* @param partial - A partial JSON-RPC request (method and params).
* @returns A promise that resolves to the response to the request.
*/
protected send(partial: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>): Promise<Json>;
listAccounts(): Promise<KeyringAccount[]>;
getAccount(id: string): Promise<KeyringAccount>;
getAccountBalances(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
discoverAccounts(scopes: CaipChainId[], entropySource: EntropySourceId, groupIndex: number): Promise<DiscoveredAccount[]>;
listAccountTransactions(id: string, pagination: Pagination): Promise<TransactionsPage>;
listAccountAssets(id: string): Promise<CaipAssetTypeOrId[]>;
resolveAccountAddress(scope: CaipChainId, request: JsonRpcRequest): Promise<ResolvedAccountAddress | null>;
filterAccountChains(id: string, chains: string[]): Promise<string[]>;
updateAccount(account: KeyringAccount): Promise<void>;
deleteAccount(id: string): Promise<void>;
exportAccount(id: string): Promise<KeyringAccountData>;
listRequests(): Promise<KeyringRequest[]>;
getRequest(id: string): Promise<KeyringRequest>;
submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
approveRequest(id: string, data?: Record<string, Json>): Promise<void>;
rejectRequest(id: string): Promise<void>;
}
//# sourceMappingURL=KeyringClient.d.mts.map