suiclient-error-decoder
Version:
A comprehensive error decoder for Sui blockchain transactions with support for custom error codes
213 lines • 9.34 kB
JavaScript
// defaultErrors.ts file
export const MOVE_ABORT_ERROR_CODES = {
1000: "Unknown verification error",
1001: "Index out of bounds",
1003: "Invalid signature token",
1005: "Recursive datatype definition",
1006: "Field missing type ability",
1007: "Invalid fall through",
1009: "Negative stack size within block",
1011: "Invalid main function signature",
1012: "Duplicate element",
1013: "Invalid module handle",
1014: "Unimplemented handle",
1017: "Lookup failed",
1020: "Type mismatch",
1021: "Missing dependency",
1023: "Pop without drop ability",
1025: "Branch type mismatch error",
1026: "Abort type mismatch error",
1027: "Store local type mismatch error",
1028: "Store local unsafe to destroy error",
1029: "Unsafe return local or resource still borrowed",
1030: "Return type mismatch error",
1031: "Return borrowed mutable reference error",
1032: "Freeze reference type mismatch error",
1033: "Freeze reference exists mutable borrow error",
1034: "Borrow field type mismatch error",
1035: "Borrow field bad field error",
1036: "Field exists mutable borrow error",
1037: "Copy local unavailable error",
1038: "Copy local without copy ability",
1039: "Copy local exists borrow error",
1040: "Move local unavailable error",
1041: "Move local exists borrow error",
1042: "Borrow local reference error",
1043: "Borrow local unavailable error",
1044: "Borrow local exists borrow error",
1045: "Call type mismatch error",
1046: "Call borrowed mutable reference error",
1047: "Pack type mismatch error",
1048: "Unpack type mismatch error",
1049: "Read reference type mismatch error",
1050: "Read reference without copy ability",
1051: "Read reference exists mutable borrow error",
1052: "Write reference type mismatch error",
1053: "Write reference without drop ability",
1054: "Write reference exists borrow error",
1055: "Write reference no mutable reference error",
1056: "Integer operation type mismatch error",
1057: "Boolean operation type mismatch error",
1058: "Equality operation type mismatch error",
1059: "Exists without key ability or bad argument",
1060: "Borrow global type mismatch error",
1061: "Borrow global without key ability",
1062: "Move from type mismatch error",
1063: "Move from without key ability",
1064: "Move to type mismatch error",
1065: "Move to without key ability",
1067: "Module address does not match sender",
1068: "No module handles",
1069: "Positive stack size at block end",
1070: "Missing acquires annotation",
1071: "Extraneous acquires annotation",
1072: "Duplicate acquires annotation",
1073: "Invalid acquires annotation",
1074: "Global reference error",
1075: "Constraint not satisfied",
1076: "Number of type arguments mismatch",
1077: "Loop in instantiation graph",
1080: "Zero sized struct",
1081: "Linker error",
1082: "Invalid constant type",
1083: "Malformed constant data",
1084: "Empty code unit",
1085: "Invalid loop split",
1086: "Invalid loop break",
1087: "Invalid loop continue",
1088: "Unsafe return unused values without drop",
1089: "Too many locals",
1090: "Generic member opcode mismatch",
1091: "Function resolution failure",
1094: "Invalid operation in script",
1095: "Duplicate module name",
1096: "Backward incompatible module update",
1097: "Cyclic module dependency",
1098: "Number of arguments mismatch",
1099: "Invalid param type for deserialization",
1100: "Failed to deserialize argument",
1101: "Number of signer arguments mismatch",
1102: "Called script visible from non script visible",
1103: "Execute entry function called on non entry function",
1104: "Invalid friend declaration with self",
1105: "Invalid friend declaration with modules outside account address",
1106: "Invalid friend declaration with modules in dependencies",
1107: "Cyclic module friendship",
1108: "Invalid phantom type param position",
1109: "Vector update exists mutable borrow error",
1110: "Vector borrow element exists mutable borrow error",
1111: "Loop max depth reached",
1112: "Too many type parameters",
1113: "Too many parameters",
1114: "Too many basic blocks",
1115: "Value stack overflow",
1116: "Too many type nodes",
1117: "Value stack push overflow",
1118: "Max dependency depth reached",
1119: "Max function definitions reached",
1120: "Max struct definitions reached",
1121: "Max field definitions reached",
1122: "Too many back edges",
1128: "Too many vector elements",
1129: "Identifier too long",
1130: "Program too complex",
1131: "Enum switch bad operand",
1132: "Enum type mismatch",
1133: "Invalid enum switch",
1134: "Zero sized enum",
1135: "Max variants reached",
};
export const SUI_SYSTEM_ERROR_CODES = {
2000: "Unknown invariant violation error",
2003: "Empty value stack",
2005: "Program counter overflow",
2006: "Verification error",
2008: "Storage error",
2009: "Internal type error",
2010: "Event key mismatch",
2011: "Unreachable",
2012: "VM startup failure",
2015: "Unexpected error from known Move function",
2016: "Verifier invariant violation",
2017: "Unexpected verifier error",
2018: "Unexpected deserialization error",
2019: "Failed to serialize write set changes",
2020: "Failed to deserialize resource",
2021: "Type resolution failure",
2022: "Duplicate native function",
2023: "Arithmetic overflow",
3000: "Unknown binary error",
3001: "Malformed binary",
3002: "Bad magic",
3003: "Unknown version",
3004: "Unknown table type",
3005: "Unknown signature type",
3006: "Unknown serialized type",
3007: "Unknown opcode",
3008: "Bad header table",
3009: "Unexpected signature type",
3010: "Duplicate table",
3013: "Unknown ability",
3014: "Unknown native struct flag",
3017: "Bad u16",
3018: "Bad u32",
3019: "Bad u64",
3020: "Bad u128",
3021: "Bad u256",
3022: "Value serialization error",
3023: "Value deserialization error",
3024: "Code deserialization error",
3025: "Invalid flag bits",
3026: "Trailing bytes",
3027: "Unknown enum flag",
3028: "Unknown jump table flag",
};
export const TRANSACTION_ERROR_CODES = {
// These are string-based enums, not numeric codes
INSUFFICIENT_GAS: "Insufficient gas.",
INVALID_GAS_OBJECT: "Invalid Gas object.",
INVARIANT_VIOLATION: "Invariant violation.",
OBJECT_TOO_BIG: "Move object is larger than the maximum allowed size.",
PACKAGE_TOO_BIG: "Package is larger than the maximum allowed size.",
CIRCULAR_OBJECT_OWNERSHIP: "Circular object ownership.",
INSUFFICIENT_COIN_BALANCE: "Insufficient coin balance for requested operation.",
COIN_BALANCE_OVERFLOW: "Coin balance overflowed an u64.",
PUBLISH_ERROR_NON_ZERO_ADDRESS: "Publish error, non-zero address.",
SUI_MOVE_VERIFICATION_ERROR: "Sui Move bytecode verification error.",
MOVE_PRIMITIVE_RUNTIME_ERROR: "Move primitive runtime error.",
MOVE_ABORT: "Move runtime abort.",
VM_VERIFICATION_OR_DESERIALIZATION_ERROR: "Bytecode verification error.",
VM_INVARIANT_VIOLATION: "MoveVm invariant violation.",
FUNCTION_NOT_FOUND: "Function not found.",
ARITY_MISMATCH: "Arity mismatch for Move function.",
TYPE_ARITY_MISMATCH: "Type arity mismatch for Move function.",
NON_ENTRY_FUNCTION_INVOKED: "Non-entry function invoked.",
COMMAND_ARGUMENT_ERROR: "Invalid command argument.",
TYPE_ARGUMENT_ERROR: "Type argument error.",
UNUSED_VALUE_WITHOUT_DROP: "Unused result without the drop ability.",
INVALID_PUBLIC_FUNCTION_RETURN_TYPE: "Invalid public Move function signature.",
INVALID_TRANSFER_OBJECT: "Invalid transfer object.",
EFFECTS_TOO_LARGE: "Effects from the transaction are too large.",
PUBLISH_UPGRADE_MISSING_DEPENDENCY: "Publish or Upgrade is missing dependency.",
PACKAGE_UPGRADE_ERROR: "Invalid package upgrade.",
WRITTEN_OBJECTS_TOO_LARGE: "Transaction tried to write objects too large to storage.",
CERTIFICATE_DENIED: "Certificate is on the deny list.",
SUI_MOVE_VERIFICATION_TIMEDOUT: "Sui Move bytecode verification timed out.",
SHARED_OBJECT_OPERATION_NOT_ALLOWED: "The requested shared object operation is not allowed.",
INPUT_OBJECT_DELETED: "Requested shared object has been deleted.",
EXECUTION_CANCELED_DUE_TO_SHARED_OBJECT_CONGESTION: "Certificate is canceled due to congestion on shared objects.",
ADDRESS_DENIED_FOR_COIN: "Address is denied for this coin type.",
COIN_TYPE_GLOBAL_PAUSE: "Coin type is globally paused for use.",
EXECUTION_CANCELED_DUE_TO_RANDOMNESS_UNAVAILABLE: "Certificate is canceled because randomness could not be generated this epoch.",
};
/**
* Default Sui and Move error codes
* These can be updated as the ecosystem evolves
*/
export const DEFAULT_SUI_ERROR_CODES = {
// Move Abort Codes
...MOVE_ABORT_ERROR_CODES,
// Sui System Error Codes
...SUI_SYSTEM_ERROR_CODES,
};
//# sourceMappingURL=defaultErrors.js.map