From 6a7a9d5a1f28167ddbcca1a5997e1322ac1c8036 Mon Sep 17 00:00:00 2001 From: George Date: Wed, 23 Oct 2024 13:44:37 -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 e63f9132..8312b530 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"` @@ -553,6 +555,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,