Applying Transformations
Helpers
Functions and packages for transformations.
Functions
To aid in transformations, we’ve begun open sourcing common utility functions and templates. You can view all of this on GitHub and as an npm package.
Pull requests are welcome! We need the community’s help for bugs, new templates, and commonly used utilities.
Here’s a list of the available functions as they can be used within transformations:
templates.token_transfers(block)
: pass in an entire block (EVM or not) and get back all of the token transfers within itutils.evmAddressToChecksum(address)
: convert an EVM address to its checksum formutils.evmChainToId(chain)
: convert an EVM chain name to achainId
; tryblock._network
to get the current chain nameutils.evmDecodeLog(log, signatures[])
: try decoding an EVM log against a list of event signaturesutils.evmDecodeLogWithMetadata(log, signatures[])
: same asevmDecodeLog
, but also return the name of the matching eventutils.evmMethodSignatureToHex(signature)
: convert an EVM event signature (e.g. from an ABI) to its topic0, hexadecimal form
Available Packages
Although transformations are run in a sandboxed environment, we inject a select few npm packages that can also be used. These include: