@bloks/utils
Advanced tools
Comparing version 26.1.30 to 26.1.36
@@ -11,4 +11,385 @@ 'use strict'; | ||
function _regeneratorRuntime() { | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
_regeneratorRuntime = function () { | ||
return exports; | ||
}; | ||
var exports = {}, | ||
Op = Object.prototype, | ||
hasOwn = Op.hasOwnProperty, | ||
$Symbol = "function" == typeof Symbol ? Symbol : {}, | ||
iteratorSymbol = $Symbol.iterator || "@@iterator", | ||
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", | ||
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | ||
function define(obj, key, value) { | ||
return Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}), obj[key]; | ||
} | ||
try { | ||
define({}, ""); | ||
} catch (err) { | ||
define = function (obj, key, value) { | ||
return obj[key] = value; | ||
}; | ||
} | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, | ||
generator = Object.create(protoGenerator.prototype), | ||
context = new Context(tryLocsList || []); | ||
return generator._invoke = function (innerFn, self, context) { | ||
var state = "suspendedStart"; | ||
return function (method, arg) { | ||
if ("executing" === state) throw new Error("Generator is already running"); | ||
if ("completed" === state) { | ||
if ("throw" === method) throw arg; | ||
return doneResult(); | ||
} | ||
for (context.method = method, context.arg = arg;;) { | ||
var delegate = context.delegate; | ||
if (delegate) { | ||
var delegateResult = maybeInvokeDelegate(delegate, context); | ||
if (delegateResult) { | ||
if (delegateResult === ContinueSentinel) continue; | ||
return delegateResult; | ||
} | ||
} | ||
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { | ||
if ("suspendedStart" === state) throw state = "completed", context.arg; | ||
context.dispatchException(context.arg); | ||
} else "return" === context.method && context.abrupt("return", context.arg); | ||
state = "executing"; | ||
var record = tryCatch(innerFn, self, context); | ||
if ("normal" === record.type) { | ||
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; | ||
return { | ||
value: record.arg, | ||
done: context.done | ||
}; | ||
} | ||
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); | ||
} | ||
}; | ||
}(innerFn, self, context), generator; | ||
} | ||
function tryCatch(fn, obj, arg) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: fn.call(obj, arg) | ||
}; | ||
} catch (err) { | ||
return { | ||
type: "throw", | ||
arg: err | ||
}; | ||
} | ||
} | ||
exports.wrap = wrap; | ||
var ContinueSentinel = {}; | ||
function Generator() {} | ||
function GeneratorFunction() {} | ||
function GeneratorFunctionPrototype() {} | ||
var IteratorPrototype = {}; | ||
define(IteratorPrototype, iteratorSymbol, function () { | ||
return this; | ||
}); | ||
var getProto = Object.getPrototypeOf, | ||
NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); | ||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); | ||
function defineIteratorMethods(prototype) { | ||
["next", "throw", "return"].forEach(function (method) { | ||
define(prototype, method, function (arg) { | ||
return this._invoke(method, arg); | ||
}); | ||
}); | ||
} | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
var record = tryCatch(generator[method], generator, arg); | ||
if ("throw" !== record.type) { | ||
var result = record.arg, | ||
value = result.value; | ||
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { | ||
invoke("next", value, resolve, reject); | ||
}, function (err) { | ||
invoke("throw", err, resolve, reject); | ||
}) : PromiseImpl.resolve(value).then(function (unwrapped) { | ||
result.value = unwrapped, resolve(result); | ||
}, function (error) { | ||
return invoke("throw", error, resolve, reject); | ||
}); | ||
} | ||
reject(record.arg); | ||
} | ||
var previousPromise; | ||
this._invoke = function (method, arg) { | ||
function callInvokeWithMethodAndArg() { | ||
return new PromiseImpl(function (resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
}); | ||
} | ||
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
}; | ||
} | ||
function maybeInvokeDelegate(delegate, context) { | ||
var method = delegate.iterator[context.method]; | ||
if (undefined === method) { | ||
if (context.delegate = null, "throw" === context.method) { | ||
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; | ||
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); | ||
} | ||
return ContinueSentinel; | ||
} | ||
var record = tryCatch(method, delegate.iterator, context.arg); | ||
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; | ||
var info = record.arg; | ||
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); | ||
} | ||
function pushTryEntry(locs) { | ||
var entry = { | ||
tryLoc: locs[0] | ||
}; | ||
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); | ||
} | ||
function resetTryEntry(entry) { | ||
var record = entry.completion || {}; | ||
record.type = "normal", delete record.arg, entry.completion = record; | ||
} | ||
function Context(tryLocsList) { | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); | ||
} | ||
function values(iterable) { | ||
if (iterable) { | ||
var iteratorMethod = iterable[iteratorSymbol]; | ||
if (iteratorMethod) return iteratorMethod.call(iterable); | ||
if ("function" == typeof iterable.next) return iterable; | ||
if (!isNaN(iterable.length)) { | ||
var i = -1, | ||
next = function next() { | ||
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; | ||
return next.value = undefined, next.done = !0, next; | ||
}; | ||
return next.next = next; | ||
} | ||
} | ||
return { | ||
next: doneResult | ||
}; | ||
} | ||
function doneResult() { | ||
return { | ||
value: undefined, | ||
done: !0 | ||
}; | ||
} | ||
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { | ||
var ctor = "function" == typeof genFun && genFun.constructor; | ||
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); | ||
}, exports.mark = function (genFun) { | ||
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; | ||
}, exports.awrap = function (arg) { | ||
return { | ||
__await: arg | ||
}; | ||
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { | ||
return this; | ||
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
void 0 === PromiseImpl && (PromiseImpl = Promise); | ||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); | ||
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { | ||
return result.done ? result.value : iter.next(); | ||
}); | ||
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { | ||
return this; | ||
}), define(Gp, "toString", function () { | ||
return "[object Generator]"; | ||
}), exports.keys = function (object) { | ||
var keys = []; | ||
for (var key in object) keys.push(key); | ||
return keys.reverse(), function next() { | ||
for (; keys.length;) { | ||
var key = keys.pop(); | ||
if (key in object) return next.value = key, next.done = !1, next; | ||
} | ||
return next.done = !0, next; | ||
}; | ||
}, exports.values = values, Context.prototype = { | ||
constructor: Context, | ||
reset: function (skipTempReset) { | ||
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); | ||
}, | ||
stop: function () { | ||
this.done = !0; | ||
var rootRecord = this.tryEntries[0].completion; | ||
if ("throw" === rootRecord.type) throw rootRecord.arg; | ||
return this.rval; | ||
}, | ||
dispatchException: function (exception) { | ||
if (this.done) throw exception; | ||
var context = this; | ||
function handle(loc, caught) { | ||
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; | ||
} | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i], | ||
record = entry.completion; | ||
if ("root" === entry.tryLoc) return handle("end"); | ||
if (entry.tryLoc <= this.prev) { | ||
var hasCatch = hasOwn.call(entry, "catchLoc"), | ||
hasFinally = hasOwn.call(entry, "finallyLoc"); | ||
if (hasCatch && hasFinally) { | ||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); | ||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); | ||
} else if (hasCatch) { | ||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); | ||
} else { | ||
if (!hasFinally) throw new Error("try statement without catch or finally"); | ||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function (type, arg) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { | ||
var finallyEntry = entry; | ||
break; | ||
} | ||
} | ||
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); | ||
var record = finallyEntry ? finallyEntry.completion : {}; | ||
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); | ||
}, | ||
complete: function (record, afterLoc) { | ||
if ("throw" === record.type) throw record.arg; | ||
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; | ||
}, | ||
finish: function (finallyLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; | ||
} | ||
}, | ||
catch: function (tryLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc === tryLoc) { | ||
var record = entry.completion; | ||
if ("throw" === record.type) { | ||
var thrown = record.arg; | ||
resetTryEntry(entry); | ||
} | ||
return thrown; | ||
} | ||
} | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function (iterable, resultName, nextLoc) { | ||
return this.delegate = { | ||
iterator: values(iterable), | ||
resultName: resultName, | ||
nextLoc: nextLoc | ||
}, "next" === this.method && (this.arg = undefined), ContinueSentinel; | ||
} | ||
}, exports; | ||
} | ||
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 _extends() { | ||
_extends = Object.assign || function (target) { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
@@ -26,3 +407,2 @@ var source = arguments[i]; | ||
}; | ||
return _extends.apply(this, arguments); | ||
@@ -75,61 +455,2 @@ } | ||
/** | ||
* FIO function | ||
* | ||
* @param str example: coinomi | ||
* @returns returns: 968ba84617b73b8e2a73b59170976f41 | ||
*/ | ||
var string_to_uint128_hash = function string_to_uint128_hash(str) { | ||
return Promise.resolve(sha(str, false, 'SHA-1')).then(function (_sha) { | ||
var hexBytes = _sha.match(/../g); | ||
if (hexBytes) { | ||
return hexBytes.slice(0, -4).reverse().join(''); | ||
} else { | ||
return 0; | ||
} | ||
}); | ||
}; | ||
/** | ||
* | ||
* @param message Sha256 | ||
*/ | ||
var sha = function sha(message, binaryRepresentationOfHex, type) { | ||
if (binaryRepresentationOfHex === void 0) { | ||
binaryRepresentationOfHex = false; | ||
} | ||
if (type === void 0) { | ||
type = 'SHA-256'; | ||
} | ||
try { | ||
var encodedMessage; | ||
if (binaryRepresentationOfHex) { | ||
var matched = message.match(/[\da-f]{2}/gi); | ||
if (!matched) throw Error('Empty message'); | ||
var mapped = matched.map(function (h) { | ||
return parseInt(h, 16); | ||
}); | ||
encodedMessage = new Uint8Array(mapped); | ||
} else { | ||
encodedMessage = new TextEncoder().encode(message); | ||
} | ||
return Promise.resolve(crypto.subtle.digest(type, encodedMessage)).then(function (hashBuffer) { | ||
// hash the message | ||
var hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array | ||
var hashHex = hashArray.map(function (b) { | ||
return b.toString(16).padStart(2, '0'); | ||
}).join(''); // convert bytes to hex string | ||
return hashHex; | ||
}); | ||
} catch (e) { | ||
return Promise.reject(e); | ||
} | ||
}; | ||
var charmap = '.12345abcdefghijklmnopqrstuvwxyz'; | ||
@@ -280,3 +601,119 @@ function charidx(ch) { | ||
} | ||
/** | ||
* | ||
* @param message Sha256 | ||
*/ | ||
function sha(_x, _x2, _x3) { | ||
return _sha.apply(this, arguments); | ||
} | ||
/** | ||
* FIO function | ||
* | ||
* @param str example: coinomi | ||
* @returns returns: 968ba84617b73b8e2a73b59170976f41 | ||
*/ | ||
function _sha() { | ||
_sha = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(message, binaryRepresentationOfHex, type) { | ||
var encodedMessage, matched, mapped, hashBuffer, hashArray, hashHex; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (binaryRepresentationOfHex === void 0) { | ||
binaryRepresentationOfHex = false; | ||
} | ||
if (type === void 0) { | ||
type = 'SHA-256'; | ||
} | ||
if (!binaryRepresentationOfHex) { | ||
_context.next = 10; | ||
break; | ||
} | ||
matched = message.match(/[\da-f]{2}/gi); | ||
if (matched) { | ||
_context.next = 6; | ||
break; | ||
} | ||
throw Error('Empty message'); | ||
case 6: | ||
mapped = matched.map(function (h) { | ||
return parseInt(h, 16); | ||
}); | ||
encodedMessage = new Uint8Array(mapped); | ||
_context.next = 11; | ||
break; | ||
case 10: | ||
encodedMessage = new TextEncoder().encode(message); | ||
case 11: | ||
_context.next = 13; | ||
return crypto.subtle.digest(type, encodedMessage); | ||
case 13: | ||
hashBuffer = _context.sent; | ||
// hash the message | ||
hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array | ||
hashHex = hashArray.map(function (b) { | ||
return b.toString(16).padStart(2, '0'); | ||
}).join(''); // convert bytes to hex string | ||
return _context.abrupt("return", hashHex); | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return _sha.apply(this, arguments); | ||
} | ||
function string_to_uint128_hash(_x4) { | ||
return _string_to_uint128_hash.apply(this, arguments); | ||
} | ||
function _string_to_uint128_hash() { | ||
_string_to_uint128_hash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(str) { | ||
var hexBytes; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return sha(str, false, 'SHA-1'); | ||
case 2: | ||
hexBytes = _context2.sent.match(/../g); | ||
if (!hexBytes) { | ||
_context2.next = 7; | ||
break; | ||
} | ||
return _context2.abrupt("return", hexBytes.slice(0, -4).reverse().join('')); | ||
case 7: | ||
return _context2.abrupt("return", 0); | ||
case 8: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2); | ||
})); | ||
return _string_to_uint128_hash.apply(this, arguments); | ||
} | ||
function nativeTransformGetActions(result, constants) { | ||
@@ -1100,12 +1537,26 @@ result.actions = result.actions.map(function (action) { | ||
var wait = function wait(ms) { | ||
try { | ||
return Promise.resolve(new Promise(function (resolve) { | ||
setTimeout(resolve, ms); | ||
})); | ||
} catch (e) { | ||
return Promise.reject(e); | ||
} | ||
}; | ||
function wait(_x) { | ||
return _wait.apply(this, arguments); | ||
} | ||
function _wait() { | ||
_wait = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ms) { | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
return _context.abrupt("return", new Promise(function (resolve) { | ||
setTimeout(resolve, ms); | ||
})); | ||
case 1: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return _wait.apply(this, arguments); | ||
} | ||
/** | ||
@@ -1112,0 +1563,0 @@ * Native |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("long"));require("fast-text-encoding");var r=t(require("qs"));function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t}).apply(this,arguments)}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var a=0;return function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}}}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 o=function(t,e,r){void 0===e&&(e=!1),void 0===r&&(r="SHA-256");try{var a;if(e){var n=t.match(/[\da-f]{2}/gi);if(!n)throw Error("Empty message");var i=n.map((function(t){return parseInt(t,16)}));a=new Uint8Array(i)}else a=(new TextEncoder).encode(t);return Promise.resolve(crypto.subtle.digest(r,a)).then((function(t){return Array.from(new Uint8Array(t)).map((function(t){return t.toString(16).padStart(2,"0")})).join("")}))}catch(t){return Promise.reject(t)}},c=".12345abcdefghijklmnopqrstuvwxyz";function s(t){var e=c.indexOf(t);if(-1===e)throw new TypeError("Invalid character: '"+t+"'");return e}function u(t,r){void 0===r&&(r=!0);for(var a,n=e.fromString(t),o="",s=i(r?n.toBytesLE():n.toBytesBE());!(a=s()).done;){var u=Number(a.value).toString(16);o+=(1===u.length?"0":"")+u}o+="0".repeat(16-o.length);for(var d=e.fromNumber(31,!0),l=e.fromNumber(15,!0),f="",m=e.fromString(o,!0,16),p=0;p<=12;p++)f=c[m.and(0===p?l:d)]+f,m=m.shiftRight(0===p?4:5);return f.replace(/\.+$/,"")}function d(t,e){return t*Math.pow(2,e)}function l(t,e,r,a,n){if(a.includes(n)&&r.push({action_trace:e}),e.inline_traces){for(var o,c=i(e.inline_traces);!(o=c()).done;)n=l(t,o.value,r,a,++n);delete e.inline_traces}return n}function f(t,e,r,a,n){if(a&&a.includes(n)&&r.push({action_trace:t,dbops:e.filter((function(t){return t.action_idx===n}))}),t.inline_traces)for(var o,c=i(t.inline_traces);!(o=c()).done;)n=f(o.value,e,r,a,++n);return n}function m(t){for(var e,r=t.reduce((function(t,e){return t[e.action_ordinal]=a({},e,{traces:[],account_ram_deltas:e.account_ram_deltas,receivers:e.notified}),t}),{}),n=i(t.sort((function(t,e){return e.action_ordinal-t.action_ordinal})));!(e=n()).done;){var o=e.value;if(0!==o.creator_action_ordinal&&r[o.creator_action_ordinal]){var c=r[o.creator_action_ordinal].traces||[],s=[r[o.action_ordinal]];delete r[o.action_ordinal],r[o.creator_action_ordinal].traces=s.concat(c)}}return Object.values(r)}function p(t){var e=t.trace,r=t.dbops,a=void 0===r?[]:r,n=t.ramops,o=void 0===n?[]:n,c=t.index,s=void 0===c?0:c,u={act:e.act,account_ram_deltas:e.account_ram_deltas,receivers:[e.receipt.receiver],act_digest:e.receipt.act_digest,dbops:(a||[]).filter((function(t){return t.action_idx===s})),ramops:(o||[]).filter((function(t){return t.action_idx===s})),traces:[]};return e.inline_traces&&e.inline_traces.length&&e.inline_traces.map((function(t){if(s++,t.act.hex_data!==u.act.hex_data||t.act.name!==u.act.name||t.act.account!==u.act.account)u.traces.push(p({trace:t,index:s,ramops:o,dbops:a}));else{if(t.inline_traces&&t.inline_traces.length)for(var e,r=i(t.inline_traces);!(e=r()).done;)s++,u.traces.push(p({trace:e.value,index:s,ramops:o,dbops:a}));u.receivers.includes(t.receipt.receiver)||u.receivers.push(t.receipt.receiver),u.dbops=u.dbops.concat((a||[]).filter((function(t){return t.action_idx===s}))),u.ramops=u.ramops.concat((o||[]).filter((function(t){return t.action_idx===s})))}})),u}function _(t){var e=t.execution_trace,r=t.transaction,a=t.ramops,n=t.dbops,i=t.created_by,o=0,c=(e.action_traces||[]).map((function(t){var e=p({trace:t,ramops:a,dbops:n,index:o}),r=b([t]);return o+=r,e}));return{status:e.receipt.status,cpu_usage:e.receipt.cpu_usage_us,net_usage:8*e.receipt.net_usage_words,id:e.id,block_time:e.block_time,block_num:e.block_num,delay_sec:r.delay_sec,expiration:r.expiration,created_by:i,actions:c,traces:c}}function v(t){return{act:a({},t),account_ram_deltas:[],receivers:[],act_digest:"",traces:[]}}function x(t){var e=t.transaction.actions.map(v);return{id:t.id,status:"deferred",dfuse_status:t.transaction_status,sender:t.created_by.sender,payer:t.created_by.payer,published:t.created_by.published_at,delay_until:t.created_by.delay_until,expiration:t.transaction.expiration,delay_sec:t.transaction.delay_sec,actions:e,traces:e}}function h(t){return a({},t,{account_ram_deltas:[],receiver:"",act_digest:"",traces:[]})}function g(t){var e={act:t.act,account_ram_deltas:t.account_ram_deltas||[],receivers:[t.receipt.receiver],act_digest:t.receipt.act_digest,traces:[]};return t.inline_traces&&t.inline_traces.length&&t.inline_traces.forEach((function(r){var a=r.receipt.act_digest===t.receipt.act_digest;a&&r.inline_traces&&r.inline_traces.length?(e.traces=e.traces.concat(r.inline_traces.map(g)),e.receivers.includes(r.receipt.receiver)||e.receivers.push(r.receipt.receiver)):a?e.receivers.includes(r.receipt.receiver)||e.receivers.push(r.receipt.receiver):e.traces.push(g(r))})),e}function y(t){for(var e,r=t.reduce((function(t,e){return t[e.action_ordinal]=e,t}),{}),n=i(t.sort((function(t,e){return e.action_ordinal-t.action_ordinal})));!(e=n()).done;){var o=e.value;0!==o.creator_action_ordinal&&(r[o.creator_action_ordinal].inline_traces=[r[o.action_ordinal]].concat(r[o.creator_action_ordinal].inline_traces||[]))}return Object.values(r).filter((function(t){return 0===t.creator_action_ordinal})).map((function(t){return a({},t,{receivers:[t.receipt.receiver],act_digest:t.receipt.act_digest})}))}function b(t){return t.reduce((function(t,e){return t+1+b(e.inline_traces||[])}),0)}var w,O=function(t){var e=t.mdata,r=t.name,a=t.image,n=t.video,i=t.model,o=t.audio,c=t.stage,s=t.skybox,u=t.pdf,d=t.id,l=t.contract,f=t.link,m=t.owner,p=t.author,_=t.collection,v=t.mint,x=t.edition_size;this.idata=t.idata,this.mdata=e,this.name=r,this.image=a,this.video=n,this.model=i,this.audio=o,this.stage=c,this.skybox=s,this.pdf=u,this.id=d,this.contract=l,this.link=f,this.owner=m,this.author=p,this.collection=_,this.mint=v,this.edition_size=x};function T(t){return t?("Qm"===t.substring(0,2)&&(t="https://cloudflare-ipfs.com/ipfs/"+t),t):t}(w=exports.DbopOp||(exports.DbopOp={})).Ins="INS",w.Rem="REM",w.Upd="UPD",exports.Nft=O,exports.bytesToString=function(t){return"string"==typeof t?t:t.reduce((function(t,e){return t+String.fromCharCode(e)}),"")},exports.charidx=s,exports.cloneDeepArrayOfObj=function(t){return[].concat(t).map((function(t){return a({},t)}))},exports.copy=function(t){var e=!1,r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r);var a=document.getSelection();a&&a.rangeCount>0&&(e=a.getRangeAt(0)),r.select(),document.execCommand("copy"),document.body.removeChild(r),a&&e&&(a.removeAllRanges(),a.addRange(e))},exports.decodeName=u,exports.dfuseDepthFirstExtract=function(t){var e=t.transactions,r=t.cursor,a=[];if(e)for(var n,o=i(e);!(n=o()).done;)for(var c,s=n.value,u=s.lifecycle,d=s.action_idx,l=0,m=i(u.execution_trace.action_traces);!(c=m()).done;)l=f(c.value,u.dbops,a,d,l),l++;return{actions:a,cursor:r}},exports.dfuseTransformDeferredAction=v,exports.dfuseTransformDeferredTransaction=x,exports.dfuseTransformGetActions=function(t,e,r){var a=t.transactions,n=t.cursor;if(!a)return{cursor:n,actions:[],numOfTxLoaded:0};for(var o,c=[],s=i(a);!(o=s()).done;){var u=o.value,d=u.lifecycle,f=u.action_idx;if(f)for(var m,p=0,_=i(d.execution_trace.action_traces);!(m=_()).done;){var v=m.value;if(v.inline_traces||(v.inline_traces=[]),v.act.account===r.EOSIO&&"claimrewards"===v.act.name){for(var x,h=0,g="",y=i(v.inline_traces);!(x=y()).done;){var b=x.value;if(b.act.data.from===r.EOSIO_VPAY||b.act.data.from===r.EOSIO_BPAY){c.push({action_trace:b});var w=b.act.data.quantity.split(" "),O=w[1];h+=Number(w[0]),g=O}}v.act.data.quantity=h.toFixed(r.CORE_PRECISION)+" "+g,delete v.inline_traces,c.push({action_trace:v})}else if(v.act.account===r.EOSIO&&"sellrex"===v.act.name){for(var T,S=i(v.inline_traces);!(T=S()).done;){var E=T.value;E.act.account!==r.EOSIO_REX&&"sellresult"!==E.act.name||c.push({action_trace:E})}delete v.inline_traces,c.push({action_trace:v})}else{var A=[];p=l(e,v,A,f,p),c=c.concat(A.reverse())}p++}else c=c.concat(d.execution_trace.action_traces.map((function(t){return{action_trace:t}})).reverse())}return{cursor:n,actions:c,numOfTxLoaded:a.length}},exports.dfuseTransformTrace=p,exports.dfuseTransformTransaction=_,exports.dfuseTransformTransactionResult=function(t){return t.execution_trace?_(t):x(t)},exports.encodeName=function(t,r){if(void 0===r&&(r=!1),"string"!=typeof t)throw new TypeError("name parameter is a required string");if(t.length>12)throw new TypeError("A name can be up to 12 characters long");for(var a="",n=0;n<=12;n++){var o=n<t.length?s(t[n]):0,c=n<12?5:4,u=Number(o).toString(2);if(u.length>c)throw new TypeError("Invalid name "+t);a+=u="0".repeat(c-u.length)+u}for(var d,l=e.fromString(a,!0,2),f="",m=i(r?l.toBytesLE():l.toBytesBE());!(d=m()).done;){var p=Number(d.value).toString(16);f+=(1===p.length?"0":"")+p}return e.fromString(f,!0,16).toString().toString()},exports.fioKeyToActor=function(t,r){return u(function(t){for(var r=new e(0,0,!0),a=1,n=0;n<=12;){if(a>=33)throw new Error("FIO: i too large");var i=t[a]&(12==n?15:31);0!=i?(r=r.or(e.fromNumber(d(i,12==n?0:5*(12-n)-1),!0)),n++,a++):a++}return r}(r(t,"FIO").data).toString(),!1).substr(0,12)},exports.hexToUint8Array=function(t){if("string"!=typeof t)throw new Error("Expected string containing hex digits");if(t.length%2)throw new Error("Odd number of hex digits");for(var e=t.length/2,r=new Uint8Array(e),a=0;a<e;++a){var n=parseInt(t.substr(2*a,2),16);if(Number.isNaN(n))throw new Error("Expected hex string");r[a]=n}return r},exports.historyTransformDeferredAction=h,exports.historyTransformDeferredTransaction=function(t){return{id:t.trx_id,status:"deferred",sender:t.sender,payer:t.payer,published:t.published,expiration:t.expiration,delay_until:t.delay_until,delay_sec:t.transaction.delay_sec,actions:t.transaction.actions,traces:t.transaction.actions.map((function(t){return h(t)}))}},exports.historyTransformFlatTraces=y,exports.historyTransformRecursiveTrace=g,exports.historyTransformTransaction=function(t){if(t.trx){var e,r,n,o=[];if(t.traces&&t.traces.length&&"creator_action_ordinal"in t.traces[0])n=y(t.traces).map(g),o=t.traces.filter((function(t){return 0===t.creator_action_ordinal}));else{for(var c,s=function(){var e=c.value,r=e[0],a=e[1],n=t.traces.slice();n.splice(r,r+1),n.find((function(t){return function t(e,r){for(var a,n=i(e);!(a=n()).done;){var o=a.value;if(o.act.hex_data===r.hex_data&&o.act.name===r.name&&o.act.account===r.account||t(o.inline_traces,r))return!0}return!1}(t.inline_traces.slice(),a.act)}))||o.push(a)},u=i(t.traces.entries());!(c=u()).done;)s();if(n=o.map((function(t){return g(t)})),t.trx.trx?(e=t.trx.trx.delay_sec,r=t.trx.trx.expiration):(e="N/A",r="N/A"),t.traces.length>0&&0===o.length){o=[];for(var d,l=0,f=0,m=i(t.traces);!(d=m()).done;){var p=d.value;f>=l&&o.push(p),l+=b(p.inline_traces),f++}n=o.map((function(t){return g(t)}))}0===t.traces.length&&0===o.length&&t.trx.trx&&t.trx.trx.actions&&t.trx.trx.actions.length&&(n=t.trx.trx.actions.map((function(t){return{act:t,account_ram_deltas:[],receivers:t.authorization.map((function(t){return t.actor})),act_digest:"",traces:[]}})),o=n)}var v=a({},t,t.trx.receipt,t.trx.trx||{});return a({},v,{status:t.trx.receipt.status,cpu_usage:t.trx.receipt.cpu_usage_us,net_usage:8*t.trx.receipt.net_usage_words,id:t.id,block_time:t.block_time,block_num:t.block_num,delay_sec:e,expiration:r,actions:o,traces:n})}if(t.action_traces)return _(t);var x=t.traces.map((function(t){return g(t)}));return{status:"executed",cpu_usage:0,net_usage:0,id:t.id,block_time:t.block_time,block_num:t.block_num,delay_sec:0,expiration:0,actions:x,traces:x}},exports.hyperionTransformFlatTraces=m,exports.hyperionTransformGetActions=function(t){for(var e,r=t.query_time,a=t.lib,n=t.actions,o=t.total,c=o.relation,s=o.value,u=[],d=0,l=i(n);!(e=l()).done;){var f=e.value;f.receipt={act_digest:d++},f.block_time=f["@timestamp"],f.act.data&&f.act.data.amount&&f.act.data.symbol&&(f.act.data.quantity=f.act.data.amount+" "+f.act.data.symbol),u.push({action_trace:f})}return{lib:a,actions:u,query_time:r,numOfTxLoaded:n.length,total:{relation:c,value:s}}},exports.hyperionTransformTransaction=function(t){var e=t.actions,r=t.lib,a=t.trx_id,n=e[0],i=n.parent?e.filter((function(t){return 0===t.parent})):e,o=m(e);return{status:"Executed",cpu_usage:n.cpu_usage_us,net_usage:8*n.net_usage_words,id:a,block_time:n["@timestamp"],block_num:n.block_num,delay_sec:"N/A",expiration:"N/A",lib:r,actions:i,traces:o}},exports.isString=function(t){return"[object String]"===Object.prototype.toString.call(t)},exports.nativeTransformGetActions=function(t,e){return t.actions=t.actions.map((function(t){if(t.action_trace.act.account===e.EOSIO&&"claimrewards"===t.action_trace.act.name&&t.action_trace.inline_traces){for(var r,a=0,n="",o=i(t.action_trace.inline_traces);!(r=o()).done;){var c=r.value;if(c.act.data.from===e.EOSIO_VPAY||c.act.data.from===e.EOSIO_BPAY){var s=c.act.data.quantity.split(" "),u=s[1];a+=Number(s[0]),n=u}}t.action_trace.act.data.quantity=a.toFixed(e.CORE_PRECISION)+" "+n}return t})).reverse(),t.numOfTxLoaded=t.actions.length,t},exports.parseAaNft=function(t){var e=T(t.data.img||t.data.image),r=T(t.data.video),n=T(t.data.audio),i=T(t.data.model),o=T(t.data.stage),c=T(t.data.skybox),s=T(t.data.pdf),u=t.immutable_data;return t.template&&t.template.immutable_data&&(u=a({},u,t.template.immutable_data)),new O({idata:u,mdata:t.mutable_data,name:t.name||t.data.name||t.asset_id,image:e,video:r,model:i,audio:n,stage:o,skybox:c,pdf:s,id:t.asset_id,contract:"atomicassets",link:"/nft/"+t.asset_id,owner:t.owner,author:t.collection.author,collection:t.collection.collection_name,mint:t.template_mint?+t.template_mint:void 0,edition_size:t.template?+t.template.max_supply||+t.template.issued_supply:void 0})},exports.parseSaNft=function(t){var e=t.idata&&t.idata.name||t.mdata&&t.mdata.name,r=T(t.idata&&(t.idata.img||t.idata.image)||t.mdata&&(t.mdata.img||t.mdata.img)),a=T(t.idata&&t.idata.video||t.mdata&&t.mdata.video),n=T(t.idata&&t.idata.audio||t.mdata&&t.mdata.audio),i=T(t.idata&&t.idata.model||t.mdata&&t.mdata.model),o=T(t.idata&&t.idata.stage||t.mdata&&t.mdata.stage),c=T(t.idata&&t.idata.pdf||t.mdata&&t.mdata.pdf),s=T(t.idata&&t.idata.skybox||t.mdata&&t.mdata.skybox);return new O({idata:t.idata,mdata:t.mdata,name:e,image:r,video:a,model:i,audio:n,stage:o,skybox:s,pdf:c,id:t.assetId,contract:"simpleassets",link:"/nft/"+t.assetId,owner:t.owner,author:t.author,mint:t.extra&&t.extra.mintNumber,collection:t.category,edition_size:t.extra&&t.extra.totalMinted})},exports.sha=o,exports.string_to_uint128_hash=function(t){return Promise.resolve(o(t,!1,"SHA-1")).then((function(t){var e=t.match(/../g);return e?e.slice(0,-4).reverse().join(""):0}))},exports.urlBuilder=function(t,e,a){return a=a||{},null!=e&&(t+="/"+encodeURIComponent(e)),0!==Object.keys(a).length&&(t+="?"+r.stringify(a)),t},exports.wait=function(t){try{return Promise.resolve(new Promise((function(e){setTimeout(e,t)})))}catch(t){return Promise.reject(t)}}; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("long"));require("fast-text-encoding");var r=t(require("qs"));function n(){n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var a=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new O(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(a,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw i;return{value:void 0,done:!0}}for(r.method=a,r.arg=i;;){var o=r.delegate;if(o){var c=b(o,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=d(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,i),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function m(){}var h={};s(h,i,(function(){return this}));var v=Object.getPrototypeOf,_=v&&v(v(k([])));_&&_!==e&&r.call(_,i)&&(h=_);var y=m.prototype=f.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var n;this._invoke=function(a,i){function o(){return new e((function(n,o){!function n(a,i,o,c){var s=d(t[a],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,o,c)}),(function(t){n("throw",t,o,c)})):e.resolve(l).then((function(t){u.value=t,o(u)}),(function(t){return n("throw",t,o,c)}))}c(s.arg)}(a,i,n,o)}))}return n=n?n.then(o,o):o()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=d(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var a=n.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function w(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 E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return p.prototype=m,s(y,"constructor",m),s(m,"constructor",p),p.displayName=s(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,s(t,c,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(x.prototype),s(x.prototype,o,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,a,i){void 0===i&&(i=Promise);var o=new x(u(e,r,n,a),i);return t.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},g(y),s(y,c,"Generator"),s(y,i,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return o.type="throw",o.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(o)},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),l},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),E(r),l}},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 a=n.arg;E(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function a(t,e,r,n,a,i,o){try{var c=t[i](o),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,a)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function c(t){a(o,n,i,c,s,"next",t)}function s(t){a(o,n,i,c,s,"throw",t)}c(void 0)}))}}function o(){return(o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return c(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}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 u=".12345abcdefghijklmnopqrstuvwxyz";function d(t){var e=u.indexOf(t);if(-1===e)throw new TypeError("Invalid character: '"+t+"'");return e}function l(t,r){void 0===r&&(r=!0);for(var n,a=e.fromString(t),i="",o=s(r?a.toBytesLE():a.toBytesBE());!(n=o()).done;){var c=Number(n.value).toString(16);i+=(1===c.length?"0":"")+c}i+="0".repeat(16-i.length);for(var d=e.fromNumber(31,!0),l=e.fromNumber(15,!0),f="",p=e.fromString(i,!0,16),m=0;m<=12;m++)f=u[p.and(0===m?l:d)]+f,p=p.shiftRight(0===m?4:5);return f.replace(/\.+$/,"")}function f(t,e){return t*Math.pow(2,e)}function p(t,e,r){return m.apply(this,arguments)}function m(){return(m=i(n().mark((function t(e,r,a){var i,o,c,s,u;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===r&&(r=!1),void 0===a&&(a="SHA-256"),!r){t.next=10;break}if(o=e.match(/[\da-f]{2}/gi)){t.next=6;break}throw Error("Empty message");case 6:c=o.map((function(t){return parseInt(t,16)})),i=new Uint8Array(c),t.next=11;break;case 10:i=(new TextEncoder).encode(e);case 11:return t.next=13,crypto.subtle.digest(a,i);case 13:return s=Array.from(new Uint8Array(t.sent)),u=s.map((function(t){return t.toString(16).padStart(2,"0")})).join(""),t.abrupt("return",u);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(){return(h=i(n().mark((function t(e){var r;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p(e,!1,"SHA-1");case 2:if(!(r=t.sent.match(/../g))){t.next=7;break}return t.abrupt("return",r.slice(0,-4).reverse().join(""));case 7:return t.abrupt("return",0);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function v(t,e,r,n,a){if(n.includes(a)&&r.push({action_trace:e}),e.inline_traces){for(var i,o=s(e.inline_traces);!(i=o()).done;)a=v(t,i.value,r,n,++a);delete e.inline_traces}return a}function _(t,e,r,n,a){if(n&&n.includes(a)&&r.push({action_trace:t,dbops:e.filter((function(t){return t.action_idx===a}))}),t.inline_traces)for(var i,o=s(t.inline_traces);!(i=o()).done;)a=_(i.value,e,r,n,++a);return a}function y(t){for(var e,r=t.reduce((function(t,e){return t[e.action_ordinal]=o({},e,{traces:[],account_ram_deltas:e.account_ram_deltas,receivers:e.notified}),t}),{}),n=s(t.sort((function(t,e){return e.action_ordinal-t.action_ordinal})));!(e=n()).done;){var a=e.value;if(0!==a.creator_action_ordinal&&r[a.creator_action_ordinal]){var i=r[a.creator_action_ordinal].traces||[],c=[r[a.action_ordinal]];delete r[a.action_ordinal],r[a.creator_action_ordinal].traces=c.concat(i)}}return Object.values(r)}function g(t){var e=t.trace,r=t.dbops,n=void 0===r?[]:r,a=t.ramops,i=void 0===a?[]:a,o=t.index,c=void 0===o?0:o,u={act:e.act,account_ram_deltas:e.account_ram_deltas,receivers:[e.receipt.receiver],act_digest:e.receipt.act_digest,dbops:(n||[]).filter((function(t){return t.action_idx===c})),ramops:(i||[]).filter((function(t){return t.action_idx===c})),traces:[]};return e.inline_traces&&e.inline_traces.length&&e.inline_traces.map((function(t){if(c++,t.act.hex_data!==u.act.hex_data||t.act.name!==u.act.name||t.act.account!==u.act.account)u.traces.push(g({trace:t,index:c,ramops:i,dbops:n}));else{if(t.inline_traces&&t.inline_traces.length)for(var e,r=s(t.inline_traces);!(e=r()).done;)c++,u.traces.push(g({trace:e.value,index:c,ramops:i,dbops:n}));u.receivers.includes(t.receipt.receiver)||u.receivers.push(t.receipt.receiver),u.dbops=u.dbops.concat((n||[]).filter((function(t){return t.action_idx===c}))),u.ramops=u.ramops.concat((i||[]).filter((function(t){return t.action_idx===c})))}})),u}function x(t){var e=t.execution_trace,r=t.transaction,n=t.ramops,a=t.dbops,i=t.created_by,o=0,c=(e.action_traces||[]).map((function(t){var e=g({trace:t,ramops:n,dbops:a,index:o}),r=S([t]);return o+=r,e}));return{status:e.receipt.status,cpu_usage:e.receipt.cpu_usage_us,net_usage:8*e.receipt.net_usage_words,id:e.id,block_time:e.block_time,block_num:e.block_num,delay_sec:r.delay_sec,expiration:r.expiration,created_by:i,actions:c,traces:c}}function b(t){return{act:o({},t),account_ram_deltas:[],receivers:[],act_digest:"",traces:[]}}function w(t){var e=t.transaction.actions.map(b);return{id:t.id,status:"deferred",dfuse_status:t.transaction_status,sender:t.created_by.sender,payer:t.created_by.payer,published:t.created_by.published_at,delay_until:t.created_by.delay_until,expiration:t.transaction.expiration,delay_sec:t.transaction.delay_sec,actions:e,traces:e}}function E(t){return o({},t,{account_ram_deltas:[],receiver:"",act_digest:"",traces:[]})}function O(t){var e={act:t.act,account_ram_deltas:t.account_ram_deltas||[],receivers:[t.receipt.receiver],act_digest:t.receipt.act_digest,traces:[]};return t.inline_traces&&t.inline_traces.length&&t.inline_traces.forEach((function(r){var n=r.receipt.act_digest===t.receipt.act_digest;n&&r.inline_traces&&r.inline_traces.length?(e.traces=e.traces.concat(r.inline_traces.map(O)),e.receivers.includes(r.receipt.receiver)||e.receivers.push(r.receipt.receiver)):n?e.receivers.includes(r.receipt.receiver)||e.receivers.push(r.receipt.receiver):e.traces.push(O(r))})),e}function k(t){for(var e,r=t.reduce((function(t,e){return t[e.action_ordinal]=e,t}),{}),n=s(t.sort((function(t,e){return e.action_ordinal-t.action_ordinal})));!(e=n()).done;){var a=e.value;0!==a.creator_action_ordinal&&(r[a.creator_action_ordinal].inline_traces=[r[a.action_ordinal]].concat(r[a.creator_action_ordinal].inline_traces||[]))}return Object.values(r).filter((function(t){return 0===t.creator_action_ordinal})).map((function(t){return o({},t,{receivers:[t.receipt.receiver],act_digest:t.receipt.act_digest})}))}function S(t){return t.reduce((function(t,e){return t+1+S(e.inline_traces||[])}),0)}var T,A=function(t){var e=t.mdata,r=t.name,n=t.image,a=t.video,i=t.model,o=t.audio,c=t.stage,s=t.skybox,u=t.pdf,d=t.id,l=t.contract,f=t.link,p=t.owner,m=t.author,h=t.collection,v=t.mint,_=t.edition_size;this.idata=t.idata,this.mdata=e,this.name=r,this.image=n,this.video=a,this.model=i,this.audio=o,this.stage=c,this.skybox=s,this.pdf=u,this.id=d,this.contract=l,this.link=f,this.owner=p,this.author=m,this.collection=h,this.mint=v,this.edition_size=_};function L(t){return t?("Qm"===t.substring(0,2)&&(t="https://cloudflare-ipfs.com/ipfs/"+t),t):t}function N(){return(N=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){setTimeout(t,e)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}(T=exports.DbopOp||(exports.DbopOp={})).Ins="INS",T.Rem="REM",T.Upd="UPD",exports.Nft=A,exports.bytesToString=function(t){return"string"==typeof t?t:t.reduce((function(t,e){return t+String.fromCharCode(e)}),"")},exports.charidx=d,exports.cloneDeepArrayOfObj=function(t){return[].concat(t).map((function(t){return o({},t)}))},exports.copy=function(t){var e=!1,r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r);var n=document.getSelection();n&&n.rangeCount>0&&(e=n.getRangeAt(0)),r.select(),document.execCommand("copy"),document.body.removeChild(r),n&&e&&(n.removeAllRanges(),n.addRange(e))},exports.decodeName=l,exports.dfuseDepthFirstExtract=function(t){var e=t.transactions,r=t.cursor,n=[];if(e)for(var a,i=s(e);!(a=i()).done;)for(var o,c=a.value,u=c.lifecycle,d=c.action_idx,l=0,f=s(u.execution_trace.action_traces);!(o=f()).done;)l=_(o.value,u.dbops,n,d,l),l++;return{actions:n,cursor:r}},exports.dfuseTransformDeferredAction=b,exports.dfuseTransformDeferredTransaction=w,exports.dfuseTransformGetActions=function(t,e,r){var n=t.transactions,a=t.cursor;if(!n)return{cursor:a,actions:[],numOfTxLoaded:0};for(var i,o=[],c=s(n);!(i=c()).done;){var u=i.value,d=u.lifecycle,l=u.action_idx;if(l)for(var f,p=0,m=s(d.execution_trace.action_traces);!(f=m()).done;){var h=f.value;if(h.inline_traces||(h.inline_traces=[]),h.act.account===r.EOSIO&&"claimrewards"===h.act.name){for(var _,y=0,g="",x=s(h.inline_traces);!(_=x()).done;){var b=_.value;if(b.act.data.from===r.EOSIO_VPAY||b.act.data.from===r.EOSIO_BPAY){o.push({action_trace:b});var w=b.act.data.quantity.split(" "),E=w[1];y+=Number(w[0]),g=E}}h.act.data.quantity=y.toFixed(r.CORE_PRECISION)+" "+g,delete h.inline_traces,o.push({action_trace:h})}else if(h.act.account===r.EOSIO&&"sellrex"===h.act.name){for(var O,k=s(h.inline_traces);!(O=k()).done;){var S=O.value;S.act.account!==r.EOSIO_REX&&"sellresult"!==S.act.name||o.push({action_trace:S})}delete h.inline_traces,o.push({action_trace:h})}else{var T=[];p=v(e,h,T,l,p),o=o.concat(T.reverse())}p++}else o=o.concat(d.execution_trace.action_traces.map((function(t){return{action_trace:t}})).reverse())}return{cursor:a,actions:o,numOfTxLoaded:n.length}},exports.dfuseTransformTrace=g,exports.dfuseTransformTransaction=x,exports.dfuseTransformTransactionResult=function(t){return t.execution_trace?x(t):w(t)},exports.encodeName=function(t,r){if(void 0===r&&(r=!1),"string"!=typeof t)throw new TypeError("name parameter is a required string");if(t.length>12)throw new TypeError("A name can be up to 12 characters long");for(var n="",a=0;a<=12;a++){var i=a<t.length?d(t[a]):0,o=a<12?5:4,c=Number(i).toString(2);if(c.length>o)throw new TypeError("Invalid name "+t);n+=c="0".repeat(o-c.length)+c}for(var u,l=e.fromString(n,!0,2),f="",p=s(r?l.toBytesLE():l.toBytesBE());!(u=p()).done;){var m=Number(u.value).toString(16);f+=(1===m.length?"0":"")+m}return e.fromString(f,!0,16).toString().toString()},exports.fioKeyToActor=function(t,r){return l(function(t){for(var r=new e(0,0,!0),n=1,a=0;a<=12;){if(n>=33)throw new Error("FIO: i too large");var i=t[n]&(12==a?15:31);0!=i?(r=r.or(e.fromNumber(f(i,12==a?0:5*(12-a)-1),!0)),a++,n++):n++}return r}(r(t,"FIO").data).toString(),!1).substr(0,12)},exports.hexToUint8Array=function(t){if("string"!=typeof t)throw new Error("Expected string containing hex digits");if(t.length%2)throw new Error("Odd number of hex digits");for(var e=t.length/2,r=new Uint8Array(e),n=0;n<e;++n){var a=parseInt(t.substr(2*n,2),16);if(Number.isNaN(a))throw new Error("Expected hex string");r[n]=a}return r},exports.historyTransformDeferredAction=E,exports.historyTransformDeferredTransaction=function(t){return{id:t.trx_id,status:"deferred",sender:t.sender,payer:t.payer,published:t.published,expiration:t.expiration,delay_until:t.delay_until,delay_sec:t.transaction.delay_sec,actions:t.transaction.actions,traces:t.transaction.actions.map((function(t){return E(t)}))}},exports.historyTransformFlatTraces=k,exports.historyTransformRecursiveTrace=O,exports.historyTransformTransaction=function(t){if(t.trx){var e,r,n,a=[];if(t.traces&&t.traces.length&&"creator_action_ordinal"in t.traces[0])n=k(t.traces).map(O),a=t.traces.filter((function(t){return 0===t.creator_action_ordinal}));else{for(var i,c=function(){var e=i.value,r=e[0],n=e[1],o=t.traces.slice();o.splice(r,r+1),o.find((function(t){return function t(e,r){for(var n,a=s(e);!(n=a()).done;){var i=n.value;if(i.act.hex_data===r.hex_data&&i.act.name===r.name&&i.act.account===r.account||t(i.inline_traces,r))return!0}return!1}(t.inline_traces.slice(),n.act)}))||a.push(n)},u=s(t.traces.entries());!(i=u()).done;)c();if(n=a.map((function(t){return O(t)})),t.trx.trx?(e=t.trx.trx.delay_sec,r=t.trx.trx.expiration):(e="N/A",r="N/A"),t.traces.length>0&&0===a.length){a=[];for(var d,l=0,f=0,p=s(t.traces);!(d=p()).done;){var m=d.value;f>=l&&a.push(m),l+=S(m.inline_traces),f++}n=a.map((function(t){return O(t)}))}0===t.traces.length&&0===a.length&&t.trx.trx&&t.trx.trx.actions&&t.trx.trx.actions.length&&(n=t.trx.trx.actions.map((function(t){return{act:t,account_ram_deltas:[],receivers:t.authorization.map((function(t){return t.actor})),act_digest:"",traces:[]}})),a=n)}var h=o({},t,t.trx.receipt,t.trx.trx||{});return o({},h,{status:t.trx.receipt.status,cpu_usage:t.trx.receipt.cpu_usage_us,net_usage:8*t.trx.receipt.net_usage_words,id:t.id,block_time:t.block_time,block_num:t.block_num,delay_sec:e,expiration:r,actions:a,traces:n})}if(t.action_traces)return x(t);var v=t.traces.map((function(t){return O(t)}));return{status:"executed",cpu_usage:0,net_usage:0,id:t.id,block_time:t.block_time,block_num:t.block_num,delay_sec:0,expiration:0,actions:v,traces:v}},exports.hyperionTransformFlatTraces=y,exports.hyperionTransformGetActions=function(t){for(var e,r=t.query_time,n=t.lib,a=t.actions,i=t.total,o=i.relation,c=i.value,u=[],d=0,l=s(a);!(e=l()).done;){var f=e.value;f.receipt={act_digest:d++},f.block_time=f["@timestamp"],f.act.data&&f.act.data.amount&&f.act.data.symbol&&(f.act.data.quantity=f.act.data.amount+" "+f.act.data.symbol),u.push({action_trace:f})}return{lib:n,actions:u,query_time:r,numOfTxLoaded:a.length,total:{relation:o,value:c}}},exports.hyperionTransformTransaction=function(t){var e=t.actions,r=t.lib,n=t.trx_id,a=e[0],i=a.parent?e.filter((function(t){return 0===t.parent})):e,o=y(e);return{status:"Executed",cpu_usage:a.cpu_usage_us,net_usage:8*a.net_usage_words,id:n,block_time:a["@timestamp"],block_num:a.block_num,delay_sec:"N/A",expiration:"N/A",lib:r,actions:i,traces:o}},exports.isString=function(t){return"[object String]"===Object.prototype.toString.call(t)},exports.nativeTransformGetActions=function(t,e){return t.actions=t.actions.map((function(t){if(t.action_trace.act.account===e.EOSIO&&"claimrewards"===t.action_trace.act.name&&t.action_trace.inline_traces){for(var r,n=0,a="",i=s(t.action_trace.inline_traces);!(r=i()).done;){var o=r.value;if(o.act.data.from===e.EOSIO_VPAY||o.act.data.from===e.EOSIO_BPAY){var c=o.act.data.quantity.split(" "),u=c[1];n+=Number(c[0]),a=u}}t.action_trace.act.data.quantity=n.toFixed(e.CORE_PRECISION)+" "+a}return t})).reverse(),t.numOfTxLoaded=t.actions.length,t},exports.parseAaNft=function(t){var e=L(t.data.img||t.data.image),r=L(t.data.video),n=L(t.data.audio),a=L(t.data.model),i=L(t.data.stage),c=L(t.data.skybox),s=L(t.data.pdf),u=t.immutable_data;return t.template&&t.template.immutable_data&&(u=o({},u,t.template.immutable_data)),new A({idata:u,mdata:t.mutable_data,name:t.name||t.data.name||t.asset_id,image:e,video:r,model:a,audio:n,stage:i,skybox:c,pdf:s,id:t.asset_id,contract:"atomicassets",link:"/nft/"+t.asset_id,owner:t.owner,author:t.collection.author,collection:t.collection.collection_name,mint:t.template_mint?+t.template_mint:void 0,edition_size:t.template?+t.template.max_supply||+t.template.issued_supply:void 0})},exports.parseSaNft=function(t){var e=t.idata&&t.idata.name||t.mdata&&t.mdata.name,r=L(t.idata&&(t.idata.img||t.idata.image)||t.mdata&&(t.mdata.img||t.mdata.img)),n=L(t.idata&&t.idata.video||t.mdata&&t.mdata.video),a=L(t.idata&&t.idata.audio||t.mdata&&t.mdata.audio),i=L(t.idata&&t.idata.model||t.mdata&&t.mdata.model),o=L(t.idata&&t.idata.stage||t.mdata&&t.mdata.stage),c=L(t.idata&&t.idata.pdf||t.mdata&&t.mdata.pdf),s=L(t.idata&&t.idata.skybox||t.mdata&&t.mdata.skybox);return new A({idata:t.idata,mdata:t.mdata,name:e,image:r,video:n,model:i,audio:a,stage:o,skybox:s,pdf:c,id:t.assetId,contract:"simpleassets",link:"/nft/"+t.assetId,owner:t.owner,author:t.author,mint:t.extra&&t.extra.mintNumber,collection:t.category,edition_size:t.extra&&t.extra.totalMinted})},exports.sha=p,exports.string_to_uint128_hash=function(t){return h.apply(this,arguments)},exports.urlBuilder=function(t,e,n){return n=n||{},null!=e&&(t+="/"+encodeURIComponent(e)),0!==Object.keys(n).length&&(t+="?"+r.stringify(n)),t},exports.wait=function(t){return N.apply(this,arguments)}; | ||
//# sourceMappingURL=utils.cjs.production.min.js.map |
@@ -5,4 +5,385 @@ import Long from 'long'; | ||
function _regeneratorRuntime() { | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
_regeneratorRuntime = function () { | ||
return exports; | ||
}; | ||
var exports = {}, | ||
Op = Object.prototype, | ||
hasOwn = Op.hasOwnProperty, | ||
$Symbol = "function" == typeof Symbol ? Symbol : {}, | ||
iteratorSymbol = $Symbol.iterator || "@@iterator", | ||
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", | ||
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | ||
function define(obj, key, value) { | ||
return Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}), obj[key]; | ||
} | ||
try { | ||
define({}, ""); | ||
} catch (err) { | ||
define = function (obj, key, value) { | ||
return obj[key] = value; | ||
}; | ||
} | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, | ||
generator = Object.create(protoGenerator.prototype), | ||
context = new Context(tryLocsList || []); | ||
return generator._invoke = function (innerFn, self, context) { | ||
var state = "suspendedStart"; | ||
return function (method, arg) { | ||
if ("executing" === state) throw new Error("Generator is already running"); | ||
if ("completed" === state) { | ||
if ("throw" === method) throw arg; | ||
return doneResult(); | ||
} | ||
for (context.method = method, context.arg = arg;;) { | ||
var delegate = context.delegate; | ||
if (delegate) { | ||
var delegateResult = maybeInvokeDelegate(delegate, context); | ||
if (delegateResult) { | ||
if (delegateResult === ContinueSentinel) continue; | ||
return delegateResult; | ||
} | ||
} | ||
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { | ||
if ("suspendedStart" === state) throw state = "completed", context.arg; | ||
context.dispatchException(context.arg); | ||
} else "return" === context.method && context.abrupt("return", context.arg); | ||
state = "executing"; | ||
var record = tryCatch(innerFn, self, context); | ||
if ("normal" === record.type) { | ||
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; | ||
return { | ||
value: record.arg, | ||
done: context.done | ||
}; | ||
} | ||
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); | ||
} | ||
}; | ||
}(innerFn, self, context), generator; | ||
} | ||
function tryCatch(fn, obj, arg) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: fn.call(obj, arg) | ||
}; | ||
} catch (err) { | ||
return { | ||
type: "throw", | ||
arg: err | ||
}; | ||
} | ||
} | ||
exports.wrap = wrap; | ||
var ContinueSentinel = {}; | ||
function Generator() {} | ||
function GeneratorFunction() {} | ||
function GeneratorFunctionPrototype() {} | ||
var IteratorPrototype = {}; | ||
define(IteratorPrototype, iteratorSymbol, function () { | ||
return this; | ||
}); | ||
var getProto = Object.getPrototypeOf, | ||
NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); | ||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); | ||
function defineIteratorMethods(prototype) { | ||
["next", "throw", "return"].forEach(function (method) { | ||
define(prototype, method, function (arg) { | ||
return this._invoke(method, arg); | ||
}); | ||
}); | ||
} | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
var record = tryCatch(generator[method], generator, arg); | ||
if ("throw" !== record.type) { | ||
var result = record.arg, | ||
value = result.value; | ||
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { | ||
invoke("next", value, resolve, reject); | ||
}, function (err) { | ||
invoke("throw", err, resolve, reject); | ||
}) : PromiseImpl.resolve(value).then(function (unwrapped) { | ||
result.value = unwrapped, resolve(result); | ||
}, function (error) { | ||
return invoke("throw", error, resolve, reject); | ||
}); | ||
} | ||
reject(record.arg); | ||
} | ||
var previousPromise; | ||
this._invoke = function (method, arg) { | ||
function callInvokeWithMethodAndArg() { | ||
return new PromiseImpl(function (resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
}); | ||
} | ||
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
}; | ||
} | ||
function maybeInvokeDelegate(delegate, context) { | ||
var method = delegate.iterator[context.method]; | ||
if (undefined === method) { | ||
if (context.delegate = null, "throw" === context.method) { | ||
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; | ||
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); | ||
} | ||
return ContinueSentinel; | ||
} | ||
var record = tryCatch(method, delegate.iterator, context.arg); | ||
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; | ||
var info = record.arg; | ||
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); | ||
} | ||
function pushTryEntry(locs) { | ||
var entry = { | ||
tryLoc: locs[0] | ||
}; | ||
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); | ||
} | ||
function resetTryEntry(entry) { | ||
var record = entry.completion || {}; | ||
record.type = "normal", delete record.arg, entry.completion = record; | ||
} | ||
function Context(tryLocsList) { | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); | ||
} | ||
function values(iterable) { | ||
if (iterable) { | ||
var iteratorMethod = iterable[iteratorSymbol]; | ||
if (iteratorMethod) return iteratorMethod.call(iterable); | ||
if ("function" == typeof iterable.next) return iterable; | ||
if (!isNaN(iterable.length)) { | ||
var i = -1, | ||
next = function next() { | ||
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; | ||
return next.value = undefined, next.done = !0, next; | ||
}; | ||
return next.next = next; | ||
} | ||
} | ||
return { | ||
next: doneResult | ||
}; | ||
} | ||
function doneResult() { | ||
return { | ||
value: undefined, | ||
done: !0 | ||
}; | ||
} | ||
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { | ||
var ctor = "function" == typeof genFun && genFun.constructor; | ||
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); | ||
}, exports.mark = function (genFun) { | ||
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; | ||
}, exports.awrap = function (arg) { | ||
return { | ||
__await: arg | ||
}; | ||
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { | ||
return this; | ||
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
void 0 === PromiseImpl && (PromiseImpl = Promise); | ||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); | ||
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { | ||
return result.done ? result.value : iter.next(); | ||
}); | ||
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { | ||
return this; | ||
}), define(Gp, "toString", function () { | ||
return "[object Generator]"; | ||
}), exports.keys = function (object) { | ||
var keys = []; | ||
for (var key in object) keys.push(key); | ||
return keys.reverse(), function next() { | ||
for (; keys.length;) { | ||
var key = keys.pop(); | ||
if (key in object) return next.value = key, next.done = !1, next; | ||
} | ||
return next.done = !0, next; | ||
}; | ||
}, exports.values = values, Context.prototype = { | ||
constructor: Context, | ||
reset: function (skipTempReset) { | ||
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); | ||
}, | ||
stop: function () { | ||
this.done = !0; | ||
var rootRecord = this.tryEntries[0].completion; | ||
if ("throw" === rootRecord.type) throw rootRecord.arg; | ||
return this.rval; | ||
}, | ||
dispatchException: function (exception) { | ||
if (this.done) throw exception; | ||
var context = this; | ||
function handle(loc, caught) { | ||
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; | ||
} | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i], | ||
record = entry.completion; | ||
if ("root" === entry.tryLoc) return handle("end"); | ||
if (entry.tryLoc <= this.prev) { | ||
var hasCatch = hasOwn.call(entry, "catchLoc"), | ||
hasFinally = hasOwn.call(entry, "finallyLoc"); | ||
if (hasCatch && hasFinally) { | ||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); | ||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); | ||
} else if (hasCatch) { | ||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); | ||
} else { | ||
if (!hasFinally) throw new Error("try statement without catch or finally"); | ||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function (type, arg) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { | ||
var finallyEntry = entry; | ||
break; | ||
} | ||
} | ||
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); | ||
var record = finallyEntry ? finallyEntry.completion : {}; | ||
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); | ||
}, | ||
complete: function (record, afterLoc) { | ||
if ("throw" === record.type) throw record.arg; | ||
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; | ||
}, | ||
finish: function (finallyLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; | ||
} | ||
}, | ||
catch: function (tryLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc === tryLoc) { | ||
var record = entry.completion; | ||
if ("throw" === record.type) { | ||
var thrown = record.arg; | ||
resetTryEntry(entry); | ||
} | ||
return thrown; | ||
} | ||
} | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function (iterable, resultName, nextLoc) { | ||
return this.delegate = { | ||
iterator: values(iterable), | ||
resultName: resultName, | ||
nextLoc: nextLoc | ||
}, "next" === this.method && (this.arg = undefined), ContinueSentinel; | ||
} | ||
}, exports; | ||
} | ||
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 _extends() { | ||
_extends = Object.assign || function (target) { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
@@ -20,3 +401,2 @@ var source = arguments[i]; | ||
}; | ||
return _extends.apply(this, arguments); | ||
@@ -69,61 +449,2 @@ } | ||
/** | ||
* FIO function | ||
* | ||
* @param str example: coinomi | ||
* @returns returns: 968ba84617b73b8e2a73b59170976f41 | ||
*/ | ||
var string_to_uint128_hash = function string_to_uint128_hash(str) { | ||
return Promise.resolve(sha(str, false, 'SHA-1')).then(function (_sha) { | ||
var hexBytes = _sha.match(/../g); | ||
if (hexBytes) { | ||
return hexBytes.slice(0, -4).reverse().join(''); | ||
} else { | ||
return 0; | ||
} | ||
}); | ||
}; | ||
/** | ||
* | ||
* @param message Sha256 | ||
*/ | ||
var sha = function sha(message, binaryRepresentationOfHex, type) { | ||
if (binaryRepresentationOfHex === void 0) { | ||
binaryRepresentationOfHex = false; | ||
} | ||
if (type === void 0) { | ||
type = 'SHA-256'; | ||
} | ||
try { | ||
var encodedMessage; | ||
if (binaryRepresentationOfHex) { | ||
var matched = message.match(/[\da-f]{2}/gi); | ||
if (!matched) throw Error('Empty message'); | ||
var mapped = matched.map(function (h) { | ||
return parseInt(h, 16); | ||
}); | ||
encodedMessage = new Uint8Array(mapped); | ||
} else { | ||
encodedMessage = new TextEncoder().encode(message); | ||
} | ||
return Promise.resolve(crypto.subtle.digest(type, encodedMessage)).then(function (hashBuffer) { | ||
// hash the message | ||
var hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array | ||
var hashHex = hashArray.map(function (b) { | ||
return b.toString(16).padStart(2, '0'); | ||
}).join(''); // convert bytes to hex string | ||
return hashHex; | ||
}); | ||
} catch (e) { | ||
return Promise.reject(e); | ||
} | ||
}; | ||
var charmap = '.12345abcdefghijklmnopqrstuvwxyz'; | ||
@@ -274,3 +595,119 @@ function charidx(ch) { | ||
} | ||
/** | ||
* | ||
* @param message Sha256 | ||
*/ | ||
function sha(_x, _x2, _x3) { | ||
return _sha.apply(this, arguments); | ||
} | ||
/** | ||
* FIO function | ||
* | ||
* @param str example: coinomi | ||
* @returns returns: 968ba84617b73b8e2a73b59170976f41 | ||
*/ | ||
function _sha() { | ||
_sha = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(message, binaryRepresentationOfHex, type) { | ||
var encodedMessage, matched, mapped, hashBuffer, hashArray, hashHex; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (binaryRepresentationOfHex === void 0) { | ||
binaryRepresentationOfHex = false; | ||
} | ||
if (type === void 0) { | ||
type = 'SHA-256'; | ||
} | ||
if (!binaryRepresentationOfHex) { | ||
_context.next = 10; | ||
break; | ||
} | ||
matched = message.match(/[\da-f]{2}/gi); | ||
if (matched) { | ||
_context.next = 6; | ||
break; | ||
} | ||
throw Error('Empty message'); | ||
case 6: | ||
mapped = matched.map(function (h) { | ||
return parseInt(h, 16); | ||
}); | ||
encodedMessage = new Uint8Array(mapped); | ||
_context.next = 11; | ||
break; | ||
case 10: | ||
encodedMessage = new TextEncoder().encode(message); | ||
case 11: | ||
_context.next = 13; | ||
return crypto.subtle.digest(type, encodedMessage); | ||
case 13: | ||
hashBuffer = _context.sent; | ||
// hash the message | ||
hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array | ||
hashHex = hashArray.map(function (b) { | ||
return b.toString(16).padStart(2, '0'); | ||
}).join(''); // convert bytes to hex string | ||
return _context.abrupt("return", hashHex); | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return _sha.apply(this, arguments); | ||
} | ||
function string_to_uint128_hash(_x4) { | ||
return _string_to_uint128_hash.apply(this, arguments); | ||
} | ||
function _string_to_uint128_hash() { | ||
_string_to_uint128_hash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(str) { | ||
var hexBytes; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return sha(str, false, 'SHA-1'); | ||
case 2: | ||
hexBytes = _context2.sent.match(/../g); | ||
if (!hexBytes) { | ||
_context2.next = 7; | ||
break; | ||
} | ||
return _context2.abrupt("return", hexBytes.slice(0, -4).reverse().join('')); | ||
case 7: | ||
return _context2.abrupt("return", 0); | ||
case 8: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2); | ||
})); | ||
return _string_to_uint128_hash.apply(this, arguments); | ||
} | ||
function nativeTransformGetActions(result, constants) { | ||
@@ -1094,12 +1531,26 @@ result.actions = result.actions.map(function (action) { | ||
var wait = function wait(ms) { | ||
try { | ||
return Promise.resolve(new Promise(function (resolve) { | ||
setTimeout(resolve, ms); | ||
})); | ||
} catch (e) { | ||
return Promise.reject(e); | ||
} | ||
}; | ||
function wait(_x) { | ||
return _wait.apply(this, arguments); | ||
} | ||
function _wait() { | ||
_wait = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ms) { | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
return _context.abrupt("return", new Promise(function (resolve) { | ||
setTimeout(resolve, ms); | ||
})); | ||
case 1: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return _wait.apply(this, arguments); | ||
} | ||
/** | ||
@@ -1106,0 +1557,0 @@ * Native |
{ | ||
"name": "@bloks/utils", | ||
"version": "26.1.30", | ||
"version": "26.1.36", | ||
"author": "jafri", | ||
@@ -26,8 +26,7 @@ "module": "dist/utils.esm.js", | ||
"@types/qs": "^6.9.0", | ||
"husky": "^4.0.10", | ||
"tsdx": "^0.12.3", | ||
"tsdx": "^0.14.1", | ||
"tslib": "^1.10.0", | ||
"typescript": "^4.3.2" | ||
}, | ||
"gitHead": "1ddcbd27e6887cf602612fac1a27fe2eb12714fd" | ||
"gitHead": "16c3a86002834f86b7c014823292aef6271ea52f" | ||
} |
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
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
337111
6
3319