protocol

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2025 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatBase64 = "base64"
	FormatJSON   = "json"
)
View Source
const (
	GetEventsMethodName = "getEvents"
	MaxFiltersLimit     = 5
	MaxTopicsLimit      = 5
	MaxContractIDsLimit = 5
	MinTopicCount       = 1
	MaxTopicCount       = 4
	WildCardExactOne    = "*"
	WildCardZeroOrMore  = "**"
)
View Source
const (
	EventTypeSystem     = "system"
	EventTypeContract   = "contract"
	EventTypeDiagnostic = "diagnostic"
)
View Source
const (
	GetTransactionMethodName = "getTransaction"
	// TransactionStatusSuccess indicates the transaction was included in the ledger and
	// it was executed without errors.
	TransactionStatusSuccess = "SUCCESS"
	// TransactionStatusNotFound indicates the transaction was not found in Stellar-RPC's
	// transaction store.
	TransactionStatusNotFound = "NOT_FOUND"
	// TransactionStatusFailed indicates the transaction was included in the ledger and
	// it was executed with an error.
	TransactionStatusFailed = "FAILED"
)
View Source
const (
	SimulateTransactionMethodName        = "simulateTransaction"
	DefaultInstructionLeeway      uint64 = 0

	AuthModeEnforce            = "enforce"
	AuthModeRecord             = "record"
	AuthModeRecordAllowNonroot = "record_allow_nonroot"
)
View Source
const GetFeeStatsMethodName = "getFeeStats"
View Source
const GetHealthMethodName = "getHealth"
View Source
const GetLatestLedgerMethodName = "getLatestLedger"
View Source
const GetLedgerEntriesMethodName = "getLedgerEntries"
View Source
const GetLedgersMethodName = "getLedgers"
View Source
const GetNetworkMethodName = "getNetwork"
View Source
const GetTransactionsMethodName = "getTransactions"
View Source
const GetVersionInfoMethodName = "getVersionInfo"
View Source
const SendTransactionMethodName = "sendTransaction"

Variables

View Source
var (
	// MinCursor is the smallest possible cursor
	//nolint:gochecknoglobals
	MinCursor = Cursor{}
	// MaxCursor is the largest possible cursor
	//nolint:gochecknoglobals
	MaxCursor = Cursor{
		Ledger: math.MaxInt32,
		Tx:     toid.TransactionMask,
		Op:     toid.OperationMask,
		Event:  math.MaxUint32,
	}
)
View Source
var (
	LedgerEntryChangeTypeName = map[LedgerEntryChangeType]string{
		LedgerEntryChangeTypeCreated: "created",
		LedgerEntryChangeTypeUpdated: "updated",
		LedgerEntryChangeTypeDeleted: "deleted",
	}
	LedgerEntryChangeTypeValue = map[string]LedgerEntryChangeType{
		"created": LedgerEntryChangeTypeCreated,
		"updated": LedgerEntryChangeTypeUpdated,
		"deleted": LedgerEntryChangeTypeDeleted,
	}
)

Functions

func GetEventTypeFromEventTypeXDR

func GetEventTypeFromEventTypeXDR() map[xdr.ContractEventType]string

func GetEventTypeXDRFromEventType

func GetEventTypeXDRFromEventType() map[string]xdr.ContractEventType

func IsLedgerWithinRange

func IsLedgerWithinRange(startLedger uint32, ledgerRange LedgerSeqRange) bool

IsLedgerWithinRange checks whether the request start ledger/cursor is within the max/min ledger for the current RPC instance.

func IsValidFormat

func IsValidFormat(format string) error

func ValidatePagination

func ValidatePagination(
	startLedger uint32,
	pagination *LedgerPaginationOptions,
	maxLimit uint,
	ledgerRange LedgerSeqRange,
) error

ValidatePagination ensures that pagination parameters across supported endpoints conform to the given requirements:

* If pagination is set:

  • If the cursor is set, the startLedger is not set.
  • If the limit is set, it does not exceed the maxLimit.
  • If the cursor is NOT set, the startLedger is in the RPC's range of known ledgers.

