|
@@ -23,7 +23,7 @@ pub fn transfer<'info>(
|
|
|
&[],
|
|
|
amount,
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[ctx.accounts.from, ctx.accounts.to, ctx.accounts.authority],
|
|
|
ctx.signer_seeds,
|
|
@@ -46,7 +46,7 @@ pub fn transfer_checked<'info>(
|
|
|
amount,
|
|
|
decimals,
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
ctx.accounts.from,
|
|
@@ -71,7 +71,7 @@ pub fn mint_to<'info>(
|
|
|
&[],
|
|
|
amount,
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[ctx.accounts.to, ctx.accounts.mint, ctx.accounts.authority],
|
|
|
ctx.signer_seeds,
|
|
@@ -88,7 +88,7 @@ pub fn burn<'info>(ctx: CpiContext<'_, '_, '_, 'info, Burn<'info>>, amount: u64)
|
|
|
&[],
|
|
|
amount,
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[ctx.accounts.from, ctx.accounts.mint, ctx.accounts.authority],
|
|
|
ctx.signer_seeds,
|
|
@@ -108,7 +108,7 @@ pub fn approve<'info>(
|
|
|
&[],
|
|
|
amount,
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
ctx.accounts.to,
|
|
@@ -127,7 +127,7 @@ pub fn revoke<'info>(ctx: CpiContext<'_, '_, '_, 'info, Revoke<'info>>) -> Resul
|
|
|
ctx.accounts.authority.key,
|
|
|
&[],
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[ctx.accounts.source, ctx.accounts.authority],
|
|
|
ctx.signer_seeds,
|
|
@@ -144,7 +144,7 @@ pub fn initialize_account<'info>(
|
|
|
ctx.accounts.mint.key,
|
|
|
ctx.accounts.authority.key,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(
|
|
|
+ anchor_lang::solana_program::program::invoke(
|
|
|
&ix,
|
|
|
&[
|
|
|
ctx.accounts.account,
|
|
@@ -165,7 +165,7 @@ pub fn initialize_account3<'info>(
|
|
|
ctx.accounts.mint.key,
|
|
|
ctx.accounts.authority.key,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.account, ctx.accounts.mint])
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.account, ctx.accounts.mint])
|
|
|
.map_err(Into::into)
|
|
|
}
|
|
|
|
|
@@ -177,7 +177,7 @@ pub fn close_account<'info>(ctx: CpiContext<'_, '_, '_, 'info, CloseAccount<'inf
|
|
|
ctx.accounts.authority.key,
|
|
|
&[], // TODO: support multisig
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
ctx.accounts.account,
|
|
@@ -199,7 +199,7 @@ pub fn freeze_account<'info>(
|
|
|
ctx.accounts.authority.key,
|
|
|
&[], // TODO: Support multisig signers.
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
ctx.accounts.account,
|
|
@@ -219,7 +219,7 @@ pub fn thaw_account<'info>(ctx: CpiContext<'_, '_, '_, 'info, ThawAccount<'info>
|
|
|
ctx.accounts.authority.key,
|
|
|
&[], // TODO: Support multisig signers.
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
ctx.accounts.account,
|
|
@@ -244,7 +244,7 @@ pub fn initialize_mint<'info>(
|
|
|
freeze_authority,
|
|
|
decimals,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.mint, ctx.accounts.rent])
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.mint, ctx.accounts.rent])
|
|
|
.map_err(Into::into)
|
|
|
}
|
|
|
|
|
@@ -261,7 +261,7 @@ pub fn initialize_mint2<'info>(
|
|
|
freeze_authority,
|
|
|
decimals,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.mint]).map_err(Into::into)
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.mint]).map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn set_authority<'info>(
|
|
@@ -282,7 +282,7 @@ pub fn set_authority<'info>(
|
|
|
ctx.accounts.current_authority.key,
|
|
|
&[], // TODO: Support multisig signers.
|
|
|
)?;
|
|
|
- solana_program::program::invoke_signed(
|
|
|
+ anchor_lang::solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[ctx.accounts.account_or_mint, ctx.accounts.current_authority],
|
|
|
ctx.signer_seeds,
|
|
@@ -292,7 +292,7 @@ pub fn set_authority<'info>(
|
|
|
|
|
|
pub fn sync_native<'info>(ctx: CpiContext<'_, '_, '_, 'info, SyncNative<'info>>) -> Result<()> {
|
|
|
let ix = spl_token_2022::instruction::sync_native(ctx.program.key, ctx.accounts.account.key)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.account]).map_err(Into::into)
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.account]).map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn get_account_data_size<'info>(
|
|
@@ -304,15 +304,15 @@ pub fn get_account_data_size<'info>(
|
|
|
ctx.accounts.mint.key,
|
|
|
extension_types,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.mint])?;
|
|
|
- solana_program::program::get_return_data()
|
|
|
- .ok_or(solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.mint])?;
|
|
|
+ anchor_lang::solana_program::program::get_return_data()
|
|
|
+ .ok_or(anchor_lang::solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
.and_then(|(key, data)| {
|
|
|
if key != *ctx.program.key {
|
|
|
- Err(solana_program::program_error::ProgramError::IncorrectProgramId)
|
|
|
+ Err(anchor_lang::solana_program::program_error::ProgramError::IncorrectProgramId)
|
|
|
} else {
|
|
|
data.try_into().map(u64::from_le_bytes).map_err(|_| {
|
|
|
- solana_program::program_error::ProgramError::InvalidInstructionData
|
|
|
+ anchor_lang::solana_program::program_error::ProgramError::InvalidInstructionData
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -328,7 +328,7 @@ pub fn initialize_mint_close_authority<'info>(
|
|
|
ctx.accounts.mint.key,
|
|
|
close_authority,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.mint]).map_err(Into::into)
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.mint]).map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn initialize_immutable_owner<'info>(
|
|
@@ -338,7 +338,7 @@ pub fn initialize_immutable_owner<'info>(
|
|
|
ctx.program.key,
|
|
|
ctx.accounts.account.key,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.account]).map_err(Into::into)
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.account]).map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn amount_to_ui_amount<'info>(
|
|
@@ -350,15 +350,15 @@ pub fn amount_to_ui_amount<'info>(
|
|
|
ctx.accounts.account.key,
|
|
|
amount,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.account])?;
|
|
|
- solana_program::program::get_return_data()
|
|
|
- .ok_or(solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.account])?;
|
|
|
+ anchor_lang::solana_program::program::get_return_data()
|
|
|
+ .ok_or(anchor_lang::solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
.and_then(|(key, data)| {
|
|
|
if key != *ctx.program.key {
|
|
|
- Err(solana_program::program_error::ProgramError::IncorrectProgramId)
|
|
|
+ Err(anchor_lang::solana_program::program_error::ProgramError::IncorrectProgramId)
|
|
|
} else {
|
|
|
String::from_utf8(data).map_err(|_| {
|
|
|
- solana_program::program_error::ProgramError::InvalidInstructionData
|
|
|
+ anchor_lang::solana_program::program_error::ProgramError::InvalidInstructionData
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -374,15 +374,15 @@ pub fn ui_amount_to_amount<'info>(
|
|
|
ctx.accounts.account.key,
|
|
|
ui_amount,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.account])?;
|
|
|
- solana_program::program::get_return_data()
|
|
|
- .ok_or(solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
+ anchor_lang::solana_program::program::invoke(&ix, &[ctx.accounts.account])?;
|
|
|
+ anchor_lang::solana_program::program::get_return_data()
|
|
|
+ .ok_or(anchor_lang::solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
.and_then(|(key, data)| {
|
|
|
if key != *ctx.program.key {
|
|
|
- Err(solana_program::program_error::ProgramError::IncorrectProgramId)
|
|
|
+ Err(anchor_lang::solana_program::program_error::ProgramError::IncorrectProgramId)
|
|
|
} else {
|
|
|
data.try_into().map(u64::from_le_bytes).map_err(|_| {
|
|
|
- solana_program::program_error::ProgramError::InvalidInstructionData
|
|
|
+ anchor_lang::solana_program::program_error::ProgramError::InvalidInstructionData
|
|
|
})
|
|
|
}
|
|
|
})
|