in

getPastLogs with accounts

I have an account `a` that contains some transactions calling a smart contract `s` where an event `e` is emitted. Is there a way I can get all `e` without going through all events in `s`?

Looks like [getPastLogs](https://web3js.readthedocs.io/en/v1.2.7/web3-eth.html#getpastlogs) might be a good candidate, but seems like it only accepts a smart contract as its `address`. If I use an account, I get an empty result. Guess this is expected? Logs only apply to an smart contract I guess?

The problem is that it’s way overkill to get all the logs of `s` , since I’m only interested in a couple of events that were emitted by my account `a`

What do you think?

10 Points
Upvote Downvote

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

One Comment

  1. The logs aren’t emitted by you’re account, they’re emitted by the contract. That might be the result of a transaction sent from your account, but the contract is still considered to have emitted the logs.

    Depending on the nature of the events, your account might be indicated in one of the topics you can filter on. For example, For ERC20 transfer events, topic1 is the sender and topic2 is the recipient of a transfer. You could filter against those if that’s what you’re looking for, but there’s not a way to do it in the general case.

Decred FAQ: What is DCR? Why was this cryptocurrency created?

$RIDE Details – It is Gold 🥇