Skip to content

Commit 89ad2df

Browse files
changeset
1 parent 16e7e4e commit 89ad2df

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.changeset/ready-tigers-pump.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,31 @@
22
"thirdweb": patch
33
---
44

5-
Get events from insight
5+
Get indexed events from `getContractEvents`
6+
7+
You can now automatically query indexed events on supported chains when calling getContractEvents
8+
9+
```ts
10+
import { getContractEvents } from "thirdweb";
11+
12+
const events = await getContractEvents({
13+
contract: DOODLES_CONTRACT,
14+
events: [transferEvent()],
15+
});
16+
```
17+
18+
This method falls back to RPC eth_getLogs if the indexer is not available.
19+
20+
You can also use the dedicated indexer function via the Insight export
21+
22+
```ts
23+
import { Insight } from "thirdweb";
24+
25+
const events = await Insight.getContractEvents({
26+
client,
27+
chains: [sepolia],
28+
contractAddress: "0x1234567890123456789012345678901234567890",
29+
event: transferEvent(),
30+
decodeLogs: true,
31+
});
32+
```

0 commit comments

Comments
 (0)