Version: 0.49.0


Note: those feature are enabled when using the --protocol kathmandu flag in LIGO CLI


New primitives#


let emit: string => 'a => operation

Build an event operation. To actually emit an event, this operation must be returned the same way as other operations (origination / transfer ..)


let get_last_events_from: typed_address <'p,'s> => string => list <'a>

Returns the list of all the event payloads emited with a given tag by a given address. Any call to this function must be annotated with the expected payload type.

Event testing#

Here is how you emit events and fetch them from your tests:

let main = ([p, _] : [[int, int], unit]) : [list<operation>, unit] => {
let op1 = Tezos.emit("%foo", p);
let op2 = Tezos.emit("%foo", p[0]);
return [list([op1, op2]), unit];
let _test = () : [list<[int,int]>, list<int>] => {
let [ta, _, _] = Test.originate(main, unit, 0 as tez);
let _ = Test.transfer_to_contract_exn(Test.to_contract(ta), [1,2], 0 as tez);
return [Test.get_last_events_from(ta, "foo") as list<[int, int]>, Test.get_last_events_from(ta, "foo") as list<int>];
let test = _test();