pub struct Chain {
pub name: Blockchain,
pub chain_id: u32,
pub hypersync_url: String,
pub rpc_url: Option<String>,
}
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.
Implementations§
Source§impl Chain
impl Chain
pub fn new(name: Blockchain, chain_id: u32) -> Self
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§
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