amount. Show the user that amount scaled by the mint’s ScaledUiAmount multiplier.
1
Set Up
Imports, env config, and the user wallet used across every step.
Imports, env, and wallet address
Imports, env, and wallet address
2
Fetch the Equity Mints
Fetch the supported equities and index them by mint.
Fetch the equity mints
Fetch the equity mints
3
Read Each Mint's Token Program
Read each mint account’s owner to find the token program that holds its balances.
Read each mint's token program
Read each mint's token program
4
Fetch the User's Equity Token Accounts
With
Display
jsonParsed encoding, the RPC returns the raw amount and a uiAmountString that already applies the mint’s current multiplier.Fetch the user's token accounts
Fetch the user's token accounts
uiAmountString, and pass the raw amount as the order endpoint’s amount to sell a full balance.5
Compute the Scaled UI Amount from the Mint
The token program uses
newMultiplier from newMultiplierEffectiveTimestamp onward and multiplier before it, and truncates the scaled amount before dividing by 10^decimals.Compute the scaled UI amount
Compute the scaled UI amount