EventInfo
public struct EventInfo : Decodable, Sendable
Information about a single contract event.
Represents an event emitted by a smart contract during execution. Events are used to communicate contract state changes and actions to off-chain systems.
Event types:
- contract: Events emitted by user contracts
- system: Events from system-level operations
- diagnostic: Debug events (only in simulation)
Contains:
- Event type and emission context (ledger, timestamp)
- Contract ID that emitted the event
- Topics (indexed event parameters)
- Event value (event payload)
- Transaction and operation context
Example:
for event in eventsResponse.events {
print("Event from contract: \(event.contractId)")
print("Emitted in ledger: \(event.ledger)")
print("Topics: \(event.topic.count)")
print("Value: \(event.valueXdr)")
}
See also:
- [GetEventsResponse] for querying events
- Stellar developer docs
-
Event type identifier (contract, diagnostic, or system).
Declaration
Swift
public let type: String -
Sequence number of the ledger in which this event was emitted.
Declaration
Swift
public let ledger: Int -
ISO8601 timestamp of the ledger closing time.
Declaration
Swift
public let ledgerClosedAt: String -
StrKey representation of the contract address that emitted this event.
Declaration
Swift
public let contractId: String -
Unique identifier for this event.
Declaration
Swift
public let id: String -
Deprecated for protocol version 23+. Indicates if the event was emitted during a successful contract invocation.
Declaration
Swift
@available(*, deprecated, message: "Deprecated for protocol version >= 23. If true the event was emitted during a successful contract call.") public var inSuccessfulContractCall: Bool? { get } -
List containing the topic this event was emitted with. [XdrSCVal as base64|]
Declaration
Swift
public let topic: [String] -
The emitted body value of the event (serialized in a base64 string - XdrSCVal).
Declaration
Swift
public let value: String -
The emitted body value of the event as XdrSCVal
Declaration
Swift
public let valueXdr: SCValXDR -
The transaction which triggered this event.
Declaration
Swift
public let txHash: String -
The operation at which an event occurred. Only available for protocol version >= 23
Declaration
Swift
public let opIndex: Int? -
The transaction at which an event occurred. Only available for protocol version >= 23
Declaration
Swift
public let txIndex: Int? -
Declaration
Swift
public init(from decoder: Decoder) throws
View on GitHub
Install in Dash