createScript
createScript<
TName,THumanReadableAbi>(__namedParameters):Script<TName,THumanReadableAbi>
Creates a Tevm Script instance from humanReadableAbi and bytecode
Type parameters
• TName extends string
• THumanReadableAbi extends readonly string[]
Parameters
• __namedParameters: CreateScriptParams<TName, THumanReadableAbi>
Returns
Script<TName, THumanReadableAbi>
Examples
import { type Script, createScript} from 'tevm/contract'
const script: Script = createScript({ name: 'MyScript', humanReadableAbi: ['function exampleRead(): uint256', ...], bytecode: '0x123...', deployedBytecode: '0x123...',})To use a json abi first pass it into formatAbi to turn it into human readable
import { type Script, createScript, formatAbi} from 'tevm/contract'import { formatAbi } from 'tevm/utils'
const script = createScript({ name: 'MyScript', bytecode: '0x123...', deployedBytecode: '0x123...', humanReadableAbi: formatAbi([ { name: 'balanceOf', inputs: [ { name: 'owner', type: 'address', }, ], outputs: [ { name: 'balance', type: 'uint256', }, } ]), })Source
createScript.js:50