export enum ErrorCode { /////////////////// // Generic Errors // Unknown Error UNKNOWN_ERROR = 'UNKNOWN_ERROR', // Not Implemented NOT_IMPLEMENTED = 'NOT_IMPLEMENTED', // Unsupported Operation // - operation UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION', // Network Error (i.e. Ethereum Network, such as an invalid chain ID) // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) NETWORK_ERROR = 'NETWORK_ERROR', // Some sort of bad response from the server SERVER_ERROR = 'SERVER_ERROR', // Timeout TIMEOUT = 'TIMEOUT', /////////////////// // Operational Errors // Buffer Overrun BUFFER_OVERRUN = 'BUFFER_OVERRUN', // Numeric Fault // - operation: the operation being executed // - fault: the reason this faulted NUMERIC_FAULT = 'NUMERIC_FAULT', /////////////////// // Argument Errors // Missing new operator to an object // - name: The name of the class MISSING_NEW = 'MISSING_NEW', // Invalid argument (e.g. value is incompatible with type) to a function: // - argument: The argument name that was invalid // - value: The value of the argument INVALID_ARGUMENT = 'INVALID_ARGUMENT', // Missing argument to a function: // - count: The number of arguments received // - expectedCount: The number of arguments expected MISSING_ARGUMENT = 'MISSING_ARGUMENT', // Too many arguments // - count: The number of arguments received // - expectedCount: The number of arguments expected UNEXPECTED_ARGUMENT = 'UNEXPECTED_ARGUMENT', /////////////////// // Blockchain Errors // Call exception // - transaction: the transaction // - address?: the contract address // - args?: The arguments passed into the function // - method?: The Solidity method signature // - errorSignature?: The EIP848 error signature // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") CALL_EXCEPTION = 'CALL_EXCEPTION', // Insufficient funds (< value + gasLimit * gasPrice) // - transaction: the transaction attempted INSUFFICIENT_FUNDS = 'INSUFFICIENT_FUNDS', // Nonce has already been used // - transaction: the transaction attempted NONCE_EXPIRED = 'NONCE_EXPIRED', // The replacement fee for the transaction is too low // - transaction: the transaction attempted REPLACEMENT_UNDERPRICED = 'REPLACEMENT_UNDERPRICED', // The gas limit could not be estimated // - transaction: the transaction passed to estimateGas UNPREDICTABLE_GAS_LIMIT = 'UNPREDICTABLE_GAS_LIMIT', // The transaction was replaced by one with a higher gas price // - reason: "cancelled", "replaced" or "repriced" // - cancelled: true if reason == "cancelled" or reason == "replaced") // - hash: original transaction hash // - replacement: the full TransactionsResponse for the replacement // - receipt: the receipt of the replacement TRANSACTION_REPLACED = 'TRANSACTION_REPLACED', ACTION_REJECTED = 'ACTION_REJECTED', } export const CUSTOM_ERROR_CODES = { MAX_PRIORITY_FEE_PER_GAS_HIGHER_THAN_MAX_FEE_PER_GAS: 'MAX_PRIORITY_FEE_PER_GAS_HIGHER_THAN_MAX_FEE_PER_GAS', MAX_FEE_PER_GAS_LESS_THAN_BLOCK_BASE_FEE: 'MAX_FEE_PER_GAS_LESS_THAN_BLOCK_BASE_FEE', TRANSACTION_RAN_OUT_OF_GAS: 'TRANSACTION_RAN_OUT_OF_GAS', GAS_LIMIT_TOO_LOW: 'GAS_LIMIT_TOO_LOW', }; export const NESTED_ERROR_CODES = { REJECTED_TRANSACTION: 4001, REQUIRE_TRANSACTION: -32603, ERROR_WHILE_FORMATTING_OUTPUT_FROM_RPC: -32603, TRANSACTION_UNDERPRICED: -32000, }; export const TEXT_CRITICAL_ERROR_CODES = { UNPREDICTABLE_GAS_LIMIT: 'UNPREDICTABLE_GAS_LIMIT', ACTION_REJECTED: 'ACTION_REJECTED', CALL_EXCEPTION: 'CALL_EXCEPTION', }; export const WEI_MULTIPLIER = '1000000000';