Surface Map
Concepts
Capture a Referral at Sign-In
Forward the referral code (for example from a?ref=CODE URL parameter) as referralCode on auth verify. Use sdk.auth.authenticate(clientId, code); sdk.login does not forward a referral code.
- A referral never blocks sign-in; an invalid code or self-referral is silently ignored.
- A referral is recorded once, at first sign-up. A wallet keeps its first referrer: a later sign-up (on any client application) with a different referrer’s code records nothing, and the verify response reports
referralNotAppliedReason: REFERRAL_NOT_APPLIED_REASON_ALREADY_REFERRED. A later sign-up with the same referrer’s code is recorded as usual.
Show a User’s TraderCode
getMyTraderCode never returns 404 for a signed-in wallet. Render display; it reflects any custom handle. Embed code in referral links (?ref=<code>).
customCode holds it as entered, isCustom is true, and display is the handle.
Claim a Custom Handle
Rules: letter-first,[A-Za-z0-9_], 5–20 characters, casing preserved, unique case-insensitively.
The availability check (
GET /api/v1/tradercodes/codes/available?code=...) is advisory and rate-limited (429 past the allowance). setTraderCode is the authoritative gate.
Read Referral State
Authenticated; return only your own chain. Other users appear as wallet address plusdisplay (custom handle when claimed), never an internal id.
Downline paging. Pass
pageSize (1–500, default 100) and pageToken (the previous nextPageToken) as SDK params or query parameters. Without them you get only the first page; repeat until nextPageToken is "". A wallet that traded through several applications is merged within a page at its first part’s position, so a merged row can sit below a smaller one and the wallet can reappear on a later page. summary always covers every level and source: summary.byLevel lists { level, earned } (raw atomic units), ascending, for each level with earnings, including levels deeper than currently rewarded. summary.level1Earned, level2Earned, and level3Earned are deprecated (levels 1–3 only); use byLevel.
level, parent, referredAt, refereeCount (expandable when above 0; always 0 at the deepest rewarded level), and totalEarned (what you earned from that wallet’s own trades). Pages hold up to 200 nodes (default 50) with a nextPageToken. Your L1 referees are always listed, and each wallet appears once, under the referrer that earns from it. A parent that is not you or one of your referees above the deepest rewarded level returns 404.
Check Rewards Balance
Returns one entry per reward token; an empty list when nothing is earned yet.available is in raw atomic units: divide by the token’s decimals (10^6 for USDC).
Transfer Rewards to a Trading Balance
Moves rewards into the authenticated application’s trading balance. Ledger-only: no on-chain transaction or gas, tradeable immediately.amount: positive integer string, raw atomic units.
- Returns the remaining
rewardsBalanceand the newtradingBalancefor the token. 409: amount exceeds the available rewards balance; refresh and show the current amount.- Each call spends the per-user movement budget shared with withdrawals and collateral transfers, whatever the rewards balance; past it the answer is
429withRetry-Afteronce that budget is enforced.
Reward Rates
Monaco configures the rewarded depth (1 to 10 levels) and a rate per level, optionally per client application.- Every level takes its rate of the same reward base for the fill; levels do not compound. All rates together never exceed 100% of that base.
- Rewards are computed at fill time and credited instantly. Each reward row records the
rateApplied. - Levels beyond the end of a shorter chain are not paid.
- Configuration changes apply to future fills only. Rewards earned at a level deeper than the current depth stay readable in reward history,
earningsBySource, andsummary.byLevel.
Related References
- Auth: full sign-in flow
- TypeScript TraderCodes SDK: method signatures
- REST schemas: Get your TraderCode, Look up a TraderCode, Get rewards balance, Transfer rewards

