getUserProfit
Fetch the signed-in user’s LP position in a single pool — the authed, per-token read behind a pool’s “your position” panel. It returns the caller’s LP shares, their LP balance valued in both the pool’s token and USDC, their claimable and claimed rewards, the token amount they deposited, the LP shares they have queued for withdrawal, and the SDK-derived availableLpAmount — the shares still free to withdraw.
import { getUserProfit } from "@symmio/trading-core";
const profit = await getUserProfit(config, {
accessToken: token.accessToken,
tokenContractAddress: "0x1234…",
});The result is a UserPoolProfit — one pool, one wallet. Where getUserListingMarkets is the Your Pools list (every pool that minted a deposit address for the wallet, with a coarse per-row position), this is the per-pool detail: the full LP breakdown for the one pool you name by its token contract address.
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.
No solver id
An HTTP 404 response with backend error code 22 (Market not listed) returns a zero LP position: balances, shares, deposited amount and rewards are 0n. Supplemental market metrics remain absent. Other errors, including HTTP 404/code 21 (Market not found), 429, 5xx and transport failures, still throw. The standalone action does not retry; composed portfolio reads retry failed per-pool reads once, excluding 401/403.
Pool listing is chain-level — one listing backend is served per chain — so getUserProfit takes only an optional chainId and no solverId. Pass a chainId to read a specific deployment’s listing backend; omit it to use the config’s default chain.
The access token and the token address
Two inputs are required — the endpoint returns nothing without either.
accessTokenstringrequiredBearer token from authenticateListing. Sent as Authorization: Bearer <token>. A bad
or expired token yields a 401 (see Throws). Mint it once, hold it, and pass it on every call.
tokenContractAddressstringrequiredThe pool’s token contract address — the id that addresses a single market in the listing API. An EVM 0x… address,
or a Solana base58 address for a Solana-deposited listing.
chainIdnumberoptionalTarget chain id. Defaults to the config’s defaultChainId. Selects which chain’s listing backend is used, and is
folded into the query key. There is no solverId — listing is resolved at chain level.
Returns
Promise<UserPoolProfit>userBalanceInTokensbigintThe LP balance valued in the pool’s token units. 18-decimal bigint.
userBalanceInUsdcbigintThe LP balance valued in USDC. 18-decimal bigint (USD).
claimableRewardbigintRewards the user can claim now. 18-decimal bigint (USD).
claimedRewardbigintRewards the user has already claimed. 18-decimal bigint (USD).
userDepositedTokenAmountbigintThe token amount the user deposited into the pool. 18-decimal bigint.
userLpAmountbigintThe user’s LP shares. 18-decimal bigint.
pendingWithdrawLpAmountbigintThe LP shares queued for withdrawal — the pending-withdrawal amount, not yet settled. 18-decimal bigint.
availableLpAmountbigintThe LP shares free to withdraw right now — userLpAmount − pendingWithdrawLpAmount, floored at 0n. Derived by
the SDK, not a field the service returns; it is the ceiling a withdrawLp request may
take. 18-decimal bigint.
Every field is an 18-decimal bigint at LISTING_VALUE_DECIMALS (18), independent of the token’s or collateral’s
own decimals — descale with formatUnits(value, LISTING_VALUE_DECIMALS) at the display edge. The *Usdc and reward
fields are USD (1e18 = $1); the token-amount and LP-share fields are counts in that same fixed-point. Unlike a
catalog row, there is no null here: an absent figure is normalized to 0n, so a real $0 and a missing value
are indistinguishable.
Query options
import { getUserProfitQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getUserProfitQueryOptions(config, { accessToken, tokenContractAddress: "0x1234…" }));GetUserProfitOptions is the action’s parameters (including the required accessToken and tokenContractAddress) 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. getUserProfitQueryKey builds the same key for cache matching and invalidation.
The rest of the factory’s types are exported too: GetUserProfitData is what the query resolves to (the same UserPoolProfit), GetUserProfitReturnType is the action’s return alias, GetUserProfitQueryKey is the key the factory builds, and GetUserProfitQueryOptions is the options bag it produces.
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_PROFIT_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
getUserListingMarkets— Your Pools, the list this drills into: every pool holding a deposit address for the wallet, with a coarse per-row position. This action is the per-pool detail of one of those rows.- Listing auth — mints the
accessTokenthis read requires. useUserProfit— the React hook.- Pools — the slice overview.
Full statistics snapshots
The normalized response additionally retains nullable TVL, APY, buyback ratio, active LP count, age, pool token/collateral totals, and long/short size/value/entry/uPNL snapshot fields. Amounts are 18-decimal bigints; buybackRatio is a whole percentage. Use balance/statistics selectors rather than duplicating pending-LP arithmetic. A failed read remains unknown; do not treat it as a zero position.