Skip to main content

newton_cli/
config.rs

1use newton_prover_core::config::{key::EcdsaKey, ConfigLoader};
2use serde::{Deserialize, Serialize};
3
4/// Newton CLI Config
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
6pub struct NewtonCliConfig {
7    /// Ethereum RPC URL
8    pub eth_rpc_url: String,
9    /// Gateway URL for Newton Protocol AVS
10    pub gateway_url: String,
11    /// Signer
12    pub signer: EcdsaKey,
13}
14
15// Implement ConfigLoader trait - provides load_config method automatically
16impl ConfigLoader for NewtonCliConfig {
17    const FILE_NAME: &'static str = "newton-cli";
18    const ENV_PREFIX: &'static str = "NEWTON_CLI";
19}
20
21impl NewtonCliConfig {
22    /// Set eth rpc url
23    pub fn set_eth_rpc_url(&mut self, eth_rpc_url: String) {
24        self.eth_rpc_url = eth_rpc_url;
25    }
26
27    /// Set gateway url
28    pub fn set_gateway_url(&mut self, gateway_url: String) {
29        self.gateway_url = gateway_url;
30    }
31
32    /// Set signer
33    pub fn set_signer(&mut self, signer: EcdsaKey) {
34        self.signer = signer;
35    }
36}