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

@fuel-ts/errors

Package Overview
Dependencies
Maintainers
1
Versions
2567
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fuel-ts/errors - npm Package Compare versions

Comparing version 0.0.0-next-20230914112903 to 0.0.0-next-20230914115056

dist/test-utils/safeExec.d.ts

44

dist/error-codes.d.ts

@@ -5,12 +5,50 @@ /**

export declare enum ErrorCode {
ABI_TYPES_AND_VALUES_MISMATCH = "abi-types-and-values-mismatch",
ABI_MAIN_METHOD_MISSING = "abi-main-method-missing",
INVALID_COMPONENT = "invalid-component",
FRAGMENT_NOT_FOUND = "fragment-not-found",
CONFIGURABLE_NOT_FOUND = "configurable-not-found",
TYPE_NOT_FOUND = "type-not-found",
TYPE_NOT_SUPPORTED = "type-not-supported",
INVALID_DECODE_VALUE = "invalid-decode-value",
JSON_ABI_ERROR = "abi-main-method-missing",
TYPE_ID_NOT_FOUND = "type-id-not-found",
BIN_FILE_NOT_FOUND = "bin-file-not-found",
INVALID_BECH32_ADDRESS = "invalid-bech32-address",
INVALID_URL = "invalid-url",
/**
* The wallet doesn't have enough assets to cover the requirements of the transaction
*/
INSUFFICIENT_BALANCE = "insufficient-balance",
WALLET_MANAGER_ERROR = "wallet-manager-error",
HD_WALLET_ERROR = "hd-wallet-error",
PARSE_FAILED = "parse-failed",
INVALID_CREDENTIALS = "invalid-credentials",
ENV_DEPENDENCY_MISSING = "env-dependency-missing",
INVALID_TTL = "invalid-ttl",
INVALID_INPUT_PARAMETERS = "invalid-input-parameters",
NOT_IMPLEMENTED = "not-implemented",
NOT_SUPPORTED = "not-supported",
CONVERTING_FAILED = "converting-error",
ELEMENT_NOT_FOUND = "element-not-found",
MISSING_REQUIRED_PARAMETER = "missing-required-parameter",
GAS_PRICE_TOO_LOW = "gas-price-too-low",
GAS_LIMIT_TOO_LOW = "gas-limit-too-low",
TRANSACTION_NOT_FOUND = "transaction-not-found",
TRANSACTION_FAILED = "transaction-failed",
INVALID_CONFIGURABLE_CONSTANTS = "invalid-configurable-constants",
INVALID_TRANSACTION_INPUT = "invalid-transaction-input",
INVALID_TRANSACTION_OUTPUT = "invalid-transaction-output",
INVALID_TRANSACTION_STATUS = "invalid-transaction-status",
INVALID_TRANSACTION_TYPE = "invalid-transaction-type",
TRANSACTION_ERROR = "transaction-error",
INVALID_RECEIPT_TYPE = "invalid-receipt-type",
INVALID_WORD_LIST = "invalid-word-list",
INVALID_MNEMONIC = "invalid-mnemonic",
INVALID_ENTROPY = "invalid-entropy",
INVALID_SEED = "invalid-seed",
INVALID_CHECKSUM = "invalid-checksum",
INVALID_PASSWORD = "invalid-password",
LATEST_BLOCK_UNAVAILABLE = "latest-block-unavailable",
ERROR_BUILDING_BLOCK_EXPLORER_URL = "error-building-block-explorer-url",
VITEPRESS_PLUGIN_ERROR = "vitepress-plugin-error",
INVALID_MULTICALL = "invalid-multicall"
}
//# sourceMappingURL=error-codes.d.ts.map

@@ -12,7 +12,48 @@ "use strict";

var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
ErrorCode2["ABI_TYPES_AND_VALUES_MISMATCH"] = "abi-types-and-values-mismatch";
ErrorCode2["ABI_MAIN_METHOD_MISSING"] = "abi-main-method-missing";
ErrorCode2["INVALID_COMPONENT"] = "invalid-component";
ErrorCode2["FRAGMENT_NOT_FOUND"] = "fragment-not-found";
ErrorCode2["CONFIGURABLE_NOT_FOUND"] = "configurable-not-found";
ErrorCode2["TYPE_NOT_FOUND"] = "type-not-found";
ErrorCode2["TYPE_NOT_SUPPORTED"] = "type-not-supported";
ErrorCode2["INVALID_DECODE_VALUE"] = "invalid-decode-value";
ErrorCode2["JSON_ABI_ERROR"] = "abi-main-method-missing";
ErrorCode2["TYPE_ID_NOT_FOUND"] = "type-id-not-found";
ErrorCode2["BIN_FILE_NOT_FOUND"] = "bin-file-not-found";
ErrorCode2["INVALID_BECH32_ADDRESS"] = "invalid-bech32-address";
ErrorCode2["INVALID_URL"] = "invalid-url";
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
ErrorCode2["PARSE_FAILED"] = "parse-failed";
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
ErrorCode2["ENV_DEPENDENCY_MISSING"] = "env-dependency-missing";
ErrorCode2["INVALID_TTL"] = "invalid-ttl";
ErrorCode2["INVALID_INPUT_PARAMETERS"] = "invalid-input-parameters";
ErrorCode2["NOT_IMPLEMENTED"] = "not-implemented";
ErrorCode2["NOT_SUPPORTED"] = "not-supported";
ErrorCode2["CONVERTING_FAILED"] = "converting-error";
ErrorCode2["ELEMENT_NOT_FOUND"] = "element-not-found";
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
ErrorCode2["TRANSACTION_NOT_FOUND"] = "transaction-not-found";
ErrorCode2["TRANSACTION_FAILED"] = "transaction-failed";
ErrorCode2["INVALID_CONFIGURABLE_CONSTANTS"] = "invalid-configurable-constants";
ErrorCode2["INVALID_TRANSACTION_INPUT"] = "invalid-transaction-input";
ErrorCode2["INVALID_TRANSACTION_OUTPUT"] = "invalid-transaction-output";
ErrorCode2["INVALID_TRANSACTION_STATUS"] = "invalid-transaction-status";
ErrorCode2["INVALID_TRANSACTION_TYPE"] = "invalid-transaction-type";
ErrorCode2["TRANSACTION_ERROR"] = "transaction-error";
ErrorCode2["INVALID_RECEIPT_TYPE"] = "invalid-receipt-type";
ErrorCode2["INVALID_WORD_LIST"] = "invalid-word-list";
ErrorCode2["INVALID_MNEMONIC"] = "invalid-mnemonic";
ErrorCode2["INVALID_ENTROPY"] = "invalid-entropy";
ErrorCode2["INVALID_SEED"] = "invalid-seed";
ErrorCode2["INVALID_CHECKSUM"] = "invalid-checksum";
ErrorCode2["INVALID_PASSWORD"] = "invalid-password";
ErrorCode2["LATEST_BLOCK_UNAVAILABLE"] = "latest-block-unavailable";
ErrorCode2["ERROR_BUILDING_BLOCK_EXPLORER_URL"] = "error-building-block-explorer-url";
ErrorCode2["VITEPRESS_PLUGIN_ERROR"] = "vitepress-plugin-error";
ErrorCode2["INVALID_MULTICALL"] = "invalid-multicall";

@@ -27,3 +68,3 @@ return ErrorCode2;

FUEL_CORE: "0.20.4",
FUELS: "0.57.1"
FUELS: "0.58.0"
};

@@ -39,3 +80,6 @@ }

if (error.code === void 0) {
throw new _FuelError("parse-failed" /* PARSE_FAILED */, "missing 'code' property");
throw new _FuelError(
"parse-failed" /* PARSE_FAILED */,
"Failed to parse the error object. The required 'code' property is missing."
);
}

@@ -42,0 +86,0 @@ const enumValues = Object.values(ErrorCode);

@@ -35,7 +35,48 @@ "use strict";

var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
ErrorCode2["ABI_TYPES_AND_VALUES_MISMATCH"] = "abi-types-and-values-mismatch";
ErrorCode2["ABI_MAIN_METHOD_MISSING"] = "abi-main-method-missing";
ErrorCode2["INVALID_COMPONENT"] = "invalid-component";
ErrorCode2["FRAGMENT_NOT_FOUND"] = "fragment-not-found";
ErrorCode2["CONFIGURABLE_NOT_FOUND"] = "configurable-not-found";
ErrorCode2["TYPE_NOT_FOUND"] = "type-not-found";
ErrorCode2["TYPE_NOT_SUPPORTED"] = "type-not-supported";
ErrorCode2["INVALID_DECODE_VALUE"] = "invalid-decode-value";
ErrorCode2["JSON_ABI_ERROR"] = "abi-main-method-missing";
ErrorCode2["TYPE_ID_NOT_FOUND"] = "type-id-not-found";
ErrorCode2["BIN_FILE_NOT_FOUND"] = "bin-file-not-found";
ErrorCode2["INVALID_BECH32_ADDRESS"] = "invalid-bech32-address";
ErrorCode2["INVALID_URL"] = "invalid-url";
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
ErrorCode2["PARSE_FAILED"] = "parse-failed";
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
ErrorCode2["ENV_DEPENDENCY_MISSING"] = "env-dependency-missing";
ErrorCode2["INVALID_TTL"] = "invalid-ttl";
ErrorCode2["INVALID_INPUT_PARAMETERS"] = "invalid-input-parameters";
ErrorCode2["NOT_IMPLEMENTED"] = "not-implemented";
ErrorCode2["NOT_SUPPORTED"] = "not-supported";
ErrorCode2["CONVERTING_FAILED"] = "converting-error";
ErrorCode2["ELEMENT_NOT_FOUND"] = "element-not-found";
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
ErrorCode2["TRANSACTION_NOT_FOUND"] = "transaction-not-found";
ErrorCode2["TRANSACTION_FAILED"] = "transaction-failed";
ErrorCode2["INVALID_CONFIGURABLE_CONSTANTS"] = "invalid-configurable-constants";
ErrorCode2["INVALID_TRANSACTION_INPUT"] = "invalid-transaction-input";
ErrorCode2["INVALID_TRANSACTION_OUTPUT"] = "invalid-transaction-output";
ErrorCode2["INVALID_TRANSACTION_STATUS"] = "invalid-transaction-status";
ErrorCode2["INVALID_TRANSACTION_TYPE"] = "invalid-transaction-type";
ErrorCode2["TRANSACTION_ERROR"] = "transaction-error";
ErrorCode2["INVALID_RECEIPT_TYPE"] = "invalid-receipt-type";
ErrorCode2["INVALID_WORD_LIST"] = "invalid-word-list";
ErrorCode2["INVALID_MNEMONIC"] = "invalid-mnemonic";
ErrorCode2["INVALID_ENTROPY"] = "invalid-entropy";
ErrorCode2["INVALID_SEED"] = "invalid-seed";
ErrorCode2["INVALID_CHECKSUM"] = "invalid-checksum";
ErrorCode2["INVALID_PASSWORD"] = "invalid-password";
ErrorCode2["LATEST_BLOCK_UNAVAILABLE"] = "latest-block-unavailable";
ErrorCode2["ERROR_BUILDING_BLOCK_EXPLORER_URL"] = "error-building-block-explorer-url";
ErrorCode2["VITEPRESS_PLUGIN_ERROR"] = "vitepress-plugin-error";
ErrorCode2["INVALID_MULTICALL"] = "invalid-multicall";

