Skip to content

events command fails with invalid parameters when using Base64 topic #2021

@leighmcculloch

Description

@leighmcculloch

Bug Description

When running the stellar events command with a Base64-encoded topic, the command fails with an error about unable to unmarshal string into TopicFilter type.

Command

stellar events --start-ledger 757126 --type contract --topic 'AAAADwAAAAh0cmFuc2Zlcg==' --network testnet

Error

❌ 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")) }

Analysis

The issue appears to be that the CLI is passing the --topic parameter as a string directly to the RPC server, which expects topics to be formatted as arrays (TopicFilter) of segments (SegmentFilter).

The Base64 string AAAADwAAAAh0cmFuc2Zlcg== decodes to what appears to be an ScVal containing "transfer", but it's not being properly structured as a topic filter for the RPC request.

Expected Behavior

The CLI should properly format the topic parameter to match the RPC server's expectations, either by:

  1. Converting single topic strings into the proper array format
  2. Providing clearer error messages about the required format
  3. Documenting the exact format needed for topic filters in the help text

Environment

  • CLI version: latest
  • Network: testnet

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions