Can we define, emit and listen to Custom Events?

There is no special inbuilt for custom events as every choice exercise is an event. So if you want to emit an event, you can just create a choice without an effect:

controller (signatory this) can
  nonconsuming MyEvent : ()
    with
      message : Text
    do
      return ()

If you exercise that, all you’ll get is an extra node on the transaction tree that you can react to.

3 Likes