import { JsonRpcError } from './JsonRpcError'; export enum RelayerTransactionStatus { PENDING = 'PENDING', SUBMITTED = 'SUBMITTED', SUCCESSFUL = 'SUCCESSFUL', REVERTED = 'REVERTED', FAILED = 'FAILED', CANCELLED = 'CANCELLED', } export interface RelayerTransaction { status: RelayerTransactionStatus; chainId: string; relayerId: string; hash: string; statusMessage?: string; } export interface FeeOption { tokenPrice: string; tokenSymbol: string; tokenDecimals: number; tokenAddress: string; recipientAddress: string; } export interface MetaTransaction { to: string; value?: bigint | null; data?: string | null; nonce?: bigint; gasLimit?: bigint; delegateCall?: boolean; revertOnError?: boolean; } export interface MetaTransactionNormalised { delegateCall: boolean; revertOnError: boolean; gasLimit: bigint; target: string; value: bigint; data: string; } // https://eips.ethereum.org/EIPS/eip-712 export interface TypedDataPayload { types: { EIP712Domain: Array<{ name: string; type: string }>; [key: string]: Array<{ name: string; type: string }>; }; domain: { name?: string; version?: string; chainId?: number | string; verifyingContract?: string; salt?: string; } | { name?: string; version?: string; chainId?: number; verifyingContract?: string; salt?: string; }; primaryType: string; message: Record; } export interface RequestArguments { method: string; params?: Array; } export type JsonRpcRequestPayload = RequestArguments & { jsonrpc?: string; id?: string | number; }; export interface JsonRpcRequestCallback { ( err: JsonRpcError | null, result?: JsonRpcResponsePayload | (JsonRpcResponsePayload | null)[] | null ): void; } export interface JsonRpcResponsePayload { result?: Array | null; error?: JsonRpcError | null; jsonrpc?: string; id?: string | number; } /** * EIP-1193 Provider Interface * Standard Ethereum provider interface */ export type Provider = { request: (request: RequestArguments) => Promise; on: (event: string, listener: (...args: any[]) => void) => void; removeListener: (event: string, listener: (...args: any[]) => void) => void; isPassport: boolean; }; export enum ProviderEvent { ACCOUNTS_CHANGED = 'accountsChanged', } export type AccountsChangedEvent = Array; export interface ProviderEventMap extends Record { [ProviderEvent.ACCOUNTS_CHANGED]: [AccountsChangedEvent]; } /** * Event detail from the `eip6963:announceProvider` event. */ export interface EIP6963ProviderDetail { info: EIP6963ProviderInfo; provider: Provider; } /** * Metadata of the EIP-1193 Provider. */ export interface EIP6963ProviderInfo { icon: `data:image/${string}`; // RFC-2397 name: string; rdns: string; uuid: string; } /** * Event type to announce an EIP-1193 Provider. */ export interface EIP6963AnnounceProviderEvent extends CustomEvent { type: 'eip6963:announceProvider'; }