Skip to content

[JS] Add Scaled UI Amount Extension Support #267

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

Merged
merged 9 commits into from
Mar 11, 2025

Conversation

gitteri
Copy link
Contributor

@gitteri gitteri commented Mar 5, 2025

Add Scaled UI Amount Extension Support

This PR adds support for the Scaled UI Amount extension to the Token-2022 program, including IDL updates, generated client libraries, and tests. This is a prerequisite to being able to add additional helpers for the scaled ui amount extension.

Changes

IDL Updates

  • Added ScaledUiAmountConfig extension to the IDL schema
  • Added fields for:
    • authority: The account authorized to update the multiplier
    • multiplier: The current scaling multiplier
    • newMultiplier: The next multiplier to be applied
    • newMultiplierEffectiveTimestamp: When the new multiplier takes effect

Generated Client Libraries

  • Added initializeScaledUiAmountMint instruction
  • Added updateMultiplierScaledUiMint instruction
  • Generated TypeScript types and codecs for the new extension

Tests

  • Added test coverage for initializing a mint with scaled UI amount extension
  • Added test coverage for updating the multiplier
  • Verified extension state and multiplier updates work correctly

Copy link
Member

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like CI isn't passing because:

  • It identifies some changes when running pnpm generate. The fix here is to run pnpm generate again locally and commit the changes.
  • For some reason, the new generated code use @solana/web3.js instead of @solana/kit (renamed like 2 days ago). My hunch is that your local nodes_module still use an old version of Codama and doing pnpm install before generating should fix it.

Copy link
Member

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you! 🍺

@joncinque joncinque merged commit b038b5e into solana-program:main Mar 11, 2025
19 of 20 checks passed
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

Successfully merging this pull request may close these issues.

3 participants