Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ebo supported networks query #25

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions availability-oracle/src/epoch_block_oracle_subgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ struct GraphqlResponse {

const SUPPORTED_NETWORKS_QUERY: &str = r#"
query Networks($skip: Int!) {
networks(first: 1000, skip: $skip) {
id
alias
globalState(id: "0") {
networks(first: 1000, skip: $skip) {
id
alias
}
}
}
}
"#;

impl EpochBlockOracleSubgraph for EpochBlockOracleSubgraphImpl {
Expand Down Expand Up @@ -81,8 +83,11 @@ impl EpochBlockOracleSubgraph for EpochBlockOracleSubgraphImpl {
let data = res
.data
.ok_or_else(|| anyhow!("Data field is missing in the response"))?
.remove("networks")
.ok_or_else(|| anyhow!("'networks' field is missing in the data"))?;
.remove("globalState")
.and_then(|global_state| global_state.get("networks").cloned())
.ok_or_else(|| {
anyhow!("'networks' field is missing in the globalState data")
})?;

#[derive(Deserialize)]
#[allow(non_snake_case)]
Expand Down
Loading