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

setTransactionMessageFeePayer() does not delete signer if one is present. #2899

Open
steveluscher opened this issue Jun 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@steveluscher
Copy link
Collaborator

Overview

Presume that you have a TransactionMessage with a feePayerSigner. If the fee payer address changes, setTransactionMessageFeePayer() won't blank out the pre-existing feePayerSigner.

Description of bug

This may cause problems if I go from:

  • Loris(A)/Phantom, to
  • Loris(B)/NO_SIGNER

The Phantom feePayerSigner will still be on the message.

@steveluscher steveluscher added the bug Something isn't working label Jun 30, 2024
@steveluscher
Copy link
Collaborator Author

steveluscher commented Jun 30, 2024

We could fix this once and for all by making feePayer a discriminated union.

export interface ITransactionMessageWithFeePayer<TAddress extends string = string> {
    readonly feePayer: Readonly<{__type: 'address', address: Address<TAddress>}>;
}
export interface ITransactionMessageWithFeePayerSigner<
    TAddress extends string = string,
    TSigner extends TransactionSigner<TAddress> = TransactionSigner<TAddress>,
> {
    readonly feePayer: Readonly<{__type: 'signer'}> & TSigner;
}

That would be a whole bunch of surgery, but we'd end up with something that always had address on it as we have now, no matter if it was a signer or not, and the decision of whether to overwrite it could involve checking that the two __type properties match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants