> For the complete documentation index, see [llms.txt](https://emeditweb.gitbook.io/pulsar-stellar-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emeditweb.gitbook.io/pulsar-stellar-sdk/concepts/successful-contract-call.md).

# Successful vs reverted calls

Every `DecodedEvent` carries a boolean, `inSuccessfulContractCall`. It is required, not optional, and understanding why is the difference between an accurate running total and one that drifts.

## Reverted calls still emit events

On Soroban, a contract call that reverts still emits its events, and those events still land in the ledger. The revert undoes the call's state changes. It does not erase the events the call emitted on its way to failing.

So the ledger holds two kinds of event that look identical in every other field: those from calls that committed, and those from calls that reverted. `inSuccessfulContractCall` is the only thing that separates them.

## The SDK does not filter for you

The SDK reports what the ledger holds. It never drops reverted-call events on your behalf, on either the indexer path or the RPC path. That is ADR-026: the SDK surfaces the flag and leaves the decision to you, because both answers are legitimate depending on what you are building.

* Computing balances, totals, or anything that must reflect committed state? Keep only `inSuccessfulContractCall === true`.
* Auditing, monitoring, or debugging, where a reverted attempt is itself the thing you want to see? Keep them all.

Filtering is one line, and it belongs at the top of your handler:

```ts
for (const event of page.items) {
  if (!event.inSuccessfulContractCall) continue; // skip reverted-call events
  applyToBalance(event);
}
```

The field is required precisely so you cannot forget it exists. An optional flag that defaulted to "successful" would silently fold reverted events into a total the first time an indexer omitted it.

## A nameless event is not a broken one

The related edge is the event name. `name` is decoded from the event's first topic, which Soroban convention makes a Symbol. When the first topic is not a Symbol, the emitter did not follow that convention, and `name` is the empty string rather than a guess.

Per ADR-026 this degrades the same way a reverted call does: the event is reported with its topics and data intact and an empty name, rather than failing the page it arrived in. If you match events by name, an empty name simply never matches your cases. To keep only convention-following events, filter on `name !== ''`:

```ts
for (const event of page.items) {
  if (event.name === '') continue; // emitter did not name this event
  handle(event);
}
```

Both rules come from the same principle. The SDK tells you what is on the ledger, including the parts that are inconvenient, and lets you decide what to do about them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://emeditweb.gitbook.io/pulsar-stellar-sdk/concepts/successful-contract-call.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
