Skip to content

Commit

Permalink
update errors for token metadata, anchor and nft-candy machine
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelvanderwaal committed Jan 18, 2022
1 parent e3bd886 commit b18741c
Showing 1 changed file with 85 additions and 55 deletions.
140 changes: 85 additions & 55 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,53 @@ pub static ANCHOR_PROGRAM: phf::Map<&'static str, &'static str> = phf_map! {
"66" => "InstructionDidNotDeserialize: The program could not deserialize the given instruction",
"67" => "InstructionDidNotSerialize: The program could not serialize the given instruction",
// IDL instructions.
"78" => "IdlInstructionStub: The program was compiled without idl instructions",
"79"=> "IdlInstructionInvalidProgram: Invalid program given to the IDL instruction",
"3E8" => "IdlInstructionStub: The program was compiled without idl instructions",
"3E9"=> "IdlInstructionInvalidProgram: Invalid program given to the IDL instruction",

// Constraints.
"8C" =>"ConstraintMut: A mut constraint was violated",
"8D" => "ConstraintHasOne: A has one constraint was violated",
"8E" => "ConstraintSigner: A signer constraint as violated",
"8F" => "ConstraintRaw: A raw constraint was violated",
"90" => "ConstraintOwner: An owner constraint was violated",
"91" => "ConstraintRentExempt: A rent exemption constraint was violated",
"92" => "ConstraintSeeds: A seeds constraint was violated",
"93" => "ConstraintExecutable: An executable constraint was violated",
"94" => "ConstraintState: A state constraint was violated",
"95" => "ConstraintAssociated: An associated constraint was violated",
"96" => "ConstraintAssociatedInit: An associated init constraint was violated",
"97" => "ConstraintClose: A close constraint was violated",
"98" => "ConstraintAddress: An address constraint was violated",
"99" => "ConstraintZero: Expected zero account discriminant",
"7D0" => "ConstraintMut: A mut constraint was violated",
"7D1" => "ConstraintHasOne: A has one constraint was violated",
"7D2" => "ConstraintSigner: A signer constraint as violated",
"7D3" => "ConstraintRaw: A raw constraint was violated",
"7D4" => "ConstraintOwner: An owner constraint was violated",
"7D5" => "ConstraintRentExempt: A rent exemption constraint was violated",
"7D6" => "ConstraintSeeds: A seeds constraint was violated",
"7D7" => "ConstraintExecutable: An executable constraint was violated",
"7D8" => "ConstraintState: A state constraint was violated",
"7D9" => "ConstraintAssociated: An associated constraint was violated",
"7DA" => "ConstraintAssociatedInit: An associated init constraint was violated",
"7DB" => "ConstraintClose: A close constraint was violated",
"7DC" => "ConstraintAddress: An address constraint was violated",
"7DD" => "ConstraintZero: Expected zero account discriminant",
"7DE" => "ConstraintTokenMint: A token mint constraint was violated",
"7DF" => "ConstraintTokenOwner: A token owner constraint was violated",
"7E0" => "ConstraintMintMintAuthority: A mint mint authority constraint was violated",
"7E1" => "ConstraintMintFreezeAuthority: A mint freeze authority constraint was violated",
"7E2" => "ConstraintMintDecimals: A mint decimals constraint was violated",
"7E3" => "ConstraintSpace: A space constraint was violated",

// Accounts.
"A0" => "AccountDiscriminatorAlreadySet: The account discriminator was already set on this account",
"A1" => "AccountDiscriminatorNotFound: No 8 byte discriminator was found on the account",
"A2" => "AccountDiscriminatorMismatch: 8 byte discriminator did not match what was expected",
"A3" => "AccountDidNotDeserialize: Failed to deserialize the account",
"A4" => "AccountDidNotSerialize: Failed to serialize the account",
"A5" => "AccountNotEnoughKeys: Not enough account keys given to the instruction",
"A6" => "AccountNotMutable: The given account is not mutable",
"A7" => "AccountNotProgramOwned: The given account is not owned by the executing program",
"A8" => "InvalidProgramId: Program ID was not as expected",
"A9" => "InvalidProgramExecutable: Program account is not executable",
"AA" => "AccountNotSigner: The given account did not sign",
"BB8" => "AccountDiscriminatorAlreadySet: The account discriminator was already set on this account",
"BB9" => "AccountDiscriminatorNotFound: No 8 byte discriminator was found on the account",
"BBA" => "AccountDiscriminatorMismatch: 8 byte discriminator did not match what was expected",
"BBB" => "AccountDidNotDeserialize: Failed to deserialize the account",
"BBC" => "AccountDidNotSerialize: Failed to serialize the account",
"BBD" => "AccountNotEnoughKeys: Not enough account keys given to the instruction",
"BBE" => "AccountNotMutable: The given account is not mutable",
"BBF" => "AccountNotProgramOwned: The given account is not owned by the executing program",
"BC0" => "InvalidProgramId: Program ID was not as expected",
"BC1" => "InvalidProgramExecutable: Program account is not executable",
"BC2" => "AccountNotSigner: The given account did not sign",
"BC3" => "AccountNotSystemOwned: The given account is not owned by the system program",
"BC4" => "AccountNotInitialized: The program expected this account to be already initialized",
"BC5" => "AccountNotProgramData: The given account is not a program data account",
"BC6" => "AccountNotAssociatedTokenAccount: The given account is not the associated token account",

// State.
"B4" => "StateInvalidAddress: The given state account does not have the correct address",
"FA0" => "StateInvalidAddress: The given state account does not have the correct address",

// Used for APIs that shouldn't be used anymore.
"12B" => "Deprecated: The API being used is deprecated and should no longer be used",
"1388" => "Deprecated: The API being used is deprecated and should no longer be used",
};

pub static FAIR_LAUNCH: phf::Map<&'static str, &'static str> = phf_map! {};
Expand All @@ -65,32 +79,32 @@ pub static NFT_CANDY_MACHINE: phf::Map<&'static str, &'static str> = phf_map! {
};

pub static NFT_CANDY_MACHINE_V2: phf::Map<&'static str, &'static str> = phf_map! {

"12C" => "IncorrectOwner: Account does not have correct owner!",
"12D" => "Uninitialized: Account is not initialized!",
"12E" => "MintMismatch: Mint Mismatch!",
"12F" => "IndexGreaterThanLength: Index greater than length!",
"130" => "NumericalOverflowError: Numerical overflow error!",
"131" => "TooManyCreators: Can only provide up to 4 creators to candy machine (because candy machine is one)!",
"132" => "UuidMustBeExactly6Length: Uuid must be exactly of 6 length",
"133" => "NotEnoughTokens: Not enough tokens to pay for this minting",
"134" => "NotEnoughSOL: Not enough SOL to pay for this minting",
"135" => "TokenTransferFailed: Token transfer failed",
"136" => "CandyMachineEmpty: Candy machine is empty!",
"137" => "CandyMachineNotLive: Candy machine is not live!",
"138" => "HiddenSettingsConfigsDoNotHaveConfigLines: Configs that are using hidden uris do not have config lines, they have a single hash representing hashed order",
"139" => "CannotChangeNumberOfLines: Cannot change number of lines unless is a hidden config",
"13A" => "DerivedKeyInvalid: Derived key invalid",
"13B" => "PublicKeyMismatch: Public key mismatch",
"13C" => "NoWhitelistToken: No whitelist token present",
"13D" => "TokenBurnFailed: Token burn failed",
"13E" => "GatewayAppMissing: Missing gateway app when required",
"13F" => "GatewayTokenMissing: Missing gateway token when required",
"140" => "GatewayTokenExpireTimeInvalid: Invalid gateway token expire time",
"141" => "NetworkExpireFeatureMissing: Missing gateway network expire feature when required",
"142" => "CannotFindUsableConfigLine: Unable to find an unused config line near your random number index",
"143" => "InvalidString: Invalid string",
"144" => "SuspiciousTransaction: Suspicious transaction detected",
"12C" => "IncorrectOwner: Account does not have correct owner!",
"12D" => "Uninitialized: Account is not initialized!",
"12E" => "MintMismatch: Mint Mismatch!",
"12F" => "IndexGreaterThanLength: Index greater than length!",
"130" => "NumericalOverflowError: Numerical overflow error!",
"131" => "TooManyCreators: Can only provide up to 4 creators to candy machine (because candy machine is one)!",
"132" => "UuidMustBeExactly6Length: Uuid must be exactly of 6 length",
"133" => "NotEnoughTokens: Not enough tokens to pay for this minting",
"134" => "NotEnoughSOL: Not enough SOL to pay for this minting",
"135" => "TokenTransferFailed: Token transfer failed",
"136" => "CandyMachineEmpty: Candy machine is empty!",
"137" => "CandyMachineNotLive: Candy machine is not live!",
"138" => "HiddenSettingsConfigsDoNotHaveConfigLines: Configs that are using hidden uris do not have config lines, they have a single hash representing hashed order",
"139" => "CannotChangeNumberOfLines: Cannot change number of lines unless is a hidden config",
"13A" => "DerivedKeyInvalid: Derived key invalid",
"13B" => "PublicKeyMismatch: Public key mismatch",
"13C" => "NoWhitelistToken: No whitelist token present",
"13D" => "TokenBurnFailed: Token burn failed",
"13E" => "GatewayAppMissing: Missing gateway app when required",
"13F" => "GatewayTokenMissing: Missing gateway token when required",
"140" => "GatewayTokenExpireTimeInvalid: Invalid gateway token expire time",
"141" => "NetworkExpireFeatureMissing: Missing gateway network expire feature when required",
"142" => "CannotFindUsableConfigLine: Unable to find an unused config line near your random number index",
"143" => "InvalidString: Invalid string",
"144" => "SuspiciousTransaction: Suspicious transaction detected",
"145" => "CannotSwitchToHiddenSettings: Cannot Switch to Hidden Settings after items available is greater than 0",
};

pub static TOKEN_METADATA: phf::Map<&'static str, &'static str> = phf_map! {
Expand Down Expand Up @@ -167,6 +181,22 @@ pub static TOKEN_METADATA: phf::Map<&'static str, &'static str> = phf_map! {
"46" => "OneTimeAuthMintSupplyMustBeZeroForConversion: One Time Auth mint supply must be zero for conversion",
"47" => "InvalidEditionIndex: You tried to insert one edition too many into an edition mark pda",
"48" => "ReservationArrayShouldBeSizeOne: In the legacy system the reservation needs to be of size one for cpu limit reasons",
"49" => "IsMutableCanOnlyBeFlippedToFalse: Is Mutable can only be flipped to false",
"4A" => "CollectionCannotBeVerifiedInThisInstruction: Cannont Verify Collection in this Instruction",
"4B" => "Removed, //For the curious we cannot get rid of an instruction in the enum or move them or it will break our api, this is a friendly way to get rid of the: This instruction was deprecated in a previous release and is now removed",
"4C" => "MustBeBurned: This token use method is burn and there are no remaining uses, it must be burned",
"4D" => "InvalidUseMethod: This use method is invalid",
"4E" => "CannotChangeUseMethodAfterFirstUse: Cannot Change Use Method after the first use",
"4F" => "CannotChangeUsesAfterFirstUse: Cannot Change Remaining or Available uses after the first use",
"50" => "CollectionNotFound: Collection Not Found on Metadata",
"51" => "InvalidCollectionUpdateAuthority: Collection Update Authority is invalid",
"52" => "CollectionMustBeAUniqueMasterEdition: Collection Must Be a Unique Master Edition v2",
"53" => "UseAuthorityRecordAlreadyExists: The Use Authority Record Already Exists, to modify it Revoke, then Approve",
"54" => "UseAuthorityRecordAlreadyRevoked: The Use Authority Record is empty or already revoked",
"55" => "Unusable: This token has no uses",
"56" => "NotEnoughUses: There are not enough Uses left on this token.",
"57" => "CollectionAuthorityRecordAlreadyExists: This Collection Authority Record Already Exists.",
"58" => "CollectionAuthorityDoesNotExist: This Collection Authoritty Record Does Not Exist.",
};

pub static TOKEN_VAULT: phf::Map<&'static str, &'static str> = phf_map! {};

0 comments on commit b18741c

Please sign in to comment.