spl: atoken error redesign
use anchor_lang::solana_program::account_info::AccountInfo;
-use anchor_lang::solana_program::entrypoint::ProgramResult;
use anchor_lang::solana_program::pubkey::Pubkey;
+use anchor_lang::Result;
use anchor_lang::{context::CpiContext, Accounts};
pub use spl_associated_token_account::{get_associated_token_address, ID};
-pub fn create<'info>(ctx: CpiContext<'_, '_, '_, 'info, Create<'info>>) -> ProgramResult {
+pub fn create<'info>(ctx: CpiContext<'_, '_, '_, 'info, Create<'info>>) -> Result<()> {
let ix = spl_associated_token_account::create_associated_token_account(
ctx.accounts.payer.key,
ctx.accounts.authority.key,
@@ -24,6 +24,7 @@ pub fn create<'info>(ctx: CpiContext<'_, '_, '_, 'info, Create<'info>>) -> Progr
],
ctx.signer_seeds,
)
+ .map_err(Into::into)
}
#[derive(Accounts)]
