soroban-cli
soroban-cli copied to clipboard
events command fails with invalid parameters when using Base64 topic
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:
- Converting single topic strings into the proper array format
- Providing clearer error messages about the required format
- Documenting the exact format needed for topic filters in the help text
Environment
- CLI version: latest
- Network: testnet