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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add receipt
/ txn_hash
to ContractInstance
#955
feat: add receipt
/ txn_hash
to ContractInstance
#955
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran a few examples locally and looks great to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave an approval, but I made one suggestion, which you can implement if you think it's necessary
@@ -92,11 +92,9 @@ def test_snapshot_and_restore_unknown_snapshot_id(chain): | |||
|
|||
def test_snapshot_and_restore_no_snapshots(chain): | |||
chain._snapshots = [] # Ensure empty (gets set in test setup) | |||
with pytest.raises(ChainError) as err: | |||
with pytest.raises(ChainError, match="There are no snapshots to revert to."): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know this existed, this is a really nice implementation
What I did
fixes: #806
txn_hash
toContractInstance
that gets set whenever possible, such as after deployments as well as if instantiating a contract that was previously deployed (using theinstance_at()
method)..receipt()
convenience property to theContractInstance
. Now, after you deploy, you have access to the receipt pretty immediate.This is needed to unblock my work for publishing deployments but is also kind of nice to have anyway and I think exists in Brownie.
How I did it
txn_hash
arguments tocontracts.instance_at()
andcontract.at()
transaction_hash
key to the deployments cachetxn_hash
automatically when calling.deploy()
instance_at()
try to look up thetxn_hash
when it is not provided (if it was from a deployment)How to verify it
Make sure you can access the txn hash and receipt on a contract instance:
Checklist