From 9fee36e1e787747d2bb98690e18be344f44521f1 Mon Sep 17 00:00:00 2001 From: Enzo Cioppettini Date: Wed, 17 Feb 2021 13:45:57 -0300 Subject: [PATCH] remove graphql address { confirmed_transactions } it's not really necessary, as getting the confirmed branch and getting it from there creates less api redundancy also, update the schema --- jormungandr/src/explorer/graphql/mod.rs | 51 ------------------- .../resources/explorer/graphql/schema.graphql | 3 +- 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/jormungandr/src/explorer/graphql/mod.rs b/jormungandr/src/explorer/graphql/mod.rs index 92f53a1f83..86c6d78ae0 100644 --- a/jormungandr/src/explorer/graphql/mod.rs +++ b/jormungandr/src/explorer/graphql/mod.rs @@ -825,57 +825,6 @@ impl Address { fn delegation() -> FieldResult { Err(ErrorKind::Unimplemented.into()) } - - async fn confirmed_transactions( - &self, - first: Option, - last: Option, - before: Option, - after: Option, - context: &Context, - ) -> FieldResult { - let transactions = context - .db - .get_main_tip() - .await - .1 - .state() - .transactions_by_address(&self.id) - .unwrap_or_else(PersistentSequence::::new); - - let boundaries = if transactions.len() > 0 { - PaginationInterval::Inclusive(InclusivePaginationInterval { - lower_bound: 0u64, - upper_bound: transactions.len(), - }) - } else { - PaginationInterval::Empty - }; - - let pagination_arguments = PaginationArguments { - first, - last, - before: before.map(u64::from), - after: after.map(u64::from), - } - .validate()?; - - TransactionConnection::new( - boundaries, - pagination_arguments, - |range: PaginationInterval| match range { - PaginationInterval::Empty => vec![], - PaginationInterval::Inclusive(range) => (range.lower_bound..=range.upper_bound) - .filter_map(|i| { - transactions - .get(i) - .map(|h| HeaderHash::clone(h)) - .map(|h| (TransactionNodeFetchInfo::Id(h), i)) - }) - .collect(), - }, - ) - } } struct TaxType(chain_impl_mockchain::rewards::TaxType); diff --git a/testing/jormungandr-testing-utils/resources/explorer/graphql/schema.graphql b/testing/jormungandr-testing-utils/resources/explorer/graphql/schema.graphql index 1242b3eae5..04052a19a7 100644 --- a/testing/jormungandr-testing-utils/resources/explorer/graphql/schema.graphql +++ b/testing/jormungandr-testing-utils/resources/explorer/graphql/schema.graphql @@ -2,7 +2,6 @@ type Address { """The base32 representation of an address""" id: String! delegation: Pool! - confirmedTransactions(first: Int, last: Int, before: IndexCursor, after: IndexCursor): TransactionConnection! } type BftLeader { @@ -25,6 +24,7 @@ type Block { totalInput: Value! totalOutput: Value! treasury: Treasury + isConfirmed: Boolean! branches: [Branch!]! } @@ -228,6 +228,7 @@ type Ratio { type Settings { fees: FeeSettings! + epochStabilityDepth: String! } scalar Slot