Skip to content

Releases: tigusigalpa/defillama-go

v1.2.1

Choose a tag to compare

@tigusigalpa tigusigalpa released this 04 Oct 08:44

DefiLlama Go SDK v1.2.1

v1.2.1 hardens the HTTP receipt boundary for safer response processing, better diagnostics, and predictable resource cleanup.

Added

  • Added WithMaxResponseBodyBytes with a default 32 MiB limit for all typed responses and receipt capture.
  • Added ErrResponseBodyTooLarge and ResponseBodyTooLargeError for inspectable, non-retryable response-size failures.
  • Added ResponseReceipt.CompletedAt and ResponseReceipt.Complete to expose receipt finalization state.
  • Added lifecycle regression coverage for partial reads, cancellation, close failures, retries, body limits, observers, and concurrent receipt access.

Changed

  • Original HTTP response bodies are now read within the configured limit, boundedly drained, and closed exactly once before returning, observing, or retrying.
  • Receipts retain a safe immutable body prefix and SHA-256 digest when a response cannot be fully completed.
  • Read, drain, close, decode, and API failures remain discoverable through errors.Is and errors.As, including combined failure cases.
  • Oversized responses are never retried.
  • Receipt observers receive events only after the corresponding response body lifecycle is complete. Transport-only failures do not emit receipts.
  • Updated the exported package version and default User-Agent to 1.2.1.

Documentation

  • Expanded receipt documentation with completion semantics, response-size budgeting, overflow handling, and observer lifecycle guarantees.
  • Updated the changelog with the published v1.1.0 receipt release and the new v1.2.1 changes.

Compatibility

This release is backward compatible. Existing service methods continue to work unchanged.

Full Changelog: v1.2.0...v1.2.1

v1.2.0

Choose a tag to compare

@tigusigalpa tigusigalpa released this 04 Oct 07:13

DefiLlama Go SDK v1.2.0

v1.2.0 strengthens the SDK’s HTTP receipt boundary, making response handling safer, more observable, and easier to audit without changing existing service APIs.

Added

  • Added WithMaxResponseBodyBytes with a 32 MiB default limit for every typed response and receipt capture.
  • Added ErrResponseBodyTooLarge and ResponseBodyTooLargeError for inspectable, non-retryable body-limit failures.
  • Added ResponseReceipt.CompletedAt and ResponseReceipt.Complete to distinguish a fully finalized response from a safely retained partial prefix.
  • Added comprehensive lifecycle regression coverage for close behavior, partial reads, cancellation causes, retry attempts, observer ordering, body limits, and concurrent receipt access.

Changed

  • Response bodies are now read within the configured limit, boundedly drained, and closed exactly once before a result is returned, an observer is called, or another retry begins.
  • Receipts preserve bounded partial evidence and a SHA-256 digest when a read, drain, close, or limit failure prevents full completion.
  • API, decode, read, drain, and close failures remain discoverable through errors.Is and errors.As, including combined failure cases.
  • Responses exceeding the configured byte limit are never retried.
  • Receipt observers run only after each received response has completed its body lifecycle. Transport-only failures do not emit receipts.
  • Corrected the exported SDK version metadata and default User-Agent to match the published v1.1.0 identity.

Documentation

  • Expanded receipt documentation with completion semantics, response-size budgeting, overflow handling, and observer lifecycle guarantees.
  • Updated the changelog to separate the published v1.1.0 receipt release from upcoming changes.

Compatibility

This release is backward compatible. Existing service calls continue to work unchanged; the new response-size limit is enabled by default and can be adjusted with WithMaxResponseBodyBytes.

Full Changelog: v1.1.0...v1.2.0

v1.1.0

Choose a tag to compare

@tigusigalpa tigusigalpa released this 03 Oct 15:32

v1.1.0 — Lossless Provider Receipts

This release adds an exact JSON boundary for DefiLlama protocol and yield data, while preserving the existing typed API.

Highlights

  • Added immutable ResponseReceipt records with exact response bytes, SHA-256 digest, redacted request provenance, attempt number, and capture time.
  • Added UseNumber-based decoding to preserve JSON number lexemes without an intermediate float64 conversion.
  • Added receipt methods for protocol and yield endpoints:
    • GetProtocolsReceipt
    • GetProtocolReceipt
    • GetPoolsReceipt
    • GetPoolChartReceipt
  • Added open lossless DTOs for protocol lists/details, yield pools, and yield charts. They preserve unknown provider fields and distinguish absent values, null, and numeric zero.
  • Added WithReceiptObserver for collecting every received HTTP response, including retry attempts.
  • Added offline DL1–DL4 fixtures and acceptance tests for route provenance, byte-identical bodies, receipt hashes, exact numeric values, native IDs, timestamps, and open-field retention.
  • Expanded documentation with lossless receipt usage and guidance on precision, provider-native identifiers, and capture-time semantics.

Compatibility

Existing service methods and typed models remain unchanged. They continue to provide the convenient float64-based compatibility interface.

Use the new receipt APIs when exact JSON representation, field presence, or immutable source bytes matter.

Verification

  • go test -race -covermode atomic ./...
  • golangci-lint v2.13.2 run — 0 issues

No live, credentialed, or paid DefiLlama API calls are required by the test suite.

What's Changed

Full Changelog: v1.0.0...v1.1.0

v1.0.0

Choose a tag to compare

@tigusigalpa tigusigalpa released this 23 Sep 10:26
446239d

v1.0.0 — First Stable Release

defillama-go is an idiomatic Go client for the DefiLlama Free and Pro APIs. This release covers all 132 GET operations in the included API specification: 31 Free and 101 Pro endpoints across 21 services.

Highlights:

  • A context-aware client that is safe to share between goroutines and has no runtime dependencies beyond Go’s standard library.
  • Typed models for common responses, with access to the full raw JSON payload when the API evolves.
  • Typed errors, local parameter validation, configurable timeouts, and bounded retries for transient failures.
  • Pro API support with explicit Free-to-Pro routing, API-key redaction in diagnostics, and protection against cross-origin redirects.
  • Runnable Free and Pro examples, an endpoint index, and tests covering every public route.

Requires Go 1.22 or newer. Free endpoints work without an API key; Pro endpoints require one.

go get github.com/tigusigalpa/defillama-go@v1.0.0

What's Changed

  • Bump codecov/codecov-action from 5 to 7 by @dependabot[bot] in #1
  • Bump golangci/golangci-lint-action from 7 to 9 by @dependabot[bot] in #2
  • Bump softprops/action-gh-release from 2 to 3 by @dependabot[bot] in #3
  • Bump actions/setup-go from 5 to 7 by @dependabot[bot] in #4

New Contributors

Full Changelog: https://github.com/tigusigalpa/defillama-go/commits/v1.0.0