From 4b948c3b197a8db483ff232ec1bf7d0cc0599b5e Mon Sep 17 00:00:00 2001 From: George Date: Thu, 24 Oct 2024 12:31:15 -0700 Subject: [PATCH] Revert "Remove pagingToken from getEvents (#297)" This reverts commit 44db01f8c6aef623a10a83c0a27f728c918d9a04. --- cmd/soroban-rpc/internal/methods/get_events.go | 3 +++ cmd/soroban-rpc/internal/methods/get_events_test.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/cmd/soroban-rpc/internal/methods/get_events.go b/cmd/soroban-rpc/internal/methods/get_events.go index a7d78eb1..933e6d81 100644 --- a/cmd/soroban-rpc/internal/methods/get_events.go +++ b/cmd/soroban-rpc/internal/methods/get_events.go @@ -92,6 +92,8 @@ type EventInfo struct { ContractID string `json:"contractId"` ID string `json:"id"` + // Deprecated: PagingToken field is deprecated, please use Cursor at top level for pagination + PagingToken string `json:"pagingToken"` InSuccessfulContractCall bool `json:"inSuccessfulContractCall"` TransactionHash string `json:"txHash"` @@ -554,6 +556,7 @@ func eventInfoForEvent( Ledger: int32(cursor.Ledger), LedgerClosedAt: ledgerClosedAt, ID: cursor.String(), + PagingToken: cursor.String(), InSuccessfulContractCall: event.InSuccessfulContractCall, TransactionHash: txHash, } diff --git a/cmd/soroban-rpc/internal/methods/get_events_test.go b/cmd/soroban-rpc/internal/methods/get_events_test.go index 81a9c169..cd06b0e3 100644 --- a/cmd/soroban-rpc/internal/methods/get_events_test.go +++ b/cmd/soroban-rpc/internal/methods/get_events_test.go @@ -649,6 +649,7 @@ func TestGetEvents(t *testing.T) { LedgerClosedAt: now.Format(time.RFC3339), ContractID: "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4", ID: id, + PagingToken: id, TopicXDR: []string{value}, ValueXDR: value, InSuccessfulContractCall: true, @@ -795,6 +796,7 @@ func TestGetEvents(t *testing.T) { LedgerClosedAt: now.Format(time.RFC3339), ContractID: "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4", ID: id, + PagingToken: id, TopicXDR: []string{counterXdr, value}, ValueXDR: value, InSuccessfulContractCall: true, @@ -941,6 +943,7 @@ func TestGetEvents(t *testing.T) { LedgerClosedAt: now.Format(time.RFC3339), ContractID: strkey.MustEncode(strkey.VersionByteContract, contractID[:]), ID: id, + PagingToken: id, TopicXDR: []string{counterXdr, value}, ValueXDR: value, InSuccessfulContractCall: true, @@ -1017,6 +1020,7 @@ func TestGetEvents(t *testing.T) { LedgerClosedAt: now.Format(time.RFC3339), ContractID: strkey.MustEncode(strkey.VersionByteContract, contractID[:]), ID: id, + PagingToken: id, TopicXDR: []string{counterXdr}, ValueXDR: counterXdr, InSuccessfulContractCall: true, @@ -1089,6 +1093,7 @@ func TestGetEvents(t *testing.T) { LedgerClosedAt: now.Format(time.RFC3339), ContractID: "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4", ID: id, + PagingToken: id, TopicXDR: []string{value}, ValueXDR: value, InSuccessfulContractCall: true, @@ -1190,6 +1195,7 @@ func TestGetEvents(t *testing.T) { LedgerClosedAt: now.Format(time.RFC3339), ContractID: strkey.MustEncode(strkey.VersionByteContract, contractID[:]), ID: id, + PagingToken: id, TopicXDR: []string{counterXdr}, ValueXDR: expectedXdr, InSuccessfulContractCall: true,