UNPKG

@metamask/snaps-simulation

Version:

A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment

463 lines 20.1 kB
import type { SnapResponse, SnapResponseWithInterface } from "./types.cjs"; export declare const TransactionOptionsStruct: import("@metamask/superstruct").Struct<{ data: `0x${string}`; value: `0x${string}`; chainId: string; origin: string; from: `0x${string}`; to: `0x${string}`; gasLimit: `0x${string}`; maxFeePerGas: `0x${string}`; maxPriorityFeePerGas: `0x${string}`; nonce: `0x${string}`; }, { /** * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`. */ chainId: import("@metamask/superstruct").Struct<string, null>; /** * The origin to send the transaction from. Defaults to `metamask.io`. */ origin: import("@metamask/superstruct").Struct<string, null>; /** * The address to send the transaction from. Defaults to a randomly generated * address. */ from: import("@metamask/superstruct").Struct<`0x${string}`, null>; /** * The address to send the transaction to. Defaults to a randomly generated * address. */ to: import("@metamask/superstruct").Struct<`0x${string}`, null>; /** * The value to send with the transaction. The value may be specified as a * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`. */ value: import("@metamask/superstruct").Struct<`0x${string}`, null>; /** * The gas limit to use for the transaction. The gas limit may be specified * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`. */ gasLimit: import("@metamask/superstruct").Struct<`0x${string}`, null>; /** * The max fee per gas (in Wei) to use for the transaction. The max fee per * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`. * Defaults to `1`. */ maxFeePerGas: import("@metamask/superstruct").Struct<`0x${string}`, null>; /** * The max priority fee per gas (in Wei) to use for the transaction. The max * priority fee per gas may be specified as a `number`, `bigint`, `string`, * or `Uint8Array`. Defaults to `1`. */ maxPriorityFeePerGas: import("@metamask/superstruct").Struct<`0x${string}`, null>; /** * The nonce to use for the transaction. The nonce may be specified as a * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`. */ nonce: import("@metamask/superstruct").Struct<`0x${string}`, null>; /** * The data to send with the transaction. The data may be specified as a * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`. */ data: import("@metamask/superstruct").Struct<`0x${string}`, null>; }>; export declare const SignatureOptionsStruct: import("@metamask/superstruct").Struct<{ data: `0x${string}` | Record<string, any> | Record<string, any>[]; origin: string; from: `0x${string}`; signatureMethod: "eth_signTypedData" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "personal_sign"; }, { /** * The origin making the signature request. */ origin: import("@metamask/superstruct").Struct<string, null>; /** * The address signing the signature request. Defaults to a randomly generated * address. */ from: import("@metamask/superstruct").Struct<`0x${string}`, null>; /** * The data to send with the transaction. The data may be specified as a * `string`, an object, or an array of objects. This covers the data types * for the supported signature methods. Defaults to `0x`. */ data: import("@metamask/superstruct").Struct<`0x${string}` | Record<string, any> | Record<string, any>[], null>; /** * The signature method being used. */ signatureMethod: import("@metamask/superstruct").Struct<"eth_signTypedData" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "personal_sign", null>; }>; export declare const BaseNameLookupOptionsStruct: import("@metamask/superstruct").Struct<{ chainId: string; }, { /** * The CAIP-2 chain ID. Defaults to `eip155:1`. */ chainId: import("@metamask/superstruct").Struct<string, null>; }>; export declare const NameLookupOptionsStruct: import("@metamask/superstruct").Struct<{ address: string; chainId: string; } | { chainId: string; domain: string; }, null>; export declare const SnapOptionsStruct: import("@metamask/superstruct").Struct<{ timeout?: number | undefined; }, { /** * The timeout in milliseconds to use for requests to the snap. Defaults to * `1000`. */ timeout: import("@metamask/superstruct").Struct<number | undefined, null>; }>; export declare const JsonRpcMockOptionsStruct: import("@metamask/superstruct").Struct<{ method: string; result: import("@metamask/snaps-sdk").Json; }, { method: import("@metamask/superstruct").Struct<string, null>; result: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Json, unknown>; }>; export declare const InterfaceStruct: import("@metamask/superstruct").Struct<{ content?: import("@metamask/snaps-sdk/jsx").JSXElement | undefined; }, { content: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk/jsx").JSXElement | undefined, null>; }>; export declare const SnapResponseWithoutInterfaceStruct: import("@metamask/superstruct").Struct<{ id: string; notifications: { id: string; message: string; type: "inApp" | "native"; title?: string | undefined; content?: string | undefined; footerLink?: { text: string; href: string; } | undefined; }[]; response: { result: import("@metamask/snaps-sdk").Json; } | { error: import("@metamask/snaps-sdk").Json; }; tracked: { events: { event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }[]; errors: import("@metamask/snaps-sdk").TrackableError[]; traces: { name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }[]; }; }, { id: import("@metamask/superstruct").Struct<string, null>; response: import("@metamask/superstruct").Struct<{ result: import("@metamask/snaps-sdk").Json; } | { error: import("@metamask/snaps-sdk").Json; }, null>; notifications: import("@metamask/superstruct").Struct<{ id: string; message: string; type: "inApp" | "native"; title?: string | undefined; content?: string | undefined; footerLink?: { text: string; href: string; } | undefined; }[], import("@metamask/superstruct").Struct<{ id: string; message: string; type: "inApp" | "native"; title?: string | undefined; content?: string | undefined; footerLink?: { text: string; href: string; } | undefined; }, { id: import("@metamask/superstruct").Struct<string, null>; message: import("@metamask/superstruct").Struct<string, null>; type: import("@metamask/superstruct").Struct<"inApp" | "native", null>; title: import("@metamask/superstruct").Struct<string | undefined, null>; content: import("@metamask/superstruct").Struct<string | undefined, null>; footerLink: import("@metamask/superstruct").Struct<{ text: string; href: string; } | undefined, { href: import("@metamask/superstruct").Struct<string, null>; text: import("@metamask/superstruct").Struct<string, null>; }>; }>>; tracked: import("@metamask/superstruct").Struct<{ events: { event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }[]; errors: import("@metamask/snaps-sdk").TrackableError[]; traces: { name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }[]; }, { errors: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").TrackableError[], import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").TrackableError, unknown>>; events: import("@metamask/superstruct").Struct<{ event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }[], import("@metamask/superstruct").Struct<{ event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }, { event: import("@metamask/superstruct").Struct<string, null>; properties: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>; sensitiveProperties: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>; }>>; traces: import("@metamask/superstruct").Struct<{ name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }[], import("@metamask/superstruct").Struct<{ name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }, { id: import("@metamask/superstruct").Struct<string | undefined, null>; name: import("@metamask/superstruct").Struct<string, null>; parentContext: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Json | undefined, unknown>; startTime: import("@metamask/superstruct").Struct<number | undefined, null>; data: import("@metamask/superstruct").Struct<Record<string, string | number | boolean> | undefined, null>; tags: import("@metamask/superstruct").Struct<Record<string, string | number | boolean> | undefined, null>; }>>; }>; }>; export declare const SnapResponseWithInterfaceStruct: import("@metamask/superstruct").Struct<{ id: string; notifications: { id: string; message: string; type: "inApp" | "native"; title?: string | undefined; content?: string | undefined; footerLink?: { text: string; href: string; } | undefined; }[]; getInterface: Function; response: { result: import("@metamask/snaps-sdk").Json; } | { error: import("@metamask/snaps-sdk").Json; }; tracked: { events: { event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }[]; errors: import("@metamask/snaps-sdk").TrackableError[]; traces: { name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }[]; }; }, { getInterface: import("@metamask/superstruct").Struct<Function, null>; id: import("@metamask/superstruct").Struct<string, null>; notifications: import("@metamask/superstruct").Struct<{ id: string; message: string; type: "inApp" | "native"; title?: string | undefined; content?: string | undefined; footerLink?: { text: string; href: string; } | undefined; }[], import("@metamask/superstruct").Struct<{ id: string; message: string; type: "inApp" | "native"; title?: string | undefined; content?: string | undefined; footerLink?: { text: string; href: string; } | undefined; }, { id: import("@metamask/superstruct").Struct<string, null>; message: import("@metamask/superstruct").Struct<string, null>; type: import("@metamask/superstruct").Struct<"inApp" | "native", null>; title: import("@metamask/superstruct").Struct<string | undefined, null>; content: import("@metamask/superstruct").Struct<string | undefined, null>; footerLink: import("@metamask/superstruct").Struct<{ text: string; href: string; } | undefined, { href: import("@metamask/superstruct").Struct<string, null>; text: import("@metamask/superstruct").Struct<string, null>; }>; }>>; response: import("@metamask/superstruct").Struct<{ result: import("@metamask/snaps-sdk").Json; } | { error: import("@metamask/snaps-sdk").Json; }, null>; tracked: import("@metamask/superstruct").Struct<{ events: { event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }[]; errors: import("@metamask/snaps-sdk").TrackableError[]; traces: { name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }[]; }, { errors: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").TrackableError[], import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").TrackableError, unknown>>; events: import("@metamask/superstruct").Struct<{ event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }[], import("@metamask/superstruct").Struct<{ event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }, { event: import("@metamask/superstruct").Struct<string, null>; properties: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>; sensitiveProperties: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>; }>>; traces: import("@metamask/superstruct").Struct<{ name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }[], import("@metamask/superstruct").Struct<{ name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }, { id: import("@metamask/superstruct").Struct<string | undefined, null>; name: import("@metamask/superstruct").Struct<string, null>; parentContext: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Json | undefined, unknown>; startTime: import("@metamask/superstruct").Struct<number | undefined, null>; data: import("@metamask/superstruct").Struct<Record<string, string | number | boolean> | undefined, null>; tags: import("@metamask/superstruct").Struct<Record<string, string | number | boolean> | undefined, null>; }>>; }>; }>; export declare const SnapResponseStruct: import("@metamask/superstruct").Struct<{ id: string; notifications: { id: string; message: string; type: "inApp" | "native"; title?: string | undefined; content?: string | undefined; footerLink?: { text: string; href: string; } | undefined; }[]; response: { result: import("@metamask/snaps-sdk").Json; } | { error: import("@metamask/snaps-sdk").Json; }; tracked: { events: { event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }[]; errors: import("@metamask/snaps-sdk").TrackableError[]; traces: { name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }[]; }; } | { id: string; notifications: { id: string; message: string; type: "inApp" | "native"; title?: string | undefined; content?: string | undefined; footerLink?: { text: string; href: string; } | undefined; }[]; getInterface: Function; response: { result: import("@metamask/snaps-sdk").Json; } | { error: import("@metamask/snaps-sdk").Json; }; tracked: { events: { event: string; properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined; }[]; errors: import("@metamask/snaps-sdk").TrackableError[]; traces: { name: string; id?: string | undefined; data?: Record<string, string | number | boolean> | undefined; parentContext?: import("@metamask/snaps-sdk").Json | undefined; startTime?: number | undefined; tags?: Record<string, string | number | boolean> | undefined; }[]; }; }, null>; /** * Ensure that the actual response contains `getInterface`. * * @param response - The response of the handler. */ export declare function assertIsResponseWithInterface(response: SnapResponse): asserts response is SnapResponseWithInterface; //# sourceMappingURL=structs.d.cts.map