Instruction: Send

This instruction sends a cross-chain message to one of the allowlisted remote contracts.

Input parameters

pub struct SendMessageParams { pub dst_eid: u32, pub message: String, pub options: Vec, pub native_fee: u64, pub lz_token_fee: u64, }
  • dst_eid: This is the ID of the remote endpoint contract.

  • message: This is the message to be sent to the remote contract.

  • options: These are additional send options, merged with the enforced options configured for the dst_eid in the remote peer configuration.

  • native_fee: This is the amount of native currency to be used to pay for messaging fees.

  • lz_token_fee: This is the amount of LZ token to be used to pay for messaging fees.

Accounts

  • peer: Account representing the allowlisted remote contract to which the message is sent.

    • PDA: Yes, with seeds PEER_SEED, store.key(), and params.dst_eid.

  • store: Account storing the OApp global configuration.

    • PDA: Yes, with seed STORE_SEED.

  • endpoint: Account storing the settings for the LayerZero endpoint on Solana.

    • PDA: Yes, with seed ENDPOINT_SEED, derived from the endpoint program ID.

CPI

The LayerZero endpoint program is invoked to send the outgoing message.

The SendParams struct of arguments passed to the CPI is initialized as follows:

  • dst_eid: params.dst_eid.

  • receiver: ctx.accounts.peer.peer_address.

  • message: params.message encoded by prepending the string length (32 bytes) before the UTF-8 representation of the string.

  • options: params.options appended to the options enforced by the OApp global configuration.

  • native_fee: params.native_fee.

  • lz_token_fee: params.lz_token_fee.

Zellic © 2025Back to top ↑