Skip to content

Commit

Permalink
missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
jayantk committed Oct 18, 2023
1 parent 9604aa4 commit a9b8329
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyth-rng/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
chains:
- chain_id: "optimism-goerli"
geth_rpc_addr: https://goerli.optimism.io
contract_addr: 0x28F16Af4D87523910b843a801454AEde5F9B0459
26 changes: 26 additions & 0 deletions pyth-rng/src/api/chain_ids.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use {
crate::api::{
ChainId,
RestError,
},
anyhow::Result,
axum::{
extract::State,
Json,
},
};

/// Get the list of supported chain ids
#[utoipa::path(
get,
path = "/v1/chains",
responses(
(status = 200, description = "Successfully retrieved the list of chain ids", body = GetRandomValueResponse),
)
)]
pub async fn chain_ids(
State(state): State<crate::api::ApiState>,
) -> Result<Json<Vec<ChainId>>, RestError> {
let chain_ids = state.chains.iter().map(|(id, _)| id.clone()).collect();
Ok(Json(chain_ids))
}

0 comments on commit a9b8329

Please sign in to comment.