What Is the Scaled UI Amount Extension?
The Token Extension Program’sScaledUiAmount mint extension lets a mint
apply an updatable multiplier to the UI amount displayed for token balances.
This is useful when a token represents a real-world asset or instrument, such as
a stock split or dividend. For example, a stock split doubles the number of
shares for all holders. Without changing every token account balance,
ScaledUiAmount lets wallets and applications display a new UI amount using
the mint’s multiplier.
This feature can also be used for dividends or distributing yield.
No new tokens are created. The token amount stored in token accounts stays the
same. Only the displayed UI amount changes.
Incompatible ExtensionDo not enable
ScaledUiAmount and InterestBearingConfig on the same
mint. The Token Extension Program rejects that extension combination.How Scaled UI Amount Works
ScaledUiAmountConfigstores the update authority,multiplier,new_multiplier, andnew_multiplier_effective_timestamp.- Before
new_multiplier_effective_timestamp, conversions usemultiplier. At or after that timestamp, conversions usenew_multiplier. UpdateMultipliercan apply a new multiplier immediately or schedule it for a future Unix timestamp.AmountToUiAmount,UiAmountToAmount, and the extension conversion helpers use floating-point arithmetic for scaled UI amount mints, so conversions are not guaranteed to round-trip exactly.
Before you start
The examples on this page run against a local validator athttp://localhost:8899 (WebSocket ws://localhost:8900) and fund their
accounts with airdrops from it. Start one in a separate terminal with
Surfpool (surfpool start) or
solana-test-validator.
Each code section below lists the packages or crates it needs. The TypeScript
examples use top-level await, so run them as ES modules, for example with
npx tsx index.ts in a project whose package.json sets "type": "module".
How to Use Scaled UI Amount
To use scaled UI amount:- Calculate the mint account size and rent needed for the mint and the
ScaledUiAmountextension. - Create the mint account with
CreateAccount, initializeScaledUiAmount, and initialize the mint withInitializeMint. - Use
AmountToUiAmount,UiAmountToAmount, or client helpers when displaying balances or converting UI amounts. - Use
UpdateMultiplierto update the displayed multiplier immediately or at a future Unix timestamp.
Instruction Order
ScaledUiAmountMintInstruction::Initialize must come before
InitializeMint. CreateAccount,
ScaledUiAmountMintInstruction::Initialize, and InitializeMint must
be included in the same transaction.Guides
Issuer Guide
Create a mint with Scaled UI Amount and update the multiplier over time.
Integration Guide
Convert token amounts for display and support Scaled UI Amount in wallets
and applications.
Source Reference
| Item | Description | Source |
|---|---|---|
ScaledUiAmountConfig | Mint extension state that stores the authority, current multiplier, next multiplier, and the timestamp when it takes effect. | Source |
ScaledUiAmountMintInstruction::Initialize | Instruction that initializes ScaledUiAmount on a mint before InitializeMint. | Source |
ScaledUiAmountMintInstruction::UpdateMultiplier | Instruction that sets a new multiplier and the Unix timestamp when it takes effect. | Source |
amount_to_ui_amount | Helper that converts a token amount to a UI amount string using the current multiplier, decimals, and timestamp. | Source |
try_ui_amount_into_amount | Helper that converts a UI amount string back into a token amount using the current multiplier, decimals, and timestamp. | Source |
process_initialize | Processor that initializes ScaledUiAmountConfig and stores the initial multiplier on an uninitialized mint. | Source |
process_update_multiplier | Processor that validates the authority, updates the scheduled multiplier, and applies it immediately when appropriate. | Source |
process_amount_to_ui_amount | Token program conversion path that uses ScaledUiAmountConfig when a mint has the extension enabled. | Source |
process_ui_amount_to_amount | Token program conversion path that converts a UI amount back into a token amount for scaled UI amount mints. | Source |
Kit
These examples use the generated Token-2022 instructions directly.Terminal
Instructions
Web3.js v3
These examples use the class-based@solana/web3.js v3 API with
@solana-program instruction builders.
Terminal
Instructions
Rust
Add these dependencies toCargo.toml (tested with Rust 1.89, 1.98, and 1.99):
Cargo.toml
Rust
Web3.js (legacy)
These examples use legacy@solana/web3.js with @solana/spl-token.
@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide to keep the class-based API.To run this code, install 1.x with npm install @solana/web3.js@1. A plain npm install @solana/web3.js installs v3, which this code doesn’t run on.Terminal
Instructions