@lens-protocol/shared-kernel
Advanced tools
Comparing version 0.11.0-alpha.11 to 0.11.0-alpha.12
@@ -17,2 +17,3 @@ import isObject from 'lodash/isObject'; | ||
export * from "./omitDeep.js"; | ||
export * from "./update.js"; | ||
export * from "./ts-helpers/assertError.js"; | ||
@@ -19,0 +20,0 @@ export * from "./ts-helpers/assertNever.js"; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var isObject = require('lodash/isObject'); | ||
var Amount = require('./Amount-e981b069.cjs.dev.js'); | ||
var unsupportedIterableToArray = require('./unsupportedIterableToArray-7c8af9ae.cjs.dev.js'); | ||
var defaultTo = require('lodash/defaultTo.js'); | ||
@@ -12,2 +12,3 @@ var isObject$1 = require('lodash/isObject.js'); | ||
var isObjectLike = require('lodash/isObjectLike.js'); | ||
var traverse = require('traverse'); | ||
require('decimal.js'); | ||
@@ -22,2 +23,3 @@ | ||
var isObjectLike__default = /*#__PURE__*/_interopDefault(isObjectLike); | ||
var traverse__default = /*#__PURE__*/_interopDefault(traverse); | ||
@@ -33,11 +35,11 @@ /** | ||
var CausedError = /*#__PURE__*/function (_Error) { | ||
Amount._inherits(CausedError, _Error); | ||
var _super = Amount._createSuper(CausedError); | ||
unsupportedIterableToArray._inherits(CausedError, _Error); | ||
var _super = unsupportedIterableToArray._createSuper(CausedError); | ||
function CausedError(message, options) { | ||
var _this; | ||
Amount._classCallCheck(this, CausedError); | ||
unsupportedIterableToArray._classCallCheck(this, CausedError); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore Error not yet properly typed | ||
_this = _super.call(this, message, options); | ||
if (isObject__default$1["default"](options) && options.cause && !('cause' in Amount._assertThisInitialized(_this))) { | ||
if (isObject__default$1["default"](options) && options.cause && !('cause' in unsupportedIterableToArray._assertThisInitialized(_this))) { | ||
var cause = options.cause; | ||
@@ -51,4 +53,4 @@ _this.cause = cause; | ||
} | ||
return Amount._createClass(CausedError); | ||
}( /*#__PURE__*/Amount._wrapNativeSuper(Error)); | ||
return unsupportedIterableToArray._createClass(CausedError); | ||
}( /*#__PURE__*/unsupportedIterableToArray._wrapNativeSuper(Error)); | ||
@@ -61,5 +63,5 @@ /** | ||
function DateUtils() { | ||
Amount._classCallCheck(this, DateUtils); | ||
unsupportedIterableToArray._classCallCheck(this, DateUtils); | ||
} | ||
Amount._createClass(DateUtils, null, [{ | ||
unsupportedIterableToArray._createClass(DateUtils, null, [{ | ||
key: "toUnix", | ||
@@ -115,5 +117,5 @@ value: function toUnix(date) { | ||
*/ | ||
var Deferred = /*#__PURE__*/Amount._createClass(function Deferred() { | ||
var Deferred = /*#__PURE__*/unsupportedIterableToArray._createClass(function Deferred() { | ||
var _this = this; | ||
Amount._classCallCheck(this, Deferred); | ||
unsupportedIterableToArray._classCallCheck(this, Deferred); | ||
this.promise = new Promise(function (resolve, reject) { | ||
@@ -138,6 +140,6 @@ _this.resolve = resolve; | ||
function Success(value) { | ||
Amount._classCallCheck(this, Success); | ||
unsupportedIterableToArray._classCallCheck(this, Success); | ||
this.value = value; | ||
} | ||
Amount._createClass(Success, [{ | ||
unsupportedIterableToArray._createClass(Success, [{ | ||
key: "isSuccess", | ||
@@ -173,6 +175,6 @@ value: function isSuccess() { | ||
function Failure(error) { | ||
Amount._classCallCheck(this, Failure); | ||
unsupportedIterableToArray._classCallCheck(this, Failure); | ||
this.error = error; | ||
} | ||
Amount._createClass(Failure, [{ | ||
unsupportedIterableToArray._createClass(Failure, [{ | ||
key: "isSuccess", | ||
@@ -315,3 +317,3 @@ value: function isSuccess() { | ||
function assertSuccess(result) { | ||
Amount.invariant(result.isSuccess(), 'Expected a success result'); | ||
unsupportedIterableToArray.invariant(result.isSuccess(), 'Expected a success result'); | ||
} | ||
@@ -323,3 +325,3 @@ | ||
function assertFailure(result) { | ||
Amount.invariant(result.isFailure(), 'Expected a failure result'); | ||
unsupportedIterableToArray.invariant(result.isFailure(), 'Expected a failure result'); | ||
} | ||
@@ -331,3 +333,3 @@ | ||
function assertNonEmptyArray(items) { | ||
Amount.invariant(hasAtLeastOne(items), "Expected array of to have at least one item, but received 0 items"); | ||
unsupportedIterableToArray.invariant(hasAtLeastOne(items), "Expected array of to have at least one item, but received 0 items"); | ||
} | ||
@@ -338,3 +340,3 @@ function hasJustOne(items) { | ||
function assertJustOne(items) { | ||
Amount.invariant(hasJustOne(items), 'Expected array of to have exactly one item.'); | ||
unsupportedIterableToArray.invariant(hasJustOne(items), 'Expected array of to have exactly one item.'); | ||
} | ||
@@ -389,2 +391,450 @@ function removeAtIndex(items, index) { | ||
function _regeneratorRuntime() { | ||
_regeneratorRuntime = function () { | ||
return e; | ||
}; | ||
var t, | ||
e = {}, | ||
r = Object.prototype, | ||
n = r.hasOwnProperty, | ||
o = Object.defineProperty || function (t, e, r) { | ||
t[e] = r.value; | ||
}, | ||
i = "function" == typeof Symbol ? Symbol : {}, | ||
a = i.iterator || "@@iterator", | ||
c = i.asyncIterator || "@@asyncIterator", | ||
u = i.toStringTag || "@@toStringTag"; | ||
function define(t, e, r) { | ||
return Object.defineProperty(t, e, { | ||
value: r, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}), t[e]; | ||
} | ||
try { | ||
define({}, ""); | ||
} catch (t) { | ||
define = function (t, e, r) { | ||
return t[e] = r; | ||
}; | ||
} | ||
function wrap(t, e, r, n) { | ||
var i = e && e.prototype instanceof Generator ? e : Generator, | ||
a = Object.create(i.prototype), | ||
c = new Context(n || []); | ||
return o(a, "_invoke", { | ||
value: makeInvokeMethod(t, r, c) | ||
}), a; | ||
} | ||
function tryCatch(t, e, r) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: t.call(e, r) | ||
}; | ||
} catch (t) { | ||
return { | ||
type: "throw", | ||
arg: t | ||
}; | ||
} | ||
} | ||
e.wrap = wrap; | ||
var h = "suspendedStart", | ||
l = "suspendedYield", | ||
f = "executing", | ||
s = "completed", | ||
y = {}; | ||
function Generator() {} | ||
function GeneratorFunction() {} | ||
function GeneratorFunctionPrototype() {} | ||
var p = {}; | ||
define(p, a, function () { | ||
return this; | ||
}); | ||
var d = Object.getPrototypeOf, | ||
v = d && d(d(values([]))); | ||
v && v !== r && n.call(v, a) && (p = v); | ||
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); | ||
function defineIteratorMethods(t) { | ||
["next", "throw", "return"].forEach(function (e) { | ||
define(t, e, function (t) { | ||
return this._invoke(e, t); | ||
}); | ||
}); | ||
} | ||
function AsyncIterator(t, e) { | ||
function invoke(r, o, i, a) { | ||
var c = tryCatch(t[r], t, o); | ||
if ("throw" !== c.type) { | ||
var u = c.arg, | ||
h = u.value; | ||
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { | ||
invoke("next", t, i, a); | ||
}, function (t) { | ||
invoke("throw", t, i, a); | ||
}) : e.resolve(h).then(function (t) { | ||
u.value = t, i(u); | ||
}, function (t) { | ||
return invoke("throw", t, i, a); | ||
}); | ||
} | ||
a(c.arg); | ||
} | ||
var r; | ||
o(this, "_invoke", { | ||
value: function (t, n) { | ||
function callInvokeWithMethodAndArg() { | ||
return new e(function (e, r) { | ||
invoke(t, n, e, r); | ||
}); | ||
} | ||
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
} | ||
}); | ||
} | ||
function makeInvokeMethod(e, r, n) { | ||
var o = h; | ||
return function (i, a) { | ||
if (o === f) throw new Error("Generator is already running"); | ||
if (o === s) { | ||
if ("throw" === i) throw a; | ||
return { | ||
value: t, | ||
done: !0 | ||
}; | ||
} | ||
for (n.method = i, n.arg = a;;) { | ||
var c = n.delegate; | ||
if (c) { | ||
var u = maybeInvokeDelegate(c, n); | ||
if (u) { | ||
if (u === y) continue; | ||
return u; | ||
} | ||
} | ||
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { | ||
if (o === h) throw o = s, n.arg; | ||
n.dispatchException(n.arg); | ||
} else "return" === n.method && n.abrupt("return", n.arg); | ||
o = f; | ||
var p = tryCatch(e, r, n); | ||
if ("normal" === p.type) { | ||
if (o = n.done ? s : l, p.arg === y) continue; | ||
return { | ||
value: p.arg, | ||
done: n.done | ||
}; | ||
} | ||
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); | ||
} | ||
}; | ||
} | ||
function maybeInvokeDelegate(e, r) { | ||
var n = r.method, | ||
o = e.iterator[n]; | ||
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; | ||
var i = tryCatch(o, e.iterator, r.arg); | ||
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; | ||
var a = i.arg; | ||
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); | ||
} | ||
function pushTryEntry(t) { | ||
var e = { | ||
tryLoc: t[0] | ||
}; | ||
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); | ||
} | ||
function resetTryEntry(t) { | ||
var e = t.completion || {}; | ||
e.type = "normal", delete e.arg, t.completion = e; | ||
} | ||
function Context(t) { | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}], t.forEach(pushTryEntry, this), this.reset(!0); | ||
} | ||
function values(e) { | ||
if (e || "" === e) { | ||
var r = e[a]; | ||
if (r) return r.call(e); | ||
if ("function" == typeof e.next) return e; | ||
if (!isNaN(e.length)) { | ||
var o = -1, | ||
i = function next() { | ||
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; | ||
return next.value = t, next.done = !0, next; | ||
}; | ||
return i.next = i; | ||
} | ||
} | ||
throw new TypeError(typeof e + " is not iterable"); | ||
} | ||
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { | ||
value: GeneratorFunctionPrototype, | ||
configurable: !0 | ||
}), o(GeneratorFunctionPrototype, "constructor", { | ||
value: GeneratorFunction, | ||
configurable: !0 | ||
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { | ||
var e = "function" == typeof t && t.constructor; | ||
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); | ||
}, e.mark = function (t) { | ||
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; | ||
}, e.awrap = function (t) { | ||
return { | ||
__await: t | ||
}; | ||
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { | ||
return this; | ||
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { | ||
void 0 === i && (i = Promise); | ||
var a = new AsyncIterator(wrap(t, r, n, o), i); | ||
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { | ||
return t.done ? t.value : a.next(); | ||
}); | ||
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { | ||
return this; | ||
}), define(g, "toString", function () { | ||
return "[object Generator]"; | ||
}), e.keys = function (t) { | ||
var e = Object(t), | ||
r = []; | ||
for (var n in e) r.push(n); | ||
return r.reverse(), function next() { | ||
for (; r.length;) { | ||
var t = r.pop(); | ||
if (t in e) return next.value = t, next.done = !1, next; | ||
} | ||
return next.done = !0, next; | ||
}; | ||
}, e.values = values, Context.prototype = { | ||
constructor: Context, | ||
reset: function (e) { | ||
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); | ||
}, | ||
stop: function () { | ||
this.done = !0; | ||
var t = this.tryEntries[0].completion; | ||
if ("throw" === t.type) throw t.arg; | ||
return this.rval; | ||
}, | ||
dispatchException: function (e) { | ||
if (this.done) throw e; | ||
var r = this; | ||
function handle(n, o) { | ||
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; | ||
} | ||
for (var o = this.tryEntries.length - 1; o >= 0; --o) { | ||
var i = this.tryEntries[o], | ||
a = i.completion; | ||
if ("root" === i.tryLoc) return handle("end"); | ||
if (i.tryLoc <= this.prev) { | ||
var c = n.call(i, "catchLoc"), | ||
u = n.call(i, "finallyLoc"); | ||
if (c && u) { | ||
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); | ||
if (this.prev < i.finallyLoc) return handle(i.finallyLoc); | ||
} else if (c) { | ||
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); | ||
} else { | ||
if (!u) throw new Error("try statement without catch or finally"); | ||
if (this.prev < i.finallyLoc) return handle(i.finallyLoc); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function (t, e) { | ||
for (var r = this.tryEntries.length - 1; r >= 0; --r) { | ||
var o = this.tryEntries[r]; | ||
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { | ||
var i = o; | ||
break; | ||
} | ||
} | ||
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); | ||
var a = i ? i.completion : {}; | ||
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); | ||
}, | ||
complete: function (t, e) { | ||
if ("throw" === t.type) throw t.arg; | ||
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; | ||
}, | ||
finish: function (t) { | ||
for (var e = this.tryEntries.length - 1; e >= 0; --e) { | ||
var r = this.tryEntries[e]; | ||
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; | ||
} | ||
}, | ||
catch: function (t) { | ||
for (var e = this.tryEntries.length - 1; e >= 0; --e) { | ||
var r = this.tryEntries[e]; | ||
if (r.tryLoc === t) { | ||
var n = r.completion; | ||
if ("throw" === n.type) { | ||
var o = n.arg; | ||
resetTryEntry(r); | ||
} | ||
return o; | ||
} | ||
} | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function (e, r, n) { | ||
return this.delegate = { | ||
iterator: values(e), | ||
resultName: r, | ||
nextLoc: n | ||
}, "next" === this.method && (this.arg = t), y; | ||
} | ||
}, e; | ||
} | ||
function _createForOfIteratorHelper(o, allowArrayLike) { | ||
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; | ||
if (!it) { | ||
if (Array.isArray(o) || (it = unsupportedIterableToArray._unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) o = it; | ||
var i = 0; | ||
var F = function () {}; | ||
return { | ||
s: F, | ||
n: function () { | ||
if (i >= o.length) return { | ||
done: true | ||
}; | ||
return { | ||
done: false, | ||
value: o[i++] | ||
}; | ||
}, | ||
e: function (e) { | ||
throw e; | ||
}, | ||
f: F | ||
}; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
var normalCompletion = true, | ||
didErr = false, | ||
err; | ||
return { | ||
s: function () { | ||
it = it.call(o); | ||
}, | ||
n: function () { | ||
var step = it.next(); | ||
normalCompletion = step.done; | ||
return step; | ||
}, | ||
e: function (e) { | ||
didErr = true; | ||
err = e; | ||
}, | ||
f: function () { | ||
try { | ||
if (!normalCompletion && it.return != null) it.return(); | ||
} finally { | ||
if (didErr) throw err; | ||
} | ||
} | ||
}; | ||
} | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
function _asyncToGenerator(fn) { | ||
return function () { | ||
var self = this, | ||
args = arguments; | ||
return new Promise(function (resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
function pathToRegExp(path) { | ||
return new RegExp("^".concat(path.replaceAll('.', '\\.').replaceAll('[n]', '\\.\\d+'), "$")); | ||
} | ||
function update(_x, _x2, _x3) { | ||
return _update.apply(this, arguments); | ||
} | ||
function _update() { | ||
_update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, paths, updater) { | ||
var output, regexps, toUpdate, _iterator, _step, _path, _value, updated; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
output = traverse__default["default"].clone(input); | ||
regexps = paths.map(pathToRegExp); | ||
toUpdate = traverse__default["default"].paths(output).filter(function (path) { | ||
return regexps.some(function (r) { | ||
return r.test(path.join('.')); | ||
}); | ||
}); | ||
_iterator = _createForOfIteratorHelper(toUpdate); | ||
_context.prev = 4; | ||
_iterator.s(); | ||
case 6: | ||
if ((_step = _iterator.n()).done) { | ||
_context.next = 16; | ||
break; | ||
} | ||
_path = _step.value; | ||
_value = traverse__default["default"].get(output, _path); | ||
if (!(typeof _value === 'string' && _value.length > 0)) { | ||
_context.next = 14; | ||
break; | ||
} | ||
_context.next = 12; | ||
return updater(_value, _path.join('.')); | ||
case 12: | ||
updated = _context.sent; | ||
traverse__default["default"].set(output, _path, updated); | ||
case 14: | ||
_context.next = 6; | ||
break; | ||
case 16: | ||
_context.next = 21; | ||
break; | ||
case 18: | ||
_context.prev = 18; | ||
_context.t0 = _context["catch"](4); | ||
_iterator.e(_context.t0); | ||
case 21: | ||
_context.prev = 21; | ||
_iterator.f(); | ||
return _context.finish(21); | ||
case 24: | ||
return _context.abrupt("return", output); | ||
case 25: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, null, [[4, 18, 21, 24]]); | ||
})); | ||
return _update.apply(this, arguments); | ||
} | ||
function assertError(error) { | ||
@@ -416,3 +866,3 @@ // why not `error instanceof Error`? see https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1099 | ||
var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Unexpected object: ".concat(String(x)); | ||
throw new Amount.InvariantError(message); | ||
throw new unsupportedIterableToArray.InvariantError(message); | ||
} | ||
@@ -426,3 +876,3 @@ | ||
var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Unexpected call to never()'; | ||
throw new Amount.InvariantError(message); | ||
throw new unsupportedIterableToArray.InvariantError(message); | ||
} | ||
@@ -438,3 +888,3 @@ | ||
} | ||
throw new Amount.InvariantError("Non nullable values expected, received ".concat(String(value), " with message: ").concat(message)); | ||
throw new unsupportedIterableToArray.InvariantError("Non nullable values expected, received ".concat(String(value), " with message: ").concat(message)); | ||
} | ||
@@ -449,15 +899,15 @@ function isNonNullable(value) { | ||
}); | ||
exports.Amount = Amount.Amount; | ||
exports.BigDecimal = Amount.BigDecimal; | ||
exports.ChainType = Amount.ChainType; | ||
exports.Denomination = Amount.Denomination; | ||
exports.InvariantError = Amount.InvariantError; | ||
exports.Kind = Amount.Kind; | ||
exports.NativeType = Amount.NativeType; | ||
exports.WellKnownSymbols = Amount.WellKnownSymbols; | ||
exports.erc20 = Amount.erc20; | ||
exports.ether = Amount.ether; | ||
exports.fiat = Amount.fiat; | ||
exports.invariant = Amount.invariant; | ||
exports.matic = Amount.matic; | ||
exports.Amount = unsupportedIterableToArray.Amount; | ||
exports.BigDecimal = unsupportedIterableToArray.BigDecimal; | ||
exports.ChainType = unsupportedIterableToArray.ChainType; | ||
exports.Denomination = unsupportedIterableToArray.Denomination; | ||
exports.InvariantError = unsupportedIterableToArray.InvariantError; | ||
exports.Kind = unsupportedIterableToArray.Kind; | ||
exports.NativeType = unsupportedIterableToArray.NativeType; | ||
exports.WellKnownSymbols = unsupportedIterableToArray.WellKnownSymbols; | ||
exports.erc20 = unsupportedIterableToArray.erc20; | ||
exports.ether = unsupportedIterableToArray.ether; | ||
exports.fiat = unsupportedIterableToArray.fiat; | ||
exports.invariant = unsupportedIterableToArray.invariant; | ||
exports.matic = unsupportedIterableToArray.matic; | ||
exports.CausedError = CausedError; | ||
@@ -487,1 +937,2 @@ exports.DateUtils = DateUtils; | ||
exports.success = success; | ||
exports.update = update; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var isObject = require('lodash/isObject'); | ||
var Amount = require('./Amount-70889ed3.cjs.prod.js'); | ||
var unsupportedIterableToArray = require('./unsupportedIterableToArray-74da6a45.cjs.prod.js'); | ||
var defaultTo = require('lodash/defaultTo.js'); | ||
@@ -12,2 +12,3 @@ var isObject$1 = require('lodash/isObject.js'); | ||
var isObjectLike = require('lodash/isObjectLike.js'); | ||
var traverse = require('traverse'); | ||
require('decimal.js'); | ||
@@ -22,2 +23,3 @@ | ||
var isObjectLike__default = /*#__PURE__*/_interopDefault(isObjectLike); | ||
var traverse__default = /*#__PURE__*/_interopDefault(traverse); | ||
@@ -33,11 +35,11 @@ /** | ||
var CausedError = /*#__PURE__*/function (_Error) { | ||
Amount._inherits(CausedError, _Error); | ||
var _super = Amount._createSuper(CausedError); | ||
unsupportedIterableToArray._inherits(CausedError, _Error); | ||
var _super = unsupportedIterableToArray._createSuper(CausedError); | ||
function CausedError(message, options) { | ||
var _this; | ||
Amount._classCallCheck(this, CausedError); | ||
unsupportedIterableToArray._classCallCheck(this, CausedError); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore Error not yet properly typed | ||
_this = _super.call(this, message, options); | ||
if (isObject__default$1["default"](options) && options.cause && !('cause' in Amount._assertThisInitialized(_this))) { | ||
if (isObject__default$1["default"](options) && options.cause && !('cause' in unsupportedIterableToArray._assertThisInitialized(_this))) { | ||
var cause = options.cause; | ||
@@ -51,4 +53,4 @@ _this.cause = cause; | ||
} | ||
return Amount._createClass(CausedError); | ||
}( /*#__PURE__*/Amount._wrapNativeSuper(Error)); | ||
return unsupportedIterableToArray._createClass(CausedError); | ||
}( /*#__PURE__*/unsupportedIterableToArray._wrapNativeSuper(Error)); | ||
@@ -61,5 +63,5 @@ /** | ||
function DateUtils() { | ||
Amount._classCallCheck(this, DateUtils); | ||
unsupportedIterableToArray._classCallCheck(this, DateUtils); | ||
} | ||
Amount._createClass(DateUtils, null, [{ | ||
unsupportedIterableToArray._createClass(DateUtils, null, [{ | ||
key: "toUnix", | ||
@@ -115,5 +117,5 @@ value: function toUnix(date) { | ||
*/ | ||
var Deferred = /*#__PURE__*/Amount._createClass(function Deferred() { | ||
var Deferred = /*#__PURE__*/unsupportedIterableToArray._createClass(function Deferred() { | ||
var _this = this; | ||
Amount._classCallCheck(this, Deferred); | ||
unsupportedIterableToArray._classCallCheck(this, Deferred); | ||
this.promise = new Promise(function (resolve, reject) { | ||
@@ -138,6 +140,6 @@ _this.resolve = resolve; | ||
function Success(value) { | ||
Amount._classCallCheck(this, Success); | ||
unsupportedIterableToArray._classCallCheck(this, Success); | ||
this.value = value; | ||
} | ||
Amount._createClass(Success, [{ | ||
unsupportedIterableToArray._createClass(Success, [{ | ||
key: "isSuccess", | ||
@@ -173,6 +175,6 @@ value: function isSuccess() { | ||
function Failure(error) { | ||
Amount._classCallCheck(this, Failure); | ||
unsupportedIterableToArray._classCallCheck(this, Failure); | ||
this.error = error; | ||
} | ||
Amount._createClass(Failure, [{ | ||
unsupportedIterableToArray._createClass(Failure, [{ | ||
key: "isSuccess", | ||
@@ -315,3 +317,3 @@ value: function isSuccess() { | ||
function assertSuccess(result) { | ||
Amount.invariant(result.isSuccess(), 'Expected a success result'); | ||
unsupportedIterableToArray.invariant(result.isSuccess(), 'Expected a success result'); | ||
} | ||
@@ -323,3 +325,3 @@ | ||
function assertFailure(result) { | ||
Amount.invariant(result.isFailure(), 'Expected a failure result'); | ||
unsupportedIterableToArray.invariant(result.isFailure(), 'Expected a failure result'); | ||
} | ||
@@ -331,3 +333,3 @@ | ||
function assertNonEmptyArray(items) { | ||
Amount.invariant(hasAtLeastOne(items), "Expected array of to have at least one item, but received 0 items"); | ||
unsupportedIterableToArray.invariant(hasAtLeastOne(items), "Expected array of to have at least one item, but received 0 items"); | ||
} | ||
@@ -338,3 +340,3 @@ function hasJustOne(items) { | ||
function assertJustOne(items) { | ||
Amount.invariant(hasJustOne(items), 'Expected array of to have exactly one item.'); | ||
unsupportedIterableToArray.invariant(hasJustOne(items), 'Expected array of to have exactly one item.'); | ||
} | ||
@@ -389,2 +391,450 @@ function removeAtIndex(items, index) { | ||
function _regeneratorRuntime() { | ||
_regeneratorRuntime = function () { | ||
return e; | ||
}; | ||
var t, | ||
e = {}, | ||
r = Object.prototype, | ||
n = r.hasOwnProperty, | ||
o = Object.defineProperty || function (t, e, r) { | ||
t[e] = r.value; | ||
}, | ||
i = "function" == typeof Symbol ? Symbol : {}, | ||
a = i.iterator || "@@iterator", | ||
c = i.asyncIterator || "@@asyncIterator", | ||
u = i.toStringTag || "@@toStringTag"; | ||
function define(t, e, r) { | ||
return Object.defineProperty(t, e, { | ||
value: r, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}), t[e]; | ||
} | ||
try { | ||
define({}, ""); | ||
} catch (t) { | ||
define = function (t, e, r) { | ||
return t[e] = r; | ||
}; | ||
} | ||
function wrap(t, e, r, n) { | ||
var i = e && e.prototype instanceof Generator ? e : Generator, | ||
a = Object.create(i.prototype), | ||
c = new Context(n || []); | ||
return o(a, "_invoke", { | ||
value: makeInvokeMethod(t, r, c) | ||
}), a; | ||
} | ||
function tryCatch(t, e, r) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: t.call(e, r) | ||
}; | ||
} catch (t) { | ||
return { | ||
type: "throw", | ||
arg: t | ||
}; | ||
} | ||
} | ||
e.wrap = wrap; | ||
var h = "suspendedStart", | ||
l = "suspendedYield", | ||
f = "executing", | ||
s = "completed", | ||
y = {}; | ||
function Generator() {} | ||
function GeneratorFunction() {} | ||
function GeneratorFunctionPrototype() {} | ||
var p = {}; | ||
define(p, a, function () { | ||
return this; | ||
}); | ||
var d = Object.getPrototypeOf, | ||
v = d && d(d(values([]))); | ||
v && v !== r && n.call(v, a) && (p = v); | ||
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); | ||
function defineIteratorMethods(t) { | ||
["next", "throw", "return"].forEach(function (e) { | ||
define(t, e, function (t) { | ||
return this._invoke(e, t); | ||
}); | ||
}); | ||
} | ||
function AsyncIterator(t, e) { | ||
function invoke(r, o, i, a) { | ||
var c = tryCatch(t[r], t, o); | ||
if ("throw" !== c.type) { | ||
var u = c.arg, | ||
h = u.value; | ||
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { | ||
invoke("next", t, i, a); | ||
}, function (t) { | ||
invoke("throw", t, i, a); | ||
}) : e.resolve(h).then(function (t) { | ||
u.value = t, i(u); | ||
}, function (t) { | ||
return invoke("throw", t, i, a); | ||
}); | ||
} | ||
a(c.arg); | ||
} | ||
var r; | ||
o(this, "_invoke", { | ||
value: function (t, n) { | ||
function callInvokeWithMethodAndArg() { | ||
return new e(function (e, r) { | ||
invoke(t, n, e, r); | ||
}); | ||
} | ||
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
} | ||
}); | ||
} | ||
function makeInvokeMethod(e, r, n) { | ||
var o = h; | ||
return function (i, a) { | ||
if (o === f) throw new Error("Generator is already running"); | ||
if (o === s) { | ||
if ("throw" === i) throw a; | ||
return { | ||
value: t, | ||
done: !0 | ||
}; | ||
} | ||
for (n.method = i, n.arg = a;;) { | ||
var c = n.delegate; | ||
if (c) { | ||
var u = maybeInvokeDelegate(c, n); | ||
if (u) { | ||
if (u === y) continue; | ||
return u; | ||
} | ||
} | ||
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { | ||
if (o === h) throw o = s, n.arg; | ||
n.dispatchException(n.arg); | ||
} else "return" === n.method && n.abrupt("return", n.arg); | ||
o = f; | ||
var p = tryCatch(e, r, n); | ||
if ("normal" === p.type) { | ||
if (o = n.done ? s : l, p.arg === y) continue; | ||
return { | ||
value: p.arg, | ||
done: n.done | ||
}; | ||
} | ||
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); | ||
} | ||
}; | ||
} | ||
function maybeInvokeDelegate(e, r) { | ||
var n = r.method, | ||
o = e.iterator[n]; | ||
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; | ||
var i = tryCatch(o, e.iterator, r.arg); | ||
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; | ||
var a = i.arg; | ||
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); | ||
} | ||
function pushTryEntry(t) { | ||
var e = { | ||
tryLoc: t[0] | ||
}; | ||
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); | ||
} | ||
function resetTryEntry(t) { | ||
var e = t.completion || {}; | ||
e.type = "normal", delete e.arg, t.completion = e; | ||
} | ||
function Context(t) { | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}], t.forEach(pushTryEntry, this), this.reset(!0); | ||
} | ||
function values(e) { | ||
if (e || "" === e) { | ||
var r = e[a]; | ||
if (r) return r.call(e); | ||
if ("function" == typeof e.next) return e; | ||
if (!isNaN(e.length)) { | ||
var o = -1, | ||
i = function next() { | ||
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; | ||
return next.value = t, next.done = !0, next; | ||
}; | ||
return i.next = i; | ||
} | ||
} | ||
throw new TypeError(typeof e + " is not iterable"); | ||
} | ||
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { | ||
value: GeneratorFunctionPrototype, | ||
configurable: !0 | ||
}), o(GeneratorFunctionPrototype, "constructor", { | ||
value: GeneratorFunction, | ||
configurable: !0 | ||
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { | ||
var e = "function" == typeof t && t.constructor; | ||
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); | ||
}, e.mark = function (t) { | ||
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; | ||
}, e.awrap = function (t) { | ||
return { | ||
__await: t | ||
}; | ||
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { | ||
return this; | ||
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { | ||
void 0 === i && (i = Promise); | ||
var a = new AsyncIterator(wrap(t, r, n, o), i); | ||
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { | ||
return t.done ? t.value : a.next(); | ||
}); | ||
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { | ||
return this; | ||
}), define(g, "toString", function () { | ||
return "[object Generator]"; | ||
}), e.keys = function (t) { | ||
var e = Object(t), | ||
r = []; | ||
for (var n in e) r.push(n); | ||
return r.reverse(), function next() { | ||
for (; r.length;) { | ||
var t = r.pop(); | ||
if (t in e) return next.value = t, next.done = !1, next; | ||
} | ||
return next.done = !0, next; | ||
}; | ||
}, e.values = values, Context.prototype = { | ||
constructor: Context, | ||
reset: function (e) { | ||
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); | ||
}, | ||
stop: function () { | ||
this.done = !0; | ||
var t = this.tryEntries[0].completion; | ||
if ("throw" === t.type) throw t.arg; | ||
return this.rval; | ||
}, | ||
dispatchException: function (e) { | ||
if (this.done) throw e; | ||
var r = this; | ||
function handle(n, o) { | ||
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; | ||
} | ||
for (var o = this.tryEntries.length - 1; o >= 0; --o) { | ||
var i = this.tryEntries[o], | ||
a = i.completion; | ||
if ("root" === i.tryLoc) return handle("end"); | ||
if (i.tryLoc <= this.prev) { | ||
var c = n.call(i, "catchLoc"), | ||
u = n.call(i, "finallyLoc"); | ||
if (c && u) { | ||
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); | ||
if (this.prev < i.finallyLoc) return handle(i.finallyLoc); | ||
} else if (c) { | ||
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); | ||
} else { | ||
if (!u) throw new Error("try statement without catch or finally"); | ||
if (this.prev < i.finallyLoc) return handle(i.finallyLoc); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function (t, e) { | ||
for (var r = this.tryEntries.length - 1; r >= 0; --r) { | ||
var o = this.tryEntries[r]; | ||
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { | ||
var i = o; | ||
break; | ||
} | ||
} | ||
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); | ||
var a = i ? i.completion : {}; | ||
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); | ||
}, | ||
complete: function (t, e) { | ||
if ("throw" === t.type) throw t.arg; | ||
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; | ||
}, | ||
finish: function (t) { | ||
for (var e = this.tryEntries.length - 1; e >= 0; --e) { | ||
var r = this.tryEntries[e]; | ||
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; | ||
} | ||
}, | ||
catch: function (t) { | ||
for (var e = this.tryEntries.length - 1; e >= 0; --e) { | ||
var r = this.tryEntries[e]; | ||
if (r.tryLoc === t) { | ||
var n = r.completion; | ||
if ("throw" === n.type) { | ||
var o = n.arg; | ||
resetTryEntry(r); | ||
} | ||
return o; | ||
} | ||
} | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function (e, r, n) { | ||
return this.delegate = { | ||
iterator: values(e), | ||
resultName: r, | ||
nextLoc: n | ||
}, "next" === this.method && (this.arg = t), y; | ||
} | ||
}, e; | ||
} | ||
function _createForOfIteratorHelper(o, allowArrayLike) { | ||
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; | ||
if (!it) { | ||
if (Array.isArray(o) || (it = unsupportedIterableToArray._unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) o = it; | ||
var i = 0; | ||
var F = function () {}; | ||
return { | ||
s: F, | ||
n: function () { | ||
if (i >= o.length) return { | ||
done: true | ||
}; | ||
return { | ||
done: false, | ||
value: o[i++] | ||
}; | ||
}, | ||
e: function (e) { | ||
throw e; | ||
}, | ||
f: F | ||
}; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
var normalCompletion = true, | ||
didErr = false, | ||
err; | ||
return { | ||
s: function () { | ||
it = it.call(o); | ||
}, | ||
n: function () { | ||
var step = it.next(); | ||
normalCompletion = step.done; | ||
return step; | ||
}, | ||
e: function (e) { | ||
didErr = true; | ||
err = e; | ||
}, | ||
f: function () { | ||
try { | ||
if (!normalCompletion && it.return != null) it.return(); | ||
} finally { | ||
if (didErr) throw err; | ||
} | ||
} | ||
}; | ||
} | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
function _asyncToGenerator(fn) { | ||
return function () { | ||
var self = this, | ||
args = arguments; | ||
return new Promise(function (resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
function pathToRegExp(path) { | ||
return new RegExp("^".concat(path.replaceAll('.', '\\.').replaceAll('[n]', '\\.\\d+'), "$")); | ||
} | ||
function update(_x, _x2, _x3) { | ||
return _update.apply(this, arguments); | ||
} | ||
function _update() { | ||
_update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, paths, updater) { | ||
var output, regexps, toUpdate, _iterator, _step, _path, _value, updated; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
output = traverse__default["default"].clone(input); | ||
regexps = paths.map(pathToRegExp); | ||
toUpdate = traverse__default["default"].paths(output).filter(function (path) { | ||
return regexps.some(function (r) { | ||
return r.test(path.join('.')); | ||
}); | ||
}); | ||
_iterator = _createForOfIteratorHelper(toUpdate); | ||
_context.prev = 4; | ||
_iterator.s(); | ||
case 6: | ||
if ((_step = _iterator.n()).done) { | ||
_context.next = 16; | ||
break; | ||
} | ||
_path = _step.value; | ||
_value = traverse__default["default"].get(output, _path); | ||
if (!(typeof _value === 'string' && _value.length > 0)) { | ||
_context.next = 14; | ||
break; | ||
} | ||
_context.next = 12; | ||
return updater(_value, _path.join('.')); | ||
case 12: | ||
updated = _context.sent; | ||
traverse__default["default"].set(output, _path, updated); | ||
case 14: | ||
_context.next = 6; | ||
break; | ||
case 16: | ||
_context.next = 21; | ||
break; | ||
case 18: | ||
_context.prev = 18; | ||
_context.t0 = _context["catch"](4); | ||
_iterator.e(_context.t0); | ||
case 21: | ||
_context.prev = 21; | ||
_iterator.f(); | ||
return _context.finish(21); | ||
case 24: | ||
return _context.abrupt("return", output); | ||
case 25: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, null, [[4, 18, 21, 24]]); | ||
})); | ||
return _update.apply(this, arguments); | ||
} | ||
function assertError(error) { | ||
@@ -416,3 +866,3 @@ // why not `error instanceof Error`? see https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1099 | ||
var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Unexpected object: ".concat(String(x)); | ||
throw new Amount.InvariantError(message); | ||
throw new unsupportedIterableToArray.InvariantError(message); | ||
} | ||
@@ -426,3 +876,3 @@ | ||
var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Unexpected call to never()'; | ||
throw new Amount.InvariantError(message); | ||
throw new unsupportedIterableToArray.InvariantError(message); | ||
} | ||
@@ -438,3 +888,3 @@ | ||
} | ||
throw new Amount.InvariantError("Non nullable values expected, received ".concat(String(value), " with message: ").concat(message)); | ||
throw new unsupportedIterableToArray.InvariantError("Non nullable values expected, received ".concat(String(value), " with message: ").concat(message)); | ||
} | ||
@@ -449,15 +899,15 @@ function isNonNullable(value) { | ||
}); | ||
exports.Amount = Amount.Amount; | ||
exports.BigDecimal = Amount.BigDecimal; | ||
exports.ChainType = Amount.ChainType; | ||
exports.Denomination = Amount.Denomination; | ||
exports.InvariantError = Amount.InvariantError; | ||
exports.Kind = Amount.Kind; | ||
exports.NativeType = Amount.NativeType; | ||
exports.WellKnownSymbols = Amount.WellKnownSymbols; | ||
exports.erc20 = Amount.erc20; | ||
exports.ether = Amount.ether; | ||
exports.fiat = Amount.fiat; | ||
exports.invariant = Amount.invariant; | ||
exports.matic = Amount.matic; | ||
exports.Amount = unsupportedIterableToArray.Amount; | ||
exports.BigDecimal = unsupportedIterableToArray.BigDecimal; | ||
exports.ChainType = unsupportedIterableToArray.ChainType; | ||
exports.Denomination = unsupportedIterableToArray.Denomination; | ||
exports.InvariantError = unsupportedIterableToArray.InvariantError; | ||
exports.Kind = unsupportedIterableToArray.Kind; | ||
exports.NativeType = unsupportedIterableToArray.NativeType; | ||
exports.WellKnownSymbols = unsupportedIterableToArray.WellKnownSymbols; | ||
exports.erc20 = unsupportedIterableToArray.erc20; | ||
exports.ether = unsupportedIterableToArray.ether; | ||
exports.fiat = unsupportedIterableToArray.fiat; | ||
exports.invariant = unsupportedIterableToArray.invariant; | ||
exports.matic = unsupportedIterableToArray.matic; | ||
exports.CausedError = CausedError; | ||
@@ -487,1 +937,2 @@ exports.DateUtils = DateUtils; | ||
exports.success = success; | ||
exports.update = update; |
import isObject$1 from 'lodash/isObject'; | ||
export { default as isObject } from 'lodash/isObject'; | ||
import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _assertThisInitialized, d as _createClass, e as _wrapNativeSuper, i as invariant, I as InvariantError } from './Amount-d254bbee.esm.js'; | ||
export { A as Amount, B as BigDecimal, C as ChainType, D as Denomination, I as InvariantError, K as Kind, N as NativeType, W as WellKnownSymbols, f as erc20, g as ether, h as fiat, i as invariant, m as matic } from './Amount-d254bbee.esm.js'; | ||
import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _assertThisInitialized, d as _createClass, e as _wrapNativeSuper, i as invariant, f as _unsupportedIterableToArray, I as InvariantError } from './unsupportedIterableToArray-16feead9.esm.js'; | ||
export { A as Amount, B as BigDecimal, C as ChainType, D as Denomination, I as InvariantError, K as Kind, N as NativeType, W as WellKnownSymbols, g as erc20, h as ether, j as fiat, i as invariant, m as matic } from './unsupportedIterableToArray-16feead9.esm.js'; | ||
import defaultTo from 'lodash/defaultTo.js'; | ||
@@ -9,2 +9,3 @@ import isObject from 'lodash/isObject.js'; | ||
import isObjectLike from 'lodash/isObjectLike.js'; | ||
import traverse from 'traverse'; | ||
import 'decimal.js'; | ||
@@ -367,2 +368,450 @@ | ||
function _regeneratorRuntime() { | ||
_regeneratorRuntime = function () { | ||
return e; | ||
}; | ||
var t, | ||
e = {}, | ||
r = Object.prototype, | ||
n = r.hasOwnProperty, | ||
o = Object.defineProperty || function (t, e, r) { | ||
t[e] = r.value; | ||
}, | ||
i = "function" == typeof Symbol ? Symbol : {}, | ||
a = i.iterator || "@@iterator", | ||
c = i.asyncIterator || "@@asyncIterator", | ||
u = i.toStringTag || "@@toStringTag"; | ||
function define(t, e, r) { | ||
return Object.defineProperty(t, e, { | ||
value: r, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}), t[e]; | ||
} | ||
try { | ||
define({}, ""); | ||
} catch (t) { | ||
define = function (t, e, r) { | ||
return t[e] = r; | ||
}; | ||
} | ||
function wrap(t, e, r, n) { | ||
var i = e && e.prototype instanceof Generator ? e : Generator, | ||
a = Object.create(i.prototype), | ||
c = new Context(n || []); | ||
return o(a, "_invoke", { | ||
value: makeInvokeMethod(t, r, c) | ||
}), a; | ||
} | ||
function tryCatch(t, e, r) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: t.call(e, r) | ||
}; | ||
} catch (t) { | ||
return { | ||
type: "throw", | ||
arg: t | ||
}; | ||
} | ||
} | ||
e.wrap = wrap; | ||
var h = "suspendedStart", | ||
l = "suspendedYield", | ||
f = "executing", | ||
s = "completed", | ||
y = {}; | ||
function Generator() {} | ||
function GeneratorFunction() {} | ||
function GeneratorFunctionPrototype() {} | ||
var p = {}; | ||
define(p, a, function () { | ||
return this; | ||
}); | ||
var d = Object.getPrototypeOf, | ||
v = d && d(d(values([]))); | ||
v && v !== r && n.call(v, a) && (p = v); | ||
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); | ||
function defineIteratorMethods(t) { | ||
["next", "throw", "return"].forEach(function (e) { | ||
define(t, e, function (t) { | ||
return this._invoke(e, t); | ||
}); | ||
}); | ||
} | ||
function AsyncIterator(t, e) { | ||
function invoke(r, o, i, a) { | ||
var c = tryCatch(t[r], t, o); | ||
if ("throw" !== c.type) { | ||
var u = c.arg, | ||
h = u.value; | ||
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { | ||
invoke("next", t, i, a); | ||
}, function (t) { | ||
invoke("throw", t, i, a); | ||
}) : e.resolve(h).then(function (t) { | ||
u.value = t, i(u); | ||
}, function (t) { | ||
return invoke("throw", t, i, a); | ||
}); | ||
} | ||
a(c.arg); | ||
} | ||
var r; | ||
o(this, "_invoke", { | ||
value: function (t, n) { | ||
function callInvokeWithMethodAndArg() { | ||
return new e(function (e, r) { | ||
invoke(t, n, e, r); | ||
}); | ||
} | ||
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
} | ||
}); | ||
} | ||
function makeInvokeMethod(e, r, n) { | ||
var o = h; | ||
return function (i, a) { | ||
if (o === f) throw new Error("Generator is already running"); | ||
if (o === s) { | ||
if ("throw" === i) throw a; | ||
return { | ||
value: t, | ||
done: !0 | ||
}; | ||
} | ||
for (n.method = i, n.arg = a;;) { | ||
var c = n.delegate; | ||
if (c) { | ||
var u = maybeInvokeDelegate(c, n); | ||
if (u) { | ||
if (u === y) continue; | ||
return u; | ||
} | ||
} | ||
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { | ||
if (o === h) throw o = s, n.arg; | ||
n.dispatchException(n.arg); | ||
} else "return" === n.method && n.abrupt("return", n.arg); | ||
o = f; | ||
var p = tryCatch(e, r, n); | ||
if ("normal" === p.type) { | ||
if (o = n.done ? s : l, p.arg === y) continue; | ||
return { | ||
value: p.arg, | ||
done: n.done | ||
}; | ||
} | ||
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); | ||
} | ||
}; | ||
} | ||
function maybeInvokeDelegate(e, r) { | ||
var n = r.method, | ||
o = e.iterator[n]; | ||
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; | ||
var i = tryCatch(o, e.iterator, r.arg); | ||
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; | ||
var a = i.arg; | ||
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); | ||
} | ||
function pushTryEntry(t) { | ||
var e = { | ||
tryLoc: t[0] | ||
}; | ||
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); | ||
} | ||
function resetTryEntry(t) { | ||
var e = t.completion || {}; | ||
e.type = "normal", delete e.arg, t.completion = e; | ||
} | ||
function Context(t) { | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}], t.forEach(pushTryEntry, this), this.reset(!0); | ||
} | ||
function values(e) { | ||
if (e || "" === e) { | ||
var r = e[a]; | ||
if (r) return r.call(e); | ||
if ("function" == typeof e.next) return e; | ||
if (!isNaN(e.length)) { | ||
var o = -1, | ||
i = function next() { | ||
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; | ||
return next.value = t, next.done = !0, next; | ||
}; | ||
return i.next = i; | ||
} | ||
} | ||
throw new TypeError(typeof e + " is not iterable"); | ||
} | ||
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { | ||
value: GeneratorFunctionPrototype, | ||
configurable: !0 | ||
}), o(GeneratorFunctionPrototype, "constructor", { | ||
value: GeneratorFunction, | ||
configurable: !0 | ||
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { | ||
var e = "function" == typeof t && t.constructor; | ||
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); | ||
}, e.mark = function (t) { | ||
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; | ||
}, e.awrap = function (t) { | ||
return { | ||
__await: t | ||
}; | ||
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { | ||
return this; | ||
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { | ||
void 0 === i && (i = Promise); | ||
var a = new AsyncIterator(wrap(t, r, n, o), i); | ||
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { | ||
return t.done ? t.value : a.next(); | ||
}); | ||
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { | ||
return this; | ||
}), define(g, "toString", function () { | ||
return "[object Generator]"; | ||
}), e.keys = function (t) { | ||
var e = Object(t), | ||
r = []; | ||
for (var n in e) r.push(n); | ||
return r.reverse(), function next() { | ||
for (; r.length;) { | ||
var t = r.pop(); | ||
if (t in e) return next.value = t, next.done = !1, next; | ||
} | ||
return next.done = !0, next; | ||
}; | ||
}, e.values = values, Context.prototype = { | ||
constructor: Context, | ||
reset: function (e) { | ||
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); | ||
}, | ||
stop: function () { | ||
this.done = !0; | ||
var t = this.tryEntries[0].completion; | ||
if ("throw" === t.type) throw t.arg; | ||
return this.rval; | ||
}, | ||
dispatchException: function (e) { | ||
if (this.done) throw e; | ||
var r = this; | ||
function handle(n, o) { | ||
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; | ||
} | ||
for (var o = this.tryEntries.length - 1; o >= 0; --o) { | ||
var i = this.tryEntries[o], | ||
a = i.completion; | ||
if ("root" === i.tryLoc) return handle("end"); | ||
if (i.tryLoc <= this.prev) { | ||
var c = n.call(i, "catchLoc"), | ||
u = n.call(i, "finallyLoc"); | ||
if (c && u) { | ||
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); | ||
if (this.prev < i.finallyLoc) return handle(i.finallyLoc); | ||
} else if (c) { | ||
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); | ||
} else { | ||
if (!u) throw new Error("try statement without catch or finally"); | ||
if (this.prev < i.finallyLoc) return handle(i.finallyLoc); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function (t, e) { | ||
for (var r = this.tryEntries.length - 1; r >= 0; --r) { | ||
var o = this.tryEntries[r]; | ||
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { | ||
var i = o; | ||
break; | ||
} | ||
} | ||
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); | ||
var a = i ? i.completion : {}; | ||
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); | ||
}, | ||
complete: function (t, e) { | ||
if ("throw" === t.type) throw t.arg; | ||
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; | ||
}, | ||
finish: function (t) { | ||
for (var e = this.tryEntries.length - 1; e >= 0; --e) { | ||
var r = this.tryEntries[e]; | ||
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; | ||
} | ||
}, | ||
catch: function (t) { | ||
for (var e = this.tryEntries.length - 1; e >= 0; --e) { | ||
var r = this.tryEntries[e]; | ||
if (r.tryLoc === t) { | ||
var n = r.completion; | ||
if ("throw" === n.type) { | ||
var o = n.arg; | ||
resetTryEntry(r); | ||
} | ||
return o; | ||
} | ||
} | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function (e, r, n) { | ||
return this.delegate = { | ||
iterator: values(e), | ||
resultName: r, | ||
nextLoc: n | ||
}, "next" === this.method && (this.arg = t), y; | ||
} | ||
}, e; | ||
} | ||
function _createForOfIteratorHelper(o, allowArrayLike) { | ||
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; | ||
if (!it) { | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) o = it; | ||
var i = 0; | ||
var F = function () {}; | ||
return { | ||
s: F, | ||
n: function () { | ||
if (i >= o.length) return { | ||
done: true | ||
}; | ||
return { | ||
done: false, | ||
value: o[i++] | ||
}; | ||
}, | ||
e: function (e) { | ||
throw e; | ||
}, | ||
f: F | ||
}; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
var normalCompletion = true, | ||
didErr = false, | ||
err; | ||
return { | ||
s: function () { | ||
it = it.call(o); | ||
}, | ||
n: function () { | ||
var step = it.next(); | ||
normalCompletion = step.done; | ||
return step; | ||
}, | ||
e: function (e) { | ||
didErr = true; | ||
err = e; | ||
}, | ||
f: function () { | ||
try { | ||
if (!normalCompletion && it.return != null) it.return(); | ||
} finally { | ||
if (didErr) throw err; | ||
} | ||
} | ||
}; | ||
} | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
function _asyncToGenerator(fn) { | ||
return function () { | ||
var self = this, | ||
args = arguments; | ||
return new Promise(function (resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
function pathToRegExp(path) { | ||
return new RegExp("^".concat(path.replaceAll('.', '\\.').replaceAll('[n]', '\\.\\d+'), "$")); | ||
} | ||
function update(_x, _x2, _x3) { | ||
return _update.apply(this, arguments); | ||
} | ||
function _update() { | ||
_update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, paths, updater) { | ||
var output, regexps, toUpdate, _iterator, _step, _path, _value, updated; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
output = traverse.clone(input); | ||
regexps = paths.map(pathToRegExp); | ||
toUpdate = traverse.paths(output).filter(function (path) { | ||
return regexps.some(function (r) { | ||
return r.test(path.join('.')); | ||
}); | ||
}); | ||
_iterator = _createForOfIteratorHelper(toUpdate); | ||
_context.prev = 4; | ||
_iterator.s(); | ||
case 6: | ||
if ((_step = _iterator.n()).done) { | ||
_context.next = 16; | ||
break; | ||
} | ||
_path = _step.value; | ||
_value = traverse.get(output, _path); | ||
if (!(typeof _value === 'string' && _value.length > 0)) { | ||
_context.next = 14; | ||
break; | ||
} | ||
_context.next = 12; | ||
return updater(_value, _path.join('.')); | ||
case 12: | ||
updated = _context.sent; | ||
traverse.set(output, _path, updated); | ||
case 14: | ||
_context.next = 6; | ||
break; | ||
case 16: | ||
_context.next = 21; | ||
break; | ||
case 18: | ||
_context.prev = 18; | ||
_context.t0 = _context["catch"](4); | ||
_iterator.e(_context.t0); | ||
case 21: | ||
_context.prev = 21; | ||
_iterator.f(); | ||
return _context.finish(21); | ||
case 24: | ||
return _context.abrupt("return", output); | ||
case 25: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, null, [[4, 18, 21, 24]]); | ||
})); | ||
return _update.apply(this, arguments); | ||
} | ||
function assertError(error) { | ||
@@ -420,2 +869,2 @@ // why not `error instanceof Error`? see https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1099 | ||
export { CausedError, DateUtils, Deferred, assertError, assertErrorWithCode, assertErrorWithReason, assertFailure, assertJustOne, assertNever, assertNonEmptyArray, assertSuccess, failure, get, hasAtLeastOne, hasJustOne, hasTwoOrMore, isInEnum, isNonNullable, maybe, never, nonNullable, omitDeep, removeAtIndex, success }; | ||
export { CausedError, DateUtils, Deferred, assertError, assertErrorWithCode, assertErrorWithReason, assertFailure, assertJustOne, assertNever, assertNonEmptyArray, assertSuccess, failure, get, hasAtLeastOne, hasJustOne, hasTwoOrMore, isInEnum, isNonNullable, maybe, never, nonNullable, omitDeep, removeAtIndex, success, update }; |
@@ -5,14 +5,8 @@ 'use strict'; | ||
var unsupportedIterableToArray = require('../../dist/unsupportedIterableToArray-7c8af9ae.cjs.dev.js'); | ||
var address = require('@ethersproject/address'); | ||
var Amount = require('../../dist/Amount-e981b069.cjs.dev.js'); | ||
require('decimal.js'); | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
if (Array.isArray(arr)) return unsupportedIterableToArray._arrayLikeToArray(arr); | ||
} | ||
@@ -24,11 +18,2 @@ | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _nonIterableSpread() { | ||
@@ -39,3 +24,3 @@ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || unsupportedIterableToArray._unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
@@ -58,12 +43,12 @@ | ||
function mockEtherAmount(value) { | ||
return Amount.Amount.ether(value); | ||
return unsupportedIterableToArray.Amount.ether(value); | ||
} | ||
function mockEtherGweiAmount(value) { | ||
return Amount.Amount.ether(Amount.Denomination.gwei(value)); | ||
return unsupportedIterableToArray.Amount.ether(unsupportedIterableToArray.Denomination.gwei(value)); | ||
} | ||
function mockMaticGweiAmount(value) { | ||
return Amount.Amount.matic(Amount.Denomination.gwei(value)); | ||
return unsupportedIterableToArray.Amount.matic(unsupportedIterableToArray.Denomination.gwei(value)); | ||
} | ||
function mockUsdAsset() { | ||
return Amount.fiat({ | ||
return unsupportedIterableToArray.fiat({ | ||
name: 'US Dollar', | ||
@@ -74,3 +59,3 @@ symbol: 'USD' | ||
function mockUsdAmount(value) { | ||
return Amount.Amount.fiat(mockUsdAsset(), value); | ||
return unsupportedIterableToArray.Amount.fiat(mockUsdAsset(), value); | ||
} | ||
@@ -81,4 +66,4 @@ function mockErc20Asset(_ref) { | ||
_ref$chainType = _ref.chainType, | ||
chainType = _ref$chainType === void 0 ? Amount.ChainType.ETHEREUM : _ref$chainType; | ||
return Amount.erc20({ | ||
chainType = _ref$chainType === void 0 ? unsupportedIterableToArray.ChainType.ETHEREUM : _ref$chainType; | ||
return unsupportedIterableToArray.erc20({ | ||
address: address, | ||
@@ -94,4 +79,4 @@ chainType: chainType, | ||
_ref2$chainType = _ref2.chainType, | ||
chainType = _ref2$chainType === void 0 ? Amount.ChainType.ETHEREUM : _ref2$chainType; | ||
return Amount.erc20({ | ||
chainType = _ref2$chainType === void 0 ? unsupportedIterableToArray.ChainType.ETHEREUM : _ref2$chainType; | ||
return unsupportedIterableToArray.erc20({ | ||
address: '0x6b175474e89094c44da98b954eedeac495271d0f', | ||
@@ -107,4 +92,4 @@ chainType: chainType, | ||
_ref3$chainType = _ref3.chainType, | ||
chainType = _ref3$chainType === void 0 ? Amount.ChainType.ETHEREUM : _ref3$chainType; | ||
return Amount.erc20({ | ||
chainType = _ref3$chainType === void 0 ? unsupportedIterableToArray.ChainType.ETHEREUM : _ref3$chainType; | ||
return unsupportedIterableToArray.erc20({ | ||
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', | ||
@@ -118,4 +103,4 @@ chainType: chainType, | ||
function mockDaiAmount(value) { | ||
var chainType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Amount.ChainType.ETHEREUM; | ||
return Amount.Amount.erc20(mockDaiAsset({ | ||
var chainType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : unsupportedIterableToArray.ChainType.ETHEREUM; | ||
return unsupportedIterableToArray.Amount.erc20(mockDaiAsset({ | ||
chainType: chainType | ||
@@ -125,4 +110,4 @@ }), value); | ||
function mockUsdcAmount(value) { | ||
var chainType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Amount.ChainType.ETHEREUM; | ||
return Amount.Amount.erc20(mockUsdcAsset({ | ||
var chainType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : unsupportedIterableToArray.ChainType.ETHEREUM; | ||
return unsupportedIterableToArray.Amount.erc20(mockUsdcAsset({ | ||
chainType: chainType | ||
@@ -132,3 +117,3 @@ }), value); | ||
function mockMaticAmount(value) { | ||
return Amount.Amount.matic(value); | ||
return unsupportedIterableToArray.Amount.matic(value); | ||
} | ||
@@ -135,0 +120,0 @@ |
@@ -5,14 +5,8 @@ 'use strict'; | ||
var unsupportedIterableToArray = require('../../dist/unsupportedIterableToArray-74da6a45.cjs.prod.js'); | ||
var address = require('@ethersproject/address'); | ||
var Amount = require('../../dist/Amount-70889ed3.cjs.prod.js'); | ||
require('decimal.js'); | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
if (Array.isArray(arr)) return unsupportedIterableToArray._arrayLikeToArray(arr); | ||
} | ||
@@ -24,11 +18,2 @@ | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _nonIterableSpread() { | ||
@@ -39,3 +24,3 @@ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || unsupportedIterableToArray._unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
@@ -58,12 +43,12 @@ | ||
function mockEtherAmount(value) { | ||
return Amount.Amount.ether(value); | ||
return unsupportedIterableToArray.Amount.ether(value); | ||
} | ||
function mockEtherGweiAmount(value) { | ||
return Amount.Amount.ether(Amount.Denomination.gwei(value)); | ||
return unsupportedIterableToArray.Amount.ether(unsupportedIterableToArray.Denomination.gwei(value)); | ||
} | ||
function mockMaticGweiAmount(value) { | ||
return Amount.Amount.matic(Amount.Denomination.gwei(value)); | ||
return unsupportedIterableToArray.Amount.matic(unsupportedIterableToArray.Denomination.gwei(value)); | ||
} | ||
function mockUsdAsset() { | ||
return Amount.fiat({ | ||
return unsupportedIterableToArray.fiat({ | ||
name: 'US Dollar', | ||
@@ -74,3 +59,3 @@ symbol: 'USD' | ||
function mockUsdAmount(value) { | ||
return Amount.Amount.fiat(mockUsdAsset(), value); | ||
return unsupportedIterableToArray.Amount.fiat(mockUsdAsset(), value); | ||
} | ||
@@ -81,4 +66,4 @@ function mockErc20Asset(_ref) { | ||
_ref$chainType = _ref.chainType, | ||
chainType = _ref$chainType === void 0 ? Amount.ChainType.ETHEREUM : _ref$chainType; | ||
return Amount.erc20({ | ||
chainType = _ref$chainType === void 0 ? unsupportedIterableToArray.ChainType.ETHEREUM : _ref$chainType; | ||
return unsupportedIterableToArray.erc20({ | ||
address: address, | ||
@@ -94,4 +79,4 @@ chainType: chainType, | ||
_ref2$chainType = _ref2.chainType, | ||
chainType = _ref2$chainType === void 0 ? Amount.ChainType.ETHEREUM : _ref2$chainType; | ||
return Amount.erc20({ | ||
chainType = _ref2$chainType === void 0 ? unsupportedIterableToArray.ChainType.ETHEREUM : _ref2$chainType; | ||
return unsupportedIterableToArray.erc20({ | ||
address: '0x6b175474e89094c44da98b954eedeac495271d0f', | ||
@@ -107,4 +92,4 @@ chainType: chainType, | ||
_ref3$chainType = _ref3.chainType, | ||
chainType = _ref3$chainType === void 0 ? Amount.ChainType.ETHEREUM : _ref3$chainType; | ||
return Amount.erc20({ | ||
chainType = _ref3$chainType === void 0 ? unsupportedIterableToArray.ChainType.ETHEREUM : _ref3$chainType; | ||
return unsupportedIterableToArray.erc20({ | ||
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', | ||
@@ -118,4 +103,4 @@ chainType: chainType, | ||
function mockDaiAmount(value) { | ||
var chainType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Amount.ChainType.ETHEREUM; | ||
return Amount.Amount.erc20(mockDaiAsset({ | ||
var chainType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : unsupportedIterableToArray.ChainType.ETHEREUM; | ||
return unsupportedIterableToArray.Amount.erc20(mockDaiAsset({ | ||
chainType: chainType | ||
@@ -125,4 +110,4 @@ }), value); | ||
function mockUsdcAmount(value) { | ||
var chainType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Amount.ChainType.ETHEREUM; | ||
return Amount.Amount.erc20(mockUsdcAsset({ | ||
var chainType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : unsupportedIterableToArray.ChainType.ETHEREUM; | ||
return unsupportedIterableToArray.Amount.erc20(mockUsdcAsset({ | ||
chainType: chainType | ||
@@ -132,3 +117,3 @@ }), value); | ||
function mockMaticAmount(value) { | ||
return Amount.Amount.matic(value); | ||
return unsupportedIterableToArray.Amount.matic(value); | ||
} | ||
@@ -135,0 +120,0 @@ |
@@ -0,11 +1,5 @@ | ||
import { k as _arrayLikeToArray, f as _unsupportedIterableToArray, A as Amount, D as Denomination, j as fiat, C as ChainType, g as erc20 } from '../../dist/unsupportedIterableToArray-16feead9.esm.js'; | ||
import { getAddress } from '@ethersproject/address'; | ||
import { A as Amount, D as Denomination, h as fiat, C as ChainType, f as erc20 } from '../../dist/Amount-d254bbee.esm.js'; | ||
import 'decimal.js'; | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
@@ -19,11 +13,2 @@ if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _nonIterableSpread() { | ||
@@ -30,0 +15,0 @@ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
{ | ||
"name": "@lens-protocol/shared-kernel", | ||
"version": "0.11.0-alpha.11", | ||
"version": "0.11.0-alpha.12", | ||
"description": "Shared kernel", | ||
@@ -33,2 +33,3 @@ "repository": { | ||
"lodash": "^4.17.21", | ||
"traverse": "^0.6.7", | ||
"tslib": "^2.6.2" | ||
@@ -42,2 +43,3 @@ }, | ||
"@types/lodash": "^4.14.202", | ||
"@types/traverse": "^0.6.35", | ||
"@types/uuid": "^9.0.7", | ||
@@ -49,5 +51,5 @@ "eslint": "^8.54.0", | ||
"typescript": "5.2.2", | ||
"@lens-protocol/prettier-config": "0.5.0", | ||
"@lens-protocol/eslint-config": "0.5.0", | ||
"@lens-protocol/tsconfig": "0.2.0" | ||
"@lens-protocol/tsconfig": "0.2.0", | ||
"@lens-protocol/prettier-config": "0.5.0" | ||
}, | ||
@@ -54,0 +56,0 @@ "prettier": "@lens-protocol/prettier-config", |
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
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
223075
44
6689
5
15
+ Addedtraverse@^0.6.7
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedarraybuffer.prototype.slice@1.0.3(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addeddata-view-buffer@1.0.1(transitive)
+ Addeddata-view-byte-length@1.0.1(transitive)
+ Addeddata-view-byte-offset@1.0.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-abstract@1.23.3(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.0.3(transitive)
+ Addedes-to-primitive@1.2.1(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.6(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedget-symbol-description@1.0.2(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.0.7(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-bigint@1.0.4(transitive)
+ Addedis-boolean-object@1.1.2(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.1(transitive)
+ Addedis-date-object@1.0.5(transitive)
+ Addedis-negative-zero@2.0.3(transitive)
+ Addedis-number-object@1.0.7(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.0.7(transitive)
+ Addedis-symbol@1.0.4(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedis-weakref@1.0.2(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedobject-inspect@1.13.2(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedregexp.prototype.flags@1.5.2(transitive)
+ Addedsafe-array-concat@1.1.2(transitive)
+ Addedsafe-regex-test@1.0.3(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring.prototype.trim@1.2.9(transitive)
+ Addedstring.prototype.trimend@1.0.8(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtraverse@0.6.10(transitive)
+ Addedtyped-array-buffer@1.0.2(transitive)
+ Addedtyped-array-byte-length@1.0.1(transitive)
+ Addedtyped-array-byte-offset@1.0.2(transitive)
+ Addedtyped-array-length@1.0.6(transitive)
+ Addedtypedarray.prototype.slice@1.0.3(transitive)
+ Addedunbox-primitive@1.0.2(transitive)
+ Addedwhich-boxed-primitive@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)