Skip to main content

LayerZeroTransport

Struct LayerZeroTransport 

Source
pub struct LayerZeroTransport {
    pub endpoint_address: [u8; 20],
    pub supported_chains: HashMap<ChainId, u32>,
    /* private fields */
}
Expand description

LayerZero v2 transport for xenith.

Communicates with a LayerZero endpoint contract to relay cross-chain messages. Each supported destination chain is mapped to its LayerZero endpoint ID (EID).

§Example

use xenith_layerzero::LayerZeroTransport;
use xenith_core::ChainId;

let transport = LayerZeroTransport::new(
    [0u8; 20],
    vec![(ChainId::from(42161), 30110)],
);

Fields§

§endpoint_address: [u8; 20]

Address of the LayerZero endpoint contract on the source chain.

§supported_chains: HashMap<ChainId, u32>

Maps a xenith ChainId to the LayerZero endpoint ID for that chain.

Implementations§

Source§

impl LayerZeroTransport

Source

pub fn new( endpoint_address: [u8; 20], chain_mappings: Vec<(ChainId, u32)>, ) -> Self

Create a new transport pointing at endpoint_address.

chain_mappings lists every destination chain this instance will accept, paired with its LayerZero endpoint ID.

Trait Implementations§

Source§

impl MessagingTransport for LayerZeroTransport

Source§

fn send_message<'life0, 'async_trait>( &'life0 self, destination: ChainId, _payload: Bytes, _options: SendOptions, ) -> Pin<Box<dyn Future<Output = Result<MessageId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Submit a message to the destination chain and return its tracking ID.
Source§

fn estimate_fee<'life0, 'async_trait>( &'life0 self, _destination: ChainId, _payload: Bytes, ) -> Pin<Box<dyn Future<Output = Result<u128>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Estimate the native-token fee for sending payload to destination.
Source§

fn message_status<'life0, 'async_trait>( &'life0 self, _id: MessageId, ) -> Pin<Box<dyn Future<Output = Result<MessageStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Poll the current delivery status of a previously sent message.
Source§

fn sender_address(&self) -> Option<[u8; 20]>

Returns the address this transport will submit transactions from, if applicable. Read more
Source§

fn poll_incoming<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(StateKey, StateValue, Option<KeyMetadata>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Poll for messages received by this transport since the last call. 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, 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, 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.