Skip to content

Instantly share code, notes, and snippets.

@nazreen
Created November 28, 2025 13:29
Show Gist options
  • Select an option

  • Save nazreen/421c694a0d584d98706b5e13f0d43e92 to your computer and use it in GitHub Desktop.

Select an option

Save nazreen/421c694a0d584d98706b5e13f0d43e92 to your computer and use it in GitHub Desktop.
IDL
{
"address": "CoVroueYhpvD9i24JmWRJJBZZSpfvoeDkQGkSBgEbRcg",
"metadata": {
"name": "my_oapp",
"version": "0.1.0",
"spec": "0.1.0",
"description": "Created with Anchor"
},
"instructions": [
{
"name": "init_store",
"discriminator": [
250,
74,
6,
95,
163,
188,
19,
181
],
"accounts": [
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "store",
"writable": true
},
{
"name": "lz_receive_types_accounts",
"writable": true
},
{
"name": "alt",
"optional": true
},
{
"name": "system_program"
}
],
"args": [
{
"name": "params",
"type": {
"defined": {
"name": "InitStoreParams"
}
}
}
]
},
{
"name": "lz_receive",
"discriminator": [
8,
179,
120,
109,
33,
118,
189,
80
],
"accounts": [
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "store",
"docs": [
"OApp Store PDA. This account represents the \"address\" of your OApp on",
"Solana and can contain any state relevant to your application.",
"Customize the fields in `Store` as needed."
],
"writable": true
},
{
"name": "peer",
"docs": [
"Peer config PDA for the sending chain. Ensures `params.sender` can only be the allowed peer from that remote chain."
]
}
],
"args": [
{
"name": "params",
"type": {
"defined": {
"name": "LzReceiveParams"
}
}
}
]
},
{
"name": "lz_receive_types_info",
"discriminator": [
43,
148,
213,
93,
101,
127,
37,
170
],
"accounts": [
{
"name": "store"
},
{
"name": "lz_receive_types_accounts",
"docs": [
"PDA account containing the versioned data structure for V2",
"Contains the accounts needed to construct lz_receive_types_v2 instruction"
]
}
],
"args": [
{
"name": "params",
"type": {
"defined": {
"name": "LzReceiveParams"
}
}
}
]
},
{
"name": "lz_receive_types_v2",
"discriminator": [
109,
157,
200,
142,
138,
223,
159,
164
],
"accounts": [
{
"name": "store"
}
],
"args": [
{
"name": "params",
"type": {
"defined": {
"name": "LzReceiveParams"
}
}
}
],
"returns": {
"defined": {
"name": "LzReceiveTypesV2Result"
}
}
},
{
"name": "quote_send",
"discriminator": [
207,
0,
49,
214,
160,
211,
76,
211
],
"accounts": [
{
"name": "store"
},
{
"name": "peer"
},
{
"name": "endpoint"
}
],
"args": [
{
"name": "params",
"type": {
"defined": {
"name": "QuoteSendParams"
}
}
}
],
"returns": {
"defined": {
"name": "MessagingFee"
}
}
},
{
"name": "send",
"discriminator": [
102,
251,
20,
187,
65,
75,
12,
69
],
"accounts": [
{
"name": "peer",
"docs": [
"Configuration for the destination chain. Holds the peer address and any",
"enforced messaging options."
]
},
{
"name": "store",
"docs": [
"OApp Store PDA that signs the send instruction"
]
},
{
"name": "endpoint"
}
],
"args": [
{
"name": "params",
"type": {
"defined": {
"name": "SendMessageParams"
}
}
}
]
},
{
"name": "set_peer_config",
"discriminator": [
79,
187,
168,
57,
139,
140,
93,
47
],
"accounts": [
{
"name": "admin",
"docs": [
"Admin of the OApp store"
],
"writable": true,
"signer": true
},
{
"name": "peer",
"docs": [
"Peer configuration PDA for a specific remote chain"
],
"writable": true
},
{
"name": "store",
"docs": [
"Store PDA of this OApp"
]
},
{
"name": "system_program"
}
],
"args": [
{
"name": "params",
"type": {
"defined": {
"name": "SetPeerConfigParams"
}
}
}
]
}
],
"accounts": [
{
"name": "EndpointSettings",
"discriminator": [
221,
232,
73,
56,
10,
66,
72,
14
]
},
{
"name": "LzReceiveTypesAccounts",
"discriminator": [
248,
87,
167,
117,
5,
251,
21,
126
]
},
{
"name": "PeerConfig",
"discriminator": [
181,
157,
86,
198,
33,
193,
94,
203
]
},
{
"name": "Store",
"discriminator": [
130,
48,
247,
244,
182,
191,
30,
26
]
}
],
"errors": [
{
"code": 6000,
"name": "InvalidMessageType"
}
],
"types": [
{
"name": "AccountMetaRef",
"docs": [
"Account metadata for V2 execution planning.",
"Used by the Executor to construct the final transaction.",
"",
"V2 removes the legacy is_signer flag from V1's AccountMeta.",
"Instead, signer roles are explicitly declared through AddressLocator variants.",
"This provides clearer semantics and enables multiple signer support."
],
"type": {
"kind": "struct",
"fields": [
{
"name": "pubkey",
"docs": [
"The account address locator - supports multiple resolution strategies"
],
"type": {
"defined": {
"name": "AddressLocator"
}
}
},
{
"name": "is_writable",
"docs": [
"Whether the account should be writable in the final transaction"
],
"type": "bool"
}
]
}
},
{
"name": "AddressLocator",
"docs": [
"A generic account locator used in LZ execution planning for V2.",
"Can reference the address directly, via ALT, or as a placeholder.",
"",
"This enum enables the compact account referencing design of V2, supporting:",
"- OApps to request multiple signer accounts, not just a single Executor EOA",
"- Dynamic creation of writable EOA-based data accounts",
"- Efficient encoding of addresses via ALTs, reducing account list size",
"",
"The legacy is_signer flag is removed. Instead, signer roles are explicitly",
"declared through Payer and indexed Signer(u8) variants."
],
"type": {
"kind": "enum",
"variants": [
{
"name": "Address",
"fields": [
"pubkey"
]
},
{
"name": "AltIndex",
"fields": [
"u8",
"u8"
]
},
{
"name": "Payer"
},
{
"name": "Signer",
"fields": [
"u8"
]
},
{
"name": "Context"
}
]
}
},
{
"name": "EndpointSettings",
"type": {
"kind": "struct",
"fields": [
{
"name": "eid",
"type": "u32"
},
{
"name": "bump",
"type": "u8"
},
{
"name": "admin",
"type": "pubkey"
},
{
"name": "lz_token_mint",
"type": {
"option": "pubkey"
}
}
]
}
},
{
"name": "EnforcedOptions",
"type": {
"kind": "struct",
"fields": [
{
"name": "send",
"type": "bytes"
},
{
"name": "send_and_call",
"type": "bytes"
}
]
}
},
{
"name": "InitStoreParams",
"type": {
"kind": "struct",
"fields": [
{
"name": "admin",
"type": "pubkey"
},
{
"name": "endpoint",
"type": "pubkey"
}
]
}
},
{
"name": "Instruction",
"docs": [
"The list of instructions that can be executed in the LzReceive transaction.",
"",
"V2's multi-instruction model enables complex patterns such as:",
"- Preprocessing steps before lz_receive (e.g., account initialization)",
"- Postprocessing steps after lz_receive (e.g., verification, cleanup)",
"- ABA messaging patterns with additional LayerZero sends",
"- Conditional execution flows based on message content"
],
"type": {
"kind": "enum",
"variants": [
{
"name": "LzReceive",
"fields": [
{
"name": "accounts",
"docs": [
"Account list for the lz_receive instruction",
"Uses AddressLocator for flexible address resolution"
],
"type": {
"vec": {
"defined": {
"name": "AccountMetaRef"
}
}
}
}
]
},
{
"name": "Standard",
"fields": [
{
"name": "program_id",
"docs": [
"Target program ID for the custom instruction"
],
"type": "pubkey"
},
{
"name": "accounts",
"docs": [
"Account list for the custom instruction",
"Uses same AddressLocator system as LzReceive"
],
"type": {
"vec": {
"defined": {
"name": "AccountMetaRef"
}
}
}
},
{
"name": "data",
"docs": [
"Instruction data payload",
"Raw bytes containing the instruction's parameters"
],
"type": "bytes"
}
]
}
]
}
},
{
"name": "LzReceiveParams",
"type": {
"kind": "struct",
"fields": [
{
"name": "src_eid",
"type": "u32"
},
{
"name": "sender",
"type": {
"array": [
"u8",
32
]
}
},
{
"name": "nonce",
"type": "u64"
},
{
"name": "guid",
"type": {
"array": [
"u8",
32
]
}
},
{
"name": "message",
"type": "bytes"
},
{
"name": "extra_data",
"type": "bytes"
}
]
}
},
{
"name": "LzReceiveTypesAccounts",
"type": {
"kind": "struct",
"fields": [
{
"name": "store",
"type": "pubkey"
},
{
"name": "alt",
"type": "pubkey"
},
{
"name": "bump",
"type": "u8"
}
]
}
},
{
"name": "LzReceiveTypesV2Result",
"docs": [
"Output of the lz_receive_types_v2 instruction.",
"",
"This structure enables the multi-instruction execution model where OApps can",
"define multiple instructions to be executed atomically by the Executor.",
"The Executor constructs a single transaction containing all returned instructions."
],
"type": {
"kind": "struct",
"fields": [
{
"name": "context_version",
"docs": [
"The version of context account"
],
"type": "u8"
},
{
"name": "alts",
"docs": [
"ALTs required for this execution context",
"Used by the Executor to resolve AltIndex references in AccountMetaRef",
"Enables efficient account list compression for complex transactions"
],
"type": {
"vec": "pubkey"
}
},
{
"name": "instructions",
"docs": [
"The complete list of instructions required for LzReceive execution",
"MUST include exactly one LzReceive instruction",
"MAY include additional Standard instructions for preprocessing/postprocessing",
"Instructions are executed in the order returned"
],
"type": {
"vec": {
"defined": {
"name": "Instruction"
}
}
}
}
]
}
},
{
"name": "MessagingFee",
"type": {
"kind": "struct",
"fields": [
{
"name": "native_fee",
"type": "u64"
},
{
"name": "lz_token_fee",
"type": "u64"
}
]
}
},
{
"name": "PeerConfig",
"type": {
"kind": "struct",
"fields": [
{
"name": "peer_address",
"type": {
"array": [
"u8",
32
]
}
},
{
"name": "enforced_options",
"type": {
"defined": {
"name": "EnforcedOptions"
}
}
},
{
"name": "bump",
"type": "u8"
}
]
}
},
{
"name": "PeerConfigParam",
"type": {
"kind": "enum",
"variants": [
{
"name": "PeerAddress",
"fields": [
{
"array": [
"u8",
32
]
}
]
},
{
"name": "EnforcedOptions",
"fields": [
{
"name": "send",
"type": "bytes"
},
{
"name": "send_and_call",
"type": "bytes"
}
]
}
]
}
},
{
"name": "QuoteSendParams",
"type": {
"kind": "struct",
"fields": [
{
"name": "dst_eid",
"type": "u32"
},
{
"name": "receiver",
"type": {
"array": [
"u8",
32
]
}
},
{
"name": "message",
"type": "string"
},
{
"name": "options",
"type": "bytes"
},
{
"name": "pay_in_lz_token",
"type": "bool"
}
]
}
},
{
"name": "SendMessageParams",
"type": {
"kind": "struct",
"fields": [
{
"name": "dst_eid",
"type": "u32"
},
{
"name": "message",
"type": "string"
},
{
"name": "options",
"type": "bytes"
},
{
"name": "native_fee",
"type": "u64"
},
{
"name": "lz_token_fee",
"type": "u64"
}
]
}
},
{
"name": "SetPeerConfigParams",
"type": {
"kind": "struct",
"fields": [
{
"name": "remote_eid",
"type": "u32"
},
{
"name": "config",
"type": {
"defined": {
"name": "PeerConfigParam"
}
}
}
]
}
},
{
"name": "Store",
"type": {
"kind": "struct",
"fields": [
{
"name": "admin",
"type": "pubkey"
},
{
"name": "bump",
"type": "u8"
},
{
"name": "endpoint_program",
"type": "pubkey"
},
{
"name": "string",
"type": "string"
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment