Events
Filter events fired during interactions:
get events[.eventName] [from <logic>] [of <ixHash>] [on <address|user|logic>] [with <filters>]
Events are also printed inline in the result of a deploy/invoke, including when the interaction fails (throw/revert or meter exhausted). The get events command below re-queries stored events with filters.
Examples
# All events of a specific type
get events.Transfer
# Events from a specific logic
get events from Tokenledger
# Events from a specific interaction
get events of 0x1089...5654
# Events emitted to an actor or logic, by name or address
get events on alice
get events on Tokenledger
get events on 0x6ada...c470
Events from string emits (emit "...",
emit f"...") have no name and no topics, so get events.<Name> and with <filters> skip them. Use
plain get events, from <logic>, of <ixHash> or on <LogicName>. They print as
value:<message> without an Event Name Hash line.
Event Address and LogicId
Every stored event records the Address it was emitted to and the LogicId of the logic that
emitted it. The Address depends on the emit:
| Emit | Address |
|---|---|
emit Ev{...} -> Sender | The sender |
emit Ev{...} -> other | other |
emit Ev{...} or emit "..." (no target) | The emitting logic |
on matches the Address. It accepts a registered user name, a compiled logic name or a hex
address. Cocolab tries a user first, then a logic, and otherwise uses the value as an address. An
emit with no target is found with on <LogicName>.
With this logic:
coco Pinger
event Ping:
topic who Identifier
field n U64
endpoint PingSelf(n U64):
emit Ping{who: Sender, n: n} -> Sender
endpoint PingTo(to Identifier, n U64):
emit Ping{who: Sender, n: n} -> to
endpoint Broadcast(n U64):
emit Ping{who: Sender, n: n}
each call's event is found by its own target:
>>> invoke Pinger.PingSelf(n: 1) as alice
>>> invoke Pinger.PingTo(to: bob, n: 2) as alice
>>> invoke Pinger.Broadcast(n: 3) as alice
>>> get events on bob
Event No. 0
IxHash: 0x609e...3d75
Address: 0xf651...9b14
LogicId: 0x0000...4c20
Event Name Hash: 0x6aca...ac4f
Topics Hashes:
1: 0x6bb0...cc69
>> n:2 who:0x6ada...c470
>>> get events on Pinger
Event No. 0
IxHash: 0xd5c6...1738
Address: 0x06b7...4c20
LogicId: 0x0000...4c20
Event Name Hash: 0x6aca...ac4f
Topics Hashes:
1: 0x6bb0...cc69
>> n:3 who:0x6ada...c470
get events on alice returns the PingSelf event. Filters combine, so get events.Ping on bob and
get events from Pinger on alice work too.
Before v0.9.2, Cocolab recorded every event with an empty Address, so get events on … never
matched, and on accepted only a hex address. Compiled logics weren't affected.
Event Output
Event No. 0
IxHash: 0xf662...a278
Address: 0x6ada...c470
LogicId: 0x0000...4c20
Event Name Hash: 0x6aca...ac4f
Topics Hashes:
1: 0x6bb0...cc69
>> n:1 who:0x6ada...c470
| Line | Meaning |
|---|---|
IxHash | Hash of the interaction that emitted the event |
Address | Where the event was emitted to (see above) |
LogicId | The logic that emitted it |
Event Name Hash | Hash of the event name. Missing for string emits |
Topics Hashes | One hash per topic field |
>> | The decoded fields |