Skip to main content

WalletsBuilder

Struct WalletsBuilder 

Source
pub struct WalletsBuilder { /* private fields */ }
Expand description

Builds a Wallets. Everything the module cannot decide for a venture — which domain its messages are bound to, where its entropy comes from, whether it can check a contract wallet — is set here.

Implementations§

Source§

impl WalletsBuilder

Source

pub fn new() -> Self

The defaults: no domain, no entropy source, Ethereum mainnet, a ten-minute nonce and no contract verifier.

Source

pub fn domain(self, domain: impl Into<String>) -> Self

The domain every SIWE/SIWS message must name. This is the phishing defence, so it is required: a message minted for another site is refused rather than verified.

Source

pub fn uri(self, uri: impl Into<String>) -> Self

The URI field of the messages, the page the signer is being sent back to. Defaults to https://<domain>.

Source

pub fn statement(self, statement: impl Into<String>) -> Self

The Statement line — the words the person reads before signing. This is the one line that reaches a human, so it should say what is about to happen in the plainest words available.

Source

pub fn chain_id(self, chain_id: impl Into<String>) -> Self

The EVM chain id the messages carry. Defaults to DEFAULT_EVM_CHAIN_ID.

Source

pub fn nonce_ttl(self, ttl: Duration) -> Self

How long a nonce stays usable. Clamped to at least one second and at most MAX_NONCE_TTL.

Source

pub fn random(self, random: impl RandomBytes + 'static) -> Self

Sets the entropy source nonces are drawn from. Required: core carries no CSPRNG, so the venture supplies one (ADR 0002).

Source

pub fn contract_verifier( self, verifier: impl ContractSignatureVerifier + 'static, ) -> Self

Sets the EIP-1271 contract-wallet verifier. Left unset the module serves EOAs only; a smart-contract wallet then fails with wallets/signature-invalid rather than hanging on a chain call.

Source

pub fn build(self) -> Wallets

Builds the module. A blank uri with a domain set becomes https://<domain>, so the common composition does not have to repeat the domain twice.

Trait Implementations§

Source§

impl Default for WalletsBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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