diff --git a/cmd/soroban-rpc/internal/methods/get_transaction.go b/cmd/soroban-rpc/internal/methods/get_transaction.go index 8187d3f09..de58be649 100644 --- a/cmd/soroban-rpc/internal/methods/get_transaction.go +++ b/cmd/soroban-rpc/internal/methods/get_transaction.go @@ -108,11 +108,12 @@ func GetTransaction(getter transactionGetter, request GetTransactionRequest) (Ge response.ResultXdr = base64.StdEncoding.EncodeToString(tx.Result) response.EnvelopeXdr = base64.StdEncoding.EncodeToString(tx.Envelope) response.ResultMetaXdr = base64.StdEncoding.EncodeToString(tx.Meta) + response.DiagnosticEventsXDR = base64EncodeSlice(tx.Events) + if tx.Successful { response.Status = TransactionStatusSuccess } else { response.Status = TransactionStatusFailed - response.DiagnosticEventsXDR = base64EncodeSlice(tx.Events) } return response, nil } diff --git a/cmd/soroban-rpc/internal/methods/get_transaction_test.go b/cmd/soroban-rpc/internal/methods/get_transaction_test.go index 85847f00c..dd5f96378 100644 --- a/cmd/soroban-rpc/internal/methods/get_transaction_test.go +++ b/cmd/soroban-rpc/internal/methods/get_transaction_test.go @@ -154,6 +154,7 @@ func TestGetTransaction(t *testing.T) { ResultMetaXdr: expectedTxMeta, Ledger: 101, LedgerCloseTime: 2625, + DiagnosticEventsXDR: []string{}, }, tx) // ingest another (failed) transaction @@ -177,6 +178,7 @@ func TestGetTransaction(t *testing.T) { ResultMetaXdr: expectedTxMeta, Ledger: 101, LedgerCloseTime: 2625, + DiagnosticEventsXDR: []string{}, }, tx) // the new transaction should also be there @@ -206,5 +208,6 @@ func TestGetTransaction(t *testing.T) { ResultMetaXdr: expectedTxMeta, Ledger: 102, LedgerCloseTime: 2650, + DiagnosticEventsXDR: []string{}, }, tx) }