pub fn deploy_with_max_program_len(
    payer_address: &Pubkey,
    program_address: &Pubkey,
    buffer_address: &Pubkey,
    upgrade_authority_address: &Pubkey,
    program_lamports: u64,
    max_data_len: usize,
) -> Result<Vec<Instruction>, InstructionError> {
    let (programdata_address, _) = Pubkey::find_program_address(&[program_address.as_ref()], &id());
    Ok(vec![
        system_instruction::create_account(
            payer_address,
            program_address,
            program_lamports,
            UpgradeableLoaderState::program_len()? as u64,
            &id(),
        ),
        Instruction::new_with_bincode(
            id(),
            &UpgradeableLoaderInstruction::DeployWithMaxDataLen { max_data_len },
            vec![
                AccountMeta::new(*payer_address, true),
                AccountMeta::new(programdata_address, false),
                AccountMeta::new(*program_address, false),
                AccountMeta::new(*buffer_address, false),
                AccountMeta::new_readonly(sysvar::rent::id(), false),
                AccountMeta::new_readonly(sysvar::clock::id(), false),
                AccountMeta::new_readonly(crate::system_program::id(), false),
                AccountMeta::new_readonly(*upgrade_authority_address, true),
            ],
        ),
    ])
}
/// Returns the instructions required to deploy a program with a specified
/// maximum program length.  The maximum length must be large enough to
/// accommodate any future upgrades.
Returns the instructions required to deploy a program with a specified
maximum program length.  The maximum length must be large enough to
accommodate any future upgrades.
Returns the instructions required to deploy a program with a specified maximum program length . The maximum length must be large enough to accommodate any future upgrades .
pub fn deploy_with_max_program_len(
    payer_address: &Pubkey,
    program_address: &Pubkey,
    buffer_address: &Pubkey,
    upgrade_authority_address: &Pubkey,
    program_lamports: u64,
    max_data_len: usize,
) -> Result<Vec<Instruction>, InstructionError> {
    let (programdata_address, _) = Pubkey::find_program_address(&[program_address.as_ref()], &id());
    Ok(vec![
        system_instruction::create_account(
            payer_address,
            program_address,
            program_lamports,
            UpgradeableLoaderState::program_len()? as u64,
            &id(),
        ),
        Instruction::new_with_bincode(
            id(),
            &UpgradeableLoaderInstruction::DeployWithMaxDataLen { max_data_len },
            vec![
                AccountMeta::new(*payer_address, true),
                AccountMeta::new(programdata_address, false),
                AccountMeta::new(*program_address, false),
                AccountMeta::new(*buffer_address, false),
                AccountMeta::new_readonly(sysvar::rent::id(), false),
                AccountMeta::new_readonly(sysvar::clock::id(), false),
                AccountMeta::new_readonly(crate::system_program::id(), false),
                AccountMeta::new_readonly(*upgrade_authority_address, true),
            ],
        ),
    ])
}
pub fn deploy_with_max_program_len ( payer_address : & Pubkey , program_address : & Pubkey , buffer_address : & Pubkey , upgrade_authority_address : & Pubkey , program_lamports : u64 , max_data_len : usize , ) -> Result < Vec < Instruction > , InstructionError > { let ( programdata_address , _ ) = Pubkey :: find_program_address ( & [ program_address . as_ref ( ) ] , & id ( ) ) ; Ok ( vec ! [ system_instruction create_account ( payer_address program_address program_lamports UpgradeableLoaderState program_len ( ) as u64 id ( ) ) Instruction new_with_bincode ( id ( ) UpgradeableLoaderInstruction DeployWithMaxDataLen { max_data_len } vec [ AccountMeta new ( payer_address true ) AccountMeta new ( programdata_address false ) AccountMeta new ( program_address false ) AccountMeta new ( buffer_address false ) AccountMeta new_readonly ( sysvar rent id ( ) false ) AccountMeta new_readonly ( sysvar clock id ( ) false ) AccountMeta new_readonly ( crate system_program id ( ) false ) AccountMeta new_readonly ( upgrade_authority_address true ) ] ) ] ) }
Returns the instructions required to deploy a program with a specified
maximum program length.
Returns the instructions required to deploy a program with a specified maximum program length .
payer_address
&Pubkey
program_address
&Pubkey
buffer_address
&Pubkey
upgrade_authority_address
&Pubkey
program_lamports
u64
max_data_len
usize