|
@@ -26,11 +26,7 @@ pub fn transfer<'info>(
|
|
|
)?;
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
- &[
|
|
|
- ctx.accounts.from.clone(),
|
|
|
- ctx.accounts.to.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
- ],
|
|
|
+ &[ctx.accounts.from, ctx.accounts.to, ctx.accounts.authority],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
|
.map_err(Into::into)
|
|
@@ -54,10 +50,10 @@ pub fn transfer_checked<'info>(
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
- ctx.accounts.from.clone(),
|
|
|
- ctx.accounts.mint.clone(),
|
|
|
- ctx.accounts.to.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
+ ctx.accounts.from,
|
|
|
+ ctx.accounts.mint,
|
|
|
+ ctx.accounts.to,
|
|
|
+ ctx.accounts.authority,
|
|
|
],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
@@ -78,11 +74,7 @@ pub fn mint_to<'info>(
|
|
|
)?;
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
- &[
|
|
|
- ctx.accounts.to.clone(),
|
|
|
- ctx.accounts.mint.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
- ],
|
|
|
+ &[ctx.accounts.to, ctx.accounts.mint, ctx.accounts.authority],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
|
.map_err(Into::into)
|
|
@@ -99,11 +91,7 @@ pub fn burn<'info>(ctx: CpiContext<'_, '_, '_, 'info, Burn<'info>>, amount: u64)
|
|
|
)?;
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
- &[
|
|
|
- ctx.accounts.from.clone(),
|
|
|
- ctx.accounts.mint.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
- ],
|
|
|
+ &[ctx.accounts.from, ctx.accounts.mint, ctx.accounts.authority],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
|
.map_err(Into::into)
|
|
@@ -124,9 +112,9 @@ pub fn approve<'info>(
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
- ctx.accounts.to.clone(),
|
|
|
- ctx.accounts.delegate.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
+ ctx.accounts.to,
|
|
|
+ ctx.accounts.delegate,
|
|
|
+ ctx.accounts.authority,
|
|
|
],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
@@ -142,7 +130,7 @@ pub fn revoke<'info>(ctx: CpiContext<'_, '_, '_, 'info, Revoke<'info>>) -> Resul
|
|
|
)?;
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
- &[ctx.accounts.source.clone(), ctx.accounts.authority.clone()],
|
|
|
+ &[ctx.accounts.source, ctx.accounts.authority],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
|
.map_err(Into::into)
|
|
@@ -160,10 +148,10 @@ pub fn initialize_account<'info>(
|
|
|
solana_program::program::invoke(
|
|
|
&ix,
|
|
|
&[
|
|
|
- ctx.accounts.account.clone(),
|
|
|
- ctx.accounts.mint.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
- ctx.accounts.rent.clone(),
|
|
|
+ ctx.accounts.account,
|
|
|
+ ctx.accounts.mint,
|
|
|
+ ctx.accounts.authority,
|
|
|
+ ctx.accounts.rent,
|
|
|
],
|
|
|
)
|
|
|
.map_err(Into::into)
|
|
@@ -178,11 +166,8 @@ pub fn initialize_account3<'info>(
|
|
|
ctx.accounts.mint.key,
|
|
|
ctx.accounts.authority.key,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(
|
|
|
- &ix,
|
|
|
- &[ctx.accounts.account.clone(), ctx.accounts.mint.clone()],
|
|
|
- )
|
|
|
- .map_err(Into::into)
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.account, ctx.accounts.mint])
|
|
|
+ .map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn close_account<'info>(ctx: CpiContext<'_, '_, '_, 'info, CloseAccount<'info>>) -> Result<()> {
|
|
@@ -196,9 +181,9 @@ pub fn close_account<'info>(ctx: CpiContext<'_, '_, '_, 'info, CloseAccount<'inf
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
- ctx.accounts.account.clone(),
|
|
|
- ctx.accounts.destination.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
+ ctx.accounts.account,
|
|
|
+ ctx.accounts.destination,
|
|
|
+ ctx.accounts.authority,
|
|
|
],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
@@ -218,9 +203,9 @@ pub fn freeze_account<'info>(
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
- ctx.accounts.account.clone(),
|
|
|
- ctx.accounts.mint.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
+ ctx.accounts.account,
|
|
|
+ ctx.accounts.mint,
|
|
|
+ ctx.accounts.authority,
|
|
|
],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
@@ -238,9 +223,9 @@ pub fn thaw_account<'info>(ctx: CpiContext<'_, '_, '_, 'info, ThawAccount<'info>
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
&[
|
|
|
- ctx.accounts.account.clone(),
|
|
|
- ctx.accounts.mint.clone(),
|
|
|
- ctx.accounts.authority.clone(),
|
|
|
+ ctx.accounts.account,
|
|
|
+ ctx.accounts.mint,
|
|
|
+ ctx.accounts.authority,
|
|
|
],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
@@ -260,7 +245,7 @@ pub fn initialize_mint<'info>(
|
|
|
freeze_authority,
|
|
|
decimals,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.mint.clone(), ctx.accounts.rent.clone()])
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.mint, ctx.accounts.rent])
|
|
|
.map_err(Into::into)
|
|
|
}
|
|
|
|
|
@@ -277,7 +262,7 @@ pub fn initialize_mint2<'info>(
|
|
|
freeze_authority,
|
|
|
decimals,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.mint.clone()]).map_err(Into::into)
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.mint]).map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn set_authority<'info>(
|
|
@@ -300,10 +285,7 @@ pub fn set_authority<'info>(
|
|
|
)?;
|
|
|
solana_program::program::invoke_signed(
|
|
|
&ix,
|
|
|
- &[
|
|
|
- ctx.accounts.account_or_mint.clone(),
|
|
|
- ctx.accounts.current_authority.clone(),
|
|
|
- ],
|
|
|
+ &[ctx.accounts.account_or_mint, ctx.accounts.current_authority],
|
|
|
ctx.signer_seeds,
|
|
|
)
|
|
|
.map_err(Into::into)
|
|
@@ -311,7 +293,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.clone()]).map_err(Into::into)
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.account]).map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn get_account_data_size<'info>(
|
|
@@ -323,7 +305,7 @@ pub fn get_account_data_size<'info>(
|
|
|
ctx.accounts.mint.key,
|
|
|
extension_types,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.mint.clone()])?;
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.mint])?;
|
|
|
solana_program::program::get_return_data()
|
|
|
.ok_or(solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
.and_then(|(key, data)| {
|
|
@@ -347,7 +329,7 @@ pub fn initialize_mint_close_authority<'info>(
|
|
|
ctx.accounts.mint.key,
|
|
|
close_authority,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.mint.clone()]).map_err(Into::into)
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.mint]).map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn initialize_immutable_owner<'info>(
|
|
@@ -357,7 +339,7 @@ pub fn initialize_immutable_owner<'info>(
|
|
|
ctx.program.key,
|
|
|
ctx.accounts.account.key,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.account.clone()]).map_err(Into::into)
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.account]).map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
pub fn amount_to_ui_amount<'info>(
|
|
@@ -369,7 +351,7 @@ pub fn amount_to_ui_amount<'info>(
|
|
|
ctx.accounts.account.key,
|
|
|
amount,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.account.clone()])?;
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.account])?;
|
|
|
solana_program::program::get_return_data()
|
|
|
.ok_or(solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
.and_then(|(key, data)| {
|
|
@@ -393,7 +375,7 @@ pub fn ui_amount_to_amount<'info>(
|
|
|
ctx.accounts.account.key,
|
|
|
ui_amount,
|
|
|
)?;
|
|
|
- solana_program::program::invoke(&ix, &[ctx.accounts.account.clone()])?;
|
|
|
+ solana_program::program::invoke(&ix, &[ctx.accounts.account])?;
|
|
|
solana_program::program::get_return_data()
|
|
|
.ok_or(solana_program::program_error::ProgramError::InvalidInstructionData)
|
|
|
.and_then(|(key, data)| {
|