Skip to main content

MulticallBuilder

Struct MulticallBuilder 

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

Accumulator for a Multicall3 batch to be run via a self-call into a 7702-delegated TridentAccount EOA.

Implementations§

Source§

impl MulticallBuilder

Source

pub fn new() -> MulticallBuilder

New builder with multicall3 set to the canonical Multicall3 address.

Source

pub fn with_multicall3(self, addr: Address) -> MulticallBuilder

Override the Multicall3 address (tests / non-canonical chains).

Source

pub fn call<C>(self, contract: Address, call: &C) -> MulticallBuilder
where C: SolCall,

Append a zero-value contract call.

Source

pub fn call_with_value<C>( self, contract: Address, call: &C, value: Uint<256, 4>, ) -> MulticallBuilder
where C: SolCall,

Append a value-bearing contract call.

Source

pub fn send_value(self, to: Address, value: Uint<256, 4>) -> MulticallBuilder

Append a pure ETH transfer (empty calldata).

Source

pub fn total_value(&self) -> Uint<256, 4>

Sum of per-call values — this is the outer msg.value that will be sent to satisfy Multicall3’s invariant.

Source

pub fn aggregate3_calldata(&self) -> Bytes

Inner calldata: ABI-encoded Multicall3.aggregate3Value(calls).

Source

pub async fn send_with_wallet_provider<P, N>( self, provider: P, ) -> Result<PendingTransactionBuilder<N>, MulticallError>
where P: Provider<N> + WalletProvider<N>, N: Network,

Build + send the outer self-call. Convenience wrapper around send that uses the provider’s default signer as the outer-tx signer. That EOA must be 7702-delegated to TridentAccount.

Returns an alloy_provider::PendingTransactionBuilder.

Source

pub async fn send<P, N>( self, provider: P, tx_signer: Address, ) -> Result<PendingTransactionBuilder<N>, MulticallError>
where P: Provider<N>, N: Network,

Build + send the outer self-call.

tx_signer is the EOA that will sign the outer transaction — the from of the outgoing tx, which is also its to because this is a self-call. It must be 7702-delegated to TridentAccount, and it must match the key provider is configured to sign with; otherwise the provider will fail to sign or the chain will reject the tx.

Returns an alloy_provider::PendingTransactionBuilder.

Source

pub fn build_transaction_request<N>( self, tx_signer: Address, ) -> <N as Network>::TransactionRequest
where N: Network,

Assemble the outer execute(multicall3, aggregate3Value(...)) tx request without sending it.

tx_signer is the EOA that will sign the outer transaction; it is set as the request’s to (self-call) and, at send time, must be 7702-delegated to TridentAccount. value is set to the sum of per-call values. Gas/fees/nonce are left unset so callers can inspect, customize, or route the tx through any submission path.

Trait Implementations§

Source§

impl Clone for MulticallBuilder

Source§

fn clone(&self) -> MulticallBuilder

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 Default for MulticallBuilder

Source§

fn default() -> MulticallBuilder

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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 = !

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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