diff --git a/token-metadata/example/src/processor.rs b/token-metadata/example/src/processor.rs index 5e282a0086a..bafb5228059 100644 --- a/token-metadata/example/src/processor.rs +++ b/token-metadata/example/src/processor.rs @@ -13,6 +13,7 @@ use { }, spl_pod::optional_keys::OptionalNonZeroPubkey, spl_token_2022::{ + error::TokenError, extension::{update_authority::check_update_authority, StateWithExtensions}, state::Mint, }, @@ -53,7 +54,7 @@ pub fn process_initialize( return Err(ProgramError::MissingRequiredSignature); } if mint.base.mint_authority.as_ref() != COption::Some(mint_authority_info.key) { - return Err(TokenMetadataError::IncorrectMintAuthority.into()); + return Err(TokenError::OwnerMismatch.into()); } } diff --git a/token-metadata/example/tests/initialize.rs b/token-metadata/example/tests/initialize.rs index ccd50373e84..a102f0a455f 100644 --- a/token-metadata/example/tests/initialize.rs +++ b/token-metadata/example/tests/initialize.rs @@ -12,9 +12,8 @@ use { system_instruction, transaction::{Transaction, TransactionError}, }, - spl_token_metadata_interface::{ - error::TokenMetadataError, instruction::initialize, state::TokenMetadata, - }, + spl_token_2022::error::TokenError, + spl_token_metadata_interface::{instruction::initialize, state::TokenMetadata}, spl_type_length_value::{ error::TlvError, state::{TlvState, TlvStateBorrowed}, @@ -265,7 +264,7 @@ async fn fail_incorrect_authority() { error, TransactionError::InstructionError( 1, - InstructionError::Custom(TokenMetadataError::IncorrectMintAuthority as u32) + InstructionError::Custom(TokenError::OwnerMismatch as u32) ) ); } diff --git a/token-metadata/interface/src/error.rs b/token-metadata/interface/src/error.rs index 3f5b2437865..aa3a19e95bd 100644 --- a/token-metadata/interface/src/error.rs +++ b/token-metadata/interface/src/error.rs @@ -11,9 +11,6 @@ pub enum TokenMetadataError { /// Mint has no mint authority #[error("Mint has no mint authority")] MintHasNoMintAuthority, - /// Incorrect mint authority has signed the instruction - #[error("Incorrect mint authority has signed the instruction")] - IncorrectMintAuthority, /// Incorrect metadata update authority has signed the instruction #[error("Incorrect metadata update authority has signed the instruction")] IncorrectUpdateAuthority, diff --git a/token/program-2022-test/tests/token_metadata_initialize.rs b/token/program-2022-test/tests/token_metadata_initialize.rs index e6576d68f68..69b0f24c7e7 100644 --- a/token/program-2022-test/tests/token_metadata_initialize.rs +++ b/token/program-2022-test/tests/token_metadata_initialize.rs @@ -11,7 +11,7 @@ use { }, spl_token_2022::{error::TokenError, extension::BaseStateWithExtensions, processor::Processor}, spl_token_client::token::{ExtensionInitializationParams, TokenError as TokenClientError}, - spl_token_metadata_interface::{error::TokenMetadataError, state::TokenMetadata}, + spl_token_metadata_interface::state::TokenMetadata, std::{convert::TryInto, sync::Arc}, }; @@ -110,7 +110,7 @@ async fn success_initialize() { TokenClientError::Client(Box::new(TransportError::TransactionError( TransactionError::InstructionError( 1, - InstructionError::Custom(TokenMetadataError::IncorrectMintAuthority as u32) + InstructionError::Custom(TokenError::OwnerMismatch as u32) ) ))) ); diff --git a/token/program-2022/src/extension/token_metadata/processor.rs b/token/program-2022/src/extension/token_metadata/processor.rs index 61af3ebeb75..6fe71644e08 100644 --- a/token/program-2022/src/extension/token_metadata/processor.rs +++ b/token/program-2022/src/extension/token_metadata/processor.rs @@ -61,7 +61,7 @@ pub fn process_initialize( return Err(ProgramError::MissingRequiredSignature); } if mint.base.mint_authority.as_ref() != COption::Some(mint_authority_info.key) { - return Err(TokenMetadataError::IncorrectMintAuthority.into()); + return Err(TokenError::OwnerMismatch.into()); } if mint.get_extension::().is_err() {