diff --git a/sse/event.go b/sse/event.go index d8a97b0..875b9af 100644 --- a/sse/event.go +++ b/sse/event.go @@ -111,9 +111,9 @@ type ( EraID uint64 `json:"era_id"` ExecutionEffect types.Effect `json:"execution_effect"` // Todo: not sure, didn't found example to test - Operations []types.Operation `json:"operations"` + Operations *[]types.Operation `json:"operations,omitempty"` // Todo: not sure, didn't found example to test - Transform types.TransformKey `json:"transform"` + Transform *types.TransformKey `json:"transform,omitempty"` } StepEvent struct { Step StepPayload `json:"step"` diff --git a/tests/sse/events_parsing_test.go b/tests/sse/events_parsing_test.go index 478c733..b60ddee 100644 --- a/tests/sse/events_parsing_test.go +++ b/tests/sse/events_parsing_test.go @@ -1,6 +1,7 @@ package sse import ( + "encoding/json" "os" "testing" @@ -97,3 +98,15 @@ func Test_RawEvent_ParseAsStepEvent(t *testing.T) { require.NoError(t, err) assert.False(t, res.Step.ExecutionEffect.Transforms[0].Transform.IsWriteTransfer()) } + +func Test_RawEvent_ParseAndMarshalStepEvent(t *testing.T) { + data, err := os.ReadFile("../data/sse/step_event.json") + require.NoError(t, err) + rawEvent := sse.RawEvent{ + Data: data, + } + res, err := rawEvent.ParseAsStepEvent() + require.NoError(t, err) + _, err = json.Marshal(res) + assert.NoError(t, err) +}