Skip to content

CreateContract

CreateContract: <TName, THumanReadableAbi>({ name, humanReadableAbi, }) => Contract<TName, THumanReadableAbi>

Type of createContract factory function Creates a tevm Contract instance from human readable abi

Examples

import { type Contract, createContract} from 'tevm/contract'
const contract: Contract = createContract({
name: 'MyContract',
abi: [
...
],
})

To use a json abi first pass it into formatAbi to turn it into human readable

import { type Contract, createContract} from 'tevm/contract'
const contract = createContract({
name: 'MyContract',
abi: [
...
],
})

Type parameters

TName extends string

THumanReadableAbi extends readonly string[]

Parameters

{ name, humanReadableAbi, }: CreateContractParams<TName, THumanReadableAbi>

Returns

Contract<TName, THumanReadableAbi>

Source

types.ts:41