Module anchor_lang::idl
source · [−]Expand description
idl.rs defines the instructions and account state used to store a program’s IDL on-chain at a canonical account address, which can be derived as a function of nothing other than the program’s ID.
It can be upgraded in a way similar to a BPF upgradeable program. That is,
one may invoke the IdlInstruction::CreateBuffer
instruction to create
a buffer, IdlInstruction::Write
to write a new IDL into it, and then
IdlInstruction::SetBuffer
to copy the IDL into the program’s canonical
IDL account. In order to perform this upgrade, the buffer’s authority
must match the canonical IDL account’s authority.
Because the IDL can be larger than the max transaction size, the transaction
must be broken up into several pieces and stored into the IDL account with
multiple transactions via the Write
instruction to continuously append to
the account’s IDL data buffer.
Note that IDL account instructions are automatically inserted into all
Anchor programs. To remove them, one can use the no-idl
feature.