-
Notifications
You must be signed in to change notification settings - Fork 22
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
[fix] return signature for send and confirm factories #109
Conversation
🦋 Changeset detectedLatest commit: 5f9432b The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
BundleMonUnchanged files (127)
Total files change +2B 0% Final result: ✅ View report in BundleMon website ➡️ |
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.
We did this super on purpose to break the connection in people's minds between:
- a transaction being confirmed
- a signature for that transaction being available
You don't have to wait for a transaction to be confirmed to obtain the signature, because the signature is a function of the private key and the message. We encourage folks to obtain the signature early, as in the example here, so that they can make use of it in their app earlier.
solana-web3.js/examples/transfer-lamports/src/example.ts
Lines 177 to 180 in 1faa88c
log.info( | |
'[step 3] Sending transaction: https://explorer.solana.com/tx/%s?cluster=custom&customUrl=127.0.0.1:8899', | |
getSignatureFromTransaction(signedTransaction), | |
); |
I know you don't have to, and that the signature is available as soon as it is signed. And that the examples are also showing how to get it. |
Because it makes waiting for the signature ergonomic. We want to discourage waiting for signatures, and encourage computing signatures pre-send, because waiting for anything can make apps feel less responsive. |
okay I guess just close the pr instead of requesting changes |
Problem
The
sendAndConfirmDurableNonceTransactionFactory
andsendAndConfirmTransactionFactory
factories return aPromise<void>
while the underlyingsendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT
returns aPromise<Signature>
Summary of Changes
Fix the return type of both factories to return the signature that they already have due to just confirming it.
sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT
already imports theSignature
type so this does not add a new dep