Profile Data
() => Promise<UserProfile>
Retrieve the authenticated user’s core profile metadata.Returns:
id: Unique user identifieraddress: Wallet addressusername: Display name (nullable)accountType: Account type (e.g."master")canWithdraw: Whether the account can withdraw fundstakerFeeBps: Deprecated. Flat taker fee rate in basis points; echoes the pre-tiered pair-level rate, not the per-user tiered fee. Usefees.getMyFeeTierfor the caller’s real ratemakerFeeBps: Deprecated. Flat maker fee rate in basis points; echoes the pre-tiered pair-level rate, not the per-user tiered fee. Usefees.getMyFeeTierfor the caller’s real rateapplicationTakerFeeBps: Additional taker fee in basis points contributed by the application, if any (optional)applicationMakerFeeBps: Additional maker fee in basis points contributed by the application, if any (optional)createdAt: Account creation timestamp (ISO 8601)
Token Balances
(params?) => Promise<GetUserBalancesResponse>
Fetch paginated token balances for the authenticated userParameters:
page(optional): Page number, starts from 1 (default: 1)pageSize(optional): Number of items per page, max 100 (default: 20)
balances: Array of AccountBalance objectspage: Current page numberpageSize: Items per pagetotal: Total number of balancestotalPages: Total number of pages
(assetId: string) => Promise<AccountBalance>
Get the user’s balance for a specific asset by its UUIDParameters:
assetId: Asset UUID (e.g., ‘123e4567-e89b-12d3-a456-426614174000’)
token: Token contract addresssymbol: Token symboldecimals: Token decimal placesavailableBalance: Available balance for tradinglockedBalance: Balance locked in orderstotalBalance: Total balance (available + locked)version(optional): Opaque, non-negative spot-row revision. Compare only for the same authenticated user, application, and token; higher is newer. Absent and 0 both mean unranked and never participate in ordering: the row predates this field or came from a producer that does not stamp it, so normalize both to the same thing and fall back to a full field comparison rather than ranking an unranked row as oldest. A server mid-rolling-deploy sends no key at all, andundefined <= nis false, so an un-normalized guard silently passes.
Transaction History
(params?) => Promise<GetPaginatedUserMovementsResponse>
Fetch paginated ledger history — deposits, withdrawals, trades, fees, funding payments, liquidations, interest, rewards, and collateral transfers — with optional server-side filteringParameters:
page(optional): Page number, starts from 1 (default: 1)pageSize(optional): Number of items per page, max 100 (default: 20)entryType(optional): Filter by entry type —LedgerEntryType:"CREDIT","DEBIT","LOCK","UNLOCK","FEE"transactionType(optional): Filter by transaction type —TransactionType:"DEPOSIT","WITHDRAWAL","TRADE","FEE","FUNDING","LIQUIDATION","INTEREST","REWARD". Filter values and returned values are both upper-case (a funding row reportstransactionType: "FUNDING",entryType: "DEBIT" | "CREDIT"), and the server matches the filter case-insensitively. The lower-case forms are the livemovementsWebSocket shape, not this oneassetId(optional): Filter by asset UUID
movements: Array ofLedgerMovementobjects. Afundingrow is a collateral USD delta rather than a token transfer:amountis a magnitude with the direction inentryType,decimalsis0, andamountRawequalsamount. It shares itsidwith the livemovementsWebSocket frame, so dedupe byidacross the two feeds — but the two payloads are not identical: the REST row is upper-case and resolvesassetId,symbolanddecimals— falling back to the pair’s quote asset when the margin account’s collateral binding is unset, so these carry a real asset rather than a placeholder, while the WebSocket frame is lower-case and carries no resolved asset id. See Account Balancespage: Current page numberpageSize: Items per pagetotal: Total number of movementstotalPages: Total number of pages
Portfolio Analytics
Portfolio analytics are documented on the Portfolio Analytics page. That page covers the authoritativesdk.portfolio methods as well as the older sdk.profile.getPortfolioStats and sdk.profile.getPortfolioChart.
Trade History
(params?) => Promise<GetUserTradesResponse>
Fetch trade history for the authenticated user, cursor-paginated by default. Legacy page-number (offset) pagination is deprecated but still available by passing
page.Parameters: all optionalpageSize: Number of items per page (default: 20); max 1000 in cursor mode (the default), max 100 in legacy page-number modetradingPairId: Filter by trading pair UUIDpageToken: Pagination cursor:- omitted — the SDK starts a cursor walk (
pageToken=""), unless the deprecatedpagewas passed ""(empty string) — start a cursor walk over full trade history (hot and archived rows merged), newest first- a previous
nextPageToken— resume the walk from that cursor
- omitted — the SDK starts a cursor walk (
page: deprecated — legacy page-number pagination over the recent hot window only; ignored wheneverpageTokenis present
trades: Array ofUserTradeobjectspageSize: Items per pagenextPageToken: Cursor for the next page — non-empty whenever a page returns rows, empty when the walk is exhausted or in legacy page-number modepage,total,totalPages: deprecated — legacy page-number mode only;0in cursor mode. In page-number mode the counts are exact up to the pagination reach and saturate there (totalatpageSize× 10,000 rows,totalPagesat 10,000 pages), andpageitself is capped at 10,000. Cursor mode has no total — build “load more” UIs onnextPageTokeninstead of “page N of M”.
UserTrade fields:tradeId: Trade unique identifiertradingPairId: Trading pair UUIDprice: Execution price (normalized string)quantity: Executed quantity (normalized string)quoteVolume: Price × quantity (normalized string)side:"BUY"or"SELL"from the user’s perspectivefee: Fee paid for this trade (normalized string)executedAt: Trade execution timestamp (ISO 8601)
(params?) => AsyncGenerator<UserTrade>
Walk full trade history with cursor pagination, yielding one trade at a time. Accepts
tradingPairId and pageSize; the cursor is managed internally.Funding Payments
(params?) => Promise<ListFundingPaymentsResponse>
Fetch the authenticated user’s funding payment history for margin positions, with pagination and optional filters.Parameters:
page(optional): Page number, starts from 1 (default: 1)pageSize(optional): Number of items per page, max 100 (default: 20)tradingPairId(optional): Filter by trading pair UUIDpositionId(optional): Filter by margin position UUIDmarginAccountId(optional): Filter by margin account UUID
records: Array ofFundingPaymentobjectstotal: Total number of matching recordspage: Current page numberpageSize: Items per pagetotalPages: Total number of pages
FundingPayment fields:id: Funding payment UUIDpositionId: Margin position UUIDmarginAccountId: Margin account UUIDtradingPairId: Trading pair UUIDfundingRate: Funding rate applied for the epoch (normalized string)positionSize: Absolute position size at settlement (normalized string)paymentAmount: Signed funding amount; positive means paid, negative means received (normalized string)direction:"PAID"or"RECEIVED"periodStart: Funding window start timestamp (ISO 8601, optional)periodEnd: Funding window end timestamp (ISO 8601, optional)createdAt: Funding payment creation timestamp (ISO 8601, optional)
Self-Trade Prevention Default
() => Promise<SelfTradePreventionDefault>
Read the wallet’s self-trade-prevention default — the mode the matching engine applies to an order that does not carry its own
selfTradePreventionMode.Returns:mode:"CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP"— the effective modeisCustom: boolean —truewhen this wallet explicitly set a default,falsewhen the platform defaultCANCEL_MAKERis being inherited
setSelfTradePreventionDefault can briefly lag that call’s own response.Throws:- REST
400/ gRPCInvalidArgumentwhen the authenticated session’s wallet is not a canonical EVM address (0x+ 40 hex) — the setting is keyed by wallet, so a legacy non-EVM session has none to read - REST
401/ gRPCUnauthenticatedwhen authentication is missing or invalid - REST
403/ gRPCPermissionDeniedwhen a delegated-agent session calls it — an agent can neither read nor set this default - REST
429/ gRPCResourceExhaustedonce read-budget enforcement is enabled: this is an authenticated read and draws your account’s shared read budget, with the retry interval on the body’sdetails.retryAfteror a gRPCRetryInfodetail. See Rate limits - REST
500/ gRPCInternalfor an internal failure
(mode: SelfTradePreventionMode) => Promise<SelfTradePreventionDefault>
Set the wallet’s self-trade-prevention default. See Self-Trade Prevention for what each mode does.Parameters:
mode:"CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP"— the SDK validates against these exact uppercase tokens and throws before sending, so pass them verbatim. The lowercase forms the server would accept never reach it
getSelfTradePreventionDefault.The write is sequenced through the matching engine and returns only after the durable append, so the wallet’s next order already resolves the new mode. A per-order selfTradePreventionMode always overrides this default.The call sets the mode outright rather than applying a delta, so sending the same mode again is safe and a retry after a lost response cannot land a different value than the one you asked for. Concurrent sets for one wallet are last-write-wins in sequencer order, so serialize them per wallet if the final mode matters, and re-read with getSelfTradePreventionDefault after a transient failure rather than assuming the write was lost.Throws:ValidationError(exported by@0xmonaco/types) whenmodeis not one of the four tokens — thrown before any network request- REST
400/ gRPCInvalidArgumentwhen a raw caller sends an unknown mode, or when the authenticated session’s wallet is not a canonical EVM address (0x+ 40 hex) - REST
401/ gRPCUnauthenticatedwhen authentication is missing or invalid - REST
403/ gRPCPermissionDeniedwhen a delegated-agent session attempts the change - REST
500/ gRPCInternalfor an internal failure - REST
503/ gRPCUnavailablewhen the matching engine is unreachable or the sequenced write fails transiently. Do not read it as proof the setting is unchanged — the outcome is unknown:is_transient_me_failurealso classifiesDeadlineExceededandCancelledas transient, so the sequenced write may have committed before the response was lost. Re-read with the getter, or simply retry the samemode— the call sets an absolute value, so a replay cannot land anything other than what you asked for
Sub-Accounts
Manage a master account’s sub-accounts and their per-asset spending limits. All methods are session-authenticated. The limit mutations (createLimit,
updateLimit, deleteLimit) additionally require the master account to hold the
ManageSubAccounts permission — enforced server-side, so a non-master or
unpermissioned caller receives a 403.
() => Promise<ListSubAccountsResponse>
List the authenticated master account’s sub-accounts with their balances.Returns:
subAccounts: Array ofSubAccountobjects, each withid,address,username(nullable),canWithdraw,createdAt, andbalances(array ofAccountBalance)total: Total number of sub-accounts
(body: CreateSubAccountLimitRequest) => Promise<CreateSubAccountLimitResponse>
Create a per-asset spending limit on a sub-account. Requires the
ManageSubAccounts permission.Body:subAccountId: Sub-account UUID to create the limit forassetId: Asset UUID to limitmaxAmount: Maximum amount allowed, in token units (string)dailyLimit(optional): Maximum daily spending limit, in token units (string)
{ limit } — the created SubAccountLimit.(subAccountId: string) => Promise<GetSubAccountLimitsResponse>
Get the limits configured for a sub-account.Parameters:
subAccountId: Sub-account UUID
{ limits } — array of SubAccountLimit objects.(subAccountId: string, assetId: string, body: UpdateSubAccountLimitBody) => Promise<UpdateSubAccountLimitResponse>
Partially update a sub-account’s per-asset limit. Requires the
ManageSubAccounts permission. The sub-account and asset are taken from the path; all body fields are optional.Parameters:subAccountId: Sub-account UUIDassetId: Asset UUID
maxAmount: New maximum amount, in token units (string)dailyLimit: New maximum daily spending limit, in token units (string)isActive: Whether the limit is active
{ limit } — the updated SubAccountLimit.(subAccountId: string, assetId: string) => Promise<void>
Delete a sub-account’s per-asset limit. Requires the
ManageSubAccounts permission. Resolves with no value.Parameters:subAccountId: Sub-account UUIDassetId: Asset UUID
Faucet
(params: MintTokensParams) => Promise<MintTokensResponse>
Mint the full set of testnet tokens to the authenticated user. Testnet-only, session-authenticated, and rate-limited per user (default 1 request / 24h). Performs real on-chain mints and resolves only when every token confirms on-chain; it throws on
429 (quota exhausted), 502 (mints failed or only partially confirmed — the error carries the minted/failed breakdown), or 503 (faucet unavailable, safe to retry). Wrap the call in a try/catch.Parameters:turnstileToken: string (required) - Cloudflare Turnstile captcha token. Requests without a valid token are rejected with400.
minted: Array of confirmed minted tokens, each withassetId,symbol,amount,txHash. A mint credits spot and margin separately, so a token can appear twice — once asUSDCand once asUSDC (margin)failed: Array of tokens that failed to mint (assetId,symbol,error); empty on a successful resolve — populated on the thrown502error insteadremainingRequests24h: Remaining faucet requests in the next 24h

