> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# RpcSchema

:::info
`RpcSchema` is a re-export of ox's [`RpcSchema`](https://oxlib.sh/api/RpcSchema). Refer to the ox documentation for the full reference.
:::

Utility types for working with Ethereum JSON-RPC namespaces & schemas.

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`RpcSchema.from`](/docs/utilities/rpcschema/from) | Instantiates a statically typed Schema. This is a runtime-noop function, and is purposed to be used as a type-level tag to be used with [`Provider.from`](/docs/utilities/provider/from) or [`RpcTransport.fromHttp`](https://oxlib.sh/api/RpcTransport/fromHttp). |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`RpcSchema.Default`](/docs/utilities/rpcschema/types#rpcschemadefault) | Type-safe union of all JSON-RPC Methods. |
| [`RpcSchema.Eth`](/docs/utilities/rpcschema/types#rpcschemaeth) | Union of all JSON-RPC Methods for the `eth_` namespace. |
| [`RpcSchema.ExtractItem`](/docs/utilities/rpcschema/types#rpcschemaextractitem) | Extracts a schema item from a [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic) or [`RpcSchema.MethodNameGeneric`](/docs/utilities/rpcschema/types#methodnamegeneric). |
| [`RpcSchema.ExtractMethodName`](/docs/utilities/rpcschema/types#rpcschemaextractmethodname) | Type-safe union of all JSON-RPC Method Names. |
| [`RpcSchema.ExtractParams`](/docs/utilities/rpcschema/types#rpcschemaextractparams) | Extracts parameters from a [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic) or [`RpcSchema.MethodNameGeneric`](/docs/utilities/rpcschema/types#methodnamegeneric). |
| [`RpcSchema.ExtractRequest`](/docs/utilities/rpcschema/types#rpcschemaextractrequest) | Extracts request from a [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic) or [`RpcSchema.MethodNameGeneric`](/docs/utilities/rpcschema/types#methodnamegeneric). |
| [`RpcSchema.ExtractReturnType`](/docs/utilities/rpcschema/types#rpcschemaextractreturntype) | Extracts return type from a [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic) or [`RpcSchema.MethodNameGeneric`](/docs/utilities/rpcschema/types#methodnamegeneric). |
| [`RpcSchema.From`](/docs/utilities/rpcschema/types#rpcschemafrom) | Type to define a custom type-safe JSON-RPC Schema. |
| [`RpcSchema.FromViem`](/docs/utilities/rpcschema/types#rpcschemafromviem) | Converts a [Viem-compatible RPC schema](https://viem.sh) (tuple of `{ Method, Parameters, ReturnType }`) to an Ox [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic) (union of `{ Request, ReturnType }`). |
| [`RpcSchema.FromZod`](/docs/utilities/rpcschema/types#rpcschemafromzod) | Converts a record of Zod `params`/`returns` schemas (keyed by method name) to an Ox [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic) (union of `{ Request, ReturnType }`). |
| [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#rpcschemageneric) | Generic type to define a JSON-RPC Method. |
| [`RpcSchema.MethodNameGeneric`](/docs/utilities/rpcschema/types#rpcschemamethodnamegeneric) | Generic type to define a JSON-RPC Method Name. |
| [`RpcSchema.Schema`](/docs/utilities/rpcschema/types#rpcschemaschema) | Schema input accepted by APIs that statically type JSON-RPC requests (e.g. [`Provider.from`](/docs/utilities/provider/from), [`RpcTransport.fromHttp`](https://oxlib.sh/api/RpcTransport/fromHttp)): either an Ox [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic) or a record of Zod `params`/`returns` schemas (keyed by method name) from `ox/zod`. |
| [`RpcSchema.ToGeneric`](/docs/utilities/rpcschema/types#rpcschematogeneric) | Resolves a [`RpcSchema.Schema`](/docs/utilities/rpcschema/types#schema) input to an Ox [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic). A Zod namespace is converted via [`RpcSchema.FromZod`](/docs/utilities/rpcschema/types#fromzod); a `Generic` is passed through; otherwise falls back to [`RpcSchema.Default`](/docs/utilities/rpcschema/types#default). |
| [`RpcSchema.ToViem`](/docs/utilities/rpcschema/types#rpcschematoviem) | Converts an Ox [`RpcSchema.Generic`](/docs/utilities/rpcschema/types#generic) (union of `{ Request, ReturnType }`) to a [Viem-compatible RPC schema](https://viem.sh) (tuple of `{ Method, Parameters, ReturnType }`). |
| [`RpcSchema.Wallet`](/docs/utilities/rpcschema/types#rpcschemawallet) | Union of all JSON-RPC Methods for the `wallet_` namespace. |
