Skip to content

Commit

Permalink
fix: ebo supported networks query
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikol committed Jun 10, 2024
1 parent 0832c1f commit e058386
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 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,9 @@ 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

0 comments on commit e058386

Please sign in to comment.