Skip to content
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 transaction serialize/deserialize bugs in ghost wallet. #40

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

yrliou
Copy link
Contributor

@yrliou yrliou commented Dec 15, 2023

Contribute what we have fixed in https://github.com/brave/wallet-standard-brave back to the reference wallet implementation. Most codes are actually from wallet-adapter.

  • Always deserialize transactions using VersionedTransaction.deserialize()
  • In #signTransaction, specify requireAllSignatures and verifySignatures to false when serializing legacy transactions signed by wallet, because transactions could be partial signed.

Contribute what we have fixed in https://github.com/brave/wallet-standard-brave
back to the reference wallet implementation. Most codes are actually from
wallet-adapter.
- Always deserialize transactions using VersionedTransaction.deserialize()
- In #signTransaction, specify requireAllSignatures and verifySignatures
  to false when serializing legacy transactions signed by wallet, because
  transactions could be partial signed.
Copy link
Collaborator

@jordaaash jordaaash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

Are the type casts for signedTransaction as Transaction required? It looks like isVersionedTransaction should narrow the types properly.

@yrliou
Copy link
Contributor Author

yrliou commented Dec 15, 2023

@jordaaash Seems to be, I was seeing below errors:

[4:09:02 PM] Building project '/Users/yrliou/solana-wallet-standard/packages/wallets/ghost/tsconfig.cjs.json'...

src/wallet.ts:242:41 - error TS2339: Property 'serialize' does not exist on type 'never'.

242                       signedTransaction.serialize({
                                            ~~~~~~~~~

[4:09:04 PM] Project 'tsconfig.esm.json' is out of date because output file 'lib/esm/account.js' does not exist

[4:09:04 PM] Building project '/Users/yrliou/solana-wallet-standard/packages/wallets/ghost/tsconfig.esm.json'...

src/wallet.ts:242:41 - error TS2339: Property 'serialize' does not exist on type 'never'.

242                       signedTransaction.serialize({
                                            ~~~~~~~~~

@jordaaash jordaaash merged commit c68c266 into anza-xyz:master Dec 15, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants