From e05838690f1eec5b3ce030c4616198dd08af3475 Mon Sep 17 00:00:00 2001 From: Miguel de Elias Date: Mon, 10 Jun 2024 17:59:56 -0300 Subject: [PATCH 1/2] fix: ebo supported networks query --- .../src/epoch_block_oracle_subgraph.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/availability-oracle/src/epoch_block_oracle_subgraph.rs b/availability-oracle/src/epoch_block_oracle_subgraph.rs index 40c41f7..d51275e 100644 --- a/availability-oracle/src/epoch_block_oracle_subgraph.rs +++ b/availability-oracle/src/epoch_block_oracle_subgraph.rs @@ -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 { @@ -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)] From 1e1cff903209f76af20366727b33664fa70d28bc Mon Sep 17 00:00:00 2001 From: Miguel de Elias Date: Mon, 10 Jun 2024 18:20:40 -0300 Subject: [PATCH 2/2] fix: lint --- availability-oracle/src/epoch_block_oracle_subgraph.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/availability-oracle/src/epoch_block_oracle_subgraph.rs b/availability-oracle/src/epoch_block_oracle_subgraph.rs index d51275e..1cea45e 100644 --- a/availability-oracle/src/epoch_block_oracle_subgraph.rs +++ b/availability-oracle/src/epoch_block_oracle_subgraph.rs @@ -85,7 +85,9 @@ impl EpochBlockOracleSubgraph for EpochBlockOracleSubgraphImpl { .ok_or_else(|| anyhow!("Data field is missing in the response"))? .remove("globalState") .and_then(|global_state| global_state.get("networks").cloned()) - .ok_or_else(|| anyhow!("'networks' field is missing in the globalState data"))?; + .ok_or_else(|| { + anyhow!("'networks' field is missing in the globalState data") + })?; #[derive(Deserialize)] #[allow(non_snake_case)]