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

@bloks/wallet

Package Overview
Dependencies
Maintainers
1
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bloks/wallet - npm Package Compare versions

Comparing version 26.1.2 to 26.1.36

1287

dist/wallet.cjs.development.js

@@ -10,2 +10,383 @@ '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 _defineProperties(target, props) {

@@ -24,2 +405,5 @@ for (var i = 0; i < props.length; i++) {

if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;

@@ -29,3 +413,3 @@ }

function _extends() {
_extends = Object.assign || function (target) {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {

@@ -43,3 +427,2 @@ var source = arguments[i];

};
return _extends.apply(this, arguments);

@@ -86,176 +469,2 @@ }

// A type of promise-like that resolves synchronously and supports only one observer
const _Pact = /*#__PURE__*/(function() {
function _Pact() {}
_Pact.prototype.then = function(onFulfilled, onRejected) {
const result = new _Pact();
const state = this.s;
if (state) {
const callback = state & 1 ? onFulfilled : onRejected;
if (callback) {
try {
_settle(result, 1, callback(this.v));
} catch (e) {
_settle(result, 2, e);
}
return result;
} else {
return this;
}
}
this.o = function(_this) {
try {
const value = _this.v;
if (_this.s & 1) {
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
} else if (onRejected) {
_settle(result, 1, onRejected(value));
} else {
_settle(result, 2, value);
}
} catch (e) {
_settle(result, 2, e);
}
};
return result;
};
return _Pact;
})();
// Settles a pact synchronously
function _settle(pact, state, value) {
if (!pact.s) {
if (value instanceof _Pact) {
if (value.s) {
if (state & 1) {
state = value.s;
}
value = value.v;
} else {
value.o = _settle.bind(null, pact, state);
return;
}
}
if (value && value.then) {
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
return;
}
pact.s = state;
pact.v = value;
const observer = pact.o;
if (observer) {
observer(pact);
}
}
}
function _isSettledPact(thenable) {
return thenable instanceof _Pact && thenable.s & 1;
}
// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)
function _forTo(array, body, check) {
var i = -1, pact, reject;
function _cycle(result) {
try {
while (++i < array.length && (!check || !check())) {
result = body(i);
if (result && result.then) {
if (_isSettledPact(result)) {
result = result.v;
} else {
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
return;
}
}
}
if (pact) {
_settle(pact, 1, result);
} else {
pact = result;
}
} catch (e) {
_settle(pact || (pact = new _Pact()), 2, e);
}
}
_cycle();
return pact;
}
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
// Asynchronously iterate through an object's values
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
function _forOf(target, body, check) {
if (typeof target[_iteratorSymbol] === "function") {
var iterator = target[_iteratorSymbol](), step, pact, reject;
function _cycle(result) {
try {
while (!(step = iterator.next()).done && (!check || !check())) {
result = body(step.value);
if (result && result.then) {
if (_isSettledPact(result)) {
result = result.v;
} else {
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
return;
}
}
}
if (pact) {
_settle(pact, 1, result);
} else {
pact = result;
}
} catch (e) {
_settle(pact || (pact = new _Pact()), 2, e);
}
}
_cycle();
if (iterator.return) {
var _fixup = function(value) {
try {
if (!step.done) {
iterator.return();
}
} catch(e) {
}
return value;
};
if (pact && pact.then) {
return pact.then(_fixup, function(e) {
throw _fixup(e);
});
}
_fixup();
}
return pact;
}
// No support for Symbol.iterator
if (!("length" in target)) {
throw new TypeError("Object is not iterable");
}
// Handle live collections properly
var values = [];
for (var i = 0; i < target.length; i++) {
values.push(target[i]);
}
return _forTo(values, function(i) { return body(values[i]); }, check);
}
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
// Asynchronously call a function and send errors to recovery continuation
function _catch(body, recover) {
try {
var result = body();
} catch(e) {
return recover(e);
}
if (result && result.then) {
return result.then(void 0, recover);
}
return result;
}
var defaultCallbacks = function defaultCallbacks() {

@@ -328,40 +537,73 @@ return {

_proto.initialize = function initialize(_ref) {
var _ref$iframe = _ref.iframe,
iframe = _ref$iframe === void 0 ? undefined : _ref$iframe;
_proto.initialize = /*#__PURE__*/function () {
var _initialize = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
var _ref$iframe, iframe, connection;
try {
var _this2 = this;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_ref$iframe = _ref.iframe, iframe = _ref$iframe === void 0 ? undefined : _ref$iframe;
// Setup iframe
connection = connectToChild({
// The iframe to which a connection should be made
iframe: iframe,
// Methods the parent is exposing to the child
methods: {}
});
_context.next = 4;
return connection.promise;
// Setup iframe
var connection = connectToChild({
// The iframe to which a connection should be made
iframe: iframe,
// Methods the parent is exposing to the child
methods: {}
});
return Promise.resolve(connection.promise).then(function (_connection$promise) {
_this2.child = _connection$promise;
// Setup user
return Promise.resolve(_this2.getUsers()).then(function (_this$getUsers) {
_this2.users = _this$getUsers;
return Promise.resolve(_this2.getUser()).then(function (_this$getUser) {
_this2.user = _this$getUser;
});
});
});
} catch (e) {
return Promise.reject(e);
case 4:
this.child = _context.sent;
_context.next = 7;
return this.getUsers();
case 7:
this.users = _context.sent;
_context.next = 10;
return this.getUser();
case 10:
this.user = _context.sent;
case 11:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function initialize(_x) {
return _initialize.apply(this, arguments);
}
};
_proto.getUser = function getUser() {
try {
var _this4 = this;
return initialize;
}();
if (_this4.child) {
return Promise.resolve(_this4.child.get(_this4.USER_KEY)).then(function (user) {
var _temp = function () {
if (!user || user.chain !== constants.constants.CHAIN) {
var existingCorrectChainUser = user && _this4.users.find(function (user) {
_proto.getUser = /*#__PURE__*/function () {
var _getUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
var user, existingCorrectChainUser;
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!this.child) {
_context2.next = 12;
break;
}
_context2.next = 3;
return this.child.get(this.USER_KEY);
case 3:
user = _context2.sent;
if (!(!user || user.chain !== constants.constants.CHAIN)) {
_context2.next = 9;
break;
}
existingCorrectChainUser = user && this.users.find(function (user) {
return user.chain === constants.constants.CHAIN;

@@ -376,34 +618,71 @@ });

return Promise.resolve(_this4.saveUser(user)).then(function () {});
}
}();
_context2.next = 9;
return this.saveUser(user);
return _temp && _temp.then ? _temp.then(function () {
return user;
}) : user;
});
} else {
return Promise.resolve(defaultUser());
}
} catch (e) {
return Promise.reject(e);
case 9:
return _context2.abrupt("return", user);
case 12:
return _context2.abrupt("return", defaultUser());
case 13:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function getUser() {
return _getUser.apply(this, arguments);
}
};
_proto.getUsers = function getUsers() {
try {
var _this6 = this;
return getUser;
}();
if (_this6.child) {
return Promise.resolve(_this6.child.get(_this6.USERS_KEY)).then(function (_this5$child$get) {
return _this5$child$get || [];
});
} else {
return Promise.resolve([]);
}
} catch (e) {
return Promise.reject(e);
_proto.getUsers = /*#__PURE__*/function () {
var _getUsers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (!this.child) {
_context3.next = 9;
break;
}
_context3.next = 3;
return this.child.get(this.USERS_KEY);
case 3:
_context3.t0 = _context3.sent;
if (_context3.t0) {
_context3.next = 6;
break;
}
_context3.t0 = [];
case 6:
return _context3.abrupt("return", _context3.t0);
case 9:
return _context3.abrupt("return", []);
case 10:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function getUsers() {
return _getUsers.apply(this, arguments);
}
};
return getUsers;
}();
/**

@@ -413,44 +692,71 @@ * If different user from current user, save

*/
_proto.saveUser = function saveUser(user) {
try {
var _this8 = this;
_proto.saveUser =
/*#__PURE__*/
function () {
var _saveUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(user) {
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
if (this.isSame(this.user, user)) {
_context4.next = 5;
break;
}
var _temp4 = function () {
if (!_this8.isSame(_this8.user, user)) {
_this8.user = user;
this.user = user;
var _temp5 = function () {
if (_this8.child) {
return Promise.resolve(_this8.child.set(_this8.USER_KEY, user)).then(function () {});
}
}();
if (!this.child) {
_context4.next = 5;
break;
}
if (_temp5 && _temp5.then) return _temp5.then(function () {});
_context4.next = 5;
return this.child.set(this.USER_KEY, user);
case 5:
case "end":
return _context4.stop();
}
}
}();
}, _callee4, this);
}));
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
} catch (e) {
return Promise.reject(e);
function saveUser(_x2) {
return _saveUser.apply(this, arguments);
}
};
_proto.saveUsers = function saveUsers(users) {
try {
var _this10 = this;
return saveUser;
}();
_this10.users = users;
_proto.saveUsers = /*#__PURE__*/function () {
var _saveUsers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(users) {
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
this.users = users;
var _temp7 = function () {
if (_this10.child) {
return Promise.resolve(_this10.child.set(_this10.USERS_KEY, users)).then(function () {});
if (!this.child) {
_context5.next = 4;
break;
}
_context5.next = 4;
return this.child.set(this.USERS_KEY, users);
case 4:
case "end":
return _context5.stop();
}
}
}();
}, _callee5, this);
}));
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
} catch (e) {
return Promise.reject(e);
function saveUsers(_x3) {
return _saveUsers.apply(this, arguments);
}
};
return saveUsers;
}();
_proto.isSame = function isSame(user1, user2) {

@@ -465,6 +771,6 @@ if ((user1 || user2) && (!user1 || !user2)) {

_proto.findUserIndex = function findUserIndex(newUser) {
var _this11 = this;
var _this = this;
return this.users.findIndex(function (user) {
return _this11.isSame(user, newUser);
return _this.isSame(user, newUser);
});

@@ -483,117 +789,193 @@ };

_proto.setUser = function setUser(newUser) {
if (newUser === void 0) {
newUser = {};
}
_proto.setUser = /*#__PURE__*/function () {
var _setUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(newUser) {
var userIndex, user;
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
if (newUser === void 0) {
newUser = {};
}
try {
var _this13 = this;
userIndex = this.findUserIndex(newUser); // Set as default user if user not found
// The default user just means no user
var userIndex = _this13.findUserIndex(newUser); // Set as default user if user not found
// The default user just means no user
user = userIndex !== -1 ? this.users[userIndex] : defaultUser(); // Save user
_context6.next = 5;
return this.saveUser(user);
var user = userIndex !== -1 ? _this13.users[userIndex] : defaultUser(); // Save user
case 5:
case "end":
return _context6.stop();
}
}
}, _callee6, this);
}));
return Promise.resolve(_this13.saveUser(user)).then(function () {});
} catch (e) {
return Promise.reject(e);
function setUser(_x4) {
return _setUser.apply(this, arguments);
}
};
_proto.addUser = function addUser(user) {
try {
var _this15 = this;
return setUser;
}();
var newUser = Object.assign({}, defaultUser(), user); // New User
_proto.addUser = /*#__PURE__*/function () {
var _addUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(user) {
var newUser, userIndex, newUsers;
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
newUser = Object.assign({}, defaultUser(), user); // New User
var userIndex = _this15.findUserIndex(newUser);
userIndex = this.findUserIndex(newUser);
newUsers = this.users; // Add the user if not found
var newUsers = _this15.users; // Add the user if not found
if (userIndex === -1) {
newUsers = newUsers.concat([newUser]); // Update information
} else {
newUsers[userIndex] = Object.assign({}, newUsers[userIndex], newUser);
} // Save
if (userIndex === -1) {
newUsers = newUsers.concat([newUser]); // Update information
} else {
newUsers[userIndex] = Object.assign({}, newUsers[userIndex], newUser);
} // Save
_context7.next = 6;
return this.saveUsers(newUsers);
return Promise.resolve(_this15.saveUsers(newUsers)).then(function () {
return Promise.resolve(_this15.setUser(newUser)).then(function () {});
});
} catch (e) {
return Promise.reject(e);
case 6:
_context7.next = 8;
return this.setUser(newUser);
case 8:
case "end":
return _context7.stop();
}
}
}, _callee7, this);
}));
function addUser(_x5) {
return _addUser.apply(this, arguments);
}
};
_proto.addUsers = function addUsers(users) {
try {
var _this17 = this;
return addUser;
}();
var newUser;
var newUsers = [];
_proto.addUsers = /*#__PURE__*/function () {
var _addUsers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(users) {
var newUser, newUsers, _iterator, _step, user, userIndex;
for (var _iterator = _createForOfIteratorHelperLoose(users), _step; !(_step = _iterator()).done;) {
var user = _step.value;
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
newUsers = [];
var userIndex = _this17.findUserIndex(user);
for (_iterator = _createForOfIteratorHelperLoose(users); !(_step = _iterator()).done;) {
user = _step.value;
userIndex = this.findUserIndex(user);
newUser = Object.assign({}, defaultUser(), user); // Add to list of users to save if not found
newUser = Object.assign({}, defaultUser(), user); // Add to list of users to save if not found
if (userIndex === -1) {
newUsers.push(newUser);
}
}
if (userIndex === -1) {
newUsers.push(newUser);
}
}
if (!newUsers.length) {
_context8.next = 6;
break;
}
var _temp9 = function () {
if (newUsers.length) {
newUsers = _this17.users.concat(newUsers);
return Promise.resolve(_this17.saveUsers(newUsers)).then(function () {});
newUsers = this.users.concat(newUsers);
_context8.next = 6;
return this.saveUsers(newUsers);
case 6:
case "end":
return _context8.stop();
}
}
}();
}, _callee8, this);
}));
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
} catch (e) {
return Promise.reject(e);
function addUsers(_x6) {
return _addUsers.apply(this, arguments);
}
};
_proto.removeUser = function removeUser(userToRemove, setNew) {
if (setNew === void 0) {
setNew = false;
}
return addUsers;
}();
try {
var _this19 = this;
_proto.removeUser = /*#__PURE__*/function () {
var _removeUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(userToRemove, setNew) {
var userToRemoveIndex, remainingUsers, changeCurrentUser;
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
if (setNew === void 0) {
setNew = false;
}
if (!userToRemove) return Promise.resolve();
if (userToRemove) {
_context9.next = 3;
break;
}
var userToRemoveIndex = _this19.findUserIndex(userToRemove);
return _context9.abrupt("return");
if (userToRemoveIndex === -1) return Promise.resolve();
var remainingUsers = spliceNoMutation(_this19.users, userToRemoveIndex);
return Promise.resolve(_this19.saveUsers(remainingUsers)).then(function () {
var changeCurrentUser = _this19.isSame(userToRemove, _this19.user);
case 3:
userToRemoveIndex = this.findUserIndex(userToRemove);
var _temp11 = function () {
if (changeCurrentUser) {
var _temp12 = function () {
if (setNew && _this19.users.length) {
return Promise.resolve(_this19.setUser(_this19.users[0])).then(function () {});
} else {
return Promise.resolve(_this19.setUser()).then(function () {});
if (!(userToRemoveIndex === -1)) {
_context9.next = 6;
break;
}
}();
if (_temp12 && _temp12.then) return _temp12.then(function () {});
return _context9.abrupt("return");
case 6:
remainingUsers = spliceNoMutation(this.users, userToRemoveIndex);
_context9.next = 9;
return this.saveUsers(remainingUsers);
case 9:
changeCurrentUser = this.isSame(userToRemove, this.user);
if (!changeCurrentUser) {
_context9.next = 18;
break;
}
if (!(setNew && this.users.length)) {
_context9.next = 16;
break;
}
_context9.next = 14;
return this.setUser(this.users[0]);
case 14:
_context9.next = 18;
break;
case 16:
_context9.next = 18;
return this.setUser();
case 18:
case "end":
return _context9.stop();
}
}();
}
}, _callee9, this);
}));
if (_temp11 && _temp11.then) return _temp11.then(function () {});
});
} catch (e) {
return Promise.reject(e);
function removeUser(_x7, _x8) {
return _removeUser.apply(this, arguments);
}
};
return removeUser;
}();
_createClass(UserClass, [{

@@ -700,113 +1082,156 @@ key: "authorization",

_proto.transact = function transact(actions) {
try {
var _this2 = this;
_proto.transact = /*#__PURE__*/function () {
var _transact = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(actions) {
var _User$user, wallet, delay_sec, authorization, _i, _Array$from, account, endTx, freeCpuEnabled, obj1, obj2, success, fieldError, detailError, error;
var _temp6 = function _temp6() {
return _catch(function () {
function _temp3() {
// MULTISIG (Msig)
if (callbacks.isMultisigMode()) {
var endTx = callbacks.onMultisig(actions);
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
callbacks.clearErrors(); // Get User
if (endTx) {
return;
_User$user = User.user, wallet = _User$user.wallet, delay_sec = _User$user.delay_sec; // Check that wallet exists
if (wallet) {
_context.next = 5;
break;
}
} // Free CPU
callbacks.onError('Please log in first.');
return _context.abrupt("return");
var freeCpuEnabled = callbacks.freeCpuEnabled();
case 5:
if (this.provider && this.provider.transact) {
_context.next = 9;
break;
}
if (freeCpuEnabled) {
actions = [_this2.generateFreeCpuAction(authorization[0].actor)].concat(actions);
}
console.log("Provider not found: " + !this.provider);
callbacks.onLoginToSign({
wallet: wallet,
actions: actions
});
return _context.abrupt("return");
var obj1 = {
delay_sec: delay_sec,
max_cpu_usage_ms: freeCpuEnabled ? 5 : 0,
actions: actions
};
case 9:
// Add auth to all actions
authorization = User.authorization;
actions = actions.map(function (action) {
action.authorization = authorization;
return action;
}); // Fetch ABI into cache if needed (EOSJS1)
var obj2 = _this2.generateTransactOptions({
freeCpuEnabled: freeCpuEnabled,
wallet: wallet
});
if (!(this.provider && this.provider.fc && this.provider.fc.abiCache)) {
_context.next = 20;
break;
}
return Promise.resolve(_this2.provider.transact(obj1, obj2)).then(function (success) {
if (freeCpuEnabled) {
callbacks.onFreeCpu(_extends({
actions: actions
}, success));
} else {
console.log('onsuccess');
callbacks.onSuccess(success);
_i = 0, _Array$from = Array.from(new Set(actions.map(function (action) {
return action.account;
})));
case 13:
if (!(_i < _Array$from.length)) {
_context.next = 20;
break;
}
}); // After success, check if free CPU, if so, handle it
}
var _temp2 = function () {
if (_this2.api && ['fio', 'fio-test'].includes(constants.constants.CHAIN)) {
return Promise.resolve(_this2.api.addFIOFeeToActions(actions, authorization[0].actor)).then(function (_this$api$addFIOFeeTo) {
actions = _this$api$addFIOFeeTo;
});
}
}();
account = _Array$from[_i];
_context.next = 17;
return this.provider.fc.abiCache.abiAsync(account);
// Add fio fees
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
}, function (e) {
var fieldError = e.json && e.json.fields && e.json.fields.length && e.json.fields[0].error;
var detailError = e && e.error && e.error.details && e.error.details.length && e.error.details[0].message;
var error = detailError || fieldError || e.reason || e.message || e.toString() || e;
console.log(error);
callbacks.onError(error);
});
};
case 17:
_i++;
_context.next = 13;
break;
callbacks.clearErrors(); // Get User
case 20:
_context.prev = 20;
var _User$user = User.user,
wallet = _User$user.wallet,
delay_sec = _User$user.delay_sec; // Check that wallet exists
if (!(this.api && ['fio', 'fio-test'].includes(constants.constants.CHAIN))) {
_context.next = 25;
break;
}
if (!wallet) {
callbacks.onError('Please log in first.');
return Promise.resolve();
} // Check that provider exists and has transact
_context.next = 24;
return this.api.addFIOFeeToActions(actions, authorization[0].actor);
case 24:
actions = _context.sent;
if (!(_this2.provider && _this2.provider.transact)) {
console.log("Provider not found: " + !_this2.provider);
callbacks.onLoginToSign({
wallet: wallet,
actions: actions
});
return Promise.resolve();
} // Add auth to all actions
case 25:
if (!callbacks.isMultisigMode()) {
_context.next = 29;
break;
}
endTx = callbacks.onMultisig(actions);
var authorization = User.authorization;
actions = actions.map(function (action) {
action.authorization = authorization;
return action;
}); // Fetch ABI into cache if needed (EOSJS1)
if (!endTx) {
_context.next = 29;
break;
}
var _temp7 = function () {
if (_this2.provider && _this2.provider.fc && _this2.provider.fc.abiCache) {
var _temp8 = _forOf(Array.from(new Set(actions.map(function (action) {
return action.account;
}))), function (account) {
return Promise.resolve(_this2.provider.fc.abiCache.abiAsync(account)).then(function () {});
});
return _context.abrupt("return");
if (_temp8 && _temp8.then) return _temp8.then(function () {});
case 29:
// Free CPU
freeCpuEnabled = callbacks.freeCpuEnabled();
if (freeCpuEnabled) {
actions = [this.generateFreeCpuAction(authorization[0].actor)].concat(actions);
}
obj1 = {
delay_sec: delay_sec,
max_cpu_usage_ms: freeCpuEnabled ? 5 : 0,
actions: actions
};
obj2 = this.generateTransactOptions({
freeCpuEnabled: freeCpuEnabled,
wallet: wallet
});
_context.next = 35;
return this.provider.transact(obj1, obj2);
case 35:
success = _context.sent;
// After success, check if free CPU, if so, handle it
if (freeCpuEnabled) {
callbacks.onFreeCpu(_extends({
actions: actions
}, success));
} else {
console.log('onsuccess');
callbacks.onSuccess(success);
}
_context.next = 46;
break;
case 39:
_context.prev = 39;
_context.t0 = _context["catch"](20);
fieldError = _context.t0.json && _context.t0.json.fields && _context.t0.json.fields.length && _context.t0.json.fields[0].error;
detailError = _context.t0 && _context.t0.error && _context.t0.error.details && _context.t0.error.details.length && _context.t0.error.details[0].message;
error = detailError || fieldError || _context.t0.reason || _context.t0.message || _context.t0.toString() || _context.t0;
console.log(error);
callbacks.onError(error);
case 46:
case "end":
return _context.stop();
}
}
}();
}, _callee, this, [[20, 39]]);
}));
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp6) : _temp6(_temp7));
} catch (e) {
return Promise.reject(e);
function transact(_x) {
return _transact.apply(this, arguments);
}
};
return transact;
}();
return ProviderClass;

