Skip to content

Commit

Permalink
upgrade async-graphql and related api changes (#4092)
Browse files Browse the repository at this point in the history
  • Loading branch information
cong-or authored Sep 15, 2022
1 parent 790178f commit 79eb8f3
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 65 deletions.
101 changes: 51 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions explorer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ version = "0.9.1"
futures = "0.3.5"
futures-channel = "0.3.5"
futures-util = "0.3.5"
async-graphql = "3"
async-graphql-warp = "3"
async-graphql = "4.0.13"
async-graphql-warp = "4.0.13"
serde = {version = "1.0.114", features = ["derive"]}
serde_json = "1.0.81"
serde_yaml = "0.8.13"
Expand Down
28 changes: 15 additions & 13 deletions explorer/src/api/graphql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ impl Branch {
}
};

connection.append(edges.iter().map(|(h, chain_length)| {
Edge::new(
IndexCursor::from(u32::from(*chain_length)),
Block::from_valid_hash(*h),
)
}));
connection
.edges
.extend(edges.iter().map(|(h, chain_length)| {
Edge::new(
IndexCursor::from(u32::from(*chain_length)),
Block::from_valid_hash(*h),
)
}));

Ok::<_, async_graphql::Error>(connection)
},
Expand Down Expand Up @@ -201,7 +203,7 @@ impl Branch {
.collect(),
};

connection.append(edges.iter().map(|(h, i)| {
connection.edges.extend(edges.iter().map(|(h, i)| {
Edge::new(IndexCursor::from(*i), Transaction::from_valid_id(*h))
}));

Expand Down Expand Up @@ -279,7 +281,7 @@ impl Branch {
}
};

connection.append(
connection.edges.extend(
edges
.iter()
.map(|(vps, cursor)| Edge::new(IndexCursor::from(*cursor), vps.clone())),
Expand Down Expand Up @@ -365,7 +367,7 @@ impl Branch {
}
};

connection.append(
connection.edges.extend(
edges
.iter()
.map(|(pool, cursor)| Edge::new(IndexCursor::from(*cursor), pool.clone())),
Expand Down Expand Up @@ -456,7 +458,7 @@ impl Branch {
.collect::<Vec<_>>(),
};

connection.append(edges.iter().map(|(id, cursor)| {
connection.edges.extend(edges.iter().map(|(id, cursor)| {
Edge::new(IndexCursor::from(*cursor), Block::from_valid_hash(*id))
}));

Expand Down Expand Up @@ -623,7 +625,7 @@ impl Block {
}
};

connection.append(
connection.edges.extend(
edges
.iter()
.map(|(tx, cursor)| Edge::new(IndexCursor::from(*cursor), tx.clone())),
Expand Down Expand Up @@ -1103,7 +1105,7 @@ impl Pool {
},
);

connection.append(
connection.edges.extend(
edges
.iter()
.map(|(h, i)| Edge::new(IndexCursor::from(*i), Block::from_valid_hash(*h))),
Expand Down Expand Up @@ -1468,7 +1470,7 @@ impl VoteProposalStatus {
}
};

connection.append(
connection.edges.extend(
edges
.iter()
.map(|(vs, cursor)| Edge::new(IndexCursor::from(*cursor), vs.clone())),
Expand Down

0 comments on commit 79eb8f3

Please sign in to comment.