feat: add asset, account, and Horizon diagnostics examples (#229-#232) - #262
Merged
Dantama022 merged 2 commits intoAug 30, 2026
Merged
Conversation
…2#229-Dantama022#232) Adds four runnable read-only examples, each with helper-level tests, runner registration, validation exclusions, and README catalog entries. - 169-asset-holder-distribution (ISSUE-169): pages every trustline for an issued asset, aggregates supply statistics (total, average, median, largest), ranks holders, and reports configurable top-N concentration. Distinguishes authorized from unauthorized balances, counts zero-balance trustlines separately, and reports mid-stream pagination failures rather than presenting a partial set as complete. - 170-account-balance-liability-analysis (ISSUE-170): analyses balances, trustline limits, and buying/selling liabilities, deriving available amounts and limit headroom. Ledger-reported and derived values are kept visually separate. Flags near-limit trustlines and unauthorized lines. - 171-account-activity-profile (ISSUE-171): combines account metadata, transaction, operation, and payment history into one descriptive profile with fee aggregation and operation-type grouping. Each Horizon section records its own status so partial failures are reported instead of surfacing as silent zeros. - 172-horizon-request-tracing (ISSUE-172): a reusable tracing wrapper recording per-request timing, HTTP status, attempt counts, and slow-request detection, with min/max/average/median latency aggregation. Diagnostics are sanitized (secret seeds, JWTs, token query params) before logging. Also repairs three files left syntactically broken by the merge in Dantama022#253, which prevented the project from typechecking on main: - src/runner/catalog.ts: restored the missing brace on the 192 entry and un-swapped the params blocks of entries 67 and 192. - src/validation/validation.config.json: restored the object boundary between the 192 and 66 exclusions, which made the file invalid JSON. Verified: all four examples run against Horizon Testnet in both text and JSON modes; 103 new tests pass; no new typecheck or lint errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VtubmgtuY97zQVrDu3PSKb
|
@Samuel1-ona Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #229, closes #230, closes #231, closes #232.
Adds four runnable, read-only examples. Each one ships with helper-level tests, runner registration, a validation exclusion, and a README catalog entry.
Examples
169-asset-holder-distribution(ISSUE-169) — Pages every trustline Horizon reports for an issued asset and produces a holder-distribution report: total/average/median/largest balance, holders ranked by balance, and configurable top-N concentration. Authorized and unauthorized balances are tallied separately, zero-balance trustlines are counted apart so they don't distort circulation figures, and a mid-stream pagination failure is reported rather than letting a partial set look complete.170-account-balance-liability-analysis(ISSUE-170) — Analyses balances, trustline limits, and buying/selling liabilities, deriving available amounts (balance - sellingLiabilities, minus the minimum reserve for native XLM) and limit headroom. Ledger-reported and derived values are kept visually separate throughout, so a computed figure is never mistaken for ledger state. Flags near-limit trustlines (a leading indicator ofop_line_full) and unauthorized lines.171-account-activity-profile(ISSUE-171) — Combines account metadata, transaction history, operation history, and payment history into one descriptive profile: success/failure counts, fee aggregation in stroops and XLM, operations grouped by type, incoming/outgoing payment split, and recent activity. The profile is assembled from four independent Horizon requests, so each records its own status and the report names which sections are incomplete — a failed request never turns into a silent zero that reads like an inactive account. Scope is explicitly descriptive: it does not score, rank, or classify accounts.172-horizon-request-tracing(ISSUE-172) — A reusable tracing wrapper recording start/end time, duration, resource, HTTP status, success, and attempt count per request, aggregated into min/max/average/median latency. Supports a configurable timeout and slow-request threshold, tracks retries, and sanitizes diagnostics (Stellar secret seeds, JWTs, andtoken/secret/api_key/authorizationquery params) before logging — public keys are deliberately preserved so traces stay debuggable. The example traces several live resources plus a deliberate 404 and a deliberate network failure.All four support
--json(alsoOUTPUT_FORMAT=json) for machine-readable output, accept parameters through the interactive runner or environment variables, and perform no ledger mutations.Incidental fix
The merge in #253 left three files syntactically broken, so
npm run typecheckfailed onmainbefore this branch. This PR repairs them, since nothing builds otherwise:src/runner/catalog.ts— restored the missing closing brace on the192-soroban-contract-code-inspectionentry, and un-swapped theparamsblocks of entries67and192, which the merge had crossed over (entry 67 had picked up 192's contract-hash prompts while its own ledger-range prompts were left orphaned mid-object). Original values recovered from the pre-merge history.src/validation/validation.config.json— restored the object boundary between the192and66exclusions; without it the file was not valid JSON.Note:
tests/soroban-contract-code-inspection.test.tsstill fails onmain(an unrelated pre-existingxdr.*.v0()typing issue from the same PR). Left alone as out of scope.Verification
tscerrors are pre-existing and confined to unrelated examples referencing a missingstellar-sdk-v16package.🤖 Generated with Claude Code
https://claude.ai/code/session_01VtubmgtuY97zQVrDu3PSKb