use crate::prelude::*;
pub const IDL_IX_TAG: u64 = 0x0a69e9a778bcf440;
pub const IDL_IX_TAG_LE: &[u8] = IDL_IX_TAG.to_le_bytes().as_slice();
pub const ERASED_AUTHORITY: Pubkey = Pubkey::new_from_array([0u8; 32]);
#[derive(AnchorSerialize, AnchorDeserialize)]
pub enum IdlInstruction {
Create { data_len: u64 },
CreateBuffer,
Write { data: Vec<u8> },
SetBuffer,
SetAuthority { new_authority: Pubkey },
Close,
Resize { data_len: u64 },
}
#[account("internal")]
#[derive(Debug)]
pub struct IdlAccount {
pub authority: Pubkey,
pub data_len: u32,
}
impl IdlAccount {
pub fn address(program_id: &Pubkey) -> Pubkey {
let program_signer = Pubkey::find_program_address(&[], program_id).0;
Pubkey::create_with_seed(&program_signer, IdlAccount::seed(), program_id)
.expect("Seed is always valid")
}
pub fn seed() -> &'static str {
"anchor:idl"
}
}
#[cfg(feature = "idl-build")]
pub use anchor_lang_idl::{build::IdlBuild, *};
#[deprecated(
note = "Usage of legacy_idl is deprecated and will be completely removed in a future version.
This \
feature has been the source of security issues in the past and is no longer supported.
Please \
migrate to https://github.com/solana-foundation/program-metadata ."
)]
pub fn deprecated_legacy_idl_usage() {}