Skip to content

Commit 9ec581d

Browse files
authored
fix: ebo supported networks query (#25)
* fix: ebo supported networks query * fix: lint
1 parent 0832c1f commit 9ec581d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

availability-oracle/src/epoch_block_oracle_subgraph.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ struct GraphqlResponse {
4141

4242
const SUPPORTED_NETWORKS_QUERY: &str = r#"
4343
query Networks($skip: Int!) {
44-
networks(first: 1000, skip: $skip) {
45-
id
46-
alias
44+
globalState(id: "0") {
45+
networks(first: 1000, skip: $skip) {
46+
id
47+
alias
48+
}
4749
}
48-
}
50+
}
4951
"#;
5052

5153
impl EpochBlockOracleSubgraph for EpochBlockOracleSubgraphImpl {
@@ -81,8 +83,11 @@ impl EpochBlockOracleSubgraph for EpochBlockOracleSubgraphImpl {
8183
let data = res
8284
.data
8385
.ok_or_else(|| anyhow!("Data field is missing in the response"))?
84-
.remove("networks")
85-
.ok_or_else(|| anyhow!("'networks' field is missing in the data"))?;
86+
.remove("globalState")
87+
.and_then(|global_state| global_state.get("networks").cloned())
88+
.ok_or_else(|| {
89+
anyhow!("'networks' field is missing in the globalState data")
90+
})?;
8691

8792
#[derive(Deserialize)]
8893
#[allow(non_snake_case)]

0 commit comments

Comments
 (0)