Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add events property to ContractFactory.deploy #1334

Closed
Dan-Nolan opened this issue Mar 5, 2021 · 4 comments
Closed

Add events property to ContractFactory.deploy #1334

Dan-Nolan opened this issue Mar 5, 2021 · 4 comments
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@Dan-Nolan
Copy link

In testing I have been using the events property found on the TransactionReceipt. However, I just noticed that it is not documented:

const tx = await contract.setValue(value);
const receipt = await tx.wait();
const event = receipt.events.find(x => x.event === "ValueChange");

The reason this came up is the deployTransaction does not appear to have this same property:

const tx = contract.deployTransaction;
const receipt = await tx.wait();
console.log( receipt.events ); // undefined

Is events something we can depend on for tests or is this something that will potentially break in future versions?

@ricmoo ricmoo added documentation Documentation related issue. on-deck This Enhancement or Bug is currently being worked on. labels Mar 30, 2021
@ra-phael
Copy link

+1

I was looking to get the values of an event from a transaction receipt. I couldn't find the answer in the docs and Google led me here #487.

After inspecting the receipt I was glad to find it's simply and conveniently there :)

const receipt = await tx.wait();
const firstEvent = receipt.events?.[0];
const eventArguments = firstEvent?.args;

@ricmoo
Copy link
Member

ricmoo commented Oct 18, 2021

This is not part of the Provider API, but instead an extension that Contracts apply.

There are some docs here. It may be a good idea to link to the Contract API from the Provider API though.

I should also add the events to the factory.deploy; I'll add this for the upcoming minor bump.

@ricmoo ricmoo changed the title Documentation of TransactionReceipt events property Add events property to ContractFactory.deploy Oct 18, 2021
@ricmoo ricmoo added enhancement New feature or improvement. and removed documentation Documentation related issue. labels Oct 18, 2021
@ricmoo
Copy link
Member

ricmoo commented Oct 20, 2021

Fixed in 5.5.0. Try it out and let me know if there are any problems; if so re-open this please.

Thanks! :)

@ricmoo ricmoo closed this as completed Oct 20, 2021
@ricmoo
Copy link
Member

ricmoo commented Oct 20, 2021

Fixed in 5.5.0. Try it out and let me know if there are any problems; if so re-open this please.

Thanks! :)

@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

3 participants