CreateContractFn
CreateContractFn: <
TName
,TAbi
,TAddress
,TBytecode
,TDeployedBytecode
,TCode
,THumanReadableAbi
>({ name, humanReadableAbi, bytecode, deployedBytecode, code, }
) =>Contract
<TName
,THumanReadableAbi
,TAddress
,TBytecode
,TDeployedBytecode
,TCode
>
Type of createContract
factory function.
Creates a tevm Contract instance from a human readable ABI or JSON ABI.
Type Parameters
• TName extends string
The name of the contract
• TAbi extends readonly string
[] | Abi
The ABI type (either string[] for human readable or Abi for JSON)
• TAddress extends undefined
| Address
= undefined
The contract address type (optional)
• TBytecode extends undefined
| Hex
= undefined
The contract bytecode type (optional)
• TDeployedBytecode extends undefined
| Hex
= undefined
The deployed bytecode type (optional)
• TCode extends undefined
| Hex
= undefined
The runtime bytecode type (optional)
• THumanReadableAbi extends readonly string
[] = TAbi
extends readonly string
[] ? TAbi
: TAbi
extends Abi
? FormatAbi
<TAbi
> : never
Parameters
• {
name,
humanReadableAbi,
bytecode,
deployedBytecode,
code,
}: CreateContractParams
<TName
, TAbi
, TAddress
, TBytecode
, TDeployedBytecode
, TCode
>
Returns
Contract
<TName
, THumanReadableAbi
, TAddress
, TBytecode
, TDeployedBytecode
, TCode
>
Examples
Using a human readable ABI:
Using a JSON ABI (needs to be formatted):