feat: add optional expression logging to GRE#728
Conversation
Closes: #702 Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Codecov ReportBase: 90.57% // Head: 90.57% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## dev #728 +/- ##
=======================================
Coverage 90.57% 90.57%
=======================================
Files 35 35
Lines 1762 1762
Branches 296 296
=======================================
Hits 1596 1596
Misses 166 166
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
abarmat
left a comment
There was a problem hiding this comment.
I've been thinking for a while about removing all the sendTransactions calls for the improved and more expressive calls that ethers supports through typechain. This is a great improvement.
We might need to think about a way to override it in case we want to do something like:
// send tx1 and tx2 immediately
const txs = await Promise.all([tx1, tx2])
// wait for both tx1 and tx2 receipts
await Promise.all([tx1.wait(), tx2.wait()])
|
yes, an override for those cases can be tricky but doable. I'll merge this as is since we are not enabling it just yet, then we can keep thinking about this stuff. |
Adds an optional wrapper for GRE contract calls, the wrapper will:
provider.waitForTransactiontx-<DATE>.log)This will be disabled for now (unless explicitly enabled) because CLI based scripts already have this type of logging using the
sendTransactionutility. Until we consolidate those (or solve any potential double logging) we shouldn't enable this feature by default.Example usage
To try it out simply initialize GRE with
enableTxLogging = true. Note that running the same script withenableTXLogging = falsewill print nothing to the console.Console output:
> Sent transaction GraphToken.addMinter sender: 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 contract: 0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7 params: [ 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 ] txHash: 0xbcdef6ebd4e743a3a11b20ba738c45ec95bd9875e2fa903258f5349b565ade8e ✔ Transaction succeeded: 0xbcdef6ebd4e743a3a11b20ba738c45ec95bd9875e2fa903258f5349b565ade8eLog file contents:
Closes: #702
Signed-off-by: Tomás Migone tomas@edgeandnode.com