Skip to content

CreateMemoryClientFn

CreateMemoryClientFn: <TCommon, TAccountOrAddress, TRpcSchema>(options?) => MemoryClient<TCommon, TAccountOrAddress>

Type definition for the function that creates a MemoryClient. This function initializes a MemoryClient with the provided options, including forking configurations, logging levels, and state persistence options.

Type Parameters

TCommon extends Common & Chain = Common & Chain

The common chain configuration, extending both Common and Chain.

TAccountOrAddress extends Account | Address | undefined = undefined

The account or address type for the client.

TRpcSchema extends RpcSchema | undefined = TevmRpcSchema

The RPC schema type, defaults to TevmRpcSchema.

Parameters

options?: MemoryClientOptions<TCommon, TAccountOrAddress, TRpcSchema>

The options to configure the MemoryClient.

Returns

MemoryClient<TCommon, TAccountOrAddress>

  • A configured MemoryClient instance.

Example

import { createMemoryClient } from "tevm";
import { optimism } from "tevm/common";
const client = createMemoryClient({
fork: {
transport: http("https://mainnet.optimism.io")({}),
blockTag: '0xa6a63cd70fbbe396321ca6fe79e1b6735760c03538208b50d7e3a5dac5226435',
},
common: optimism,
});

See

For more details on using the MemoryClient, refer to MemoryClient.

Defined in

packages/memory-client/src/CreateMemoryClientFn.ts:36