Skip to content

Commit

Permalink
remove graphql address { confirmed_transactions }
Browse files Browse the repository at this point in the history
it's not really necessary, as getting the confirmed branch and getting
it from there creates less api redundancy

also, update the schema
  • Loading branch information
ecioppettini committed Feb 17, 2021
1 parent 8816369 commit 9fee36e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 52 deletions.
51 changes: 0 additions & 51 deletions jormungandr/src/explorer/graphql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,57 +825,6 @@ impl Address {
fn delegation() -> FieldResult<Pool> {
Err(ErrorKind::Unimplemented.into())
}

async fn confirmed_transactions(
&self,
first: Option<i32>,
last: Option<i32>,
before: Option<IndexCursor>,
after: Option<IndexCursor>,
context: &Context,
) -> FieldResult<TransactionConnection> {
let transactions = context
.db
.get_main_tip()
.await
.1
.state()
.transactions_by_address(&self.id)
.unwrap_or_else(PersistentSequence::<FragmentId>::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<u64>| 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -25,6 +24,7 @@ type Block {
totalInput: Value!
totalOutput: Value!
treasury: Treasury
isConfirmed: Boolean!
branches: [Branch!]!
}

Expand Down Expand Up @@ -228,6 +228,7 @@ type Ratio {

type Settings {
fees: FeeSettings!
epochStabilityDepth: String!
}

scalar Slot
Expand Down

0 comments on commit 9fee36e

Please sign in to comment.