Replies: 1 comment 4 replies
-
You can use ethers's contract.queryFilter (docs for past events, and contract.on (docs) for future events. The transaction hash is available as const events = contract.queryFilter(contract.filters.PairCreated());
events[0].transactionHash
contract.on('PairCreated', (...args) => {
const event = args[args.length - 1];
event.transactionHash;
}) Once you have the tx hash, you can do provider.getTransaction (docs) to extract the value. const tx = await provider.getTransaction(event.transactionHash);
tx.value (moving to discussions) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm looking at this contract's events:
https://etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f#events
I'm able to recieve it's function 'PairCreated' however I also want it's associated transaction:
https://etherscan.io/tx/0x28fb38ff07efb68f378e3ea832500acb3e6bef458ffada83b9ac09dcbc82d1ad
(specifically the amount of ethereum transferred for the new Pair) I was hoping there was some way to get the transaction and it's information.
Is your feature request related to a problem? Please describe.
Not that I'm aware of, It could possibly be I need to use:
https://github.com/ethers-io/ethers.js/blob/master/packages/contracts/src.ts/index.ts#L992
to recieve the transaction id, but I don't speak javascript.
Describe the solution you'd like
Hopefully a pointer towards how to do what I'm trying to do
Describe alternatives you've considered
Mentioned above ^^
Additional context
Trying to get the amount of ethereum transferred when a new pair is created with uniswap
Beta Was this translation helpful? Give feedback.
All reactions