* Otherwise,

  • The startLedger is set and is in the RPC's range of known ledgers.

Types

type Cursor

type Cursor struct {
	// Ledger is the sequence of the ledger which emitted the event.
	Ledger uint32
	// Tx is the index of the transaction within the ledger which emitted the event.
	Tx uint32
	// Op is the index of the operation within the transaction which emitted the event.
	Op uint32
	// Event is the index of the event within in the operation which emitted the event.
	Event uint32
}

Cursor represents the position of a Soroban event. Soroban events are sorted in ascending order by ledger sequence, transaction index, operation index, and event index.

func ParseCursor

func ParseCursor(input string) (Cursor, error)

ParseCursor parses the given string and returns the corresponding cursor

func (Cursor) Cmp

func (c Cursor) Cmp(other Cursor) int

Cmp compares two cursors. 0 is returned if the c is equal to other. 1 is returned if c is greater than other. -1 is returned if c is less than other.

func (Cursor) MarshalJSON

func (c Cursor) MarshalJSON() ([]byte, error)

MarshalJSON marshals the cursor into JSON

func (Cursor) String

func (c Cursor) String() string

String returns a string representation of this cursor

func (*Cursor) UnmarshalJSON

func (c *Cursor) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls a cursor from the given JSON

type CursorRange

type CursorRange struct {
	// Start defines the (inclusive) start of the range.
	Start Cursor
	// End defines the (exclusive) end of the range.
	End Cursor
}

type EventFilter

type EventFilter struct {
	EventType   EventTypeSet  `json:"type,omitempty"`
	ContractIDs []string      `json:"contractIds,omitempty"`
	Topics      []TopicFilter `json:"topics,omitempty"`
}

func (*EventFilter) Matches

func (e *EventFilter) Matches(event xdr.DiagnosticEvent) bool

func (*EventFilter) Valid

func (e *EventFilter) Valid() error

type EventInfo

type EventInfo struct {
	EventType       string `json:"type"`
	Ledger          int32  `json:"ledger"`
	LedgerClosedAt  string `json:"ledgerClosedAt"`
	ContractID      string `json:"contractId"`
	ID              string `json:"id"`
	OpIndex         uint32 `json:"operationIndex"`
	TxIndex         uint32 `json:"transactionIndex"`
	TransactionHash string `json:"txHash"`

	// Deprecated: remove in v24
	InSuccessfulContractCall bool `json:"inSuccessfulContractCall"`

	// TopicXDR is a base64-encoded list of ScVals
	TopicXDR  []string          `json:"topic,omitempty"`
	TopicJSON []json.RawMessage `json:"topicJson,omitempty"`

	// ValueXDR is a base64-encoded ScVal
	ValueXDR  string          `json:"value,omitempty"`
	ValueJSON json.RawMessage `json:"valueJson,omitempty"`
}

type EventTypeSet

type EventTypeSet map[string]interface{} //nolint:recvcheck

func (EventTypeSet) Keys

func (e EventTypeSet) Keys() []string

func (EventTypeSet) MarshalJSON

func (e EventTypeSet) MarshalJSON() ([]byte, error)

func (*EventTypeSet) UnmarshalJSON

func (e *EventTypeSet) UnmarshalJSON(data []byte) error

type Events

type Events struct {
	// TransactionEventsXDR contains base64-encoded xdr.TransactionEvent objects
	TransactionEventsXDR []string `json:"transactionEventsXdr,omitempty"`

	// TransactionEventsJSON contains TransactionEvents in raw JSON format
	TransactionEventsJSON []json.RawMessage `json:"transactionEventsJson,omitempty"`

	// ContractEventsXDR contains base64-encoded xdr.ContractEvent objects.
	// Each inner slice contains the contract events for a single operation.
	ContractEventsXDR [][]string `json:"contractEventsXdr,omitempty"`

	// ContractEventsJSON contains ContractEvents in raw JSON format.
	// Each inner slice contains the contract events for a single operation.
	ContractEventsJSON [][]json.RawMessage `json:"contractEventsJson,omitempty"`
}

Events contains all the events related to the transaction in both XDR and JSON formats.

type FeeDistribution

type FeeDistribution struct {
	Max              uint64 `json:"max,string"`
	Min              uint64 `json:"min,string"`
	Mode             uint64 `json:"mode,string"`
	P10              uint64 `json:"p10,string"`
	P20              uint64 `json:"p20,string"`
	P30              uint64 `json:"p30,string"`
	P40              uint64 `json:"p40,string"`
	P50              uint64 `json:"p50,string"`
	P60              uint64 `json:"p60,string"`
	P70              uint64 `json:"p70,string"`
	P80              uint64 `json:"p80,string"`
	P90              uint64 `json:"p90,string"`
	P95              uint64 `json:"p95,string"`
	P99              uint64 `json:"p99,string"`
	TransactionCount uint32 `json:"transactionCount,string"`
	LedgerCount      uint32 `json:"ledgerCount"`
}

type GetEventsRequest

type GetEventsRequest struct {
	StartLedger uint32             `json:"startLedger,omitempty"`
	EndLedger   uint32             `json:"endLedger,omitempty"`
	Filters     []EventFilter      `json:"filters"`
	Pagination  *PaginationOptions `json:"pagination,omitempty"`
	Format      string             `json:"xdrFormat,omitempty"`
}

func (*GetEventsRequest) Matches

func (g *GetEventsRequest) Matches(event xdr.DiagnosticEvent) bool

func (*GetEventsRequest) Valid

func (g *GetEventsRequest) Valid(maxLimit uint) error

type GetEventsResponse

type GetEventsResponse struct {
	Events []EventInfo `json:"events"`
	// Cursor represents last populated event ID if total events reach the limit
	// or end of the search window
	Cursor string `json:"cursor"`

	LatestLedger          uint32 `json:"latestLedger"`
	OldestLedger          uint32 `json:"oldestLedger"`
	LatestLedgerCloseTime int64  `json:"latestLedgerCloseTime,string"`
	OldestLedgerCloseTime int64  `json:"oldestLedgerCloseTime,string"`
}

type GetFeeStatsRequest

type GetFeeStatsRequest struct{}

type GetFeeStatsResponse

type GetFeeStatsResponse struct {
	SorobanInclusionFee FeeDistribution `json:"sorobanInclusionFee"`
	InclusionFee        FeeDistribution `json:"inclusionFee"`
	LatestLedger        uint32          `json:"latestLedger"`
}

type GetHealthRequest

type GetHealthRequest struct{}

type GetHealthResponse

type GetHealthResponse struct {
	Status                string `json:"status"`
	LatestLedger          uint32 `json:"latestLedger"`
	OldestLedger          uint32 `json:"oldestLedger"`
	LedgerRetentionWindow uint32 `json:"ledgerRetentionWindow"`
}

type GetLatestLedgerRequest

type GetLatestLedgerRequest struct{}

type GetLatestLedgerResponse

type GetLatestLedgerResponse struct {
	// Hash of the latest ledger as a hex-encoded string
	Hash string `json:"id"`
	// Stellar Core protocol version associated with the ledger.
	ProtocolVersion uint32 `json:"protocolVersion"`
	// Sequence number of the latest ledger.
	Sequence uint32 `json:"sequence"`
	// Time the ledger closed at (unix timestamp)
	LedgerCloseTime int64 `json:"closeTime,string"`
	// LedgerHeader of the latest ledger (base64-encoded XDR)
	LedgerHeader string `json:"headerXdr"`
	// LedgerMetadata of the latest ledger (base64-encoded XDR)
	LedgerMetadata string `json:"metadataXdr"`
}

type GetLedgerEntriesRequest

type GetLedgerEntriesRequest struct {
	Keys   []string `json:"keys"`
	Format string   `json:"xdrFormat,omitempty"`
}

type GetLedgerEntriesResponse

type GetLedgerEntriesResponse struct {
	// All found ledger entries.
	Entries []LedgerEntryResult `json:"entries"`
	// Sequence number of the latest ledger at time of request.
	LatestLedger uint32 `json:"latestLedger"`
}

type GetLedgersRequest

type GetLedgersRequest struct {
	StartLedger uint32                   `json:"startLedger"`
	Pagination  *LedgerPaginationOptions `json:"pagination,omitempty"`
	Format      string                   `json:"xdrFormat,omitempty"`
}

GetLedgersRequest represents the request parameters for fetching ledgers.

func (*GetLedgersRequest) Validate

func (req *GetLedgersRequest) Validate(maxLimit uint, ledgerRange LedgerSeqRange) error

validate checks the validity of the request parameters.

type GetLedgersResponse

type GetLedgersResponse struct {
	Ledgers               []LedgerInfo `json:"ledgers"`
	LatestLedger          uint32       `json:"latestLedger"`
	LatestLedgerCloseTime int64        `json:"latestLedgerCloseTime"`
	OldestLedger          uint32       `json:"oldestLedger"`
	OldestLedgerCloseTime int64        `json:"oldestLedgerCloseTime"`
	Cursor                string       `json:"cursor"`
}

GetLedgersResponse encapsulates the response structure for getLedgers queries.

type GetNetworkRequest

type GetNetworkRequest struct{}

type GetNetworkResponse

type GetNetworkResponse struct {
	FriendbotURL    string `json:"friendbotUrl,omitempty"`
	Passphrase      string `json:"passphrase"`
	ProtocolVersion int    `json:"protocolVersion"`
}

type GetTransactionRequest

type GetTransactionRequest struct {
	Hash   string `json:"hash"`
	Format string `json:"xdrFormat,omitempty"`
}

type GetTransactionResponse

type GetTransactionResponse struct {
	// LatestLedger is the latest ledger stored in Stellar-RPC.
	LatestLedger uint32 `json:"latestLedger"`
	// LatestLedgerCloseTime is the unix timestamp of when the latest ledger was closed.
	LatestLedgerCloseTime int64 `json:"latestLedgerCloseTime,string"`
	// LatestLedger is the oldest ledger stored in Stellar-RPC.
	OldestLedger uint32 `json:"oldestLedger"`
	// LatestLedgerCloseTime is the unix timestamp of when the oldest ledger was closed.
	OldestLedgerCloseTime int64 `json:"oldestLedgerCloseTime,string"`

	// Many of the fields below are only present if Status is not
	// TransactionNotFound.
	TransactionDetails
	// LedgerCloseTime is the unix timestamp of when the transaction was
	// included in the ledger. It isn't part of `TransactionInfo` because of a
	// bug in which `createdAt` in getTransactions is encoded as a number
	// whereas in getTransaction (singular) it's encoded as a string.
	LedgerCloseTime int64 `json:"createdAt,string"`
}

GetTransactionResponse is the response for the Stellar-RPC getTransaction() endpoint

type GetTransactionsRequest

type GetTransactionsRequest struct {
	StartLedger uint32                   `json:"startLedger"`
	Pagination  *LedgerPaginationOptions `json:"pagination,omitempty"`
	Format      string                   `json:"xdrFormat,omitempty"`
}

GetTransactionsRequest represents the request parameters for fetching transactions within a range of ledgers.

func (GetTransactionsRequest) IsValid

func (req GetTransactionsRequest) IsValid(maxLimit uint, ledgerRange LedgerSeqRange) error

IsValid checks the validity of the request parameters.

type GetTransactionsResponse

type GetTransactionsResponse struct {
	Transactions          []TransactionInfo `json:"transactions"`
	LatestLedger          uint32            `json:"latestLedger"`
	LatestLedgerCloseTime int64             `json:"latestLedgerCloseTimestamp"`
	OldestLedger          uint32            `json:"oldestLedger"`
	OldestLedgerCloseTime int64             `json:"oldestLedgerCloseTimestamp"`
	Cursor                string            `json:"cursor"`
}

GetTransactionsResponse encapsulates the response structure for getTransactions queries.

type GetVersionInfoRequest

type GetVersionInfoRequest struct{}

type GetVersionInfoResponse

type GetVersionInfoResponse struct {
	Version            string `json:"version"`
	CommitHash         string `json:"commitHash"`
	BuildTimestamp     string `json:"buildTimestamp"`
	CaptiveCoreVersion string `json:"captiveCoreVersion"`
	ProtocolVersion    uint32 `json:"protocolVersion"`
}

type LedgerEntryChange

type LedgerEntryChange struct {
	Type LedgerEntryChangeType `json:"type"`

	KeyXDR  string          `json:"key,omitempty"` // LedgerEntryKey in base64
	KeyJSON json.RawMessage `json:"keyJson,omitempty"`

	BeforeXDR  *string         `json:"before"` // LedgerEntry XDR in base64
	BeforeJSON json.RawMessage `json:"beforeJson,omitempty"`

	AfterXDR  *string         `json:"after"` // LedgerEntry XDR in base64
	AfterJSON json.RawMessage `json:"afterJson,omitempty"`
}

LedgerEntryChange designates a change in a ledger entry. Before and After cannot be omitted at the same time. If Before is omitted, it constitutes a creation, if After is omitted, it constitutes a deletion.

type LedgerEntryChangeType

type LedgerEntryChangeType int //nolint:recvcheck
const (
	LedgerEntryChangeTypeCreated LedgerEntryChangeType = iota + 1
	LedgerEntryChangeTypeUpdated
	LedgerEntryChangeTypeDeleted
)

func (LedgerEntryChangeType) MarshalJSON

func (l LedgerEntryChangeType) MarshalJSON() ([]byte, error)

func (*LedgerEntryChangeType) Parse

func (l *LedgerEntryChangeType) Parse(s string) error

func (LedgerEntryChangeType) String

func (l LedgerEntryChangeType) String() string

func (*LedgerEntryChangeType) UnmarshalJSON

func (l *LedgerEntryChangeType) UnmarshalJSON(data []byte) error

type LedgerEntryResult

type LedgerEntryResult struct {
	// Original request key matching this LedgerEntryResult.
	KeyXDR  string          `json:"key,omitempty"`
	KeyJSON json.RawMessage `json:"keyJson,omitempty"`
	// Ledger entry data encoded in base 64.
	DataXDR  string          `json:"xdr,omitempty"`
	DataJSON json.RawMessage `json:"dataJson,omitempty"`
	// Last modified ledger for this entry.
	LastModifiedLedger uint32 `json:"lastModifiedLedgerSeq"`
	// The ledger sequence until the entry is live, available for entries that have associated ttl ledger entries.
	LiveUntilLedgerSeq *uint32 `json:"liveUntilLedgerSeq,omitempty"`
	// Extension field for this entry, if any
	ExtensionXDR  string          `json:"extXdr,omitempty"`
	ExtensionJSON json.RawMessage `json:"extJson,omitempty"`
}

type LedgerInfo

type LedgerInfo struct {
	Hash            string `json:"hash"`
	Sequence        uint32 `json:"sequence"`
	LedgerCloseTime int64  `json:"ledgerCloseTime,string"`

	LedgerHeader     string          `json:"headerXdr"`
	LedgerHeaderJSON json.RawMessage `json:"headerJson,omitempty"`

	LedgerMetadata     string          `json:"metadataXdr"`
	LedgerMetadataJSON json.RawMessage `json:"metadataJson,omitempty"`
}

LedgerInfo represents a single ledger in the response.

type LedgerPaginationOptions

type LedgerPaginationOptions struct {
	Cursor string `json:"cursor,omitempty"`
	Limit  uint   `json:"limit,omitempty"`
}

type LedgerSeqRange

type LedgerSeqRange struct {
	FirstLedger uint32
	LastLedger  uint32
}

type PaginationOptions

type PaginationOptions struct {
	Cursor *Cursor `json:"cursor,omitempty"`
	Limit  uint    `json:"limit,omitempty"`
}

type ResourceConfig

type ResourceConfig struct {
	InstructionLeeway uint64 `json:"instructionLeeway"`
}

func DefaultResourceConfig

func DefaultResourceConfig() ResourceConfig

type RestorePreamble

type RestorePreamble struct {
	// TransactionDataXDR is an xdr.SorobanTransactionData in base64
	TransactionDataXDR  string          `json:"transactionData,omitempty"`
	TransactionDataJSON json.RawMessage `json:"transactionDataJson,omitempty"`

	MinResourceFee int64 `json:"minResourceFee,string"`
}

type SegmentFilter

type SegmentFilter struct {
	Wildcard *string    `json:"-"`
	ScVal    *xdr.ScVal `json:"-"`
}

func (SegmentFilter) MarshalJSON

func (s SegmentFilter) MarshalJSON() ([]byte, error)

func (*SegmentFilter) Matches

func (s *SegmentFilter) Matches(segment xdr.ScVal) bool

func (*SegmentFilter) UnmarshalJSON

func (s *SegmentFilter) UnmarshalJSON(p []byte) error

func (*SegmentFilter) Valid

func (s *SegmentFilter) Valid() error

type SendTransactionRequest

type SendTransactionRequest struct {
	// Transaction is the base64 encoded transaction envelope.
	Transaction string `json:"transaction"`
	Format      string `json:"xdrFormat,omitempty"`
}

SendTransactionRequest is the Stellar-RPC request to submit a transaction.

type SendTransactionResponse

type SendTransactionResponse struct {
	// ErrorResultXDR is present only if Status is equal to proto.TXStatusError.
	// ErrorResultXDR is a TransactionResult xdr string which contains details on why
	// the transaction could not be accepted by stellar-core.
	ErrorResultXDR  string          `json:"errorResultXdr,omitempty"`
	ErrorResultJSON json.RawMessage `json:"errorResultJson,omitempty"`

	// DiagnosticEventsXDR is present only if Status is equal to proto.TXStatusError.
	// DiagnosticEventsXDR is a base64-encoded slice of xdr.DiagnosticEvent
	DiagnosticEventsXDR  []string          `json:"diagnosticEventsXdr,omitempty"`
	DiagnosticEventsJSON []json.RawMessage `json:"diagnosticEventsJson,omitempty"`

	// Status represents the status of the transaction submission returned by stellar-core.
	// Status can be one of: proto.TXStatusPending, proto.TXStatusDuplicate,
	// proto.TXStatusTryAgainLater, or proto.TXStatusError.
	Status string `json:"status"`
	// Hash is a hash of the transaction which can be used to look up whether
	// the transaction was included in the ledger.
	Hash string `json:"hash"`
	// LatestLedger is the latest ledger known to Stellar-RPC at the time it handled
	// the transaction submission request.
	LatestLedger uint32 `json:"latestLedger"`
	// LatestLedgerCloseTime is the unix timestamp of the close time of the latest ledger known to
	// Stellar-RPC at the time it handled the transaction submission request.
	LatestLedgerCloseTime int64 `json:"latestLedgerCloseTime,string"`
}

SendTransactionResponse represents the transaction submission response returned Stellar-RPC

type SimulateHostFunctionResult

type SimulateHostFunctionResult struct {
	AuthXDR  *[]string         `json:"auth,omitempty"`
	AuthJSON []json.RawMessage `json:"authJson,omitempty"`

	ReturnValueXDR  *string         `json:"xdr,omitempty"`
	ReturnValueJSON json.RawMessage `json:"returnValueJson,omitempty"`
}

SimulateHostFunctionResult contains the simulation result of each HostFunction within the single InvokeHostFunctionOp allowed in a Transaction

type SimulateTransactionRequest

type SimulateTransactionRequest struct {
	Transaction    string          `json:"transaction"`
	ResourceConfig *ResourceConfig `json:"resourceConfig,omitempty"`
	AuthMode       string          `json:"authMode,omitempty"`
	Format         string          `json:"xdrFormat,omitempty"`
}

type SimulateTransactionResponse

type SimulateTransactionResponse struct {
	Error string `json:"error,omitempty"`

	TransactionDataXDR  string          `json:"transactionData,omitempty"` // SorobanTransactionData XDR in base64
	TransactionDataJSON json.RawMessage `json:"transactionDataJson,omitempty"`

	EventsXDR  []string          `json:"events,omitempty"` // DiagnosticEvent XDR in base64
	EventsJSON []json.RawMessage `json:"eventsJson,omitempty"`

	MinResourceFee int64 `json:"minResourceFee,string,omitempty"`
	// an array of the individual host function call results
	Results []SimulateHostFunctionResult `json:"results,omitempty"`
	// If present, it indicates that a prior RestoreFootprint is required
	RestorePreamble *RestorePreamble `json:"restorePreamble,omitempty"`
	// If present, it indicates how the state (ledger entries) will change as a result of the transaction execution.
	StateChanges []LedgerEntryChange `json:"stateChanges,omitempty"`
	LatestLedger uint32              `json:"latestLedger"`
}

type TopicFilter

type TopicFilter []SegmentFilter

func (TopicFilter) Matches

func (t TopicFilter) Matches(event []xdr.ScVal) bool

Matches returns true if the event matches the filter:

  • If the filter ends with the "**" wildcard, the event must have *at least* as many topics as the filter excluding the "**".
  • If the filter does not end with "**", the event must have exactly the same number of topics as the filter.
  • Each segment must either match exactly or via a wildcard.

func (TopicFilter) Valid

func (t TopicFilter) Valid() error

Valid checks if the filter is properly structured: - must have at least one segment. - cannot have more than 4 segments total (excluding trailing "**"). - each segment must be valid. - The "**" wildcard, representing a flexible-length match, is only allowed as the last segment. Returns an error if any of the rules fail.

type TransactionDetails

type TransactionDetails struct {
	// Status is one of: TransactionSuccess, TransactionFailed, TransactionNotFound.
	Status string `json:"status"`
	// TransactionHash is the hex encoded hash of the transaction. Note that for
	// fee-bump transaction this will be the hash of the fee-bump transaction
	// instead of the inner transaction hash.
	TransactionHash string `json:"txHash"`
	// ApplicationOrder is the index of the transaction among all the
	// transactions for that ledger.
	ApplicationOrder int32 `json:"applicationOrder"`
	// FeeBump indicates whether the transaction is a feebump transaction
	FeeBump bool `json:"feeBump"`
	// EnvelopeXDR is the TransactionEnvelope XDR value.
	EnvelopeXDR  string          `json:"envelopeXdr,omitempty"`
	EnvelopeJSON json.RawMessage `json:"envelopeJson,omitempty"`
	// ResultXDR is the TransactionResult XDR value.
	ResultXDR  string          `json:"resultXdr,omitempty"`
	ResultJSON json.RawMessage `json:"resultJson,omitempty"`
	// ResultMetaXDR is the TransactionMeta XDR value.
	ResultMetaXDR  string          `json:"resultMetaXdr,omitempty"`
	ResultMetaJSON json.RawMessage `json:"resultMetaJson,omitempty"`
	// DiagnosticEventsXDR is a base64-encoded slice of xdr.DiagnosticEvent
	DiagnosticEventsXDR  []string          `json:"diagnosticEventsXdr,omitempty"`
	DiagnosticEventsJSON []json.RawMessage `json:"diagnosticEventsJson,omitempty"`

	// Events contains all events related to the transaction: diagnostic, contract and transaction events.
	Events Events `json:"events,omitempty"`

	// Ledger is the sequence of the ledger which included the transaction.
	Ledger uint32 `json:"ledger"`
}

type TransactionInfo

type TransactionInfo struct {
	TransactionDetails

	// LedgerCloseTime is the unix timestamp of when the transaction was
	// included in the ledger.
	LedgerCloseTime int64 `json:"createdAt"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL