- squid-evm-typegen
- squid-substrate-typegen
- squid-ink-typegen
The Arguments:
squid-evm-typegen(1) tool generates TypeScript facades for EVM transactions, logs and eth_call queries.The generated facades are assumed to be used by squids indexing EVM data.The tool takes a JSON ABIs as an input. Those can be specified in three ways:-
as a plain JSON file(s):
To include all files in
./abiand add an interface for the Multicall contract, runYou can get JSON ABIs for explorer (Etherscan, Bscscan etc) verified contract by visiting the contract page, going to the “Contract” tab and scrolling down to the “Contract ABI” section. Do not use the “Export ABI” function! Copy the contents to the clipboard and paste them to a new JSON file. -
as a contract address. One can pass multiple addresses at once. Without an Etherscan key, typegen uses the SQD ABI proxy. Pass a key only when you want to call Etherscan directly.
Please check if your contract is a proxy when using this method. If it is,
consult this page for guidance.
-
as an arbitrary URL:
basename of the ABI as the root name for the generated files. You can change the basename of generated files using the fragment (#) suffix.Options:
Typegen v5 writes one directory per ABI, for example
src/abi/erc20/{events,functions,contract,index}.ts, plus src/abi/abi.support.ts. It removes a stale src/abi/erc20.ts file from the older layout. Imports such as import * as erc20 from './abi/erc20' continue to resolve through index.ts.Local and URL inputs can be a raw ABI array or a compiler artifact with an abi array. NatSpec in artifact userdoc and devdoc fields is carried into generated documentation.Usage
The generated utility modules have three intended uses:-
Constants: EVM log topic0 values and sighashes for transactions. Example:
- Decoding of EVM logs and transactions
- Direct chain state queries, including queries to multicall.