1use num_derive::FromPrimitive;
9use thiserror::Error;
10
11#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
12pub enum MplTokenMetadataError {
13 #[error("")]
15 InstructionUnpackError,
16 #[error("")]
18 InstructionPackError,
19 #[error("Lamport balance below rent-exempt threshold")]
21 NotRentExempt,
22 #[error("Already initialized")]
24 AlreadyInitialized,
25 #[error("Uninitialized")]
27 Uninitialized,
28 #[error(" Metadata's key must match seed of ['metadata', program id, mint] provided")]
30 InvalidMetadataKey,
31 #[error("Edition's key must match seed of ['metadata', program id, name, 'edition'] provided")]
33 InvalidEditionKey,
34 #[error("Update Authority given does not match")]
36 UpdateAuthorityIncorrect,
37 #[error("Update Authority needs to be signer to update metadata")]
39 UpdateAuthorityIsNotSigner,
40 #[error("You must be the mint authority and signer on this transaction")]
42 NotMintAuthority,
43 #[error("Mint authority provided does not match the authority on the mint")]
45 InvalidMintAuthority,
46 #[error("Name too long")]
48 NameTooLong,
49 #[error("Symbol too long")]
51 SymbolTooLong,
52 #[error("URI too long")]
54 UriTooLong,
55 #[error("")]
57 UpdateAuthorityMustBeEqualToMetadataAuthorityAndSigner,
58 #[error("Mint given does not match mint on Metadata")]
60 MintMismatch,
61 #[error("Editions must have exactly one token")]
63 EditionsMustHaveExactlyOneToken,
64 #[error("")]
66 MaxEditionsMintedAlready,
67 #[error("")]
69 TokenMintToFailed,
70 #[error("")]
72 MasterRecordMismatch,
73 #[error("")]
75 DestinationMintMismatch,
76 #[error("")]
78 EditionAlreadyMinted,
79 #[error("")]
81 PrintingMintDecimalsShouldBeZero,
82 #[error("")]
84 OneTimePrintingAuthorizationMintDecimalsShouldBeZero,
85 #[error("EditionMintDecimalsShouldBeZero")]
87 EditionMintDecimalsShouldBeZero,
88 #[error("")]
90 TokenBurnFailed,
91 #[error("")]
93 TokenAccountOneTimeAuthMintMismatch,
94 #[error("Derived key invalid")]
96 DerivedKeyInvalid,
97 #[error("The Printing mint does not match that on the master edition!")]
99 PrintingMintMismatch,
100 #[error("The One Time Printing Auth mint does not match that on the master edition!")]
102 OneTimePrintingAuthMintMismatch,
103 #[error("The mint of the token account does not match the Printing mint!")]
105 TokenAccountMintMismatch,
106 #[error("The mint of the token account does not match the master metadata mint!")]
108 TokenAccountMintMismatchV2,
109 #[error("Not enough tokens to mint a limited edition")]
111 NotEnoughTokens,
112 #[error("")]
114 PrintingMintAuthorizationAccountMismatch,
115 #[error("")]
117 AuthorizationTokenAccountOwnerMismatch,
118 #[error("")]
120 Disabled,
121 #[error("Creators list too long")]
123 CreatorsTooLong,
124 #[error("Creators must be at least one if set")]
126 CreatorsMustBeAtleastOne,
127 #[error("")]
129 MustBeOneOfCreators,
130 #[error("This metadata does not have creators")]
132 NoCreatorsPresentOnMetadata,
133 #[error("This creator address was not found")]
135 CreatorNotFound,
136 #[error("Basis points cannot be more than 10000")]
138 InvalidBasisPoints,
139 #[error("Primary sale can only be flipped to true and is immutable")]
141 PrimarySaleCanOnlyBeFlippedToTrue,
142 #[error("Owner does not match that on the account given")]
144 OwnerMismatch,
145 #[error("This account has no tokens to be used for authorization")]
147 NoBalanceInAccountForAuthorization,
148 #[error("Share total must equal 100 for creator array")]
150 ShareTotalMustBe100,
151 #[error("")]
153 ReservationExists,
154 #[error("")]
156 ReservationDoesNotExist,
157 #[error("")]
159 ReservationNotSet,
160 #[error("")]
162 ReservationAlreadyMade,
163 #[error("")]
165 BeyondMaxAddressSize,
166 #[error("NumericalOverflowError")]
168 NumericalOverflowError,
169 #[error("")]
171 ReservationBreachesMaximumSupply,
172 #[error("")]
174 AddressNotInReservation,
175 #[error("You cannot unilaterally verify another creator, they must sign")]
177 CannotVerifyAnotherCreator,
178 #[error("You cannot unilaterally unverify another creator")]
180 CannotUnverifyAnotherCreator,
181 #[error("")]
183 SpotMismatch,
184 #[error("Incorrect account owner")]
186 IncorrectOwner,
187 #[error("")]
189 PrintingWouldBreachMaximumSupply,
190 #[error("Data is immutable")]
192 DataIsImmutable,
193 #[error("No duplicate creator addresses")]
195 DuplicateCreatorAddress,
196 #[error("")]
198 ReservationSpotsRemainingShouldMatchTotalSpotsAtStart,
199 #[error("Invalid token program")]
201 InvalidTokenProgram,
202 #[error("Data type mismatch")]
204 DataTypeMismatch,
205 #[error("")]
207 BeyondAlottedAddressSize,
208 #[error("")]
210 ReservationNotComplete,
211 #[error("")]
213 TriedToReplaceAnExistingReservation,
214 #[error("Invalid operation")]
216 InvalidOperation,
217 #[error("Invalid Owner")]
219 InvalidOwner,
220 #[error("Printing mint supply must be zero for conversion")]
222 PrintingMintSupplyMustBeZeroForConversion,
223 #[error("One Time Auth mint supply must be zero for conversion")]
225 OneTimeAuthMintSupplyMustBeZeroForConversion,
226 #[error("You tried to insert one edition too many into an edition mark pda")]
228 InvalidEditionIndex,
229 #[error("")]
231 ReservationArrayShouldBeSizeOne,
232 #[error("Is Mutable can only be flipped to false")]
234 IsMutableCanOnlyBeFlippedToFalse,
235 #[error("Collection cannot be verified in this instruction")]
237 CollectionCannotBeVerifiedInThisInstruction,
238 #[error("This instruction was deprecated in a previous release and is now removed")]
240 Removed,
241 #[error("")]
243 MustBeBurned,
244 #[error("This use method is invalid")]
246 InvalidUseMethod,
247 #[error("Cannot Change Use Method after the first use")]
249 CannotChangeUseMethodAfterFirstUse,
250 #[error("Cannot Change Remaining or Available uses after the first use")]
252 CannotChangeUsesAfterFirstUse,
253 #[error("Collection Not Found on Metadata")]
255 CollectionNotFound,
256 #[error("Collection Update Authority is invalid")]
258 InvalidCollectionUpdateAuthority,
259 #[error("Collection Must Be a Unique Master Edition v2")]
261 CollectionMustBeAUniqueMasterEdition,
262 #[error("The Use Authority Record Already Exists, to modify it Revoke, then Approve")]
264 UseAuthorityRecordAlreadyExists,
265 #[error("The Use Authority Record is empty or already revoked")]
267 UseAuthorityRecordAlreadyRevoked,
268 #[error("This token has no uses")]
270 Unusable,
271 #[error("There are not enough Uses left on this token.")]
273 NotEnoughUses,
274 #[error("This Collection Authority Record Already Exists.")]
276 CollectionAuthorityRecordAlreadyExists,
277 #[error("This Collection Authority Record Does Not Exist.")]
279 CollectionAuthorityDoesNotExist,
280 #[error("This Use Authority Record is invalid.")]
282 InvalidUseAuthorityRecord,
283 #[error("")]
285 InvalidCollectionAuthorityRecord,
286 #[error("Metadata does not match the freeze authority on the mint")]
288 InvalidFreezeAuthority,
289 #[error("All tokens in this account have not been delegated to this user.")]
291 InvalidDelegate,
292 #[error("")]
294 CannotAdjustVerifiedCreator,
295 #[error("Verified creators cannot be removed.")]
297 CannotRemoveVerifiedCreator,
298 #[error("")]
300 CannotWipeVerifiedCreators,
301 #[error("")]
303 NotAllowedToChangeSellerFeeBasisPoints,
304 #[error("Edition override cannot be zero")]
306 EditionOverrideCannotBeZero,
307 #[error("Invalid User")]
309 InvalidUser,
310 #[error("Revoke Collection Authority signer is incorrect")]
312 RevokeCollectionAuthoritySignerIncorrect,
313 #[error("")]
315 TokenCloseFailed,
316 #[error("Can't use this function on unsized collection")]
318 UnsizedCollection,
319 #[error("Can't use this function on a sized collection")]
321 SizedCollection,
322 #[error("Missing collection metadata account")]
324 MissingCollectionMetadata,
325 #[error("This NFT is not a member of the specified collection.")]
327 NotAMemberOfCollection,
328 #[error("This NFT is not a verified member of the specified collection.")]
330 NotVerifiedMemberOfCollection,
331 #[error("This NFT is not a collection parent NFT.")]
333 NotACollectionParent,
334 #[error("Could not determine a TokenStandard type.")]
336 CouldNotDetermineTokenStandard,
337 #[error("This mint account has an edition but none was provided.")]
339 MissingEditionAccount,
340 #[error("This edition is not a Master Edition")]
342 NotAMasterEdition,
343 #[error("This Master Edition has existing prints")]
345 MasterEditionHasPrints,
346 #[error("")]
348 BorshDeserializationError,
349 #[error("Cannot update a verified collection in this command")]
351 CannotUpdateVerifiedCollection,
352 #[error("Edition account doesnt match collection ")]
354 CollectionMasterEditionAccountInvalid,
355 #[error("Item is already verified.")]
357 AlreadyVerified,
358 #[error("")]
360 AlreadyUnverified,
361 #[error("This edition is not a Print Edition")]
363 NotAPrintEdition,
364 #[error("Invalid Master Edition")]
366 InvalidMasterEdition,
367 #[error("Invalid Print Edition")]
369 InvalidPrintEdition,
370 #[error("Invalid Edition Marker")]
372 InvalidEditionMarker,
373 #[error("Reservation List is Deprecated")]
375 ReservationListDeprecated,
376 #[error("Print Edition does not match Master Edition")]
378 PrintEditionDoesNotMatchMasterEdition,
379 #[error("Edition Number greater than max supply")]
381 EditionNumberGreaterThanMaxSupply,
382 #[error("Must unverify before migrating collections.")]
384 MustUnverify,
385 #[error("Invalid Escrow Account Bump Seed")]
387 InvalidEscrowBumpSeed,
388 #[error("Must Escrow Authority")]
390 MustBeEscrowAuthority,
391 #[error("Invalid System Program")]
393 InvalidSystemProgram,
394 #[error("Must be a Non Fungible Token")]
396 MustBeNonFungible,
397 #[error("Insufficient tokens for transfer")]
399 InsufficientTokens,
400 #[error("Borsh Serialization Error")]
402 BorshSerializationError,
403 #[error("Cannot create NFT with no Freeze Authority.")]
405 NoFreezeAuthoritySet,
406 #[error("Invalid collection size change")]
408 InvalidCollectionSizeChange,
409 #[error("Invalid bubblegum signer")]
411 InvalidBubblegumSigner,
412 #[error("Escrow parent cannot have a delegate")]
414 EscrowParentHasDelegate,
415 #[error("Mint needs to be signer to initialize the account")]
417 MintIsNotSigner,
418 #[error("Invalid token standard")]
420 InvalidTokenStandard,
421 #[error("Invalid mint account for specified token standard")]
423 InvalidMintForTokenStandard,
424 #[error("Invalid authorization rules account")]
426 InvalidAuthorizationRules,
427 #[error("Missing authorization rules account")]
429 MissingAuthorizationRules,
430 #[error("Missing programmable configuration")]
432 MissingProgrammableConfig,
433 #[error("Invalid programmable configuration")]
435 InvalidProgrammableConfig,
436 #[error("Delegate already exists")]
438 DelegateAlreadyExists,
439 #[error("Delegate not found")]
441 DelegateNotFound,
442 #[error("Required account not set in instruction builder")]
444 MissingAccountInBuilder,
445 #[error("Required argument not set in instruction builder")]
447 MissingArgumentInBuilder,
448 #[error("Feature not supported currently")]
450 FeatureNotSupported,
451 #[error("Invalid system wallet")]
453 InvalidSystemWallet,
454 #[error("Only the sale delegate can transfer while its set")]
456 OnlySaleDelegateCanTransfer,
457 #[error("Missing token account")]
459 MissingTokenAccount,
460 #[error("Missing SPL token program")]
462 MissingSplTokenProgram,
463 #[error("Missing authorization rules program")]
465 MissingAuthorizationRulesProgram,
466 #[error("Invalid delegate role for transfer")]
468 InvalidDelegateRoleForTransfer,
469 #[error("Invalid transfer authority")]
471 InvalidTransferAuthority,
472 #[error("Instruction not supported for ProgrammableNonFungible assets")]
474 InstructionNotSupported,
475 #[error("Public key does not match expected value")]
477 KeyMismatch,
478 #[error("Token is locked")]
480 LockedToken,
481 #[error("Token is unlocked")]
483 UnlockedToken,
484 #[error("Missing delegate role")]
486 MissingDelegateRole,
487 #[error("Invalid authority type")]
489 InvalidAuthorityType,
490 #[error("Missing token record account")]
492 MissingTokenRecord,
493 #[error("Mint supply must be zero for programmable assets")]
495 MintSupplyMustBeZero,
496 #[error("Data is empty or zeroed")]
498 DataIsEmptyOrZeroed,
499 #[error("Missing token owner")]
501 MissingTokenOwnerAccount,
502 #[error("Master edition account has an invalid length")]
504 InvalidMasterEditionAccountLength,
505 #[error("Incorrect token state")]
507 IncorrectTokenState,
508 #[error("Invalid delegate role")]
510 InvalidDelegateRole,
511 #[error("Print supply is required for non-fungibles")]
513 MissingPrintSupply,
514 #[error("Missing master edition account")]
516 MissingMasterEditionAccount,
517 #[error("Amount must be greater than zero")]
519 AmountMustBeGreaterThanZero,
520 #[error("Invalid delegate args")]
522 InvalidDelegateArgs,
523 #[error("Missing address for locked transfer")]
525 MissingLockedTransferAddress,
526 #[error("Invalid destination address for locked transfer")]
528 InvalidLockedTransferAddress,
529 #[error("Exceeded account realloc increase limit")]
531 DataIncrementLimitExceeded,
532 #[error("Cannot update the rule set of a programmable asset that has a delegate")]
534 CannotUpdateAssetWithDelegate,
535 #[error("Invalid token amount for this operation or token standard")]
537 InvalidAmount,
538 #[error("Missing master edition mint account")]
540 MissingMasterEditionMintAccount,
541 #[error("Missing master edition token account")]
543 MissingMasterEditionTokenAccount,
544 #[error("Missing edition marker account")]
546 MissingEditionMarkerAccount,
547 #[error("Cannot burn while persistent delegate is set")]
549 CannotBurnWithDelegate,
550 #[error("Missing edition account")]
552 MissingEdition,
553 #[error("Invalid Associated Token Account Program")]
555 InvalidAssociatedTokenAccountProgram,
556 #[error("Invalid InstructionsSysvar")]
558 InvalidInstructionsSysvar,
559 #[error("Invalid or Unneeded parent accounts")]
561 InvalidParentAccounts,
562 #[error("Authority cannot apply all update args")]
564 InvalidUpdateArgs,
565 #[error("Token account does not have enough tokens")]
567 InsufficientTokenBalance,
568 #[error("Missing collection account")]
570 MissingCollectionMint,
571 #[error("Missing collection master edition account")]
573 MissingCollectionMasterEdition,
574 #[error("Invalid token record account")]
576 InvalidTokenRecord,
577 #[error("The close authority needs to be revoked by the Utility Delegate")]
579 InvalidCloseAuthority,
580 #[error("Invalid or removed instruction")]
582 InvalidInstruction,
583 #[error("Missing delegate record")]
585 MissingDelegateRecord,
586 #[error("")]
588 InvalidFeeAccount,
589 #[error("")]
591 InvalidMetadataFlags,
592 #[error("Cannot change the update authority with a delegate")]
594 CannotChangeUpdateAuthorityWithDelegate,
595 #[error("Invalid mint extension type")]
597 InvalidMintExtensionType,
598 #[error("Invalid mint close authority")]
600 InvalidMintCloseAuthority,
601 #[error("Invalid metadata pointer")]
603 InvalidMetadataPointer,
604 #[error("Invalid token extension type")]
606 InvalidTokenExtensionType,
607 #[error("Missing immutable owner extension")]
609 MissingImmutableOwnerExtension,
610 #[error("Expected account to be uninitialized")]
612 ExpectedUninitializedAccount,
613 #[error("Edition account has an invalid length")]
615 InvalidEditionAccountLength,
616 #[error("Account has already been resized")]
618 AccountAlreadyResized,
619 #[error("Conditions for closing not met")]
621 ConditionsForClosingNotMet,
622}
623
624impl solana_program::program_error::PrintProgramError for MplTokenMetadataError {
625 fn print<E>(&self) {
626 solana_program::msg!(&self.to_string());
627 }
628}