Send Messages
Use LayerZero to send a bytes payload from one chain to another.
To send a message, call the Endpoint's send() function.
Initiate the send()
function in your contracts to send a cross chain message.
public fun send<UA>(
dst_chain_id: u64,
dst_address: vector<u8>,
payload: vector<u8>,
native_fee: Coin<AptosCoin>,
zro_fee: Coin<ZRO>,
adapter_params: vector<u8>,
msglib_params: vector<u8>,
_cap: &UaCapability<UA>
): (u64, Coin<AptosCoin>, Coin<ZRO>)
You can send any message (payload
) to any address on any chain and pay fee with AptosCoin
. So far we only support AptosCoin
as fee. ZRO
coin will be supported to pay the protocol fee in the future.
The msglib_params
is for passing parameters to the message libraries. So far, it is not used and can be empty.
Estimating Message Fees If you want to know how much to give to the send() function to pay for you message please refer to this section on estimating fees.