-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[token-js] : Support for UiAmountToAmount and AmountToUiAmount instructions #3345
[token-js] : Support for UiAmountToAmount and AmountToUiAmount instructions #3345
Conversation
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 is in pretty good shape already! Just some notes and questions to make this ready. Also, be sure to run yarn lint
or yarn lint:fix
to get the formatting standard and fix the lint errors
6cbfdad
to
fa4551e
Compare
if (!instruction.programId.equals(programId)) throw new TokenInvalidInstructionProgramError(); | ||
const uiAmountToAmountInstructionData = struct<UiAmountToAmountInstructionData>([ | ||
u8('instruction'), | ||
blob(instruction.data.length - 1, 'amount'), |
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.
Since length would be depending on the size of amount string , for decoding I assigned it data.length -1 , since u8 instruction would be taking 1 size. I checked that it is decoding correctly, is it fine or is there some better way for this
}: TransactionInstruction): DecodedUiAmountToAmountInstructionUnchecked { | ||
const uiAmountToAmountInstructionData = struct<UiAmountToAmountInstructionData>([ | ||
u8('instruction'), | ||
blob(data.length - 1, 'amount'), |
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.
same here
@joncinque is the test failing because of upgrading @solana/web3.js ? |
@atharmohammad Ah yeah, that's an annoying bug -- since two packages depend on I should have noticed it earlier, but you'll also need to commit the change to |
fa4551e
to
c26fc79
Compare
@joncinque So i have resolved web3 conflict issue, now i think test are failing because solana version for ci is |
@atharmohammad you're correct -- I thought we had backported those changes to 1.10, but it isn't the case. We'll upgrade SPL to 1.11 once the release branch gets branched off of master, so not just yet. Which means we'll need to hold off on this a little bit longer. |
@atharmohammad master is now on 1.11.6 |
3105033
to
75962d5
Compare
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 great, just two little things, then we can get this merged!
The resolved conflicts in this PR undo a bunch of the changes from #3508. This will need to be rebased against the current master. |
bfdbc71
to
c39875a
Compare
c39875a
to
d232e55
Compare
@jordansexton was the rebase done correctly? Because otherwise this is ready to go from my side |
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.
Thanks for rebasing! I added a commit to fix the .js file extensions in the imports and exports in the new code, and organize the imports. I just have one question about the web3.js version.
I'll release to npm tomorrow! Thanks for this! |
Published: @solana/spl-token@0.3.3 |
This PR adds :
1). support for
amount to uiamount
instruction2). support for
uiamount to amount
instruction3). upgrades solana/web3 from 1.41.0 to 1.47.4
4). e2e test for instructions
fixes #3264
cc : @joncinque