Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 18f643a

Browse files
committed
simplify
1 parent ff4e1f6 commit 18f643a

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

wit-definitions/operator/wit/operator.wit

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,17 @@ interface input {
2424
interface output {
2525
use event-types.{event-id};
2626

27-
variant response-event-id {
28-
// will be auto-generated on the host by hashing service + trigger-action + (optional) salt
29-
// the salt can be provided to ensure additional uniqueness if needed
30-
// e.g. when multiple responses are generated for the same trigger-action
31-
auto(option<list<u8>>),
32-
33-
// hash any arbitrary payload to generate the event id
34-
// it's up to you to ensure uniqueness here
35-
hash(list<u8>),
36-
37-
// a raw event id provided directly, typically for testing purposes
38-
raw(event-id),
39-
}
40-
4127
record wasm-response {
4228
// arbitrary payload returned from the component
4329
// and passed on to be signed by the operators
4430
payload: list<u8>,
4531
// currently unused
4632
ordering: option<u64>,
47-
// make sure this is unique for every response!
48-
event-id: response-event-id
33+
// if supplied, make sure this is unique for every response!
34+
// for example, `host::hash_event_id(some_uuid.as_bytes())`
35+
// otherwise it will be auto-generated by the host
36+
// by hashing service + trigger-action
37+
event-id: option<event-id>
4938
}
5039
}
5140

@@ -71,7 +60,6 @@ world wavs-world {
7160
use service-types.{service-and-workflow-id, workflow-and-workflow-id};
7261
use core-types.{log-level};
7362
use event-types.{event-id};
74-
use output.{response-event-id};
7563

7664
get-evm-chain-config: func(chain-key: string) -> option<evm-chain-config>;
7765
get-cosmos-chain-config: func(chain-key: string) -> option<cosmos-chain-config>;
@@ -86,9 +74,12 @@ world wavs-world {
8674
// convenience function to get the workflow without having to walk service.workflows
8775
get-workflow: func() -> workflow-and-workflow-id;
8876

89-
// convenience function to get what the event id will be
77+
// convenience function to get what the auto-generated event id will be
9078
// typically only used for debugging or testing purposes
91-
get-event-id: func(kind: response-event-id) -> event-id;
79+
get-event-id: func() -> event-id;
80+
81+
// helper to hash any arbitrary data into an event id
82+
hash-event-id: func(bytes: list<u8>) -> event-id;
9283
}
9384

9485
use input.{trigger-action};

0 commit comments

Comments
 (0)