lend and deposit action needs a marketId.
React hooks
UseuseEarnMarkets, useEarnProviders, and useEarnBalances inside a React tree wrapped with TrailsProvider:
useEarnMarkets filters
| Field | Type | Description |
|---|---|---|
chain | ChainIdentifier | Chain name or ID |
type | "lending" | "vault" | … | Market category |
provider | ProviderId | Restrict to one protocol |
search | string | Free-text search over market names |
sortBy | SortBy | e.g. "rewardRateDesc" |
limit | number | Page size |
offset | number | Page offset |
EarnMarket exposes id, rewardRate, statistics.tvlUsd, metadata.*, providerId, and more.
Use these hooks in browser apps to discover supported markets, providers, and the user’s existing earn positions before building an action list.
useEarnBalances
Fetch a wallet’s earn balances for one chain:
| Field | Type | Description |
|---|---|---|
walletAddress | string | Wallet whose earn positions should be fetched |
chain | ChainIdentifier | Single chain name, ID, or viem chain object |
chains | ChainIdentifier[] | Multiple chains; mutually exclusive with chain |
marketId | string | Optional market ID to filter one position |
arguments | object | Optional market-specific balance arguments |
enabled | boolean | Set false to disable the query |