Skip to main content

How do I display APY and TVL from Enso data?

Read APY, TVL, protocol, and underlying-asset fields from GET /v1/tokens, with metadata included, and refresh those figures after a transaction.

J
Written by Javier Diaz

Read APY, TVL, protocol, and underlying-asset fields from GET /v1/tokens (with metadata included), and refresh those figures after a transaction. Do not hardcode yield numbers in your UI.

Definition

APY and TVL are catalog metrics on DeFi tokens, used to help a user compare destinations. They are display data, not an execution guarantee.

How it works

  • Query GET https://api.enso.build/api/v1/tokens with the relevant chainId, and filters such as protocolSlug, type=defi, apyFrom, or tvlFrom when you need a subset.

  • Set includeMetadata=true when you want the richer fields, including logos and underlying assets.

  • Show the values from the current response, with the protocol and chain, on the quote or catalog screen.

  • After confirmation, refresh token metadata and balances so the UI does not keep stale APY or TVL.

How Enso does this

Get Protocol Data documents these filters and the token metadata fields. Get Started lists APY, TVL, protocol, and token metadata as what to show before an action and after confirmation. These metrics are not the same as amountOut or priceImpact on a route.

FAQ

Are APY and TVL always present?

They are included where the catalog offers them. If a field is missing, do not invent a number.

Can I execute a deposit from this data alone?

No. Use Route or Bundle to build the transaction, then refresh the catalog data afterward.

Related articles

  • What is protocol data in a DeFi API?

  • How do I discover tokens, vaults, and protocols from the API?

  • How do I add an Earn tab to a wallet or app?

  • What is Enso Earn?

  • How do I get wallet balances and DeFi positions?

Sources

Did this answer your question?