@fuel-ts/utils
Advanced tools
Comparing version 0.0.0-pr-984-20230508220652 to 0.0.0-pr-990-20230508221740
@@ -1,2 +0,1 @@ | ||
import './test'; | ||
/** | ||
@@ -3,0 +2,0 @@ * Converts `some.string-value` into `SomeStringValue`. |
@@ -1,143 +0,2 @@ | ||
"use strict"; | ||
(() => { | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __commonJS = (cb, mod) => function __require() { | ||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
// ../../node_modules/.pnpm/lodash.upperfirst@4.3.1/node_modules/lodash.upperfirst/index.js | ||
var require_lodash = __commonJS({ | ||
"../../node_modules/.pnpm/lodash.upperfirst@4.3.1/node_modules/lodash.upperfirst/index.js"(exports, module) { | ||
var INFINITY = 1 / 0; | ||
var symbolTag = "[object Symbol]"; | ||
var rsAstralRange = "\\ud800-\\udfff"; | ||
var rsComboMarksRange = "\\u0300-\\u036f\\ufe20-\\ufe23"; | ||
var rsComboSymbolsRange = "\\u20d0-\\u20f0"; | ||
var rsVarRange = "\\ufe0e\\ufe0f"; | ||
var rsAstral = "[" + rsAstralRange + "]"; | ||
var rsCombo = "[" + rsComboMarksRange + rsComboSymbolsRange + "]"; | ||
var rsFitz = "\\ud83c[\\udffb-\\udfff]"; | ||
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")"; | ||
var rsNonAstral = "[^" + rsAstralRange + "]"; | ||
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}"; | ||
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]"; | ||
var rsZWJ = "\\u200d"; | ||
var reOptMod = rsModifier + "?"; | ||
var rsOptVar = "[" + rsVarRange + "]?"; | ||
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*"; | ||
var rsSeq = rsOptVar + reOptMod + rsOptJoin; | ||
var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; | ||
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); | ||
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + "]"); | ||
var freeGlobal = typeof global == "object" && global && global.Object === Object && global; | ||
var freeSelf = typeof self == "object" && self && self.Object === Object && self; | ||
var root = freeGlobal || freeSelf || Function("return this")(); | ||
function asciiToArray(string) { | ||
return string.split(""); | ||
} | ||
function hasUnicode(string) { | ||
return reHasUnicode.test(string); | ||
} | ||
function stringToArray(string) { | ||
return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); | ||
} | ||
function unicodeToArray(string) { | ||
return string.match(reUnicode) || []; | ||
} | ||
var objectProto = Object.prototype; | ||
var objectToString = objectProto.toString; | ||
var Symbol = root.Symbol; | ||
var symbolProto = Symbol ? Symbol.prototype : void 0; | ||
var symbolToString = symbolProto ? symbolProto.toString : void 0; | ||
function baseSlice(array, start, end) { | ||
var index = -1, length = array.length; | ||
if (start < 0) { | ||
start = -start > length ? 0 : length + start; | ||
} | ||
end = end > length ? length : end; | ||
if (end < 0) { | ||
end += length; | ||
} | ||
length = start > end ? 0 : end - start >>> 0; | ||
start >>>= 0; | ||
var result = Array(length); | ||
while (++index < length) { | ||
result[index] = array[index + start]; | ||
} | ||
return result; | ||
} | ||
function baseToString(value) { | ||
if (typeof value == "string") { | ||
return value; | ||
} | ||
if (isSymbol(value)) { | ||
return symbolToString ? symbolToString.call(value) : ""; | ||
} | ||
var result = value + ""; | ||
return result == "0" && 1 / value == -INFINITY ? "-0" : result; | ||
} | ||
function castSlice(array, start, end) { | ||
var length = array.length; | ||
end = end === void 0 ? length : end; | ||
return !start && end >= length ? array : baseSlice(array, start, end); | ||
} | ||
function createCaseFirst(methodName) { | ||
return function(string) { | ||
string = toString(string); | ||
var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0; | ||
var chr = strSymbols ? strSymbols[0] : string.charAt(0); | ||
var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); | ||
return chr[methodName]() + trailing; | ||
}; | ||
} | ||
function isObjectLike(value) { | ||
return !!value && typeof value == "object"; | ||
} | ||
function isSymbol(value) { | ||
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag; | ||
} | ||
function toString(value) { | ||
return value == null ? "" : baseToString(value); | ||
} | ||
var upperFirst2 = createCaseFirst("toUpperCase"); | ||
module.exports = upperFirst2; | ||
} | ||
}); | ||
// src/utils/normalizeString.ts | ||
var import_lodash = __toESM(require_lodash()); | ||
var normalizeString = (str) => { | ||
const transformations = [ | ||
(s) => s.replace(/\s+/g, "-"), | ||
(s) => s.replace(/\./g, "-"), | ||
(s) => s.replace(/_/g, "-"), | ||
(s) => s.replace(/-[a-z]/g, (match) => match.slice(-1).toUpperCase()), | ||
(s) => s.replace(/-/g, ""), | ||
(s) => s.replace(/^\d+/, ""), | ||
(s) => (0, import_lodash.default)(s) | ||
]; | ||
const output = transformations.reduce((s, t) => t(s), str); | ||
if (output === "") { | ||
throw new Error(`Can't normalize string: ${str}`); | ||
} | ||
return output; | ||
}; | ||
})(); | ||
"use strict";(()=>{var R=Object.create;var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var w=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var E=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of F(e))!z.call(r,n)&&n!==o&&s(r,n,{get:()=>e[n],enumerable:!(t=x(e,n))||t.enumerable});return r};var I=(r,e,o)=>(o=r!=null?R(U(r)):{},E(e||!r||!r.__esModule?s(o,"default",{value:r,enumerable:!0}):o,r));var T=w((fr,A)=>{var M=1/0,N="[object Symbol]",u="\\ud800-\\udfff",p="\\u0300-\\u036f\\ufe20-\\ufe23",g="\\u20d0-\\u20f0",d="\\ufe0e\\ufe0f",P="["+u+"]",i="["+p+g+"]",f="\\ud83c[\\udffb-\\udfff]",k="(?:"+i+"|"+f+")",m="[^"+u+"]",y="(?:\\ud83c[\\udde6-\\uddff]){2}",S="[\\ud800-\\udbff][\\udc00-\\udfff]",j="\\u200d",v=k+"?",h="["+d+"]?",J="(?:"+j+"(?:"+[m,y,S].join("|")+")"+h+v+")*",V=h+v+J,q="(?:"+[m+i+"?",i,y,S,P].join("|")+")",G=RegExp(f+"(?="+f+")|"+q+V,"g"),H=RegExp("["+j+u+p+g+d+"]"),L=typeof global=="object"&&global&&global.Object===Object&&global,W=typeof self=="object"&&self&&self.Object===Object&&self,Y=L||W||Function("return this")();function Z(r){return r.split("")}function O(r){return H.test(r)}function _(r){return O(r)?$(r):Z(r)}function $(r){return r.match(G)||[]}var B=Object.prototype,D=B.toString,a=Y.Symbol,l=a?a.prototype:void 0,b=l?l.toString:void 0;function K(r,e,o){var t=-1,n=r.length;e<0&&(e=-e>n?0:n+e),o=o>n?n:o,o<0&&(o+=n),n=e>o?0:o-e>>>0,e>>>=0;for(var c=Array(n);++t<n;)c[t]=r[t+e];return c}function Q(r){if(typeof r=="string")return r;if(or(r))return b?b.call(r):"";var e=r+"";return e=="0"&&1/r==-M?"-0":e}function X(r,e,o){var t=r.length;return o=o===void 0?t:o,!e&&o>=t?r:K(r,e,o)}function rr(r){return function(e){e=tr(e);var o=O(e)?_(e):void 0,t=o?o[0]:e.charAt(0),n=o?X(o,1).join(""):e.slice(1);return t[r]()+n}}function er(r){return!!r&&typeof r=="object"}function or(r){return typeof r=="symbol"||er(r)&&D.call(r)==N}function tr(r){return r==null?"":Q(r)}var nr=rr("toUpperCase");A.exports=nr});var C=I(T()),ur=r=>{let o=[t=>t.replace(/\s+/g,"-"),t=>t.replace(/\./g,"-"),t=>t.replace(/_/g,"-"),t=>t.replace(/-[a-z]/g,n=>n.slice(-1).toUpperCase()),t=>t.replace(/-/g,""),t=>t.replace(/^\d+/,""),t=>(0,C.default)(t)].reduce((t,n)=>n(t),r);if(o==="")throw new Error(`Can't normalize string: ${r}`);return o};})(); | ||
//# sourceMappingURL=index.global.js.map |
@@ -1,55 +0,2 @@ | ||
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/utils/index.ts | ||
var utils_exports = {}; | ||
__export(utils_exports, { | ||
normalizeString: () => normalizeString | ||
}); | ||
module.exports = __toCommonJS(utils_exports); | ||
// src/utils/normalizeString.ts | ||
var import_lodash = __toESM(require("lodash.upperfirst")); | ||
var normalizeString = (str) => { | ||
const transformations = [ | ||
(s) => s.replace(/\s+/g, "-"), | ||
(s) => s.replace(/\./g, "-"), | ||
(s) => s.replace(/_/g, "-"), | ||
(s) => s.replace(/-[a-z]/g, (match) => match.slice(-1).toUpperCase()), | ||
(s) => s.replace(/-/g, ""), | ||
(s) => s.replace(/^\d+/, ""), | ||
(s) => (0, import_lodash.default)(s) | ||
]; | ||
const output = transformations.reduce((s, t) => t(s), str); | ||
if (output === "") { | ||
throw new Error(`Can't normalize string: ${str}`); | ||
} | ||
return output; | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
normalizeString | ||
}); | ||
"use strict";var p=Object.create;var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var n in t)s(e,n,{get:t[n],enumerable:!0})},a=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of g(t))!m.call(e,o)&&o!==n&&s(e,o,{get:()=>t[o],enumerable:!(r=c(t,o))||r.enumerable});return e};var u=(e,t,n)=>(n=e!=null?p(l(e)):{},a(t||!e||!e.__esModule?s(n,"default",{value:e,enumerable:!0}):n,e)),z=e=>a(s({},"__esModule",{value:!0}),e);var x={};f(x,{normalizeString:()=>w});module.exports=z(x);var i=u(require("lodash.upperfirst")),w=e=>{let n=[r=>r.replace(/\s+/g,"-"),r=>r.replace(/\./g,"-"),r=>r.replace(/_/g,"-"),r=>r.replace(/-[a-z]/g,o=>o.slice(-1).toUpperCase()),r=>r.replace(/-/g,""),r=>r.replace(/^\d+/,""),r=>(0,i.default)(r)].reduce((r,o)=>o(r),e);if(n==="")throw new Error(`Can't normalize string: ${e}`);return n};0&&(module.exports={normalizeString}); | ||
//# sourceMappingURL=index.js.map |
@@ -1,595 +0,2 @@ | ||
"use strict"; | ||
(() => { | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { | ||
get: (a, b) => (typeof require !== "undefined" ? require : a)[b] | ||
}) : x)(function(x) { | ||
if (typeof require !== "undefined") | ||
return require.apply(this, arguments); | ||
throw new Error('Dynamic require of "' + x + '" is not supported'); | ||
}); | ||
var __commonJS = (cb, mod) => function __require2() { | ||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
// ../../node_modules/.pnpm/lodash.upperfirst@4.3.1/node_modules/lodash.upperfirst/index.js | ||
var require_lodash = __commonJS({ | ||
"../../node_modules/.pnpm/lodash.upperfirst@4.3.1/node_modules/lodash.upperfirst/index.js"(exports, module) { | ||
var INFINITY = 1 / 0; | ||
var symbolTag = "[object Symbol]"; | ||
var rsAstralRange = "\\ud800-\\udfff"; | ||
var rsComboMarksRange = "\\u0300-\\u036f\\ufe20-\\ufe23"; | ||
var rsComboSymbolsRange = "\\u20d0-\\u20f0"; | ||
var rsVarRange = "\\ufe0e\\ufe0f"; | ||
var rsAstral = "[" + rsAstralRange + "]"; | ||
var rsCombo = "[" + rsComboMarksRange + rsComboSymbolsRange + "]"; | ||
var rsFitz = "\\ud83c[\\udffb-\\udfff]"; | ||
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")"; | ||
var rsNonAstral = "[^" + rsAstralRange + "]"; | ||
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}"; | ||
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]"; | ||
var rsZWJ = "\\u200d"; | ||
var reOptMod = rsModifier + "?"; | ||
var rsOptVar = "[" + rsVarRange + "]?"; | ||
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*"; | ||
var rsSeq = rsOptVar + reOptMod + rsOptJoin; | ||
var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; | ||
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); | ||
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + "]"); | ||
var freeGlobal = typeof global == "object" && global && global.Object === Object && global; | ||
var freeSelf = typeof self == "object" && self && self.Object === Object && self; | ||
var root = freeGlobal || freeSelf || Function("return this")(); | ||
function asciiToArray(string) { | ||
return string.split(""); | ||
} | ||
function hasUnicode(string) { | ||
return reHasUnicode.test(string); | ||
} | ||
function stringToArray(string) { | ||
return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); | ||
} | ||
function unicodeToArray(string) { | ||
return string.match(reUnicode) || []; | ||
} | ||
var objectProto = Object.prototype; | ||
var objectToString = objectProto.toString; | ||
var Symbol = root.Symbol; | ||
var symbolProto = Symbol ? Symbol.prototype : void 0; | ||
var symbolToString = symbolProto ? symbolProto.toString : void 0; | ||
function baseSlice(array, start, end) { | ||
var index = -1, length = array.length; | ||
if (start < 0) { | ||
start = -start > length ? 0 : length + start; | ||
} | ||
end = end > length ? length : end; | ||
if (end < 0) { | ||
end += length; | ||
} | ||
length = start > end ? 0 : end - start >>> 0; | ||
start >>>= 0; | ||
var result = Array(length); | ||
while (++index < length) { | ||
result[index] = array[index + start]; | ||
} | ||
return result; | ||
} | ||
function baseToString(value) { | ||
if (typeof value == "string") { | ||
return value; | ||
} | ||
if (isSymbol(value)) { | ||
return symbolToString ? symbolToString.call(value) : ""; | ||
} | ||
var result = value + ""; | ||
return result == "0" && 1 / value == -INFINITY ? "-0" : result; | ||
} | ||
function castSlice(array, start, end) { | ||
var length = array.length; | ||
end = end === void 0 ? length : end; | ||
return !start && end >= length ? array : baseSlice(array, start, end); | ||
} | ||
function createCaseFirst(methodName) { | ||
return function(string) { | ||
string = toString(string); | ||
var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0; | ||
var chr = strSymbols ? strSymbols[0] : string.charAt(0); | ||
var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); | ||
return chr[methodName]() + trailing; | ||
}; | ||
} | ||
function isObjectLike(value) { | ||
return !!value && typeof value == "object"; | ||
} | ||
function isSymbol(value) { | ||
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag; | ||
} | ||
function toString(value) { | ||
return value == null ? "" : baseToString(value); | ||
} | ||
var upperFirst2 = createCaseFirst("toUpperCase"); | ||
module.exports = upperFirst2; | ||
} | ||
}); | ||
// src/test-utils/safeExec.ts | ||
var safeExec = async (lambda) => { | ||
let error; | ||
let result; | ||
try { | ||
result = await lambda(); | ||
} catch (_error) { | ||
error = _error; | ||
} | ||
return { error, result }; | ||
}; | ||
// ../../node_modules/.pnpm/@ethersproject+logger@5.7.0/node_modules/@ethersproject/logger/lib.esm/_version.js | ||
var version = "logger/5.7.0"; | ||
// ../../node_modules/.pnpm/@ethersproject+logger@5.7.0/node_modules/@ethersproject/logger/lib.esm/index.js | ||
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(ErrorCode2) { | ||
ErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; | ||
ErrorCode2["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; | ||
ErrorCode2["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; | ||
ErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR"; | ||
ErrorCode2["SERVER_ERROR"] = "SERVER_ERROR"; | ||
ErrorCode2["TIMEOUT"] = "TIMEOUT"; | ||
ErrorCode2["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; | ||
ErrorCode2["NUMERIC_FAULT"] = "NUMERIC_FAULT"; | ||
ErrorCode2["MISSING_NEW"] = "MISSING_NEW"; | ||
ErrorCode2["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; | ||
ErrorCode2["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; | ||
ErrorCode2["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; | ||
ErrorCode2["CALL_EXCEPTION"] = "CALL_EXCEPTION"; | ||
ErrorCode2["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; | ||
ErrorCode2["NONCE_EXPIRED"] = "NONCE_EXPIRED"; | ||
ErrorCode2["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; | ||
ErrorCode2["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; | ||
ErrorCode2["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; | ||
ErrorCode2["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; | ||
// ../../node_modules/.pnpm/@ethersproject+bytes@5.7.0/node_modules/@ethersproject/bytes/lib.esm/_version.js | ||
var version2 = "bytes/5.7.0"; | ||
// ../../node_modules/.pnpm/@ethersproject+bytes@5.7.0/node_modules/@ethersproject/bytes/lib.esm/index.js | ||
var logger = new Logger(version2); | ||
function isHexable(value) { | ||
return !!value.toHexString; | ||
} | ||
function isInteger(value) { | ||
return typeof value === "number" && value == value && value % 1 === 0; | ||
} | ||
function isBytes(value) { | ||
if (value == null) { | ||
return false; | ||
} | ||
if (value.constructor === Uint8Array) { | ||
return true; | ||
} | ||
if (typeof value === "string") { | ||
return false; | ||
} | ||
if (!isInteger(value.length) || value.length < 0) { | ||
return false; | ||
} | ||
for (let i = 0; i < value.length; i++) { | ||
const v = value[i]; | ||
if (!isInteger(v) || v < 0 || v >= 256) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
function isHexString(value, length) { | ||
if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { | ||
return false; | ||
} | ||
if (length && value.length !== 2 + 2 * length) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
var HexCharacters = "0123456789abcdef"; | ||
function hexlify(value, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
if (typeof value === "number") { | ||
logger.checkSafeUint53(value, "invalid hexlify value"); | ||
let hex = ""; | ||
while (value) { | ||
hex = HexCharacters[value & 15] + hex; | ||
value = Math.floor(value / 16); | ||
} | ||
if (hex.length) { | ||
if (hex.length % 2) { | ||
hex = "0" + hex; | ||
} | ||
return "0x" + hex; | ||
} | ||
return "0x00"; | ||
} | ||
if (typeof value === "bigint") { | ||
value = value.toString(16); | ||
if (value.length % 2) { | ||
return "0x0" + value; | ||
} | ||
return "0x" + value; | ||
} | ||
if (options.allowMissingPrefix && typeof value === "string" && value.substring(0, 2) !== "0x") { | ||
value = "0x" + value; | ||
} | ||
if (isHexable(value)) { | ||
return value.toHexString(); | ||
} | ||
if (isHexString(value)) { | ||
if (value.length % 2) { | ||
if (options.hexPad === "left") { | ||
value = "0x0" + value.substring(2); | ||
} else if (options.hexPad === "right") { | ||
value += "0"; | ||
} else { | ||
logger.throwArgumentError("hex data is odd-length", "value", value); | ||
} | ||
} | ||
return value.toLowerCase(); | ||
} | ||
if (isBytes(value)) { | ||
let result = "0x"; | ||
for (let i = 0; i < value.length; i++) { | ||
let v = value[i]; | ||
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15]; | ||
} | ||
return result; | ||
} | ||
return logger.throwArgumentError("invalid hexlify value", "value", value); | ||
} | ||
// src/test-utils/getForcProject.ts | ||
var import_fs = __require("fs"); | ||
var import_path = __require("path"); | ||
// src/utils/normalizeString.ts | ||
var import_lodash = __toESM(require_lodash()); | ||
var normalizeString = (str) => { | ||
const transformations = [ | ||
(s) => s.replace(/\s+/g, "-"), | ||
(s) => s.replace(/\./g, "-"), | ||
(s) => s.replace(/_/g, "-"), | ||
(s) => s.replace(/-[a-z]/g, (match) => match.slice(-1).toUpperCase()), | ||
(s) => s.replace(/-/g, ""), | ||
(s) => s.replace(/^\d+/, ""), | ||
(s) => (0, import_lodash.default)(s) | ||
]; | ||
const output = transformations.reduce((s, t) => t(s), str); | ||
if (output === "") { | ||
throw new Error(`Can't normalize string: ${str}`); | ||
} | ||
return output; | ||
}; | ||
// src/test-utils/getForcProject.ts | ||
var getProjectDebugDir = (params) => (0, import_path.join)(params.projectDir, "out", "debug"); | ||
var getProjectTempDir = (params) => (0, import_path.join)(getProjectDebugDir(params), "__temp__"); | ||
var getProjectAbiPath = (params) => (0, import_path.join)(getProjectDebugDir(params), `${params.projectName}-abi.json`); | ||
var getProjectBinPath = (params) => (0, import_path.join)(getProjectDebugDir(params), `${params.projectName}.bin`); | ||
var getProjectAbiName = (params) => `${params.projectName}-abi`; | ||
var getProjectNormalizedName = (params) => normalizeString(params.projectName); | ||
var getProjectAbi = (params) => { | ||
const projectPath = getProjectAbiPath(params); | ||
const abiContents = JSON.parse((0, import_fs.readFileSync)(projectPath, "utf-8")); | ||
return abiContents; | ||
}; | ||
var getForcProject = (projectDir) => { | ||
const projectName = (0, import_path.basename)(projectDir); | ||
const params = { | ||
projectDir, | ||
projectName | ||
}; | ||
const debugDir = getProjectDebugDir(params); | ||
const tempDir = getProjectTempDir(params); | ||
const binPath = getProjectBinPath(params); | ||
const binHelixfied = hexlify((0, import_fs.readFileSync)(binPath)); | ||
const abiPath = getProjectAbiPath(params); | ||
const abiName = getProjectAbiName(params); | ||
const abiContents = getProjectAbi(params); | ||
const normalizedName = getProjectNormalizedName(params); | ||
const inputGlobal = `${debugDir}/*-abi.json`; | ||
return { | ||
name: projectName, | ||
normalizedName, | ||
debugDir, | ||
tempDir, | ||
binPath, | ||
binHelixfied, | ||
abiPath, | ||
abiName, | ||
abiContents, | ||
inputGlobal | ||
}; | ||
}; | ||
})(); | ||
"use strict";(()=>{var rr=Object.create;var S=Object.defineProperty;var tr=Object.getOwnPropertyDescriptor;var er=Object.getOwnPropertyNames;var nr=Object.getPrototypeOf,or=Object.prototype.hasOwnProperty;var w=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var ir=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var sr=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of er(t))!or.call(r,o)&&o!==e&&S(r,o,{get:()=>t[o],enumerable:!(n=tr(t,o))||n.enumerable});return r};var cr=(r,t,e)=>(e=r!=null?rr(nr(r)):{},sr(t||!r||!r.__esModule?S(e,"default",{value:r,enumerable:!0}):e,r));var Z=ir((Yr,K)=>{var hr=1/0,Er="[object Symbol]",y="\\ud800-\\udfff",k="\\u0300-\\u036f\\ufe20-\\ufe23",L="\\u20d0-\\u20f0",z="\\ufe0e\\ufe0f",mr="["+y+"]",A="["+k+L+"]",R="\\ud83c[\\udffb-\\udfff]",gr="(?:"+A+"|"+R+")",W="[^"+y+"]",B="(?:\\ud83c[\\udde6-\\uddff]){2}",V="[\\ud800-\\udbff][\\udc00-\\udfff]",X="\\u200d",H=gr+"?",J="["+z+"]?",Nr="(?:"+X+"(?:"+[W,B,V].join("|")+")"+J+H+")*",pr=J+H+Nr,xr="(?:"+[W+A+"?",A,B,V,mr].join("|")+")",br=RegExp(R+"(?="+R+")|"+xr+pr,"g"),Pr=RegExp("["+X+y+k+L+z+"]"),Ar=typeof global=="object"&&global&&global.Object===Object&&global,Rr=typeof self=="object"&&self&&self.Object===Object&&self,yr=Ar||Rr||Function("return this")();function Ir(r){return r.split("")}function $(r){return Pr.test(r)}function Sr(r){return $(r)?wr(r):Ir(r)}function wr(r){return r.match(br)||[]}var Tr=Object.prototype,_r=Tr.toString,C=yr.Symbol,M=C?C.prototype:void 0,G=M?M.toString:void 0;function Ur(r,t,e){var n=-1,o=r.length;t<0&&(t=-t>o?0:o+t),e=e>o?o:e,e<0&&(e+=o),o=t>e?0:e-t>>>0,t>>>=0;for(var l=Array(o);++n<o;)l[n]=r[n+t];return l}function Or(r){if(typeof r=="string")return r;if(Dr(r))return G?G.call(r):"";var t=r+"";return t=="0"&&1/r==-hr?"-0":t}function dr(r,t,e){var n=r.length;return e=e===void 0?n:e,!t&&e>=n?r:Ur(r,t,e)}function vr(r){return function(t){t=Fr(t);var e=$(t)?Sr(t):void 0,n=e?e[0]:t.charAt(0),o=e?dr(e,1).join(""):t.slice(1);return n[r]()+o}}function jr(r){return!!r&&typeof r=="object"}function Dr(r){return typeof r=="symbol"||jr(r)&&_r.call(r)==Er}function Fr(r){return r==null?"":Or(r)}var Cr=vr("toUpperCase");K.exports=Cr});var Br=async r=>{let t,e;try{e=await r()}catch(n){t=n}return{error:t,result:e}};var T="logger/5.7.0";var _=!1,U=!1,g={debug:1,default:2,info:2,warning:3,error:4,off:5},O=g.default,p=null;function fr(){try{let r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}var d=fr(),x;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(x||(x={}));var c;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(c||(c={}));var v="0123456789abcdef",i=class{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){let n=t.toLowerCase();g[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(O>g[n])&&console.log.apply(console,e)}debug(...t){this._log(i.levels.DEBUG,t)}info(...t){this._log(i.levels.INFO,t)}warn(...t){this._log(i.levels.WARNING,t)}makeError(t,e,n){if(U)return this.makeError("censored error",e,{});e||(e=i.errors.UNKNOWN_ERROR),n||(n={});let o=[];Object.keys(n).forEach(s=>{let a=n[s];try{if(a instanceof Uint8Array){let E="";for(let m=0;m<a.length;m++)E+=v[a[m]>>4],E+=v[a[m]&15];o.push(s+"=Uint8Array(0x"+E+")")}else o.push(s+"="+JSON.stringify(a))}catch{o.push(s+"="+JSON.stringify(n[s].toString()))}}),o.push(`code=${e}`),o.push(`version=${this.version}`);let l=t,f="";switch(e){case c.NUMERIC_FAULT:{f="NUMERIC_FAULT";let s=t;switch(s){case"overflow":case"underflow":case"division-by-zero":f+="-"+s;break;case"negative-power":case"negative-width":f+="-unsupported";break;case"unbound-bitwise-result":f+="-unbound-result";break}break}case c.CALL_EXCEPTION:case c.INSUFFICIENT_FUNDS:case c.MISSING_NEW:case c.NONCE_EXPIRED:case c.REPLACEMENT_UNDERPRICED:case c.TRANSACTION_REPLACED:case c.UNPREDICTABLE_GAS_LIMIT:f=e;break}f&&(t+=" [ See: https://links.ethers.org/v5-errors-"+f+" ]"),o.length&&(t+=" ("+o.join(", ")+")");let h=new Error(t);return h.reason=l,h.code=e,Object.keys(n).forEach(function(s){h[s]=n[s]}),h}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,i.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,o){t||this.throwError(e,n,o)}assertArgument(t,e,n,o){t||this.throwArgumentError(e,n,o)}checkNormalize(t){t==null&&(t="platform missing String.prototype.normalize"),d&&this.throwError("platform missing String.prototype.normalize",i.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:d})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,i.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,i.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n?n=": "+n:n="",t<e&&this.throwError("missing argument"+n,i.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+n,i.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||t==null)&&this.throwError("missing new",i.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",i.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",i.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return p||(p=new i(T)),p}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",i.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_){if(!t)return;this.globalLogger().throwError("error censorship permanent",i.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}U=!!t,_=!!e}static setLogLevel(t){let e=g[t.toLowerCase()];if(e==null){i.globalLogger().warn("invalid log level - "+t);return}O=e}static from(t){return new i(t)}};i.errors=c;i.levels=x;var j="bytes/5.7.0";var b=new i(j);function lr(r){return!!r.toHexString}function D(r){return typeof r=="number"&&r==r&&r%1===0}function ar(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!D(r.length)||r.length<0)return!1;for(let t=0;t<r.length;t++){let e=r[t];if(!D(e)||e<0||e>=256)return!1}return!0}function ur(r,t){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||t&&r.length!==2+2*t)}var P="0123456789abcdef";function F(r,t){if(t||(t={}),typeof r=="number"){b.checkSafeUint53(r,"invalid hexlify value");let e="";for(;r;)e=P[r&15]+e,r=Math.floor(r/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),lr(r))return r.toHexString();if(ur(r))return r.length%2&&(t.hexPad==="left"?r="0x0"+r.substring(2):t.hexPad==="right"?r+="0":b.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(ar(r)){let e="0x";for(let n=0;n<r.length;n++){let o=r[n];e+=P[(o&240)>>4]+P[o&15]}return e}return b.throwArgumentError("invalid hexlify value","value",r)}var I=w("fs"),u=w("path");var q=cr(Z()),Y=r=>{let e=[n=>n.replace(/\s+/g,"-"),n=>n.replace(/\./g,"-"),n=>n.replace(/_/g,"-"),n=>n.replace(/-[a-z]/g,o=>o.slice(-1).toUpperCase()),n=>n.replace(/-/g,""),n=>n.replace(/^\d+/,""),n=>(0,q.default)(n)].reduce((n,o)=>o(n),r);if(e==="")throw new Error(`Can't normalize string: ${r}`);return e};var N=r=>(0,u.join)(r.projectDir,"out","debug"),Mr=r=>(0,u.join)(N(r),"__temp__"),Q=r=>(0,u.join)(N(r),`${r.projectName}-abi.json`),Gr=r=>(0,u.join)(N(r),`${r.projectName}.bin`),kr=r=>`${r.projectName}-abi`,Lr=r=>Y(r.projectName),zr=r=>{let t=Q(r);return JSON.parse((0,I.readFileSync)(t,"utf-8"))},et=r=>{let t=(0,u.basename)(r),e={projectDir:r,projectName:t},n=N(e),o=Mr(e),l=Gr(e),f=F((0,I.readFileSync)(l)),h=Q(e),s=kr(e),a=zr(e),E=Lr(e),m=`${n}/*-abi.json`;return{name:t,normalizedName:E,debugDir:n,tempDir:o,binPath:l,binHelixfied:f,abiPath:h,abiName:s,abiContents:a,inputGlobal:m}};})(); | ||
//# sourceMappingURL=test.global.js.map |
516
dist/test.js
@@ -1,516 +0,2 @@ | ||
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/test-utils/index.ts | ||
var test_utils_exports = {}; | ||
__export(test_utils_exports, { | ||
getForcProject: () => getForcProject, | ||
getProjectAbi: () => getProjectAbi, | ||
getProjectAbiName: () => getProjectAbiName, | ||
getProjectAbiPath: () => getProjectAbiPath, | ||
getProjectBinPath: () => getProjectBinPath, | ||
getProjectDebugDir: () => getProjectDebugDir, | ||
getProjectNormalizedName: () => getProjectNormalizedName, | ||
getProjectTempDir: () => getProjectTempDir, | ||
safeExec: () => safeExec | ||
}); | ||
module.exports = __toCommonJS(test_utils_exports); | ||
// src/test-utils/safeExec.ts | ||
var safeExec = async (lambda) => { | ||
let error; | ||
let result; | ||
try { | ||
result = await lambda(); | ||
} catch (_error) { | ||
error = _error; | ||
} | ||
return { error, result }; | ||
}; | ||
// ../../node_modules/.pnpm/@ethersproject+logger@5.7.0/node_modules/@ethersproject/logger/lib.esm/_version.js | ||
var version = "logger/5.7.0"; | ||
// ../../node_modules/.pnpm/@ethersproject+logger@5.7.0/node_modules/@ethersproject/logger/lib.esm/index.js | ||
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(ErrorCode2) { | ||
ErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; | ||
ErrorCode2["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; | ||
ErrorCode2["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; | ||
ErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR"; | ||
ErrorCode2["SERVER_ERROR"] = "SERVER_ERROR"; | ||
ErrorCode2["TIMEOUT"] = "TIMEOUT"; | ||
ErrorCode2["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; | ||
ErrorCode2["NUMERIC_FAULT"] = "NUMERIC_FAULT"; | ||
ErrorCode2["MISSING_NEW"] = "MISSING_NEW"; | ||
ErrorCode2["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; | ||
ErrorCode2["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; | ||
ErrorCode2["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; | ||
ErrorCode2["CALL_EXCEPTION"] = "CALL_EXCEPTION"; | ||
ErrorCode2["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; | ||
ErrorCode2["NONCE_EXPIRED"] = "NONCE_EXPIRED"; | ||
ErrorCode2["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; | ||
ErrorCode2["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; | ||
ErrorCode2["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; | ||
ErrorCode2["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; | ||
// ../../node_modules/.pnpm/@ethersproject+bytes@5.7.0/node_modules/@ethersproject/bytes/lib.esm/_version.js | ||
var version2 = "bytes/5.7.0"; | ||
// ../../node_modules/.pnpm/@ethersproject+bytes@5.7.0/node_modules/@ethersproject/bytes/lib.esm/index.js | ||
var logger = new Logger(version2); | ||
function isHexable(value) { | ||
return !!value.toHexString; | ||
} | ||
function isInteger(value) { | ||
return typeof value === "number" && value == value && value % 1 === 0; | ||
} | ||
function isBytes(value) { | ||
if (value == null) { | ||
return false; | ||
} | ||
if (value.constructor === Uint8Array) { | ||
return true; | ||
} | ||
if (typeof value === "string") { | ||
return false; | ||
} | ||
if (!isInteger(value.length) || value.length < 0) { | ||
return false; | ||
} | ||
for (let i = 0; i < value.length; i++) { | ||
const v = value[i]; | ||
if (!isInteger(v) || v < 0 || v >= 256) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
function isHexString(value, length) { | ||
if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { | ||
return false; | ||
} | ||
if (length && value.length !== 2 + 2 * length) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
var HexCharacters = "0123456789abcdef"; | ||
function hexlify(value, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
if (typeof value === "number") { | ||
logger.checkSafeUint53(value, "invalid hexlify value"); | ||
let hex = ""; | ||
while (value) { | ||
hex = HexCharacters[value & 15] + hex; | ||
value = Math.floor(value / 16); | ||
} | ||
if (hex.length) { | ||
if (hex.length % 2) { | ||
hex = "0" + hex; | ||
} | ||
return "0x" + hex; | ||
} | ||
return "0x00"; | ||
} | ||
if (typeof value === "bigint") { | ||
value = value.toString(16); | ||
if (value.length % 2) { | ||
return "0x0" + value; | ||
} | ||
return "0x" + value; | ||
} | ||
if (options.allowMissingPrefix && typeof value === "string" && value.substring(0, 2) !== "0x") { | ||
value = "0x" + value; | ||
} | ||
if (isHexable(value)) { | ||
return value.toHexString(); | ||
} | ||
if (isHexString(value)) { | ||
if (value.length % 2) { | ||
if (options.hexPad === "left") { | ||
value = "0x0" + value.substring(2); | ||
} else if (options.hexPad === "right") { | ||
value += "0"; | ||
} else { | ||
logger.throwArgumentError("hex data is odd-length", "value", value); | ||
} | ||
} | ||
return value.toLowerCase(); | ||
} | ||
if (isBytes(value)) { | ||
let result = "0x"; | ||
for (let i = 0; i < value.length; i++) { | ||
let v = value[i]; | ||
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15]; | ||
} | ||
return result; | ||
} | ||
return logger.throwArgumentError("invalid hexlify value", "value", value); | ||
} | ||
// src/test-utils/getForcProject.ts | ||
var import_fs = require("fs"); | ||
var import_path = require("path"); | ||
// src/utils/normalizeString.ts | ||
var import_lodash = __toESM(require("lodash.upperfirst")); | ||
var normalizeString = (str) => { | ||
const transformations = [ | ||
(s) => s.replace(/\s+/g, "-"), | ||
(s) => s.replace(/\./g, "-"), | ||
(s) => s.replace(/_/g, "-"), | ||
(s) => s.replace(/-[a-z]/g, (match) => match.slice(-1).toUpperCase()), | ||
(s) => s.replace(/-/g, ""), | ||
(s) => s.replace(/^\d+/, ""), | ||
(s) => (0, import_lodash.default)(s) | ||
]; | ||
const output = transformations.reduce((s, t) => t(s), str); | ||
if (output === "") { | ||
throw new Error(`Can't normalize string: ${str}`); | ||
} | ||
return output; | ||
}; | ||
// src/test-utils/getForcProject.ts | ||
var getProjectDebugDir = (params) => (0, import_path.join)(params.projectDir, "out", "debug"); | ||
var getProjectTempDir = (params) => (0, import_path.join)(getProjectDebugDir(params), "__temp__"); | ||
var getProjectAbiPath = (params) => (0, import_path.join)(getProjectDebugDir(params), `${params.projectName}-abi.json`); | ||
var getProjectBinPath = (params) => (0, import_path.join)(getProjectDebugDir(params), `${params.projectName}.bin`); | ||
var getProjectAbiName = (params) => `${params.projectName}-abi`; | ||
var getProjectNormalizedName = (params) => normalizeString(params.projectName); | ||
var getProjectAbi = (params) => { | ||
const projectPath = getProjectAbiPath(params); | ||
const abiContents = JSON.parse((0, import_fs.readFileSync)(projectPath, "utf-8")); | ||
return abiContents; | ||
}; | ||
var getForcProject = (projectDir) => { | ||
const projectName = (0, import_path.basename)(projectDir); | ||
const params = { | ||
projectDir, | ||
projectName | ||
}; | ||
const debugDir = getProjectDebugDir(params); | ||
const tempDir = getProjectTempDir(params); | ||
const binPath = getProjectBinPath(params); | ||
const binHelixfied = hexlify((0, import_fs.readFileSync)(binPath)); | ||
const abiPath = getProjectAbiPath(params); | ||
const abiName = getProjectAbiName(params); | ||
const abiContents = getProjectAbi(params); | ||
const normalizedName = getProjectNormalizedName(params); | ||
const inputGlobal = `${debugDir}/*-abi.json`; | ||
return { | ||
name: projectName, | ||
normalizedName, | ||
debugDir, | ||
tempDir, | ||
binPath, | ||
binHelixfied, | ||
abiPath, | ||
abiName, | ||
abiContents, | ||
inputGlobal | ||
}; | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
getForcProject, | ||
getProjectAbi, | ||
getProjectAbiName, | ||
getProjectAbiPath, | ||
getProjectBinPath, | ||
getProjectDebugDir, | ||
getProjectNormalizedName, | ||
getProjectTempDir, | ||
safeExec | ||
}); | ||
"use strict";var W=Object.create;var p=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var $=(r,t)=>{for(var e in t)p(r,e,{get:t[e],enumerable:!0})},_=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X(t))!V.call(r,i)&&i!==e&&p(r,i,{get:()=>t[i],enumerable:!(n=B(t,i))||n.enumerable});return r};var K=(r,t,e)=>(e=r!=null?W(H(r)):{},_(t||!r||!r.__esModule?p(e,"default",{value:r,enumerable:!0}):e,r)),J=r=>_(p({},"__esModule",{value:!0}),r);var er={};$(er,{getForcProject:()=>tr,getProjectAbi:()=>z,getProjectAbiName:()=>k,getProjectAbiPath:()=>y,getProjectBinPath:()=>d,getProjectDebugDir:()=>g,getProjectNormalizedName:()=>L,getProjectTempDir:()=>G,safeExec:()=>Z});module.exports=J(er);var Z=async r=>{let t,e;try{e=await r()}catch(n){t=n}return{error:t,result:e}};var U="logger/5.7.0";var b=!1,T=!1,x={debug:1,default:2,info:2,warning:3,error:4,off:5},S=x.default,P=null;function q(){try{let r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}var O=q(),A;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(A||(A={}));var c;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(c||(c={}));var D="0123456789abcdef",o=class{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){let n=t.toLowerCase();x[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(S>x[n])&&console.log.apply(console,e)}debug(...t){this._log(o.levels.DEBUG,t)}info(...t){this._log(o.levels.INFO,t)}warn(...t){this._log(o.levels.WARNING,t)}makeError(t,e,n){if(T)return this.makeError("censored error",e,{});e||(e=o.errors.UNKNOWN_ERROR),n||(n={});let i=[];Object.keys(n).forEach(s=>{let a=n[s];try{if(a instanceof Uint8Array){let u="";for(let m=0;m<a.length;m++)u+=D[a[m]>>4],u+=D[a[m]&15];i.push(s+"=Uint8Array(0x"+u+")")}else i.push(s+"="+JSON.stringify(a))}catch{i.push(s+"="+JSON.stringify(n[s].toString()))}}),i.push(`code=${e}`),i.push(`version=${this.version}`);let N=t,f="";switch(e){case c.NUMERIC_FAULT:{f="NUMERIC_FAULT";let s=t;switch(s){case"overflow":case"underflow":case"division-by-zero":f+="-"+s;break;case"negative-power":case"negative-width":f+="-unsupported";break;case"unbound-bitwise-result":f+="-unbound-result";break}break}case c.CALL_EXCEPTION:case c.INSUFFICIENT_FUNDS:case c.MISSING_NEW:case c.NONCE_EXPIRED:case c.REPLACEMENT_UNDERPRICED:case c.TRANSACTION_REPLACED:case c.UNPREDICTABLE_GAS_LIMIT:f=e;break}f&&(t+=" [ See: https://links.ethers.org/v5-errors-"+f+" ]"),i.length&&(t+=" ("+i.join(", ")+")");let E=new Error(t);return E.reason=N,E.code=e,Object.keys(n).forEach(function(s){E[s]=n[s]}),E}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,o.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,i){t||this.throwError(e,n,i)}assertArgument(t,e,n,i){t||this.throwArgumentError(e,n,i)}checkNormalize(t){t==null&&(t="platform missing String.prototype.normalize"),O&&this.throwError("platform missing String.prototype.normalize",o.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:O})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,o.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,o.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n?n=": "+n:n="",t<e&&this.throwError("missing argument"+n,o.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+n,o.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||t==null)&&this.throwError("missing new",o.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",o.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",o.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return P||(P=new o(U)),P}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",o.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),b){if(!t)return;this.globalLogger().throwError("error censorship permanent",o.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}T=!!t,b=!!e}static setLogLevel(t){let e=x[t.toLowerCase()];if(e==null){o.globalLogger().warn("invalid log level - "+t);return}S=e}static from(t){return new o(t)}};o.errors=c;o.levels=A;var F="bytes/5.7.0";var R=new o(F);function Q(r){return!!r.toHexString}function C(r){return typeof r=="number"&&r==r&&r%1===0}function Y(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!C(r.length)||r.length<0)return!1;for(let t=0;t<r.length;t++){let e=r[t];if(!C(e)||e<0||e>=256)return!1}return!0}function rr(r,t){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||t&&r.length!==2+2*t)}var I="0123456789abcdef";function v(r,t){if(t||(t={}),typeof r=="number"){R.checkSafeUint53(r,"invalid hexlify value");let e="";for(;r;)e=I[r&15]+e,r=Math.floor(r/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Q(r))return r.toHexString();if(rr(r))return r.length%2&&(t.hexPad==="left"?r="0x0"+r.substring(2):t.hexPad==="right"?r+="0":R.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(Y(r)){let e="0x";for(let n=0;n<r.length;n++){let i=r[n];e+=I[(i&240)>>4]+I[i&15]}return e}return R.throwArgumentError("invalid hexlify value","value",r)}var w=require("fs"),h=require("path");var M=K(require("lodash.upperfirst")),j=r=>{let e=[n=>n.replace(/\s+/g,"-"),n=>n.replace(/\./g,"-"),n=>n.replace(/_/g,"-"),n=>n.replace(/-[a-z]/g,i=>i.slice(-1).toUpperCase()),n=>n.replace(/-/g,""),n=>n.replace(/^\d+/,""),n=>(0,M.default)(n)].reduce((n,i)=>i(n),r);if(e==="")throw new Error(`Can't normalize string: ${r}`);return e};var g=r=>(0,h.join)(r.projectDir,"out","debug"),G=r=>(0,h.join)(g(r),"__temp__"),y=r=>(0,h.join)(g(r),`${r.projectName}-abi.json`),d=r=>(0,h.join)(g(r),`${r.projectName}.bin`),k=r=>`${r.projectName}-abi`,L=r=>j(r.projectName),z=r=>{let t=y(r);return JSON.parse((0,w.readFileSync)(t,"utf-8"))},tr=r=>{let t=(0,h.basename)(r),e={projectDir:r,projectName:t},n=g(e),i=G(e),N=d(e),f=v((0,w.readFileSync)(N)),E=y(e),s=k(e),a=z(e),u=L(e),m=`${n}/*-abi.json`;return{name:t,normalizedName:u,debugDir:n,tempDir:i,binPath:N,binHelixfied:f,abiPath:E,abiName:s,abiContents:a,inputGlobal:m}};0&&(module.exports={getForcProject,getProjectAbi,getProjectAbiName,getProjectAbiPath,getProjectBinPath,getProjectDebugDir,getProjectNormalizedName,getProjectTempDir,safeExec}); | ||
//# sourceMappingURL=test.js.map |
{ | ||
"name": "@fuel-ts/utils", | ||
"version": "0.0.0-pr-984-20230508220652", | ||
"version": "0.0.0-pr-990-20230508221740", | ||
"description": "Utilities (and test utilities) collection", | ||
@@ -42,5 +42,6 @@ "author": "Fuel Labs <contact@fuel.sh> (https://fuel.network/)", | ||
"pretest": "cd test/forc-projects/simple && forc build", | ||
"build": "tsup", | ||
"build:watch": "tsup --watch" | ||
} | ||
"build": "tsup --dts" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110664
148
5
2