From 75d6016081c37d62e57b157ccf2d4c5d0b0f3076 Mon Sep 17 00:00:00 2001 From: David Mechler Date: Wed, 14 Oct 2020 08:18:41 -0400 Subject: [PATCH] Update graphql pending to allow txn sorting (#1450) * Update graphql pending to allow for sorting of transactions Signed-off-by: David Mechler --- ethereum/api/src/main/resources/schema.graphqls | 11 ++++++++++- .../besu/ethereum/api/graphql/graphql_pending.json | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ethereum/api/src/main/resources/schema.graphqls b/ethereum/api/src/main/resources/schema.graphqls index b065daf502..f06cb2e243 100644 --- a/ethereum/api/src/main/resources/schema.graphqls +++ b/ethereum/api/src/main/resources/schema.graphqls @@ -257,12 +257,21 @@ type SyncState{ knownStates: Long } +input TransactionOrderByNonce { + nonce: Sort +} + +enum Sort { + asc + desc +} + # Pending represents the current pending state. type Pending { # TransactionCount is the number of transactions in the pending state. transactionCount: Int! # Transactions is a list of transactions in the current pending state. - transactions: [Transaction!] + transactions(orderBy: TransactionOrderByNonce): [Transaction!] # Account fetches an Ethereum account for the pending state. account(address: Address!): Account! # Call executes a local call operation for the pending state. diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/graphql/graphql_pending.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/graphql/graphql_pending.json index 46cad8c1c7..8cbdccca14 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/graphql/graphql_pending.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/graphql/graphql_pending.json @@ -1,6 +1,6 @@ { "request": - "{ pending { transactionCount transactions { nonce gas } account(address:\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance} estimateGas(data:{}) call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x12a7b914\"}){data status}} }", + "{ pending { transactionCount transactions(orderBy: {nonce: asc}) { nonce gas } account(address:\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance} estimateGas(data:{}) call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x12a7b914\"}){data status}} }", "response": { "data": {