-
Notifications
You must be signed in to change notification settings - Fork 129
Add to react-app example of signing with wallet and then server signer #1059
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
base: sign-wo-lifetime
Are you sure you want to change the base?
Conversation
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
BundleMonUnchanged files (133)
No change in files bundle size Final result: ✅ View report in BundleMon website ➡️ |
3e3bed0 to
441fafe
Compare
|
Documentation Preview: https://kit-docs-260rp5duw-anza-tech.vercel.app |
441fafe to
38db218
Compare

Problem
I've seen a few people asking how to do this, and signers provide a really neat approach. Since I think it makes most sense to demonstrate this using a browser wallet, I've added it to the react-app example
Summary of Changes
The new "Partial Sign Transaction" panel is very similar to the existing "Sign Transaction" one.
A
mockApiRequesttakes a serializedTransactionas input, and returns theSignatureBytesfor this address (the keypair is stored in a JSON file). This mocks a server being used to sign transactions, for example as a fee payer.A custom
TransactionPartialSignercalledfeePayerSignersigns transactions by encoding them and passing them tomockApiRequest, mocking making an API request to a server that can sign a transaction.The connected wallet continues to be a signer, for the SOL transfer instruction.
When the transaction is signed, it is first sent to the user's wallet to be signed, and then it is signed by the custom
feePayerSigner. This ordering is because the user's wallet is a modifying signer, and is enforced bymockApiRequestusingsignTransactionwhich means that after it signs the transaction is fully signed.Fixes #1034