Socket
Socket
Sign inDemoInstall

web3-errors

Package Overview
Dependencies
1
Maintainers
2
Versions
264
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1-alpha.0 to 0.1.1-alpha.1

dist/errors/core_errors.d.ts

11

dist/error_codes.d.ts

@@ -9,2 +9,3 @@ export declare const ERR_RESPONSE = 100;

export declare const ERR_ABI_ENCODING = 205;
export declare const ERR_EXISTING_PLUGIN_NAMESPACE = 206;
export declare const ERR_CONTRACT = 300;

@@ -20,2 +21,3 @@ export declare const ERR_CONTRACT_RESOLVER_MISSING = 301;

export declare const ERR_CONTRACT_INSTANTIATION = 309;
export declare const ERR_CONTRACT_EXECUTION_REVERTED = 310;
export declare const ERR_TX = 400;

@@ -53,2 +55,7 @@ export declare const ERR_TX_REVERT_INSTRUCTION = 401;

export declare const ERR_TX_SEND_TIMEOUT = 431;
export declare const ERR_TX_BLOCK_TIMEOUT = 432;
export declare const ERR_TX_SIGNING = 433;
export declare const ERR_TX_GAS_MISMATCH = 434;
export declare const ERR_TX_CHAIN_MISMATCH = 435;
export declare const ERR_TX_HARDFORK_MISMATCH = 436;
export declare const ERR_CONN = 500;

@@ -80,3 +87,3 @@ export declare const ERR_CONN_INVALID = 501;

export declare const JSONRPC_ERR_REJECTED_REQUEST = 4001;
export declare const JSONRPC_ERR_UNAUTHORIZED = 4001;
export declare const JSONRPC_ERR_UNAUTHORIZED = 4100;
export declare const JSONRPC_ERR_UNSUPPORTED_METHOD = 4200;

@@ -103,2 +110,4 @@ export declare const JSONRPC_ERR_DISCONNECTED = 4900;

export declare const ERR_VALIDATION = 1100;
export declare const ERR_CORE_HARDFORK_MISMATCH = 1101;
export declare const ERR_CORE_CHAIN_MISMATCH = 1102;
//# sourceMappingURL=error_codes.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ERR_TX_SEND_TIMEOUT = exports.ERR_TX_NOT_FOUND = exports.ERR_TX_LOCAL_WALLET_NOT_AVAILABLE = exports.ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER = 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_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_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_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 = 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 = void 0;
exports.ERR_TX_LOCAL_WALLET_NOT_AVAILABLE = exports.ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER = 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_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_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_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 = 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_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 = void 0;
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 = void 0;
exports.ERR_RESPONSE = 100;

@@ -13,2 +14,3 @@ exports.ERR_INVALID_RESPONSE = 101;

exports.ERR_ABI_ENCODING = 205;
exports.ERR_EXISTING_PLUGIN_NAMESPACE = 206;
exports.ERR_CONTRACT = 300;

@@ -24,2 +26,3 @@ exports.ERR_CONTRACT_RESOLVER_MISSING = 301;

exports.ERR_CONTRACT_INSTANTIATION = 309;
exports.ERR_CONTRACT_EXECUTION_REVERTED = 310;
exports.ERR_TX = 400;

@@ -57,2 +60,7 @@ exports.ERR_TX_REVERT_INSTRUCTION = 401;

exports.ERR_TX_SEND_TIMEOUT = 431;
exports.ERR_TX_BLOCK_TIMEOUT = 432;
exports.ERR_TX_SIGNING = 433;
exports.ERR_TX_GAS_MISMATCH = 434;
exports.ERR_TX_CHAIN_MISMATCH = 435;
exports.ERR_TX_HARDFORK_MISMATCH = 436;
exports.ERR_CONN = 500;

@@ -84,3 +92,3 @@ exports.ERR_CONN_INVALID = 501;

exports.JSONRPC_ERR_REJECTED_REQUEST = 4001;
exports.JSONRPC_ERR_UNAUTHORIZED = 4001;
exports.JSONRPC_ERR_UNAUTHORIZED = 4100;
exports.JSONRPC_ERR_UNSUPPORTED_METHOD = 4200;

@@ -107,2 +115,4 @@ exports.JSONRPC_ERR_DISCONNECTED = 4900;

exports.ERR_VALIDATION = 1100;
exports.ERR_CORE_HARDFORK_MISMATCH = 1101;
exports.ERR_CORE_CHAIN_MISMATCH = 1102;
//# sourceMappingURL=error_codes.js.map

@@ -14,2 +14,3 @@ import { ConnectionEvent } from 'web3-types';

message: string;
innerError: Error | Error[] | undefined;
};

@@ -27,2 +28,3 @@ }

message: string;
innerError: Error | Error[] | undefined;
};

@@ -40,2 +42,3 @@ }

message: string;
innerError: Error | Error[] | undefined;
};

@@ -42,0 +45,0 @@ }

@@ -0,2 +1,8 @@

import { JsonRpcError, TransactionReceipt, HexString } from 'web3-types';
import { Web3Error } from '../web3_error_base';
export declare class Web3ContractError extends Web3Error {
code: number;
receipt?: TransactionReceipt;
constructor(message: string, receipt?: TransactionReceipt);
}
export declare class ResolverMethodMissingError extends Web3Error {

@@ -12,2 +18,3 @@ address: string;

message: string;
innerError: Error | Error[] | undefined;
};

@@ -32,2 +39,3 @@ }

message: string;
innerError: Error | Error[] | undefined;
};

@@ -44,2 +52,3 @@ }

message: string;
innerError: Error | Error[] | undefined;
};

@@ -62,2 +71,20 @@ }

}
export declare class Eip838ExecutionError extends Web3ContractError {
readonly name: string;
code: number;
data?: HexString;
errorName?: string;
errorSignature?: string;
errorArgs?: {
[K in string]: unknown;
};
constructor(code: number, message: string, data?: HexString);
setDecodedProperties(errorName: string, errorSignature?: string, errorArgs?: {
[K in string]: unknown;
}): void;
}
export declare class ContractExecutionError extends Web3ContractError {
innerError: Eip838ExecutionError;
constructor(rpcError: JsonRpcError);
}
//# sourceMappingURL=contract_errors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContractInstantiationError = exports.ContractNoFromAddressDefinedError = exports.ContractNoAddressDefinedError = exports.ContractMissingDeployDataError = exports.ContractReservedEventError = exports.ContractEventDoesNotExistError = exports.ContractOnceRequiresCallbackError = exports.ContractMissingABIError = exports.ResolverMethodMissingError = void 0;
exports.ContractExecutionError = exports.Eip838ExecutionError = exports.ContractInstantiationError = exports.ContractNoFromAddressDefinedError = exports.ContractNoAddressDefinedError = exports.ContractMissingDeployDataError = exports.ContractReservedEventError = exports.ContractEventDoesNotExistError = exports.ContractOnceRequiresCallbackError = exports.ContractMissingABIError = exports.ResolverMethodMissingError = exports.Web3ContractError = void 0;
const error_codes_1 = require("../error_codes");
const web3_error_base_1 = require("../web3_error_base");
class Web3ContractError extends web3_error_base_1.Web3Error {
constructor(message, receipt) {
super(message);
this.code = error_codes_1.ERR_CONTRACT;
this.receipt = receipt;
}
}
exports.Web3ContractError = Web3ContractError;
class ResolverMethodMissingError extends web3_error_base_1.Web3Error {

@@ -82,2 +90,24 @@ constructor(address, name) {

exports.ContractInstantiationError = ContractInstantiationError;
class Eip838ExecutionError extends Web3ContractError {
constructor(code, message, data) {
super(message);
this.name = this.constructor.name;
this.code = code;
this.data = data;
}
setDecodedProperties(errorName, errorSignature, errorArgs) {
this.errorName = errorName;
this.errorSignature = errorSignature;
this.errorArgs = errorArgs;
}
}
exports.Eip838ExecutionError = Eip838ExecutionError;
class ContractExecutionError extends Web3ContractError {
constructor(rpcError) {
super('Error happened while trying to execute a function inside a smart contract');
this.code = error_codes_1.ERR_CONTRACT_EXECUTION_REVERTED;
this.innerError = new Eip838ExecutionError(rpcError.code, rpcError.message, rpcError.data);
}
}
exports.ContractExecutionError = ContractExecutionError;
//# sourceMappingURL=contract_errors.js.map

@@ -15,2 +15,3 @@ import { Web3Error } from '../web3_error_base';

message: string;
innerError: Error | Error[] | undefined;
};

@@ -34,2 +35,6 @@ }

}
export declare class ExistingPluginNamespaceError extends Web3Error {
code: number;
constructor(pluginNamespace: string);
}
//# sourceMappingURL=generic_errors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbiError = exports.OperationAbortError = exports.OperationTimeoutError = exports.MethodNotImplementedError = exports.FormatterError = exports.InvalidNumberOfParamsError = void 0;
exports.ExistingPluginNamespaceError = exports.AbiError = exports.OperationAbortError = exports.OperationTimeoutError = exports.MethodNotImplementedError = exports.FormatterError = exports.InvalidNumberOfParamsError = void 0;
const error_codes_1 = require("../error_codes");

@@ -54,2 +54,9 @@ const web3_error_base_1 = require("../web3_error_base");

exports.AbiError = AbiError;
class ExistingPluginNamespaceError extends web3_error_base_1.Web3Error {
constructor(pluginNamespace) {
super(`A plugin with the namespace: ${pluginNamespace} has already been registered.`);
this.code = error_codes_1.ERR_EXISTING_PLUGIN_NAMESPACE;
}
}
exports.ExistingPluginNamespaceError = ExistingPluginNamespaceError;
//# sourceMappingURL=generic_errors.js.map

@@ -12,2 +12,3 @@ import { JsonRpcResponse } from 'web3-types';

message: string;
innerError: Error | Error[] | undefined;
};

@@ -14,0 +15,0 @@ }

11

dist/errors/response_errors.js

@@ -34,6 +34,11 @@ "use strict";

super(result);
if (!this.message || this.message === '') {
this.message = `Invalid JSON RPC response: ${JSON.stringify(result)}`;
this.code = error_codes_1.ERR_INVALID_RESPONSE;
let errorOrErrors;
if (`error` in result) {
errorOrErrors = result.error;
}
this.code = error_codes_1.ERR_INVALID_RESPONSE;
else if (result instanceof Array) {
errorOrErrors = result.map(r => r.error);
}
this.innerError = errorOrErrors;
}

@@ -40,0 +45,0 @@ }

@@ -1,6 +0,5 @@

import { Web3Error } from '../web3_error_base';
export declare class SignerError extends Web3Error {
import { InvalidValueError } from '../web3_error_base';
export declare class SignatureError extends InvalidValueError {
code: number;
constructor(errorDetails: string);
}
//# sourceMappingURL=signature_errors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SignerError = void 0;
exports.SignatureError = void 0;
const error_codes_1 = require("../error_codes");
const web3_error_base_1 = require("../web3_error_base");
class SignerError extends web3_error_base_1.Web3Error {
constructor(errorDetails) {
super(`Invalid signature. "${errorDetails}"`);
class SignatureError extends web3_error_base_1.InvalidValueError {
constructor() {
super(...arguments);
this.code = error_codes_1.ERR_SIGNATURE_FAILED;
}
}
exports.SignerError = SignerError;
exports.SignatureError = SignatureError;
//# sourceMappingURL=signature_errors.js.map

@@ -1,3 +0,3 @@

import { TransactionReceipt } from 'web3-types';
import { Web3Error } from '../web3_error_base';
import { Bytes, HexString, Numbers, TransactionReceipt } from 'web3-types';
import { InvalidValueError, Web3Error } from '../web3_error_base';
export declare class TransactionError<ReceiptType = TransactionReceipt> extends Web3Error {

@@ -12,2 +12,3 @@ receipt?: ReceiptType | undefined;

message: string;
innerError: Error | Error[] | undefined;
};

@@ -26,2 +27,3 @@ }

message: string;
innerError: Error | Error[] | undefined;
};

@@ -31,13 +33,14 @@ }

reason: string;
signature: string;
receipt: TransactionReceipt;
signature?: string | undefined;
receipt?: TransactionReceipt | undefined;
code: number;
constructor(reason: string, signature: string, receipt: TransactionReceipt);
constructor(reason: string, signature?: string | undefined, receipt?: TransactionReceipt | undefined);
toJSON(): {
reason: string;
signature: string;
receipt: TransactionReceipt;
signature: string | undefined;
receipt: TransactionReceipt | undefined;
name: string;
code: number;
message: string;
innerError: Error | Error[] | undefined;
};

@@ -52,2 +55,3 @@ }

message: string;
innerError: Error | Error[] | undefined;
};

@@ -70,2 +74,169 @@ }

}
export declare class InvalidTransactionWithSender extends InvalidValueError {
code: number;
constructor(value: unknown);
}
export declare class InvalidTransactionCall extends InvalidValueError {
code: number;
constructor(value: unknown);
}
export declare class MissingCustomChainError extends InvalidValueError {
code: number;
constructor();
}
export declare class MissingCustomChainIdError extends InvalidValueError {
code: number;
constructor();
}
export declare class ChainIdMismatchError extends InvalidValueError {
code: number;
constructor(value: {
txChainId: unknown;
customChainId: unknown;
});
}
export declare class ChainMismatchError extends InvalidValueError {
code: number;
constructor(value: {
txChain: unknown;
baseChain: unknown;
});
}
export declare class HardforkMismatchError extends InvalidValueError {
code: number;
constructor(value: {
txHardfork: unknown;
commonHardfork: unknown;
});
}
export declare class CommonOrChainAndHardforkError extends InvalidValueError {
code: number;
constructor();
}
export declare class MissingChainOrHardforkError extends InvalidValueError {
code: number;
constructor(value: {
chain: string | undefined;
hardfork: string | undefined;
});
}
export declare class MissingGasError extends InvalidValueError {
code: number;
constructor(value: {
gas: Numbers | undefined;
gasLimit: Numbers | undefined;
gasPrice: Numbers | undefined;
maxPriorityFeePerGas: Numbers | undefined;
maxFeePerGas: Numbers | undefined;
});
}
export declare class TransactionGasMismatchError extends InvalidValueError {
code: number;
constructor(value: {
gas: Numbers | undefined;
gasLimit: Numbers | undefined;
gasPrice: Numbers | undefined;
maxPriorityFeePerGas: Numbers | undefined;
maxFeePerGas: Numbers | undefined;
});
}
export declare class InvalidGasOrGasPrice extends InvalidValueError {
code: number;
constructor(value: {
gas: Numbers | undefined;
gasPrice: Numbers | undefined;
});
}
export declare class InvalidMaxPriorityFeePerGasOrMaxFeePerGas extends InvalidValueError {
code: number;
constructor(value: {
maxPriorityFeePerGas: Numbers | undefined;
maxFeePerGas: Numbers | undefined;
});
}
export declare class Eip1559GasPriceError extends InvalidValueError {
code: number;
constructor(value: unknown);
}
export declare class UnsupportedFeeMarketError extends InvalidValueError {
code: number;
constructor(value: {
maxPriorityFeePerGas: Numbers | undefined;
maxFeePerGas: Numbers | undefined;
});
}
export declare class InvalidTransactionObjectError extends InvalidValueError {
code: number;
constructor(value: unknown);
}
export declare class InvalidNonceOrChainIdError extends InvalidValueError {
code: number;
constructor(value: {
nonce: Numbers | undefined;
chainId: Numbers | undefined;
});
}
export declare class UnableToPopulateNonceError extends InvalidValueError {
code: number;
constructor();
}
export declare class Eip1559NotSupportedError extends InvalidValueError {
code: number;
constructor();
}
export declare class UnsupportedTransactionTypeError extends InvalidValueError {
code: number;
constructor(value: unknown);
}
export declare class TransactionDataAndInputError extends InvalidValueError {
code: number;
constructor(value: {
data: HexString | undefined;
input: HexString | undefined;
});
}
export declare class TransactionSendTimeoutError extends Web3Error {
code: number;
constructor(value: {
numberOfSeconds: number;
transactionHash?: Bytes;
});
}
export declare class TransactionPollingTimeoutError extends Web3Error {
code: number;
constructor(value: {
numberOfSeconds: number;
transactionHash: Bytes;
});
}
export declare class TransactionBlockTimeoutError extends Web3Error {
code: number;
constructor(value: {
starterBlockNumber: number;
numberOfBlocks: number;
transactionHash?: Bytes;
});
}
export declare class TransactionMissingReceiptOrBlockHashError extends InvalidValueError {
code: number;
constructor(value: {
receipt: TransactionReceipt;
blockHash: Bytes;
transactionHash: Bytes;
});
}
export declare class TransactionReceiptMissingBlockNumberError extends InvalidValueError {
code: number;
constructor(value: {
receipt: TransactionReceipt;
});
}
export declare class TransactionSigningError extends Web3Error {
code: number;
constructor(errorDetails: string);
}
export declare class LocalWalletNotAvailableError extends InvalidValueError {
code: number;
constructor();
}
//# sourceMappingURL=transaction_errors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransactionNotFound = exports.UndefinedRawTransactionError = exports.TransactionOutOfGasError = exports.TransactionRevertedWithoutReasonError = exports.ContractCodeNotStoredError = exports.NoContractAddressFoundError = exports.TransactionRevertError = exports.RevertInstructionError = exports.TransactionError = void 0;
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.InvalidTransactionWithSender = exports.TransactionNotFound = exports.UndefinedRawTransactionError = exports.TransactionOutOfGasError = exports.TransactionRevertedWithoutReasonError = exports.ContractCodeNotStoredError = exports.NoContractAddressFoundError = exports.TransactionRevertError = exports.RevertInstructionError = exports.TransactionError = void 0;
const error_codes_1 = require("../error_codes");

