maticnetwork / matic.js

Javascript developer library to interact with Matic Network
https://wiki.polygon.technology/docs/tools/matic-js/get-started/
MIT License
541 stars 262 forks source link

Is there a method to fetch historical event logs like web3.eth.getPastLogs()? #226

Closed zhouhanseng closed 3 years ago

zhouhanseng commented 3 years ago

Hi, Currently historical contract transaction records can be fetched by thegraph.com. Since the service of thegraph is not stable enough, I want to ask is there a method that provided by polygon directly to fetch the historical event logs like web3.eth.getPastLogs() does?

fuzious commented 3 years ago

Hi @zhouhanseng , We have not implemented that functionality, as of now, but meanwhile you can use web3 library for the same.

zhouhanseng commented 3 years ago

Thanks @fuzious ,

The web3-eth package allows you to interact with an Ethereum blockchain and Ethereum smart contracts.

According to web3 document, web3.eth.getPastLogs() should only work on Ethereum network. Does it work on Polygon network?

fuzious commented 3 years ago

Yeah @zhouhanseng absolutely, you can work with the polygon network completely using web3js be it deploying smart contracts directly to polygon or in your case fetching logs. Matic.JS is more suitable for tasks of cross bridge interactions like depositing to ethereum and withdrawing to matic etc.

zhouhanseng commented 3 years ago

Thanks a lot!