Skip to content

feat(rpc): add inspectDiagnosticEvents for RPC responses - #1917

Open
Ryang-21 wants to merge 1 commit into
mainfrom
feat/soroban-ledger-keys-diagnostics-1244
Open

Ryang-21 wants to merge 1 commit into
mainfrom
feat/soroban-ledger-keys-diagnostics-1244

Conversation

@Ryang-21

@Ryang-21 Ryang-21 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds rpc.inspectDiagnosticEvents(response). It takes a sendTransaction, getTransaction or simulateTransaction response, or a getTransactions entry, and returns its diagnostic events with topics and data as native values, plus inSuccessfulContractCall. It returns an empty list when there are none, and makes no network calls.

For getTransaction and getTransactions it reads the events in resultMetaXdr when the deprecated top-level diagnosticEventsXdr is missing or empty.

Why

Each response keeps diagnostic events in a different field and shape, so finding why a contract call failed meant knowing all of them. The fallback keeps the helper working once RPC removes the deprecated field.

Closes #1258

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Nov 24, 2026
@Ryang-21
Ryang-21 force-pushed the feat/soroban-ledger-keys-diagnostics-1244 branch from ade81b3 to e693359 Compare November 24, 2026 01:37
@Ryang-21 Ryang-21 changed the title feat: add Soroban ledger key helpers and rpc.inspectDiagnosticEvents feat(rpc): add inspectDiagnosticEvents for RPC responses Nov 24, 2026
@Ryang-21
Ryang-21 requested a balanced review from Copilot November 24, 2026 18:46

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.

🟢 Approval recommended

No active review issues block approval of the diagnostic-event inspection helper.

No open issues 🎉

What changed in this PR

Adds rpc.inspectDiagnosticEvents() to provide a consistent, readable view of diagnostic events across parsed Stellar RPC responses.

Changes:

  • Converts event topics and data to native values while preserving event type, contract ID, and call-success status.
  • Supports simulation, submission, and transaction lookup responses, with transaction metadata fallback when needed.
  • Adds runtime and compile-time tests, API documentation, and a failed-call example.
File Description
test/​unit/​server/​soroban/​inspect_diagnostic_events.test.ts Tests response formats, metadata fallback, event conversion, and empty results.
test/​types/​diagnostic-events.ts Checks public input and output types and rejects raw events.
src/​rpc/​index.ts Exports the helper and its public types.
src/​rpc/​diagnostics.ts Implements diagnostic event extraction and conversion.
examples/​guides/​invoke-a-contract.ts Demonstrates inspecting a failed contract simulation.
docs/​reference/​network-rpc.md Documents the helper and its types.
docs/​guides/​06-invoke-a-contract.md Adds guidance on diagnosing failed calls.
CHANGELOG.md Records the new helper under Unreleased.

Review effort: Balanced

@Ryang-21
Ryang-21 requested a review from quietbits November 24, 2026 18:58
@Ryang-21
Ryang-21 marked this pull request as ready for review November 24, 2026 18:58
Comment thread src/rpc/diagnostics.ts
/** A diagnostic event with its topics and data converted to native values. */
export interface DiagnosticEventInfo {
/** whether the contract call that emitted the event succeeded */
inSuccessfulContractCall: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is a deprecated field iirc

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

Extract diagnostic events from failed Soroban transactions

4 participants