Effect API
Advanced Effect API
Loop decoder also exposes Effect API interfaces.
To get started with using the Decoder, first, you have to provide the RPC Provider and a ContractLoader Service.
- Create an RPC Provider
- Create the AbiStore
AbiStore
serves as a repository for obtaining and caching the contract ABI necessary for decoding transaction data. In a real-world scenario, it may be preferable to retrieve this data from a database. In the following example, we will be hardcoding all the necessary information.
To create a new AbiStore
service you will need to implement two methods set
and get
, optionally provide an getMany
implementation.
- Create the ContractMetaStore
Similarly to AbiStore, but returns all the contract meta data
- Create a context using the services we created above
- Fetch and decode a transaction
- Finally provide the context and run the program