File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments