pub struct Chain {
pub name: Blockchain,
pub chain_id: u32,
pub hypersync_url: String,
pub rpc_url: Option<String>,
pub native_currency_decimals: u8,
}
Expand description
Defines a blockchain with its unique identifiers and connection details for network interaction.
Fields§
§name: Blockchain
The blockchain network type.
chain_id: u32
The unique identifier for this blockchain.
hypersync_url: String
URL endpoint for HyperSync connection.
rpc_url: Option<String>
URL endpoint for the default RPC connection.
native_currency_decimals: u8
The number of decimals for the native currency.
Implementations§
Source§impl Chain
impl Chain
Sourcepub fn new(name: Blockchain, chain_id: u32) -> Self
pub fn new(name: Blockchain, chain_id: u32) -> Self
Creates a new Chain
instance with the specified blockchain and chain ID.
Sourcepub fn set_rpc_url(&mut self, rpc: String)
pub fn set_rpc_url(&mut self, rpc: String)
Sets the RPC URL endpoint.
Sourcepub fn from_chain_id(chain_id: u32) -> Option<&'static Chain>
pub fn from_chain_id(chain_id: u32) -> Option<&'static Chain>
Returns a reference to the Chain
corresponding to the given chain_id
, or None
if it is not found.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chain
impl<'de> Deserialize<'de> for Chain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Chain
Auto Trait Implementations§
impl Freeze for Chain
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnwindSafe for Chain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
Adds separators according to the given
SeparatorPolicy
. Read moreSource§fn separate_with_commas(&self) -> String
fn separate_with_commas(&self) -> String
Inserts a comma every three digits from the right. Read more
Source§fn separate_with_spaces(&self) -> String
fn separate_with_spaces(&self) -> String
Inserts a space every three digits from the right. Read more
Source§fn separate_with_dots(&self) -> String
fn separate_with_dots(&self) -> String
Inserts a period every three digits from the right. Read more
Source§fn separate_with_underscores(&self) -> String
fn separate_with_underscores(&self) -> String
Inserts an underscore every three digits from the right. Read more