@@ -813,0 +1238,0 @@ }();

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,n=require("@bloks/constants"),e=(t=require("penpal/lib/connectToChild"))&&"object"==typeof t&&"default"in t?t.default:t;function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function o(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}const a=function(){function t(){}return t.prototype.then=function(n,e){const r=new t,o=this.s;if(o){const t=1&o?n:e;if(t){try{i(r,1,t(this.v))}catch(t){i(r,2,t)}return r}return this}return this.o=function(t){try{const o=t.v;1&t.s?i(r,1,n?n(o):o):e?i(r,1,e(o)):i(r,2,o)}catch(t){i(r,2,t)}},r},t}();function i(t,n,e){if(!t.s){if(e instanceof a){if(!e.s)return void(e.o=i.bind(null,t,n));1&n&&(n=e.s),e=e.v}if(e&&e.then)return void e.then(i.bind(null,t,n),i.bind(null,t,2));t.s=n,t.v=e;const r=t.o;r&&r(t)}}function s(t){return t instanceof a&&1&t.s}const c="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var u=function(){return{onLoginToSign:function(t){console.log(t.wallet,t.actions)},clearErrors:function(){},onSuccess:function(t){console.log("Success",t)},onError:function(t){throw new Error(t)},onMultisig:function(t){return!1},onFreeCpu:function(t){return!1},isMultisigMode:function(){return!1},freeCpuEnabled:function(){return!1}}},f=function(){return{actor:"",permission:"",publicKey:"",wallet:"",type:"",chain:n.constants.CHAIN,delay_sec:0,index:0}},l=new(function(){function t(){if(this.user=f(),this.users=[],this.child=void 0,this.USER_KEY="user-v.0.0.7",this.USERS_KEY="users-v.0.0.7",this.setDimensions=function(){},this.onDimensionsChange=function(){},t.instance)return t.instance}var r,a=t.prototype;return a.initialize=function(t){var n=t.iframe,r=void 0===n?void 0:n;try{var o=this,a=e({iframe:r,methods:{}});return Promise.resolve(a.promise).then((function(t){return o.child=t,Promise.resolve(o.getUsers()).then((function(t){return o.users=t,Promise.resolve(o.getUser()).then((function(t){o.user=t}))}))}))}catch(t){return Promise.reject(t)}},a.getUser=function(){try{var t=this;return t.child?Promise.resolve(t.child.get(t.USER_KEY)).then((function(e){var r=function(){if(!e||e.chain!==n.constants.CHAIN){var r=e&&t.users.find((function(t){return t.chain===n.constants.CHAIN}));return e=r||f(),Promise.resolve(t.saveUser(e)).then((function(){}))}}();return r&&r.then?r.then((function(){return e})):e})):Promise.resolve(f())}catch(t){return Promise.reject(t)}},a.getUsers=function(){try{return this.child?Promise.resolve(this.child.get(this.USERS_KEY)).then((function(t){return t||[]})):Promise.resolve([])}catch(t){return Promise.reject(t)}},a.saveUser=function(t){try{var n=this,e=function(){if(!n.isSame(n.user,t)){n.user=t;var e=function(){if(n.child)return Promise.resolve(n.child.set(n.USER_KEY,t)).then((function(){}))}();if(e&&e.then)return e.then((function(){}))}}();return Promise.resolve(e&&e.then?e.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},a.saveUsers=function(t){try{var n=this;n.users=t;var e=function(){if(n.child)return Promise.resolve(n.child.set(n.USERS_KEY,t)).then((function(){}))}();return Promise.resolve(e&&e.then?e.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},a.isSame=function(t,n){return!!(!t&&!n||t&&n)&&t.actor===n.actor&&t.permission===n.permission&&t.wallet===n.wallet&&t.publicKey===n.publicKey},a.findUserIndex=function(t){var n=this;return this.users.findIndex((function(e){return n.isSame(e,t)}))},a.findUser=function(t){var n=this.findUserIndex(t);if(-1!==n)return this.users[n]},a.setUser=function(t){void 0===t&&(t={});try{var n=this.findUserIndex(t),e=-1!==n?this.users[n]:f();return Promise.resolve(this.saveUser(e)).then((function(){}))}catch(t){return Promise.reject(t)}},a.addUser=function(t){try{var n=this,e=Object.assign({},f(),t),r=n.findUserIndex(e),o=n.users;return-1===r?o=o.concat([e]):o[r]=Object.assign({},o[r],e),Promise.resolve(n.saveUsers(o)).then((function(){return Promise.resolve(n.setUser(e)).then((function(){}))}))}catch(t){return Promise.reject(t)}},a.addUsers=function(t){try{for(var n,e,r=this,a=[],i=function(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,n){if(t){if("string"==typeof t)return o(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?o(t,void 0):void 0}}(t))){e&&(t=e);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var s=e.value,c=r.findUserIndex(s);n=Object.assign({},f(),s),-1===c&&a.push(n)}var u=function(){if(a.length)return a=r.users.concat(a),Promise.resolve(r.saveUsers(a)).then((function(){}))}();return Promise.resolve(u&&u.then?u.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},a.removeUser=function(t,n){void 0===n&&(n=!1);try{var e=this;if(!t)return Promise.resolve();var r=e.findUserIndex(t);if(-1===r)return Promise.resolve();var o=(a=e.users).slice(0,i=r).concat(a.slice(i+1));return Promise.resolve(e.saveUsers(o)).then((function(){var r=e.isSame(t,e.user),o=function(){if(r){var t=n&&e.users.length?Promise.resolve(e.setUser(e.users[0])).then((function(){})):Promise.resolve(e.setUser()).then((function(){}));if(t&&t.then)return t.then((function(){}))}}();if(o&&o.then)return o.then((function(){}))}))}catch(t){return Promise.reject(t)}var a,i},(r=[{key:"authorization",get:function(){return[{actor:this.user.actor,permission:this.user.permission}]}},{key:"currentChainUsers",get:function(){return this.users.filter((function(t){return t.chain===n.constants.CHAIN}))}}])&&function(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,r),t}()),d=u();function h(){return["ScatterExtension"].includes(l.user.wallet)}var v={__proto__:null,get callbacks(){return d},setCallbacks:function(t){void 0===t&&(t={}),d=Object.assign(u(),t)},isEosjs1:h},p=new(function(){function t(){if(this.provider={},this.scatter=void 0,this.wax=void 0,this.api=void 0,t.instance)return t.instance}var e=t.prototype;return e.setApi=function(t){this.api=t},e.setProvider=function(t){this.provider=t},e.setScatter=function(t){this.scatter=t},e.setWax=function(t){this.wax=t},e.generateFreeCpuAction=function(t){return{account:"tippedtipped",name:"transfer",data:{from:"tippedtipped",to:t,quantity:"1.0 CPU",memo:"Free CPU from Bloks.io!"},authorization:[{actor:"tippedtipped",permission:"payforcpu"}]}},e.generateTransactOptions=function(t){var n=t.freeCpuEnabled;return r({blocksBehind:300,expireSeconds:3e3,broadcast:!n},n&&{requiredKeys:[l.user.publicKey]})},e.transact=function(t){try{var e=this,o=function(){return function(o,a){try{var i=function(){function o(){if(!d.isMultisigMode()||!d.onMultisig(t)){var n=d.freeCpuEnabled();n&&(t=[e.generateFreeCpuAction(v[0].actor)].concat(t));var o={delay_sec:h,max_cpu_usage_ms:n?5:0,actions:t},a=e.generateTransactOptions({freeCpuEnabled:n,wallet:f});return Promise.resolve(e.provider.transact(o,a)).then((function(e){n?d.onFreeCpu(r({actions:t},e)):(console.log("onsuccess"),d.onSuccess(e))}))}}var a=function(){if(e.api&&["fio","fio-test"].includes(n.constants.CHAIN))return Promise.resolve(e.api.addFIOFeeToActions(t,v[0].actor)).then((function(n){t=n}))}();return a&&a.then?a.then(o):o()}()}catch(t){return a(t)}return i&&i.then?i.then(void 0,a):i}(0,(function(t){var n=t&&t.error&&t.error.details&&t.error.details.length&&t.error.details[0].message||t.json&&t.json.fields&&t.json.fields.length&&t.json.fields[0].error||t.reason||t.message||t.toString()||t;console.log(n),d.onError(n)}))};d.clearErrors();var u=l.user,f=u.wallet,h=u.delay_sec;if(!f)return d.onError("Please log in first."),Promise.resolve();if(!e.provider||!e.provider.transact)return console.log("Provider not found: "+!e.provider),d.onLoginToSign({wallet:f,actions:t}),Promise.resolve();var v=l.authorization;t=t.map((function(t){return t.authorization=v,t}));var p=function(){if(e.provider&&e.provider.fc&&e.provider.fc.abiCache){var n=function(t,n,e){if("function"==typeof t[c]){var r,o,u,f=t[c]();if(function t(e){try{for(;!(r=f.next()).done;)if((e=n(r.value))&&e.then){if(!s(e))return void e.then(t,u||(u=i.bind(null,o=new a,2)));e=e.v}o?i(o,1,e):o=e}catch(t){i(o||(o=new a),2,t)}}(),f.return){var l=function(t){try{r.done||f.return()}catch(t){}return t};if(o&&o.then)return o.then(l,(function(t){throw l(t)}));l()}return o}if(!("length"in t))throw new TypeError("Object is not iterable");for(var d=[],h=0;h<t.length;h++)d.push(t[h]);return function(t,n,e){var r,o,c=-1;return function e(u){try{for(;++c<t.length;)if((u=n(c))&&u.then){if(!s(u))return void u.then(e,o||(o=i.bind(null,r=new a,2)));u=u.v}r?i(r,1,u):r=u}catch(t){i(r||(r=new a),2,t)}}(),r}(d,(function(t){return n(d[t])}))}(Array.from(new Set(t.map((function(t){return t.account})))),(function(t){return Promise.resolve(e.provider.fc.abiCache.abiAsync(t)).then((function(){}))}));if(n&&n.then)return n.then((function(){}))}}();return Promise.resolve(p&&p.then?p.then(o):o())}catch(t){return Promise.reject(t)}},t}());function m(t,e,r,o,a){return{account:n.constants.EOSIO,name:"delegatebw",data:{from:t,receiver:e,stake_net_quantity:r,stake_cpu_quantity:o,transfer:a}}}function y(t,e,r,o){return{account:n.constants.EOSIO,name:"undelegatebw",data:{from:t,receiver:e,unstake_net_quantity:r,unstake_cpu_quantity:o}}}function b(t,e,r){return{account:n.constants.EOSIO,name:"buyrambytes",data:{payer:t,receiver:e,bytes:r}}}function g(t,e,r,o){return{account:n.constants.EOSIO,name:"updateauth",data:{account:t,permission:e,parent:r,auth:{threshold:1,keys:[{key:o,weight:1}],accounts:[],waits:[]}}}}function O(t,e,r,o){var a;return{account:n.constants.EOSIO,name:"newaccount",data:(a={creator:t},a[n.constants.NEWACCOUNT_NAME_PARAM]=e,a.owner={threshold:1,keys:[{key:r,weight:1}],accounts:[],waits:[]},a.active={threshold:1,keys:[{key:o,weight:1}],accounts:[],waits:[]},a)}}function S(t){return{account:"eosio.proton",name:"newaccres",data:{account:t}}}exports.default=r({},v,{__proto__:null,transfer:function(t,n,e,r,o){return p.transact([{account:t,name:"transfer",data:{from:n,to:e,quantity:r,memo:o}}])},delegatebw:function(t,n,e,r,o){h()&&(o=+o);var a=[m(t,n,e,r,o)];return p.transact(a)},_delegatebw:m,undelegatebw:function(t,n,e,r){var o=[y(t,n,e,r)];return p.transact(o)},_undelegatebw:y,buyram:function(t,e,r){return p.transact([{account:n.constants.EOSIO,name:"buyram",data:{payer:t,receiver:e,quant:r}}])},buyrambytes:function(t,n,e){var r=[b(t,n,e)];return p.transact(r)},_buyrambytes:b,sellram:function(t,e){return p.transact([{account:n.constants.EOSIO,name:"sellram",data:{account:t,bytes:e}}])},refund:function(t){return p.transact([{account:n.constants.EOSIO,name:"refund",data:{owner:t}}])},addgravatar:function(t,e,r,o){return p.transact([{account:n.constants.ACCOUNT_INFO,name:"update",data:{account_name:t,title:e,avatar:r,desc:"",modifier:t,url:o?'{"telegram":"'+o+'"':""}}])},changeBasicPermissions:function(t,n,e){var r=[];return n&&""!==n&&r.push(g(t,"active","owner",n)),e&&""!==e&&r.push(g(t,"owner","",e)),p.transact(r)},_updateauthkey:g,updateAuth:function(t,e,r,o){return o.keys=o.keys.sort((function(t,n){return t.key.localeCompare(n.key)})),o.accounts=o.accounts.sort((function(t,n){return t.permission.actor.localeCompare(n.permission.actor)})),o.waits=o.waits.sort((function(t,n){return t.wait_sec.localeCompare(n.wait_sec)})),p.transact([{account:n.constants.EOSIO,name:"updateauth",data:{account:t,permission:e,parent:r,auth:o}}])},_newaccount:O,_newaccres:S,createAccount:function(t,e,r,o,a,i,s,c){h()&&(c=+c);var u=[O(t,e,r,o),b(t,e,a)];return-1!==n.constants.CHAIN.indexOf("proton")?u.push(S(e)):u.push(m(t,e,i,s,c)),p.transact(u)},voteproducer:function(t,e,r){var o=[];return["fio","fio-test"].includes(n.constants.CHAIN)&&e?o.push({account:n.constants.EOSIO,name:"voteproxy",data:{proxy:e}}):o.push({account:n.constants.EOSIO,name:"voteproducer",data:{voter:t,proxy:e,producers:r}}),p.transact(o)},linkAuth:function(t,e,r,o){return p.transact([{account:n.constants.EOSIO,name:"linkauth",data:{account:t,code:e,type:r,requirement:o}}])},unlinkAuth:function(t,e,r){return p.transact([{account:n.constants.EOSIO,name:"unlinkauth",data:{account:t,code:e,type:r}}])},deleteAuth:function(t,e){return p.transact([{account:n.constants.EOSIO,name:"deleteauth",data:{account:t,permission:e}}])},cancelDelay:function(t,e,r){return p.transact([{account:n.constants.EOSIO,name:"canceldelay",data:{canceling_auth:{actor:t,permission:e},trx_id:r}}])},updateProxy:function(t,e){return h()&&(e=+e),p.transact([{account:n.constants.EOSIO,name:"regproxy",data:{proxy:t,isproxy:e}}])},_setCode:function(t,e){return{account:n.constants.EOSIO,name:"setcode",data:{account:t,code:e,vmtype:0,vmversion:0}}},_setAbi:function(t,e){return{account:n.constants.EOSIO,name:"setabi",data:{account:t,abi:e}}},propose:function(t,e,r,o){return p.transact([{account:n.constants.EOSIO_MSIG,name:"propose",data:{proposer:t,proposal_name:e,requested:r,trx:o}}])},approve:function(t,e,r){return p.transact([{account:n.constants.EOSIO_MSIG,name:"approve",data:{proposer:t,proposal_name:e,level:r}}])},execute:function(t,e,r){return p.transact([{account:n.constants.EOSIO_MSIG,name:"exec",data:{proposer:t,proposal_name:e,executer:r}}])},cancel:function(t,e,r){return p.transact([{account:n.constants.EOSIO_MSIG,name:"cancel",data:{proposer:t,proposal_name:e,canceler:r}}])},bidname:function(t,e,r){return p.transact([{account:n.constants.EOSIO,name:"bidname",data:{bidder:t,newname:e,bid:r}}])}},{Provider:p,User:l});
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@bloks/constants"),n=(t=require("penpal/lib/connectToChild"))&&"object"==typeof t&&"default"in t?t.default:t;function r(){r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var a=Object.create((e&&e.prototype instanceof p?e:p).prototype),o=new _(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=x(i,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=f(t,e,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(t,n,o),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function p(){}function l(){}function d(){}var v={};c(v,o,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(k([])));m&&m!==e&&n.call(m,o)&&(v=m);var g=d.prototype=p.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var r;this._invoke=function(a,o){function i(){return new e((function(r,i){!function r(a,o,i,s){var c=f(t[a],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){r("next",t,i,s)}),(function(t){r("throw",t,i,s)})):e.resolve(h).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,s)}))}s(c.arg)}(a,o,r,i)}))}return r=r?r.then(i,i):i()}}function x(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=f(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var a=r.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,h):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function O(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 _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function k(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],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 l.prototype=d,c(g,"constructor",d),c(d,"constructor",l),l.displayName=c(d,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,s,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},b(g),c(g,s,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=k,_.prototype={constructor:_,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)&&n.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 r(n,r){return i.type="throw",i.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(i)},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),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;E(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function a(t,e,n,r,a,o,i){try{var s=t[o](i),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,a)}function o(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function s(t){a(i,r,o,s,c,"next",t)}function c(t){a(i,r,o,s,c,"throw",t)}s(void 0)}))}}function i(){return(i=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function c(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return s(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}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=function(){return{onLoginToSign:function(t){console.log(t.wallet,t.actions)},clearErrors:function(){},onSuccess:function(t){console.log("Success",t)},onError:function(t){throw new Error(t)},onMultisig:function(t){return!1},onFreeCpu:function(t){return!1},isMultisigMode:function(){return!1},freeCpuEnabled:function(){return!1}}},f=function(){return{actor:"",permission:"",publicKey:"",wallet:"",type:"",chain:e.constants.CHAIN,delay_sec:0,index:0}},h=new(function(){function t(){if(this.user=f(),this.users=[],this.child=void 0,this.USER_KEY="user-v.0.0.7",this.USERS_KEY="users-v.0.0.7",this.setDimensions=function(){},this.onDimensionsChange=function(){},t.instance)return t.instance}var a,i,s=t.prototype;return s.initialize=function(){var t=o(r().mark((function t(e){var a,o;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n({iframe:void 0===(a=e.iframe)?void 0:a,methods:{}}),t.next=4,o.promise;case 4:return this.child=t.sent,t.next=7,this.getUsers();case 7:return this.users=t.sent,t.next=10,this.getUser();case 10:this.user=t.sent;case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),s.getUser=function(){var t=o(r().mark((function t(){var n,a;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.child){t.next=12;break}return t.next=3,this.child.get(this.USER_KEY);case 3:if((n=t.sent)&&n.chain===e.constants.CHAIN){t.next=9;break}return a=n&&this.users.find((function(t){return t.chain===e.constants.CHAIN})),n=a||f(),t.next=9,this.saveUser(n);case 9:return t.abrupt("return",n);case 12:return t.abrupt("return",f());case 13:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),s.getUsers=function(){var t=o(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.child){t.next=9;break}return t.next=3,this.child.get(this.USERS_KEY);case 3:if(t.t0=t.sent,t.t0){t.next=6;break}t.t0=[];case 6:return t.abrupt("return",t.t0);case 9:return t.abrupt("return",[]);case 10:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),s.saveUser=function(){var t=o(r().mark((function t(e){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.isSame(this.user,e)){t.next=5;break}if(this.user=e,!this.child){t.next=5;break}return t.next=5,this.child.set(this.USER_KEY,e);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),s.saveUsers=function(){var t=o(r().mark((function t(e){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.users=e,!this.child){t.next=4;break}return t.next=4,this.child.set(this.USERS_KEY,e);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),s.isSame=function(t,e){return!!(!t&&!e||t&&e)&&t.actor===e.actor&&t.permission===e.permission&&t.wallet===e.wallet&&t.publicKey===e.publicKey},s.findUserIndex=function(t){var e=this;return this.users.findIndex((function(n){return e.isSame(n,t)}))},s.findUser=function(t){var e=this.findUserIndex(t);if(-1!==e)return this.users[e]},s.setUser=function(){var t=o(r().mark((function t(e){var n,a;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e={}),n=this.findUserIndex(e),a=-1!==n?this.users[n]:f(),t.next=5,this.saveUser(a);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),s.addUser=function(){var t=o(r().mark((function t(e){var n,a,o;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Object.assign({},f(),e),a=this.findUserIndex(n),o=this.users,-1===a?o=o.concat([n]):o[a]=Object.assign({},o[a],n),t.next=6,this.saveUsers(o);case 6:return t.next=8,this.setUser(n);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),s.addUsers=function(){var t=o(r().mark((function t(e){var n,a,o,i,s,u;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(a=[],o=c(e);!(i=o()).done;)u=this.findUserIndex(s=i.value),n=Object.assign({},f(),s),-1===u&&a.push(n);if(!a.length){t.next=6;break}return a=this.users.concat(a),t.next=6,this.saveUsers(a);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),s.removeUser=function(){var t=o(r().mark((function t(e,n){var a,o;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===n&&(n=!1),e){t.next=3;break}return t.abrupt("return");case 3:if(-1!==(a=this.findUserIndex(e))){t.next=6;break}return t.abrupt("return");case 6:return o=(r=this.users).slice(0,i=a).concat(r.slice(i+1)),t.next=9,this.saveUsers(o);case 9:if(!this.isSame(e,this.user)){t.next=18;break}if(!n||!this.users.length){t.next=16;break}return t.next=14,this.setUser(this.users[0]);case 14:t.next=18;break;case 16:return t.next=18,this.setUser();case 18:case"end":return t.stop()}var r,i}),t,this)})));return function(e,n){return t.apply(this,arguments)}}(),a=t,(i=[{key:"authorization",get:function(){return[{actor:this.user.actor,permission:this.user.permission}]}},{key:"currentChainUsers",get:function(){return this.users.filter((function(t){return t.chain===e.constants.CHAIN}))}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(a.prototype,i),Object.defineProperty(a,"prototype",{writable:!1}),t}()),p=u();function l(){return["ScatterExtension"].includes(h.user.wallet)}var d={__proto__:null,get callbacks(){return p},setCallbacks:function(t){void 0===t&&(t={}),p=Object.assign(u(),t)},isEosjs1:l},v=new(function(){function t(){if(this.provider={},this.scatter=void 0,this.wax=void 0,this.api=void 0,t.instance)return t.instance}var n=t.prototype;return n.setApi=function(t){this.api=t},n.setProvider=function(t){this.provider=t},n.setScatter=function(t){this.scatter=t},n.setWax=function(t){this.wax=t},n.generateFreeCpuAction=function(t){return{account:"tippedtipped",name:"transfer",data:{from:"tippedtipped",to:t,quantity:"1.0 CPU",memo:"Free CPU from Bloks.io!"},authorization:[{actor:"tippedtipped",permission:"payforcpu"}]}},n.generateTransactOptions=function(t){var e=t.freeCpuEnabled;return i({blocksBehind:300,expireSeconds:3e3,broadcast:!e},e&&{requiredKeys:[h.user.publicKey]})},n.transact=function(){var t=o(r().mark((function t(n){var a,o,s,c,u,f,l,d,v,y,m,g,b;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(p.clearErrors(),s=(a=h.user).delay_sec,o=a.wallet){t.next=5;break}return p.onError("Please log in first."),t.abrupt("return");case 5:if(this.provider&&this.provider.transact){t.next=9;break}return console.log("Provider not found: "+!this.provider),p.onLoginToSign({wallet:o,actions:n}),t.abrupt("return");case 9:if(c=h.authorization,n=n.map((function(t){return t.authorization=c,t})),!(this.provider&&this.provider.fc&&this.provider.fc.abiCache)){t.next=20;break}u=0,f=Array.from(new Set(n.map((function(t){return t.account}))));case 13:if(!(u<f.length)){t.next=20;break}return l=f[u],t.next=17,this.provider.fc.abiCache.abiAsync(l);case 17:u++,t.next=13;break;case 20:if(t.prev=20,!this.api||!["fio","fio-test"].includes(e.constants.CHAIN)){t.next=25;break}return t.next=24,this.api.addFIOFeeToActions(n,c[0].actor);case 24:n=t.sent;case 25:if(!p.isMultisigMode()){t.next=29;break}if(!p.onMultisig(n)){t.next=29;break}return t.abrupt("return");case 29:return(d=p.freeCpuEnabled())&&(n=[this.generateFreeCpuAction(c[0].actor)].concat(n)),v={delay_sec:s,max_cpu_usage_ms:d?5:0,actions:n},y=this.generateTransactOptions({freeCpuEnabled:d,wallet:o}),t.next=35,this.provider.transact(v,y);case 35:m=t.sent,d?p.onFreeCpu(i({actions:n},m)):(console.log("onsuccess"),p.onSuccess(m)),t.next=46;break;case 39:t.prev=39,t.t0=t.catch(20),g=t.t0.json&&t.t0.json.fields&&t.t0.json.fields.length&&t.t0.json.fields[0].error,b=t.t0&&t.t0.error&&t.t0.error.details&&t.t0.error.details.length&&t.t0.error.details[0].message||g||t.t0.reason||t.t0.message||t.t0.toString()||t.t0,console.log(b),p.onError(b);case 46:case"end":return t.stop()}}),t,this,[[20,39]])})));return function(e){return t.apply(this,arguments)}}(),t}());function y(t,n,r,a,o){return{account:e.constants.EOSIO,name:"delegatebw",data:{from:t,receiver:n,stake_net_quantity:r,stake_cpu_quantity:a,transfer:o}}}function m(t,n,r,a){return{account:e.constants.EOSIO,name:"undelegatebw",data:{from:t,receiver:n,unstake_net_quantity:r,unstake_cpu_quantity:a}}}function g(t,n,r){return{account:e.constants.EOSIO,name:"buyrambytes",data:{payer:t,receiver:n,bytes:r}}}function b(t,n,r,a){return{account:e.constants.EOSIO,name:"updateauth",data:{account:t,permission:n,parent:r,auth:{threshold:1,keys:[{key:a,weight:1}],accounts:[],waits:[]}}}}function w(t,n,r,a){var o;return{account:e.constants.EOSIO,name:"newaccount",data:(o={creator:t},o[e.constants.NEWACCOUNT_NAME_PARAM]=n,o.owner={threshold:1,keys:[{key:r,weight:1}],accounts:[],waits:[]},o.active={threshold:1,keys:[{key:a,weight:1}],accounts:[],waits:[]},o)}}function x(t){return{account:"eosio.proton",name:"newaccres",data:{account:t}}}exports.default=i({},d,{__proto__:null,transfer:function(t,e,n,r,a){return v.transact([{account:t,name:"transfer",data:{from:e,to:n,quantity:r,memo:a}}])},delegatebw:function(t,e,n,r,a){l()&&(a=+a);var o=[y(t,e,n,r,a)];return v.transact(o)},_delegatebw:y,undelegatebw:function(t,e,n,r){var a=[m(t,e,n,r)];return v.transact(a)},_undelegatebw:m,buyram:function(t,n,r){return v.transact([{account:e.constants.EOSIO,name:"buyram",data:{payer:t,receiver:n,quant:r}}])},buyrambytes:function(t,e,n){var r=[g(t,e,n)];return v.transact(r)},_buyrambytes:g,sellram:function(t,n){return v.transact([{account:e.constants.EOSIO,name:"sellram",data:{account:t,bytes:n}}])},refund:function(t){return v.transact([{account:e.constants.EOSIO,name:"refund",data:{owner:t}}])},addgravatar:function(t,n,r,a){return v.transact([{account:e.constants.ACCOUNT_INFO,name:"update",data:{account_name:t,title:n,avatar:r,desc:"",modifier:t,url:a?'{"telegram":"'+a+'"':""}}])},changeBasicPermissions:function(t,e,n){var r=[];return e&&""!==e&&r.push(b(t,"active","owner",e)),n&&""!==n&&r.push(b(t,"owner","",n)),v.transact(r)},_updateauthkey:b,updateAuth:function(t,n,r,a){return a.keys=a.keys.sort((function(t,e){return t.key.localeCompare(e.key)})),a.accounts=a.accounts.sort((function(t,e){return t.permission.actor.localeCompare(e.permission.actor)})),a.waits=a.waits.sort((function(t,e){return t.wait_sec.localeCompare(e.wait_sec)})),v.transact([{account:e.constants.EOSIO,name:"updateauth",data:{account:t,permission:n,parent:r,auth:a}}])},_newaccount:w,_newaccres:x,createAccount:function(t,n,r,a,o,i,s,c){l()&&(c=+c);var u=[w(t,n,r,a),g(t,n,o)];return-1!==e.constants.CHAIN.indexOf("proton")?u.push(x(n)):u.push(y(t,n,i,s,c)),v.transact(u)},voteproducer:function(t,n,r){var a=[];return["fio","fio-test"].includes(e.constants.CHAIN)&&n?a.push({account:e.constants.EOSIO,name:"voteproxy",data:{proxy:n}}):a.push({account:e.constants.EOSIO,name:"voteproducer",data:{voter:t,proxy:n,producers:r}}),v.transact(a)},linkAuth:function(t,n,r,a){return v.transact([{account:e.constants.EOSIO,name:"linkauth",data:{account:t,code:n,type:r,requirement:a}}])},unlinkAuth:function(t,n,r){return v.transact([{account:e.constants.EOSIO,name:"unlinkauth",data:{account:t,code:n,type:r}}])},deleteAuth:function(t,n){return v.transact([{account:e.constants.EOSIO,name:"deleteauth",data:{account:t,permission:n}}])},cancelDelay:function(t,n,r){return v.transact([{account:e.constants.EOSIO,name:"canceldelay",data:{canceling_auth:{actor:t,permission:n},trx_id:r}}])},updateProxy:function(t,n){return l()&&(n=+n),v.transact([{account:e.constants.EOSIO,name:"regproxy",data:{proxy:t,isproxy:n}}])},_setCode:function(t,n){return{account:e.constants.EOSIO,name:"setcode",data:{account:t,code:n,vmtype:0,vmversion:0}}},_setAbi:function(t,n){return{account:e.constants.EOSIO,name:"setabi",data:{account:t,abi:n}}},propose:function(t,n,r,a){return v.transact([{account:e.constants.EOSIO_MSIG,name:"propose",data:{proposer:t,proposal_name:n,requested:r,trx:a}}])},approve:function(t,n,r){return v.transact([{account:e.constants.EOSIO_MSIG,name:"approve",data:{proposer:t,proposal_name:n,level:r}}])},execute:function(t,n,r){return v.transact([{account:e.constants.EOSIO_MSIG,name:"exec",data:{proposer:t,proposal_name:n,executer:r}}])},cancel:function(t,n,r){return v.transact([{account:e.constants.EOSIO_MSIG,name:"cancel",data:{proposer:t,proposal_name:n,canceler:r}}])},bidname:function(t,n,r){return v.transact([{account:e.constants.EOSIO,name:"bidname",data:{bidder:t,newname:n,bid:r}}])}},{Provider:v,User:h});
//# sourceMappingURL=wallet.cjs.production.min.js.map
import { constants } from '@bloks/constants';
import connectToChild from 'penpal/lib/connectToChild';
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 _defineProperties(target, props) {

@@ -17,2 +398,5 @@ for (var i = 0; i < props.length; i++) {

if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;

@@ -22,3 +406,3 @@ }

function _extends() {
_extends = Object.assign || function (target) {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {

@@ -36,3 +420,2 @@ var source = arguments[i];

};
return _extends.apply(this, arguments);

@@ -79,176 +462,2 @@ }

// A type of promise-like that resolves synchronously and supports only one observer
const _Pact = /*#__PURE__*/(function() {
function _Pact() {}
_Pact.prototype.then = function(onFulfilled, onRejected) {
const result = new _Pact();
const state = this.s;
if (state) {
const callback = state & 1 ? onFulfilled : onRejected;
if (callback) {
try {
_settle(result, 1, callback(this.v));
} catch (e) {
_settle(result, 2, e);
}
return result;
} else {
return this;
}
}
this.o = function(_this) {
try {
const value = _this.v;
if (_this.s & 1) {
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
} else if (onRejected) {
_settle(result, 1, onRejected(value));
} else {
_settle(result, 2, value);
}
} catch (e) {
_settle(result, 2, e);
}
};
return result;
};
return _Pact;
})();
// Settles a pact synchronously
function _settle(pact, state, value) {
if (!pact.s) {
if (value instanceof _Pact) {
if (value.s) {
if (state & 1) {
state = value.s;
}
value = value.v;
} else {
value.o = _settle.bind(null, pact, state);
return;
}
}
if (value && value.then) {
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
return;
}
pact.s = state;
pact.v = value;
const observer = pact.o;
if (observer) {
observer(pact);
}
}
}
function _isSettledPact(thenable) {
return thenable instanceof _Pact && thenable.s & 1;
}
// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)
function _forTo(array, body, check) {
var i = -1, pact, reject;
function _cycle(result) {
try {
while (++i < array.length && (!check || !check())) {
result = body(i);
if (result && result.then) {
if (_isSettledPact(result)) {
result = result.v;
} else {
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
return;
}
}
}
if (pact) {
_settle(pact, 1, result);
} else {
pact = result;
}
} catch (e) {
_settle(pact || (pact = new _Pact()), 2, e);
}
}
_cycle();
return pact;
}
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
// Asynchronously iterate through an object's values
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
function _forOf(target, body, check) {
if (typeof target[_iteratorSymbol] === "function") {
var iterator = target[_iteratorSymbol](), step, pact, reject;
function _cycle(result) {
try {
while (!(step = iterator.next()).done && (!check || !check())) {
result = body(step.value);
if (result && result.then) {
if (_isSettledPact(result)) {
result = result.v;
} else {
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
return;
}
}
}
if (pact) {
_settle(pact, 1, result);
} else {
pact = result;
}
} catch (e) {
_settle(pact || (pact = new _Pact()), 2, e);
}
}
_cycle();
if (iterator.return) {
var _fixup = function(value) {
try {
if (!step.done) {
iterator.return();
}
} catch(e) {
}
return value;
};
if (pact && pact.then) {
return pact.then(_fixup, function(e) {
throw _fixup(e);
});
}
_fixup();
}
return pact;
}
// No support for Symbol.iterator
if (!("length" in target)) {
throw new TypeError("Object is not iterable");
}
// Handle live collections properly
var values = [];
for (var i = 0; i < target.length; i++) {
values.push(target[i]);
}
return _forTo(values, function(i) { return body(values[i]); }, check);
}
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
// Asynchronously call a function and send errors to recovery continuation
function _catch(body, recover) {
try {
var result = body();
} catch(e) {
return recover(e);
}
if (result && result.then) {
return result.then(void 0, recover);
}
return result;
}
var defaultCallbacks = function defaultCallbacks() {

@@ -321,40 +530,73 @@ return {

_proto.initialize = function initialize(_ref) {
var _ref$iframe = _ref.iframe,
iframe = _ref$iframe === void 0 ? undefined : _ref$iframe;
_proto.initialize = /*#__PURE__*/function () {
var _initialize = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
var _ref$iframe, iframe, connection;
try {
var _this2 = this;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_ref$iframe = _ref.iframe, iframe = _ref$iframe === void 0 ? undefined : _ref$iframe;
// Setup iframe
connection = connectToChild({
// The iframe to which a connection should be made
iframe: iframe,
// Methods the parent is exposing to the child
methods: {}
});
_context.next = 4;
return connection.promise;
// Setup iframe
var connection = connectToChild({
// The iframe to which a connection should be made
iframe: iframe,
// Methods the parent is exposing to the child
methods: {}
});
return Promise.resolve(connection.promise).then(function (_connection$promise) {
_this2.child = _connection$promise;
// Setup user
return Promise.resolve(_this2.getUsers()).then(function (_this$getUsers) {
_this2.users = _this$getUsers;
return Promise.resolve(_this2.getUser()).then(function (_this$getUser) {
_this2.user = _this$getUser;
});
});
});
} catch (e) {
return Promise.reject(e);
case 4:
this.child = _context.sent;
_context.next = 7;
return this.getUsers();
case 7:
this.users = _context.sent;
_context.next = 10;
return this.getUser();
case 10:
this.user = _context.sent;
case 11:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function initialize(_x) {
return _initialize.apply(this, arguments);
}
};
_proto.getUser = function getUser() {
try {
var _this4 = this;
return initialize;
}();
if (_this4.child) {
return Promise.resolve(_this4.child.get(_this4.USER_KEY)).then(function (user) {
var _temp = function () {
if (!user || user.chain !== constants.CHAIN) {
var existingCorrectChainUser = user && _this4.users.find(function (user) {
_proto.getUser = /*#__PURE__*/function () {
var _getUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
var user, existingCorrectChainUser;
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!this.child) {
_context2.next = 12;
break;
}
_context2.next = 3;
return this.child.get(this.USER_KEY);
case 3:
user = _context2.sent;
if (!(!user || user.chain !== constants.CHAIN)) {
_context2.next = 9;
break;
}
existingCorrectChainUser = user && this.users.find(function (user) {
return user.chain === constants.CHAIN;

@@ -369,34 +611,71 @@ });

return Promise.resolve(_this4.saveUser(user)).then(function () {});
}
}();
_context2.next = 9;
return this.saveUser(user);
return _temp && _temp.then ? _temp.then(function () {
return user;
}) : user;
});
} else {
return Promise.resolve(defaultUser());
}
} catch (e) {
return Promise.reject(e);
case 9:
return _context2.abrupt("return", user);
case 12:
return _context2.abrupt("return", defaultUser());
case 13:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function getUser() {
return _getUser.apply(this, arguments);
}
};
_proto.getUsers = function getUsers() {
try {
var _this6 = this;
return getUser;
}();
if (_this6.child) {
return Promise.resolve(_this6.child.get(_this6.USERS_KEY)).then(function (_this5$child$get) {
return _this5$child$get || [];
});
} else {
return Promise.resolve([]);
}
} catch (e) {
return Promise.reject(e);
_proto.getUsers = /*#__PURE__*/function () {
var _getUsers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (!this.child) {
_context3.next = 9;
break;
}
_context3.next = 3;
return this.child.get(this.USERS_KEY);
case 3:
_context3.t0 = _context3.sent;
if (_context3.t0) {
_context3.next = 6;
break;
}
_context3.t0 = [];
case 6:
return _context3.abrupt("return", _context3.t0);
case 9:
return _context3.abrupt("return", []);
case 10:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function getUsers() {
return _getUsers.apply(this, arguments);
}
};
return getUsers;
}();
/**

@@ -406,44 +685,71 @@ * If different user from current user, save

*/
_proto.saveUser = function saveUser(user) {
try {
var _this8 = this;
_proto.saveUser =
/*#__PURE__*/
function () {
var _saveUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(user) {
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
if (this.isSame(this.user, user)) {
_context4.next = 5;
break;
}
var _temp4 = function () {
if (!_this8.isSame(_this8.user, user)) {
_this8.user = user;
this.user = user;
var _temp5 = function () {
if (_this8.child) {
return Promise.resolve(_this8.child.set(_this8.USER_KEY, user)).then(function () {});
}
}();
if (!this.child) {
_context4.next = 5;
break;
}
if (_temp5 && _temp5.then) return _temp5.then(function () {});
_context4.next = 5;
return this.child.set(this.USER_KEY, user);
case 5:
case "end":
return _context4.stop();
}
}
}();
}, _callee4, this);
}));
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
} catch (e) {
return Promise.reject(e);
function saveUser(_x2) {
return _saveUser.apply(this, arguments);
}
};
_proto.saveUsers = function saveUsers(users) {
try {
var _this10 = this;
return saveUser;
}();
_this10.users = users;
_proto.saveUsers = /*#__PURE__*/function () {
var _saveUsers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(users) {
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
this.users = users;
var _temp7 = function () {
if (_this10.child) {
return Promise.resolve(_this10.child.set(_this10.USERS_KEY, users)).then(function () {});
if (!this.child) {
_context5.next = 4;
break;
}
_context5.next = 4;
return this.child.set(this.USERS_KEY, users);
case 4:
case "end":
return _context5.stop();
}
}
}();
}, _callee5, this);
}));
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
} catch (e) {
return Promise.reject(e);
function saveUsers(_x3) {
return _saveUsers.apply(this, arguments);
}
};
return saveUsers;
}();
_proto.isSame = function isSame(user1, user2) {

@@ -458,6 +764,6 @@ if ((user1 || user2) && (!user1 || !user2)) {

_proto.findUserIndex = function findUserIndex(newUser) {
var _this11 = this;
var _this = this;
return this.users.findIndex(function (user) {
return _this11.isSame(user, newUser);
return _this.isSame(user, newUser);
});

@@ -476,117 +782,193 @@ };

_proto.setUser = function setUser(newUser) {
if (newUser === void 0) {
newUser = {};
}
_proto.setUser = /*#__PURE__*/function () {
var _setUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(newUser) {
var userIndex, user;
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
if (newUser === void 0) {
newUser = {};
}
try {
var _this13 = this;
userIndex = this.findUserIndex(newUser); // Set as default user if user not found
// The default user just means no user
var userIndex = _this13.findUserIndex(newUser); // Set as default user if user not found
// The default user just means no user
user = userIndex !== -1 ? this.users[userIndex] : defaultUser(); // Save user
_context6.next = 5;
return this.saveUser(user);
var user = userIndex !== -1 ? _this13.users[userIndex] : defaultUser(); // Save user
case 5:
case "end":
return _context6.stop();
}
}
}, _callee6, this);
}));
return Promise.resolve(_this13.saveUser(user)).then(function () {});
} catch (e) {
return Promise.reject(e);
function setUser(_x4) {
return _setUser.apply(this, arguments);
}
};
_proto.addUser = function addUser(user) {
try {
var _this15 = this;
return setUser;
}();
var newUser = Object.assign({}, defaultUser(), user); // New User
_proto.addUser = /*#__PURE__*/function () {
var _addUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(user) {
var newUser, userIndex, newUsers;
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
newUser = Object.assign({}, defaultUser(), user); // New User
var userIndex = _this15.findUserIndex(newUser);
userIndex = this.findUserIndex(newUser);
newUsers = this.users; // Add the user if not found
var newUsers = _this15.users; // Add the user if not found
if (userIndex === -1) {
newUsers = newUsers.concat([newUser]); // Update information
} else {
newUsers[userIndex] = Object.assign({}, newUsers[userIndex], newUser);
} // Save
if (userIndex === -1) {
newUsers = newUsers.concat([newUser]); // Update information
} else {
newUsers[userIndex] = Object.assign({}, newUsers[userIndex], newUser);
} // Save
_context7.next = 6;
return this.saveUsers(newUsers);
return Promise.resolve(_this15.saveUsers(newUsers)).then(function () {
return Promise.resolve(_this15.setUser(newUser)).then(function () {});
});
} catch (e) {
return Promise.reject(e);
case 6:
_context7.next = 8;
return this.setUser(newUser);
case 8:
case "end":
return _context7.stop();
}
}
}, _callee7, this);
}));
function addUser(_x5) {
return _addUser.apply(this, arguments);
}
};
_proto.addUsers = function addUsers(users) {
try {
var _this17 = this;
return addUser;
}();
var newUser;
var newUsers = [];
_proto.addUsers = /*#__PURE__*/function () {
var _addUsers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(users) {
var newUser, newUsers, _iterator, _step, user, userIndex;
for (var _iterator = _createForOfIteratorHelperLoose(users), _step; !(_step = _iterator()).done;) {
var user = _step.value;
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
newUsers = [];
var userIndex = _this17.findUserIndex(user);
for (_iterator = _createForOfIteratorHelperLoose(users); !(_step = _iterator()).done;) {
user = _step.value;
userIndex = this.findUserIndex(user);
newUser = Object.assign({}, defaultUser(), user); // Add to list of users to save if not found
newUser = Object.assign({}, defaultUser(), user); // Add to list of users to save if not found
if (userIndex === -1) {
newUsers.push(newUser);
}
}
if (userIndex === -1) {
newUsers.push(newUser);
}
}
if (!newUsers.length) {
_context8.next = 6;
break;
}
var _temp9 = function () {
if (newUsers.length) {
newUsers = _this17.users.concat(newUsers);
return Promise.resolve(_this17.saveUsers(newUsers)).then(function () {});
newUsers = this.users.concat(newUsers);
_context8.next = 6;
return this.saveUsers(newUsers);
case 6:
case "end":
return _context8.stop();
}
}
}();
}, _callee8, this);
}));
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
} catch (e) {
return Promise.reject(e);
function addUsers(_x6) {
return _addUsers.apply(this, arguments);
}
};
_proto.removeUser = function removeUser(userToRemove, setNew) {
if (setNew === void 0) {
setNew = false;
}
return addUsers;
}();
try {
var _this19 = this;
_proto.removeUser = /*#__PURE__*/function () {
var _removeUser = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(userToRemove, setNew) {
var userToRemoveIndex, remainingUsers, changeCurrentUser;
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
if (setNew === void 0) {
setNew = false;
}
if (!userToRemove) return Promise.resolve();
if (userToRemove) {
_context9.next = 3;
break;
}
var userToRemoveIndex = _this19.findUserIndex(userToRemove);
return _context9.abrupt("return");
if (userToRemoveIndex === -1) return Promise.resolve();
var remainingUsers = spliceNoMutation(_this19.users, userToRemoveIndex);
return Promise.resolve(_this19.saveUsers(remainingUsers)).then(function () {
var changeCurrentUser = _this19.isSame(userToRemove, _this19.user);
case 3:
userToRemoveIndex = this.findUserIndex(userToRemove);
var _temp11 = function () {
if (changeCurrentUser) {
var _temp12 = function () {
if (setNew && _this19.users.length) {
return Promise.resolve(_this19.setUser(_this19.users[0])).then(function () {});
} else {
return Promise.resolve(_this19.setUser()).then(function () {});
if (!(userToRemoveIndex === -1)) {
_context9.next = 6;
break;
}
}();
if (_temp12 && _temp12.then) return _temp12.then(function () {});
return _context9.abrupt("return");
case 6:
remainingUsers = spliceNoMutation(this.users, userToRemoveIndex);
_context9.next = 9;
return this.saveUsers(remainingUsers);
case 9:
changeCurrentUser = this.isSame(userToRemove, this.user);
if (!changeCurrentUser) {
_context9.next = 18;
break;
}
if (!(setNew && this.users.length)) {
_context9.next = 16;
break;
}
_context9.next = 14;
return this.setUser(this.users[0]);
case 14:
_context9.next = 18;
break;
case 16:
_context9.next = 18;
return this.setUser();
case 18:
case "end":
return _context9.stop();
}
}();
}
}, _callee9, this);
}));
if (_temp11 && _temp11.then) return _temp11.then(function () {});
});
} catch (e) {
return Promise.reject(e);
function removeUser(_x7, _x8) {
return _removeUser.apply(this, arguments);
}
};
return removeUser;
}();
_createClass(UserClass, [{

@@ -693,113 +1075,156 @@ key: "authorization",

_proto.transact = function transact(actions) {
try {
var _this2 = this;
_proto.transact = /*#__PURE__*/function () {
var _transact = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(actions) {
var _User$user, wallet, delay_sec, authorization, _i, _Array$from, account, endTx, freeCpuEnabled, obj1, obj2, success, fieldError, detailError, error;
var _temp6 = function _temp6() {
return _catch(function () {
function _temp3() {
// MULTISIG (Msig)
if (callbacks.isMultisigMode()) {
var endTx = callbacks.onMultisig(actions);
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
callbacks.clearErrors(); // Get User
if (endTx) {
return;
_User$user = User.user, wallet = _User$user.wallet, delay_sec = _User$user.delay_sec; // Check that wallet exists
if (wallet) {
_context.next = 5;
break;
}
} // Free CPU
callbacks.onError('Please log in first.');
return _context.abrupt("return");
var freeCpuEnabled = callbacks.freeCpuEnabled();
case 5:
if (this.provider && this.provider.transact) {
_context.next = 9;
break;
}
if (freeCpuEnabled) {
actions = [_this2.generateFreeCpuAction(authorization[0].actor)].concat(actions);
}
console.log("Provider not found: " + !this.provider);
callbacks.onLoginToSign({
wallet: wallet,
actions: actions
});
return _context.abrupt("return");
var obj1 = {
delay_sec: delay_sec,
max_cpu_usage_ms: freeCpuEnabled ? 5 : 0,
actions: actions
};
case 9:
// Add auth to all actions
authorization = User.authorization;
actions = actions.map(function (action) {
action.authorization = authorization;
return action;
}); // Fetch ABI into cache if needed (EOSJS1)
var obj2 = _this2.generateTransactOptions({
freeCpuEnabled: freeCpuEnabled,
wallet: wallet
});
if (!(this.provider && this.provider.fc && this.provider.fc.abiCache)) {
_context.next = 20;
break;
}
return Promise.resolve(_this2.provider.transact(obj1, obj2)).then(function (success) {
if (freeCpuEnabled) {
callbacks.onFreeCpu(_extends({
actions: actions
}, success));
} else {
console.log('onsuccess');
callbacks.onSuccess(success);
_i = 0, _Array$from = Array.from(new Set(actions.map(function (action) {
return action.account;
})));
case 13:
if (!(_i < _Array$from.length)) {
_context.next = 20;
break;
}
}); // After success, check if free CPU, if so, handle it
}
var _temp2 = function () {
if (_this2.api && ['fio', 'fio-test'].includes(constants.CHAIN)) {
return Promise.resolve(_this2.api.addFIOFeeToActions(actions, authorization[0].actor)).then(function (_this$api$addFIOFeeTo) {
actions = _this$api$addFIOFeeTo;
});
}
}();
account = _Array$from[_i];
_context.next = 17;
return this.provider.fc.abiCache.abiAsync(account);
// Add fio fees
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
}, function (e) {
var fieldError = e.json && e.json.fields && e.json.fields.length && e.json.fields[0].error;
var detailError = e && e.error && e.error.details && e.error.details.length && e.error.details[0].message;
var error = detailError || fieldError || e.reason || e.message || e.toString() || e;
console.log(error);
callbacks.onError(error);
});
};
case 17:
_i++;
_context.next = 13;
break;
callbacks.clearErrors(); // Get User
case 20:
_context.prev = 20;
var _User$user = User.user,
wallet = _User$user.wallet,
delay_sec = _User$user.delay_sec; // Check that wallet exists
if (!(this.api && ['fio', 'fio-test'].includes(constants.CHAIN))) {
_context.next = 25;
break;
}
if (!wallet) {
callbacks.onError('Please log in first.');
return Promise.resolve();
} // Check that provider exists and has transact
_context.next = 24;
return this.api.addFIOFeeToActions(actions, authorization[0].actor);
case 24:
actions = _context.sent;
if (!(_this2.provider && _this2.provider.transact)) {
console.log("Provider not found: " + !_this2.provider);
callbacks.onLoginToSign({
wallet: wallet,
actions: actions
});
return Promise.resolve();
} // Add auth to all actions
case 25:
if (!callbacks.isMultisigMode()) {
_context.next = 29;
break;
}
endTx = callbacks.onMultisig(actions);
var authorization = User.authorization;
actions = actions.map(function (action) {
action.authorization = authorization;
return action;
}); // Fetch ABI into cache if needed (EOSJS1)
if (!endTx) {
_context.next = 29;
break;
}
var _temp7 = function () {
if (_this2.provider && _this2.provider.fc && _this2.provider.fc.abiCache) {
var _temp8 = _forOf(Array.from(new Set(actions.map(function (action) {
return action.account;
}))), function (account) {
return Promise.resolve(_this2.provider.fc.abiCache.abiAsync(account)).then(function () {});
});
return _context.abrupt("return");
if (_temp8 && _temp8.then) return _temp8.then(function () {});
case 29:
// Free CPU
freeCpuEnabled = callbacks.freeCpuEnabled();
if (freeCpuEnabled) {
actions = [this.generateFreeCpuAction(authorization[0].actor)].concat(actions);
}
obj1 = {
delay_sec: delay_sec,
max_cpu_usage_ms: freeCpuEnabled ? 5 : 0,
actions: actions
};
obj2 = this.generateTransactOptions({
freeCpuEnabled: freeCpuEnabled,
wallet: wallet
});
_context.next = 35;
return this.provider.transact(obj1, obj2);
case 35:
success = _context.sent;
// After success, check if free CPU, if so, handle it
if (freeCpuEnabled) {
callbacks.onFreeCpu(_extends({
actions: actions
}, success));
} else {
console.log('onsuccess');
callbacks.onSuccess(success);
}
_context.next = 46;
break;
case 39:
_context.prev = 39;
_context.t0 = _context["catch"](20);
fieldError = _context.t0.json && _context.t0.json.fields && _context.t0.json.fields.length && _context.t0.json.fields[0].error;
detailError = _context.t0 && _context.t0.error && _context.t0.error.details && _context.t0.error.details.length && _context.t0.error.details[0].message;
error = detailError || fieldError || _context.t0.reason || _context.t0.message || _context.t0.toString() || _context.t0;
console.log(error);
callbacks.onError(error);
case 46:
case "end":
return _context.stop();
}
}
}();
}, _callee, this, [[20, 39]]);
}));
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp6) : _temp6(_temp7));
} catch (e) {
return Promise.reject(e);
function transact(_x) {
return _transact.apply(this, arguments);
}
};
return transact;
}();
return ProviderClass;

@@ -806,0 +1231,0 @@ }();

{
"name": "@bloks/wallet",
"version": "26.1.2",
"version": "26.1.36",
"author": "jafri",

@@ -20,4 +20,3 @@ "module": "dist/wallet.esm.js",

"@types/jest": "^24.9.0",
"husky": "^4.0.10",
"tsdx": "^0.12.3",
"tsdx": "^0.14.1",
"tslib": "^2.3.0",

@@ -27,6 +26,6 @@ "typescript": "^4.3.2"

"dependencies": {
"@bloks/constants": "^26.1.2",
"@bloks/constants": "^26.1.36",
"penpal": "^4.1.1"
},
"gitHead": "2c3620d16bd3c2c43721dc66a033a24f9186577f"
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc