Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

web3-errors

Package Overview
Dependencies
Maintainers
4
Versions
327
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-errors - npm Package Compare versions

Comparing version 1.0.3-dev.ebd0c57.0 to 1.0.3-dev.ed2770c.0

lib/commonjs/errors/rpc_error_messages.d.ts

2

lib/commonjs/error_codes.d.ts

@@ -63,2 +63,4 @@ export declare const ERR_RESPONSE = 100;

export declare const ERR_TX_INVALID_PROPERTIES_FOR_TYPE = 439;
export declare const ERR_TX_MISSING_GAS_INNER_ERROR = 440;
export declare const ERR_TX_GAS_MISMATCH_INNER_ERROR = 441;
export declare const ERR_CONN = 500;

@@ -65,0 +67,0 @@ export declare const ERR_CONN_INVALID = 501;

10

lib/commonjs/error_codes.js

@@ -20,4 +20,4 @@ "use strict";

exports.ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL = exports.ERR_TX_POLLING_TIMEOUT = exports.ERR_TX_DATA_AND_INPUT = exports.ERR_TX_UNSUPPORTED_TYPE = exports.ERR_TX_UNSUPPORTED_EIP_1559 = exports.ERR_TX_UNABLE_TO_POPULATE_NONCE = exports.ERR_TX_INVALID_NONCE_OR_CHAIN_ID = exports.ERR_TX_INVALID_OBJECT = exports.ERR_TX_INVALID_LEGACY_FEE_MARKET = exports.ERR_TX_INVALID_FEE_MARKET_GAS_PRICE = exports.ERR_TX_INVALID_FEE_MARKET_GAS = exports.ERR_TX_INVALID_LEGACY_GAS = exports.ERR_TX_MISSING_GAS = exports.ERR_TX_MISSING_CHAIN_INFO = exports.ERR_TX_INVALID_CHAIN_INFO = exports.ERR_TX_CHAIN_ID_MISMATCH = exports.ERR_TX_MISSING_CUSTOM_CHAIN_ID = exports.ERR_TX_MISSING_CUSTOM_CHAIN = exports.ERR_TX_INVALID_CALL = exports.ERR_TX_INVALID_SENDER = exports.ERR_RAW_TX_UNDEFINED = exports.ERR_TX_OUT_OF_GAS = exports.ERR_TX_REVERT_WITHOUT_REASON = exports.ERR_TX_CONTRACT_NOT_STORED = exports.ERR_TX_NO_CONTRACT_ADDRESS = exports.ERR_TX_REVERT_TRANSACTION = exports.ERR_TX_REVERT_INSTRUCTION = exports.ERR_TX = exports.ERR_CONTRACT_TX_DATA_AND_INPUT = exports.ERR_CONTRACT_EXECUTION_REVERTED = exports.ERR_CONTRACT_INSTANTIATION = exports.ERR_CONTRACT_MISSING_FROM_ADDRESS = exports.ERR_CONTRACT_MISSING_ADDRESS = exports.ERR_CONTRACT_MISSING_DEPLOY_DATA = exports.ERR_CONTRACT_RESERVED_EVENT = exports.ERR_CONTRACT_EVENT_NOT_EXISTS = exports.ERR_CONTRACT_REQUIRED_CALLBACK = exports.ERR_CONTRACT_ABI_MISSING = exports.ERR_CONTRACT_RESOLVER_MISSING = exports.ERR_CONTRACT = exports.ERR_INVALID_METHOD_PARAMS = exports.ERR_EXISTING_PLUGIN_NAMESPACE = exports.ERR_ABI_ENCODING = exports.ERR_OPERATION_ABORT = exports.ERR_OPERATION_TIMEOUT = exports.ERR_METHOD_NOT_IMPLEMENTED = exports.ERR_FORMATTERS = exports.ERR_PARAM = exports.ERR_INVALID_RESPONSE = exports.ERR_RESPONSE = void 0;
exports.ERR_INVALID_ADDRESS = exports.ERR_INVALID_UNIT = exports.ERR_INVALID_NUMBER = exports.ERR_INVALID_BYTES = exports.ERR_INVALID_STRING = exports.ERR_ENS_NETWORK_NOT_SYNCED = exports.ERR_ENS_UNSUPPORTED_NETWORK = exports.ERR_ENS_CHECK_INTERFACE_SUPPORT = exports.JSONRPC_ERR_CHAIN_DISCONNECTED = exports.JSONRPC_ERR_DISCONNECTED = exports.JSONRPC_ERR_UNSUPPORTED_METHOD = exports.JSONRPC_ERR_UNAUTHORIZED = exports.JSONRPC_ERR_REJECTED_REQUEST = exports.GENESIS_BLOCK_NUMBER = exports.ERR_INVALID_SIGNATURE = exports.ERR_SIGNATURE_FAILED = exports.ERR_PBKDF2_ITERATIONS = exports.ERR_INVALID_KEYSTORE = exports.ERR_IV_LENGTH = exports.ERR_INVALID_PASSWORD = exports.ERR_KEY_VERSION_UNSUPPORTED = exports.ERR_KEY_DERIVATION_FAIL = exports.ERR_UNSUPPORTED_KDF = exports.ERR_INVALID_PRIVATE_KEY = exports.ERR_PRIVATE_KEY_LENGTH = exports.ERR_WS_PROVIDER = exports.ERR_SUBSCRIPTION = exports.ERR_INVALID_CLIENT = exports.ERR_INVALID_PROVIDER = exports.ERR_PROVIDER = exports.ERR_REQ_ALREADY_SENT = exports.ERR_CONN_PENDING_REQUESTS = exports.ERR_CONN_MAX_ATTEMPTS = exports.ERR_CONN_CLOSE = exports.ERR_CONN_NOT_OPEN = exports.ERR_CONN_TIMEOUT = exports.ERR_CONN_INVALID = exports.ERR_CONN = exports.ERR_TX_INVALID_PROPERTIES_FOR_TYPE = exports.ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR = exports.ERR_TX_INVALID_RECEIVER = exports.ERR_TX_HARDFORK_MISMATCH = exports.ERR_TX_CHAIN_MISMATCH = exports.ERR_TX_GAS_MISMATCH = exports.ERR_TX_SIGNING = exports.ERR_TX_BLOCK_TIMEOUT = exports.ERR_TX_SEND_TIMEOUT = exports.ERR_TX_NOT_FOUND = exports.ERR_TX_LOCAL_WALLET_NOT_AVAILABLE = exports.ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER = void 0;
exports.ERR_RPC_NOT_SUPPORTED = exports.ERR_RPC_LIMIT_EXCEEDED = exports.ERR_RPC_UNSUPPORTED_METHOD = exports.ERR_RPC_TRANSACTION_REJECTED = exports.ERR_RPC_UNAVAILABLE_RESOURCE = exports.ERR_RPC_MISSING_RESOURCE = exports.ERR_RPC_INVALID_INPUT = exports.ERR_RPC_INTERNAL_ERROR = exports.ERR_RPC_INVALID_PARAMS = exports.ERR_RPC_INVALID_METHOD = exports.ERR_RPC_INVALID_REQUEST = exports.ERR_RPC_INVALID_JSON = exports.ERR_CORE_CHAIN_MISMATCH = exports.ERR_CORE_HARDFORK_MISMATCH = exports.ERR_VALIDATION = exports.ERR_INVALID_NIBBLE_WIDTH = exports.ERR_INVALID_TYPE_ABI = exports.ERR_INVALID_BLOCK = exports.ERR_INVALID_LARGE_VALUE = exports.ERR_INVALID_SIZE = exports.ERR_INVALID_UNSIGNED_INTEGER = exports.ERR_INVALID_BOOLEAN = exports.ERR_INVALID_TYPE = exports.ERR_INVALID_HEX = void 0;
exports.ERR_INVALID_NUMBER = exports.ERR_INVALID_BYTES = exports.ERR_INVALID_STRING = exports.ERR_ENS_NETWORK_NOT_SYNCED = exports.ERR_ENS_UNSUPPORTED_NETWORK = exports.ERR_ENS_CHECK_INTERFACE_SUPPORT = exports.JSONRPC_ERR_CHAIN_DISCONNECTED = exports.JSONRPC_ERR_DISCONNECTED = exports.JSONRPC_ERR_UNSUPPORTED_METHOD = exports.JSONRPC_ERR_UNAUTHORIZED = exports.JSONRPC_ERR_REJECTED_REQUEST = exports.GENESIS_BLOCK_NUMBER = exports.ERR_INVALID_SIGNATURE = exports.ERR_SIGNATURE_FAILED = exports.ERR_PBKDF2_ITERATIONS = exports.ERR_INVALID_KEYSTORE = exports.ERR_IV_LENGTH = exports.ERR_INVALID_PASSWORD = exports.ERR_KEY_VERSION_UNSUPPORTED = exports.ERR_KEY_DERIVATION_FAIL = exports.ERR_UNSUPPORTED_KDF = exports.ERR_INVALID_PRIVATE_KEY = exports.ERR_PRIVATE_KEY_LENGTH = exports.ERR_WS_PROVIDER = exports.ERR_SUBSCRIPTION = exports.ERR_INVALID_CLIENT = exports.ERR_INVALID_PROVIDER = exports.ERR_PROVIDER = exports.ERR_REQ_ALREADY_SENT = exports.ERR_CONN_PENDING_REQUESTS = exports.ERR_CONN_MAX_ATTEMPTS = exports.ERR_CONN_CLOSE = exports.ERR_CONN_NOT_OPEN = exports.ERR_CONN_TIMEOUT = exports.ERR_CONN_INVALID = exports.ERR_CONN = exports.ERR_TX_GAS_MISMATCH_INNER_ERROR = exports.ERR_TX_MISSING_GAS_INNER_ERROR = exports.ERR_TX_INVALID_PROPERTIES_FOR_TYPE = exports.ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR = exports.ERR_TX_INVALID_RECEIVER = exports.ERR_TX_HARDFORK_MISMATCH = exports.ERR_TX_CHAIN_MISMATCH = exports.ERR_TX_GAS_MISMATCH = exports.ERR_TX_SIGNING = exports.ERR_TX_BLOCK_TIMEOUT = exports.ERR_TX_SEND_TIMEOUT = exports.ERR_TX_NOT_FOUND = exports.ERR_TX_LOCAL_WALLET_NOT_AVAILABLE = exports.ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER = void 0;
exports.ERR_RPC_NOT_SUPPORTED = exports.ERR_RPC_LIMIT_EXCEEDED = exports.ERR_RPC_UNSUPPORTED_METHOD = exports.ERR_RPC_TRANSACTION_REJECTED = exports.ERR_RPC_UNAVAILABLE_RESOURCE = exports.ERR_RPC_MISSING_RESOURCE = exports.ERR_RPC_INVALID_INPUT = exports.ERR_RPC_INTERNAL_ERROR = exports.ERR_RPC_INVALID_PARAMS = exports.ERR_RPC_INVALID_METHOD = exports.ERR_RPC_INVALID_REQUEST = exports.ERR_RPC_INVALID_JSON = exports.ERR_CORE_CHAIN_MISMATCH = exports.ERR_CORE_HARDFORK_MISMATCH = exports.ERR_VALIDATION = exports.ERR_INVALID_NIBBLE_WIDTH = exports.ERR_INVALID_TYPE_ABI = exports.ERR_INVALID_BLOCK = exports.ERR_INVALID_LARGE_VALUE = exports.ERR_INVALID_SIZE = exports.ERR_INVALID_UNSIGNED_INTEGER = exports.ERR_INVALID_BOOLEAN = exports.ERR_INVALID_TYPE = exports.ERR_INVALID_HEX = exports.ERR_INVALID_ADDRESS = exports.ERR_INVALID_UNIT = void 0;
// Response error

