use num_derive::FromPrimitive;
use solana_program_error::{ProgramError, ToStr};
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum MplTokenMetadataError {
#[error("")]
InstructionUnpackError,
#[error("")]
InstructionPackError,
#[error("Lamport balance below rent-exempt threshold")]
NotRentExempt,
#[error("Already initialized")]
AlreadyInitialized,
#[error("Uninitialized")]
Uninitialized,
#[error(" Metadata's key must match seed of ['metadata', program id, mint] provided")]
InvalidMetadataKey,
#[error("Edition's key must match seed of ['metadata', program id, name, 'edition'] provided")]
InvalidEditionKey,
#[error("Update Authority given does not match")]
UpdateAuthorityIncorrect,
#[error("Update Authority needs to be signer to update metadata")]
UpdateAuthorityIsNotSigner,
#[error("You must be the mint authority and signer on this transaction")]
NotMintAuthority,
#[error("Mint authority provided does not match the authority on the mint")]
InvalidMintAuthority,
#[error("Name too long")]
NameTooLong,
#[error("Symbol too long")]
SymbolTooLong,
#[error("URI too long")]
UriTooLong,
#[error("")]
UpdateAuthorityMustBeEqualToMetadataAuthorityAndSigner,
#[error("Mint given does not match mint on Metadata")]
MintMismatch,
#[error("Editions must have exactly one token")]
EditionsMustHaveExactlyOneToken,
#[error("")]
MaxEditionsMintedAlready,
#[error("")]
TokenMintToFailed,
#[error("")]
MasterRecordMismatch,
#[error("")]
DestinationMintMismatch,
#[error("")]
EditionAlreadyMinted,
#[error("")]
PrintingMintDecimalsShouldBeZero,
#[error("")]
OneTimePrintingAuthorizationMintDecimalsShouldBeZero,
#[error("EditionMintDecimalsShouldBeZero")]
EditionMintDecimalsShouldBeZero,
#[error("")]
TokenBurnFailed,
#[error("")]
TokenAccountOneTimeAuthMintMismatch,
#[error("Derived key invalid")]
DerivedKeyInvalid,
#[error("The Printing mint does not match that on the master edition!")]
PrintingMintMismatch,
#[error("The One Time Printing Auth mint does not match that on the master edition!")]
OneTimePrintingAuthMintMismatch,
#[error("The mint of the token account does not match the Printing mint!")]
TokenAccountMintMismatch,
#[error("The mint of the token account does not match the master metadata mint!")]
TokenAccountMintMismatchV2,
#[error("Not enough tokens to mint a limited edition")]
NotEnoughTokens,
#[error("")]
PrintingMintAuthorizationAccountMismatch,
#[error("")]
AuthorizationTokenAccountOwnerMismatch,
#[error("")]
Disabled,
#[error("Creators list too long")]
CreatorsTooLong,
#[error("Creators must be at least one if set")]
CreatorsMustBeAtleastOne,
#[error("")]
MustBeOneOfCreators,
#[error("This metadata does not have creators")]
NoCreatorsPresentOnMetadata,
#[error("This creator address was not found")]
CreatorNotFound,
#[error("Basis points cannot be more than 10000")]
InvalidBasisPoints,
#[error("Primary sale can only be flipped to true and is immutable")]
PrimarySaleCanOnlyBeFlippedToTrue,
#[error("Owner does not match that on the account given")]
OwnerMismatch,
#[error("This account has no tokens to be used for authorization")]
NoBalanceInAccountForAuthorization,
#[error("Share total must equal 100 for creator array")]
ShareTotalMustBe100,
#[error("")]
ReservationExists,
#[error("")]
ReservationDoesNotExist,
#[error("")]
ReservationNotSet,
#[error("")]
ReservationAlreadyMade,
#[error("")]
BeyondMaxAddressSize,
#[error("NumericalOverflowError")]
NumericalOverflowError,
#[error("")]
ReservationBreachesMaximumSupply,
#[error("")]
AddressNotInReservation,
#[error("You cannot unilaterally verify another creator, they must sign")]
CannotVerifyAnotherCreator,
#[error("You cannot unilaterally unverify another creator")]
CannotUnverifyAnotherCreator,
#[error("")]
SpotMismatch,
#[error("Incorrect account owner")]
IncorrectOwner,
#[error("")]
PrintingWouldBreachMaximumSupply,
#[error("Data is immutable")]
DataIsImmutable,
#[error("No duplicate creator addresses")]
DuplicateCreatorAddress,
#[error("")]
ReservationSpotsRemainingShouldMatchTotalSpotsAtStart,
#[error("Invalid token program")]
InvalidTokenProgram,
#[error("Data type mismatch")]
DataTypeMismatch,
#[error("")]
BeyondAlottedAddressSize,
#[error("")]
ReservationNotComplete,
#[error("")]
TriedToReplaceAnExistingReservation,
#[error("Invalid operation")]
InvalidOperation,
#[error("Invalid Owner")]
InvalidOwner,
#[error("Printing mint supply must be zero for conversion")]
PrintingMintSupplyMustBeZeroForConversion,
#[error("One Time Auth mint supply must be zero for conversion")]
OneTimeAuthMintSupplyMustBeZeroForConversion,
#[error("You tried to insert one edition too many into an edition mark pda")]
InvalidEditionIndex,
#[error("")]
ReservationArrayShouldBeSizeOne,
#[error("Is Mutable can only be flipped to false")]
IsMutableCanOnlyBeFlippedToFalse,
#[error("Collection cannot be verified in this instruction")]
CollectionCannotBeVerifiedInThisInstruction,
#[error("This instruction was deprecated in a previous release and is now removed")]
Removed,
#[error("")]
MustBeBurned,
#[error("This use method is invalid")]
InvalidUseMethod,
#[error("Cannot Change Use Method after the first use")]
CannotChangeUseMethodAfterFirstUse,
#[error("Cannot Change Remaining or Available uses after the first use")]
CannotChangeUsesAfterFirstUse,
#[error("Collection Not Found on Metadata")]
CollectionNotFound,
#[error("Collection Update Authority is invalid")]
InvalidCollectionUpdateAuthority,
#[error("Collection Must Be a Unique Master Edition v2")]
CollectionMustBeAUniqueMasterEdition,
#[error("The Use Authority Record Already Exists, to modify it Revoke, then Approve")]
UseAuthorityRecordAlreadyExists,
#[error("The Use Authority Record is empty or already revoked")]
UseAuthorityRecordAlreadyRevoked,
#[error("This token has no uses")]
Unusable,
#[error("There are not enough Uses left on this token.")]
NotEnoughUses,
#[error("This Collection Authority Record Already Exists.")]
CollectionAuthorityRecordAlreadyExists,
#[error("This Collection Authority Record Does Not Exist.")]
CollectionAuthorityDoesNotExist,
#[error("This Use Authority Record is invalid.")]
InvalidUseAuthorityRecord,
#[error("")]
InvalidCollectionAuthorityRecord,
#[error("Metadata does not match the freeze authority on the mint")]
InvalidFreezeAuthority,
#[error("All tokens in this account have not been delegated to this user.")]
InvalidDelegate,
#[error("")]
CannotAdjustVerifiedCreator,
#[error("Verified creators cannot be removed.")]
CannotRemoveVerifiedCreator,
#[error("")]
CannotWipeVerifiedCreators,
#[error("")]
NotAllowedToChangeSellerFeeBasisPoints,
#[error("Edition override cannot be zero")]
EditionOverrideCannotBeZero,
#[error("Invalid User")]
InvalidUser,
#[error("Revoke Collection Authority signer is incorrect")]
RevokeCollectionAuthoritySignerIncorrect,
#[error("")]
TokenCloseFailed,
#[error("Can't use this function on unsized collection")]
UnsizedCollection,
#[error("Can't use this function on a sized collection")]
SizedCollection,
#[error("Missing collection metadata account")]
MissingCollectionMetadata,
#[error("This NFT is not a member of the specified collection.")]
NotAMemberOfCollection,
#[error("This NFT is not a verified member of the specified collection.")]
NotVerifiedMemberOfCollection,
#[error("This NFT is not a collection parent NFT.")]
NotACollectionParent,
#[error("Could not determine a TokenStandard type.")]
CouldNotDetermineTokenStandard,
#[error("This mint account has an edition but none was provided.")]
MissingEditionAccount,
#[error("This edition is not a Master Edition")]
NotAMasterEdition,
#[error("This Master Edition has existing prints")]
MasterEditionHasPrints,
#[error("")]
BorshDeserializationError,
#[error("Cannot update a verified collection in this command")]
CannotUpdateVerifiedCollection,
#[error("Edition account doesnt match collection ")]
CollectionMasterEditionAccountInvalid,
#[error("Item is already verified.")]
AlreadyVerified,
#[error("")]
AlreadyUnverified,
#[error("This edition is not a Print Edition")]
NotAPrintEdition,
#[error("Invalid Master Edition")]
InvalidMasterEdition,
#[error("Invalid Print Edition")]
InvalidPrintEdition,
#[error("Invalid Edition Marker")]
InvalidEditionMarker,
#[error("Reservation List is Deprecated")]
ReservationListDeprecated,
#[error("Print Edition does not match Master Edition")]
PrintEditionDoesNotMatchMasterEdition,
#[error("Edition Number greater than max supply")]
EditionNumberGreaterThanMaxSupply,
#[error("Must unverify before migrating collections.")]
MustUnverify,
#[error("Invalid Escrow Account Bump Seed")]
InvalidEscrowBumpSeed,
#[error("Must Escrow Authority")]
MustBeEscrowAuthority,
#[error("Invalid System Program")]
InvalidSystemProgram,
#[error("Must be a Non Fungible Token")]
MustBeNonFungible,
#[error("Insufficient tokens for transfer")]
InsufficientTokens,
#[error("Borsh Serialization Error")]
BorshSerializationError,
#[error("Cannot create NFT with no Freeze Authority.")]
NoFreezeAuthoritySet,
#[error("Invalid collection size change")]
InvalidCollectionSizeChange,
#[error("Invalid bubblegum signer")]
InvalidBubblegumSigner,
#[error("Escrow parent cannot have a delegate")]
EscrowParentHasDelegate,
#[error("Mint needs to be signer to initialize the account")]
MintIsNotSigner,
#[error("Invalid token standard")]
InvalidTokenStandard,
#[error("Invalid mint account for specified token standard")]
InvalidMintForTokenStandard,
#[error("Invalid authorization rules account")]
InvalidAuthorizationRules,
#[error("Missing authorization rules account")]
MissingAuthorizationRules,
#[error("Missing programmable configuration")]
MissingProgrammableConfig,
#[error("Invalid programmable configuration")]
InvalidProgrammableConfig,
#[error("Delegate already exists")]
DelegateAlreadyExists,
#[error("Delegate not found")]
DelegateNotFound,
#[error("Required account not set in instruction builder")]
MissingAccountInBuilder,
#[error("Required argument not set in instruction builder")]
MissingArgumentInBuilder,
#[error("Feature not supported currently")]
FeatureNotSupported,
#[error("Invalid system wallet")]
InvalidSystemWallet,
#[error("Only the sale delegate can transfer while its set")]
OnlySaleDelegateCanTransfer,
#[error("Missing token account")]
MissingTokenAccount,
#[error("Missing SPL token program")]
MissingSplTokenProgram,
#[error("Missing authorization rules program")]
MissingAuthorizationRulesProgram,
#[error("Invalid delegate role for transfer")]
InvalidDelegateRoleForTransfer,
#[error("Invalid transfer authority")]
InvalidTransferAuthority,
#[error("Instruction not supported for ProgrammableNonFungible assets")]
InstructionNotSupported,
#[error("Public key does not match expected value")]
KeyMismatch,
#[error("Token is locked")]
LockedToken,
#[error("Token is unlocked")]
UnlockedToken,
#[error("Missing delegate role")]
MissingDelegateRole,
#[error("Invalid authority type")]
InvalidAuthorityType,
#[error("Missing token record account")]
MissingTokenRecord,
#[error("Mint supply must be zero for programmable assets")]
MintSupplyMustBeZero,
#[error("Data is empty or zeroed")]
DataIsEmptyOrZeroed,
#[error("Missing token owner")]
MissingTokenOwnerAccount,
#[error("Master edition account has an invalid length")]
InvalidMasterEditionAccountLength,
#[error("Incorrect token state")]
IncorrectTokenState,
#[error("Invalid delegate role")]
InvalidDelegateRole,
#[error("Print supply is required for non-fungibles")]
MissingPrintSupply,
#[error("Missing master edition account")]
MissingMasterEditionAccount,
#[error("Amount must be greater than zero")]
AmountMustBeGreaterThanZero,
#[error("Invalid delegate args")]
InvalidDelegateArgs,
#[error("Missing address for locked transfer")]
MissingLockedTransferAddress,
#[error("Invalid destination address for locked transfer")]
InvalidLockedTransferAddress,
#[error("Exceeded account realloc increase limit")]
DataIncrementLimitExceeded,
#[error("Cannot update the rule set of a programmable asset that has a delegate")]
CannotUpdateAssetWithDelegate,
#[error("Invalid token amount for this operation or token standard")]
InvalidAmount,
#[error("Missing master edition mint account")]
MissingMasterEditionMintAccount,
#[error("Missing master edition token account")]
MissingMasterEditionTokenAccount,
#[error("Missing edition marker account")]
MissingEditionMarkerAccount,
#[error("Cannot burn while persistent delegate is set")]
CannotBurnWithDelegate,
#[error("Missing edition account")]
MissingEdition,
#[error("Invalid Associated Token Account Program")]
InvalidAssociatedTokenAccountProgram,
#[error("Invalid InstructionsSysvar")]
InvalidInstructionsSysvar,
#[error("Invalid or Unneeded parent accounts")]
InvalidParentAccounts,
#[error("Authority cannot apply all update args")]
InvalidUpdateArgs,
#[error("Token account does not have enough tokens")]
InsufficientTokenBalance,
#[error("Missing collection account")]
MissingCollectionMint,
#[error("Missing collection master edition account")]
MissingCollectionMasterEdition,
#[error("Invalid token record account")]
InvalidTokenRecord,
#[error("The close authority needs to be revoked by the Utility Delegate")]
InvalidCloseAuthority,
#[error("Invalid or removed instruction")]
InvalidInstruction,
#[error("Missing delegate record")]
MissingDelegateRecord,
#[error("")]
InvalidFeeAccount,
#[error("")]
InvalidMetadataFlags,
#[error("Cannot change the update authority with a delegate")]
CannotChangeUpdateAuthorityWithDelegate,
#[error("Invalid mint extension type")]
InvalidMintExtensionType,
#[error("Invalid mint close authority")]
InvalidMintCloseAuthority,
#[error("Invalid metadata pointer")]
InvalidMetadataPointer,
#[error("Invalid token extension type")]
InvalidTokenExtensionType,
#[error("Missing immutable owner extension")]
MissingImmutableOwnerExtension,
#[error("Expected account to be uninitialized")]
ExpectedUninitializedAccount,
#[error("Edition account has an invalid length")]
InvalidEditionAccountLength,
#[error("Account has already been resized")]
AccountAlreadyResized,
#[error("Conditions for closing not met")]
ConditionsForClosingNotMet,
}
impl From<MplTokenMetadataError> for ProgramError {
fn from(e: MplTokenMetadataError) -> Self {
ProgramError::Custom(e as u32)
}
}
impl TryFrom<u32> for MplTokenMetadataError {
type Error = ProgramError;
fn try_from(error: u32) -> Result<Self, Self::Error> {
match error {
0 => Ok(MplTokenMetadataError::InstructionUnpackError),
1 => Ok(MplTokenMetadataError::InstructionPackError),
2 => Ok(MplTokenMetadataError::NotRentExempt),
3 => Ok(MplTokenMetadataError::AlreadyInitialized),
4 => Ok(MplTokenMetadataError::Uninitialized),
5 => Ok(MplTokenMetadataError::InvalidMetadataKey),
6 => Ok(MplTokenMetadataError::InvalidEditionKey),
7 => Ok(MplTokenMetadataError::UpdateAuthorityIncorrect),
8 => Ok(MplTokenMetadataError::UpdateAuthorityIsNotSigner),
9 => Ok(MplTokenMetadataError::NotMintAuthority),
10 => Ok(MplTokenMetadataError::InvalidMintAuthority),
11 => Ok(MplTokenMetadataError::NameTooLong),
12 => Ok(MplTokenMetadataError::SymbolTooLong),
13 => Ok(MplTokenMetadataError::UriTooLong),
14 => Ok(MplTokenMetadataError::UpdateAuthorityMustBeEqualToMetadataAuthorityAndSigner),
15 => Ok(MplTokenMetadataError::MintMismatch),
16 => Ok(MplTokenMetadataError::EditionsMustHaveExactlyOneToken),
17 => Ok(MplTokenMetadataError::MaxEditionsMintedAlready),
18 => Ok(MplTokenMetadataError::TokenMintToFailed),
19 => Ok(MplTokenMetadataError::MasterRecordMismatch),
20 => Ok(MplTokenMetadataError::DestinationMintMismatch),
21 => Ok(MplTokenMetadataError::EditionAlreadyMinted),
22 => Ok(MplTokenMetadataError::PrintingMintDecimalsShouldBeZero),
23 => Ok(MplTokenMetadataError::OneTimePrintingAuthorizationMintDecimalsShouldBeZero),
24 => Ok(MplTokenMetadataError::EditionMintDecimalsShouldBeZero),
25 => Ok(MplTokenMetadataError::TokenBurnFailed),
26 => Ok(MplTokenMetadataError::TokenAccountOneTimeAuthMintMismatch),
27 => Ok(MplTokenMetadataError::DerivedKeyInvalid),
28 => Ok(MplTokenMetadataError::PrintingMintMismatch),
29 => Ok(MplTokenMetadataError::OneTimePrintingAuthMintMismatch),
30 => Ok(MplTokenMetadataError::TokenAccountMintMismatch),
31 => Ok(MplTokenMetadataError::TokenAccountMintMismatchV2),
32 => Ok(MplTokenMetadataError::NotEnoughTokens),
33 => Ok(MplTokenMetadataError::PrintingMintAuthorizationAccountMismatch),
34 => Ok(MplTokenMetadataError::AuthorizationTokenAccountOwnerMismatch),
35 => Ok(MplTokenMetadataError::Disabled),
36 => Ok(MplTokenMetadataError::CreatorsTooLong),
37 => Ok(MplTokenMetadataError::CreatorsMustBeAtleastOne),
38 => Ok(MplTokenMetadataError::MustBeOneOfCreators),
39 => Ok(MplTokenMetadataError::NoCreatorsPresentOnMetadata),
40 => Ok(MplTokenMetadataError::CreatorNotFound),
41 => Ok(MplTokenMetadataError::InvalidBasisPoints),
42 => Ok(MplTokenMetadataError::PrimarySaleCanOnlyBeFlippedToTrue),
43 => Ok(MplTokenMetadataError::OwnerMismatch),
44 => Ok(MplTokenMetadataError::NoBalanceInAccountForAuthorization),
45 => Ok(MplTokenMetadataError::ShareTotalMustBe100),
46 => Ok(MplTokenMetadataError::ReservationExists),
47 => Ok(MplTokenMetadataError::ReservationDoesNotExist),
48 => Ok(MplTokenMetadataError::ReservationNotSet),
49 => Ok(MplTokenMetadataError::ReservationAlreadyMade),
50 => Ok(MplTokenMetadataError::BeyondMaxAddressSize),
51 => Ok(MplTokenMetadataError::NumericalOverflowError),
52 => Ok(MplTokenMetadataError::ReservationBreachesMaximumSupply),
53 => Ok(MplTokenMetadataError::AddressNotInReservation),
54 => Ok(MplTokenMetadataError::CannotVerifyAnotherCreator),
55 => Ok(MplTokenMetadataError::CannotUnverifyAnotherCreator),
56 => Ok(MplTokenMetadataError::SpotMismatch),
57 => Ok(MplTokenMetadataError::IncorrectOwner),
58 => Ok(MplTokenMetadataError::PrintingWouldBreachMaximumSupply),
59 => Ok(MplTokenMetadataError::DataIsImmutable),
60 => Ok(MplTokenMetadataError::DuplicateCreatorAddress),
61 => Ok(MplTokenMetadataError::ReservationSpotsRemainingShouldMatchTotalSpotsAtStart),
62 => Ok(MplTokenMetadataError::InvalidTokenProgram),
63 => Ok(MplTokenMetadataError::DataTypeMismatch),
64 => Ok(MplTokenMetadataError::BeyondAlottedAddressSize),
65 => Ok(MplTokenMetadataError::ReservationNotComplete),
66 => Ok(MplTokenMetadataError::TriedToReplaceAnExistingReservation),
67 => Ok(MplTokenMetadataError::InvalidOperation),
68 => Ok(MplTokenMetadataError::InvalidOwner),
69 => Ok(MplTokenMetadataError::PrintingMintSupplyMustBeZeroForConversion),
70 => Ok(MplTokenMetadataError::OneTimeAuthMintSupplyMustBeZeroForConversion),
71 => Ok(MplTokenMetadataError::InvalidEditionIndex),
72 => Ok(MplTokenMetadataError::ReservationArrayShouldBeSizeOne),
73 => Ok(MplTokenMetadataError::IsMutableCanOnlyBeFlippedToFalse),
74 => Ok(MplTokenMetadataError::CollectionCannotBeVerifiedInThisInstruction),
75 => Ok(MplTokenMetadataError::Removed),
76 => Ok(MplTokenMetadataError::MustBeBurned),
77 => Ok(MplTokenMetadataError::InvalidUseMethod),
78 => Ok(MplTokenMetadataError::CannotChangeUseMethodAfterFirstUse),
79 => Ok(MplTokenMetadataError::CannotChangeUsesAfterFirstUse),
80 => Ok(MplTokenMetadataError::CollectionNotFound),
81 => Ok(MplTokenMetadataError::InvalidCollectionUpdateAuthority),
82 => Ok(MplTokenMetadataError::CollectionMustBeAUniqueMasterEdition),
83 => Ok(MplTokenMetadataError::UseAuthorityRecordAlreadyExists),
84 => Ok(MplTokenMetadataError::UseAuthorityRecordAlreadyRevoked),
85 => Ok(MplTokenMetadataError::Unusable),
86 => Ok(MplTokenMetadataError::NotEnoughUses),
87 => Ok(MplTokenMetadataError::CollectionAuthorityRecordAlreadyExists),
88 => Ok(MplTokenMetadataError::CollectionAuthorityDoesNotExist),
89 => Ok(MplTokenMetadataError::InvalidUseAuthorityRecord),
90 => Ok(MplTokenMetadataError::InvalidCollectionAuthorityRecord),
91 => Ok(MplTokenMetadataError::InvalidFreezeAuthority),
92 => Ok(MplTokenMetadataError::InvalidDelegate),
93 => Ok(MplTokenMetadataError::CannotAdjustVerifiedCreator),
94 => Ok(MplTokenMetadataError::CannotRemoveVerifiedCreator),
95 => Ok(MplTokenMetadataError::CannotWipeVerifiedCreators),
96 => Ok(MplTokenMetadataError::NotAllowedToChangeSellerFeeBasisPoints),
97 => Ok(MplTokenMetadataError::EditionOverrideCannotBeZero),
98 => Ok(MplTokenMetadataError::InvalidUser),
99 => Ok(MplTokenMetadataError::RevokeCollectionAuthoritySignerIncorrect),
100 => Ok(MplTokenMetadataError::TokenCloseFailed),
101 => Ok(MplTokenMetadataError::UnsizedCollection),
102 => Ok(MplTokenMetadataError::SizedCollection),
103 => Ok(MplTokenMetadataError::MissingCollectionMetadata),
104 => Ok(MplTokenMetadataError::NotAMemberOfCollection),
105 => Ok(MplTokenMetadataError::NotVerifiedMemberOfCollection),
106 => Ok(MplTokenMetadataError::NotACollectionParent),
107 => Ok(MplTokenMetadataError::CouldNotDetermineTokenStandard),
108 => Ok(MplTokenMetadataError::MissingEditionAccount),
109 => Ok(MplTokenMetadataError::NotAMasterEdition),
110 => Ok(MplTokenMetadataError::MasterEditionHasPrints),
111 => Ok(MplTokenMetadataError::BorshDeserializationError),
112 => Ok(MplTokenMetadataError::CannotUpdateVerifiedCollection),
113 => Ok(MplTokenMetadataError::CollectionMasterEditionAccountInvalid),
114 => Ok(MplTokenMetadataError::AlreadyVerified),
115 => Ok(MplTokenMetadataError::AlreadyUnverified),
116 => Ok(MplTokenMetadataError::NotAPrintEdition),
117 => Ok(MplTokenMetadataError::InvalidMasterEdition),
118 => Ok(MplTokenMetadataError::InvalidPrintEdition),
119 => Ok(MplTokenMetadataError::InvalidEditionMarker),
120 => Ok(MplTokenMetadataError::ReservationListDeprecated),
121 => Ok(MplTokenMetadataError::PrintEditionDoesNotMatchMasterEdition),
122 => Ok(MplTokenMetadataError::EditionNumberGreaterThanMaxSupply),
123 => Ok(MplTokenMetadataError::MustUnverify),
124 => Ok(MplTokenMetadataError::InvalidEscrowBumpSeed),
125 => Ok(MplTokenMetadataError::MustBeEscrowAuthority),
126 => Ok(MplTokenMetadataError::InvalidSystemProgram),
127 => Ok(MplTokenMetadataError::MustBeNonFungible),
128 => Ok(MplTokenMetadataError::InsufficientTokens),
129 => Ok(MplTokenMetadataError::BorshSerializationError),
130 => Ok(MplTokenMetadataError::NoFreezeAuthoritySet),
131 => Ok(MplTokenMetadataError::InvalidCollectionSizeChange),
132 => Ok(MplTokenMetadataError::InvalidBubblegumSigner),
133 => Ok(MplTokenMetadataError::EscrowParentHasDelegate),
134 => Ok(MplTokenMetadataError::MintIsNotSigner),
135 => Ok(MplTokenMetadataError::InvalidTokenStandard),
136 => Ok(MplTokenMetadataError::InvalidMintForTokenStandard),
137 => Ok(MplTokenMetadataError::InvalidAuthorizationRules),
138 => Ok(MplTokenMetadataError::MissingAuthorizationRules),
139 => Ok(MplTokenMetadataError::MissingProgrammableConfig),
140 => Ok(MplTokenMetadataError::InvalidProgrammableConfig),
141 => Ok(MplTokenMetadataError::DelegateAlreadyExists),
142 => Ok(MplTokenMetadataError::DelegateNotFound),
143 => Ok(MplTokenMetadataError::MissingAccountInBuilder),
144 => Ok(MplTokenMetadataError::MissingArgumentInBuilder),
145 => Ok(MplTokenMetadataError::FeatureNotSupported),
146 => Ok(MplTokenMetadataError::InvalidSystemWallet),
147 => Ok(MplTokenMetadataError::OnlySaleDelegateCanTransfer),
148 => Ok(MplTokenMetadataError::MissingTokenAccount),
149 => Ok(MplTokenMetadataError::MissingSplTokenProgram),
150 => Ok(MplTokenMetadataError::MissingAuthorizationRulesProgram),
151 => Ok(MplTokenMetadataError::InvalidDelegateRoleForTransfer),
152 => Ok(MplTokenMetadataError::InvalidTransferAuthority),
153 => Ok(MplTokenMetadataError::InstructionNotSupported),
154 => Ok(MplTokenMetadataError::KeyMismatch),
155 => Ok(MplTokenMetadataError::LockedToken),
156 => Ok(MplTokenMetadataError::UnlockedToken),
157 => Ok(MplTokenMetadataError::MissingDelegateRole),
158 => Ok(MplTokenMetadataError::InvalidAuthorityType),
159 => Ok(MplTokenMetadataError::MissingTokenRecord),
160 => Ok(MplTokenMetadataError::MintSupplyMustBeZero),
161 => Ok(MplTokenMetadataError::DataIsEmptyOrZeroed),
162 => Ok(MplTokenMetadataError::MissingTokenOwnerAccount),
163 => Ok(MplTokenMetadataError::InvalidMasterEditionAccountLength),
164 => Ok(MplTokenMetadataError::IncorrectTokenState),
165 => Ok(MplTokenMetadataError::InvalidDelegateRole),
166 => Ok(MplTokenMetadataError::MissingPrintSupply),
167 => Ok(MplTokenMetadataError::MissingMasterEditionAccount),
168 => Ok(MplTokenMetadataError::AmountMustBeGreaterThanZero),
169 => Ok(MplTokenMetadataError::InvalidDelegateArgs),
170 => Ok(MplTokenMetadataError::MissingLockedTransferAddress),
171 => Ok(MplTokenMetadataError::InvalidLockedTransferAddress),
172 => Ok(MplTokenMetadataError::DataIncrementLimitExceeded),
173 => Ok(MplTokenMetadataError::CannotUpdateAssetWithDelegate),
174 => Ok(MplTokenMetadataError::InvalidAmount),
175 => Ok(MplTokenMetadataError::MissingMasterEditionMintAccount),
176 => Ok(MplTokenMetadataError::MissingMasterEditionTokenAccount),
177 => Ok(MplTokenMetadataError::MissingEditionMarkerAccount),
178 => Ok(MplTokenMetadataError::CannotBurnWithDelegate),
179 => Ok(MplTokenMetadataError::MissingEdition),
180 => Ok(MplTokenMetadataError::InvalidAssociatedTokenAccountProgram),
181 => Ok(MplTokenMetadataError::InvalidInstructionsSysvar),
182 => Ok(MplTokenMetadataError::InvalidParentAccounts),
183 => Ok(MplTokenMetadataError::InvalidUpdateArgs),
184 => Ok(MplTokenMetadataError::InsufficientTokenBalance),
185 => Ok(MplTokenMetadataError::MissingCollectionMint),
186 => Ok(MplTokenMetadataError::MissingCollectionMasterEdition),
187 => Ok(MplTokenMetadataError::InvalidTokenRecord),
188 => Ok(MplTokenMetadataError::InvalidCloseAuthority),
189 => Ok(MplTokenMetadataError::InvalidInstruction),
190 => Ok(MplTokenMetadataError::MissingDelegateRecord),
191 => Ok(MplTokenMetadataError::InvalidFeeAccount),
192 => Ok(MplTokenMetadataError::InvalidMetadataFlags),
193 => Ok(MplTokenMetadataError::CannotChangeUpdateAuthorityWithDelegate),
194 => Ok(MplTokenMetadataError::InvalidMintExtensionType),
195 => Ok(MplTokenMetadataError::InvalidMintCloseAuthority),
196 => Ok(MplTokenMetadataError::InvalidMetadataPointer),
197 => Ok(MplTokenMetadataError::InvalidTokenExtensionType),
198 => Ok(MplTokenMetadataError::MissingImmutableOwnerExtension),
199 => Ok(MplTokenMetadataError::ExpectedUninitializedAccount),
200 => Ok(MplTokenMetadataError::InvalidEditionAccountLength),
201 => Ok(MplTokenMetadataError::AccountAlreadyResized),
202 => Ok(MplTokenMetadataError::ConditionsForClosingNotMet),
_ => Err(ProgramError::InvalidArgument),
}
}
}
impl ToStr for MplTokenMetadataError {
fn to_str(&self) -> &'static str {
match self {
MplTokenMetadataError::InstructionUnpackError => "",
MplTokenMetadataError::InstructionPackError => "",
MplTokenMetadataError::NotRentExempt => "Lamport balance below rent-exempt threshold",
MplTokenMetadataError::AlreadyInitialized => "Already initialized",
MplTokenMetadataError::Uninitialized => "Uninitialized",
MplTokenMetadataError::InvalidMetadataKey => " Metadata's key must match seed of ['metadata', program id, mint] provided",
MplTokenMetadataError::InvalidEditionKey => "Edition's key must match seed of ['metadata', program id, name, 'edition'] provided",
MplTokenMetadataError::UpdateAuthorityIncorrect => "Update Authority given does not match",
MplTokenMetadataError::UpdateAuthorityIsNotSigner => "Update Authority needs to be signer to update metadata",
MplTokenMetadataError::NotMintAuthority => "You must be the mint authority and signer on this transaction",
MplTokenMetadataError::InvalidMintAuthority => "Mint authority provided does not match the authority on the mint",
MplTokenMetadataError::NameTooLong => "Name too long",
MplTokenMetadataError::SymbolTooLong => "Symbol too long",
MplTokenMetadataError::UriTooLong => "URI too long",
MplTokenMetadataError::UpdateAuthorityMustBeEqualToMetadataAuthorityAndSigner => "",
MplTokenMetadataError::MintMismatch => "Mint given does not match mint on Metadata",
MplTokenMetadataError::EditionsMustHaveExactlyOneToken => "Editions must have exactly one token",
MplTokenMetadataError::MaxEditionsMintedAlready => "",
MplTokenMetadataError::TokenMintToFailed => "",
MplTokenMetadataError::MasterRecordMismatch => "",
MplTokenMetadataError::DestinationMintMismatch => "",
MplTokenMetadataError::EditionAlreadyMinted => "",
MplTokenMetadataError::PrintingMintDecimalsShouldBeZero => "",
MplTokenMetadataError::OneTimePrintingAuthorizationMintDecimalsShouldBeZero => "",
MplTokenMetadataError::EditionMintDecimalsShouldBeZero => "EditionMintDecimalsShouldBeZero",
MplTokenMetadataError::TokenBurnFailed => "",
MplTokenMetadataError::TokenAccountOneTimeAuthMintMismatch => "",
MplTokenMetadataError::DerivedKeyInvalid => "Derived key invalid",
MplTokenMetadataError::PrintingMintMismatch => "The Printing mint does not match that on the master edition!",
MplTokenMetadataError::OneTimePrintingAuthMintMismatch => "The One Time Printing Auth mint does not match that on the master edition!",
MplTokenMetadataError::TokenAccountMintMismatch => "The mint of the token account does not match the Printing mint!",
MplTokenMetadataError::TokenAccountMintMismatchV2 => "The mint of the token account does not match the master metadata mint!",
MplTokenMetadataError::NotEnoughTokens => "Not enough tokens to mint a limited edition",
MplTokenMetadataError::PrintingMintAuthorizationAccountMismatch => "",
MplTokenMetadataError::AuthorizationTokenAccountOwnerMismatch => "",
MplTokenMetadataError::Disabled => "",
MplTokenMetadataError::CreatorsTooLong => "Creators list too long",
MplTokenMetadataError::CreatorsMustBeAtleastOne => "Creators must be at least one if set",
MplTokenMetadataError::MustBeOneOfCreators => "",
MplTokenMetadataError::NoCreatorsPresentOnMetadata => "This metadata does not have creators",
MplTokenMetadataError::CreatorNotFound => "This creator address was not found",
MplTokenMetadataError::InvalidBasisPoints => "Basis points cannot be more than 10000",
MplTokenMetadataError::PrimarySaleCanOnlyBeFlippedToTrue => "Primary sale can only be flipped to true and is immutable",
MplTokenMetadataError::OwnerMismatch => "Owner does not match that on the account given",
MplTokenMetadataError::NoBalanceInAccountForAuthorization => "This account has no tokens to be used for authorization",
MplTokenMetadataError::ShareTotalMustBe100 => "Share total must equal 100 for creator array",
MplTokenMetadataError::ReservationExists => "",
MplTokenMetadataError::ReservationDoesNotExist => "",
MplTokenMetadataError::ReservationNotSet => "",
MplTokenMetadataError::ReservationAlreadyMade => "",
MplTokenMetadataError::BeyondMaxAddressSize => "",
MplTokenMetadataError::NumericalOverflowError => "NumericalOverflowError",
MplTokenMetadataError::ReservationBreachesMaximumSupply => "",
MplTokenMetadataError::AddressNotInReservation => "",
MplTokenMetadataError::CannotVerifyAnotherCreator => "You cannot unilaterally verify another creator, they must sign",
MplTokenMetadataError::CannotUnverifyAnotherCreator => "You cannot unilaterally unverify another creator",
MplTokenMetadataError::SpotMismatch => "",
MplTokenMetadataError::IncorrectOwner => "Incorrect account owner",
MplTokenMetadataError::PrintingWouldBreachMaximumSupply => "",
MplTokenMetadataError::DataIsImmutable => "Data is immutable",
MplTokenMetadataError::DuplicateCreatorAddress => "No duplicate creator addresses",
MplTokenMetadataError::ReservationSpotsRemainingShouldMatchTotalSpotsAtStart => "",
MplTokenMetadataError::InvalidTokenProgram => "Invalid token program",
MplTokenMetadataError::DataTypeMismatch => "Data type mismatch",
MplTokenMetadataError::BeyondAlottedAddressSize => "",
MplTokenMetadataError::ReservationNotComplete => "",
MplTokenMetadataError::TriedToReplaceAnExistingReservation => "",
MplTokenMetadataError::InvalidOperation => "Invalid operation",
MplTokenMetadataError::InvalidOwner => "Invalid Owner",
MplTokenMetadataError::PrintingMintSupplyMustBeZeroForConversion => "Printing mint supply must be zero for conversion",
MplTokenMetadataError::OneTimeAuthMintSupplyMustBeZeroForConversion => "One Time Auth mint supply must be zero for conversion",
MplTokenMetadataError::InvalidEditionIndex => "You tried to insert one edition too many into an edition mark pda",
MplTokenMetadataError::ReservationArrayShouldBeSizeOne => "",
MplTokenMetadataError::IsMutableCanOnlyBeFlippedToFalse => "Is Mutable can only be flipped to false",
MplTokenMetadataError::CollectionCannotBeVerifiedInThisInstruction => "Collection cannot be verified in this instruction",
MplTokenMetadataError::Removed => "This instruction was deprecated in a previous release and is now removed",
MplTokenMetadataError::MustBeBurned => "",
MplTokenMetadataError::InvalidUseMethod => "This use method is invalid",
MplTokenMetadataError::CannotChangeUseMethodAfterFirstUse => "Cannot Change Use Method after the first use",
MplTokenMetadataError::CannotChangeUsesAfterFirstUse => "Cannot Change Remaining or Available uses after the first use",
MplTokenMetadataError::CollectionNotFound => "Collection Not Found on Metadata",
MplTokenMetadataError::InvalidCollectionUpdateAuthority => "Collection Update Authority is invalid",
MplTokenMetadataError::CollectionMustBeAUniqueMasterEdition => "Collection Must Be a Unique Master Edition v2",
MplTokenMetadataError::UseAuthorityRecordAlreadyExists => "The Use Authority Record Already Exists, to modify it Revoke, then Approve",
MplTokenMetadataError::UseAuthorityRecordAlreadyRevoked => "The Use Authority Record is empty or already revoked",
MplTokenMetadataError::Unusable => "This token has no uses",
MplTokenMetadataError::NotEnoughUses => "There are not enough Uses left on this token.",
MplTokenMetadataError::CollectionAuthorityRecordAlreadyExists => "This Collection Authority Record Already Exists.",
MplTokenMetadataError::CollectionAuthorityDoesNotExist => "This Collection Authority Record Does Not Exist.",
MplTokenMetadataError::InvalidUseAuthorityRecord => "This Use Authority Record is invalid.",
MplTokenMetadataError::InvalidCollectionAuthorityRecord => "",
MplTokenMetadataError::InvalidFreezeAuthority => "Metadata does not match the freeze authority on the mint",
MplTokenMetadataError::InvalidDelegate => "All tokens in this account have not been delegated to this user.",
MplTokenMetadataError::CannotAdjustVerifiedCreator => "",
MplTokenMetadataError::CannotRemoveVerifiedCreator => "Verified creators cannot be removed.",
MplTokenMetadataError::CannotWipeVerifiedCreators => "",
MplTokenMetadataError::NotAllowedToChangeSellerFeeBasisPoints => "",
MplTokenMetadataError::EditionOverrideCannotBeZero => "Edition override cannot be zero",
MplTokenMetadataError::InvalidUser => "Invalid User",
MplTokenMetadataError::RevokeCollectionAuthoritySignerIncorrect => "Revoke Collection Authority signer is incorrect",
MplTokenMetadataError::TokenCloseFailed => "",
MplTokenMetadataError::UnsizedCollection => "Can't use this function on unsized collection",
MplTokenMetadataError::SizedCollection => "Can't use this function on a sized collection",
MplTokenMetadataError::MissingCollectionMetadata => "Missing collection metadata account",
MplTokenMetadataError::NotAMemberOfCollection => "This NFT is not a member of the specified collection.",
MplTokenMetadataError::NotVerifiedMemberOfCollection => "This NFT is not a verified member of the specified collection.",
MplTokenMetadataError::NotACollectionParent => "This NFT is not a collection parent NFT.",
MplTokenMetadataError::CouldNotDetermineTokenStandard => "Could not determine a TokenStandard type.",
MplTokenMetadataError::MissingEditionAccount => "This mint account has an edition but none was provided.",
MplTokenMetadataError::NotAMasterEdition => "This edition is not a Master Edition",
MplTokenMetadataError::MasterEditionHasPrints => "This Master Edition has existing prints",
MplTokenMetadataError::BorshDeserializationError => "",
MplTokenMetadataError::CannotUpdateVerifiedCollection => "Cannot update a verified collection in this command",
MplTokenMetadataError::CollectionMasterEditionAccountInvalid => "Edition account doesnt match collection ",
MplTokenMetadataError::AlreadyVerified => "Item is already verified.",
MplTokenMetadataError::AlreadyUnverified => "",
MplTokenMetadataError::NotAPrintEdition => "This edition is not a Print Edition",
MplTokenMetadataError::InvalidMasterEdition => "Invalid Master Edition",
MplTokenMetadataError::InvalidPrintEdition => "Invalid Print Edition",
MplTokenMetadataError::InvalidEditionMarker => "Invalid Edition Marker",
MplTokenMetadataError::ReservationListDeprecated => "Reservation List is Deprecated",
MplTokenMetadataError::PrintEditionDoesNotMatchMasterEdition => "Print Edition does not match Master Edition",
MplTokenMetadataError::EditionNumberGreaterThanMaxSupply => "Edition Number greater than max supply",
MplTokenMetadataError::MustUnverify => "Must unverify before migrating collections.",
MplTokenMetadataError::InvalidEscrowBumpSeed => "Invalid Escrow Account Bump Seed",
MplTokenMetadataError::MustBeEscrowAuthority => "Must Escrow Authority",
MplTokenMetadataError::InvalidSystemProgram => "Invalid System Program",
MplTokenMetadataError::MustBeNonFungible => "Must be a Non Fungible Token",
MplTokenMetadataError::InsufficientTokens => "Insufficient tokens for transfer",
MplTokenMetadataError::BorshSerializationError => "Borsh Serialization Error",
MplTokenMetadataError::NoFreezeAuthoritySet => "Cannot create NFT with no Freeze Authority.",
MplTokenMetadataError::InvalidCollectionSizeChange => "Invalid collection size change",
MplTokenMetadataError::InvalidBubblegumSigner => "Invalid bubblegum signer",
MplTokenMetadataError::EscrowParentHasDelegate => "Escrow parent cannot have a delegate",
MplTokenMetadataError::MintIsNotSigner => "Mint needs to be signer to initialize the account",
MplTokenMetadataError::InvalidTokenStandard => "Invalid token standard",
MplTokenMetadataError::InvalidMintForTokenStandard => "Invalid mint account for specified token standard",
MplTokenMetadataError::InvalidAuthorizationRules => "Invalid authorization rules account",
MplTokenMetadataError::MissingAuthorizationRules => "Missing authorization rules account",
MplTokenMetadataError::MissingProgrammableConfig => "Missing programmable configuration",
MplTokenMetadataError::InvalidProgrammableConfig => "Invalid programmable configuration",
MplTokenMetadataError::DelegateAlreadyExists => "Delegate already exists",
MplTokenMetadataError::DelegateNotFound => "Delegate not found",
MplTokenMetadataError::MissingAccountInBuilder => "Required account not set in instruction builder",
MplTokenMetadataError::MissingArgumentInBuilder => "Required argument not set in instruction builder",
MplTokenMetadataError::FeatureNotSupported => "Feature not supported currently",
MplTokenMetadataError::InvalidSystemWallet => "Invalid system wallet",
MplTokenMetadataError::OnlySaleDelegateCanTransfer => "Only the sale delegate can transfer while its set",
MplTokenMetadataError::MissingTokenAccount => "Missing token account",
MplTokenMetadataError::MissingSplTokenProgram => "Missing SPL token program",
MplTokenMetadataError::MissingAuthorizationRulesProgram => "Missing authorization rules program",
MplTokenMetadataError::InvalidDelegateRoleForTransfer => "Invalid delegate role for transfer",
MplTokenMetadataError::InvalidTransferAuthority => "Invalid transfer authority",
MplTokenMetadataError::InstructionNotSupported => "Instruction not supported for ProgrammableNonFungible assets",
MplTokenMetadataError::KeyMismatch => "Public key does not match expected value",
MplTokenMetadataError::LockedToken => "Token is locked",
MplTokenMetadataError::UnlockedToken => "Token is unlocked",
MplTokenMetadataError::MissingDelegateRole => "Missing delegate role",
MplTokenMetadataError::InvalidAuthorityType => "Invalid authority type",
MplTokenMetadataError::MissingTokenRecord => "Missing token record account",
MplTokenMetadataError::MintSupplyMustBeZero => "Mint supply must be zero for programmable assets",
MplTokenMetadataError::DataIsEmptyOrZeroed => "Data is empty or zeroed",
MplTokenMetadataError::MissingTokenOwnerAccount => "Missing token owner",
MplTokenMetadataError::InvalidMasterEditionAccountLength => "Master edition account has an invalid length",
MplTokenMetadataError::IncorrectTokenState => "Incorrect token state",
MplTokenMetadataError::InvalidDelegateRole => "Invalid delegate role",
MplTokenMetadataError::MissingPrintSupply => "Print supply is required for non-fungibles",
MplTokenMetadataError::MissingMasterEditionAccount => "Missing master edition account",
MplTokenMetadataError::AmountMustBeGreaterThanZero => "Amount must be greater than zero",
MplTokenMetadataError::InvalidDelegateArgs => "Invalid delegate args",
MplTokenMetadataError::MissingLockedTransferAddress => "Missing address for locked transfer",
MplTokenMetadataError::InvalidLockedTransferAddress => "Invalid destination address for locked transfer",
MplTokenMetadataError::DataIncrementLimitExceeded => "Exceeded account realloc increase limit",
MplTokenMetadataError::CannotUpdateAssetWithDelegate => "Cannot update the rule set of a programmable asset that has a delegate",
MplTokenMetadataError::InvalidAmount => "Invalid token amount for this operation or token standard",
MplTokenMetadataError::MissingMasterEditionMintAccount => "Missing master edition mint account",
MplTokenMetadataError::MissingMasterEditionTokenAccount => "Missing master edition token account",
MplTokenMetadataError::MissingEditionMarkerAccount => "Missing edition marker account",
MplTokenMetadataError::CannotBurnWithDelegate => "Cannot burn while persistent delegate is set",
MplTokenMetadataError::MissingEdition => "Missing edition account",
MplTokenMetadataError::InvalidAssociatedTokenAccountProgram => "Invalid Associated Token Account Program",
MplTokenMetadataError::InvalidInstructionsSysvar => "Invalid InstructionsSysvar",
MplTokenMetadataError::InvalidParentAccounts => "Invalid or Unneeded parent accounts",
MplTokenMetadataError::InvalidUpdateArgs => "Authority cannot apply all update args",
MplTokenMetadataError::InsufficientTokenBalance => "Token account does not have enough tokens",
MplTokenMetadataError::MissingCollectionMint => "Missing collection account",
MplTokenMetadataError::MissingCollectionMasterEdition => "Missing collection master edition account",
MplTokenMetadataError::InvalidTokenRecord => "Invalid token record account",
MplTokenMetadataError::InvalidCloseAuthority => "The close authority needs to be revoked by the Utility Delegate",
MplTokenMetadataError::InvalidInstruction => "Invalid or removed instruction",
MplTokenMetadataError::MissingDelegateRecord => "Missing delegate record",
MplTokenMetadataError::InvalidFeeAccount => "",
MplTokenMetadataError::InvalidMetadataFlags => "",
MplTokenMetadataError::CannotChangeUpdateAuthorityWithDelegate => "Cannot change the update authority with a delegate",
MplTokenMetadataError::InvalidMintExtensionType => "Invalid mint extension type",
MplTokenMetadataError::InvalidMintCloseAuthority => "Invalid mint close authority",
MplTokenMetadataError::InvalidMetadataPointer => "Invalid metadata pointer",
MplTokenMetadataError::InvalidTokenExtensionType => "Invalid token extension type",
MplTokenMetadataError::MissingImmutableOwnerExtension => "Missing immutable owner extension",
MplTokenMetadataError::ExpectedUninitializedAccount => "Expected account to be uninitialized",
MplTokenMetadataError::InvalidEditionAccountLength => "Edition account has an invalid length",
MplTokenMetadataError::AccountAlreadyResized => "Account has already been resized",
MplTokenMetadataError::ConditionsForClosingNotMet => "Conditions for closing not met",
}
}
}