This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat: you can now abort transaction confirmations in web3.js #29057
Merged
steveluscher
merged 4 commits into
solana-labs:master
from
steveluscher:cancelable-transaction-confirmation-web3
Dec 3, 2022
Merged
feat: you can now abort transaction confirmations in web3.js #29057
steveluscher
merged 4 commits into
solana-labs:master
from
steveluscher:cancelable-transaction-confirmation-web3
Dec 3, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…y well together In this instance it means they: * understand `AbortSignal` * don't cause build errors
steveluscher
commented
Dec 3, 2022
@@ -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 |
gnapoli23
pushed a commit
to gnapoli23/solana
that referenced
this pull request
Dec 16, 2022
…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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.