openzeppelin_relayer/config/config_file/network/solana.rs
1//! Solana Network Configuration
2//!
3//! This module provides configuration support for Solana blockchain networks including
4//! mainnet-beta, testnet, devnet, and custom Solana-compatible networks.
5//!
6//! ## Key Features
7//!
8//! - **Full inheritance support**: Solana networks can inherit from other Solana networks
9//! - **Standard validation**: Inherits all common field validation requirements
10//! - **Type safety**: Inheritance only allowed between Solana networks
11
12use super::common::NetworkConfigCommon;
13use crate::config::ConfigFileError;
14use serde::{Deserialize, Serialize};
15
16/// Configuration specific to Solana networks.
17#[derive(Debug, Serialize, Deserialize, Clone)]
18#[serde(deny_unknown_fields)]
19pub struct SolanaNetworkConfig {
20 /// Common network fields.
21 #[serde(flatten)]
22 pub common: NetworkConfigCommon,
23 // Additional Solana-specific fields can be added here.
24}
25
26impl SolanaNetworkConfig {
27 /// Validates the specific configuration fields for a Solana network.
28 ///
29 /// # Returns
30 /// - `Ok(())` if the Solana configuration is valid.
31 /// - `Err(ConfigFileError)` if validation fails (e.g., missing fields, invalid URLs).
32 pub fn validate(&self) -> Result<(), ConfigFileError> {
33 self.common.validate()?;
34 Ok(())
35 }
36
37 /// Merges this Solana configuration with a parent Solana configuration.
38 /// Parent values are used as defaults, child values take precedence.
39 pub fn merge_with_parent(&self, parent: &Self) -> Self {
40 Self {
41 common: self.common.merge_with_parent(&parent.common),
42 // Add Solana-specific field merging here as they are added to the struct
43 }
44 }
45}