Package
Use the@layerzerolabs/lz-solana-sdk-v2 package to interact with the LayerZero Endpoint program on Solana from TypeScript/JavaScript.
Interacting with the Endpoint
Note that the SDK makes use ofUmi in place of @solana/web3.js
Create an endpoint instance:
endpoint.initVerify(umiWalletSigner, { srcEid, sender, receiver, nonce }) before skip or clear.
Skip a message
endpoint.skip(umiWalletSigner, { sender, receiver, srcEid, nonce })
- When to use: Bypass a stuck inbound message at a future nonce to unblock subsequent processing.
- Preconditions:
nonce > inboundNoncenonce <= inboundNonce + 256(sliding window)- If the payload account is missing, call
initVerifyfirst - Caller is the authorized delegate
Nilify a nonce
endpoint.oAppNilify(umiWalletSigner, { nonce, receiver, sender, srcEid, payloadHash })
- When to use: Invalidate a verified payload by setting its payload hash to NIL without deleting the account.
- Preconditions:
- Provide the exact
payloadHash(must match onchain) - Typically after verification; does not create the payload account
- Caller is the authorized delegate
- Provide the exact
Burn a nonce
endpoint.oAppBurnNonce(umiWalletSigner, { nonce, receiver, sender, srcEid, payloadHash })
- When to use: Delete the payload hash account for an older nonce after inbound processing has advanced beyond it (state cleanup).
- Preconditions:
nonce < inboundNonce- Provide the exact
payloadHash(must match onchain) - Caller is the authorized delegate
Clear a payload
Note thatclear does not make use of the endpoint class, but instead requires usage of EndpointProgram.instruction.
EndpointProgram.instructions.clear({ programs }, { accounts }, { args })
- When to use: Finalize/ack a payload for a nonce that has already been verified; clean up state for a known payload.
- Preconditions:
nonce <= inboundNonce- Provide
payloadHashORguid + message(to derive the hash) - If payload account is missing, call
initVerifyfirst - Caller is the authorized delegate