keySeismicWallet

Multi-signer wallet generic over SeismicNetwork

SeismicWallet<N> is the signing wallet used by SeismicSignedProvider. It holds one or more signers, tracks a default signer, and implements Alloy's NetworkWallet<N> trait so the filler pipeline can request transaction signatures.

Overview

SeismicWallet is generic over N: SeismicNetwork, meaning the same wallet type works transparently with SeismicReth (production) and SeismicFoundry (local development). Internally, it stores signers in an address-indexed map and maintains a default signer address.

Definition

pub struct SeismicWallet<N: SeismicNetwork>
where
    N::UnsignedTx: Send + Sync,
{
    default: Address,
    signers: AddressHashMap<Arc<dyn TxSigner<Signature> + Send + Sync>>,
    _network: std::marker::PhantomData<N>,
}
Field
Type
Description

default

Address

Address of the default signer

signers

AddressHashMap<Arc<dyn TxSigner<Signature> + Send + Sync>>

Map of registered signers by address

_network

PhantomData<N>

Marker for the network type (zero-sized)

Creating a Wallet

From a Single Signer

The most common pattern is to create a wallet from a PrivateKeySigner:

The From implementation is available for any type that implements TxSigner<Signature> + Send + Sync + 'static. The provided signer becomes both the default and the only registered signer.

With new()

This is equivalent to using From -- the signer is registered and set as the default.

Methods

new

Create a new wallet with a single signer that becomes the default.

Parameter
Type
Required
Description

signer

impl TxSigner<Signature> + Send + Sync + 'static

Yes

The signer to register as default

Returns: A new SeismicWallet with the given signer.

register_signer

Add an additional signer to the wallet without changing the default.

Parameter
Type
Required
Description

signer

impl TxSigner<Signature> + Send + Sync + 'static

Yes

The signer to add

register_default_signer

Add a signer and set it as the new default.

Parameter
Type
Required
Description

signer

impl TxSigner<Signature> + Send + Sync + 'static

Yes

The signer to add and set as default

set_default_signer

Change the default signer to an already-registered address. Panics if the address is not registered.

Parameter
Type
Required
Description

address

Address

Yes

Address of an already-registered signer

circle-info

This method will panic if you pass an address that has not been registered with register_signer or register_default_signer. Always register the signer first.

default_signer

Get an Arc reference to the default signer.

Returns: Arc<dyn TxSigner<Signature> + Send + Sync> -- The default signer.

signer_by_address

Look up a signer by its address.

Parameter
Type
Required
Description

address

Address

Yes

The address to look up

Returns: Option<Arc<dyn TxSigner<Signature> + Send + Sync>> -- The signer if registered, None otherwise.

Trait Implementations

NetworkWallet<N>

SeismicWallet<N> implements Alloy's NetworkWallet<N> trait, which is how the WalletFiller interacts with it during the filler pipeline:

  • default_signer_address() -- returns the default signer's address

  • has_signer_for(address) -- checks if a signer is registered for the given address

  • signer_addresses() -- returns an iterator over all registered signer addresses

From<S> for SeismicWallet<N>

Any type S that implements TxSigner<Signature> + Send + Sync + 'static can be converted into a SeismicWallet via From:

This is the most ergonomic way to create a wallet from a single signer.

Examples

Basic Wallet Creation

Multi-Account Wallet

Switching Default Signer

Local Development with SeismicFoundry

Notes

  • SeismicWallet is generic over N: SeismicNetwork so the same API works for both production and testing networks

  • Signers are stored as Arc<dyn TxSigner<Signature>>, allowing heterogeneous signer types in a single wallet

  • The PhantomData<N> field ensures type safety -- a SeismicWallet<SeismicReth> cannot be used with a SeismicSignedProvider<SeismicFoundry>

  • set_default_signer panics on unregistered addresses; check with signer_by_address first if unsure

  • The wallet does not handle encryption -- that is the responsibility of SeismicElementsFiller

See Also

Last updated