Skip to content

Conversation

@fnando
Copy link
Member

@fnando fnando commented Feb 9, 2026

What

Using stellar contract invoke:

$ stellar contract invoke --id events -- transfer --from default --to fnando --amount 100
ℹ️ Signing transaction: df106774838950fb3741f4e90801a114f2f001c42c5123c5d2c5bb53b319bc1b
📅 CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3 - Success - Event: Transfer, from: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW", to: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5", amount: "100"

Using stellar events:

$ stellar events --id events --start-ledger 918600 --count 10 --output plain
Event 0003945550231638016-0000000000 [CONTRACT]:
  Ledger:   918645 (closed at 2026-02-09T18:03:16Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Transfer
  Params:
    from: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    to: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "500"

Event 0003945597476278272-0000000000 [CONTRACT]:
  Ledger:   918656 (closed at 2026-02-09T18:03:27Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Approve
  Params:
    owner: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    spender: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "1000"
    expiration_ledger: 999999

Event 0003952757186760704-0000000000 [CONTRACT]:
  Ledger:   920323 (closed at 2026-02-09T18:31:18Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Transfer
  Params:
    from: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    to: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "100"

$ stellar events --id events --start-ledger 918600 --count 10 --output raw
Event 0003945550231638016-0000000000 [CONTRACT]:
  Ledger:   918645 (closed at 2026-02-09T18:03:16Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Topics:
            Symbol(ScSymbol(StringM(transfer)))
            Address(Account(AccountId(PublicKeyTypeEd25519(Uint256(024f5be19e6bb169bd4741c6e07d92fd5cf5b49096ff9381235096664fa7ac4e)))))
            Address(Account(AccountId(PublicKeyTypeEd25519(Uint256(d4545ed4e9ca3fe5676fafecc41c6db54ef2fa35e3bed81034b8a5016ea82749)))))
  Value: I128(Int128Parts { hi: 0, lo: 500 })

Event 0003945597476278272-0000000000 [CONTRACT]:
  Ledger:   918656 (closed at 2026-02-09T18:03:27Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Topics:
            Symbol(ScSymbol(StringM(approve)))
            Address(Account(AccountId(PublicKeyTypeEd25519(Uint256(024f5be19e6bb169bd4741c6e07d92fd5cf5b49096ff9381235096664fa7ac4e)))))
            Address(Account(AccountId(PublicKeyTypeEd25519(Uint256(d4545ed4e9ca3fe5676fafecc41c6db54ef2fa35e3bed81034b8a5016ea82749)))))
  Value: Vec(Some(ScVec(VecM([I128(Int128Parts { hi: 0, lo: 1000 }), U32(999999)]))))

Event 0003952757186760704-0000000000 [CONTRACT]:
  Ledger:   920323 (closed at 2026-02-09T18:31:18Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Topics:
            Symbol(ScSymbol(StringM(transfer)))
            Address(Account(AccountId(PublicKeyTypeEd25519(Uint256(024f5be19e6bb169bd4741c6e07d92fd5cf5b49096ff9381235096664fa7ac4e)))))
            Address(Account(AccountId(PublicKeyTypeEd25519(Uint256(d4545ed4e9ca3fe5676fafecc41c6db54ef2fa35e3bed81034b8a5016ea82749)))))
  Value: I128(Int128Parts { hi: 0, lo: 100 })

$ stellar events --id events --start-ledger 918600 --count 10 --output json
{"id":"0003945550231638016-0000000000","ledger":918645,"ledger_closed_at":"2026-02-09T18:03:16Z","type":"contract","contract_id":"CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3","event_name":"Transfer","params":{"from":"GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW","to":"GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5","amount":"500"}}
{"id":"0003945597476278272-0000000000","ledger":918656,"ledger_closed_at":"2026-02-09T18:03:27Z","type":"contract","contract_id":"CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3","event_name":"Approve","params":{"owner":"GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW","spender":"GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5","amount":"1000","expiration_ledger":999999}}
{"id":"0003952757186760704-0000000000","ledger":920323,"ledger_closed_at":"2026-02-09T18:31:18Z","type":"contract","contract_id":"CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3","event_name":"Transfer","params":{"from":"GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW","to":"GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5","amount":"100"}}

$ stellar events --id events --start-ledger 918600 --count 10 --output pretty
Event 0003945550231638016-0000000000 [CONTRACT]:
  Ledger:   918645 (closed at 2026-02-09T18:03:16Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Transfer
  Params:
    from: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    to: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "500"

Event 0003945597476278272-0000000000 [CONTRACT]:
  Ledger:   918656 (closed at 2026-02-09T18:03:27Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Approve
  Params:
    owner: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    spender: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "1000"
    expiration_ledger: 999999

Event 0003952757186760704-0000000000 [CONTRACT]:
  Ledger:   920323 (closed at 2026-02-09T18:31:18Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Transfer
  Params:
    from: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    to: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "100"

$ stellar events --id events --start-ledger 918600 --count 10
Event 0003945550231638016-0000000000 [CONTRACT]:
  Ledger:   918645 (closed at 2026-02-09T18:03:16Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Transfer
  Params:
    from: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    to: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "500"

Event 0003945597476278272-0000000000 [CONTRACT]:
  Ledger:   918656 (closed at 2026-02-09T18:03:27Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Approve
  Params:
    owner: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    spender: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "1000"
    expiration_ledger: 999999

Event 0003952757186760704-0000000000 [CONTRACT]:
  Ledger:   920323 (closed at 2026-02-09T18:31:18Z)
  Contract: CCIHVGCOHGYGKOHBWT3GMR7WTUDFCHMWLWWR6DDP7VT2HJ6JMER4Z2T3
  Event:    Transfer
  Params:
    from: "GABE6W7BTZV3C2N5I5A4NYD5SL6VZ5NUSCLP7E4BENIJMZSPU6WE4ZEW"
    to: "GDKFIXWU5HFD7ZLHN6X6ZRA4NW2U54X2GXR35WAQGS4KKALOVATUSVH5"
    amount: "100"
events

Why

Implement #2086.

Known limitations

N/A

Copilot AI review requested due to automatic review settings February 9, 2026 18:34
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Feb 9, 2026
@fnando fnando requested review from leighmcculloch and mootz12 and removed request for Copilot February 9, 2026 18:35
@willemneal
Copy link
Contributor

Looks awesome! My one nit is that the invoke line is too long. If the invoke had multiple events could they share the same output as the other event examples?

@fnando
Copy link
Member Author

fnando commented Feb 9, 2026

@willemneal I decided to keep the same previous output mostly because in a real terminal you get the autowrap.

@willemneal
Copy link
Contributor

willemneal commented Feb 9, 2026

That's true, just find it more readable than an auto wrap, since it would be predictable line breaks and chunked logically.

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

👏🏻 So good. Few questions and comments inline.

Copilot AI review requested due to automatic review settings February 9, 2026 21:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements self-describing (spec-decoded) contract event rendering for stellar events and stellar contract invoke, leveraging Protocol 23 event definitions in contract specs to display named parameters and improved human-readable/JSON output.

Changes:

  • Add event-spec decoding support to soroban-spec-tools (new event module + Spec::find_events + decoding helpers/tests).
  • Update stellar events to optionally fetch contract specs and render decoded Pretty/Plain/Json outputs, plus add a --output raw mode.
  • Update stellar contract invoke to render decoded contract events when the invoked contract’s spec is available.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
cmd/soroban-cli/src/log/event.rs Adds contract_with_spec to render decoded contract events when a spec is provided, with raw fallback.
cmd/soroban-cli/src/commands/events.rs Adds decoded event rendering (Pretty/Plain/Json), spec fetching/cache, and a new raw output mode.
cmd/soroban-cli/src/commands/contract/invoke.rs Switches invoke event printing to the new spec-aware event renderer.
cmd/soroban-cli/Cargo.toml Adds indexmap dependency for stable param ordering in decoded output.
cmd/crates/soroban-spec-tools/src/lib.rs Exposes new event module and adds Spec::find_events with tests.
cmd/crates/soroban-spec-tools/src/event.rs Introduces event spec matching/decoding to named parameters + unit tests.
cmd/crates/soroban-spec-tools/Cargo.toml Adds serde and indexmap dependencies needed for decoded event types.
FULL_HELP_DOCS.md Documents new/updated stellar events --output behaviors (decoded formats + raw).
Cargo.lock Locks new transitive dependencies (indexmap, serde).

@fnando fnando merged commit 6ce33a1 into main Feb 10, 2026
32 checks passed
@fnando fnando deleted the self-describing-events branch February 10, 2026 17:55
@github-project-automation github-project-automation bot moved this from Backlog (Not Ready) to Done in DevX Feb 10, 2026
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.

4 participants