pub struct ChainId(/* private fields */);Expand description
Identifies the NEAR chain the client is connected to.
This is a string-based newtype that replaces the former Network enum,
allowing any chain identifier (not just the hardcoded variants).
Use the named constructors for well-known chains, or ChainId::new
for custom ones.
§Examples
use near_kit::ChainId;
let mainnet = ChainId::mainnet();
assert!(mainnet.is_mainnet());
assert_eq!(mainnet.as_str(), "mainnet");
let custom = ChainId::new("localnet");
assert_eq!(custom.as_str(), "localnet");Implementations§
Source§impl ChainId
impl ChainId
Sourcepub fn is_mainnet(&self) -> bool
pub fn is_mainnet(&self) -> bool
Returns true if this is mainnet.
Sourcepub fn is_testnet(&self) -> bool
pub fn is_testnet(&self) -> bool
Returns true if this is testnet.
Trait Implementations§
impl Eq for ChainId
impl StructuralPartialEq for ChainId
Auto Trait Implementations§
impl Freeze for ChainId
impl RefUnwindSafe for ChainId
impl Send for ChainId
impl Sync for ChainId
impl Unpin for ChainId
impl UnsafeUnpin for ChainId
impl UnwindSafe for ChainId
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.