sdk.pitpass.* methods of @0xmonaco/core. Each is a
thin useCallback wrapper that resolves the client from the MonacoProvider
context, so the request, validation, and casing behaviour are owned by the core
client. Import each hook directly from @0xmonaco/react.
useMyTraderCode
() => Promise<TraderCodeResponse>
Read the authenticated caller’s TraderCode identity. Requires authentication.Returns:
code: string - The permanent wallet-derived TraderCode (normalized wallet address)createdAt: string - RFC 3339 timestamp when the code row was first derivedcustomCode: string - The custom vanity handle exactly as entered, or""when the wallet-derived default is keptisCustom: boolean - True when a custom handle is setdisplay: string - The single human-facing string to render (custom handle when set, otherwise theMonaco - <address>default form)
useSetTraderCode
(code: string) => Promise<TraderCodeResponse>
Claim or edit the caller’s custom (vanity) TraderCode handle. Requires authentication.Parameters:
code: string - The custom handle. Validated client-side (letter-first[A-Za-z0-9_], length 5–20) and sent exactly as entered; casing is preserved
TraderCodeResponse shape as useMyTraderCode, reflecting the new custom handle.useClearTraderCode
() => Promise<TraderCodeResponse>
Clear the caller’s custom TraderCode handle, reverting to the wallet-derived
default. The freed handle enters a cooldown before it can be reclaimed.
Requires authentication.Returns: the
TraderCodeResponse shape, now with the wallet-derived default in effect.useTraderCodeAvailability
(code: string) => Promise<TraderCodeAvailabilityResponse>
Public, unauthenticated advisory check of whether a custom handle is available
(as-you-type UX). Advisory only — the authoritative gate is the atomic claim
in
useSetTraderCode, so a positive result is not a reservation.Parameters:code: string - The candidate custom handle
available: boolean - True when the handle passes validation and is neither live nor cooling downreason: “taken” | “too_short” | “too_long” | “reserved” | “invalid_char” | “looks_like_address” (optional) - Present only when unavailable
useTraderCodeInfo
(code: string) => Promise<TraderCodeInfoResponse>
Public lookup of a TraderCode by wallet address, used at sign-up to validate a
referral code before applying it. No authentication required.Parameters:
code: string - The bare wallet address or theMonaco - <address>display form
code: string - The resolved TraderCode (normalized wallet address)
useRewardsBalance
() => Promise<GetRewardsBalanceResponse>
Read the authenticated caller’s current PitPass rewards-bucket balances.
Requires authentication.Returns:
balances:{ token: string; available: string }[]- One entry per reward token with a non-zero available balance.availableis in RAW atomic units of the token
useTransferRewards
(params: TransferRewardsParams) => Promise<TransferRewardsResponse>
Transfer earned PitPass rewards into a tradeable balance. Parameters are
validated by the SDK core using Zod. Requires authentication.Parameters:
token: string - Reward token contract address (0x-prefixed) to transferamount: string - Amount to transfer, in RAW atomic units of the token (positive integer string)
rewardsBalance: string - Your rewards-bucket balance after the transfer, RAW atomic unitstradingBalance: string - Your trading balance for the token after the transfer, RAW atomic units
useMyReferralPosition
() => Promise<GetMyReferralPositionResponse>
Read the authenticated caller’s own referral position. Self-scoped — only ever returns your
own chain. Requires authentication.Returns:
referrer: string - Wallet address of your direct (L1) referrer, or""when you were not referredupline:{ wallet, display, level }[]- Your referral chain upward, nearest first (L1, L2, and so on), at most as many entries as PitPass rewards levels (never more than 10); empty when you were not referredreferrerDisplay: string - The referrer’s custom handle if claimed, otherwise the wallet addresstotalEarned: string - All-time rewards you have earned, RAW atomic unitsrewards:{ source, sourceDisplay, level, amount, token, rateApplied, createdAt }[]- Up to your 100 most recent reward rows (totalEarnedremains the complete aggregate);levelis 1 for a direct referee’s fills, 2 for their referee’s, and so on (at most 10)
useMyReferralDownline
(params?: { pageSize?: number; pageToken?: string }) => Promise<GetMyReferralDownlineResponse>
Read who you earn from and how much. Self-scoped, read-only. Requires authentication.
earningsBySource is paged. Called without params, it returns only the first page (up to 100 rows), not every row — follow nextPageToken until it is "" to read the rest.Parameters:pageSize?: number -earningsBySourcerows per page, 1-500 (default 100)pageToken?: string - OpaquenextPageTokenfrom the previous response; omit for the first page
earningsBySource:{ source, sourceDisplay, level, totalEarned, token }[]- One page of rows, one per(source, level, token)across every reward level, ordered by each source account’s total, largest first, so the same trader can appear more than once (different level or token);sourceis not unique. 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 it can appear again on a later pagedirectReferees:{ wallet, display, referredAt, totalEarned }[]- Your direct (L1) referees, including non-traders ("0"earned); up to the 500 most recent effective referees from a bounded scan, so a very large history may be incomplete (the earnings views stay complete)summary:{ totalEarned, byLevel, level1Earned, level2Earned, level3Earned }- Earnings broken down by level, covering every level and source regardless of the page.byLevelis{ level, earned }[](raw atomic units), ascending, one entry per level with earnings, including levels deeper than PitPass rewards today.level1Earned,level2Earned, andlevel3Earnedare deprecated (levels 1-3 only) - usebyLevelnextPageToken: string - Pass it back aspageTokenfor the next page;""when there are no more rows
ValidationError before sending when pageSize is outside 1-500; 400 for a malformed pageToken; 401 when unauthenticated; 429 when the account’s read budget is exhausted (retry after the interval in the error detail); 500 on a server erroruseMyReferralTree
(params?: GetMyReferralTreeParams) => Promise<GetMyReferralTreeResponse>
Read one level of your referral tree: your L1 referees when
parent is omitted, or the referees
of one of your own referees above the deepest rewarded level when it is set. Self-scoped, read-only. Requires authentication.Parameters:parent?: string - Wallet whose direct referees to list; any wallet that is not you or one of your referees above the deepest rewarded level returns 404pageSize?: number - Nodes per page, 1-200 (default 50)pageToken?: string -nextPageTokenfrom the previous page (sameparent)
parent: string - The wallet whose referees are listedparentLevel: number -0for you,1-9for an expanded refereenodes:{ wallet, display, level, parent, referredAt, refereeCount, totalEarned }[]- Newest first;levelis the depth below you (1-10); expand a node whenrefereeCount > 0(always 0 at the deepest rewarded level);totalEarnedis what you earned from that wallet’s own tradesnextPageToken: string - Cursor for the next page,""on the last page

