Skip to main content

JSON-RPC API

As per the EIP-1193 specification, the zkEVM provider exposes a request function, which is intended to act as a transport and protocol agnostic wrapper for Remote Procedure Calls (RPCs):

export interface RequestArguments {
method: string;
params?: Array<any>;
}

export type Provider = {
request: (request: RequestArguments) => Promise<any>;
// ...
}

Error Handling

The request method may reject with a JsonRpcError error:

export class JsonRpcError extends Error {
public readonly message: string;
public readonly code: ProviderErrorCode | RpcErrorCode;
}

export enum ProviderErrorCode {
USER_REJECTED_REQUEST = 4001,
UNAUTHORIZED = 4100,
UNSUPPORTED_METHOD = 4200,
DISCONNECTED = 4900,
}

export enum RpcErrorCode {
RPC_SERVER_ERROR = -32000,
INVALID_REQUEST = -32600,
METHOD_NOT_FOUND = -32601,
INVALID_PARAMS = -32602,
INTERNAL_ERROR = -32603,
PARSE_ERROR = -32700,
USER_REJECTED_REQUEST = -32003,
}

Supported RPC Methods

The zkEVM provider supports the following RPC methods:

IMX Whitepaper IMX Tokenomics Block Explorer Careers Contact Us