wao 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ao.js +14 -10
- package/cjs/aoconnect.js +89 -85
- package/cjs/ar.js +63 -60
- package/cjs/helpers.js +6 -27
- package/cjs/test.js +32 -0
- package/esm/ao.js +1 -1
- package/esm/aoconnect.js +31 -21
- package/esm/ar.js +2 -0
- package/esm/helpers.js +1 -4
- package/esm/test.js +3 -0
- package/package.json +1 -1
package/cjs/ao.js
CHANGED
|
@@ -1225,37 +1225,41 @@ var AO = /*#__PURE__*/function () {
|
|
|
1225
1225
|
err = null;
|
|
1226
1226
|
case 3:
|
|
1227
1227
|
if (!(attempts > 0)) {
|
|
1228
|
-
_context17.next =
|
|
1228
|
+
_context17.next = 18;
|
|
1229
1229
|
break;
|
|
1230
1230
|
}
|
|
1231
|
-
|
|
1231
|
+
if (this.in_memory) {
|
|
1232
|
+
_context17.next = 7;
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1235
|
+
_context17.next = 7;
|
|
1232
1236
|
return (0, _utils.wait)(1000);
|
|
1233
|
-
case
|
|
1234
|
-
_context17.next =
|
|
1237
|
+
case 7:
|
|
1238
|
+
_context17.next = 9;
|
|
1235
1239
|
return this.dry({
|
|
1236
1240
|
pid: pid,
|
|
1237
1241
|
data: "#Inbox"
|
|
1238
1242
|
});
|
|
1239
|
-
case
|
|
1243
|
+
case 9:
|
|
1240
1244
|
_yield$this$dry = _context17.sent;
|
|
1241
1245
|
res = _yield$this$dry.res;
|
|
1242
1246
|
_err = _yield$this$dry.err;
|
|
1243
1247
|
if (!(_typeof(res === null || res === void 0 ? void 0 : res.Output) === "object")) {
|
|
1244
|
-
_context17.next =
|
|
1248
|
+
_context17.next = 14;
|
|
1245
1249
|
break;
|
|
1246
1250
|
}
|
|
1247
|
-
return _context17.abrupt("break",
|
|
1248
|
-
case
|
|
1251
|
+
return _context17.abrupt("break", 18);
|
|
1252
|
+
case 14:
|
|
1249
1253
|
attempts -= 1;
|
|
1250
1254
|
if (attempts === 0) err = "timeout";
|
|
1251
1255
|
_context17.next = 3;
|
|
1252
1256
|
break;
|
|
1253
|
-
case
|
|
1257
|
+
case 18:
|
|
1254
1258
|
return _context17.abrupt("return", {
|
|
1255
1259
|
err: err,
|
|
1256
1260
|
pid: pid
|
|
1257
1261
|
});
|
|
1258
|
-
case
|
|
1262
|
+
case 19:
|
|
1259
1263
|
case "end":
|
|
1260
1264
|
return _context17.stop();
|
|
1261
1265
|
}
|
package/cjs/aoconnect.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.connect = void 0;
|
|
6
|
+
exports.mu = exports.connect = exports.acc = void 0;
|
|
7
7
|
var _warpArbundles = require("warp-arbundles");
|
|
8
8
|
var _base64url = _interopRequireDefault(require("base64url"));
|
|
9
9
|
var _aoLoader = _interopRequireDefault(require("@permaweb/ao-loader"));
|
|
@@ -11,19 +11,20 @@ var _fs = require("fs");
|
|
|
11
11
|
var _path = require("path");
|
|
12
12
|
var _ramda = require("ramda");
|
|
13
13
|
var _accounts = _interopRequireDefault(require("./accounts.js"));
|
|
14
|
+
var _utils = require("./utils.js");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
18
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
19
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
20
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
20
22
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21
23
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
23
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
24
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
25
24
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
26
25
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
27
28
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
28
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
29
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -78,41 +79,8 @@ var dirname = /*#__PURE__*/function () {
|
|
|
78
79
|
return _ref.apply(this, arguments);
|
|
79
80
|
};
|
|
80
81
|
}();
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
return [v.name, v.value];
|
|
84
|
-
})(_tags2));
|
|
85
|
-
};
|
|
86
|
-
var action = function action(value) {
|
|
87
|
-
return tag("Action", value);
|
|
88
|
-
};
|
|
89
|
-
var tag = function tag(name, value) {
|
|
90
|
-
return {
|
|
91
|
-
name: name,
|
|
92
|
-
value: jsonToStr(value)
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
var buildTags = function buildTags(act, tags) {
|
|
96
|
-
var _tags = [];
|
|
97
|
-
if (act) _tags.push(action(act));
|
|
98
|
-
for (var k in tags) {
|
|
99
|
-
if ((0, _ramda.is)(Array)(tags[k])) {
|
|
100
|
-
var _iterator = _createForOfIteratorHelper(tags[k]),
|
|
101
|
-
_step;
|
|
102
|
-
try {
|
|
103
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
104
|
-
var v = _step.value;
|
|
105
|
-
_tags.push(tag(k, v));
|
|
106
|
-
}
|
|
107
|
-
} catch (err) {
|
|
108
|
-
_iterator.e(err);
|
|
109
|
-
} finally {
|
|
110
|
-
_iterator.f();
|
|
111
|
-
}
|
|
112
|
-
} else _tags.push(tag(k, tags[k]));
|
|
113
|
-
}
|
|
114
|
-
return _tags;
|
|
115
|
-
};
|
|
82
|
+
var acc = exports.acc = _accounts["default"].users;
|
|
83
|
+
var mu = exports.mu = _accounts["default"].mu;
|
|
116
84
|
var connect = exports.connect = function connect() {
|
|
117
85
|
var wasms = {
|
|
118
86
|
"Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM": {
|
|
@@ -137,7 +105,6 @@ var connect = exports.connect = function connect() {
|
|
|
137
105
|
var env = {
|
|
138
106
|
msgs: {}
|
|
139
107
|
};
|
|
140
|
-
var mu = _accounts["default"].mu;
|
|
141
108
|
var transform = function transform(input) {
|
|
142
109
|
var _input$Tags;
|
|
143
110
|
var output = {
|
|
@@ -277,7 +244,7 @@ var connect = exports.connect = function connect() {
|
|
|
277
244
|
"Memory-Limit": "1-gb",
|
|
278
245
|
"Compute-Limit": "9000000000000"
|
|
279
246
|
});
|
|
280
|
-
_tags = buildTags(t);
|
|
247
|
+
_tags = (0, _utils.buildTags)(t);
|
|
281
248
|
_context3.next = 5;
|
|
282
249
|
return parse({
|
|
283
250
|
tags: _tags,
|
|
@@ -311,22 +278,22 @@ var connect = exports.connect = function connect() {
|
|
|
311
278
|
}();
|
|
312
279
|
var _message = /*#__PURE__*/function () {
|
|
313
280
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
|
|
314
|
-
var p, ex,
|
|
281
|
+
var p, ex, _iterator, _step, _v, _yield$parse2, id, owner, _opt$data2, _opt$from, _res$Messages, msg, _env, res, _iterator2, _step2, v;
|
|
315
282
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
316
283
|
while (1) switch (_context4.prev = _context4.next) {
|
|
317
284
|
case 0:
|
|
318
285
|
p = env[opt.process];
|
|
319
286
|
ex = false;
|
|
320
|
-
|
|
287
|
+
_iterator = _createForOfIteratorHelper(opt.tags);
|
|
321
288
|
try {
|
|
322
|
-
for (
|
|
323
|
-
_v =
|
|
289
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
290
|
+
_v = _step.value;
|
|
324
291
|
if (_v.name === "Type") ex = true;
|
|
325
292
|
}
|
|
326
293
|
} catch (err) {
|
|
327
|
-
|
|
294
|
+
_iterator.e(err);
|
|
328
295
|
} finally {
|
|
329
|
-
|
|
296
|
+
_iterator.f();
|
|
330
297
|
}
|
|
331
298
|
if (!ex) opt.tags.push({
|
|
332
299
|
name: "Type",
|
|
@@ -358,15 +325,15 @@ var connect = exports.connect = function connect() {
|
|
|
358
325
|
id: id
|
|
359
326
|
}, opt));
|
|
360
327
|
env.msgs[id] = opt;
|
|
361
|
-
|
|
328
|
+
_iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
|
|
362
329
|
_context4.prev = 23;
|
|
363
|
-
|
|
330
|
+
_iterator2.s();
|
|
364
331
|
case 25:
|
|
365
|
-
if ((
|
|
332
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
366
333
|
_context4.next = 32;
|
|
367
334
|
break;
|
|
368
335
|
}
|
|
369
|
-
v =
|
|
336
|
+
v = _step2.value;
|
|
370
337
|
if (!env[v.Target]) {
|
|
371
338
|
_context4.next = 30;
|
|
372
339
|
break;
|
|
@@ -388,10 +355,10 @@ var connect = exports.connect = function connect() {
|
|
|
388
355
|
case 34:
|
|
389
356
|
_context4.prev = 34;
|
|
390
357
|
_context4.t0 = _context4["catch"](23);
|
|
391
|
-
|
|
358
|
+
_iterator2.e(_context4.t0);
|
|
392
359
|
case 37:
|
|
393
360
|
_context4.prev = 37;
|
|
394
|
-
|
|
361
|
+
_iterator2.f();
|
|
395
362
|
return _context4.finish(37);
|
|
396
363
|
case 40:
|
|
397
364
|
return _context4.abrupt("return", id);
|
|
@@ -414,28 +381,28 @@ var connect = exports.connect = function connect() {
|
|
|
414
381
|
return {
|
|
415
382
|
scheduler: "GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",
|
|
416
383
|
modules: modules,
|
|
417
|
-
accounts:
|
|
384
|
+
accounts: acc,
|
|
418
385
|
message: _message,
|
|
419
386
|
txs: function () {
|
|
420
387
|
var _txs2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(pid) {
|
|
421
|
-
var _txs,
|
|
388
|
+
var _txs, _iterator3, _step3, v;
|
|
422
389
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
423
390
|
while (1) switch (_context5.prev = _context5.next) {
|
|
424
391
|
case 0:
|
|
425
392
|
_txs = [];
|
|
426
|
-
|
|
393
|
+
_iterator3 = _createForOfIteratorHelper(env[pid].txs);
|
|
427
394
|
try {
|
|
428
|
-
for (
|
|
429
|
-
v =
|
|
395
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
396
|
+
v = _step3.value;
|
|
430
397
|
_txs.push({
|
|
431
398
|
tags: v.tags,
|
|
432
399
|
id: v.id
|
|
433
400
|
});
|
|
434
401
|
}
|
|
435
402
|
} catch (err) {
|
|
436
|
-
|
|
403
|
+
_iterator3.e(err);
|
|
437
404
|
} finally {
|
|
438
|
-
|
|
405
|
+
_iterator3.f();
|
|
439
406
|
}
|
|
440
407
|
return _context5.abrupt("return", _txs);
|
|
441
408
|
case 4:
|
|
@@ -459,12 +426,22 @@ var connect = exports.connect = function connect() {
|
|
|
459
426
|
handle,
|
|
460
427
|
_module,
|
|
461
428
|
ex,
|
|
462
|
-
|
|
463
|
-
|
|
429
|
+
_iterator4,
|
|
430
|
+
_step4,
|
|
464
431
|
v,
|
|
465
432
|
_yield$parse3,
|
|
466
433
|
id,
|
|
467
434
|
owner,
|
|
435
|
+
_tags,
|
|
436
|
+
res,
|
|
437
|
+
memory,
|
|
438
|
+
p,
|
|
439
|
+
_opt$data3,
|
|
440
|
+
_env$msgs$_tags$OnBo,
|
|
441
|
+
_env$msgs$_tags$OnBo2,
|
|
442
|
+
data,
|
|
443
|
+
msg,
|
|
444
|
+
_env,
|
|
468
445
|
_args6 = arguments;
|
|
469
446
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
470
447
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -512,16 +489,16 @@ var connect = exports.connect = function connect() {
|
|
|
512
489
|
_module = modmap[mod];
|
|
513
490
|
ex = false;
|
|
514
491
|
(_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : opt.tags = [];
|
|
515
|
-
|
|
492
|
+
_iterator4 = _createForOfIteratorHelper(opt.tags);
|
|
516
493
|
try {
|
|
517
|
-
for (
|
|
518
|
-
v =
|
|
494
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
495
|
+
v = _step4.value;
|
|
519
496
|
if (v.name === "Type") ex = true;
|
|
520
497
|
}
|
|
521
498
|
} catch (err) {
|
|
522
|
-
|
|
499
|
+
_iterator4.e(err);
|
|
523
500
|
} finally {
|
|
524
|
-
|
|
501
|
+
_iterator4.f();
|
|
525
502
|
}
|
|
526
503
|
if (!ex) opt.tags.push({
|
|
527
504
|
name: "Type",
|
|
@@ -533,22 +510,49 @@ var connect = exports.connect = function connect() {
|
|
|
533
510
|
_yield$parse3 = _context6.sent;
|
|
534
511
|
id = _yield$parse3.id;
|
|
535
512
|
owner = _yield$parse3.owner;
|
|
536
|
-
|
|
537
|
-
|
|
513
|
+
_tags = (0, _utils.tags)(opt.tags);
|
|
514
|
+
res = null;
|
|
515
|
+
memory = null;
|
|
516
|
+
p = {
|
|
538
517
|
id: id,
|
|
539
518
|
handle: _module.handle,
|
|
540
519
|
module: _module.id,
|
|
541
|
-
memory:
|
|
520
|
+
memory: memory,
|
|
542
521
|
owner: owner,
|
|
543
|
-
height:
|
|
544
|
-
res: {
|
|
545
|
-
id: null
|
|
546
|
-
},
|
|
522
|
+
height: 0,
|
|
523
|
+
res: _defineProperty({}, id, res),
|
|
547
524
|
results: [id],
|
|
548
525
|
txs: []
|
|
549
526
|
};
|
|
527
|
+
if (!_tags["On-Boot"]) {
|
|
528
|
+
_context6.next = 45;
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
data = "";
|
|
532
|
+
if (_tags["On-Boot"] === "Data") data = (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "";else data = (_env$msgs$_tags$OnBo = (_env$msgs$_tags$OnBo2 = env.msgs[_tags["On-Boot"]]) === null || _env$msgs$_tags$OnBo2 === void 0 ? void 0 : _env$msgs$_tags$OnBo2.data) !== null && _env$msgs$_tags$OnBo !== void 0 ? _env$msgs$_tags$OnBo : "";
|
|
533
|
+
msg = genMsg(p, data, opt.tags, owner, mu.addr, true);
|
|
534
|
+
_env = genEnv({
|
|
535
|
+
pid: p.id,
|
|
536
|
+
owner: p.owner,
|
|
537
|
+
module: p.module,
|
|
538
|
+
auth: mu.addr
|
|
539
|
+
});
|
|
540
|
+
_context6.next = 39;
|
|
541
|
+
return _module.handle(null, msg, _env);
|
|
542
|
+
case 39:
|
|
543
|
+
res = _context6.sent;
|
|
544
|
+
memory = res.Memory;
|
|
545
|
+
delete res.Memory;
|
|
546
|
+
p.res[id] = res;
|
|
547
|
+
_context6.next = 46;
|
|
548
|
+
break;
|
|
549
|
+
case 45:
|
|
550
|
+
p.height += 1;
|
|
551
|
+
case 46:
|
|
552
|
+
env.msgs[id] = opt;
|
|
553
|
+
env[id] = p;
|
|
550
554
|
return _context6.abrupt("return", id);
|
|
551
|
-
case
|
|
555
|
+
case 49:
|
|
552
556
|
case "end":
|
|
553
557
|
return _context6.stop();
|
|
554
558
|
}
|
|
@@ -561,7 +565,7 @@ var connect = exports.connect = function connect() {
|
|
|
561
565
|
}(),
|
|
562
566
|
assign: function () {
|
|
563
567
|
var _assign = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
|
|
564
|
-
var p, _opt, _yield$parse4, id, owner, _opt$
|
|
568
|
+
var p, _opt, _yield$parse4, id, owner, _opt$data4, _opt$from2, _res$Messages2, msg, _env, res, _iterator5, _step5, v;
|
|
565
569
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
566
570
|
while (1) switch (_context7.prev = _context7.next) {
|
|
567
571
|
case 0:
|
|
@@ -574,7 +578,7 @@ var connect = exports.connect = function connect() {
|
|
|
574
578
|
id = _yield$parse4.id;
|
|
575
579
|
owner = _yield$parse4.owner;
|
|
576
580
|
_context7.prev = 7;
|
|
577
|
-
msg = genMsg(p, (_opt$
|
|
581
|
+
msg = genMsg(p, (_opt$data4 = _opt.data) !== null && _opt$data4 !== void 0 ? _opt$data4 : "", _opt.tags, (_opt$from2 = _opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : owner, mu.addr);
|
|
578
582
|
_env = genEnv({
|
|
579
583
|
pid: p.id,
|
|
580
584
|
owner: p.owner,
|
|
@@ -593,15 +597,15 @@ var connect = exports.connect = function connect() {
|
|
|
593
597
|
id: id
|
|
594
598
|
}, _opt));
|
|
595
599
|
env.msgs[id] = _opt;
|
|
596
|
-
|
|
600
|
+
_iterator5 = _createForOfIteratorHelper((_res$Messages2 = res.Messages) !== null && _res$Messages2 !== void 0 ? _res$Messages2 : []);
|
|
597
601
|
_context7.prev = 20;
|
|
598
|
-
|
|
602
|
+
_iterator5.s();
|
|
599
603
|
case 22:
|
|
600
|
-
if ((
|
|
604
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
601
605
|
_context7.next = 29;
|
|
602
606
|
break;
|
|
603
607
|
}
|
|
604
|
-
v =
|
|
608
|
+
v = _step5.value;
|
|
605
609
|
if (!env[v.Target]) {
|
|
606
610
|
_context7.next = 27;
|
|
607
611
|
break;
|
|
@@ -623,10 +627,10 @@ var connect = exports.connect = function connect() {
|
|
|
623
627
|
case 31:
|
|
624
628
|
_context7.prev = 31;
|
|
625
629
|
_context7.t0 = _context7["catch"](20);
|
|
626
|
-
|
|
630
|
+
_iterator5.e(_context7.t0);
|
|
627
631
|
case 34:
|
|
628
632
|
_context7.prev = 34;
|
|
629
|
-
|
|
633
|
+
_iterator5.f();
|
|
630
634
|
return _context7.finish(34);
|
|
631
635
|
case 37:
|
|
632
636
|
return _context7.abrupt("return", id);
|
|
@@ -736,7 +740,7 @@ var connect = exports.connect = function connect() {
|
|
|
736
740
|
}(),
|
|
737
741
|
dryrun: function () {
|
|
738
742
|
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
|
|
739
|
-
var p, _yield$parse5, id, owner, _opt$
|
|
743
|
+
var p, _yield$parse5, id, owner, _opt$data5, msg, _env, res;
|
|
740
744
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
741
745
|
while (1) switch (_context10.prev = _context10.next) {
|
|
742
746
|
case 0:
|
|
@@ -748,7 +752,7 @@ var connect = exports.connect = function connect() {
|
|
|
748
752
|
id = _yield$parse5.id;
|
|
749
753
|
owner = _yield$parse5.owner;
|
|
750
754
|
_context10.prev = 6;
|
|
751
|
-
msg = genMsg(p, (_opt$
|
|
755
|
+
msg = genMsg(p, (_opt$data5 = opt.data) !== null && _opt$data5 !== void 0 ? _opt$data5 : "", opt.tags, owner, mu.addr, true);
|
|
752
756
|
_env = genEnv({
|
|
753
757
|
pid: p.id,
|
|
754
758
|
owner: p.owner,
|
package/cjs/ar.js
CHANGED
|
@@ -56,7 +56,7 @@ var AR = /*#__PURE__*/function () {
|
|
|
56
56
|
key: "init",
|
|
57
57
|
value: function () {
|
|
58
58
|
var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(jwk) {
|
|
59
|
-
var isGen, isWallet;
|
|
59
|
+
var isGen, _jwk, isWallet;
|
|
60
60
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
61
61
|
while (1) switch (_context.prev = _context.next) {
|
|
62
62
|
case 0:
|
|
@@ -67,59 +67,60 @@ var AR = /*#__PURE__*/function () {
|
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
69
|
isGen = true;
|
|
70
|
-
_context.next =
|
|
70
|
+
_context.next = 31;
|
|
71
71
|
break;
|
|
72
72
|
case 6:
|
|
73
|
+
jwk = _typeof((_jwk = jwk) === null || _jwk === void 0 ? void 0 : _jwk.jwk) === "object" ? jwk.jwk : jwk;
|
|
73
74
|
this.jwk = jwk;
|
|
74
75
|
isWallet = this.isArConnect(this.jwk);
|
|
75
76
|
if (!isWallet) {
|
|
76
|
-
_context.next =
|
|
77
|
+
_context.next = 27;
|
|
77
78
|
break;
|
|
78
79
|
}
|
|
79
|
-
_context.prev =
|
|
80
|
-
_context.next =
|
|
80
|
+
_context.prev = 10;
|
|
81
|
+
_context.next = 13;
|
|
81
82
|
return this.jwk.connect(["ACCESS_ADDRESS", "ACCESS_PUBLIC_KEY", "SIGN_TRANSACTION"]);
|
|
82
|
-
case
|
|
83
|
-
_context.next =
|
|
83
|
+
case 13:
|
|
84
|
+
_context.next = 15;
|
|
84
85
|
return this.jwk.getActiveAddress();
|
|
85
|
-
case
|
|
86
|
+
case 15:
|
|
86
87
|
this.addr = _context.sent;
|
|
87
|
-
_context.next =
|
|
88
|
+
_context.next = 18;
|
|
88
89
|
return this.jwk.getActivePublicKey();
|
|
89
|
-
case
|
|
90
|
+
case 18:
|
|
90
91
|
this.pub = _context.sent;
|
|
91
92
|
this.isWallet = true;
|
|
92
|
-
_context.next =
|
|
93
|
+
_context.next = 25;
|
|
93
94
|
break;
|
|
94
|
-
case
|
|
95
|
-
_context.prev =
|
|
96
|
-
_context.t0 = _context["catch"](
|
|
95
|
+
case 22:
|
|
96
|
+
_context.prev = 22;
|
|
97
|
+
_context.t0 = _context["catch"](10);
|
|
97
98
|
isGen = true;
|
|
98
|
-
case
|
|
99
|
-
_context.next =
|
|
99
|
+
case 25:
|
|
100
|
+
_context.next = 31;
|
|
100
101
|
break;
|
|
101
|
-
case
|
|
102
|
-
_context.next =
|
|
102
|
+
case 27:
|
|
103
|
+
_context.next = 29;
|
|
103
104
|
return this.toAddr(jwk);
|
|
104
|
-
case
|
|
105
|
+
case 29:
|
|
105
106
|
this.addr = _context.sent;
|
|
106
107
|
this.pub = jwk.n;
|
|
107
|
-
case
|
|
108
|
+
case 31:
|
|
108
109
|
if (!isGen) {
|
|
109
|
-
_context.next =
|
|
110
|
+
_context.next = 36;
|
|
110
111
|
break;
|
|
111
112
|
}
|
|
112
113
|
this.isWallet = false;
|
|
113
114
|
this.addr = this.pub = this.jwk = null;
|
|
114
|
-
_context.next =
|
|
115
|
+
_context.next = 36;
|
|
115
116
|
return this.gen("100");
|
|
116
|
-
case 35:
|
|
117
|
-
return _context.abrupt("return", this);
|
|
118
117
|
case 36:
|
|
118
|
+
return _context.abrupt("return", this);
|
|
119
|
+
case 37:
|
|
119
120
|
case "end":
|
|
120
121
|
return _context.stop();
|
|
121
122
|
}
|
|
122
|
-
}, _callee, this, [[
|
|
123
|
+
}, _callee, this, [[10, 22]]);
|
|
123
124
|
}));
|
|
124
125
|
function init(_x) {
|
|
125
126
|
return _init.apply(this, arguments);
|
|
@@ -152,6 +153,7 @@ var AR = /*#__PURE__*/function () {
|
|
|
152
153
|
var _checkWallet = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
153
154
|
var _ref2,
|
|
154
155
|
jwk,
|
|
156
|
+
start,
|
|
155
157
|
err,
|
|
156
158
|
addr,
|
|
157
159
|
pub,
|
|
@@ -164,104 +166,105 @@ var AR = /*#__PURE__*/function () {
|
|
|
164
166
|
while (1) switch (_context3.prev = _context3.next) {
|
|
165
167
|
case 0:
|
|
166
168
|
_ref2 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, jwk = _ref2.jwk;
|
|
169
|
+
start = Date.now();
|
|
167
170
|
if (!jwk) {
|
|
168
|
-
_context3.next =
|
|
171
|
+
_context3.next = 4;
|
|
169
172
|
break;
|
|
170
173
|
}
|
|
171
174
|
return _context3.abrupt("return", {
|
|
172
175
|
err: null,
|
|
173
176
|
jwk: jwk
|
|
174
177
|
});
|
|
175
|
-
case
|
|
178
|
+
case 4:
|
|
176
179
|
err = null, addr = null, pub = null;
|
|
177
180
|
existWallet = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && window.arweaveWallet;
|
|
178
181
|
isJwkWallet = this.isArConnect(this.jwk);
|
|
179
182
|
if (this.jwk) {
|
|
180
|
-
_context3.next =
|
|
183
|
+
_context3.next = 25;
|
|
181
184
|
break;
|
|
182
185
|
}
|
|
183
186
|
if (!this._jwk) {
|
|
184
|
-
_context3.next =
|
|
187
|
+
_context3.next = 16;
|
|
185
188
|
break;
|
|
186
189
|
}
|
|
187
190
|
jwk = this._jwk;
|
|
188
191
|
pub = this._jwk.n;
|
|
189
|
-
_context3.next =
|
|
192
|
+
_context3.next = 13;
|
|
190
193
|
return this.toAddr(jwk);
|
|
191
|
-
case
|
|
194
|
+
case 13:
|
|
192
195
|
addr = _context3.sent;
|
|
193
|
-
_context3.next =
|
|
196
|
+
_context3.next = 23;
|
|
194
197
|
break;
|
|
195
|
-
case
|
|
198
|
+
case 16:
|
|
196
199
|
;
|
|
197
|
-
_context3.next =
|
|
200
|
+
_context3.next = 19;
|
|
198
201
|
return this.gen("100", false);
|
|
199
|
-
case
|
|
202
|
+
case 19:
|
|
200
203
|
_yield$this$gen = _context3.sent;
|
|
201
204
|
jwk = _yield$this$gen.jwk;
|
|
202
205
|
addr = _yield$this$gen.addr;
|
|
203
206
|
pub = _yield$this$gen.pub;
|
|
204
|
-
case
|
|
205
|
-
_context3.next =
|
|
207
|
+
case 23:
|
|
208
|
+
_context3.next = 53;
|
|
206
209
|
break;
|
|
207
|
-
case
|
|
210
|
+
case 25:
|
|
208
211
|
if (!(this.jwk && !isJwkWallet)) {
|
|
209
|
-
_context3.next =
|
|
212
|
+
_context3.next = 31;
|
|
210
213
|
break;
|
|
211
214
|
}
|
|
212
215
|
jwk = this.jwk;
|
|
213
216
|
addr = this.addr;
|
|
214
217
|
pub = this.pub;
|
|
215
|
-
_context3.next =
|
|
218
|
+
_context3.next = 53;
|
|
216
219
|
break;
|
|
217
|
-
case
|
|
220
|
+
case 31:
|
|
218
221
|
if (!existWallet) {
|
|
219
|
-
_context3.next =
|
|
222
|
+
_context3.next = 52;
|
|
220
223
|
break;
|
|
221
224
|
}
|
|
222
|
-
_context3.next =
|
|
225
|
+
_context3.next = 34;
|
|
223
226
|
return arweaveWallet.connect(["ACCESS_ADDRESS", "ACCESS_PUBLIC_KEY", "SIGN_TRANSACTION"]);
|
|
224
|
-
case
|
|
225
|
-
_context3.next =
|
|
227
|
+
case 34:
|
|
228
|
+
_context3.next = 36;
|
|
226
229
|
return arweaveWallet.getActiveAddress();
|
|
227
|
-
case
|
|
230
|
+
case 36:
|
|
228
231
|
_addr = _context3.sent;
|
|
229
232
|
if (!_addr) {
|
|
230
|
-
_context3.next =
|
|
233
|
+
_context3.next = 49;
|
|
231
234
|
break;
|
|
232
235
|
}
|
|
233
236
|
if (!(this.addr && this.addr !== _addr)) {
|
|
234
|
-
_context3.next =
|
|
237
|
+
_context3.next = 42;
|
|
235
238
|
break;
|
|
236
239
|
}
|
|
237
240
|
err = "the wrong wallet";
|
|
238
|
-
_context3.next =
|
|
241
|
+
_context3.next = 47;
|
|
239
242
|
break;
|
|
240
|
-
case
|
|
243
|
+
case 42:
|
|
241
244
|
addr = _addr;
|
|
242
|
-
_context3.next =
|
|
245
|
+
_context3.next = 45;
|
|
243
246
|
return arweaveWallet.getActivePublicKey();
|
|
244
|
-
case
|
|
247
|
+
case 45:
|
|
245
248
|
pub = _context3.sent;
|
|
246
249
|
jwk = arweaveWallet;
|
|
247
|
-
case
|
|
248
|
-
_context3.next =
|
|
250
|
+
case 47:
|
|
251
|
+
_context3.next = 50;
|
|
249
252
|
break;
|
|
250
|
-
case 48:
|
|
251
|
-
err = "no wallet found";
|
|
252
253
|
case 49:
|
|
253
|
-
_context3.next = 52;
|
|
254
|
-
break;
|
|
255
|
-
case 51:
|
|
256
254
|
err = "no wallet found";
|
|
255
|
+
case 50:
|
|
256
|
+
_context3.next = 53;
|
|
257
|
+
break;
|
|
257
258
|
case 52:
|
|
259
|
+
err = "no wallet found";
|
|
260
|
+
case 53:
|
|
258
261
|
return _context3.abrupt("return", {
|
|
259
262
|
addr: addr,
|
|
260
263
|
jwk: jwk,
|
|
261
264
|
pub: pub,
|
|
262
265
|
err: err
|
|
263
266
|
});
|
|
264
|
-
case
|
|
267
|
+
case 54:
|
|
265
268
|
case "end":
|
|
266
269
|
return _context3.stop();
|
|
267
270
|
}
|
package/cjs/helpers.js
CHANGED
|
@@ -4,31 +4,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _tao["default"];
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "AR", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.AR;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.Src = void 0;
|
|
20
|
-
Object.defineProperty(exports, "connect", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function get() {
|
|
23
|
-
return _aoconnect3.connect;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
exports.setup = exports.ok = exports.fail = void 0;
|
|
27
|
-
var _aoconnect3 = require("./aoconnect.js");
|
|
7
|
+
exports.setup = exports.ok = exports.fail = exports.Src = void 0;
|
|
28
8
|
var _index = require("./index.js");
|
|
29
|
-
var _tao = _interopRequireDefault(require("./tao.js"));
|
|
30
9
|
var _assert = _interopRequireDefault(require("assert"));
|
|
31
|
-
var
|
|
10
|
+
var _aoconnect3 = require("@permaweb/aoconnect");
|
|
32
11
|
var _path = require("path");
|
|
33
12
|
var _fs = require("fs");
|
|
34
13
|
var _yargs = _interopRequireDefault(require("yargs"));
|
|
@@ -219,11 +198,11 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
219
198
|
dir: dir
|
|
220
199
|
});
|
|
221
200
|
_context3.next = 25;
|
|
222
|
-
return new
|
|
201
|
+
return new AO(opt.ao).init(opt.jwk);
|
|
223
202
|
case 25:
|
|
224
203
|
_ao = _context3.sent;
|
|
225
204
|
_context3.next = 28;
|
|
226
|
-
return new
|
|
205
|
+
return new AO(opt.ao2).init(opt.jwk);
|
|
227
206
|
case 28:
|
|
228
207
|
_ao2 = _context3.sent;
|
|
229
208
|
console.log("cache:\t", optPath);
|
|
@@ -281,7 +260,7 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
281
260
|
return src.upload("aos2_0_1", "wasm");
|
|
282
261
|
case 51:
|
|
283
262
|
wasm_aos2 = _context3.sent;
|
|
284
|
-
ao = new
|
|
263
|
+
ao = new AO({
|
|
285
264
|
aoconnect: aoconnect,
|
|
286
265
|
ar: ar,
|
|
287
266
|
authority: auth
|
|
@@ -345,7 +324,7 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
345
324
|
|
|
346
325
|
// ao2
|
|
347
326
|
_context3.next = 87;
|
|
348
|
-
return new
|
|
327
|
+
return new AO({
|
|
349
328
|
aoconnect: aoconnect,
|
|
350
329
|
ar: ar,
|
|
351
330
|
authority: auth,
|
package/cjs/test.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AO", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _tao["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "acc", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _aoconnect.acc;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "connect", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _aoconnect.connect;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "mu", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _aoconnect.mu;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _aoconnect = require("./aoconnect.js");
|
|
31
|
+
var _tao = _interopRequireDefault(require("./tao.js"));
|
|
32
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
package/esm/ao.js
CHANGED
|
@@ -601,7 +601,7 @@ class AO {
|
|
|
601
601
|
let exist = false
|
|
602
602
|
let err = null
|
|
603
603
|
while (attempts > 0) {
|
|
604
|
-
await wait(1000)
|
|
604
|
+
if (!this.in_memory) await wait(1000)
|
|
605
605
|
const { res, err: _err } = await this.dry({ pid, data: "#Inbox" })
|
|
606
606
|
if (typeof res?.Output === "object") break
|
|
607
607
|
attempts -= 1
|
package/esm/aoconnect.js
CHANGED
|
@@ -5,7 +5,7 @@ import { readFileSync } from "fs"
|
|
|
5
5
|
import { resolve } from "path"
|
|
6
6
|
import { is, clone, fromPairs, map, mergeLeft } from "ramda"
|
|
7
7
|
import accounts from "./accounts.js"
|
|
8
|
-
|
|
8
|
+
import { tags, action, tag, buildTags } from "./utils.js"
|
|
9
9
|
function isJSON(obj) {
|
|
10
10
|
if (obj === null || obj === undefined) return false
|
|
11
11
|
if (
|
|
@@ -35,19 +35,8 @@ const dirname = async () =>
|
|
|
35
35
|
? __dirname
|
|
36
36
|
: (await import("./dirname.js")).default
|
|
37
37
|
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const tag = (name, value) => ({ name, value: jsonToStr(value) })
|
|
41
|
-
|
|
42
|
-
const buildTags = (act, tags) => {
|
|
43
|
-
let _tags = []
|
|
44
|
-
if (act) _tags.push(action(act))
|
|
45
|
-
for (const k in tags) {
|
|
46
|
-
if (is(Array)(tags[k])) for (const v of tags[k]) _tags.push(tag(k, v))
|
|
47
|
-
else _tags.push(tag(k, tags[k]))
|
|
48
|
-
}
|
|
49
|
-
return _tags
|
|
50
|
-
}
|
|
38
|
+
export const acc = accounts.users
|
|
39
|
+
export const mu = accounts.mu
|
|
51
40
|
|
|
52
41
|
export const connect = () => {
|
|
53
42
|
let wasms = {
|
|
@@ -71,7 +60,6 @@ export const connect = () => {
|
|
|
71
60
|
}
|
|
72
61
|
let modmap = {}
|
|
73
62
|
let env = { msgs: {} }
|
|
74
|
-
let mu = accounts.mu
|
|
75
63
|
const transform = input => {
|
|
76
64
|
const output = { Tags: [] }
|
|
77
65
|
if (input.Data) output.Data = input.Data
|
|
@@ -208,7 +196,7 @@ export const connect = () => {
|
|
|
208
196
|
return {
|
|
209
197
|
scheduler: "GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",
|
|
210
198
|
modules,
|
|
211
|
-
accounts:
|
|
199
|
+
accounts: acc,
|
|
212
200
|
message,
|
|
213
201
|
txs: async pid => {
|
|
214
202
|
let _txs = []
|
|
@@ -234,18 +222,40 @@ export const connect = () => {
|
|
|
234
222
|
for (let v of opt.tags) if (v.name === "Type") ex = true
|
|
235
223
|
if (!ex) opt.tags.push({ name: "Type", value: "Process" })
|
|
236
224
|
const { id, owner } = await parse(opt)
|
|
237
|
-
|
|
238
|
-
|
|
225
|
+
const _tags = tags(opt.tags)
|
|
226
|
+
let res = null
|
|
227
|
+
let memory = null
|
|
228
|
+
let p = {
|
|
239
229
|
id: id,
|
|
240
230
|
handle: _module.handle,
|
|
241
231
|
module: _module.id,
|
|
242
|
-
memory
|
|
232
|
+
memory,
|
|
243
233
|
owner,
|
|
244
|
-
height:
|
|
245
|
-
res: { id:
|
|
234
|
+
height: 0,
|
|
235
|
+
res: { [id]: res },
|
|
246
236
|
results: [id],
|
|
247
237
|
txs: [],
|
|
248
238
|
}
|
|
239
|
+
if (_tags["On-Boot"]) {
|
|
240
|
+
let data = ""
|
|
241
|
+
if (_tags["On-Boot"] === "Data") data = opt.data ?? ""
|
|
242
|
+
else data = env.msgs[_tags["On-Boot"]]?.data ?? ""
|
|
243
|
+
const msg = genMsg(p, data, opt.tags, owner, mu.addr, true)
|
|
244
|
+
const _env = genEnv({
|
|
245
|
+
pid: p.id,
|
|
246
|
+
owner: p.owner,
|
|
247
|
+
module: p.module,
|
|
248
|
+
auth: mu.addr,
|
|
249
|
+
})
|
|
250
|
+
res = await _module.handle(null, msg, _env)
|
|
251
|
+
memory = res.Memory
|
|
252
|
+
delete res.Memory
|
|
253
|
+
p.res[id] = res
|
|
254
|
+
} else {
|
|
255
|
+
p.height += 1
|
|
256
|
+
}
|
|
257
|
+
env.msgs[id] = opt
|
|
258
|
+
env[id] = p
|
|
249
259
|
return id
|
|
250
260
|
},
|
|
251
261
|
assign: async opt => {
|
package/esm/ar.js
CHANGED
|
@@ -27,6 +27,7 @@ class AR {
|
|
|
27
27
|
if (!jwk && typeof window === "object") jwk = window.arweaveWallet
|
|
28
28
|
if (!jwk) isGen = true
|
|
29
29
|
else {
|
|
30
|
+
jwk = typeof jwk?.jwk === "object" ? jwk.jwk : jwk
|
|
30
31
|
this.jwk = jwk
|
|
31
32
|
const isWallet = this.isArConnect(this.jwk)
|
|
32
33
|
if (isWallet) {
|
|
@@ -60,6 +61,7 @@ class AR {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
async checkWallet({ jwk } = {}) {
|
|
64
|
+
let start = Date.now()
|
|
63
65
|
if (jwk) return { err: null, jwk }
|
|
64
66
|
let [err, addr, pub] = [null, null, null]
|
|
65
67
|
let existWallet = typeof window === "object" && window.arweaveWallet
|
package/esm/helpers.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { connect as tconnect } from "./aoconnect.js"
|
|
2
1
|
import { AR } from "./index.js"
|
|
3
|
-
import AO from "./tao.js"
|
|
4
2
|
import assert from "assert"
|
|
5
3
|
import { createDataItemSigner, connect } from "@permaweb/aoconnect"
|
|
6
4
|
import { dirname as _dirname, resolve } from "path"
|
|
@@ -110,6 +108,7 @@ export const setup = async ({
|
|
|
110
108
|
url: "http://su",
|
|
111
109
|
overwrite: true,
|
|
112
110
|
})
|
|
111
|
+
|
|
113
112
|
opt.ao = {
|
|
114
113
|
module: module_sqlite,
|
|
115
114
|
scheduler,
|
|
@@ -161,5 +160,3 @@ export const fail = obj => {
|
|
|
161
160
|
assert.notEqual(obj.err, null)
|
|
162
161
|
return obj
|
|
163
162
|
}
|
|
164
|
-
|
|
165
|
-
export { AO, AR, tconnect as connect }
|
package/esm/test.js
ADDED