defillama

package module
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 19 Imported by: 0

README

DefiLlama Golang Client/SDK/Library

DefiLlama Go Golang SDK Client

CI Tests Go Version License CodeQL Codecov GitHub Release GoDoc

defillama-go is a small, idiomatic Go client for the DefiLlama Free and Pro APIs. It gives an application one consistent, context-aware interface for protocol TVL, token prices, yields, stablecoins, fees, bridges, RWA, equities, and the rest of the documented API surface.

[!TIP] 📚 Explore the full documentation: DefiLlama Go Wiki →

  • All 132 GET operations in the included OpenAPI snapshot are available: 31 Free and 101 Pro.
  • The runtime uses only Go's standard library. Supply your own *http.Client when you need a proxy, custom transport, tracing, or different timeout policy.
  • New performs no network request, every network method accepts context.Context, and one client is safe to share between goroutines.
  • The route registry is generated from spec/defillama-api.json. The complete operation-to-method map is in docs/api-index.md.

This package is an API transport, not financial advice. DefiLlama metrics and token prices follow DefiLlama's methodology; use a decimal type in application code where exact monetary precision matters.

Install

Requires Go 1.22 or newer.

go get github.com/tigusigalpa/defillama-go

Your first request: no API key needed

Free endpoints work immediately. The following program reads the protocol list and Bitcoin's current USD price. In production, use a request-scoped context with a deadline just as shown here.

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	defillama "github.com/tigusigalpa/defillama-go"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
	defer cancel()

	client, err := defillama.New(defillama.WithTimeout(10 * time.Second))
	if err != nil {
		log.Fatal(err)
	}

	protocols, err := client.TVL().GetProtocols(ctx)
	if err != nil {
		log.Fatal(err)
	}
	if len(protocols) > 0 {
		fmt.Printf("%s TVL: $%.0f\n", protocols[0].Name, protocols[0].TVL)
	}

	prices, err := client.Prices().GetCurrentPrices(ctx, []string{
		"coingecko:bitcoin",
		"ethereum:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
	})
	if err != nil {
		log.Fatal(err)
	}
	btc, ok := prices["coingecko:bitcoin"]
	if !ok {
		log.Fatal("DefiLlama response did not include bitcoin")
	}
	fmt.Printf("BTC: $%.2f\n", btc.Price)
}

You can run the equivalent checked example from this repository:

go run ./examples/basic

Free operations use the origin specified for that individual route, rather than forcing every call through one host. Depending on the operation, that is api.llama.fi, coins.llama.fi, stablecoins.llama.fi, or yields.llama.fi.

Pro API

Create a key in DefiLlama, keep it outside source control, and provide it to the client. For example:

# macOS / Linux
export DEFILLAMA_API_KEY='your-key'
go run ./examples/pro

# PowerShell
$env:DEFILLAMA_API_KEY = 'your-key'
go run ./examples/pro
client, err := defillama.New(
	defillama.WithAPIKey(os.Getenv("DEFILLAMA_API_KEY")),
	defillama.WithTimeout(10*time.Second),
	defillama.WithRetryPolicy(defillama.RetryPolicy{
		MaxAttempts: 3,
		BaseDelay:  250 * time.Millisecond,
		MaxDelay:   2 * time.Second,
		Jitter:     true,
	}),
)
if err != nil {
	return err
}

usage, err := client.Account().GetUsage(ctx)
if err != nil {
	return err
}
if credits, ok := usage.CreditsLeft(); ok {
	fmt.Printf("credits remaining: %.0f\n", credits)
}

chart, err := client.TVL().GetProtocolTVLChart(ctx, "aave", nil)
if err != nil {
	return err
}
fmt.Println("chart points:", len(chart))

DefiLlama authenticates Pro requests with the key in the URL path:

https://pro-api.llama.fi/{API_KEY}/<endpoint path>

It is deliberately never sent as an HTTP header or query parameter. The client escapes the key as one path segment and redacts it from URLs, response diagnostics, and nested HTTP errors. Calling a Pro method without a key returns *defillama.ProAPIKeyRequiredError before the SDK builds or sends a request.

Pro requests can follow redirects on the same origin. The SDK returns a redirect to another origin as an APIError with the redirect status, without following it.

If you already have a Pro key and want the Free methods to use DefiLlama's official Pro equivalents too, opt in explicitly:

client, err := defillama.New(
	defillama.WithAPIKey(os.Getenv("DEFILLAMA_API_KEY")),
	defillama.WithPreferProForFree(true),
)

This only changes routing for the 31 Free endpoints that have an official Pro mapping. It is off by default, so a configured key never silently changes the default Free routing.

Common tasks

The snippets in this section assume you already have a client and a ctx, as in the first example. They fit inside a function that returns an error. Examples marked Pro need a client configured with WithAPIKey.

Explore a protocol's TVL (Free)

The protocol detail endpoint has a flexible response shape. Start with the typed accessors, then inspect Raw when you need a field the SDK does not model yet:

protocol, err := client.TVL().GetProtocol(ctx, "aave")
if err != nil {
	return err
}
fmt.Printf("%s (%s): %d TVL samples\n",
	protocol.Name(), protocol.Slug(), len(protocol.TVLHistory()))

if ethereum, ok := protocol.ChainTVLs()["Ethereum"]; ok {
	fmt.Printf("Ethereum breakdown: %v\n", ethereum)
}
if description, ok := protocol.Raw["description"].(string); ok {
	fmt.Println(description)
}

ChainTVLs() returns raw per-chain values rather than assuming every chain has the same shape. Check types before using fields from Raw in calculations.

Ask for a historical token price

Use DefiLlama token identifiers in the chain:address form; CoinGecko assets use coingecko:<id>.

