Chain

Enum Chain 

Source
pub enum Chain {
Show 17 variants Polkadot, Kusama, Moonbeam, Astar, Acala, Phala, Bifrost, Westend, Paseo, Ethereum, BinanceSmartChain, Polygon, Avalanche, Arbitrum, Optimism, ZkSync, Base,
}
Expand description

Supported blockchain networks

Variants§

§

Polkadot

Polkadot relay chain

§

Kusama

Kusama relay chain

§

Moonbeam

Moonbeam (Polkadot parachain with EVM)

§

Astar

Astar (Polkadot parachain with EVM)

§

Acala

Acala DeFi Hub

§

Phala

Phala Privacy Cloud

§

Bifrost

Bifrost Liquid Staking

§

Westend

Westend testnet

§

Paseo

Paseo testnet (default)

§

Ethereum

Ethereum mainnet

§

BinanceSmartChain

Binance Smart Chain

§

Polygon

Polygon

§

Avalanche

Avalanche C-Chain

§

Arbitrum

Arbitrum One

§

Optimism

Optimism

§

ZkSync

zkSync Era

§

Base

Base (Coinbase L2)

Implementations§

Source§

impl Chain

Source

pub fn chain_type(&self) -> ChainType

Get the chain type

Source

pub fn name(&self) -> &str

Get the chain name

Source

pub fn default_endpoint(&self) -> &str

Get default RPC endpoint for the chain

Source

pub fn rpc_endpoints(&self) -> Vec<&str>

Get multiple RPC endpoints for reliability and failover

Source

pub fn is_layer2(&self) -> bool

Check if chain is a Layer 2 solution

Source

pub fn supports_smart_contracts(&self) -> bool

Check if chain supports smart contracts

Source

pub fn is_testnet(&self) -> bool

Check if this is a testnet

Source

pub fn from_str_case_insensitive(s: &str) -> Option<Self>

Parse chain from string (case-insensitive)

Source

pub fn is_substrate_endpoint(endpoint: &str) -> bool

Check if an endpoint URL is for Substrate (WebSocket-based)

Source

pub fn is_evm_endpoint(endpoint: &str) -> bool

Check if an endpoint URL is for EVM (HTTP-based)

Source

pub fn chain_id(&self) -> Option<u64>

Get the chain ID for EVM-compatible chains

Returns None for pure Substrate chains that don’t have a chain ID concept. For EVM and Hybrid chains, returns the standard EIP-155 chain ID.

Source

pub fn validate_chain_id(&self, chain_id: u64) -> Result<(), ValidationError>

Validate that a given chain ID matches this chain

Returns an error if the chain ID doesn’t match the expected value. For Substrate-only chains, returns an error indicating chain ID is not applicable.

Trait Implementations§

Source§

impl Clone for Chain

Source§

fn clone(&self) -> Chain

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Chain

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Chain

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for Chain

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Chain

Source§

fn eq(&self, other: &Chain) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Chain

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Chain

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,