-
Notifications
You must be signed in to change notification settings - Fork 13
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 supporting Versioned Transaction signing #9
Add supporting Versioned Transaction signing #9
Conversation
…d for VersionedTransaction
params: { ...legacyTransaction, transaction: rawTransaction }, | ||
}, |
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.
Hmm, why are the transaction properties passed as params? I realize this isn't a change from how it's currently being done, but the transaction bytes are all that should be needed, right?
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.
@jordansexton It was old way of doing this implemented by WalletConnect. So we are keeping for backward compatibility and introducing a new way that could support both legacy and v0 transactions.
request: { | ||
method: WalletConnectRPCMethods.signTransaction, | ||
params: { transaction: rawTransaction }, | ||
}, |
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 whole block looks identical to the same request for the legacy
transaction, i'd suggest combining the two blocks and just create the parameters differently depending on the incoming transaction
topic: this._session.topic, | ||
request: { | ||
method: WalletConnectRPCMethods.signTransaction, | ||
params: { ...transaction, transaction: rawTransaction }, |
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.
the previous version did not require an explicit serialization of the transaction, is there a particular reason why that's needed for the existing non-versioned transactions?
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.
@jnwng Versioned Transaction and legacy Transaction have completely different set of properties. Passing non-serialized transaction will require to create different methods for the future changes of Transaction class.
Also it makes its much harder to consume deconstructed transactions on the wallet side.
To make API future proof and easy to use we believe that moving to serialized transaction is a better approach, which is similar to approach of Solana Pay.
request: { | ||
method: WalletConnectRPCMethods.signTransaction, | ||
params: { | ||
...legacyTransaction, // Legacy sign transaction request format |
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.
@bergusman make a comment here. That it is deprecated and in the future versions only transaction will be sent.
if (transaction.version === 'legacy') { | ||
// Build Transaction for legacy sign transaction request format | ||
legacyTransaction = Transaction.from(transaction.serialize()); | ||
} else { |
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.
@bergusman @jnwng This "else" block I think should be completely removed.
We can't create legacy transaction from non-legacy one. So legacyTransaction should be undefined here.
Add field
transaction
forsolana_signTransaction
method with serialized transaction.For 0 and next version of transaction used only
transaction
parameter.For
Transaction
and legacyVersionedTransaction
put old WalletConnect specification parameters and newtransaction
parameter.Updated @solana/web3.js to 1.63.0 version to support
addSignature
forVersionedTransaction
.