-
Notifications
You must be signed in to change notification settings - Fork 473
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
Sdk updates for proposed 1.1 spec #197
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Looks good! I'm going to do another round of review on the spec itself.
/** | ||
* Fields of a Solana Pay message sign request URL. | ||
*/ | ||
export interface MessageSignRequestURLFields { |
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.
I think this type can be (structurally) the same as TransactionRequestURLFields
, right? Label and message can still be used.
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.
I think maybe we should rename the type of request to a Sign Message Request
in the spec and here.
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.
They can still be used, but it seems a bit confusing because wallets would presumably ignore them. Both fields are not inputs in the spec, and are also fields in server responses which I think makes it more confusing. We do already have this problem with transaction requests - I just wasn't sure whether it was a good idea to do the same here, and thought it might be better to move toward removing the fields from transaction request in the SDK instead.
Renaming to Sign Message Request
sounds good to me, seems a bit more natural!
link, | ||
label, | ||
message, | ||
}: TransactionRequestURLFields | (MessageSignRequestURLFields & { label: undefined; message: undefined })): URL { |
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 can also be simplified if we allow those fields.
Marking as draft because we'll want to coordinate this release so we don't confuse application developers. Maybe a 1.1 or alpha branch?
This PR adds the spec changes to support the proposed/alpha 1.1 spec
MessageSignRequestURLFields
is added with just alink
field. InternallyencodeURL
encodes it in the same way as a transaction requestNotes:
label
andmessage
fields ofTransactionRequestURLFields
? They're not in the spec and I haven't included them in the fields for message signing requests. I think they're superseded bylabel
in the GET response, andmessage
in the POST response. If we eventually remove them we could simplify the encoding since transaction request and message signing request would be the same structure.encodeTransactionOrMessageSignRequestURL
is kinda hacky, but we can't differentiateTransactionRequestURLFields
fromMessageSignRequestURLFields
at a typescript level