Skip to content

CommonOptions

CommonOptions: ViemChain & object

Type declaration

customCrypto?

optional customCrypto: CustomCrypto

Custom crypto implementations For EIP-4844 support kzg must be passed

Warning

KZG can add a significant amount of bundle size to an app In future a stub will be provided that that automatically returns valid without checking the kzg proof

Example

import { createMemoryClient } from 'tevm'
import { mainnet } from 'tevm/common'
import { createMockKzg } from 'tevm/crypto'
const common = createCommon({
...mainnet,
customCrypto: {
kzg: createMockKzg(),
...customCrypto,
},
})

eips?

optional eips: ReadonlyArray<number>

Eips to enable. Defaults to [1559, 4895]

Default

[1559, 4895]

hardfork?

optional hardfork: Hardfork

Hardfork to use. Defaults to shanghai

Default

'cancun'

loggingLevel?

optional loggingLevel: LogOptions["level"]

Logging level of the Tevm logger instance

Default

'warn'

Examples

import { mainnet, createCommon, type CommonOptions } from 'tevm/common'
const opts: CommonOptions = {
...mainnet,
hardfork: 'london',
}
const common = createCommon(opts)

You can also create a Common instance from viem chains:

import { mainnet } from 'viem/chains'
import { createCommon } from 'tevm/common'
const common = createCommon({
...mainnet,
hardfork: 'cancun',
})

See

createCommon

Defined in

packages/common/src/CommonOptions.ts:38