@@ -11,7 +11,6 @@ use mpl_token_metadata::instruction::MetadataInstruction;
1111use mpl_token_metadata:: instruction:: TransferArgs ;
1212use mpl_token_metadata:: state:: Metadata ;
1313use mpl_token_metadata:: state:: TokenStandard ;
14- use mpl_token_metadata:: utils:: assert_derivation;
1514use solana_program:: instruction:: Instruction ;
1615use solana_program:: program:: invoke_signed;
1716
@@ -43,26 +42,16 @@ pub fn handler<'key, 'accounts, 'remaining, 'info>(ctx: Context<'key, 'accounts,
4342 if token_manager. kind != TokenManagerKind :: Programmable as u8 {
4443 // look at next account
4544 if let Some ( next_account) = remaining_accs. peek ( ) {
46- match assert_derivation (
47- & mpl_token_metadata:: id ( ) ,
48- & next_account. to_account_info ( ) ,
49- & [ mpl_token_metadata:: state:: PREFIX . as_bytes ( ) , mpl_token_metadata:: id ( ) . as_ref ( ) , mint. as_ref ( ) ] ,
50- ) {
51- // migrated pnft
52- Ok ( _) => {
53- let mint_metadata_data = next_account. try_borrow_mut_data ( ) . expect ( "Failed to borrow data" ) ;
54- let metadata = Metadata :: deserialize ( & mut mint_metadata_data. as_ref ( ) ) . expect ( "Failed to deserialize metadata" ) ;
55- match metadata. token_standard {
56- Some ( TokenStandard :: ProgrammableNonFungible ) => {
57- // pop this account and update type
58- next_account_info ( remaining_accs) ?;
59- token_manager. kind = TokenManagerKind :: Programmable as u8 ;
60- }
61- _ => return Err ( error ! ( ErrorCode :: InvalidTokenManagerKind ) ) ,
45+ if next_account. owner == & mpl_token_metadata:: id ( ) {
46+ let mint_metadata_data = next_account. try_borrow_mut_data ( ) . expect ( "Failed to borrow data" ) ;
47+ if let Ok ( metadata) = Metadata :: deserialize ( & mut mint_metadata_data. as_ref ( ) ) {
48+ // migrated pnft
49+ if metadata. token_standard == Some ( TokenStandard :: ProgrammableNonFungible ) && metadata. mint == mint {
50+ // pop this account and update type
51+ next_account_info ( remaining_accs) ?;
52+ token_manager. kind = TokenManagerKind :: Programmable as u8 ;
6253 }
6354 }
64- // regular edition
65- _ => { }
6655 }
6756 }
6857 }
0 commit comments