getPoolRewardChart
Fetch a pool’s daily LP-reward series — the public data behind the rewards tab of a pool page’s chart.
import { getPoolRewardChart, ListingDepositChainId } from "@symmio/trading-core";
const rewards = await getPoolRewardChart(config, {
marketAddress: "0x1234…",
marketChainId: ListingDepositChainId.BASE,
});
const total = rewards.reduce((sum, point) => sum + point.reward, 0n);One GET /v2/market/chart/rewards against the chain’s listing backend. Public — no bearer token, no wallet. For the same series scoped to the signed-in user instead of the whole pool, use getUserRewardChart; for the single headline figure above the chart, getPoolTotalReward.
Addressing a pool: two chain ids
The endpoint takes the pool’s token contract address and the chain that token lives on. That is not the same thing as the SDK’s chainId, which selects which deployment’s listing backend to ask — a pool whose token is on Solana still trades on the Arbitrum deployment.
marketChainId is ListingMarket.chainId — the deposit chain, a ListingDepositChainId, where SOLANA = 0 is a
sentinel and not a real chain id. Passing the SDK’s own chainId here silently returns an empty series rather than an
error, because the backend simply finds no market at that pair.
Parameters
marketAddressstringrequiredThe pool’s token contract address — ListingMarket.contractAddress. An EVM 0x… address, or a Solana base58
address for a Solana-deposited listing.
marketChainIdListingDepositChainIdrequiredChain the pool’s token lives on — ListingMarket.chainId. Not the SDK’s chainId.
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<PoolRewardPoint[]>One point per reward day, in the order the service returns them. A pool with no snapshots resolves to an empty array
rather than erroring, so [] means “nothing to plot yet”, not “something went wrong”.
timestampnumberrequiredStart of the reward day, unix seconds.
rewardbigintrequiredReward earned that day, 18-decimal fixed point (LISTING_VALUE_DECIMALS).
reward is a money field: descaled it is a USD amount (1e18 = $1). The catalog’s apr / apy fields share
the same 18-decimal scale but descale to a percentage (1e18 = 1%). Reusing a rate formatter here prints
$5.50 as 5.5%.
A day the service reports as null collapses to 0n rather than staying nullable — on a chart a missing snapshot and a zero-reward day are the same point, and a nullable field would push that collapse onto every consumer.
toPoolRewardPoint
The mapper this read runs on each row, exported for when you hold a raw response yourself — a proxy route, a fixture, a rehydrated payload.
import { toPoolRewardPoint } from "@symmio/trading-core";
toPoolRewardPoint({ timestamp: 1752364800, reward: "5500000000000000" });
// { timestamp: 1752364800, reward: 5500000000000000n }
toPoolRewardPoint({ timestamp: 1752451200, reward: null });
// { timestamp: 1752451200, reward: 0n }Query options
import { getPoolRewardChartQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(
getPoolRewardChartQueryOptions(config, {
marketAddress: pool.contractAddress,
marketChainId: pool.chainId,
}),
);GetPoolRewardChartOptions is the action’s parameters plus a query bag of TanStack overrides. The factory folds config.getChainConfigKey(chainId) into the key, so a runtime config override pointed at another listing deployment refetches instead of serving the previous one’s cache. getPoolRewardChartQueryKey builds the same ["getPoolRewardChart", …] key for cache matching and invalidation, and GetPoolRewardChartData / GetPoolRewardChartQueryKey / GetPoolRewardChartQueryOptions name the factory’s other halves.
Gate it where Pools may be absent, or before a pool has been picked:
import { getPoolRewardChartQueryOptions, supportsListingService } from "@symmio/trading-core";
useQuery({
...getPoolRewardChartQueryOptions(config, { chainId, marketAddress, marketChainId }),
enabled: supportsListingService(config, chainId) && marketAddress.length > 0,
});Throws
LISTING_NOT_CONFIGURED— aSymmError(kind: "config") when the resolved chain has no listing backend. Raised byresolveListingServicebefore any request goes out. Gate withsupportsListingServiceto hide Pools instead.UNSUPPORTED_CHAIN— aSymmError(kind: "config") when thechainIdis not one the config knows about at all.FETCH_POOL_REWARD_CHART_FAILED— the request itself failed. Any axios failure becomes aSymmApiErrorcarryingstatus,statusText,responseData,urlandmethod; a non-axios throw becomes a plainSymmError(kind: "api").
Related
getPoolTotalReward— the trailing-window headline above this chart.getUserRewardChart— the same series scoped to the signed-in user.getInventoryTvlHistory— the pool page’s other time series, from the inventory service.getListingMarketDetail— the pool’s aggregate stats and inventory.@symmio/trading-react—usePoolRewardChartis the React binding over this read.- Errors — the
SymmError/SymmApiErrorhierarchy these codes belong to.