Skip to content

Commit

Permalink
replace serialize with metadata save fn
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelvanderwaal committed Jun 9, 2023
1 parent 52917c2 commit 17b1222
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use borsh::BorshSerialize;
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
Expand Down Expand Up @@ -35,6 +34,6 @@ pub fn process_puff_metadata_account(
let (_, edition_bump_seed) = Pubkey::find_program_address(edition_seeds, program_id);
metadata.edition_nonce = Some(edition_bump_seed);

metadata.serialize(&mut *metadata_account_info.try_borrow_mut_data()?)?;
metadata.save(&mut metadata_account_info.try_borrow_mut_data()?)?;
Ok(())
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use borsh::BorshSerialize;
use mpl_utils::assert_signer;
use solana_program::{
account_info::{next_account_info, AccountInfo},
Expand Down Expand Up @@ -41,7 +40,7 @@ pub fn process_remove_creator_verification(
} else {
return Err(MetadataError::NoCreatorsPresentOnMetadata.into());
}
metadata.serialize(&mut *metadata_info.try_borrow_mut_data()?)?;
metadata.save(&mut metadata_info.try_borrow_mut_data()?)?;

Ok(())
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use borsh::BorshSerialize;
use mpl_utils::assert_signer;
use solana_program::{
account_info::{next_account_info, AccountInfo},
Expand Down Expand Up @@ -38,7 +37,7 @@ pub fn process_sign_metadata(program_id: &Pubkey, accounts: &[AccountInfo]) -> P
} else {
return Err(MetadataError::NoCreatorsPresentOnMetadata.into());
}
metadata.serialize(&mut *metadata_info.try_borrow_mut_data()?)?;
metadata.save(&mut metadata_info.try_borrow_mut_data()?)?;

Ok(())
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use borsh::BorshSerialize;
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
Expand Down Expand Up @@ -46,7 +45,7 @@ pub fn process_update_primary_sale_happened_via_token(
}

metadata.primary_sale_happened = true;
metadata.serialize(&mut *metadata_account_info.try_borrow_mut_data()?)?;
metadata.save(&mut metadata_account_info.try_borrow_mut_data()?)?;

Ok(())
}
2 changes: 1 addition & 1 deletion token-metadata/program/src/processor/uses/utilize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub fn process_utilize(
} else if user_info.key != owner_info.key {
return Err(MetadataError::InvalidUser.into());
}
metadata.serialize(&mut *metadata_info.try_borrow_mut_data()?)?;
metadata.save(&mut metadata_info.try_borrow_mut_data()?)?;
if remaining_uses == 0 && must_burn {
if approved_authority_is_using {
let burn_authority_info = next_account_info(account_info_iter)?;
Expand Down
4 changes: 2 additions & 2 deletions token-metadata/program/src/utils/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use borsh::{maybestd::io::Error as BorshError, BorshDeserialize, BorshSerialize};
use borsh::{maybestd::io::Error as BorshError, BorshDeserialize};
use mpl_utils::{create_or_allocate_account_raw, token::get_mint_authority};
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_option::COption, pubkey::Pubkey,
Expand Down Expand Up @@ -264,7 +264,7 @@ pub fn clean_write_metadata(
let mut metadata_account_info_data = metadata_account_info.try_borrow_mut_data()?;
metadata_account_info_data[0..].fill(0);

metadata.serialize(&mut *metadata_account_info_data)?;
metadata.save(&mut metadata_account_info_data)?;

Ok(())
}
Expand Down

0 comments on commit 17b1222

Please sign in to comment.