at := time.Date(2025, time.January, 1, 0, 0, 0, 0, time.UTC).Unix()
prices, err := client.Prices().GetHistoricalPrices(ctx,
	[]string{"coingecko:ethereum", "ethereum:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},
	at,
)
if err != nil {
	return err
}
eth, ok := prices["coingecko:ethereum"]
if !ok {
	return fmt.Errorf("historical response did not include ethereum")
}
fmt.Println(eth.Price)
List stablecoins with prices (Free)

GetStablecoins returns typed records. Request prices explicitly, and keep the output small when you're exploring a large list:

stablecoins, err := client.Stablecoins().GetStablecoins(ctx,
	&defillama.StablecoinsListOptions{
		IncludePrices: defillama.Ptr(true),
	},
)
if err != nil {
	return err
}
for i, coin := range stablecoins {
	if i >= 3 {
		break
	}
	fmt.Printf("%s (%s): %d chains, price %.4f\n",
		coin.Name, coin.Symbol, len(coin.Chains), coin.Price)
}

When an optional field's presence matters, inspect coin.Raw instead of treating a zero-valued Go field as proof that the API returned zero.

Filter earn pools

Option structs make optional values explicit. defillama.Ptr keeps examples tidy, and nil fields are not serialized.

result, err := client.Yields().QueryEarnPools(ctx, defillama.EarnPoolsQuery{
	Chain:      defillama.Ptr("Ethereum"),
	Stablecoin: defillama.Ptr(true),
	MinTVL:     defillama.Ptr(1_000_000.0),
	Page:       defillama.Ptr(int64(1)),
	Limit:      defillama.Ptr(int64(50)),
})
if err != nil {
	return err
}
fmt.Printf("filtered response fields: %d\n", len(result))

QueryEarnPools reflects the API's evolving response as map[string]any. For the stable, typed Free pool list, use client.Yields().GetPools(ctx), which returns []defillama.YieldPool.

Request a price chart
chart, err := client.Prices().GetChart(ctx,
	[]string{"coingecko:bitcoin"},
	&defillama.ChartOptions{
		Span:   defillama.Ptr(30.0), // 30 data points
		Period: defillama.Ptr("1d"),
	},
)
if err != nil {
	return err
}
fmt.Println("chart response fields:", len(chart))

The SDK validates declared enum values and required flags before making a request. For routes with required Boolean flags, such as DEX overview, use the value-based option struct:

overview, err := client.Volumes().GetDEXOverview(ctx, defillama.OverviewOptions{
	ExcludeTotalDataChart:          true,
	ExcludeTotalDataChartBreakdown: true,
})
if err != nil {
	return err
}
_ = overview
Inspect real-world assets (Pro)

RWA assets have typed fields for common data and a Raw map for additional fields returned by the API:

assets, err := client.RWA().GetCurrentAssets(ctx)
if err != nil {
	return err
}
for i, asset := range assets {
	if i >= 3 {
		break
	}
	fmt.Printf("%s (%s), issuer: %s\n", asset.AssetName, asset.Ticker, asset.Issuer)
}
if len(assets) > 0 {
	fmt.Printf("first asset's complete payload: %v\n", assets[0].Raw)
}
Filter recent bridge transactions (Pro)

Bridge IDs come from client.Bridges().GetBridges(ctx, nil). After choosing one, pass Unix timestamps and a bounded result limit:

bridgeID := int64(1) // Replace with an ID from GetBridges.
end := time.Now().UTC()
start := end.Add(-24 * time.Hour)

transactions, err := client.Bridges().GetBridgeTransactions(ctx, bridgeID,
	&defillama.BridgeTransactionsOptions{
		Starttimestamp: defillama.Ptr(start.Unix()),
		Endtimestamp:   defillama.Ptr(end.Unix()),
		Sourcechain:    defillama.Ptr("Ethereum"),
		Limit:          defillama.Ptr(int64(100)),
	},
)
if err != nil {
	return err
}
fmt.Printf("bridge response fields: %d\n", len(transactions))

The transaction response is map[string]any; inspect its fields before converting them to application-specific types. Limit must be between 1 and 6000, and the SDK rejects values outside that range before sending a request.

Handle errors deliberately

All service errors are typed and work with errors.As. URLs in errors are already safe to record in logs.

_, err := client.TVL().GetProtocol(ctx, "not-a-real-protocol")

var (
	notFound  *defillama.NotFoundError
	rateLimit *defillama.RateLimitError
	apiErr    *defillama.APIError
	transport *defillama.TransportError
	decode    *defillama.DecodeError
	missingKey *defillama.ProAPIKeyRequiredError
)

switch {
case errors.As(err, &notFound):
	// The resource does not exist (HTTP 404).
case errors.As(err, &rateLimit):
	// HTTP 429. rateLimit.RetryAfter is zero if the server did not provide it.
	return fmt.Errorf("try again in %s: %w", rateLimit.RetryAfter, err)
case errors.As(err, &apiErr):
	// Other non-2xx responses: StatusCode, Header, Body, and a redacted URL.
case errors.As(err, &transport):
	// DNS, TLS, timeout, or cancellation; errors.Is reaches the root cause.
case errors.As(err, &decode):
	// The server returned a successful response that was not valid JSON.
case errors.As(err, &missingKey):
	// A Pro method was called without WithAPIKey.
case err != nil:
	return err
}

Retries are disabled by default. When configured, only GET requests with transient transport errors, HTTP 429, or HTTP 5xx are retried. Backoff is capped, includes optional jitter, honors Retry-After, and stops promptly when the context is cancelled or reaches its deadline. Decode errors and ordinary 4xx responses are never retried.

Preserve exact protocol and yield receipts

The ordinary service methods are the convenient compatibility interface: their documented numeric fields use float64, and unknown fields in map[string]any follow Go's usual JSON decoding rules. That is not a lossless boundary for economic values.

For provider-native protocol and yield data, use the receipt methods. A complete receipt preserves the exact response bytes, route provenance, redacted request URL, attempt number, and SDK capture time. Decode uses json.Decoder.UseNumber, so an untyped number remains a json.Number with its original lexeme. This is especially useful when a caller owns an immutable ingestion receipt or needs to distinguish an absent member, null, and numeric zero.

receipt, err := client.TVL().GetProtocolReceipt(ctx, "aave")
if err != nil {
	return err
}

var details defillama.LosslessProtocolDetails
if err := receipt.Decode(&details); err != nil {
	return err
}
name, _, err := details.Name()
if err != nil {
	return err
}
history, present, err := details.TVLHistory()
if err != nil {
	return err
}
if !present || len(history) == 0 {
	return fmt.Errorf("protocol history unavailable")
}
date, present := history[0].Field("date")
if !present {
	return fmt.Errorf("provider history date unavailable")
}
fmt.Printf("%s history date JSON: %s\n", name, date.RawJSON())
fmt.Println("receipt SHA-256:", receipt.BodySHA256())

CapturedAt is recorded as soon as the HTTP response is received; CompletedAt is recorded only after the original response body has been read, boundedly drained, and closed. Always check Complete before treating Body() as a whole response. If a read, limit, drain, or close step fails, the receipt still exposes the immutable prefix and its SHA-256 digest for diagnostics, but Complete is false and the returned error keeps every underlying cause discoverable through errors.Is and errors.As.

Every response body, including ordinary typed calls, is limited to 32 MiB by default. Choose a smaller or larger positive limit when constructing the client; an over-limit response is never retried and matches defillama.ErrResponseBodyTooLarge.

client, err := defillama.New(
	defillama.WithMaxResponseBodyBytes(8<<20), // 8 MiB
)
if err != nil {
	return err
}

receipt, err := client.TVL().GetProtocolsReceipt(ctx)
if err != nil {
	if errors.Is(err, defillama.ErrResponseBodyTooLarge) {
		// receipt, when non-nil, holds the safely bounded prefix.
		return fmt.Errorf("protocol response exceeds the ingestion budget: %w", err)
	}
	return err
}
if !receipt.Complete {
	return fmt.Errorf("incomplete protocol receipt")
}

The selected receipt methods are TVL().GetProtocolsReceipt, TVL().GetProtocolReceipt, Yields().GetPoolsReceipt, and Yields().GetPoolChartReceipt. Decode their bodies into LosslessProtocols, LosslessProtocolDetails, LosslessYieldPools, or LosslessYieldChart. Those DTOs intentionally expose only selected convenience fields and retain all other provider fields through open Fields() objects; they do not claim a closed or complete provider schema.

Pool IDs and protocol IDs are provider-native identifiers, not universal asset identities. Protocol history date values are provider Unix seconds, while a yield chart's timestamp is provider ISO-8601 text. Both are distinct from receipt.CapturedAt. Yield apy, apyBase, and apyReward remain separate provider percentages, and predictions stays an unclassified provider output.

To retain every HTTP response, including responses that trigger a retry, pass an observer when constructing the client. The callback runs in the calling goroutine only after that response's original body is finalized; a transport-only failure produces no receipt. Avoid logging or persisting receipt bodies unless that is permitted by your application's data policy.

client, err := defillama.New(
	defillama.WithReceiptObserver(func(receipt defillama.ResponseReceipt) {
		fmt.Printf("attempt %d: HTTP %d, complete=%t, %s\n",
			receipt.Attempt, receipt.StatusCode, receipt.Complete, receipt.BodySHA256())
	}),
)
if err != nil {
	return err
}

Services

Every service accessor returns a lightweight client-owned value. Keep the top-level Client and call the service that matches the data you need.

Accessor What it covers A starting method
TVL() Protocols, chains, TVL, Pro TVL metrics and charts GetProtocols(ctx)
Prices() Current/historical prices, charts, blocks GetCurrentPrices(ctx, coins)
Stablecoins() Stablecoin supply, charts, prices, dominance GetStablecoins(ctx, opts)
Yields() Free pools plus Pro earn, borrow, LST, and perps data GetPools(ctx)
Volumes() DEX, options, open interest, and derivatives volumes GetDEXOverview(ctx, opts)
Fees() Fees and revenue overview/summary data GetOverview(ctx, opts)
Emissions() Token unlocks GetEmissions(ctx)
Ecosystem() Categories, entities, forks, hacks, oracles, raises, treasuries GetHacks(ctx)
Bridges() Bridges, volumes, daily stats, transactions GetBridgeTransactions(ctx, id, opts)
ETFs() ETF snapshots and flows GetSnapshot(ctx)
Narratives() Narrative performance GetPerformance(ctx, period)
Account() Pro key usage GetUsage(ctx)
DAT() Digital Asset Treasury institutions GetInstitutions(ctx)
Treasury() Protocol treasury metrics and charts GetTreasuryChart(ctx, protocol, opts)
Oracles() Oracle metrics and charts GetOracleMetrics(ctx)
Forks() Fork metrics and charts GetForkMetrics(ctx)
Dimensions() Cross-metric chart and breakdown endpoints GetChart(ctx, metric, opts)
FinancialStatements() Protocol financial statements GetIncomeStatement(ctx, protocol)
Equities() Public company lists, statements, OHLCV, filings GetCompaniesList(ctx)
PreIPO() Pre-IPO companies, valuations, raises, integrations GetValuations(ctx, query)
RWA() Real-world assets, stats, and charts GetCurrentAssets(ctx)

For all 132 operations, parameter names, and links to the official reference, see docs/api-index.md. Stable response shapes use typed models such as Protocol, Chain, CoinPrice, Stablecoin, and YieldPool. Evolving API responses are intentionally returned as clearly named map[string]any or []any; the typed models also retain their complete raw payload in Raw.

Configuration

Option Default Purpose
WithAPIKey(key) none Enables Pro endpoints. The SDK does not read environment variables itself.
WithTimeout(d) 30 seconds Timeout used by the default *http.Client.
WithHTTPClient(client) SDK default Inject a client for a proxy, tracing, or your own timeout policy.
WithRetryPolicy(policy) one attempt Enables bounded retries for retryable GET failures.
WithUserAgent(value) defillama-go/<version> Overrides the User-Agent header.
WithPreferProForFree(true) false Routes Free calls to their official Pro equivalents when a key is present.
WithReceiptObserver(fn) none Receives one immutable receipt for every HTTP response, including retry attempts.
WithMaxResponseBodyBytes(n) 32 MiB Sets a positive inclusive response-body limit for typed decoding and receipts; overflow returns a non-retryable ResponseBodyTooLargeError.

WithTimeout does not alter a custom client supplied through WithHTTPClient; configure that client's timeouts yourself. WithBaseURLsForTesting exists for tests and advanced local mock-server setups, not ordinary production configuration.

For example, to use an HTTP client already configured by your application (requires the net/http and time imports):

httpClient := &http.Client{Timeout: 8 * time.Second}
client, err := defillama.New(defillama.WithHTTPClient(httpClient))
if err != nil {
	return err
}
// Reuse client for subsequent requests; it is safe to share across goroutines.

Response precision and compatibility

The ordinary typed API decodes values supplied by DefiLlama as float64 transport values. Convert prices, TVL, and percentages to a decimal representation before calculations where rounding matters. Stable typed models retain unknown fields in Raw, but Raw is a compatibility map and does not preserve raw number lexemes. Use the receipt APIs above when exact JSON representation, field presence, or immutable source bytes matter.

The package follows semantic versioning. Review CHANGELOG.md when upgrading; endpoint coverage changes are visible in docs/api-index.md.

Development

The automated tests use local HTTP servers; they neither contact DefiLlama nor need a key.

go test ./...
go test -race ./...
go vet ./...
gofmt -l .             # should print nothing
staticcheck ./...      # if installed
golangci-lint run      # if installed

See CONTRIBUTING.md for project conventions and docs/implementation-report.md for the original coverage and verification record. To report a security issue, follow SECURITY.md.

License

MIT — © 2026 Igor Sazonov. See LICENSE.

Documentation

Overview

Package defillama provides an idiomatic Go client for the DefiLlama Free and Pro APIs (https://api-docs.defillama.com/).

All 132 GET operations of the pinned OpenAPI spec (spec/defillama-api.json) are exposed through 21 services on the Client. Free endpoints use the per-operation origin declared by the spec (api.llama.fi, coins.llama.fi, stablecoins.llama.fi, yields.llama.fi). Pro endpoints embed the API key as a single URL path segment: https://pro-api.llama.fi/{API_KEY}/<path>.

The client is safe for concurrent use and holds no request-level state.

Index

Constants

View Source
const DefaultMaxResponseBodyBytes int64 = 32 << 20

DefaultMaxResponseBodyBytes is the 32 MiB ceiling applied to every HTTP response body. It is deliberately large enough for protocol and pool lists; use WithMaxResponseBodyBytes when an application has a different budget.

View Source
const Version = "1.2.1"

Version is the package version, used in the default User-Agent.

Variables

View Source
var ErrResponseBodyTooLarge = errors.New("defillama: response body exceeds configured limit")

ErrResponseBodyTooLarge is matched by ResponseBodyTooLargeError when a response exceeds the configured WithMaxResponseBodyBytes limit.

Functions

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to v — a convenience for filling pointer-based optional fields on the option structs (e.g. &ChartOptions{Period: Ptr("1d")}).

Types

type APIError

type APIError struct {
	StatusCode int
	// URL is the redacted request URL (API key replaced by {API_KEY}).
	URL string
	// Header is a copy of the response headers with API key values redacted.
	Header http.Header
	// Body is the response body truncated to 4096 bytes with API key values
	// redacted. It is safe to include in application diagnostics.
	Body []byte
}

APIError is a non-2xx HTTP response. URL is always the redacted form.

func (*APIError) Error

func (e *APIError) Error() string

Error implements error.

type APIUsage

type APIUsage struct {
	Raw map[string]any
}

APIUsage is the response of GET /usage/APIKEY — the Pro key credit balance. The payload shape is not fully documented, so fields are accessed via Raw and the helpers below.

func (*APIUsage) CreditsLeft

func (u *APIUsage) CreditsLeft() (float64, bool)

CreditsLeft extracts the remaining credit count when present.

type AccountService

type AccountService struct {
	// contains filtered or unexported fields
}

AccountService provides access to the Account endpoints.

func (*AccountService) GetUsage

func (s *AccountService) GetUsage(ctx context.Context) (*APIUsage, error)

GetUsage Get amount of credits left in the api key, these reset on the 1st of each month See: https://api-docs.defillama.com/#tag/meta/get/usage/APIKEY

type Block

type Block struct {
	Height    int64          `json:"height"`
	Timestamp int64          `json:"timestamp"`
	Raw       map[string]any `json:"-"`
}

Block is the response of GET /block/{chain}/{timestamp}.

func (*Block) UnmarshalJSON

func (b *Block) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type BridgeTransactionsOptions

type BridgeTransactionsOptions struct {
	Starttimestamp *int64  // query: starttimestamp
	Endtimestamp   *int64  // query: endtimestamp
	Sourcechain    *string // query: sourcechain
	Address        *string // query: address
	Limit          *int64  // query: limit
}

BridgeTransactionsOptions holds optional/required query parameters. Nil pointer fields are omitted.

type BridgeVolumeOptions

type BridgeVolumeOptions struct {
	ID *int64 // query: id
}

BridgeVolumeOptions holds optional/required query parameters. Nil pointer fields are omitted.

type BridgesOptions

type BridgesOptions struct {
	IncludeChains *bool // query: includeChains
}

BridgesOptions holds optional/required query parameters. Nil pointer fields are omitted.

type BridgesService

type BridgesService struct {
	// contains filtered or unexported fields
}

BridgesService provides access to the Bridges endpoints.

func (*BridgesService) GetBridge

func (s *BridgesService) GetBridge(ctx context.Context, id int64) (map[string]any, error)

GetBridge Get summary of bridge volume and volume breakdown by chain See: https://api-docs.defillama.com/#tag/bridges/get/bridges/bridge/%7Bid%7D

func (*BridgesService) GetBridgeDayStats

func (s *BridgesService) GetBridgeDayStats(ctx context.Context, timestamp int64, chain string, opts *BridgeVolumeOptions) (map[string]any, error)

GetBridgeDayStats Get a 24hr token and address volume breakdown for a bridge See: https://api-docs.defillama.com/#tag/bridges/get/bridges/bridgedaystats/%7Btimestamp%7D/%7Bchain%7D

func (*BridgesService) GetBridgeTransactions

func (s *BridgesService) GetBridgeTransactions(ctx context.Context, id int64, opts *BridgeTransactionsOptions) (map[string]any, error)

GetBridgeTransactions Get all transactions for a bridge within a date range See: https://api-docs.defillama.com/#tag/bridges/get/bridges/transactions/%7Bid%7D

func (*BridgesService) GetBridgeVolume

func (s *BridgesService) GetBridgeVolume(ctx context.Context, chain string, opts *BridgeVolumeOptions) ([]any, error)

GetBridgeVolume Get historical volumes for a bridge, chain, or bridge on a particular chain See: https://api-docs.defillama.com/#tag/bridges/get/bridges/bridgevolume/%7Bchain%7D

func (*BridgesService) GetBridges

func (s *BridgesService) GetBridges(ctx context.Context, opts *BridgesOptions) (map[string]any, error)

GetBridges List all bridges along with summaries of recent bridge volumes. See: https://api-docs.defillama.com/#tag/bridges/get/bridges/bridges

type Chain

type Chain struct {
	GeckoID     string         `json:"gecko_id"`
	TVL         float64        `json:"tvl"`
	TokenSymbol string         `json:"tokenSymbol"`
	CmcID       string         `json:"cmcId"`
	Name        string         `json:"name"`
	ChainID     float64        `json:"chainId"`
	Raw         map[string]any `json:"-"`
}

Chain is an entry of GET /v2/chains.

func (*Chain) UnmarshalJSON

func (c *Chain) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type ChartOptions

type ChartOptions struct {
	Start  *float64 // query: start
	End    *float64 // query: end
	Span   *float64 // query: span
	Period *string  // query: period
}

ChartOptions holds optional/required query parameters. Nil pointer fields are omitted.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the DefiLlama API client. Construct it with New.

func New

func New(opts ...Option) (*Client, error)

New builds a Client. It performs no network I/O; invalid configuration is reported as *ConfigError.

func (*Client) Account

func (c *Client) Account() *AccountService

Account returns the account/meta service (API key usage).

func (*Client) Bridges

func (c *Client) Bridges() *BridgesService

Bridges returns the bridges service.

func (*Client) DAT

func (c *Client) DAT() *DATService

DAT returns the Digital Asset Treasury service.

func (*Client) Dimensions

func (c *Client) Dimensions() *DimensionsService

Dimensions returns the dimensions service (19 chart/metric endpoints).

func (*Client) ETFs

func (c *Client) ETFs() *ETFsService

ETFs returns the ETFs service.

func (*Client) Ecosystem

func (c *Client) Ecosystem() *EcosystemService

Ecosystem returns the main-page service (categories, entities, forks, hacks, oracles, raises, treasuries).

func (*Client) Emissions

func (c *Client) Emissions() *EmissionsService

Emissions returns the token unlocks/emissions service.

func (*Client) Equities

func (c *Client) Equities() *EquitiesService

Equities returns the equities service.

func (*Client) Fees

func (c *Client) Fees() *FeesService

Fees returns the fees & revenue service.

func (*Client) FinancialStatements

func (c *Client) FinancialStatements() *FinancialStatementsService

FinancialStatements returns the financial statements service.

func (*Client) Forks

func (c *Client) Forks() *ForksService

Forks returns the forks service.

func (*Client) IsPro

func (c *Client) IsPro() bool

IsPro reports whether an API key is configured, i.e. Pro endpoints are usable.

func (*Client) Narratives

func (c *Client) Narratives() *NarrativesService

Narratives returns the narratives service.

func (*Client) Oracles

func (c *Client) Oracles() *OraclesService

Oracles returns the oracles service.

func (*Client) PreIPO

func (c *Client) PreIPO() *PreIPOService

PreIPO returns the pre-IPO companies service.

func (*Client) Prices

func (c *Client) Prices() *PricesService

Prices returns the coins/token-liquidity service.

func (*Client) RWA

func (c *Client) RWA() *RWAService

RWA returns the real-world assets service.

func (*Client) Stablecoins

func (c *Client) Stablecoins() *StablecoinsService

Stablecoins returns the stablecoins service.

func (*Client) TVL

func (c *Client) TVL() *TVLService

TVL returns the TVL service (Free TVL + Pro TVL charts/metrics).

func (*Client) Treasury

func (c *Client) Treasury() *TreasuryService

Treasury returns the protocol treasury service.

func (*Client) Volumes

func (c *Client) Volumes() *VolumesService

Volumes returns the volumes service (DEX/options volume, open interest, derivatives).

func (*Client) Yields

func (c *Client) Yields() *YieldsService

Yields returns the yields service (pools, earn/borrow v2, LST rates, legacy v1).

type CoinPrice

type CoinPrice struct {
	Price      float64        `json:"price"`
	Symbol     string         `json:"symbol"`
	Timestamp  int64          `json:"timestamp"`
	Decimals   float64        `json:"decimals"`
	Confidence float64        `json:"confidence"`
	Raw        map[string]any `json:"-"`
}

CoinPrice is a single record from the coins API.

func (*CoinPrice) UnmarshalJSON

func (p *CoinPrice) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type ConfigError

type ConfigError struct {
	Msg string
}

ConfigError reports invalid client configuration. Returned by New before any network I/O takes place.

func (*ConfigError) Error

func (e *ConfigError) Error() string

Error implements error.

type DATService

type DATService struct {
	// contains filtered or unexported fields
}

DATService provides access to the DAT endpoints.

func (*DATService) GetInstitution

func (s *DATService) GetInstitution(ctx context.Context, symbol string) (map[string]any, error)

GetInstitution Get individual institution Digital Asset Treasury details See: https://api-docs.defillama.com/#tag/dat/get/dat/institutions/%7Bsymbol%7D

func (*DATService) GetInstitutions

func (s *DATService) GetInstitutions(ctx context.Context) (map[string]any, error)

GetInstitutions Get list of all institutions with Digital Asset Treasury data See: https://api-docs.defillama.com/#tag/dat/get/dat/institutions

type DecodeError

type DecodeError struct {
	// URL is the redacted request URL.
	URL string
	Err error
}

DecodeError reports a response body that is not valid JSON.

func (*DecodeError) Error

func (e *DecodeError) Error() string

Error implements error.

func (*DecodeError) Unwrap

func (e *DecodeError) Unwrap() error

Unwrap returns the JSON decoding error.

type DimensionOptions

type DimensionOptions struct {
	DataType *string // query: dataType
}

DimensionOptions holds optional/required query parameters. Nil pointer fields are omitted.

type DimensionsService

type DimensionsService struct {
	// contains filtered or unexported fields
}

DimensionsService provides access to the Dimensions endpoints.

func (*DimensionsService) GetCategoryChainChart

func (s *DimensionsService) GetCategoryChainChart(ctx context.Context, metric string, category string, chain string, opts *DimensionOptions) ([]any, error)

GetCategoryChainChart Get category chain historical timeseries chart data See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/category/%7Bcategory%7D/chain/%7Bchain%7D

func (*DimensionsService) GetCategoryChainChartProtocolBreakdown

func (s *DimensionsService) GetCategoryChainChartProtocolBreakdown(ctx context.Context, metric string, category string, chain string, opts *DimensionOptions) ([]any, error)

GetCategoryChainChartProtocolBreakdown Get category chain timeseries chart data breakdown by protocol See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/category/%7Bcategory%7D/chain/%7Bchain%7D/protocol-breakdown

func (*DimensionsService) GetCategoryChainMetrics

func (s *DimensionsService) GetCategoryChainMetrics(ctx context.Context, metric string, category string, chain string, opts *DimensionOptions) (map[string]any, error)

GetCategoryChainMetrics Get category chain dimension data overview See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/metrics/%7Bmetric%7D/category/%7Bcategory%7D/chain/%7Bchain%7D

func (*DimensionsService) GetCategoryChart

func (s *DimensionsService) GetCategoryChart(ctx context.Context, metric string, category string, opts *DimensionOptions) ([]any, error)

GetCategoryChart Get category historical timeseries chart data See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/category/%7Bcategory%7D

func (*DimensionsService) GetCategoryChartChainBreakdown

func (s *DimensionsService) GetCategoryChartChainBreakdown(ctx context.Context, metric string, category string, opts *DimensionOptions) ([]any, error)

GetCategoryChartChainBreakdown Get category timeseries chart data breakdown by chain See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/category/%7Bcategory%7D/chain-breakdown

func (*DimensionsService) GetCategoryChartProtocolBreakdown

func (s *DimensionsService) GetCategoryChartProtocolBreakdown(ctx context.Context, metric string, category string, opts *DimensionOptions) ([]any, error)

GetCategoryChartProtocolBreakdown Get category timeseries chart data breakdown by protocol See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/category/%7Bcategory%7D/protocol-breakdown

func (*DimensionsService) GetCategoryMetrics

func (s *DimensionsService) GetCategoryMetrics(ctx context.Context, metric string, category string, opts *DimensionOptions) (map[string]any, error)

GetCategoryMetrics Get category dimension data overview See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/metrics/%7Bmetric%7D/category/%7Bcategory%7D

func (*DimensionsService) GetChainChart

func (s *DimensionsService) GetChainChart(ctx context.Context, metric string, chain string, opts *DimensionOptions) ([]any, error)

GetChainChart Get chain historical timeseries chart data See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/chain/%7Bchain%7D

func (*DimensionsService) GetChainChartProtocolBreakdown

func (s *DimensionsService) GetChainChartProtocolBreakdown(ctx context.Context, metric string, chain string, opts *DimensionOptions) ([]any, error)

GetChainChartProtocolBreakdown Get chain timeseries chart data breakdown by protocol See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/chain/%7Bchain%7D/protocol-breakdown

func (*DimensionsService) GetChainMetrics

func (s *DimensionsService) GetChainMetrics(ctx context.Context, metric string, chain string, opts *DimensionOptions) (map[string]any, error)

GetChainMetrics Get chain dimension data overview See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/metrics/%7Bmetric%7D/chain/%7Bchain%7D

func (*DimensionsService) GetChart

func (s *DimensionsService) GetChart(ctx context.Context, metric string, opts *DimensionOptions) ([]any, error)

GetChart Get historical timeseries chart data See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D

func (*DimensionsService) GetChartChainBreakdown

func (s *DimensionsService) GetChartChainBreakdown(ctx context.Context, metric string, opts *DimensionOptions) ([]any, error)

GetChartChainBreakdown Get historical timeseries chart data breakdown by chain See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/chain-breakdown

func (*DimensionsService) GetChartProtocolBreakdown

func (s *DimensionsService) GetChartProtocolBreakdown(ctx context.Context, metric string, opts *DimensionOptions) ([]any, error)

GetChartProtocolBreakdown Get historical timeseries chart data breakdown by protocol See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/protocol-breakdown

func (*DimensionsService) GetMetrics

func (s *DimensionsService) GetMetrics(ctx context.Context, metric string, opts *DimensionOptions) (map[string]any, error)

GetMetrics Get dimension data overview See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/metrics/%7Bmetric%7D

func (*DimensionsService) GetProtocolChart

func (s *DimensionsService) GetProtocolChart(ctx context.Context, metric string, protocol string, opts *DimensionOptions) ([]any, error)

GetProtocolChart Get protocol historical timeseries chart data See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/protocol/%7Bprotocol%7D

func (*DimensionsService) GetProtocolChartChainBreakdown

func (s *DimensionsService) GetProtocolChartChainBreakdown(ctx context.Context, metric string, protocol string, opts *DimensionOptions) ([]any, error)

GetProtocolChartChainBreakdown Get protocol timeseries chart data breakdown by chain See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/protocol/%7Bprotocol%7D/chain-breakdown

func (*DimensionsService) GetProtocolChartLabelBreakdown

func (s *DimensionsService) GetProtocolChartLabelBreakdown(ctx context.Context, metric string, protocol string, opts *DimensionOptions) ([]any, error)

GetProtocolChartLabelBreakdown Get protocol timeseries chart data breakdown by label See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/protocol/%7Bprotocol%7D/label-breakdown

func (*DimensionsService) GetProtocolChartVersionBreakdown

func (s *DimensionsService) GetProtocolChartVersionBreakdown(ctx context.Context, metric string, protocol string, opts *DimensionOptions) ([]any, error)

GetProtocolChartVersionBreakdown Get protocol timeseries chart data breakdown by version See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/chart/%7Bmetric%7D/protocol/%7Bprotocol%7D/version-breakdown

func (*DimensionsService) GetProtocolMetrics

func (s *DimensionsService) GetProtocolMetrics(ctx context.Context, metric string, protocol string, opts *DimensionOptions) (map[string]any, error)

GetProtocolMetrics Get protocol dimension data overview See: https://api-docs.defillama.com/#tag/dimensions/get/api/v2/metrics/%7Bmetric%7D/protocol/%7Bprotocol%7D

type ETFsService

type ETFsService struct {
	// contains filtered or unexported fields
}

ETFsService provides access to the ETFs endpoints.

func (*ETFsService) GetFlows

func (s *ETFsService) GetFlows(ctx context.Context) ([]any, error)

GetFlows Historical Flows at the Asset Level See: https://api-docs.defillama.com/#tag/etfs/get/etfs/flows

func (*ETFsService) GetSnapshot

func (s *ETFsService) GetSnapshot(ctx context.Context) ([]any, error)

GetSnapshot Get ETFs and their metrics (aum, flows, fees...) See: https://api-docs.defillama.com/#tag/etfs/get/etfs/snapshot

type EarnPoolsQuery

type EarnPoolsQuery struct {
	Chain               *string  // query: chain
	Protocol            *string  // query: protocol
	Stablecoin          *bool    // query: stablecoin
	SingleAssetExposure *bool    // query: single_asset_exposure
	ImpermanentLossRisk *bool    // query: impermanent_loss_risk
	MinTVL              *float64 // query: min_tvl
	Page                *int64   // query: page
	Limit               *int64   // query: limit
}

EarnPoolsQuery holds optional/required query parameters. Nil pointer fields are omitted.

type EcosystemService

type EcosystemService struct {
	// contains filtered or unexported fields
}

EcosystemService provides access to the Ecosystem endpoints.

func (*EcosystemService) GetCategories

func (s *EcosystemService) GetCategories(ctx context.Context) (map[string]any, error)

GetCategories Overview of all categories across all protocols See: https://api-docs.defillama.com/#tag/main-page/get/api/categories

func (*EcosystemService) GetEntities

func (s *EcosystemService) GetEntities(ctx context.Context) ([]any, error)

GetEntities List all entities See: https://api-docs.defillama.com/#tag/main-page/get/api/entities

func (*EcosystemService) GetForks

func (s *EcosystemService) GetForks(ctx context.Context) (map[string]any, error)

GetForks Overview of all forks across all protocols See: https://api-docs.defillama.com/#tag/main-page/get/api/forks

func (*EcosystemService) GetHacks

func (s *EcosystemService) GetHacks(ctx context.Context) ([]any, error)

GetHacks Overview of all hacks on our Hacks dashboard See: https://api-docs.defillama.com/#tag/main-page/get/api/hacks

func (*EcosystemService) GetOracles

func (s *EcosystemService) GetOracles(ctx context.Context) (map[string]any, error)

GetOracles Overview of all oracles across all protocols See: https://api-docs.defillama.com/#tag/main-page/get/api/oracles

func (*EcosystemService) GetRaises

func (s *EcosystemService) GetRaises(ctx context.Context) (map[string]any, error)

GetRaises Overview of all raises on our Raises dashboard See: https://api-docs.defillama.com/#tag/main-page/get/api/raises

func (*EcosystemService) GetTreasuries

func (s *EcosystemService) GetTreasuries(ctx context.Context) ([]any, error)

GetTreasuries List all protocols on our Treasuries dashboard See: https://api-docs.defillama.com/#tag/main-page/get/api/treasuries

type EmissionsService

type EmissionsService struct {
	// contains filtered or unexported fields
}

EmissionsService provides access to the Emissions endpoints.

func (*EmissionsService) GetEmission

func (s *EmissionsService) GetEmission(ctx context.Context, protocol string) (map[string]any, error)

GetEmission Unlocks data for a given token/protocol. You can find a list of available slugs to query by querying /emissions and then extracting the key `gecko_id` See: https://api-docs.defillama.com/#tag/unlocks/get/api/emission/%7Bprotocol%7D

func (*EmissionsService) GetEmissions

func (s *EmissionsService) GetEmissions(ctx context.Context) ([]any, error)

GetEmissions List of all tokens along with basic info for each See: https://api-docs.defillama.com/#tag/unlocks/get/api/emissions

type EquitiesQuery

type EquitiesQuery struct {
	Ticker    string  // query: ticker
	Country   string  // query: country
	Timeframe *string // query: timeframe
}

EquitiesQuery holds optional/required query parameters. Nil pointer fields are omitted.

type EquitiesService

type EquitiesService struct {
	// contains filtered or unexported fields
}

EquitiesService provides access to the Equities endpoints.

func (*EquitiesService) GetCompaniesList

func (s *EquitiesService) GetCompaniesList(ctx context.Context) ([]EquityCompany, error)

GetCompaniesList Get list of all tracked public companies See: https://api-docs.defillama.com/#tag/equities/get/equities/v1/companies-list

func (*EquitiesService) GetDimensions

func (s *EquitiesService) GetDimensions(ctx context.Context, opts EquitiesQuery) (map[string]any, error)

GetDimensions Get financial dimensions for a company See: https://api-docs.defillama.com/#tag/equities/get/equities/v1/dimensions

func (*EquitiesService) GetFilings

func (s *EquitiesService) GetFilings(ctx context.Context, opts EquitiesQuery) ([]any, error)

GetFilings Get filings for a company See: https://api-docs.defillama.com/#tag/equities/get/equities/v1/filings

func (*EquitiesService) GetOHLCV

func (s *EquitiesService) GetOHLCV(ctx context.Context, opts EquitiesQuery) ([]any, error)

GetOHLCV Get OHLCV candle data for a company See: https://api-docs.defillama.com/#tag/equities/get/equities/v1/ohlcv

func (*EquitiesService) GetOnchainMarkets

func (s *EquitiesService) GetOnchainMarkets(ctx context.Context, opts EquitiesQuery) (map[string]any, error)

GetOnchainMarkets Get on-chain tradeable markets for a company See: https://api-docs.defillama.com/#tag/equities/get/equities/v1/onchain

func (*EquitiesService) GetPriceHistory

func (s *EquitiesService) GetPriceHistory(ctx context.Context, opts EquitiesQuery) ([]any, error)

GetPriceHistory Get historical price data for a company See: https://api-docs.defillama.com/#tag/equities/get/equities/v1/price-history

func (*EquitiesService) GetStatements

func (s *EquitiesService) GetStatements(ctx context.Context, opts EquitiesQuery) (map[string]any, error)

GetStatements Get financial statements for a company See: https://api-docs.defillama.com/#tag/equities/get/equities/v1/statements

func (*EquitiesService) GetSummary

func (s *EquitiesService) GetSummary(ctx context.Context, opts EquitiesQuery) (map[string]any, error)

GetSummary Get live market summary for a company See: https://api-docs.defillama.com/#tag/equities/get/equities/v1/summary

type EquityCompany

type EquityCompany struct {
	Ticker      string         `json:"ticker"`
	CompanyName string         `json:"companyName"`
	Country     string         `json:"country"`
	CountryName string         `json:"countryName"`
	Raw         map[string]any `json:"-"`
}

EquityCompany is an entry of GET /equities/v1/companies-list.

func (*EquityCompany) UnmarshalJSON

func (e *EquityCompany) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type FeesService

type FeesService struct {
	// contains filtered or unexported fields
}

FeesService provides access to the Fees endpoints.

func (*FeesService) GetOverview

func (s *FeesService) GetOverview(ctx context.Context, opts OverviewOptions) (map[string]any, error)

GetOverview List all protocols along with summaries of their fees and revenue and dataType history data See: https://api-docs.defillama.com/#tag/fees-and-revenue/get/overview/fees

func (*FeesService) GetOverviewByChain

func (s *FeesService) GetOverviewByChain(ctx context.Context, chain string, opts OverviewOptions) (map[string]any, error)

GetOverviewByChain List all protocols along with summaries of their fees and revenue and dataType history data by chain See: https://api-docs.defillama.com/#tag/fees-and-revenue/get/overview/fees/%7Bchain%7D

func (*FeesService) GetSummary

func (s *FeesService) GetSummary(ctx context.Context, protocol string, opts *DimensionOptions) (map[string]any, error)

GetSummary Get summary of protocol fees and revenue with historical data See: https://api-docs.defillama.com/#tag/fees-and-revenue/get/summary/fees/%7Bprotocol%7D

type FinancialStatementsService

type FinancialStatementsService struct {
	// contains filtered or unexported fields
}

FinancialStatementsService provides access to the FinancialStatements endpoints.

func (*FinancialStatementsService) GetIncomeStatement

func (s *FinancialStatementsService) GetIncomeStatement(ctx context.Context, protocol string) (map[string]any, error)

GetIncomeStatement Get protocol income statement report See: https://api-docs.defillama.com/#tag/financial-statements/get/api/v2/metrics/financial-statement/protocol/%7Bprotocol%7D

type ForksService

type ForksService struct {
	// contains filtered or unexported fields
}

ForksService provides access to the Forks endpoints.

func (*ForksService) GetForkChartProtocolBreakdown

func (s *ForksService) GetForkChartProtocolBreakdown(ctx context.Context) ([]any, error)

GetForkChartProtocolBreakdown Get timeseries chart data breakdown by protocol See: https://api-docs.defillama.com/#tag/forks/get/api/v2/chart/fork/protocol-breakdown

func (*ForksService) GetForkMetrics

func (s *ForksService) GetForkMetrics(ctx context.Context) (map[string]any, error)

GetForkMetrics Get fork data overview See: https://api-docs.defillama.com/#tag/forks/get/api/v2/metrics/fork

func (*ForksService) GetForkProtocolChart

func (s *ForksService) GetForkProtocolChart(ctx context.Context, protocol string) ([]any, error)

GetForkProtocolChart Get timeseries chart data by protocol See: https://api-docs.defillama.com/#tag/forks/get/api/v2/chart/fork/protocol/%7Bprotocol%7D

type HistoryRangeOptions

type HistoryRangeOptions struct {
	Range *string // query: range
}

HistoryRangeOptions holds optional/required query parameters. Nil pointer fields are omitted.

type LosslessObject added in v1.1.0

type LosslessObject struct {
	// contains filtered or unexported fields
}

LosslessObject stores an open JSON object without converting number lexemes to float64. It intentionally exposes accessors rather than a mutable map so unknown provider fields remain inspectable without sharing SDK-owned bytes.

func (LosslessObject) Field added in v1.1.0

func (o LosslessObject) Field(name string) (LosslessValue, bool)

Field returns a lossless member value and whether it was present. A present null is returned with ok=true and Value.IsNull()==true.

func (LosslessObject) Has added in v1.1.0

func (o LosslessObject) Has(name string) bool

Has reports whether a member was present, including when its value was null.

func (LosslessObject) Keys added in v1.1.0

func (o LosslessObject) Keys() []string

Keys returns object member names in stable lexical order.

func (*LosslessObject) UnmarshalJSON added in v1.1.0

func (o *LosslessObject) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler while preserving every member's original JSON representation.

type LosslessProtocol added in v1.1.0

type LosslessProtocol struct {
	// contains filtered or unexported fields
}

LosslessProtocol is one provider-native protocol record. Chain and token maps remain open through Fields rather than being constrained to an enum.

func (LosslessProtocol) Fields added in v1.1.0

func (p LosslessProtocol) Fields() LosslessObject

Fields returns the complete open object for this protocol record.

func (LosslessProtocol) ID added in v1.1.0

func (p LosslessProtocol) ID() (string, bool, error)

ID returns the provider-native protocol identifier when present.

func (LosslessProtocol) Name added in v1.1.0

func (p LosslessProtocol) Name() (string, bool, error)

Name returns the provider-native protocol name when present.

func (LosslessProtocol) TVL added in v1.1.0

func (p LosslessProtocol) TVL() (json.Number, bool, error)

TVL returns the exact provider TVL number lexeme when present and non-null.

type LosslessProtocolDetails added in v1.1.0

type LosslessProtocolDetails struct {
	// contains filtered or unexported fields
}

LosslessProtocolDetails is a provider-native response from GET /protocol/{protocol}. It intentionally models only selected stable fields; Fields retains the full response, including open chain/token maps.

func (LosslessProtocolDetails) ChainTVLs added in v1.1.0

ChainTVLs returns the open per-chain TVL map when present.

func (LosslessProtocolDetails) Fields added in v1.1.0

Fields returns the complete open provider object.

func (LosslessProtocolDetails) ID added in v1.1.0

ID returns the provider-native protocol identifier when present.

func (LosslessProtocolDetails) Name added in v1.1.0

Name returns the provider-native protocol name when present.

func (LosslessProtocolDetails) TVLHistory added in v1.1.0

func (d LosslessProtocolDetails) TVLHistory() ([]LosslessObject, bool, error)

TVLHistory returns provider history records exactly as open objects. Provider date values are provider timestamps (Unix seconds), not capture times.

func (*LosslessProtocolDetails) UnmarshalJSON added in v1.1.0

func (d *LosslessProtocolDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type LosslessProtocols added in v1.1.0

type LosslessProtocols struct {
	// contains filtered or unexported fields
}

LosslessProtocols is a provider-native response from GET /protocols. It exposes only selected convenience fields; all provider additions remain in each entry's Fields object.

func (LosslessProtocols) Entries added in v1.1.0

func (p LosslessProtocols) Entries() []LosslessProtocol

Entries returns the provider-native protocol records.

func (*LosslessProtocols) UnmarshalJSON added in v1.1.0

func (p *LosslessProtocols) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for the protocol array response.

type LosslessValue added in v1.1.0

type LosslessValue struct {
	// contains filtered or unexported fields
}

LosslessValue preserves one JSON value exactly and exposes safe, typed convenience accessors. It distinguishes an absent object member (Field's ok=false), a present null (IsNull), and numeric zero (Number returns "0").

func (LosslessValue) Array added in v1.1.0

func (v LosslessValue) Array() ([]LosslessValue, error)

Array returns values from a JSON array while retaining each element exactly.

func (LosslessValue) IsNull added in v1.1.0

func (v LosslessValue) IsNull() bool

IsNull reports whether the preserved value is the JSON literal null.

func (LosslessValue) Number added in v1.1.0

func (v LosslessValue) Number() (json.Number, error)

Number returns the original numeric lexeme without a float64 conversion.

func (LosslessValue) Object added in v1.1.0

func (v LosslessValue) Object() (LosslessObject, error)

Object returns a nested open JSON object.

func (LosslessValue) RawJSON added in v1.1.0

func (v LosslessValue) RawJSON() []byte

RawJSON returns a copy of the exact JSON value bytes.

func (LosslessValue) String added in v1.1.0

func (v LosslessValue) String() (string, error)

String returns a JSON string value.

type LosslessYieldChart added in v1.1.0

type LosslessYieldChart struct {
	// contains filtered or unexported fields
}

LosslessYieldChart is a provider-native response from GET /chart/{pool}. It contains only selected convenience accessors; all extra response and point fields remain available in open Fields objects.

func (LosslessYieldChart) Fields added in v1.1.0

Fields returns the complete open chart response object.

func (LosslessYieldChart) Points added in v1.1.0

Points returns chart records as open provider objects.

func (*LosslessYieldChart) UnmarshalJSON added in v1.1.0

func (c *LosslessYieldChart) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type LosslessYieldChartPoint added in v1.1.0

type LosslessYieldChartPoint struct {
	// contains filtered or unexported fields
}

LosslessYieldChartPoint is one provider-native chart record. Timestamp is an ISO-8601 provider timestamp, distinct from ResponseReceipt.CapturedAt.

func (LosslessYieldChartPoint) APY added in v1.1.0

APY returns the exact APY percentage lexeme when present and non-null.

func (LosslessYieldChartPoint) APYBase added in v1.1.0

func (p LosslessYieldChartPoint) APYBase() (json.Number, bool, error)

APYBase returns the exact base APY percentage lexeme when present and non-null.

func (LosslessYieldChartPoint) APYReward added in v1.1.0

func (p LosslessYieldChartPoint) APYReward() (LosslessValue, bool)

APYReward returns the raw reward APY member, preserving absent/null/zero.

func (LosslessYieldChartPoint) Fields added in v1.1.0

Fields returns the complete open provider object.

func (LosslessYieldChartPoint) TVLUSD added in v1.1.0

func (p LosslessYieldChartPoint) TVLUSD() (json.Number, bool, error)

TVLUSD returns the exact provider TVL number lexeme when present and non-null.

func (LosslessYieldChartPoint) Timestamp added in v1.1.0

func (p LosslessYieldChartPoint) Timestamp() (string, bool, error)

Timestamp returns the provider's ISO-8601 chart timestamp when present.

type LosslessYieldPool added in v1.1.0

type LosslessYieldPool struct {
	// contains filtered or unexported fields
}

LosslessYieldPool is a provider-native yield pool. APY values are provider percentages, not ratios. Predictions and classification fields remain open in Fields and are not interpreted as observed APY.

func (LosslessYieldPool) APY added in v1.1.0

func (p LosslessYieldPool) APY() (json.Number, bool, error)

APY returns the exact APY percentage lexeme when present and non-null.

func (LosslessYieldPool) APYBase added in v1.1.0

func (p LosslessYieldPool) APYBase() (json.Number, bool, error)

APYBase returns the exact base APY percentage lexeme when present and non-null.

func (LosslessYieldPool) APYReward added in v1.1.0

func (p LosslessYieldPool) APYReward() (LosslessValue, bool)

APYReward returns the raw APY reward member. Use the returned present value plus IsNull to distinguish absent, null, and numeric zero.

func (LosslessYieldPool) Fields added in v1.1.0

func (p LosslessYieldPool) Fields() LosslessObject

Fields returns the complete open provider object.

func (LosslessYieldPool) PoolID added in v1.1.0

func (p LosslessYieldPool) PoolID() (string, bool, error)

PoolID returns the provider-native pool identifier, not a universal asset ID.

func (LosslessYieldPool) RewardTokens added in v1.1.0

func (p LosslessYieldPool) RewardTokens() (LosslessValue, bool)

RewardTokens returns the raw rewardTokens member. It preserves the distinction between absent, null, and an empty array.

type LosslessYieldPools added in v1.1.0

type LosslessYieldPools struct {
	// contains filtered or unexported fields
}

LosslessYieldPools is a provider-native response from GET /pools.

func (LosslessYieldPools) Fields added in v1.1.0

Fields returns the complete open response object.

func (LosslessYieldPools) Pools added in v1.1.0

Pools returns provider-native pool records as open objects.

func (*LosslessYieldPools) UnmarshalJSON added in v1.1.0

func (p *LosslessYieldPools) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type NarrativesService

type NarrativesService struct {
	// contains filtered or unexported fields
}

NarrativesService provides access to the Narratives endpoints.

func (*NarrativesService) GetPerformance

func (s *NarrativesService) GetPerformance(ctx context.Context, period string) ([]any, error)

GetPerformance Get chart of narratives based on category performance (with individual coins weighted by mcap) See: https://api-docs.defillama.com/#tag/narratives/get/fdv/performance/%7Bperiod%7D

type NotFoundError

type NotFoundError struct {
	*APIError
}

NotFoundError is an HTTP 404 response.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements error.

type Option

type Option func(*config) error

Option configures a Client.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the DefiLlama Pro API key. The key is embedded as a single URL path segment (https://pro-api.llama.fi/{API_KEY}/...) — never a header or query parameter — and is redacted from all errors and diagnostics. The application decides how to source the secret (e.g. os.Getenv).

func WithBaseURLsForTesting

func WithBaseURLsForTesting(m map[string]string) Option

WithBaseURLsForTesting overrides default base URLs. For tests and advanced use only: keys are the default origins ("https://api.llama.fi", "https://coins.llama.fi", "https://stablecoins.llama.fi", "https://yields.llama.fi", "https://pro-api.llama.fi").

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient sets a custom *http.Client for all requests. When unset, a default client is built using WithTimeout.

func WithMaxResponseBodyBytes added in v1.2.0

func WithMaxResponseBodyBytes(limit int64) Option

WithMaxResponseBodyBytes sets the maximum number of response bytes retained and decoded for each request. The default is DefaultMaxResponseBodyBytes (32 MiB). An over-limit response returns a ResponseBodyTooLargeError and is never retried.

func WithPreferProForFree

func WithPreferProForFree(v bool) Option

WithPreferProForFree routes the 31 Free endpoints through their official Pro equivalents when an API key is configured (/protocols -> /api/protocols, prices -> /coins/..., stablecoins -> /stablecoins/..., yields -> /yields/...). Default: false — Free routes use their own per-operation origins.

func WithReceiptObserver added in v1.1.0

func WithReceiptObserver(observer ReceiptObserver) Option

WithReceiptObserver receives an immutable ResponseReceipt for every HTTP response the SDK receives, including retryable responses before a later attempt succeeds. Use it when your application needs to retain provider receipts outside the SDK's ordinary typed response boundary.

The observer runs synchronously in the request goroutine. It receives a redacted URL and defensive copies from Body and Header; avoid logging or persisting receipt bodies unless your application's data policy allows it.

func WithRetryPolicy

func WithRetryPolicy(p RetryPolicy) Option

WithRetryPolicy configures bounded retries for idempotent GET requests. Only transient network errors, HTTP 429 and HTTP 5xx are retried; Retry-After is honored. Default: no retries.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the default request timeout. It is applied to the default http.Client; a custom WithHTTPClient manages its own timeouts. Per-request deadlines can always be tightened via context.

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent overrides the default "defillama-go/<version>" User-Agent.

type OraclesService

type OraclesService struct {
	// contains filtered or unexported fields
}

OraclesService provides access to the Oracles endpoints.

func (*OraclesService) GetOracleChainChart

func (s *OraclesService) GetOracleChainChart(ctx context.Context, chain string) ([]any, error)

GetOracleChainChart Get timeseries chart data by chain See: https://api-docs.defillama.com/#tag/oracles/get/api/v2/chart/oracle/chain/%7Bchain%7D

func (*OraclesService) GetOracleChainChartProtocolBreakdown

func (s *OraclesService) GetOracleChainChartProtocolBreakdown(ctx context.Context, chain string) ([]any, error)

GetOracleChainChartProtocolBreakdown Get protocol breakdown timeseries chart data by chain See: https://api-docs.defillama.com/#tag/oracles/get/api/v2/chart/oracle/chain/%7Bchain%7D/protocol-breakdown

func (*OraclesService) GetOracleChart

func (s *OraclesService) GetOracleChart(ctx context.Context) ([]any, error)

GetOracleChart Get timeseries chart data for all oracles See: https://api-docs.defillama.com/#tag/oracles/get/api/v2/chart/oracle

func (*OraclesService) GetOracleChartChainBreakdown

func (s *OraclesService) GetOracleChartChainBreakdown(ctx context.Context) ([]any, error)

GetOracleChartChainBreakdown Get timeseries chart data breakdown by chain See: https://api-docs.defillama.com/#tag/oracles/get/api/v2/chart/oracle/chain-breakdown

func (*OraclesService) GetOracleChartProtocolBreakdown

func (s *OraclesService) GetOracleChartProtocolBreakdown(ctx context.Context) ([]any, error)

GetOracleChartProtocolBreakdown Get timeseries chart data breakdown by protocol See: https://api-docs.defillama.com/#tag/oracles/get/api/v2/chart/oracle/protocol-breakdown

func (*OraclesService) GetOracleMetrics

func (s *OraclesService) GetOracleMetrics(ctx context.Context) (map[string]any, error)

GetOracleMetrics Get oracle data overview See: https://api-docs.defillama.com/#tag/oracles/get/api/v2/metrics/oracle

func (*OraclesService) GetOracleProtocolChart

func (s *OraclesService) GetOracleProtocolChart(ctx context.Context, protocol string) ([]any, error)

GetOracleProtocolChart Get timeseries chart data by protocol/oracle See: https://api-docs.defillama.com/#tag/oracles/get/api/v2/chart/oracle/protocol/%7Bprotocol%7D

func (*OraclesService) GetOracleProtocolChartChainBreakdown

func (s *OraclesService) GetOracleProtocolChartChainBreakdown(ctx context.Context, protocol string) ([]any, error)

GetOracleProtocolChartChainBreakdown Get chain breakdown timeseries chart data by protocol/oracle See: https://api-docs.defillama.com/#tag/oracles/get/api/v2/chart/oracle/protocol/%7Bprotocol%7D/chain-breakdown

type OverviewOptions

type OverviewOptions struct {
	ExcludeTotalDataChart          bool    // query: excludeTotalDataChart
	ExcludeTotalDataChartBreakdown bool    // query: excludeTotalDataChartBreakdown
	DataType                       *string // query: dataType
}

OverviewOptions holds optional/required query parameters. Nil pointer fields are omitted.

type PercentageOptions

type PercentageOptions struct {
	Timestamp   *float64 // query: timestamp
	LookForward *bool    // query: lookForward
	Period      *string  // query: period
}

PercentageOptions holds optional/required query parameters. Nil pointer fields are omitted.

type PreIPOCompany

type PreIPOCompany struct {
	ID                       string         `json:"id"`
	Name                     string         `json:"name"`
	Description              string         `json:"description"`
	Website                  string         `json:"website"`
	Sector                   string         `json:"sector"`
	LatestEstimatedValuation *float64       `json:"latestEstimatedValuation"`
	LatestRaise              *float64       `json:"latestRaise"`
	LatestFundingValuation   *float64       `json:"latestFundingValuation"`
	LatestFundingDate        string         `json:"latestFundingDate"`
	TotalRaised              *float64       `json:"totalRaised"`
	Raw                      map[string]any `json:"-"`
}

PreIPOCompany is an entry of GET /pre-ipo/v1/companies-list (data array).

func (*PreIPOCompany) UnmarshalJSON

func (p *PreIPOCompany) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type PreIPOQuery

type PreIPOQuery struct {
	Company string // query: company
}

PreIPOQuery holds optional/required query parameters. Nil pointer fields are omitted.

type PreIPOService

type PreIPOService struct {
	// contains filtered or unexported fields
}

PreIPOService provides access to the PreIPO endpoints.

func (*PreIPOService) GetCompaniesList

func (s *PreIPOService) GetCompaniesList(ctx context.Context) ([]PreIPOCompany, error)

GetCompaniesList Get list of all tracked pre-IPO companies See: https://api-docs.defillama.com/#tag/pre-ipo/get/pre-ipo/v1/companies-list

func (*PreIPOService) GetIntegrations

func (s *PreIPOService) GetIntegrations(ctx context.Context, opts PreIPOQuery) (map[string]any, error)

GetIntegrations Get tradeable markets for a pre-IPO company See: https://api-docs.defillama.com/#tag/pre-ipo/get/pre-ipo/v1/integrations

func (*PreIPOService) GetRaises

func (s *PreIPOService) GetRaises(ctx context.Context, opts PreIPOQuery) (map[string]any, error)

GetRaises Get funding rounds for a pre-IPO company See: https://api-docs.defillama.com/#tag/pre-ipo/get/pre-ipo/v1/raises

func (*PreIPOService) GetSummary

func (s *PreIPOService) GetSummary(ctx context.Context, opts PreIPOQuery) (map[string]any, error)

GetSummary Get profile and latest valuation for a pre-IPO company See: https://api-docs.defillama.com/#tag/pre-ipo/get/pre-ipo/v1/summary

func (*PreIPOService) GetValuations

func (s *PreIPOService) GetValuations(ctx context.Context, opts PreIPOQuery) (map[string]any, error)

GetValuations Get valuation history for a pre-IPO company See: https://api-docs.defillama.com/#tag/pre-ipo/get/pre-ipo/v1/valuations

type PricesService

type PricesService struct {
	// contains filtered or unexported fields
}

PricesService provides access to the Prices endpoints.

func (*PricesService) GetBatchHistoricalPrices

func (s *PricesService) GetBatchHistoricalPrices(ctx context.Context, coins map[string][]int64) (map[string]any, error)

GetBatchHistoricalPrices Get historical prices for multiple tokens at multiple different timestamps See: https://api-docs.defillama.com/#tag/coins/get/batchHistorical

func (*PricesService) GetBlockAtTimestamp

func (s *PricesService) GetBlockAtTimestamp(ctx context.Context, chain string, timestamp int64) (*Block, error)

GetBlockAtTimestamp Get the closest block to a timestamp See: https://api-docs.defillama.com/#tag/coins/get/block/%7Bchain%7D/%7Btimestamp%7D

func (*PricesService) GetChart

func (s *PricesService) GetChart(ctx context.Context, coins []string, opts *ChartOptions) (map[string]any, error)

GetChart Get token prices at regular time intervals See: https://api-docs.defillama.com/#tag/coins/get/chart/%7Bcoins%7D

func (*PricesService) GetCurrentPrices

func (s *PricesService) GetCurrentPrices(ctx context.Context, coins []string) (map[string]CoinPrice, error)

GetCurrentPrices Get current prices of tokens by contract address See: https://api-docs.defillama.com/#tag/coins/get/prices/current/%7Bcoins%7D

func (*PricesService) GetFirstPrices

func (s *PricesService) GetFirstPrices(ctx context.Context, coins []string) (map[string]CoinPrice, error)

GetFirstPrices Get earliest timestamp price record for coins See: https://api-docs.defillama.com/#tag/coins/get/prices/first/%7Bcoins%7D

func (*PricesService) GetHistoricalLiquidity

func (s *PricesService) GetHistoricalLiquidity(ctx context.Context, token string) (map[string]any, error)

GetHistoricalLiquidity Provides the name of contracts on a determined chain See: https://api-docs.defillama.com/#tag/token-liquidity/get/api/historicalLiquidity/%7Btoken%7D

func (*PricesService) GetHistoricalPrices

func (s *PricesService) GetHistoricalPrices(ctx context.Context, coins []string, timestamp int64) (map[string]CoinPrice, error)

GetHistoricalPrices Get historical prices of tokens by contract address See: https://api-docs.defillama.com/#tag/coins/get/prices/historical/%7Btimestamp%7D/%7Bcoins%7D

func (*PricesService) GetPercentageChange

func (s *PricesService) GetPercentageChange(ctx context.Context, coins []string, opts *PercentageOptions) (map[string]any, error)

GetPercentageChange Get percentage change in price over time See: https://api-docs.defillama.com/#tag/coins/get/percentage/%7Bcoins%7D

type ProAPIKeyRequiredError

type ProAPIKeyRequiredError struct {
	// Route is the registry route id ("GET /path").
	Route string
}

ProAPIKeyRequiredError is returned locally — before any HTTP request is built — when a Pro endpoint is called without an API key.

func (*ProAPIKeyRequiredError) Error

func (e *ProAPIKeyRequiredError) Error() string

Error implements error.

type Protocol

type Protocol struct {
	ID        string             `json:"id"`
	Name      string             `json:"name"`
	Symbol    string             `json:"symbol"`
	Category  string             `json:"category"`
	Chains    []string           `json:"chains"`
	TVL       float64            `json:"tvl"`
	ChainTVLs map[string]float64 `json:"chainTvls"`
	Change1d  float64            `json:"change_1d"`
	Change7d  float64            `json:"change_7d"`
	Raw       map[string]any     `json:"-"`
}

Protocol is an entry of GET /protocols.

func (*Protocol) UnmarshalJSON

func (p *Protocol) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type ProtocolDetails

type ProtocolDetails struct {
	Raw map[string]any
}

ProtocolDetails is the response of GET /protocol/{protocol}. The shape evolves, so the decoded payload is exposed via Raw with typed accessors for the stable fields.

func (*ProtocolDetails) ChainTVLs

func (d *ProtocolDetails) ChainTVLs() map[string]any

ChainTVLs returns the per-chain TVL breakdown.

func (*ProtocolDetails) Name

func (d *ProtocolDetails) Name() string

Name returns the protocol name, if present.

func (*ProtocolDetails) Slug

func (d *ProtocolDetails) Slug() string

Slug returns the protocol slug, if present.

func (*ProtocolDetails) TVLHistory

func (d *ProtocolDetails) TVLHistory() []any

TVLHistory returns the raw historical TVL series.

type RWAAsset

type RWAAsset struct {
	ID          string             `json:"id"`
	Ticker      string             `json:"ticker"`
	AssetName   string             `json:"assetName"`
	AssetGroup  string             `json:"assetGroup"`
	Issuer      string             `json:"issuer"`
	Chain       []string           `json:"chain"`
	Category    []string           `json:"category"`
	OnChainMcap map[string]float64 `json:"onChainMcap"`
	Price       *float64           `json:"price"`
	Stablecoin  *bool              `json:"stablecoin"`
	Governance  *bool              `json:"governance"`
	Raw         map[string]any     `json:"-"`
}

RWAAsset is an entry of GET /rwa/current and /rwa/chain/{chain}.

func (*RWAAsset) UnmarshalJSON

func (a *RWAAsset) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type RWAChartOptions

type RWAChartOptions struct {
	Key               *string // query: key
	IncludeStablecoin *bool   // query: includeStablecoin
	IncludeGovernance *bool   // query: includeGovernance
}

RWAChartOptions holds optional/required query parameters. Nil pointer fields are omitted.

type RWAService

type RWAService struct {
	// contains filtered or unexported fields
}

RWAService provides access to the RWA endpoints.

func (*RWAService) GetAssetsByChain

func (s *RWAService) GetAssetsByChain(ctx context.Context, chain string) (map[string]any, error)

GetAssetsByChain List current RWA assets on a chain See: https://api-docs.defillama.com/#tag/rwa/get/rwa/chain/%7Bchain%7D

func (*RWAService) GetChainChart

func (s *RWAService) GetChainChart(ctx context.Context, chain string) ([]any, error)

GetChainChart Get historical RWA chart data for a chain See: https://api-docs.defillama.com/#tag/rwa/get/rwa/chart/chain/%7Bchain%7D

func (*RWAService) GetChartChainBreakdown

func (s *RWAService) GetChartChainBreakdown(ctx context.Context, opts *RWAChartOptions) ([]any, error)

GetChartChainBreakdown Get historical RWA metric breakdown by chain See: https://api-docs.defillama.com/#tag/rwa/get/rwa/chart/chain-breakdown

func (*RWAService) GetCurrentAssets

func (s *RWAService) GetCurrentAssets(ctx context.Context) ([]RWAAsset, error)

GetCurrentAssets List all current RWA assets See: https://api-docs.defillama.com/#tag/rwa/get/rwa/current

func (*RWAService) GetList

func (s *RWAService) GetList(ctx context.Context) (map[string]any, error)

GetList List RWA ids and filter values See: https://api-docs.defillama.com/#tag/rwa/get/rwa/list

func (*RWAService) GetStats

func (s *RWAService) GetStats(ctx context.Context) (map[string]any, error)

GetStats Get aggregate RWA stats by chain, category, platform, and asset group See: https://api-docs.defillama.com/#tag/rwa/get/rwa/stats

type RateLimitError

type RateLimitError struct {
	*APIError
	RetryAfter time.Duration
}

RateLimitError is an HTTP 429 response. RetryAfter is the parsed Retry-After value, or zero when the header was absent/unparseable.

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

Error implements error.

type ReceiptObserver added in v1.1.0

type ReceiptObserver func(ResponseReceipt)

ReceiptObserver receives one immutable receipt for every HTTP response the SDK receives, including retryable responses before a later retry succeeds. The observer runs synchronously in the calling request's goroutine.

type ResponseBodyTooLargeError added in v1.2.0

type ResponseBodyTooLargeError struct {
	Limit int64
}

ResponseBodyTooLargeError reports a response that exceeded the configured body limit. It is never retryable because a retry would not reduce the body.

func (*ResponseBodyTooLargeError) Error added in v1.2.0

func (e *ResponseBodyTooLargeError) Error() string

Error implements error.

func (*ResponseBodyTooLargeError) Unwrap added in v1.2.0

func (e *ResponseBodyTooLargeError) Unwrap() error

Unwrap allows errors.Is(err, ErrResponseBodyTooLarge).

type ResponseReceipt added in v1.1.0

type ResponseReceipt struct {
	// Route is the SDK route identifier, for example "GET /protocols".
	Route string
	// SourceURL is the redacted request URL actually selected for this response.
	SourceURL string
	// DocsURL points to the route's official API reference when available.
	DocsURL string
	// StatusCode is the HTTP response status.
	StatusCode int
	// Attempt is the one-based request attempt number for this operation.
	Attempt int
	// CapturedAt is when the SDK received the response, in UTC. It is distinct
	// from any provider timestamp in the response body.
	CapturedAt time.Time
	// CompletedAt is when bounded reading, draining, and closing the original
	// response body completed. It is distinct from provider event time.
	CompletedAt time.Time
	// Complete reports that the original body reached EOF within the configured
	// limit and closed successfully. It does not indicate an HTTP success, valid
	// JSON, or provider-data quality.
	Complete bool
	// contains filtered or unexported fields
}

ResponseReceipt is an immutable record of one HTTP response received by the SDK. It preserves the response body byte-for-byte and records the selected route, its redacted request URL, and transport lifecycle times. It may hold an incomplete prefix when the body cannot be fully read or exceeds the configured response limit.

Body returns a copy. Decode uses json.Decoder.UseNumber, so numbers decoded into interface values remain json.Number rather than float64. Receipts are intended for callers that need a lossless boundary around provider-native data; callers are responsible for retaining them securely.

func (ResponseReceipt) Body added in v1.1.0

func (r ResponseReceipt) Body() []byte

Body returns an independent copy of the exact response body bytes.

func (ResponseReceipt) BodySHA256 added in v1.1.0

func (r ResponseReceipt) BodySHA256() string

BodySHA256 returns the lowercase SHA-256 digest of the exact response body.

func (ResponseReceipt) Decode added in v1.1.0

func (r ResponseReceipt) Decode(out any) error

Decode decodes the exact receipt body into out with json.Number preserved. It rejects trailing data and multiple JSON values.

func (ResponseReceipt) Header added in v1.1.0

func (r ResponseReceipt) Header() http.Header

Header returns an independent copy of the response headers.

type RetryPolicy

type RetryPolicy struct {
	// MaxAttempts is the total number of attempts including the first (1 = off).
	MaxAttempts int
	// BaseDelay is the delay before the first retry; it doubles per attempt.
	BaseDelay time.Duration
	// MaxDelay caps a single delay.
	MaxDelay time.Duration
	// Jitter adds +/-50% randomization to each computed delay.
	Jitter bool
}

RetryPolicy configures bounded retries for GET requests.

type Stablecoin

type Stablecoin struct {
	ID           string         `json:"id"`
	Name         string         `json:"name"`
	Symbol       string         `json:"symbol"`
	PegType      string         `json:"pegType"`
	PegMechanism string         `json:"pegMechanism"`
	Circulating  map[string]any `json:"circulating"`
	Chains       []string       `json:"chains"`
	Price        float64        `json:"price"`
	Raw          map[string]any `json:"-"`
}

Stablecoin is an entry of GET /stablecoins (peggedAssets).

func (*Stablecoin) UnmarshalJSON

func (s *Stablecoin) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type StablecoinChartOptions

type StablecoinChartOptions struct {
	Stablecoin *int64 // query: stablecoin
}

StablecoinChartOptions holds optional/required query parameters. Nil pointer fields are omitted.

type StablecoinsListOptions

type StablecoinsListOptions struct {
	IncludePrices *bool // query: includePrices
}

StablecoinsListOptions holds optional/required query parameters. Nil pointer fields are omitted.

type StablecoinsService

type StablecoinsService struct {
	// contains filtered or unexported fields
}

StablecoinsService provides access to the Stablecoins endpoints.

func (*StablecoinsService) GetStablecoin

func (s *StablecoinsService) GetStablecoin(ctx context.Context, asset int64) (map[string]any, error)

GetStablecoin Get historical mcap and historical chain distribution of a stablecoin See: https://api-docs.defillama.com/#tag/stablecoins/get/stablecoin/%7Basset%7D

func (*StablecoinsService) GetStablecoinChains

func (s *StablecoinsService) GetStablecoinChains(ctx context.Context) ([]any, error)

GetStablecoinChains Get current mcap sum of all stablecoins on each chain See: https://api-docs.defillama.com/#tag/stablecoins/get/stablecoinchains

func (*StablecoinsService) GetStablecoinCharts

func (s *StablecoinsService) GetStablecoinCharts(ctx context.Context, opts *StablecoinChartOptions) ([]any, error)

GetStablecoinCharts Get historical mcap sum of all stablecoins See: https://api-docs.defillama.com/#tag/stablecoins/get/stablecoincharts/all

func (*StablecoinsService) GetStablecoinChartsByChain

func (s *StablecoinsService) GetStablecoinChartsByChain(ctx context.Context, chain string, opts *StablecoinChartOptions) ([]any, error)

GetStablecoinChartsByChain Get historical mcap sum of all stablecoins in a chain See: https://api-docs.defillama.com/#tag/stablecoins/get/stablecoincharts/%7Bchain%7D

func (*StablecoinsService) GetStablecoinDominance

func (s *StablecoinsService) GetStablecoinDominance(ctx context.Context, chain string, opts *StablecoinChartOptions) ([]any, error)

GetStablecoinDominance Get stablecoin dominance per chain along with the info about the larges coin in a chain See: https://api-docs.defillama.com/#tag/stablecoins/get/stablecoins/stablecoindominance/%7Bchain%7D

func (*StablecoinsService) GetStablecoinPrices

func (s *StablecoinsService) GetStablecoinPrices(ctx context.Context) ([]any, error)

GetStablecoinPrices Get historical prices of all stablecoins See: https://api-docs.defillama.com/#tag/stablecoins/get/stablecoinprices

func (*StablecoinsService) GetStablecoins

func (s *StablecoinsService) GetStablecoins(ctx context.Context, opts *StablecoinsListOptions) ([]Stablecoin, error)

GetStablecoins List all stablecoins along with their circulating amounts See: https://api-docs.defillama.com/#tag/stablecoins/get/stablecoins

type TVLChartOptions

type TVLChartOptions struct {
	Key      *string // query: key
	Currency *string // query: currency
}

TVLChartOptions holds optional/required query parameters. Nil pointer fields are omitted.

type TVLService

type TVLService struct {
	// contains filtered or unexported fields
}

TVLService provides access to the TVL endpoints.

func (*TVLService) GetChainAssets

func (s *TVLService) GetChainAssets(ctx context.Context) (map[string]any, error)

GetChainAssets Get assets of all chains See: https://api-docs.defillama.com/#tag/tvl/get/api/chainAssets

func (*TVLService) GetChains

func (s *TVLService) GetChains(ctx context.Context) ([]Chain, error)

GetChains Get current TVL of all chains See: https://api-docs.defillama.com/#tag/tvl/get/v2/chains

func (*TVLService) GetHistoricalChainTVL

func (s *TVLService) GetHistoricalChainTVL(ctx context.Context) ([]any, error)

GetHistoricalChainTVL Get historical TVL (excludes liquid staking and double counted tvl) of DeFi on all chains See: https://api-docs.defillama.com/#tag/tvl/get/v2/historicalChainTvl

func (*TVLService) GetHistoricalChainTVLByChain

func (s *TVLService) GetHistoricalChainTVLByChain(ctx context.Context, chain string) ([]any, error)

GetHistoricalChainTVLByChain Get historical TVL (excludes liquid staking and double counted tvl) of a chain See: https://api-docs.defillama.com/#tag/tvl/get/v2/historicalChainTvl/%7Bchain%7D

func (*TVLService) GetInflows

func (s *TVLService) GetInflows(ctx context.Context, protocol string, timestamp int64) (map[string]any, error)

GetInflows Lists the amount of inflows and outflows for a protocol at a given date See: https://api-docs.defillama.com/#tag/tvl/get/api/inflows/%7Bprotocol%7D/%7Btimestamp%7D

func (*TVLService) GetProtocol

func (s *TVLService) GetProtocol(ctx context.Context, protocol string) (*ProtocolDetails, error)

GetProtocol Get historical TVL of a protocol and breakdowns by token and chain See: https://api-docs.defillama.com/#tag/tvl/get/protocol/%7Bprotocol%7D

func (*TVLService) GetProtocolReceipt added in v1.1.0

func (s *TVLService) GetProtocolReceipt(ctx context.Context, protocol string) (*ResponseReceipt, error)

GetProtocolReceipt returns the lossless HTTP receipt for GET /protocol/{protocol}. Decode it into LosslessProtocolDetails to retain exact numeric lexemes and open chain/token maps.

func (*TVLService) GetProtocolTVLChart

func (s *TVLService) GetProtocolTVLChart(ctx context.Context, protocol string, opts *TVLChartOptions) ([]any, error)

GetProtocolTVLChart Get historical TVL chart for a protocol See: https://api-docs.defillama.com/#tag/tvl/get/api/v2/chart/tvl/protocol/%7Bprotocol%7D

func (*TVLService) GetProtocolTVLChartChainBreakdown

func (s *TVLService) GetProtocolTVLChartChainBreakdown(ctx context.Context, protocol string, opts *TVLChartOptions) ([]any, error)

GetProtocolTVLChartChainBreakdown Get historical TVL chart for a protocol broken down by chain See: https://api-docs.defillama.com/#tag/tvl/get/api/v2/chart/tvl/protocol/%7Bprotocol%7D/chain-breakdown

func (*TVLService) GetProtocolTVLChartTokenBreakdown

func (s *TVLService) GetProtocolTVLChartTokenBreakdown(ctx context.Context, protocol string, opts *TVLChartOptions) ([]any, error)

GetProtocolTVLChartTokenBreakdown Get historical TVL chart for a protocol broken down by token See: https://api-docs.defillama.com/#tag/tvl/get/api/v2/chart/tvl/protocol/%7Bprotocol%7D/token-breakdown

func (*TVLService) GetProtocolTVLMetrics

func (s *TVLService) GetProtocolTVLMetrics(ctx context.Context, protocol string) (map[string]any, error)

GetProtocolTVLMetrics Get aggregate TVL metrics for a protocol See: https://api-docs.defillama.com/#tag/tvl/get/api/v2/metrics/tvl/protocol/%7Bprotocol%7D

func (*TVLService) GetProtocols

func (s *TVLService) GetProtocols(ctx context.Context) ([]Protocol, error)

GetProtocols List all protocols on defillama along with their tvl See: https://api-docs.defillama.com/#tag/tvl/get/protocols

func (*TVLService) GetProtocolsReceipt added in v1.1.0

func (s *TVLService) GetProtocolsReceipt(ctx context.Context) (*ResponseReceipt, error)

GetProtocolsReceipt returns the lossless HTTP receipt for GET /protocols. Decode it into LosslessProtocols to retain exact numeric lexemes and open provider fields, or use ResponseReceipt.Decode with a caller-owned DTO.

func (*TVLService) GetTVL

func (s *TVLService) GetTVL(ctx context.Context, protocol string) (float64, error)

GetTVL Simplified endpoint to get current TVL of a protocol See: https://api-docs.defillama.com/#tag/tvl/get/tvl/%7Bprotocol%7D

func (*TVLService) GetTokenProtocols

func (s *TVLService) GetTokenProtocols(ctx context.Context, symbol string) ([]any, error)

GetTokenProtocols Lists the amount of a certain token within all protocols. Data for the Token Usage page See: https://api-docs.defillama.com/#tag/tvl/get/api/tokenProtocols/%7Bsymbol%7D

type TransportError

type TransportError struct {
	// URL is the redacted request URL (API key replaced by {API_KEY}).
	URL string
	Err error
}

TransportError wraps a network-level failure (DNS, TLS, timeout, ...). Unwrap exposes the underlying error; errors.Is/As work through it.

func (*TransportError) Error

func (e *TransportError) Error() string

Error implements error.

func (*TransportError) Unwrap

func (e *TransportError) Unwrap() error

Unwrap returns the wrapped network error.

type TreasuryChartOptions

type TreasuryChartOptions struct {
	Key      *string // query: key
	Currency *string // query: currency
}

TreasuryChartOptions holds optional/required query parameters. Nil pointer fields are omitted.

type TreasuryService

type TreasuryService struct {
	// contains filtered or unexported fields
}

TreasuryService provides access to the Treasury endpoints.

func (*TreasuryService) GetTreasuryChart

func (s *TreasuryService) GetTreasuryChart(ctx context.Context, protocol string, opts *TreasuryChartOptions) ([]any, error)

GetTreasuryChart Get historical treasury chart for a protocol See: https://api-docs.defillama.com/#tag/treasury/get/api/v2/chart/treasury/protocol/%7Bprotocol%7D

func (*TreasuryService) GetTreasuryChartChainBreakdown

func (s *TreasuryService) GetTreasuryChartChainBreakdown(ctx context.Context, protocol string, opts *TreasuryChartOptions) ([]any, error)

GetTreasuryChartChainBreakdown Get historical treasury chart for a protocol broken down by chain See: https://api-docs.defillama.com/#tag/treasury/get/api/v2/chart/treasury/protocol/%7Bprotocol%7D/chain-breakdown

func (*TreasuryService) GetTreasuryChartTokenBreakdown

func (s *TreasuryService) GetTreasuryChartTokenBreakdown(ctx context.Context, protocol string, opts *TreasuryChartOptions) ([]any, error)

GetTreasuryChartTokenBreakdown Get historical treasury chart for a protocol broken down by token See: https://api-docs.defillama.com/#tag/treasury/get/api/v2/chart/treasury/protocol/%7Bprotocol%7D/token-breakdown

func (*TreasuryService) GetTreasuryMetrics

func (s *TreasuryService) GetTreasuryMetrics(ctx context.Context, protocol string) (map[string]any, error)

GetTreasuryMetrics Get aggregate treasury metrics for a protocol See: https://api-docs.defillama.com/#tag/treasury/get/api/v2/metrics/treasury/protocol/%7Bprotocol%7D

type VolumesService

type VolumesService struct {
	// contains filtered or unexported fields
}

VolumesService provides access to the Volumes endpoints.

func (*VolumesService) GetDEXOverview

func (s *VolumesService) GetDEXOverview(ctx context.Context, opts OverviewOptions) (map[string]any, error)

GetDEXOverview List all dexs along with summaries of their volumes and dataType history data See: https://api-docs.defillama.com/#tag/volumes/get/overview/dexs

func (*VolumesService) GetDEXOverviewByChain

func (s *VolumesService) GetDEXOverviewByChain(ctx context.Context, chain string, opts OverviewOptions) (map[string]any, error)

GetDEXOverviewByChain List all dexs along with summaries of their volumes and dataType history data filtering by chain See: https://api-docs.defillama.com/#tag/volumes/get/overview/dexs/%7Bchain%7D

func (*VolumesService) GetDEXSummary

func (s *VolumesService) GetDEXSummary(ctx context.Context, protocol string, opts OverviewOptions) (map[string]any, error)

GetDEXSummary Get summary of dex volume with historical data See: https://api-docs.defillama.com/#tag/volumes/get/summary/dexs/%7Bprotocol%7D

func (*VolumesService) GetDerivativesOverview

func (s *VolumesService) GetDerivativesOverview(ctx context.Context, opts OverviewOptions) (map[string]any, error)

GetDerivativesOverview Lists all derivatives along summaries of their volumes filtering by chain See: https://api-docs.defillama.com/#tag/perps/get/api/overview/derivatives

func (*VolumesService) GetDerivativesSummary

func (s *VolumesService) GetDerivativesSummary(ctx context.Context, protocol string, opts OverviewOptions) (map[string]any, error)

GetDerivativesSummary Volume Details about a specific perp protocol See: https://api-docs.defillama.com/#tag/perps/get/api/summary/derivatives/%7Bprotocol%7D

func (*VolumesService) GetOpenInterestOverview

func (s *VolumesService) GetOpenInterestOverview(ctx context.Context, opts OverviewOptions) (map[string]any, error)

GetOpenInterestOverview List all open interest dex exchanges along with summaries of their open interest See: https://api-docs.defillama.com/#tag/perps/get/overview/open-interest

func (*VolumesService) GetOptionsOverview

func (s *VolumesService) GetOptionsOverview(ctx context.Context, opts OverviewOptions) (map[string]any, error)

GetOptionsOverview List all options dexs along with summaries of their volumes and dataType history data See: https://api-docs.defillama.com/#tag/volumes/get/overview/options

func (*VolumesService) GetOptionsOverviewByChain

func (s *VolumesService) GetOptionsOverviewByChain(ctx context.Context, chain string, opts OverviewOptions) (map[string]any, error)

GetOptionsOverviewByChain List all options dexs along with summaries of their volumes and dataType history data filtering by chain See: https://api-docs.defillama.com/#tag/volumes/get/overview/options/%7Bchain%7D

func (*VolumesService) GetOptionsSummary

func (s *VolumesService) GetOptionsSummary(ctx context.Context, protocol string, opts *DimensionOptions) (map[string]any, error)

GetOptionsSummary Get summary of options dex volume with historical data See: https://api-docs.defillama.com/#tag/volumes/get/summary/options/%7Bprotocol%7D

type YieldPool

type YieldPool struct {
	Pool         string         `json:"pool"`
	Chain        string         `json:"chain"`
	Project      string         `json:"project"`
	Symbol       string         `json:"symbol"`
	TVLUsd       float64        `json:"tvlUsd"`
	APY          float64        `json:"apy"`
	APYBase      float64        `json:"apyBase"`
	APYReward    *float64       `json:"apyReward"`
	Stablecoin   bool           `json:"stablecoin"`
	IlRisk       string         `json:"ilRisk"`
	Exposure     string         `json:"exposure"`
	RewardTokens []string       `json:"rewardTokens"`
	Predictions  map[string]any `json:"predictions"`
	Raw          map[string]any `json:"-"`
}

YieldPool is an entry of GET yields.llama.fi/pools (data array).

func (*YieldPool) UnmarshalJSON

func (p *YieldPool) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the typed fields and retains the raw payload.

type YieldsService

type YieldsService struct {
	// contains filtered or unexported fields
}

YieldsService provides access to the Yields endpoints.

func (*YieldsService) GetBorrowMarketHistory

func (s *YieldsService) GetBorrowMarketHistory(ctx context.Context, id string, opts *HistoryRangeOptions) (map[string]any, error)

GetBorrowMarketHistory Retrieve daily borrow-side history for a borrow market See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/borrow/markets/%7Bid%7D/history

func (*YieldsService) GetBorrowMarkets

func (s *YieldsService) GetBorrowMarkets(ctx context.Context) (map[string]any, error)

GetBorrowMarkets Retrieve the latest data for all borrow markets See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/borrow/markets

func (*YieldsService) GetBorrowRoutes

func (s *YieldsService) GetBorrowRoutes(ctx context.Context) (map[string]any, error)

GetBorrowRoutes Retrieve the latest data for all borrow routes See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/borrow/routes

func (*YieldsService) GetEarnPoolHistory

func (s *YieldsService) GetEarnPoolHistory(ctx context.Context, id string, opts *HistoryRangeOptions) (map[string]any, error)

GetEarnPoolHistory Retrieve daily history for an earn pool See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/earn/%7Bid%7D/history

func (*YieldsService) GetEarnPools

func (s *YieldsService) GetEarnPools(ctx context.Context) (map[string]any, error)

GetEarnPools Retrieve the latest data for all earn pools See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/earn

func (*YieldsService) GetLSTRates

func (s *YieldsService) GetLSTRates(ctx context.Context) ([]any, error)

GetLSTRates Exchange rates and ETH peg of liquid staking tokens See: https://api-docs.defillama.com/#tag/yields/get/api/lstRates

func (*YieldsService) GetLegacyBorrowPools

func (s *YieldsService) GetLegacyBorrowPools(ctx context.Context) (map[string]any, error)

GetLegacyBorrowPools Borrow costs APY of assets from lending markets in the legacy v1 response format See: https://api-docs.defillama.com/#tag/yields/get/yields/v1/poolsBorrow

func (*YieldsService) GetLegacyLendBorrowChart

func (s *YieldsService) GetLegacyLendBorrowChart(ctx context.Context, pool string) (map[string]any, error)

GetLegacyLendBorrowChart Historical borrow cost APY from a pool on a lending market in the legacy v1 response format See: https://api-docs.defillama.com/#tag/yields/get/yields/v1/chartLendBorrow/%7Bpool%7D

func (*YieldsService) GetLegacyPoolChart

func (s *YieldsService) GetLegacyPoolChart(ctx context.Context, pool string) (map[string]any, error)

GetLegacyPoolChart Get historical APY and TVL of a pool in the legacy v1 response format See: https://api-docs.defillama.com/#tag/yields/get/yields/v1/chart/%7Bpool%7D

func (*YieldsService) GetLegacyPools

func (s *YieldsService) GetLegacyPools(ctx context.Context) (map[string]any, error)

GetLegacyPools Retrieve the latest data for all pools in the legacy v1 response format See: https://api-docs.defillama.com/#tag/yields/get/yields/v1/pools

func (*YieldsService) GetLoopStrategies

func (s *YieldsService) GetLoopStrategies(ctx context.Context) (map[string]any, error)

GetLoopStrategies Retrieve the latest data for all loop strategies See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/loops

func (*YieldsService) GetPerpFundingRates

func (s *YieldsService) GetPerpFundingRates(ctx context.Context) (map[string]any, error)

GetPerpFundingRates Funding rates and Open Interest of perps across exchanges, including both Decentralized and Centralized See: https://api-docs.defillama.com/#tag/yields/get/yields/perps

func (*YieldsService) GetPoolChart

func (s *YieldsService) GetPoolChart(ctx context.Context, pool string) (map[string]any, error)

GetPoolChart Get historical APY and TVL of a pool See: https://api-docs.defillama.com/#tag/yields/get/chart/%7Bpool%7D

func (*YieldsService) GetPoolChartReceipt added in v1.1.0

func (s *YieldsService) GetPoolChartReceipt(ctx context.Context, pool string) (*ResponseReceipt, error)

GetPoolChartReceipt returns the lossless HTTP receipt for GET /chart/{pool}. Decode it into LosslessYieldChart to retain ISO-8601 provider timestamps and exact APY/TVL number lexemes.

func (*YieldsService) GetPools

func (s *YieldsService) GetPools(ctx context.Context) ([]YieldPool, error)

GetPools Retrieve the latest data for all pools, including enriched information such as predictions See: https://api-docs.defillama.com/#tag/yields/get/pools

func (*YieldsService) GetPoolsReceipt added in v1.1.0

func (s *YieldsService) GetPoolsReceipt(ctx context.Context) (*ResponseReceipt, error)

GetPoolsReceipt returns the lossless HTTP receipt for GET /pools. Decode it into LosslessYieldPools to preserve provider-native pool IDs, number lexemes, and absent/null/zero distinctions for open response fields.

func (*YieldsService) GetVerifiedEarnPool

func (s *YieldsService) GetVerifiedEarnPool(ctx context.Context, id string) (map[string]any, error)

GetVerifiedEarnPool Retrieve the latest verified data for one earn pool See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/earn/verified/%7Bid%7D

func (*YieldsService) GetVerifiedEarnPoolHistory

func (s *YieldsService) GetVerifiedEarnPoolHistory(ctx context.Context, id string, opts *HistoryRangeOptions) (map[string]any, error)

GetVerifiedEarnPoolHistory Retrieve daily verified history for an earn pool See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/earn/verified/%7Bid%7D/history

func (*YieldsService) GetVerifiedEarnPools

func (s *YieldsService) GetVerifiedEarnPools(ctx context.Context) (map[string]any, error)

GetVerifiedEarnPools Retrieve the latest verified data for all measured earn pools See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/earn/verified

func (*YieldsService) QueryEarnPools

func (s *YieldsService) QueryEarnPools(ctx context.Context, opts EarnPoolsQuery) (map[string]any, error)

QueryEarnPools Retrieve a filtered, paginated page of earn pools See: https://api-docs.defillama.com/#tag/yields/get/yields/v2/earn/query

Directories

Path Synopsis
examples
basic command
Basic Free API usage of the DefiLlama Go SDK.
Basic Free API usage of the DefiLlama Go SDK.
pro command
Pro API usage of the DefiLlama Go SDK.
Pro API usage of the DefiLlama Go SDK.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL