Skip to content

Conversation

@elizabethengelman
Copy link
Collaborator

@elizabethengelman elizabethengelman commented Nov 17, 2025

What

closes #2021

related rpc-client pr: stellar/rs-stellar-rpc-client#57

Updates the topic filter structure that is being passed to the rpc server getEvents method, to align with it's expected API.

The GetEventsRequest, from the rpc server, is expecting the topics to be an array of TopicFilters, and a TopicFilter is an array of SegmentFilters. So it is expecting an array of arrays.

type TopicFilter []SegmentFilter
type SegmentFilter struct {
	Wildcard *string    `json:"-"`
	ScVal    *xdr.ScVal `json:"-"`
}
type EventFilter struct {
	EventType   EventTypeSet  `json:"type,omitempty"`
	ContractIDs []string      `json:"contractIds,omitempty"`
	Topics      []TopicFilter `json:"topics,omitempty"`
}
cargo run events --start-ledger 757126 --type contract --topic 'AAAADwAAAAh0cmFuc2Zlcg=='  --topic 'AAAADwAAAAh0cmFuc2Zlcg==,**" --network testnet

Why

We are currently just passing in a segment filter, without nesting it in an array of arrays, and are seeing an error when doing so.

❌ error: ErrorObject { code: InvalidParams, message: "invalid parameters", data: Some(RawValue("json: cannot unmarshal string into Go struct field EventFilter.filters.topics of type protocol.TopicFilter")) }

Known limitations

n/a

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Nov 17, 2025
@elizabethengelman elizabethengelman changed the title Update updated rpc client to get_events by passing topics as [TopicFi… Update rpc client to get_events by passing topics as [TopicFilter] Nov 18, 2025
…d together properly

so that --topic 'AAAADwAAAAh0cmFuc2Zlcg==,**' --topic "*,**" will work
without error
@elizabethengelman elizabethengelman self-assigned this Nov 18, 2025
@elizabethengelman elizabethengelman marked this pull request as ready for review November 19, 2025 15:02
@elizabethengelman elizabethengelman force-pushed the fix/events-for-base64-topics branch from c3a0380 to baf9b41 Compare November 19, 2025 15:40
Copy link
Contributor

@mootz12 mootz12 left a comment

Choose a reason for hiding this comment

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

LG2M. Noticed one check that was missing.

@github-project-automation github-project-automation bot moved this from Backlog (Not Ready) to Needs Review in DevX Nov 19, 2025
Copy link
Contributor

@mootz12 mootz12 left a comment

Choose a reason for hiding this comment

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

LG2M!

@elizabethengelman elizabethengelman enabled auto-merge (squash) November 24, 2025 22:47
@elizabethengelman elizabethengelman merged commit a8e1d07 into main Nov 24, 2025
32 checks passed
@elizabethengelman elizabethengelman deleted the fix/events-for-base64-topics branch November 24, 2025 22:47
@github-project-automation github-project-automation bot moved this from Needs Review to Done in DevX Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

events command fails with invalid parameters when using Base64 topic

3 participants