-
Notifications
You must be signed in to change notification settings - Fork 147
Add plural sign transaction hooks #1105
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
Add plural sign transaction hooks #1105
Conversation
🦋 Changeset detectedLatest commit: 3fd0e3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 43 packages
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 |
steveluscher
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.
Before we move forward, lets think about whether wallets are ready to handle multi-signing workflows from a UI perspective. Right now I don't know of a wallet that has a sensible UI/workflow for multi-transaction signing sessions. #1104 (comment)
|
Talked to @mcintyre94 about this. I didn't know that some apps were already using the API in this way. I'll review this today. |
|
OK, maybe today. |
|
OK, maybe today, but no guarantees. |
steveluscher
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.
Thanks for this work, and sorry it's taken me so long.
I'm really struggling with this API. I understand the need for it now, but I think we should end up with one API and deprecate the old one. I think this looks like:
- Mark the singular versions with
@deprecated Use {plural version} - Export the plural versions
- Rewrite all of the tests and examples to use the plural versions instead
- Release 5.{y+1}.0
- Delete the singular implementation
- Release 6.0.0
Would you be OK with this @mcintyre94?
|
I can see the argument for just exporting the plural version, since it covers both use cases and mirrors the wallet-standard feature. It also mirrors the signers APIs which are all multi-transaction. That said, I think the single transaction use case is going to be used overwhelmingly more common, and it is easier if you don't need to use a plural API and unpack the result from an array. The cost of providing the single API is very small, since it's just a wrapper around the plural one in the current implementation. Most importantly though, given the limitations with error handling for multiple transactions, there is a semantic difference (in practice) between sending one transaction and sending multiple. If you're dealing with one then you can understand its success/error status, if you send multiple then an error means some might have landed. Apps that do send multiple will need to treat these cases as meaningfully different. So I think it might be worth keeping the single transaction versions, with their more predictable behaviour, for the typical case of an app sending only one transaction. And then we have a clear place to document the issues with multiple transactions on the plural API. |
1f6f571 to
fc1c718
Compare
|
@steveluscher @mcintyre94 Thank you for the review. I've removed the unrelated changes (will create separate PR for those). Let me know if we should keep the singular version or deprecate it. |
BundleMonUnchanged files (136)
Total files change +20B +0.01% Final result: ✅ View report in BundleMon website ➡️ |
dcb68bd to
c863029
Compare
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.
This is looking great, thankyou!
We will need a changeset for this, we can do a minor version with a message like: "Add useSignTransactions and useSignAndSendTransactions hooks that you can use to send multiple transactions to a connected wallet."
Also looks like we need a pnpm style:fix to tidy up the lint CI error.
LMK if you want me to pick up these last few changes to get it over the line :)
Discussed with @lorisleiva and we're going to keep shipping both the single and plural APIs, so no need to deprecate the single ones.
packages/react/README.md
Outdated
| } | ||
| ``` | ||
|
|
||
| ### `useSignAndSendTransactions(uiWalletAccount, chain)` |
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.
Can we move this to the end of the README? Below where you added useSignTransactions
c863029 to
eebc4fa
Compare
Your organization requires reapproval when changes are made, so Graphite has dismissed approvals. See the output of git range-diff at https://github.com/anza-xyz/kit/actions/runs/20813439388
81a328a to
a00d986
Compare
Export plural versions of useSignTransaction and useSignAndSendTransaction. Closes anza-xyz#1104
a00d986 to
90764b0
Compare
|
@mcintyre94 thanks for the review. I've made the changes |
mcintyre94
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.
Awesome, thankyou!
These changes have been addressed
Your organization requires reapproval when changes are made, so Graphite has dismissed approvals. See the output of git range-diff at https://github.com/anza-xyz/kit/actions/runs/20816553115
|
🔎💬 Inkeep AI search and chat service is syncing content for source 'Solana Kit Docs' |
|
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
Export plural versions of useSignTransaction and useSignAndSendTransaction.
Problem
Wallet-standard allows requesting a wallet to sign multiple transactions. But we only export a hook capable of signing one, eg useSignTransaction.
The actual implementation of this uses a hook that can accept multiple transactions.
Summary of Changes
Closes #1104