rwa_market instructions, reading the price from the Asset
account and the settlement mint from the token’s TokenMeta. The full IDL JSON files
(loadable with Anchor’s Program) are the ground truth; below is the trader-facing
subset. All prices are integer USD cents (price_cents).
Read the price — Asset account
The Asset PDA (["asset", mint]) holds everything you quote against:
price_cents— USD cents per whole token.fee_bps— fee in basis points taken off your trade.is_active— whether trading is currently enabled.max_per_tx/max_per_user— trade-size caps (0= unlimited).
Trade — buy / sell
Trades are non-custodial — your wallet signs, and the vault side moves automatically
via a pre-authorized delegate. Both
buy and sell use the same Trade account
context:
trader(signer) — your walletassetPDA —["asset", mint]rwa_mint,payout_mint- the vault’s RWA + payout token accounts (ATAs owned by the vault PDA)
- your RWA + payout token accounts (ATAs)
- both token programs (SPL Token + Token-2022)
Trade math
The amounts are computed inu128:
proceeds + fee (capped by max_cost); on a sell you receive
proceeds - fee (floored by min_proceeds).
Read the settlement token — TokenMeta
Before trading, read payout_token (and decimals) from the token’s TokenMeta PDA
(["meta", mint]) so you know which mint you’re spending/receiving and how to scale
amounts.
Redemption — rwa_exit.claim
At end-of-life the asset admin freezes a final price and opens claims. Redemption is
claim-based — you pull your principal:
The
ExitState PDA (["exit", mint]) exposes final_price_cents, initiated, and
completed so you can check whether claiming is open. Payout math matches trading:
amount * final_price_cents * 10^payout_dec / (100 * 10^rwa_dec).
Download the IDLs
The IDL JSON files are the complete, machine-readable contract surface — the ground truth for every instruction, account, and type. Download the ones you need and load them with Anchor’sProgram. Each program id is embedded in the IDL’s address field, so you
don’t need to hard-code it.
rwa_market.json
Trading —
buy / sell, the Asset account.rwa_token.json
Asset terms & the
TokenMeta account (payout_token, decimals).rwa_exit.json
Redemption —
claim, the ExitState account.rwa_vault.json
The vault accounts a trade touches.
Loading the IDL (Anchor)
Save the file you downloaded above into your project (e.g../idl/) and import it:
