getUserListingMarkets
Fetch a page of Your Pools — the listing markets that generated a deposit address for the signed-in user, whether or not they have deposited into them yet. It is the authenticated twin of getListingMarkets: the same catalog rows, enriched with the caller’s own position in each pool.
import { getUserListingMarkets, ListingMarketStatus } from "@symmio/trading-core";
const page = await getUserListingMarkets(config, {
accessToken: token.accessToken,
marketStatus: ListingMarketStatus.LISTED,
sortBy: "tvl",
orderBy: "desc",
limit: 50,
});Each row is a UserListingMarket — a ListingMarket plus userDeposit, userSharePercentage, and userRevenue. A pool appears here once it has minted a deposit address for the user, so the list includes pools the user has been allocated but not yet funded; userDeposit is then null.
This is a REST read against the listing backend, not a contract call, and it is authed: the accessToken from
authenticateListing is sent as an Authorization: Bearer <token> header. The backend is
resolved from the config before the request, so a target without Pools fails immediately and without any network
traffic — see resolveListingService.
The access token
accessToken is the one required parameter — the endpoint returns nothing without it. Mint it once with authenticateListing (the SIWE exchange), hold it, and pass it on every call.
The token is a credential, not a cache dimension. getUserListingMarketsQueryKey deliberately drops accessToken
before hashing, so refreshing an expired token still hits the same cache entry and the secret never leaks into a
devtools-visible key. A bad or expired token comes back as a 401 (see Throws) — refresh it and retry, do
not vary the query key on it.
Parameters
accessToken is required; every other field is optional and shares the exact search, filter, sort, and pagination semantics of getListingMarkets — see that page for the full sortBy key list and the 18-decimal filters contract. In brief:
accessTokenstringrequiredBearer token from authenticateListing. Sent as Authorization: Bearer <token>. A bad
or expired token yields a 401. Not part of the query key.
chainIdnumberoptionalTarget chain id. Defaults to the config’s defaultChainId. Selects which chain’s listing backend is used, and is
folded into the query key.
searchstringoptionalFree-text search, matched by the backend against contract address, ticker, and token name. Sent as query on the
wire; named search because the TanStack options bag already owns query.
chainIdsreadonly ListingDepositChainId[]optionalRestrict to tokens deposited on these chains. An empty array is sent as no filter. Serialized as repeated keys
(chain_ids=56&chain_ids=8453), the only form the backend honors.
marketStatusListingMarketStatusoptionalRestrict to one lifecycle status — a single status, not a set.
limitnumberdefault service 20optionalPage size, 1–100. Omitted when unset, so the backend applies its default of 20.
offsetnumberdefault service 0optionalRow offset. Combine with total from the response to page.
sortByListingMarketSortFieldoptionalServer-side sort key, in the backend’s snake_case wire form. See getListingMarkets § Sort
keys.
orderBy"asc" | "desc"default "desc"optionalSort direction applied to sortBy.
filtersListingMarketFiltersoptionalInclusive numeric range filters, applied server-side. Bounds are at 18 decimals, not human units — see
getListingMarkets § Filters.
Returns
Promise<UserListingMarketPage>totalnumberTotal rows matching the query across all pages — what you page against, not items.length.
limitnumberPage size the backend actually applied.
offsetnumberRow offset of this page.
itemsUserListingMarket[]The rows themselves — each a ListingMarket plus the user-scoped fields below.
A UserListingMarket extends ListingMarket with three fields describing the user’s position:
userDepositbigint | nullThe user’s current deposit into this pool, in USD as a bigint at LISTING_VALUE_DECIMALS (18). null when the
deposit address exists but nothing has been deposited yet — null is not 0; render it as a dash.
userSharePercentagenumberThe user’s share of the pool, as a plain percentage number (12.5 means 12.5%) — not 18-decimal scaled and
not a ratio. Format it directly, without formatUnits.
userRevenuebigint | nullThe user’s accrued revenue from this pool, in USD as a bigint at LISTING_VALUE_DECIMALS (18), or null when the
backend reported none.
The two money fields (userDeposit, userRevenue) are 18-decimal bigints like every other money field on the row —
descale with formatUnits(value, LISTING_VALUE_DECIMALS) before formatting as USD. userSharePercentage is the
exception: a bare number that already is the percentage. And null on either money field means “not reported”,
which is a different fact from a real $0.
Query options
import { getUserListingMarketsQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getUserListingMarketsQueryOptions(config, { accessToken, sortBy: "tvl", limit: 50 }));GetUserListingMarketsOptions is the action’s parameters (including the required accessToken) plus a query bag of TanStack overrides. The factory folds config.getChainConfigKey(chainId) into the key but leaves accessToken out of it, so a refreshed token reuses the cache rather than refetching. getUserListingMarketsQueryKey builds the same key for cache matching and invalidation.
The rest of the factory’s types are exported too: GetUserListingMarketsData is what the query resolves to (the same UserListingMarketPage), GetUserListingMarketsReturnType is the action’s return alias, GetUserListingMarketsQueryKey is the key the factory builds, and GetUserListingMarketsQueryOptions is the options bag it produces.
Because search, filtering, sorting and paging are all server-side, each distinct combination is its own cache entry — change one and the query refetches rather than re-slicing a page you already hold.
Throws
LISTING_NOT_CONFIGURED— aSymmError(kind: "config") when the chain has nolistingbackend configured. Gate withsupportsListingServiceto hide Pools instead of erroring. Only chains with a listing backend have Pools.FETCH_USER_LISTING_MARKETS_FAILED— the request itself failed. Any axios failure becomes aSymmApiErrorcarryingstatus,statusText,responseData,urlandmethod; a non-axios throw becomes a plainSymmError(kind: "api") with the original error as itscause. A401here means theaccessTokenwas missing, malformed, or expired — re-runauthenticateListingand retry.
Related
- Listing auth — mints the
accessTokenthis read requires. getListingMarkets— the public catalog, with the full sort-key and filter reference.ListingMarket— the base row shape and its 18-decimal value contract.useUserListingMarkets— the React hook.- Pools — the slice overview.