Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion program-tests/create-address-test-program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ anchor-lang = { workspace = true }
light-system-program-anchor = { workspace = true, features = ["cpi"] }
account-compression = { workspace = true, features = ["cpi"] }
light-compressed-account = { workspace = true, features = ["anchor"] }
light-sdk = { workspace = true, features = ["anchor", "v2", "small_ix"] }
light-sdk = { workspace = true, features = ["anchor", "v2", "v2_ix"] }
light-sdk-types = { workspace = true }
18 changes: 9 additions & 9 deletions program-tests/create-address-test-program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use light_compressed_account::instruction_data::{
use light_sdk::{
constants::LIGHT_SYSTEM_PROGRAM_ID,
cpi::{
get_account_metas_from_config, invoke_light_system_program, to_account_metas_small,
get_account_metas_from_config, invoke_light_system_program, to_account_metas_v2,
CpiAccountsConfig, CpiInstructionConfig,
},
};
Expand Down Expand Up @@ -58,23 +58,23 @@ pub mod system_cpi_test {
pub fn invoke_with_read_only<'info>(
ctx: Context<'_, '_, '_, 'info, InvokeCpiReadOnly<'info>>,
config: CpiAccountsConfig,
small_ix: bool,
v2_ix: bool,
inputs: Vec<u8>,
) -> Result<()> {
let fee_payer = ctx.accounts.signer.to_account_info();

let (account_infos, account_metas) = if small_ix {
use light_sdk::cpi::CpiAccountsSmall;
let (account_infos, account_metas) = if v2_ix {
use light_sdk::cpi::CpiAccountsV2;
let cpi_accounts =
CpiAccountsSmall::new_with_config(&fee_payer, ctx.remaining_accounts, config);
CpiAccountsV2::new_with_config(&fee_payer, ctx.remaining_accounts, config);
let account_infos = cpi_accounts
.to_account_infos()
.into_iter()
.cloned()
.collect::<Vec<_>>();

let account_metas = to_account_metas_small(cpi_accounts)
.map_err(|_| ErrorCode::AccountNotEnoughKeys)?;
let account_metas =
to_account_metas_v2(cpi_accounts).map_err(|_| ErrorCode::AccountNotEnoughKeys)?;
(account_infos, account_metas)
} else {
use light_sdk::cpi::CpiAccounts;
Expand Down Expand Up @@ -218,11 +218,11 @@ pub fn create_invoke_read_only_account_info_instruction(
signer: Pubkey,
inputs: Vec<u8>,
config: CpiAccountsConfig,
small: bool,
v2_ix: bool,
remaining_accounts: Vec<AccountMeta>,
) -> Instruction {
let ix_data = crate::instruction::InvokeWithReadOnly {
small_ix: small,
v2_ix,
inputs,
config,
}
Expand Down
Loading
Loading