Skip to main content

BrowserWalletError

Enum BrowserWalletError 

Source
#[non_exhaustive]
pub enum BrowserWalletError {
Show 19 variants WalletUnavailable, DiscoverySelectionRequired { candidates: usize, }, DiscoverySelectionOutOfRange { index: usize, candidates: usize, }, InvalidProviderOrigin { message: Redacted<String>, }, UntrustedProviderOrigin { origin: Redacted<String>, }, UserRejectedRequest { method: String, code: i32, message: Redacted<String>, }, Disconnected { method: String, code: i32, message: Redacted<String>, }, WrongChain { method: String, code: i32, message: Redacted<String>, }, ChainNotAdded { chain_id: Option<ChainId>, method: String, code: i32, message: Redacted<String>, }, InvalidChainConfiguration { chain_id: ChainId, message: Redacted<String>, }, SessionChainMismatch { expected_chain_id: ChainId, session_chain_id: ChainId, }, TypedDataChainMismatch { expected_chain_id: ChainId, typed_data_chain_id: ChainId, }, UnsupportedRpcMethod { method: String, message: Redacted<String>, }, MalformedResponse { method: String, message: Redacted<String>, }, Rpc { method: String, code: i32, message: Redacted<String>, data: Option<Redacted<Value>>, }, JsInterop { message: Redacted<String>, }, Serialization { message: Redacted<String>, }, Core(CoreError), Cancelled,
}
Expand description

Errors produced by typed browser-wallet discovery, session, provider, and signer flows.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

WalletUnavailable

No injected browser wallet provider is available in the current runtime.

§

DiscoverySelectionRequired

Discovery found more than one candidate and requires an explicit wallet selection.

Fields

§candidates: usize

Number of candidates returned by discovery.

§

DiscoverySelectionOutOfRange

A requested discovery index is outside the available wallet range.

Fields

§index: usize

Requested wallet index.

§candidates: usize

Number of available discovery candidates.

§

InvalidProviderOrigin

A provider origin label failed local validation before provider construction.

Fields

§message: Redacted<String>

Sanitized validation failure description.

§

UntrustedProviderOrigin

An EIP-1193 provider did not have discovery metadata or an explicit trusted origin.

Fields

§origin: Redacted<String>

Redacted provider origin label.

§

UserRejectedRequest

The wallet explicitly rejected a user-authorized request.

The rejected RPC method and the EIP-1193 code are surfaced; the provider’s free-form message is retained for programmatic access but kept off the public rendering, so this variant reads as cleanly as the signing-layer typed-data rejection for the same 4001 condition.

Fields

§method: String

RPC method that was rejected.

§code: i32

Provider error code.

§message: Redacted<String>

Provider error message, retained for diagnostics and redacted on public rendering.

§

Disconnected

The wallet reported that it is disconnected from all chains.

Fields

§method: String

RPC method that failed.

§code: i32

Provider error code.

§message: Redacted<String>

Provider error message.

§

WrongChain

The wallet reported that the currently connected chain is incompatible with the request.

Fields

§method: String

RPC method that failed.

§code: i32

Provider error code.

§message: Redacted<String>

Provider error message.

§

ChainNotAdded

The requested chain has not been added to the wallet yet.

Fields

§chain_id: Option<ChainId>

Chain id requested by the wallet call, when the request carried one.

None when the failing request did not carry a parseable chain id, so the surfaced error never claims a chain the caller did not request.

§method: String

RPC method that failed.

§code: i32

Provider error code.

§message: Redacted<String>

Provider error message.

§

InvalidChainConfiguration

The typed add-chain input is invalid before any wallet request is attempted.

Fields

§chain_id: ChainId

Chain id referenced by the configuration.

§message: Redacted<String>

Validation failure description.

§

SessionChainMismatch

The wallet session chain does not match the expected workflow chain.

Fields

§expected_chain_id: ChainId

Chain id required by the current workflow.

§session_chain_id: ChainId

Chain id currently reported by the wallet session.

§

TypedDataChainMismatch

The typed-data payload chain does not match the expected workflow chain.

Fields

§expected_chain_id: ChainId

Chain id required by the current workflow.

§typed_data_chain_id: ChainId

Chain id encoded in the typed-data payload.

§

UnsupportedRpcMethod

The wallet does not support the requested RPC method.

Fields

§method: String

Unsupported RPC method.

§message: Redacted<String>

Provider-supplied failure description.

§

MalformedResponse

The wallet returned a response that does not match the typed contract.

Fields

§method: String

RPC method whose response could not be decoded.

§message: Redacted<String>

Decode or validation failure description.

§

Rpc

An unclassified wallet or RPC error payload.

Fields

§method: String

RPC method that failed.

§code: i32

Provider error code.

§message: Redacted<String>

Provider error message.

§data: Option<Redacted<Value>>

Optional provider-specific error data.

§

JsInterop

JavaScript interop or DOM interaction failed in the browser runtime.

Fields

§message: Redacted<String>

Interop failure description.

§

Serialization

JSON serialization, ABI conversion, or typed-data encoding failed locally.

Fields

§message: Redacted<String>

Serialization or local encoding failure description.

§

Core(CoreError)

Shared core type or validation error.

§

Cancelled

A long-running browser-wallet operation was cancelled through a cooperative cancellation token.

Implementations§

Source§

impl BrowserWalletError

Source

pub const fn class(&self) -> ErrorClass

Returns the coarse-grained ErrorClass for this error.

Trait Implementations§

Source§

impl Clone for BrowserWalletError

Source§

fn clone(&self) -> BrowserWalletError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BrowserWalletError

Source§

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

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

impl Display for BrowserWalletError

Source§

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

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

impl Error for BrowserWalletError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Cancelled> for BrowserWalletError

Source§

fn from(_: Cancelled) -> Self

Converts to this type from the input type.
Source§

impl From<CoreError> for BrowserWalletError

Source§

fn from(source: CoreError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for BrowserWalletError

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for BrowserWalletError

Source§

impl UserRejection for BrowserWalletError

Exposes the EIP-1193 provider error code carried by the UserRejectedRequest variant so the signing crate can route the rejection through cow_sdk_signing::SigningError::SignerRejection. Every other variant returns None and falls through to the signing crate’s redacted display path.

The match is exhaustive over every typed rejection-class variant the wallet error carries today; new EIP-1193 rejection variants must add a row here so the classification contract stays pinned against the typed error surface (and not against the Display shape). Pinning lives in crates/browser-wallet/tests/signer_error_trait_contract.rs.

Source§

fn user_rejection_code(&self) -> Option<i32>

Returns the EIP-1193 provider error code when this error represents a user-driven rejection of the signing request, or None for every other class of failure. Read more

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more