Skip to content

Feature: Ticket 5 additions#82

Merged
tmosleyIII merged 3 commits into
mainfrom
feature/tmosley/ticket-5-additions
Jun 22, 2026
Merged

Feature: Ticket 5 additions#82
tmosleyIII merged 3 commits into
mainfrom
feature/tmosley/ticket-5-additions

Conversation

@tmosleyIII

Copy link
Copy Markdown
Contributor

This pull request introduces new API endpoints for retrieving account transactions and address balance history in the Silver API, and adds comprehensive tests for these features. The main changes include the addition of two new routes and their corresponding handler registrations, as well as a new test file to validate the new functionality.

New API endpoints and routes:

  • Added a new route and handler for fetching account transactions at /api/v1/silver/accounts/{id}/transactions (routes_silver.go).
  • Added a new route and handler for fetching address balance history at /api/v1/silver/addresses/{addr}/balances/history (routes_silver.go).

Testing improvements:

  • Introduced a new test file account_history_test.go with tests for account transaction pagination/deduplication and unified address balance history, including setup of DuckDB schemas, tables, and fixture data.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new Silver API endpoints backed by the unified DuckDB reader: one to fetch account-scoped transactions and one to fetch address balance history (classic assets or Soroban token contracts), along with a new DuckDB-based test suite validating hot/cold de-duplication and pagination behavior.

Changes:

  • Added routes for /api/v1/silver/accounts/{id}/transactions and /api/v1/silver/addresses/{addr}/balances/history.
  • Implemented new handlers plus unified-reader query methods for account transactions and address balance history (with cursor pagination).
  • Added DuckDB fixture-driven tests covering hot/cold de-duplication, pagination, and classic vs contract balance history modes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
obsrvr-lake/stellar-query-api/go/routes_silver.go Registers the two new Silver API routes and logs them during startup.
obsrvr-lake/stellar-query-api/go/account_history.go Adds handler implementations, cursor encoding/decoding, and unified DuckDB queries for transactions and balance history.
obsrvr-lake/stellar-query-api/go/account_history_test.go Adds DuckDB-backed tests validating query behavior (dedup + pagination + history reconstruction).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +206 to +207
filters.StartTime = r.URL.Query().Get("start_time")
filters.EndTime = r.URL.Query().Get("end_time")
Comment thread obsrvr-lake/stellar-query-api/go/account_history.go
Comment thread obsrvr-lake/stellar-query-api/go/account_history_test.go
Comment thread obsrvr-lake/stellar-query-api/go/account_history_test.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b64bc96bd2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +526 to +528
if strings.TrimSpace(hotSchema) != "" {
parts = append(parts, oneClassic(hotSchema, 1))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip hot balance_changes when it is not materialized

When classic history is requested in the normal unified-reader setup, hotSchema is non-empty, so this branch emits a query against hot_db...balance_changes. I searched the silver realtime hot schema/migrations and balance_changes is only produced by the cold history loader, not the hot schema, so DuckDB fails the entire UNION instead of returning cold history. Please skip the hot branch or add a table-existence fallback for classic balance history.

Useful? React with 👍 / 👎.

Comment on lines +228 to +230
if !validAccountAddress(addr) {
respondError(w, "addr must be a valid Stellar account (G...) address", http.StatusBadRequest)
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept contract holders for token balance history

Use the account-or-contract validator here. For a Soroban token balance history where the holder is a contract address (C...) and contract_id is supplied, this returns 400 before reaching the token_transfers_raw query, even though /addresses/{addr}/balances accepts contract addresses and the query can match from_account/to_account for contracts. This prevents contract-held token balances from using the new history endpoint.

Useful? React with 👍 / 👎.

@tmosleyIII tmosleyIII merged commit 988760c into main Jun 22, 2026
@tmosleyIII tmosleyIII deleted the feature/tmosley/ticket-5-additions branch June 22, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants