pub struct MessageTransmitterV2Contract<P: Provider<Ethereum>> { /* private fields */ }Expand description
The CCTP v2 Message Transmitter contract wrapper
Handles message verification and reception with support for different finality levels (Fast Transfer vs Standard).
Implementations§
Source§impl<P: Provider<Ethereum>> MessageTransmitterV2Contract<P>
impl<P: Provider<Ethereum>> MessageTransmitterV2Contract<P>
Sourcepub fn receive_message_transaction(
&self,
message: Bytes,
attestation: Bytes,
from_address: Address,
) -> TransactionRequest
pub fn receive_message_transaction( &self, message: Bytes, attestation: Bytes, from_address: Address, ) -> TransactionRequest
Create transaction request for receiving a cross-chain message with attestation
§Arguments
message- The message bytes from the source chainattestation- Circle’s attestation signature for the messagefrom_address- Address that will submit the transaction
§Finality Handling
v2 contracts handle different finality levels:
- Fast Transfer messages (threshold 1000) trigger
handleReceiveUnfinalizedMessage - Standard messages (threshold 2000) trigger
handleReceiveFinalizedMessage
The receiving contract must implement the appropriate handler interface.
Sourcepub fn send_message_transaction(
&self,
from_address: Address,
destination_domain: DomainId,
recipient: Address,
message_body: Bytes,
destination_caller: Address,
min_finality_threshold: u32,
) -> TransactionRequest
pub fn send_message_transaction( &self, from_address: Address, destination_domain: DomainId, recipient: Address, message_body: Bytes, destination_caller: Address, min_finality_threshold: u32, ) -> TransactionRequest
Create transaction request for sending a generic cross-chain message
v2 adds support for sending arbitrary messages, not just token burns.
§Arguments
from_address- Address initiating the message senddestination_domain- CCTP domain ID for destination chainrecipient- Recipient address on destination chainmessage_body- Arbitrary message datadestination_caller- Optional authorized caller on destination (0x0 = anyone)min_finality_threshold- 1000 (fast) or 2000 (standard)
Sourcepub async fn is_message_received(
&self,
message_hash: [u8; 32],
) -> Result<bool, Error>
pub async fn is_message_received( &self, message_hash: [u8; 32], ) -> Result<bool, Error>
Check if a message has been received (anti-replay protection)
Queries the usedNonces mapping to determine if a message has already
been processed. A non-zero value indicates the message was received.
This is useful for checking replay protection before attempting to receive a message on the destination chain.
Auto Trait Implementations§
impl<P> Freeze for MessageTransmitterV2Contract<P>where
P: Freeze,
impl<P> RefUnwindSafe for MessageTransmitterV2Contract<P>where
P: RefUnwindSafe,
impl<P> Send for MessageTransmitterV2Contract<P>
impl<P> Sync for MessageTransmitterV2Contract<P>
impl<P> Unpin for MessageTransmitterV2Contract<P>where
P: Unpin,
impl<P> UnwindSafe for MessageTransmitterV2Contract<P>where
P: UnwindSafe,
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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