-
Notifications
You must be signed in to change notification settings - Fork 360
feat: watch pending txs for success #3537
Conversation
|
CLA Assistant Lite All Contributors have signed the CLA. |
ESLint Summary View Full Report
[warning] @typescript-eslint/explicit-module-boundary-types
[warning] react-hooks/exhaustive-deps
Report generated by eslint-plus-action |
|
E2E Tests Failed Failed tests:
|
ESLint Summary View Full Report
Report generated by eslint-plus-action |
src/logic/safe/store/middleware/pendingTransactionsMiddleware.ts
Outdated
Show resolved
Hide resolved
katspaugh
left a comment
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 would refactor the watcher in the following way:
- Make a function that iterates over pending txns, launches a monitor for them
- The monitor itself should be a function that takes a single tx
- Write unit tests for both functions
src/logic/safe/store/middleware/pendingTransactionsMiddleware.ts
Outdated
Show resolved
Hide resolved
katspaugh
left a comment
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.
Code looks great!
DiogoSoaress
left a comment
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.
Looks good! And easy to follow 👍
| ) | ||
| .encodeABI() | ||
| : txHash && safeInstance.methods.approveHash(txHash).encodeABI() | ||
| : this.txHash && safeInstance.methods.approveHash(this.txHash).encodeABI() |
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.
Why this change? I see that before we were destructuring txHash from this
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.
txHash wasn't updating when destructured
usame-algan
left a comment
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.
Great feature! 👍
|
Looks goods So I tried a couple of times to create a tx, setting the gas price in low and then cancelling it right away, refresh the page and see that the tx is shown in pending until it "realizes" after a few minutes that the tx was not mined. |
What it solves
Resolves #3531
How this PR fixes it
Pending transactions that exist in the store on mount are watched for their success on the chain. If they succeed or alternatively timeout, their pending status is removed. This depends on if the transaction was (un-)successfully mined within 50 blocks since the session loaded.
How to test it
Screenshots