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

Instruction Impl Type Inconsistency: Builder vs Unmarshal #222

Open
lukestoltenberg opened this issue Jun 20, 2024 · 0 comments
Open

Instruction Impl Type Inconsistency: Builder vs Unmarshal #222

lukestoltenberg opened this issue Jun 20, 2024 · 0 comments

Comments

@lukestoltenberg
Copy link

When unmarshalling a transaction from []byte it creates a pointer to the instruction's BaseVariant.Impl but when creating a token.Instruction using a builder like token.NewMintToCheckedInstructionBuilder() the BaseVariant.Impl is a value.

For example, token.NewMintToCheckedInstructionBuilder(), the .Build() sets the BaseVariant.Impl to the receiver value of inst MintToChecked

When using UnmarshalBin of a []byte, it sets the BaseVariant.Impl to a pointer, https://github.com/gagliardetto/binary/blob/79f49c5de0e11369897085d761a7e27cbd8eab15/variant.go#L320.

To fix this, I propose changing the instructions' .Build() to take a pointer receiver

func (inst *MintToChecked) Build() *Instruction
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

No branches or pull requests

1 participant