Skip to content

feat: combined address endpoint, displayAmount, date filters, summary & eventType filter#6

Merged
Miracle656 merged 1 commit into
Miracle656:mainfrom
dxfareed:feat/issues-1-5-api-enhancements
Apr 4, 2026
Merged

feat: combined address endpoint, displayAmount, date filters, summary & eventType filter#6
Miracle656 merged 1 commit into
Miracle656:mainfrom
dxfareed:feat/issues-1-5-api-enhancements

Conversation

@dxfareed
Copy link
Copy Markdown
Contributor

@dxfareed dxfareed commented Apr 1, 2026

Summary

Implements all 5 open feature issues.

Closes #1GET /transfers/address/:address

Added a combined incoming + outgoing endpoint. Results are merged and sorted by ledger descending. Each record includes a direction field ("incoming" | "outgoing"). Supports all existing query params (contractId, fromLedger, toLedger, limit, offset).

Closes #2displayAmount field on all transfer responses

Added a displayAmount field alongside the raw amount on every transfer response (all endpoints including /incoming, /outgoing, /address, /tx). Uses BigInt arithmetic to divide by 10^7 and format to 7 decimal places — no floating-point precision loss. e.g. "10000000000""1000.0000000".

Closes #3fromDate / toDate filters

Added ISO 8601 date range filtering via ledgerClosedAt on /incoming, /outgoing, and /address endpoints. Invalid date strings return HTTP 400 with a clear error message. Works alongside existing fromLedger / toLedger params.

Closes #4GET /summary/:address

Added aggregate stats endpoint grouped by contractId. Returns totalReceived, totalSent, netFlow (can be negative) and their display* variants. Uses a raw SQL query with Prisma.sql parameterisation since Prisma cannot SUM string-typed columns. Supports fromDate, toDate, and contractId filters.

Closes #5eventType filter

Added eventType query param to /incoming, /outgoing, and /address endpoints. Accepts a single value or comma-separated list (e.g. eventType=transfer,mint). Invalid values return HTTP 400. Requests without eventType return all event types — no breaking change.

Changes

  • src/db.ts — extended TransferQueryParams and AllTransfersQueryParams with fromDate, toDate, eventTypes; added querySummary (raw SQL aggregate) and queryAllTransfers (combined OR query with direction mapping)
  • src/api.ts — added toDisplayAmount helper (exported, BigInt-safe, handles negatives for netFlow), parseEventTypes validator, parseDateParam validator; wired all new params into existing and new endpoints

@Miracle656 Miracle656 merged commit a3d4090 into Miracle656:main Apr 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants