Skip to content

Commit

Permalink
update: add env support for Celestia DA client
Browse files Browse the repository at this point in the history
  • Loading branch information
heemankv committed Jul 20, 2024
1 parent f93de6a commit 3bd0a1a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ ETHEREUM_RPC_URL=
MEMORY_PAGES_CONTRACT_ADDRESS=
STARKNET_SOLIDITY_CORE_CONTRACT_ADDRESS=

# Celestia DA Client
CELESTIA_DA_RPC_URL=http://localhost:8000
# CELESTIA_DA_AUTH_TOKEN
CELESTIA_DA_NID=Karnot



# Starknet
STARKNET_PUBLIC_KEY=
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/da-clients/celestia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ celestia-rpc = "0.2.0"
celestia-types = "0.2.0"
color-eyre = { workspace = true }
da-client-interface = { workspace = true }
dotenv = "0.15.0"
jsonrpsee = { version = "0.20.0", features = ["http-client"] }
mockall = "0.12.1"
protobuf = "3.5.0"
Expand Down
5 changes: 3 additions & 2 deletions crates/da-clients/celestia/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fs::File;
use std::path::PathBuf;
use utils::env_utils::get_env_var_or_panic;
use serde::Deserialize;

use dotenv::dotenv;
#[derive(Clone, PartialEq, Deserialize, Debug)]
pub struct CelestiaDaConfig {
pub http_provider: String,
Expand All @@ -22,10 +22,11 @@ impl TryFrom<&PathBuf> for CelestiaDaConfig {

impl DaConfig for CelestiaDaConfig {
fn new_from_env() -> Self {
dotenv().ok();
Self {
http_provider: get_env_var_or_panic("CELESTIA_DA_RPC_URL"),
auth_token: Some(get_env_var_or_panic("CELESTIA_DA_AUTH_TOKEN")),
nid: get_env_var_or_panic("CELESTIA_DA_NID"),
}
}
}
}

0 comments on commit 3bd0a1a

Please sign in to comment.