Skip to content

Commit

Permalink
fix: ebo supported networks query (#25)
Browse files Browse the repository at this point in the history
* fix: ebo supported networks query

* fix: lint
  • Loading branch information
Maikol authored Jun 12, 2024
1 parent 0832c1f commit 9ec581d
Showing 1 changed file with 11 additions and 6 deletions.
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

0 comments on commit 9ec581d

Please sign in to comment.