@@ -52,3 +93,6 @@ return ErrorCode2;

if (error.code === void 0) {
throw new _FuelError("parse-failed" /* PARSE_FAILED */, "missing 'code' property");
throw new _FuelError(
"parse-failed" /* PARSE_FAILED */,
"Failed to parse the error object. The required 'code' property is missing."
);
}

@@ -55,0 +99,0 @@ const enumValues = Object.values(ErrorCode);

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

export * from './test-utils/safeExec';
export * from './test-utils/expect-to-throw-fuel-error';
//# sourceMappingURL=test-utils.d.ts.map

362

dist/test-utils.global.js
"use strict";
(() => {
// ../utils/dist/test-utils.mjs
// src/test-utils/safeExec.ts
var safeExec = async (lambda) => {

@@ -14,315 +14,57 @@ let error;

};
var version = "logger/5.7.0";
var _permanentCensorErrors = false;
var _censorErrors = false;
var LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
var _logLevel = LogLevels["default"];
var _globalLogger = null;
function _checkNormalize() {
try {
const missing = [];
["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => {
try {
if ("test".normalize(form) !== "test") {
throw new Error("bad normalize");
}
;
} catch (error) {
missing.push(form);
}
});
if (missing.length) {
throw new Error("missing " + missing.join(", "));
}
if (String.fromCharCode(233).normalize("NFD") !== String.fromCharCode(101, 769)) {
throw new Error("broken implementation");
}
} catch (error) {
return error.message;
}
return null;
}
var _normalizeError = _checkNormalize();
var LogLevel;
(function(LogLevel2) {
LogLevel2["DEBUG"] = "DEBUG";
LogLevel2["INFO"] = "INFO";
LogLevel2["WARNING"] = "WARNING";
LogLevel2["ERROR"] = "ERROR";
LogLevel2["OFF"] = "OFF";
})(LogLevel || (LogLevel = {}));
var ErrorCode;
(function(ErrorCode22) {
ErrorCode22["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
ErrorCode22["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
ErrorCode22["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
ErrorCode22["NETWORK_ERROR"] = "NETWORK_ERROR";
ErrorCode22["SERVER_ERROR"] = "SERVER_ERROR";
ErrorCode22["TIMEOUT"] = "TIMEOUT";
ErrorCode22["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
ErrorCode22["NUMERIC_FAULT"] = "NUMERIC_FAULT";
ErrorCode22["MISSING_NEW"] = "MISSING_NEW";
ErrorCode22["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
ErrorCode22["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
ErrorCode22["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
ErrorCode22["CALL_EXCEPTION"] = "CALL_EXCEPTION";
ErrorCode22["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
ErrorCode22["NONCE_EXPIRED"] = "NONCE_EXPIRED";
ErrorCode22["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
ErrorCode22["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
ErrorCode22["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED";
ErrorCode22["ACTION_REJECTED"] = "ACTION_REJECTED";
})(ErrorCode || (ErrorCode = {}));
var HEX = "0123456789abcdef";
var Logger = class {
constructor(version3) {
Object.defineProperty(this, "version", {
enumerable: true,
value: version3,
writable: false
});
}
_log(logLevel, args) {
const level = logLevel.toLowerCase();
if (LogLevels[level] == null) {
this.throwArgumentError("invalid log level name", "logLevel", logLevel);
}
if (_logLevel > LogLevels[level]) {
return;
}
console.log.apply(console, args);
}
debug(...args) {
this._log(Logger.levels.DEBUG, args);
}
info(...args) {
this._log(Logger.levels.INFO, args);
}
warn(...args) {
this._log(Logger.levels.WARNING, args);
}
makeError(message, code, params) {
if (_censorErrors) {
return this.makeError("censored error", code, {});
}
if (!code) {
code = Logger.errors.UNKNOWN_ERROR;
}
if (!params) {
params = {};
}
const messageDetails = [];
Object.keys(params).forEach((key) => {
const value = params[key];
try {
if (value instanceof Uint8Array) {
let hex = "";
for (let i = 0; i < value.length; i++) {
hex += HEX[value[i] >> 4];
hex += HEX[value[i] & 15];
}
messageDetails.push(key + "=Uint8Array(0x" + hex + ")");
} else {
messageDetails.push(key + "=" + JSON.stringify(value));
}
} catch (error2) {
messageDetails.push(key + "=" + JSON.stringify(params[key].toString()));
}
});
messageDetails.push(`code=${code}`);
messageDetails.push(`version=${this.version}`);
const reason = message;
let url = "";
switch (code) {
case ErrorCode.NUMERIC_FAULT: {
url = "NUMERIC_FAULT";
const fault = message;
switch (fault) {
case "overflow":
case "underflow":
case "division-by-zero":
url += "-" + fault;
break;
case "negative-power":
case "negative-width":
url += "-unsupported";
break;
case "unbound-bitwise-result":
url += "-unbound-result";
break;
}
break;
}
case ErrorCode.CALL_EXCEPTION:
case ErrorCode.INSUFFICIENT_FUNDS:
case ErrorCode.MISSING_NEW:
case ErrorCode.NONCE_EXPIRED:
case ErrorCode.REPLACEMENT_UNDERPRICED:
case ErrorCode.TRANSACTION_REPLACED:
case ErrorCode.UNPREDICTABLE_GAS_LIMIT:
url = code;
break;
}
if (url) {
message += " [ See: https://links.ethers.org/v5-errors-" + url + " ]";
}
if (messageDetails.length) {
message += " (" + messageDetails.join(", ") + ")";
}
const error = new Error(message);
error.reason = reason;
error.code = code;
Object.keys(params).forEach(function(key) {
error[key] = params[key];
});
return error;
}
throwError(message, code, params) {
throw this.makeError(message, code, params);
}
throwArgumentError(message, name, value) {
return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {
argument: name,
value
});
}
assert(condition, message, code, params) {
if (!!condition) {
return;
}
this.throwError(message, code, params);
}
assertArgument(condition, message, name, value) {
if (!!condition) {
return;
}
this.throwArgumentError(message, name, value);
}
checkNormalize(message) {
if (message == null) {
message = "platform missing String.prototype.normalize";
}
if (_normalizeError) {
this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "String.prototype.normalize",
form: _normalizeError
});
}
}
checkSafeUint53(value, message) {
if (typeof value !== "number") {
return;
}
if (message == null) {
message = "value not safe";
}
if (value < 0 || value >= 9007199254740991) {
this.throwError(message, Logger.errors.NUMERIC_FAULT, {
operation: "checkSafeInteger",
fault: "out-of-safe-range",
value
});
}
if (value % 1) {
this.throwError(message, Logger.errors.NUMERIC_FAULT, {
operation: "checkSafeInteger",
fault: "non-integer",
value
});
}
}
checkArgumentCount(count, expectedCount, message) {
if (message) {
message = ": " + message;
} else {
message = "";
}
if (count < expectedCount) {
this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, {
count,
expectedCount
});
}
if (count > expectedCount) {
this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, {
count,
expectedCount
});
}
}
checkNew(target, kind) {
if (target === Object || target == null) {
this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
}
}
checkAbstract(target, kind) {
if (target === kind) {
this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" });
} else if (target === Object || target == null) {
this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
}
}
static globalLogger() {
if (!_globalLogger) {
_globalLogger = new Logger(version);
}
return _globalLogger;
}
static setCensorship(censorship, permanent) {
if (!censorship && permanent) {
this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "setCensorship"
});
}
if (_permanentCensorErrors) {
if (!censorship) {
return;
}
this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "setCensorship"
});
}
_censorErrors = !!censorship;
_permanentCensorErrors = !!permanent;
}
static setLogLevel(logLevel) {
const level = LogLevels[logLevel.toLowerCase()];
if (level == null) {
Logger.globalLogger().warn("invalid log level - " + logLevel);
return;
}
_logLevel = level;
}
static from(version3) {
return new Logger(version3);
}
};
Logger.errors = ErrorCode;
Logger.levels = LogLevel;
var version2 = "bytes/5.7.0";
var logger = new Logger(version2);
// src/error-codes.ts
var ErrorCode2 = /* @__PURE__ */ ((ErrorCode3) => {
ErrorCode3["INVALID_BECH32_ADDRESS"] = "invalid-bech32-address";
ErrorCode3["INVALID_URL"] = "invalid-url";
ErrorCode3["INSUFFICIENT_BALANCE"] = "insufficient-balance";
ErrorCode3["PARSE_FAILED"] = "parse-failed";
ErrorCode3["TRANSACTION_FAILED"] = "transaction-failed";
ErrorCode3["INVALID_MULTICALL"] = "invalid-multicall";
return ErrorCode3;
})(ErrorCode2 || {});
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
ErrorCode2["ABI_TYPES_AND_VALUES_MISMATCH"] = "abi-types-and-values-mismatch";
ErrorCode2["ABI_MAIN_METHOD_MISSING"] = "abi-main-method-missing";
ErrorCode2["INVALID_COMPONENT"] = "invalid-component";
ErrorCode2["FRAGMENT_NOT_FOUND"] = "fragment-not-found";
ErrorCode2["CONFIGURABLE_NOT_FOUND"] = "configurable-not-found";
ErrorCode2["TYPE_NOT_FOUND"] = "type-not-found";
ErrorCode2["TYPE_NOT_SUPPORTED"] = "type-not-supported";
ErrorCode2["INVALID_DECODE_VALUE"] = "invalid-decode-value";
ErrorCode2["JSON_ABI_ERROR"] = "abi-main-method-missing";
ErrorCode2["TYPE_ID_NOT_FOUND"] = "type-id-not-found";
ErrorCode2["BIN_FILE_NOT_FOUND"] = "bin-file-not-found";
ErrorCode2["INVALID_BECH32_ADDRESS"] = "invalid-bech32-address";
ErrorCode2["INVALID_URL"] = "invalid-url";
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
ErrorCode2["PARSE_FAILED"] = "parse-failed";
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
ErrorCode2["ENV_DEPENDENCY_MISSING"] = "env-dependency-missing";
ErrorCode2["INVALID_TTL"] = "invalid-ttl";
ErrorCode2["INVALID_INPUT_PARAMETERS"] = "invalid-input-parameters";
ErrorCode2["NOT_IMPLEMENTED"] = "not-implemented";
ErrorCode2["NOT_SUPPORTED"] = "not-supported";
ErrorCode2["CONVERTING_FAILED"] = "converting-error";
ErrorCode2["ELEMENT_NOT_FOUND"] = "element-not-found";
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
ErrorCode2["TRANSACTION_NOT_FOUND"] = "transaction-not-found";
ErrorCode2["TRANSACTION_FAILED"] = "transaction-failed";
ErrorCode2["INVALID_CONFIGURABLE_CONSTANTS"] = "invalid-configurable-constants";
ErrorCode2["INVALID_TRANSACTION_INPUT"] = "invalid-transaction-input";
ErrorCode2["INVALID_TRANSACTION_OUTPUT"] = "invalid-transaction-output";
ErrorCode2["INVALID_TRANSACTION_STATUS"] = "invalid-transaction-status";
ErrorCode2["INVALID_TRANSACTION_TYPE"] = "invalid-transaction-type";
ErrorCode2["TRANSACTION_ERROR"] = "transaction-error";
ErrorCode2["INVALID_RECEIPT_TYPE"] = "invalid-receipt-type";
ErrorCode2["INVALID_WORD_LIST"] = "invalid-word-list";
ErrorCode2["INVALID_MNEMONIC"] = "invalid-mnemonic";
ErrorCode2["INVALID_ENTROPY"] = "invalid-entropy";
ErrorCode2["INVALID_SEED"] = "invalid-seed";
ErrorCode2["INVALID_CHECKSUM"] = "invalid-checksum";
ErrorCode2["INVALID_PASSWORD"] = "invalid-password";
ErrorCode2["LATEST_BLOCK_UNAVAILABLE"] = "latest-block-unavailable";
ErrorCode2["ERROR_BUILDING_BLOCK_EXPLORER_URL"] = "error-building-block-explorer-url";
ErrorCode2["VITEPRESS_PLUGIN_ERROR"] = "vitepress-plugin-error";
ErrorCode2["INVALID_MULTICALL"] = "invalid-multicall";
return ErrorCode2;
})(ErrorCode || {});
// ../versions/dist/index.mjs
function getSupportedVersions() {
return {
FORC: "0.44.0",
FUEL_CORE: "0.20.4",
FUELS: "0.57.1"
};
}
var versions = getSupportedVersions();
// src/test-utils/expect-to-throw-fuel-error.ts
var codes = Object.values(ErrorCode2);
var codes = Object.values(ErrorCode);
var expectToThrowFuelError = async (lambda, expectedError) => {

@@ -329,0 +71,0 @@ if (!expectedError.code) {

@@ -23,16 +23,67 @@ "use strict";

__export(test_utils_exports, {
expectToThrowFuelError: () => expectToThrowFuelError
expectToThrowFuelError: () => expectToThrowFuelError,
safeExec: () => safeExec
});
module.exports = __toCommonJS(test_utils_exports);
// src/test-utils/expect-to-throw-fuel-error.ts
var import_test_utils = require("@fuel-ts/utils/test-utils");
// src/test-utils/safeExec.ts
var safeExec = async (lambda) => {
let error;
let result;
try {
result = await lambda();
} catch (_error) {
error = _error;
}
return { error, result };
};
// src/error-codes.ts
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
ErrorCode2["ABI_TYPES_AND_VALUES_MISMATCH"] = "abi-types-and-values-mismatch";
ErrorCode2["ABI_MAIN_METHOD_MISSING"] = "abi-main-method-missing";
ErrorCode2["INVALID_COMPONENT"] = "invalid-component";
ErrorCode2["FRAGMENT_NOT_FOUND"] = "fragment-not-found";
ErrorCode2["CONFIGURABLE_NOT_FOUND"] = "configurable-not-found";
ErrorCode2["TYPE_NOT_FOUND"] = "type-not-found";
ErrorCode2["TYPE_NOT_SUPPORTED"] = "type-not-supported";
ErrorCode2["INVALID_DECODE_VALUE"] = "invalid-decode-value";
ErrorCode2["JSON_ABI_ERROR"] = "abi-main-method-missing";
ErrorCode2["TYPE_ID_NOT_FOUND"] = "type-id-not-found";
ErrorCode2["BIN_FILE_NOT_FOUND"] = "bin-file-not-found";
ErrorCode2["INVALID_BECH32_ADDRESS"] = "invalid-bech32-address";
ErrorCode2["INVALID_URL"] = "invalid-url";
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
ErrorCode2["PARSE_FAILED"] = "parse-failed";
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
ErrorCode2["ENV_DEPENDENCY_MISSING"] = "env-dependency-missing";
ErrorCode2["INVALID_TTL"] = "invalid-ttl";
ErrorCode2["INVALID_INPUT_PARAMETERS"] = "invalid-input-parameters";
ErrorCode2["NOT_IMPLEMENTED"] = "not-implemented";
ErrorCode2["NOT_SUPPORTED"] = "not-supported";
ErrorCode2["CONVERTING_FAILED"] = "converting-error";
ErrorCode2["ELEMENT_NOT_FOUND"] = "element-not-found";
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
ErrorCode2["TRANSACTION_NOT_FOUND"] = "transaction-not-found";
ErrorCode2["TRANSACTION_FAILED"] = "transaction-failed";
ErrorCode2["INVALID_CONFIGURABLE_CONSTANTS"] = "invalid-configurable-constants";
ErrorCode2["INVALID_TRANSACTION_INPUT"] = "invalid-transaction-input";
ErrorCode2["INVALID_TRANSACTION_OUTPUT"] = "invalid-transaction-output";
ErrorCode2["INVALID_TRANSACTION_STATUS"] = "invalid-transaction-status";
ErrorCode2["INVALID_TRANSACTION_TYPE"] = "invalid-transaction-type";
ErrorCode2["TRANSACTION_ERROR"] = "transaction-error";
ErrorCode2["INVALID_RECEIPT_TYPE"] = "invalid-receipt-type";
ErrorCode2["INVALID_WORD_LIST"] = "invalid-word-list";
ErrorCode2["INVALID_MNEMONIC"] = "invalid-mnemonic";
ErrorCode2["INVALID_ENTROPY"] = "invalid-entropy";
ErrorCode2["INVALID_SEED"] = "invalid-seed";
ErrorCode2["INVALID_CHECKSUM"] = "invalid-checksum";
ErrorCode2["INVALID_PASSWORD"] = "invalid-password";
ErrorCode2["LATEST_BLOCK_UNAVAILABLE"] = "latest-block-unavailable";
ErrorCode2["ERROR_BUILDING_BLOCK_EXPLORER_URL"] = "error-building-block-explorer-url";
ErrorCode2["VITEPRESS_PLUGIN_ERROR"] = "vitepress-plugin-error";
ErrorCode2["INVALID_MULTICALL"] = "invalid-multicall";

@@ -42,5 +93,2 @@ return ErrorCode2;

// src/fuel-error.ts
var import_versions = require("@fuel-ts/versions");
// src/test-utils/expect-to-throw-fuel-error.ts

@@ -55,3 +103,3 @@ var codes = Object.values(ErrorCode);

}
const { error: thrownError } = await (0, import_test_utils.safeExec)(lambda);
const { error: thrownError } = await safeExec(lambda);
if (!thrownError) {

@@ -74,4 +122,5 @@ throw new Error(`Passed-in lambda didn't throw.`);

0 && (module.exports = {
expectToThrowFuelError
expectToThrowFuelError,
safeExec
});
//# sourceMappingURL=test-utils.js.map

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

import type { FuelError } from '../index';
import type { FuelError } from '../fuel-error';
type ExpectedFuelError = Partial<FuelError> & Required<Pick<FuelError, 'code'>>;

@@ -3,0 +3,0 @@ export declare const expectToThrowFuelError: (lambda: () => unknown, expectedError: ExpectedFuelError) => Promise<void>;

{
"name": "@fuel-ts/errors",
"version": "0.0.0-next-20230914112903",
"version": "0.0.0-next-20230914115056",
"description": "Error class and error codes that the fuels-ts library throws",

@@ -33,4 +33,3 @@ "author": "Fuel Labs <contact@fuel.sh> (https://fuel.network/)",

"dependencies": {
"@fuel-ts/utils": "0.0.0-next-20230914112903",
"@fuel-ts/versions": "0.0.0-next-20230914112903"
"@fuel-ts/versions": "0.0.0-next-20230914115056"
},

@@ -37,0 +36,0 @@ "scripts": {

@@ -55,3 +55,3 @@ # `@fuel-ts/errors`

// can also be imported from `fuels` when using the umbrella package
import { expectToThrowFuelError } from "@fuel-ts/errors/test-utils";
import { expectToThrowFuelError } from "@fuel-ts/errors";

@@ -58,0 +58,0 @@ import { myFn } from "...";

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