Skip to main content
Every lend and deposit action needs a marketId.

React hooks

Use useEarnMarkets, useEarnProviders, and useEarnBalances inside a React tree wrapped with TrailsProvider:

useEarnMarkets filters

Each 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:
Fetch balances across multiple chains in a single backend request:
Restrict the lookup to one market:

End-to-end example

Wire a market picker into a typed action: