-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
feat: you can now abort transaction confirmations in web3.js #29057
feat: you can now abort transaction confirmations in web3.js #29057
Conversation
…y well together In this instance it means they: * understand `AbortSignal` * don't cause build errors
@@ -1167,6 +1167,44 @@ describe('Connection', function () { | |||
}); | |||
|
|||
describe('block height strategy', () => { | |||
it('rejects if called with an already-aborted `abortSignal`', () => { |
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.
Side note: I would have written more test coverage here, to assert that when cancelled, the subscription gets disposed and the nonce account no longer gets pinged. Our test framework, however, just doesn't work. I tried setting up sinon
spies, and they never fired. I tested other spies in previous tests and – surprise – they don't work either.
I, for one, can't wait to return to Jest as we rewrite web3.js.
Codecov Report
@@ Coverage Diff @@
## master #29057 +/- ##
=========================================
- Coverage 76.8% 76.8% -0.1%
=========================================
Files 55 55
Lines 3112 3127 +15
Branches 460 466 +6
=========================================
+ Hits 2393 2402 +9
- Misses 556 561 +5
- Partials 163 164 +1 |
automerge label removed due to a CI failure |
…labs#29057) * Upgrade Typescript, `@types/node`, and `typedoc` to versions that play well together In this instance it means they: * understand `AbortSignal` * don't cause build errors * You can now abort transaction confirmation using an `AbortSignal` * Pipe an `AbortSignal` down through `sendAndConfirmTransaction()` * Add `AbortController` polyfill to test so that test works in Node 14
…labs#29057) * Upgrade Typescript, `@types/node`, and `typedoc` to versions that play well together In this instance it means they: * understand `AbortSignal` * don't cause build errors * You can now abort transaction confirmation using an `AbortSignal` * Pipe an `AbortSignal` down through `sendAndConfirmTransaction()` * Add `AbortController` polyfill to test so that test works in Node 14
Problem
Now that we have long-running transaction confirmation strategies, like #25839, one might like to cancel outstanding transaction confirmations that they no longer care about. For instance, if a user takes an action, but then visits a different page on your site before the transaction has confirmed, you might like to dispose of it.
Summary of Changes
abortSignal
as an input toconfirmTransaction()
Now, callers can do this:
Fixes #25304.