Instruction: QuoteSend
This instruction returns a quote of the fees needed to send a cross-chain message.
Input parameters
dst_eid
: This is the identifier of the remote endpoint.receiver
: This is the address of the receiver contract.message
: This is the arbitrary string to be sent to the remote contract.options
: These are the send options; these are used in addition to the enforced options specified in the OApp configuration for the given receiver.pay_in_lz_token
: If this is false, the fee is calculated in native currency; otherwise, it is calculated using the LayerZero token.
Accounts
The instruction receives the following accounts explicitly:
store
: Account storing the global OApp configuration.PDA: Yes, with seed
STORE_SEED
.
peer
: Account representing an allowlisted remote contract.PDA: Yes, with seeds
PEER_SEED
,store.key()
, andparams.dst_eid
.
endpoint
: Account storing the settings for the LayerZero endpoint on Solana.PDA: Yes, with seed
ENDPOINT_SEED
, derived from the endpoint program ID.
It also forwards the remaining accounts in the CPI made to get the messaging fee from the LayerZero endpoint.
CPI
The LayerZero endpoint is invoked to get a quote for the messaging fees.
The accounts for the CPI are forwarded verbatim from the Anchor context remaining_accounts
, and the caller is responsible for providing the correct ones.
The QuoteParams
struct providing arguments for the instruction is initialized as follows:
sender
:ctx.accounts.store.key()
.dst_eid
:params.dst_eid
.receiver
:params.receiver
.message
:params.message
encoded by prepending the string length (32 bytes) before the UTF-8 representation of the string.pay_in_lz_token
:params.pay_in_lz_token
.options
:params.options
combined with the enforced options configured in the per-peer configuration.