Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
boudra authored Oct 16, 2023
1 parent 1b97a75 commit e578f9b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -40,7 +40,7 @@ const indexer = createIndexer({
contracts: MyContracts,
});

// Subscribe to deployed contracts:
// -- Subscribe to deployed contracts:

indexer.subscribeToContract({
contract: "ERC20",
Expand All @@ -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 }) => {
Expand All @@ -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");
Expand Down Expand Up @@ -110,6 +110,10 @@ async function handleTransfer({
indexer.on("ERC20:Transfer", handleTransfer);
```

## How to define ABIs

TODO

## Using context

TODO
Expand All @@ -118,6 +122,10 @@ TODO

TODO

## Caching events and contract reads

TODO

## Complete examples

- [Allo Protocol Indexer](https://github.com/gitcoinco/allo-indexer)

0 comments on commit e578f9b

Please sign in to comment.