@@ -87,2 +87,210 @@ const web3_error_base_1 = require("../web3_error_base");

exports.TransactionNotFound = TransactionNotFound;
class InvalidTransactionWithSender extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(value, 'invalid transaction with sender');
this.code = error_codes_1.ERR_TX_INVALID_SENDER;
}
}
exports.InvalidTransactionWithSender = InvalidTransactionWithSender;
class InvalidTransactionCall extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(value, 'invalid transaction call');
this.code = error_codes_1.ERR_TX_INVALID_CALL;
}
}
exports.InvalidTransactionCall = InvalidTransactionCall;
class MissingCustomChainError extends web3_error_base_1.InvalidValueError {
constructor() {
super('MissingCustomChainError', 'If tx.common is provided it must have tx.common.customChain');
this.code = error_codes_1.ERR_TX_MISSING_CUSTOM_CHAIN;
}
}
exports.MissingCustomChainError = MissingCustomChainError;
class MissingCustomChainIdError extends web3_error_base_1.InvalidValueError {
constructor() {
super('MissingCustomChainIdError', 'If tx.common is provided it must have tx.common.customChain and tx.common.customChain.chainId');
this.code = error_codes_1.ERR_TX_MISSING_CUSTOM_CHAIN_ID;
}
}
exports.MissingCustomChainIdError = MissingCustomChainIdError;
class ChainIdMismatchError extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(JSON.stringify(value), 'Chain Id doesnt match in tx.chainId tx.common.customChain.chainId');
this.code = error_codes_1.ERR_TX_CHAIN_ID_MISMATCH;
}
}
exports.ChainIdMismatchError = ChainIdMismatchError;
class ChainMismatchError extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(JSON.stringify(value), 'Chain doesnt match in tx.chain tx.common.basechain');
this.code = error_codes_1.ERR_TX_CHAIN_MISMATCH;
}
}
exports.ChainMismatchError = ChainMismatchError;
class HardforkMismatchError extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(JSON.stringify(value), 'hardfork doesnt match in tx.hardfork tx.common.hardfork');
this.code = error_codes_1.ERR_TX_HARDFORK_MISMATCH;
}
}
exports.HardforkMismatchError = HardforkMismatchError;
class CommonOrChainAndHardforkError extends web3_error_base_1.InvalidValueError {
constructor() {
super('CommonOrChainAndHardforkError', 'Please provide the @ethereumjs/common object or the chain and hardfork property but not all together.');
this.code = error_codes_1.ERR_TX_INVALID_CHAIN_INFO;
}
}
exports.CommonOrChainAndHardforkError = CommonOrChainAndHardforkError;
class MissingChainOrHardforkError extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b;
super('MissingChainOrHardforkError', `When specifying chain and hardfork, both values must be defined. Received "chain": ${(_a = value.chain) !== null && _a !== void 0 ? _a : 'undefined'}, "hardfork": ${(_b = value.hardfork) !== null && _b !== void 0 ? _b : 'undefined'}`);
this.code = error_codes_1.ERR_TX_MISSING_CHAIN_INFO;
}
}
exports.MissingChainOrHardforkError = MissingChainOrHardforkError;
class MissingGasError extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b, _c, _d, _e;
super(`gas: ${(_a = value.gas) !== null && _a !== void 0 ? _a : 'undefined'}, gasLimit: ${(_b = value.gasLimit) !== null && _b !== void 0 ? _b : 'undefined'}, gasPrice: ${(_c = value.gasPrice) !== null && _c !== void 0 ? _c : 'undefined'}, maxPriorityFeePerGas: ${(_d = value.maxPriorityFeePerGas) !== null && _d !== void 0 ? _d : 'undefined'}, maxFeePerGas: ${(_e = value.maxFeePerGas) !== null && _e !== void 0 ? _e : 'undefined'}`, '"gas" is missing');
this.code = error_codes_1.ERR_TX_MISSING_GAS;
}
}
exports.MissingGasError = MissingGasError;
class TransactionGasMismatchError extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b, _c, _d, _e;
super(`gas: ${(_a = value.gas) !== null && _a !== void 0 ? _a : 'undefined'}, gasLimit: ${(_b = value.gasLimit) !== null && _b !== void 0 ? _b : 'undefined'}, gasPrice: ${(_c = value.gasPrice) !== null && _c !== void 0 ? _c : 'undefined'}, maxPriorityFeePerGas: ${(_d = value.maxPriorityFeePerGas) !== null && _d !== void 0 ? _d : 'undefined'}, maxFeePerGas: ${(_e = value.maxFeePerGas) !== null && _e !== void 0 ? _e : 'undefined'}`, 'transaction must specify legacy or fee market gas properties, not both');
this.code = error_codes_1.ERR_TX_GAS_MISMATCH;
}
}
exports.TransactionGasMismatchError = TransactionGasMismatchError;
class InvalidGasOrGasPrice extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b;
super(`gas: ${(_a = value.gas) !== null && _a !== void 0 ? _a : 'undefined'}, gasPrice: ${(_b = value.gasPrice) !== null && _b !== void 0 ? _b : 'undefined'}`, 'Gas or gasPrice is lower than 0');
this.code = error_codes_1.ERR_TX_INVALID_LEGACY_GAS;
}
}
exports.InvalidGasOrGasPrice = InvalidGasOrGasPrice;
class InvalidMaxPriorityFeePerGasOrMaxFeePerGas extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b;
super(`maxPriorityFeePerGas: ${(_a = value.maxPriorityFeePerGas) !== null && _a !== void 0 ? _a : 'undefined'}, maxFeePerGas: ${(_b = value.maxFeePerGas) !== null && _b !== void 0 ? _b : 'undefined'}`, 'maxPriorityFeePerGas or maxFeePerGas is lower than 0');
this.code = error_codes_1.ERR_TX_INVALID_FEE_MARKET_GAS;
}
}
exports.InvalidMaxPriorityFeePerGasOrMaxFeePerGas = InvalidMaxPriorityFeePerGasOrMaxFeePerGas;
class Eip1559GasPriceError extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(value, "eip-1559 transactions don't support gasPrice");
this.code = error_codes_1.ERR_TX_INVALID_FEE_MARKET_GAS_PRICE;
}
}
exports.Eip1559GasPriceError = Eip1559GasPriceError;
class UnsupportedFeeMarketError extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b;
super(`maxPriorityFeePerGas: ${(_a = value.maxPriorityFeePerGas) !== null && _a !== void 0 ? _a : 'undefined'}, maxFeePerGas: ${(_b = value.maxFeePerGas) !== null && _b !== void 0 ? _b : 'undefined'}`, "pre-eip-1559 transaction don't support maxFeePerGas/maxPriorityFeePerGas");
this.code = error_codes_1.ERR_TX_INVALID_LEGACY_FEE_MARKET;
}
}
exports.UnsupportedFeeMarketError = UnsupportedFeeMarketError;
class InvalidTransactionObjectError extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(value, 'invalid transaction object');
this.code = error_codes_1.ERR_TX_INVALID_OBJECT;
}
}
exports.InvalidTransactionObjectError = InvalidTransactionObjectError;
class InvalidNonceOrChainIdError extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b;
super(`nonce: ${(_a = value.nonce) !== null && _a !== void 0 ? _a : 'undefined'}, chainId: ${(_b = value.chainId) !== null && _b !== void 0 ? _b : 'undefined'}`, 'Nonce or chainId is lower than 0');
this.code = error_codes_1.ERR_TX_INVALID_NONCE_OR_CHAIN_ID;
}
}
exports.InvalidNonceOrChainIdError = InvalidNonceOrChainIdError;
class UnableToPopulateNonceError extends web3_error_base_1.InvalidValueError {
constructor() {
super('UnableToPopulateNonceError', 'unable to populate nonce, no from address available');
this.code = error_codes_1.ERR_TX_UNABLE_TO_POPULATE_NONCE;
}
}
exports.UnableToPopulateNonceError = UnableToPopulateNonceError;
class Eip1559NotSupportedError extends web3_error_base_1.InvalidValueError {
constructor() {
super('Eip1559NotSupportedError', "Network doesn't support eip-1559");
this.code = error_codes_1.ERR_TX_UNSUPPORTED_EIP_1559;
}
}
exports.Eip1559NotSupportedError = Eip1559NotSupportedError;
class UnsupportedTransactionTypeError extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(value, 'unsupported transaction type');
this.code = error_codes_1.ERR_TX_UNSUPPORTED_TYPE;
}
}
exports.UnsupportedTransactionTypeError = UnsupportedTransactionTypeError;
class TransactionDataAndInputError extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b;
super(`data: ${(_a = value.data) !== null && _a !== void 0 ? _a : 'undefined'}, input: ${(_b = value.input) !== null && _b !== void 0 ? _b : 'undefined'}`, 'You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');
this.code = error_codes_1.ERR_TX_DATA_AND_INPUT;
}
}
exports.TransactionDataAndInputError = TransactionDataAndInputError;
class TransactionSendTimeoutError extends web3_error_base_1.Web3Error {
constructor(value) {
super(`The connected Ethereum Node did not respond within ${value.numberOfSeconds} seconds, please make sure your transaction was properly sent and you are connected to a healthy Node. Be aware that transaction might still be pending or mined!\n\tTransaction Hash: ${value.transactionHash ? value.transactionHash.toString() : 'not available'}`);
this.code = error_codes_1.ERR_TX_SEND_TIMEOUT;
}
}
exports.TransactionSendTimeoutError = TransactionSendTimeoutError;
function transactionTimeoutHint(transactionHash) {
return `Please make sure your transaction was properly sent and there no pervious pending transaction for the same account. However, be aware that it might still be mined!\n\tTransaction Hash: ${transactionHash ? transactionHash.toString() : 'not available'}`;
}
class TransactionPollingTimeoutError extends web3_error_base_1.Web3Error {
constructor(value) {
super(`Transaction was not mined within ${value.numberOfSeconds} seconds. ${transactionTimeoutHint(value.transactionHash)}`);
this.code = error_codes_1.ERR_TX_POLLING_TIMEOUT;
}
}
exports.TransactionPollingTimeoutError = TransactionPollingTimeoutError;
class TransactionBlockTimeoutError extends web3_error_base_1.Web3Error {
constructor(value) {
super(`Transaction started at ${value.starterBlockNumber} but was not mined within ${value.numberOfBlocks} blocks. ${transactionTimeoutHint(value.transactionHash)}`);
this.code = error_codes_1.ERR_TX_BLOCK_TIMEOUT;
}
}
exports.TransactionBlockTimeoutError = TransactionBlockTimeoutError;
class TransactionMissingReceiptOrBlockHashError extends web3_error_base_1.InvalidValueError {
constructor(value) {
var _a, _b;
super(`receipt: ${JSON.stringify(value.receipt)}, blockHash: ${(_a = value.blockHash) === null || _a === void 0 ? void 0 : _a.toString()}, transactionHash: ${(_b = value.transactionHash) === null || _b === void 0 ? void 0 : _b.toString()}`, `Receipt missing or blockHash null`);
this.code = error_codes_1.ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL;
}
}
exports.TransactionMissingReceiptOrBlockHashError = TransactionMissingReceiptOrBlockHashError;
class TransactionReceiptMissingBlockNumberError extends web3_error_base_1.InvalidValueError {
constructor(value) {
super(`receipt: ${JSON.stringify(value.receipt)}`, `Receipt missing block number`);
this.code = error_codes_1.ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER;
}
}
exports.TransactionReceiptMissingBlockNumberError = TransactionReceiptMissingBlockNumberError;
class TransactionSigningError extends web3_error_base_1.Web3Error {
constructor(errorDetails) {
super(`Invalid signature. "${errorDetails}"`);
this.code = error_codes_1.ERR_TX_SIGNING;
}
}
exports.TransactionSigningError = TransactionSigningError;
class LocalWalletNotAvailableError extends web3_error_base_1.InvalidValueError {
constructor() {
super('LocalWalletNotAvailableError', `Attempted to index account in local wallet, but no wallet is available`);
this.code = error_codes_1.ERR_TX_LOCAL_WALLET_NOT_AVAILABLE;
}
}
exports.LocalWalletNotAvailableError = LocalWalletNotAvailableError;
//# sourceMappingURL=transaction_errors.js.map

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

export * from './errors/response_errors';
export * from './errors/core_errors';
//# sourceMappingURL=index.d.ts.map

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

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

@@ -6,3 +6,4 @@ import { Web3Error as ErrorInterface } from 'web3-types';

stack: string | undefined;
constructor(msg?: string);
innerError: Error | Error[] | undefined;
constructor(msg?: string, innerError?: Error | Error[]);
static convertToString(value: unknown, unquotValue?: boolean): string;

@@ -13,2 +14,3 @@ toJSON(): {

message: string;
innerError: Error | Error[] | undefined;
};

@@ -15,0 +17,0 @@ }

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

class Web3Error extends Error {
constructor(msg) {
constructor(msg, innerError) {
super(msg);
this.innerError = innerError;
this.name = this.constructor.name;

@@ -25,3 +26,8 @@ if (typeof Error.captureStackTrace === 'function') {

toJSON() {
return { name: this.name, code: this.code, message: this.message };
return {
name: this.name,
code: this.code,
message: this.message,
innerError: this.innerError,
};
}

@@ -28,0 +34,0 @@ }

{
"name": "web3-errors",
"version": "0.1.1-alpha.0",
"version": "0.1.1-alpha.1",
"description": "This package has web3 error classes",

@@ -25,6 +25,6 @@ "main": "dist/index.js",

"test:unit": "jest --config=./test/unit/jest.config.js",
"test:integration": "jest --config=./test/integration/jest.config.js --runInBand --passWithNoTests"
"test:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests"
},
"dependencies": {
"web3-types": "^0.1.1-alpha.0"
"web3-types": "^0.1.1-alpha.1"
},

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

},
"gitHead": "766ebd976ef71458eaebf7a6108b268881e30552"
"gitHead": "a754e3a965c30f42a6e639df27462650062833ee"
}

@@ -17,5 +17,15 @@ <p align="center">

###### Get it from the NPM Registry
## Installation
You can install the package either using [NPM](https://www.npmjs.com/package/web3-errors) or using [Yarn](https://yarnpkg.com/package/web3-errors)
### Using NPM
```bash
npm install web3-errors
```
### Using Yarn
```bash
yarn add web3-errors

@@ -22,0 +32,0 @@ ```

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

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc