Overview
A sell converts the user’s$GOLD tokens back into USDC on Solana. The flow and signer set are identical to Buying Gold — the only differences are the endpoint (/v1/sell) and the input/output fields (you specify gold_amount instead of usdc_amount; min_usdc_out replaces min_gold_out).
Because everything else is the same — three signers, blockhash TTL, stateless quote, indexer-driven row writes — this guide focuses on the differences.
Signers
Same as buy: GRAIL + partner + user. Three signatures required.Step 1 — Quote
Sell-specific input fields
| Field | Required | Notes |
|---|---|---|
gold_amount | yes | $GOLD tokens to sell (human decimal). |
slippage_bps | no | Default 50 (0.5%). Ignored if min_usdc_out is set. |
min_usdc_out | no | Absolute USDC floor. Overrides slippage_bps when provided. |
Sell-specific fee note
The quote’sfee_bps often differs from a buy quote — on-chain inti uses separate market_open_fee_bps and market_close_fee_bps values, with the applicable side depending on market state. A partner’s IntegratorV2 on-chain config can also have a market_fee_override that forces one or the other. You don’t need to manage this — GRAIL reads the effective rate from the partner’s on-chain config when it builds the quote.
Step 2 — Co-sign with partner + user
Identical to buy:Step 3 — Submit
Step 4 — Wait and fetch
side: "sell". usdc_amount is the output, gold_amount is the input.
End-to-end script
Same as the buy reference script in Buying Gold, with two changes:- Quote endpoint →
/v1/sell - Quote body →
{"grail_user_id":"...", "gold_amount":0.01, "slippage_bps":50}
/v1/sell/$TRADE_ID/submit), indexer polling — is identical.
