Skip to content

feat: add 192-soroban-contract-code-inspection example - #253

Merged
Dantama022 merged 2 commits into
Dantama022:mainfrom
Olisachukwuma1:feature/issue-192-soroban-contract-code-inspection
Aug 30, 2026
Merged

feat: add 192-soroban-contract-code-inspection example#253
Dantama022 merged 2 commits into
Dantama022:mainfrom
Olisachukwuma1:feature/issue-192-soroban-contract-code-inspection

Conversation

@Olisachukwuma1

Copy link
Copy Markdown
Contributor
  • Add src/examples/192-soroban-contract-code-inspection.ts
    • Read-only inspection of Soroban contract instance and code ledger entries
    • Validates contract ID format before any RPC calls
    • Retrieves contract instance entry and extracts code hash
    • Retrieves contract-code entry with last-modified and TTL metadata
    • Optionally hashes a supplied WASM file and compares against deployed hash
    • Reports match / mismatch / unable_to_verify / not_supplied
    • Preserves raw ledger-entry XDR for both instance and code entries
    • Handles missing instance, missing code, built-in executables, and RPC failures
    • Supports JSON output via param or JSON_OUTPUT env var
  • Add tests/soroban-contract-code-inspection.test.ts
    • Unit tests for all exported helpers and core inspection logic
    • Covers hash comparison states, missing entries, RPC errors, XDR capture
    • Verifies catalog registration and README documentation
  • Register example in src/runner/catalog.ts with interactive params
  • Add exclusion entry in src/validation/validation.config.json
  • Update README.md catalog with entry 54

Summary

Describe the changes introduced by this Pull Request.

Related Issue

Closes #

Type of Change

  • 🚀 New example script added
  • 🐛 Bug fix (fixes an execution error in an example)
  • 📝 Documentation update (updates inline commentary or README)
  • 🧪 Test improvement

Changes Made

  • List changes made
  • Note any testnet addresses or networks tested against

Testing

  • The example runs successfully on Testnet (npm run run-example <name>)
  • Linter check passes (npm run lint)
  • Type check passes (npm run typecheck)

CLI Output

Paste successful execution logs from your terminal here.

closes #252

- Add src/examples/192-soroban-contract-code-inspection.ts
  - Read-only inspection of Soroban contract instance and code ledger entries
  - Validates contract ID format before any RPC calls
  - Retrieves contract instance entry and extracts code hash
  - Retrieves contract-code entry with last-modified and TTL metadata
  - Optionally hashes a supplied WASM file and compares against deployed hash
  - Reports match / mismatch / unable_to_verify / not_supplied
  - Preserves raw ledger-entry XDR for both instance and code entries
  - Handles missing instance, missing code, built-in executables, and RPC failures
  - Supports JSON output via param or JSON_OUTPUT env var
- Add tests/soroban-contract-code-inspection.test.ts
  - Unit tests for all exported helpers and core inspection logic
  - Covers hash comparison states, missing entries, RPC errors, XDR capture
  - Verifies catalog registration and README documentation
- Register example in src/runner/catalog.ts with interactive params
- Add exclusion entry in src/validation/validation.config.json
- Update README.md catalog with entry 54
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@Olisachukwuma1 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! 🚀

Learn more about application limits

@Dantama022
Dantama022 merged commit dde2605 into Dantama022:main Aug 30, 2026
1 of 3 checks passed
Dantama022 pushed a commit that referenced this pull request Aug 30, 2026
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 #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
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.

ISSUE-192: Add Soroban Contract Code Inspection Example

2 participants