From e578f9b89cc3c9d075647654281a4fbab9b17cad Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Mon, 16 Oct 2023 16:06:49 +0100 Subject: [PATCH] Update README.md --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e5e4888..bebf299 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,12 @@ $ npm install boudra/chainsauce#main ```ts import { erc20ABI } from "./erc20ABI.ts"; -// Define contracts +// -- Define contracts const MyContracts = { ERC20: erc20ABI, }; -// Create an indexer: +// -- Create an indexer: const indexer = createIndexer({ chain: { @@ -40,7 +40,7 @@ const indexer = createIndexer({ contracts: MyContracts, }); -// Subscribe to deployed contracts: +// -- Subscribe to deployed contracts: indexer.subscribeToContract({ contract: "ERC20", @@ -51,7 +51,7 @@ indexer.subscribeToContract({ toBlock: "latest" }); -// Attach event listeners: +// -- Attach event listeners: // subscribe to a specific event indexer.on("ERC20:Approval", async ({ event }) => { @@ -63,7 +63,7 @@ indexer.on("events", async ({ event }) => { console.log("Event:", event.params); }); -// Start indexing +// -- Start indexing: // one off indexing await indexer.indexToBlock("latest"); @@ -110,6 +110,10 @@ async function handleTransfer({ indexer.on("ERC20:Transfer", handleTransfer); ``` +## How to define ABIs + +TODO + ## Using context TODO @@ -118,6 +122,10 @@ TODO TODO +## Caching events and contract reads + +TODO + ## Complete examples - [Allo Protocol Indexer](https://github.com/gitcoinco/allo-indexer)