@@ -89,2 +89,4 @@ exports.ERR_RESPONSE = 100;

exports.ERR_TX_INVALID_PROPERTIES_FOR_TYPE = 439;
exports.ERR_TX_MISSING_GAS_INNER_ERROR = 440;
exports.ERR_TX_GAS_MISMATCH_INNER_ERROR = 441;
// Connection error codes

@@ -119,2 +121,3 @@ exports.ERR_CONN = 500;

exports.GENESIS_BLOCK_NUMBER = '0x0';
// RPC error codes (EIP-1193)
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors

@@ -150,3 +153,4 @@ exports.JSONRPC_ERR_REJECTED_REQUEST = 4001;

exports.ERR_CORE_CHAIN_MISMATCH = 1102;
// rpc error codes EIP-1474
// RPC error codes (EIP-1474)
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
exports.ERR_RPC_INVALID_JSON = -32700;

@@ -153,0 +157,0 @@ exports.ERR_RPC_INVALID_REQUEST = -32600;

@@ -19,2 +19,7 @@ import { JsonRpcResponseWithError, JsonRpcId, JsonRpcError } from 'web3-types';

}
export declare class EIP1193ProviderRpcError extends BaseWeb3Error {
code: number;
data?: unknown;
constructor(code: number, data?: unknown);
}
export declare class ParseError extends RpcError {

@@ -21,0 +26,0 @@ code: number;

@@ -19,8 +19,9 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.rpcErrorsMap = exports.LimitExceededError = exports.TransactionRejectedError = exports.VersionNotSupportedError = exports.ResourcesNotFoundError = exports.ResourceUnavailableError = exports.MethodNotSupported = exports.InvalidInputError = exports.InternalError = exports.InvalidParamsError = exports.MethodNotFoundError = exports.InvalidRequestError = exports.ParseError = exports.RpcError = void 0;
exports.rpcErrorsMap = exports.LimitExceededError = exports.TransactionRejectedError = exports.VersionNotSupportedError = exports.ResourcesNotFoundError = exports.ResourceUnavailableError = exports.MethodNotSupported = exports.InvalidInputError = exports.InternalError = exports.InvalidParamsError = exports.MethodNotFoundError = exports.InvalidRequestError = exports.ParseError = exports.EIP1193ProviderRpcError = exports.RpcError = void 0;
const web3_error_base_js_1 = require("../web3_error_base.js");
const error_codes_js_1 = require("../error_codes.js");
const rpc_error_messages_js_1 = require("./rpc_error_messages.js");
class RpcError extends web3_error_base_js_1.BaseWeb3Error {
constructor(rpcError, message) {
super(message !== null && message !== void 0 ? message : `An Rpc error has occured with a code of ${rpcError.error.code}`);
super(message !== null && message !== void 0 ? message : rpc_error_messages_js_1.genericRpcErrorMessageTemplate.replace('*code*', rpcError.error.code.toString()));
this.code = rpcError.error.code;

@@ -36,5 +37,27 @@ this.id = rpcError.id;

exports.RpcError = RpcError;
class EIP1193ProviderRpcError extends web3_error_base_js_1.BaseWeb3Error {
constructor(code, data) {
var _a, _b, _c, _d;
if (!code) {
// this case should ideally not happen
super();
}
else if ((_a = rpc_error_messages_js_1.RpcErrorMessages[code]) === null || _a === void 0 ? void 0 : _a.message) {
super(rpc_error_messages_js_1.RpcErrorMessages[code].message);
}
else {
// Retrieve the status code object for the given code from the table, by searching through the appropriate range
const statusCodeRange = Object.keys(rpc_error_messages_js_1.RpcErrorMessages).find(statusCode => typeof statusCode === 'string' &&
code >= parseInt(statusCode.split('-')[0], 10) &&
code <= parseInt(statusCode.split('-')[1], 10));
super((_c = (_b = rpc_error_messages_js_1.RpcErrorMessages[statusCodeRange !== null && statusCodeRange !== void 0 ? statusCodeRange : '']) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : rpc_error_messages_js_1.genericRpcErrorMessageTemplate.replace('*code*', (_d = code === null || code === void 0 ? void 0 : code.toString()) !== null && _d !== void 0 ? _d : '""'));
}
this.code = code;
this.data = data;
}
}
exports.EIP1193ProviderRpcError = EIP1193ProviderRpcError;
class ParseError extends RpcError {
constructor(rpcError) {
super(rpcError, 'Parse error');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_INVALID_JSON].message);
this.code = error_codes_js_1.ERR_RPC_INVALID_JSON;

@@ -46,3 +69,3 @@ }

constructor(rpcError) {
super(rpcError, 'Invalid request');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_INVALID_REQUEST].message);
this.code = error_codes_js_1.ERR_RPC_INVALID_REQUEST;

@@ -54,3 +77,3 @@ }

constructor(rpcError) {
super(rpcError, 'Method not found');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_INVALID_METHOD].message);
this.code = error_codes_js_1.ERR_RPC_INVALID_METHOD;

@@ -62,3 +85,3 @@ }

constructor(rpcError) {
super(rpcError, 'Invalid request');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_INVALID_PARAMS].message);
this.code = error_codes_js_1.ERR_RPC_INVALID_PARAMS;

@@ -70,3 +93,3 @@ }

constructor(rpcError) {
super(rpcError, 'Internal error');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_INTERNAL_ERROR].message);
this.code = error_codes_js_1.ERR_RPC_INTERNAL_ERROR;

@@ -78,3 +101,3 @@ }

constructor(rpcError) {
super(rpcError, 'Invalid input');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_INVALID_INPUT].message);
this.code = error_codes_js_1.ERR_RPC_INVALID_INPUT;

@@ -86,3 +109,3 @@ }

constructor(rpcError) {
super(rpcError, 'Method not supported');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_UNSUPPORTED_METHOD].message);
this.code = error_codes_js_1.ERR_RPC_UNSUPPORTED_METHOD;

@@ -94,3 +117,3 @@ }

constructor(rpcError) {
super(rpcError, 'Resource unavailable');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_UNAVAILABLE_RESOURCE].message);
this.code = error_codes_js_1.ERR_RPC_UNAVAILABLE_RESOURCE;

@@ -102,3 +125,3 @@ }

constructor(rpcError) {
super(rpcError, 'Resource not found');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_MISSING_RESOURCE].message);
this.code = error_codes_js_1.ERR_RPC_MISSING_RESOURCE;

@@ -110,3 +133,3 @@ }

constructor(rpcError) {
super(rpcError, 'JSON-RPC version not supported');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_NOT_SUPPORTED].message);
this.code = error_codes_js_1.ERR_RPC_NOT_SUPPORTED;

@@ -118,3 +141,3 @@ }

constructor(rpcError) {
super(rpcError, 'Transaction rejected');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_TRANSACTION_REJECTED].message);
this.code = error_codes_js_1.ERR_RPC_TRANSACTION_REJECTED;

@@ -126,3 +149,3 @@ }

constructor(rpcError) {
super(rpcError, 'Limit exceeded');
super(rpcError, rpc_error_messages_js_1.RpcErrorMessages[error_codes_js_1.ERR_RPC_LIMIT_EXCEEDED].message);
this.code = error_codes_js_1.ERR_RPC_LIMIT_EXCEEDED;

@@ -129,0 +152,0 @@ }

@@ -153,2 +153,6 @@ import { Bytes, HexString, Numbers, TransactionReceipt, Web3ValidationErrorObject } from 'web3-types';

}
export declare class MissingGasInnerError extends BaseWeb3Error {
code: number;
constructor();
}
export declare class MissingGasError extends InvalidValueError {

@@ -163,2 +167,6 @@ code: number;

}
export declare class TransactionGasMismatchInnerError extends BaseWeb3Error {
code: number;
constructor();
}
export declare class TransactionGasMismatchError extends InvalidValueError {

@@ -165,0 +173,0 @@ code: number;

@@ -19,3 +19,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidPropertiesForTransactionTypeError = exports.LocalWalletNotAvailableError = exports.TransactionSigningError = exports.TransactionReceiptMissingBlockNumberError = exports.TransactionMissingReceiptOrBlockHashError = exports.TransactionBlockTimeoutError = exports.TransactionPollingTimeoutError = exports.TransactionSendTimeoutError = exports.TransactionDataAndInputError = exports.UnsupportedTransactionTypeError = exports.Eip1559NotSupportedError = exports.UnableToPopulateNonceError = exports.InvalidNonceOrChainIdError = exports.InvalidTransactionObjectError = exports.UnsupportedFeeMarketError = exports.Eip1559GasPriceError = exports.InvalidMaxPriorityFeePerGasOrMaxFeePerGas = exports.InvalidGasOrGasPrice = exports.TransactionGasMismatchError = exports.MissingGasError = exports.MissingChainOrHardforkError = exports.CommonOrChainAndHardforkError = exports.HardforkMismatchError = exports.ChainMismatchError = exports.ChainIdMismatchError = exports.MissingCustomChainIdError = exports.MissingCustomChainError = exports.InvalidTransactionCall = exports.InvalidTransactionWithReceiver = exports.InvalidTransactionWithSender = exports.TransactionNotFound = exports.UndefinedRawTransactionError = exports.TransactionOutOfGasError = exports.TransactionRevertedWithoutReasonError = exports.ContractCodeNotStoredError = exports.NoContractAddressFoundError = exports.TransactionRevertWithCustomError = exports.TransactionRevertInstructionError = exports.RevertInstructionError = exports.TransactionError = void 0;
exports.InvalidPropertiesForTransactionTypeError = exports.LocalWalletNotAvailableError = exports.TransactionSigningError = exports.TransactionReceiptMissingBlockNumberError = exports.TransactionMissingReceiptOrBlockHashError = exports.TransactionBlockTimeoutError = exports.TransactionPollingTimeoutError = exports.TransactionSendTimeoutError = exports.TransactionDataAndInputError = exports.UnsupportedTransactionTypeError = exports.Eip1559NotSupportedError = exports.UnableToPopulateNonceError = exports.InvalidNonceOrChainIdError = exports.InvalidTransactionObjectError = exports.UnsupportedFeeMarketError = exports.Eip1559GasPriceError = exports.InvalidMaxPriorityFeePerGasOrMaxFeePerGas = exports.InvalidGasOrGasPrice = exports.TransactionGasMismatchError = exports.TransactionGasMismatchInnerError = exports.MissingGasError = exports.MissingGasInnerError = exports.MissingChainOrHardforkError = exports.CommonOrChainAndHardforkError = exports.HardforkMismatchError = exports.ChainMismatchError = exports.ChainIdMismatchError = exports.MissingCustomChainIdError = exports.MissingCustomChainError = exports.InvalidTransactionCall = exports.InvalidTransactionWithReceiver = exports.InvalidTransactionWithSender = exports.TransactionNotFound = exports.UndefinedRawTransactionError = exports.TransactionOutOfGasError = exports.TransactionRevertedWithoutReasonError = exports.ContractCodeNotStoredError = exports.NoContractAddressFoundError = exports.TransactionRevertWithCustomError = exports.TransactionRevertInstructionError = exports.RevertInstructionError = exports.TransactionError = void 0;
const error_codes_js_1 = require("../error_codes.js");

@@ -200,2 +200,9 @@ const web3_error_base_js_1 = require("../web3_error_base.js");

exports.MissingChainOrHardforkError = MissingChainOrHardforkError;
class MissingGasInnerError extends web3_error_base_js_1.BaseWeb3Error {
constructor() {
super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions');
this.code = error_codes_js_1.ERR_TX_MISSING_GAS_INNER_ERROR;
}
}
exports.MissingGasInnerError = MissingGasInnerError;
class MissingGasError extends web3_error_base_js_1.InvalidValueError {

@@ -206,5 +213,13 @@ constructor(value) {

this.code = error_codes_js_1.ERR_TX_MISSING_GAS;
this.innerError = new MissingGasInnerError();
}
}
exports.MissingGasError = MissingGasError;
class TransactionGasMismatchInnerError extends web3_error_base_js_1.BaseWeb3Error {
constructor() {
super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions, not both');
this.code = error_codes_js_1.ERR_TX_GAS_MISMATCH_INNER_ERROR;
}
}
exports.TransactionGasMismatchInnerError = TransactionGasMismatchInnerError;
class TransactionGasMismatchError extends web3_error_base_js_1.InvalidValueError {

@@ -215,2 +230,3 @@ constructor(value) {

this.code = error_codes_js_1.ERR_TX_GAS_MISMATCH;
this.innerError = new TransactionGasMismatchInnerError();
}

@@ -350,7 +366,3 @@ }

const invalidPropertyNames = [];
validationError.forEach(error => invalidPropertyNames.push(
// These errors are erroneously reported, error
// has type Web3ValidationErrorObject, but eslint doesn't recognize it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
error.keyword.match(/data.(.+)/)[1]));
validationError.forEach(error => invalidPropertyNames.push(error.keyword));
super(`The following properties are invalid for the transaction type ${txType}: ${invalidPropertyNames.join(', ')}`);

@@ -357,0 +369,0 @@ this.code = error_codes_js_1.ERR_TX_INVALID_PROPERTIES_FOR_TYPE;

@@ -15,1 +15,2 @@ export * from './error_codes.js';

export * from './errors/rpc_errors.js';
export * from './errors/rpc_error_messages.js';

@@ -47,2 +47,3 @@ "use strict";

__exportStar(require("./errors/rpc_errors.js"), exports);
__exportStar(require("./errors/rpc_error_messages.js"), exports);
//# sourceMappingURL=index.js.map

@@ -83,2 +83,4 @@ /*

export const ERR_TX_INVALID_PROPERTIES_FOR_TYPE = 439;
export const ERR_TX_MISSING_GAS_INNER_ERROR = 440;
export const ERR_TX_GAS_MISMATCH_INNER_ERROR = 441;
// Connection error codes

@@ -113,2 +115,3 @@ export const ERR_CONN = 500;

export const GENESIS_BLOCK_NUMBER = '0x0';
// RPC error codes (EIP-1193)
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors

@@ -144,3 +147,4 @@ export const JSONRPC_ERR_REJECTED_REQUEST = 4001;

export const ERR_CORE_CHAIN_MISMATCH = 1102;
// rpc error codes EIP-1474
// RPC error codes (EIP-1474)
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
export const ERR_RPC_INVALID_JSON = -32700;

@@ -147,0 +151,0 @@ export const ERR_RPC_INVALID_REQUEST = -32600;

@@ -19,5 +19,6 @@ /*

import { ERR_RPC_INTERNAL_ERROR, ERR_RPC_INVALID_INPUT, ERR_RPC_INVALID_JSON, ERR_RPC_INVALID_METHOD, ERR_RPC_INVALID_PARAMS, ERR_RPC_INVALID_REQUEST, ERR_RPC_LIMIT_EXCEEDED, ERR_RPC_MISSING_RESOURCE, ERR_RPC_NOT_SUPPORTED, ERR_RPC_TRANSACTION_REJECTED, ERR_RPC_UNAVAILABLE_RESOURCE, ERR_RPC_UNSUPPORTED_METHOD, } from '../error_codes.js';
import { RpcErrorMessages, genericRpcErrorMessageTemplate } from './rpc_error_messages.js';
export class RpcError extends BaseWeb3Error {
constructor(rpcError, message) {
super(message !== null && message !== void 0 ? message : `An Rpc error has occured with a code of ${rpcError.error.code}`);
super(message !== null && message !== void 0 ? message : genericRpcErrorMessageTemplate.replace('*code*', rpcError.error.code.toString()));
this.code = rpcError.error.code;

@@ -32,5 +33,26 @@ this.id = rpcError.id;

}
export class EIP1193ProviderRpcError extends BaseWeb3Error {
constructor(code, data) {
var _a, _b, _c, _d;
if (!code) {
// this case should ideally not happen
super();
}
else if ((_a = RpcErrorMessages[code]) === null || _a === void 0 ? void 0 : _a.message) {
super(RpcErrorMessages[code].message);
}
else {
// Retrieve the status code object for the given code from the table, by searching through the appropriate range
const statusCodeRange = Object.keys(RpcErrorMessages).find(statusCode => typeof statusCode === 'string' &&
code >= parseInt(statusCode.split('-')[0], 10) &&
code <= parseInt(statusCode.split('-')[1], 10));
super((_c = (_b = RpcErrorMessages[statusCodeRange !== null && statusCodeRange !== void 0 ? statusCodeRange : '']) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : genericRpcErrorMessageTemplate.replace('*code*', (_d = code === null || code === void 0 ? void 0 : code.toString()) !== null && _d !== void 0 ? _d : '""'));
}
this.code = code;
this.data = data;
}
}
export class ParseError extends RpcError {
constructor(rpcError) {
super(rpcError, 'Parse error');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_JSON].message);
this.code = ERR_RPC_INVALID_JSON;

@@ -41,3 +63,3 @@ }

constructor(rpcError) {
super(rpcError, 'Invalid request');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_REQUEST].message);
this.code = ERR_RPC_INVALID_REQUEST;

@@ -48,3 +70,3 @@ }

constructor(rpcError) {
super(rpcError, 'Method not found');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_METHOD].message);
this.code = ERR_RPC_INVALID_METHOD;

@@ -55,3 +77,3 @@ }

constructor(rpcError) {
super(rpcError, 'Invalid request');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_PARAMS].message);
this.code = ERR_RPC_INVALID_PARAMS;

@@ -62,3 +84,3 @@ }

constructor(rpcError) {
super(rpcError, 'Internal error');
super(rpcError, RpcErrorMessages[ERR_RPC_INTERNAL_ERROR].message);
this.code = ERR_RPC_INTERNAL_ERROR;

@@ -69,3 +91,3 @@ }

constructor(rpcError) {
super(rpcError, 'Invalid input');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_INPUT].message);
this.code = ERR_RPC_INVALID_INPUT;

@@ -76,3 +98,3 @@ }

constructor(rpcError) {
super(rpcError, 'Method not supported');
super(rpcError, RpcErrorMessages[ERR_RPC_UNSUPPORTED_METHOD].message);
this.code = ERR_RPC_UNSUPPORTED_METHOD;

@@ -83,3 +105,3 @@ }

constructor(rpcError) {
super(rpcError, 'Resource unavailable');
super(rpcError, RpcErrorMessages[ERR_RPC_UNAVAILABLE_RESOURCE].message);
this.code = ERR_RPC_UNAVAILABLE_RESOURCE;

@@ -90,3 +112,3 @@ }

constructor(rpcError) {
super(rpcError, 'Resource not found');
super(rpcError, RpcErrorMessages[ERR_RPC_MISSING_RESOURCE].message);
this.code = ERR_RPC_MISSING_RESOURCE;

@@ -97,3 +119,3 @@ }

constructor(rpcError) {
super(rpcError, 'JSON-RPC version not supported');
super(rpcError, RpcErrorMessages[ERR_RPC_NOT_SUPPORTED].message);
this.code = ERR_RPC_NOT_SUPPORTED;

@@ -104,3 +126,3 @@ }

constructor(rpcError) {
super(rpcError, 'Transaction rejected');
super(rpcError, RpcErrorMessages[ERR_RPC_TRANSACTION_REJECTED].message);
this.code = ERR_RPC_TRANSACTION_REJECTED;

@@ -111,3 +133,3 @@ }

constructor(rpcError) {
super(rpcError, 'Limit exceeded');
super(rpcError, RpcErrorMessages[ERR_RPC_LIMIT_EXCEEDED].message);
this.code = ERR_RPC_LIMIT_EXCEEDED;

@@ -114,0 +136,0 @@ }

@@ -17,3 +17,3 @@ /*

*/
import { ERR_RAW_TX_UNDEFINED, ERR_TX, ERR_TX_BLOCK_TIMEOUT, ERR_TX_CONTRACT_NOT_STORED, ERR_TX_CHAIN_ID_MISMATCH, ERR_TX_DATA_AND_INPUT, ERR_TX_GAS_MISMATCH, ERR_TX_CHAIN_MISMATCH, ERR_TX_HARDFORK_MISMATCH, ERR_TX_INVALID_CALL, ERR_TX_INVALID_CHAIN_INFO, ERR_TX_INVALID_FEE_MARKET_GAS, ERR_TX_INVALID_FEE_MARKET_GAS_PRICE, ERR_TX_INVALID_LEGACY_FEE_MARKET, ERR_TX_INVALID_LEGACY_GAS, ERR_TX_INVALID_NONCE_OR_CHAIN_ID, ERR_TX_INVALID_OBJECT, ERR_TX_INVALID_SENDER, ERR_TX_INVALID_RECEIVER, ERR_TX_LOCAL_WALLET_NOT_AVAILABLE, ERR_TX_MISSING_CHAIN_INFO, ERR_TX_MISSING_CUSTOM_CHAIN, ERR_TX_MISSING_CUSTOM_CHAIN_ID, ERR_TX_MISSING_GAS, ERR_TX_NO_CONTRACT_ADDRESS, ERR_TX_NOT_FOUND, ERR_TX_OUT_OF_GAS, ERR_TX_POLLING_TIMEOUT, ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER, ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL, ERR_TX_REVERT_INSTRUCTION, ERR_TX_REVERT_TRANSACTION, ERR_TX_REVERT_WITHOUT_REASON, ERR_TX_SEND_TIMEOUT, ERR_TX_SIGNING, ERR_TX_UNABLE_TO_POPULATE_NONCE, ERR_TX_UNSUPPORTED_EIP_1559, ERR_TX_UNSUPPORTED_TYPE, ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR, ERR_TX_INVALID_PROPERTIES_FOR_TYPE, } from '../error_codes.js';
import { ERR_RAW_TX_UNDEFINED, ERR_TX, ERR_TX_BLOCK_TIMEOUT, ERR_TX_CONTRACT_NOT_STORED, ERR_TX_CHAIN_ID_MISMATCH, ERR_TX_DATA_AND_INPUT, ERR_TX_GAS_MISMATCH, ERR_TX_CHAIN_MISMATCH, ERR_TX_HARDFORK_MISMATCH, ERR_TX_INVALID_CALL, ERR_TX_INVALID_CHAIN_INFO, ERR_TX_INVALID_FEE_MARKET_GAS, ERR_TX_INVALID_FEE_MARKET_GAS_PRICE, ERR_TX_INVALID_LEGACY_FEE_MARKET, ERR_TX_INVALID_LEGACY_GAS, ERR_TX_INVALID_NONCE_OR_CHAIN_ID, ERR_TX_INVALID_OBJECT, ERR_TX_INVALID_SENDER, ERR_TX_INVALID_RECEIVER, ERR_TX_LOCAL_WALLET_NOT_AVAILABLE, ERR_TX_MISSING_CHAIN_INFO, ERR_TX_MISSING_CUSTOM_CHAIN, ERR_TX_MISSING_CUSTOM_CHAIN_ID, ERR_TX_MISSING_GAS, ERR_TX_NO_CONTRACT_ADDRESS, ERR_TX_NOT_FOUND, ERR_TX_OUT_OF_GAS, ERR_TX_POLLING_TIMEOUT, ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER, ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL, ERR_TX_REVERT_INSTRUCTION, ERR_TX_REVERT_TRANSACTION, ERR_TX_REVERT_WITHOUT_REASON, ERR_TX_SEND_TIMEOUT, ERR_TX_SIGNING, ERR_TX_UNABLE_TO_POPULATE_NONCE, ERR_TX_UNSUPPORTED_EIP_1559, ERR_TX_UNSUPPORTED_TYPE, ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR, ERR_TX_INVALID_PROPERTIES_FOR_TYPE, ERR_TX_MISSING_GAS_INNER_ERROR, ERR_TX_GAS_MISMATCH_INNER_ERROR, } from '../error_codes.js';
import { InvalidValueError, BaseWeb3Error } from '../web3_error_base.js';

@@ -177,2 +177,8 @@ export class TransactionError extends BaseWeb3Error {

}
export class MissingGasInnerError extends BaseWeb3Error {
constructor() {
super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions');
this.code = ERR_TX_MISSING_GAS_INNER_ERROR;
}
}
export class MissingGasError extends InvalidValueError {

@@ -183,4 +189,11 @@ constructor(value) {

this.code = ERR_TX_MISSING_GAS;
this.innerError = new MissingGasInnerError();
}
}
export class TransactionGasMismatchInnerError extends BaseWeb3Error {
constructor() {
super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions, not both');
this.code = ERR_TX_GAS_MISMATCH_INNER_ERROR;
}
}
export class TransactionGasMismatchError extends InvalidValueError {

@@ -191,2 +204,3 @@ constructor(value) {

this.code = ERR_TX_GAS_MISMATCH;
this.innerError = new TransactionGasMismatchInnerError();
}

@@ -308,7 +322,3 @@ }

const invalidPropertyNames = [];
validationError.forEach(error => invalidPropertyNames.push(
// These errors are erroneously reported, error
// has type Web3ValidationErrorObject, but eslint doesn't recognize it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
error.keyword.match(/data.(.+)/)[1]));
validationError.forEach(error => invalidPropertyNames.push(error.keyword));
super(`The following properties are invalid for the transaction type ${txType}: ${invalidPropertyNames.join(', ')}`);

@@ -315,0 +325,0 @@ this.code = ERR_TX_INVALID_PROPERTIES_FOR_TYPE;

@@ -31,2 +31,3 @@ /*

export * from './errors/rpc_errors.js';
export * from './errors/rpc_error_messages.js';
//# sourceMappingURL=index.js.map

@@ -63,2 +63,4 @@ export declare const ERR_RESPONSE = 100;

export declare const ERR_TX_INVALID_PROPERTIES_FOR_TYPE = 439;
export declare const ERR_TX_MISSING_GAS_INNER_ERROR = 440;
export declare const ERR_TX_GAS_MISMATCH_INNER_ERROR = 441;
export declare const ERR_CONN = 500;

@@ -65,0 +67,0 @@ export declare const ERR_CONN_INVALID = 501;

@@ -19,2 +19,7 @@ import { JsonRpcResponseWithError, JsonRpcId, JsonRpcError } from 'web3-types';

}
export declare class EIP1193ProviderRpcError extends BaseWeb3Error {
code: number;
data?: unknown;
constructor(code: number, data?: unknown);
}
export declare class ParseError extends RpcError {

@@ -21,0 +26,0 @@ code: number;

@@ -153,2 +153,6 @@ import { Bytes, HexString, Numbers, TransactionReceipt, Web3ValidationErrorObject } from 'web3-types';

}
export declare class MissingGasInnerError extends BaseWeb3Error {
code: number;
constructor();
}
export declare class MissingGasError extends InvalidValueError {

@@ -163,2 +167,6 @@ code: number;

}
export declare class TransactionGasMismatchInnerError extends BaseWeb3Error {
code: number;
constructor();
}
export declare class TransactionGasMismatchError extends InvalidValueError {

@@ -165,0 +173,0 @@ code: number;

@@ -15,2 +15,3 @@ export * from './error_codes.js';

export * from './errors/rpc_errors.js';
export * from './errors/rpc_error_messages.js';
//# sourceMappingURL=index.d.ts.map
{
"name": "web3-errors",
"version": "1.0.3-dev.ebd0c57.0+ebd0c57",
"version": "1.0.3-dev.ed2770c.0+ed2770c",
"description": "This package has web3 error classes",

@@ -44,3 +44,3 @@ "main": "./lib/commonjs/index.js",

"dependencies": {
"web3-types": "1.0.3-dev.ebd0c57.0+ebd0c57"
"web3-types": "1.0.3-dev.ed2770c.0+ed2770c"
},

@@ -61,3 +61,3 @@ "devDependencies": {

},
"gitHead": "ebd0c578d34795d7d5a2e3d1cedd3ae1c3031c68"
"gitHead": "ed2770c8e9dade23b3577612201269a0b004aac0"
}

@@ -93,2 +93,4 @@ /*

export const ERR_TX_MISSING_GAS_INNER_ERROR = 440;
export const ERR_TX_GAS_MISMATCH_INNER_ERROR = 441;
// Connection error codes

@@ -128,2 +130,3 @@ export const ERR_CONN = 500;

// RPC error codes (EIP-1193)
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors

@@ -164,3 +167,4 @@ export const JSONRPC_ERR_REJECTED_REQUEST = 4001;

// rpc error codes EIP-1474
// RPC error codes (EIP-1474)
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
export const ERR_RPC_INVALID_JSON = -32700;

@@ -167,0 +171,0 @@ export const ERR_RPC_INVALID_REQUEST = -32600;

@@ -36,2 +36,3 @@ /*

} from '../error_codes.js';
import { RpcErrorMessages, genericRpcErrorMessageTemplate } from './rpc_error_messages.js';

@@ -44,3 +45,6 @@ export class RpcError extends BaseWeb3Error {

public constructor(rpcError: JsonRpcResponseWithError, message?: string) {
super(message ?? `An Rpc error has occured with a code of ${rpcError.error.code}`);
super(
message ??
genericRpcErrorMessageTemplate.replace('*code*', rpcError.error.code.toString()),
);
this.code = rpcError.error.code;

@@ -57,6 +61,34 @@ this.id = rpcError.id;

export class EIP1193ProviderRpcError extends BaseWeb3Error {
public code: number;
public data?: unknown;
public constructor(code: number, data?: unknown) {
if (!code) {
// this case should ideally not happen
super();
} else if (RpcErrorMessages[code]?.message) {
super(RpcErrorMessages[code].message);
} else {
// Retrieve the status code object for the given code from the table, by searching through the appropriate range
const statusCodeRange = Object.keys(RpcErrorMessages).find(
statusCode =>
typeof statusCode === 'string' &&
code >= parseInt(statusCode.split('-')[0], 10) &&
code <= parseInt(statusCode.split('-')[1], 10),
);
super(
RpcErrorMessages[statusCodeRange ?? '']?.message ??
genericRpcErrorMessageTemplate.replace('*code*', code?.toString() ?? '""'),
);
}
this.code = code;
this.data = data;
}
}
export class ParseError extends RpcError {
public code = ERR_RPC_INVALID_JSON;
public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Parse error');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_JSON].message);
}

@@ -68,3 +100,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Invalid request');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_REQUEST].message);
}

@@ -76,3 +108,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Method not found');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_METHOD].message);
}

@@ -84,3 +116,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Invalid request');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_PARAMS].message);
}

@@ -92,3 +124,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Internal error');
super(rpcError, RpcErrorMessages[ERR_RPC_INTERNAL_ERROR].message);
}

@@ -100,3 +132,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Invalid input');
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_INPUT].message);
}

@@ -108,3 +140,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Method not supported');
super(rpcError, RpcErrorMessages[ERR_RPC_UNSUPPORTED_METHOD].message);
}

@@ -116,3 +148,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Resource unavailable');
super(rpcError, RpcErrorMessages[ERR_RPC_UNAVAILABLE_RESOURCE].message);
}

@@ -124,3 +156,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Resource not found');
super(rpcError, RpcErrorMessages[ERR_RPC_MISSING_RESOURCE].message);
}

@@ -132,3 +164,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'JSON-RPC version not supported');
super(rpcError, RpcErrorMessages[ERR_RPC_NOT_SUPPORTED].message);
}

@@ -140,3 +172,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Transaction rejected');
super(rpcError, RpcErrorMessages[ERR_RPC_TRANSACTION_REJECTED].message);
}

@@ -148,3 +180,3 @@ }

public constructor(rpcError: JsonRpcResponseWithError) {
super(rpcError, 'Limit exceeded');
super(rpcError, RpcErrorMessages[ERR_RPC_LIMIT_EXCEEDED].message);
}

@@ -151,0 +183,0 @@ }

@@ -68,2 +68,4 @@ /*

ERR_TX_INVALID_PROPERTIES_FOR_TYPE,
ERR_TX_MISSING_GAS_INNER_ERROR,
ERR_TX_GAS_MISMATCH_INNER_ERROR,
} from '../error_codes.js';

@@ -316,2 +318,12 @@ import { InvalidValueError, BaseWeb3Error } from '../web3_error_base.js';

export class MissingGasInnerError extends BaseWeb3Error {
public code = ERR_TX_MISSING_GAS_INNER_ERROR;
public constructor() {
super(
'Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions',
);
}
}
export class MissingGasError extends InvalidValueError {

@@ -334,5 +346,16 @@ public code = ERR_TX_MISSING_GAS;

);
this.innerError = new MissingGasInnerError();
}
}
export class TransactionGasMismatchInnerError extends BaseWeb3Error {
public code = ERR_TX_GAS_MISMATCH_INNER_ERROR;
public constructor() {
super(
'Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions, not both',
);
}
}
export class TransactionGasMismatchError extends InvalidValueError {

@@ -355,2 +378,3 @@ public code = ERR_TX_GAS_MISMATCH;

);
this.innerError = new TransactionGasMismatchInnerError();
}

@@ -562,10 +586,3 @@ }

const invalidPropertyNames: string[] = [];
validationError.forEach(error =>
invalidPropertyNames.push(
// These errors are erroneously reported, error
// has type Web3ValidationErrorObject, but eslint doesn't recognize it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
(error.keyword.match(/data.(.+)/) as string[])[1],
),
);
validationError.forEach(error => invalidPropertyNames.push(error.keyword));
super(

@@ -572,0 +589,0 @@ `The following properties are invalid for the transaction type ${txType}: ${invalidPropertyNames.join(

@@ -32,1 +32,2 @@ /*

export * from './errors/rpc_errors.js';
export * from './errors/rpc_error_messages.js';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc