diff --git a/cmd/soroban-rpc/internal/transactions/transactions.go b/cmd/soroban-rpc/internal/transactions/transactions.go index 5a0c31ad..f2feef49 100644 --- a/cmd/soroban-rpc/internal/transactions/transactions.go +++ b/cmd/soroban-rpc/internal/transactions/transactions.go @@ -211,7 +211,7 @@ func (m *MemoryStore) GetTransaction(hash xdr.Hash) (Transaction, bool, StoreRan return Transaction{}, false, storeRange } - var events = make([][]byte, 0, len(txEvents)) + events := make([][]byte, 0, len(txEvents)) for _, e := range txEvents { diagnosticEventXDR, err := e.MarshalBinary() diff --git a/cmd/soroban-rpc/internal/transactions/transactions_test.go b/cmd/soroban-rpc/internal/transactions/transactions_test.go index 1683f986..99fce9cf 100644 --- a/cmd/soroban-rpc/internal/transactions/transactions_test.go +++ b/cmd/soroban-rpc/internal/transactions/transactions_test.go @@ -361,6 +361,19 @@ func TestGetTransactionsWithEventData(t *testing.T) { require.True(t, ok) require.NotNil(t, tx.Events) require.Len(t, tx.Events, 1) + + var event xdr.DiagnosticEvent + err := event.UnmarshalBinary(tx.Events[0]) + require.Nil(t, err) + require.Equal(t, xdr.ContractEventTypeContract, event.Event.Type) + require.Equal(t, int32(0), event.Event.Body.V) + + require.NotNil(t, event.Event.Body.V0.Topics) + require.Equal(t, xdr.ScValTypeScvSymbol, event.Event.Body.V0.Topics[0].Type) + + require.NotNil(t, event.Event.Body.V0.Data) + require.Equal(t, xdr.ScValTypeScvSymbol, event.Event.Body.V0.Data.Type) + } func stableHeapInUse() int64 {