Skip to content

Commit

Permalink
Change ledger sequence to uint32
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya1702 committed Apr 18, 2024
1 parent 364ee92 commit aeb0a84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/soroban-rpc/internal/methods/get_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type TransactionInfo struct {
FeeBump bool `json:"feeBump"`
ApplicationOrder int32 `json:"applicationOrder"`
Successful bool `json:"successful"`
LedgerSequence uint `json:"ledgerSequence"`
LedgerSequence uint32 `json:"ledgerSequence"`
}

// GetTransactionsResponse encapsulates the response structure for getTransactions queries.
Expand Down Expand Up @@ -180,7 +180,7 @@ LedgerLoop:
FeeBump: tx.Envelope.IsFeeBump(),
ApplicationOrder: int32(tx.Index),
Successful: tx.Result.Result.Successful(),
LedgerSequence: uint(ledger.LedgerSequence()),
LedgerSequence: ledger.LedgerSequence(),
}

txns = append(txns, txInfo)
Expand Down
14 changes: 7 additions & 7 deletions cmd/soroban-rpc/internal/test/get_transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ func TestGetTransactions(t *testing.T) {
err := client.CallResult(context.Background(), "getTransactions", request, &result)
assert.NoError(t, err)
assert.Equal(t, len(result.Transactions), 3)
assert.Equal(t, uint32(result.Transactions[0].LedgerSequence), ledgers[0])
assert.Equal(t, uint32(result.Transactions[1].LedgerSequence), ledgers[1])
assert.Equal(t, uint32(result.Transactions[2].LedgerSequence), ledgers[2])
assert.Equal(t, result.Transactions[0].LedgerSequence, ledgers[0])
assert.Equal(t, result.Transactions[1].LedgerSequence, ledgers[1])
assert.Equal(t, result.Transactions[2].LedgerSequence, ledgers[2])

// Get transactions from single ledger
request = methods.GetTransactionsRequest{
Expand All @@ -95,7 +95,7 @@ func TestGetTransactions(t *testing.T) {
err = client.CallResult(context.Background(), "getTransactions", request, &result)
assert.NoError(t, err)
assert.Equal(t, len(result.Transactions), 1)
assert.Equal(t, uint32(result.Transactions[0].LedgerSequence), ledgers[0])
assert.Equal(t, result.Transactions[0].LedgerSequence, ledgers[0])

// Get transactions with limit
request = methods.GetTransactionsRequest{
Expand All @@ -108,7 +108,7 @@ func TestGetTransactions(t *testing.T) {
err = client.CallResult(context.Background(), "getTransactions", request, &result)
assert.NoError(t, err)
assert.Equal(t, len(result.Transactions), 1)
assert.Equal(t, uint32(result.Transactions[0].LedgerSequence), ledgers[0])
assert.Equal(t, result.Transactions[0].LedgerSequence, ledgers[0])

// Get transactions using previous result's cursor
cursor := result.Pagination.Cursor
Expand All @@ -122,7 +122,7 @@ func TestGetTransactions(t *testing.T) {
err = client.CallResult(context.Background(), "getTransactions", request, &result)
assert.NoError(t, err)
assert.Equal(t, len(result.Transactions), 2)
assert.Equal(t, uint32(result.Transactions[0].LedgerSequence), ledgers[1])
assert.Equal(t, uint32(result.Transactions[1].LedgerSequence), ledgers[2])
assert.Equal(t, result.Transactions[0].LedgerSequence, ledgers[1])
assert.Equal(t, result.Transactions[1].LedgerSequence, ledgers[2])

}

0 comments on commit aeb0a84

Please sign in to comment.