CreateScript: <TName, THumanReadableAbi>({ name, humanReadableAbi, bytecode, deployedBytecode, }) => Script<TName, THumanReadableAbi>
TName
THumanReadableAbi
{ name, humanReadableAbi, bytecode, deployedBytecode, }
Script
Type of createScript factory function Creates a tevm Script instance from human readable abi
createScript
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
formatAbi
import { type Script, createScript, formatAbi} from 'tevm/contract'import { formatAbi } from 'tevm/abi' const script = createScript({ name: 'MyScript', bytecode: '0x123...', deployedBytecode: '0x123...', humanReadableAbi: formatAbi([ { name: 'balanceOf', inputs: [ { name: 'owner', type: 'address', }, ], outputs: [ { name: 'balance', type: 'uint256', }, } ]), }) ## Type parameters • **TName** *extends* `string` • **THumanReadableAbi** *extends* readonly `string`[] ## Parameters • **\{ name, humanReadableAbi, bytecode, deployedBytecode,\}**: [`CreateScriptParams`](/reference/tevm/contract/type-aliases/createscriptparams/)\<`TName`, `THumanReadableAbi`\> ## Returns [`Script`](/reference/tevm/contract/type-aliases/script/)\<`TName`, `THumanReadableAbi`\> ## Source types.ts:98