wao 0.4.6 → 0.4.7

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/aoconnect.js CHANGED
@@ -20,11 +20,11 @@ var _tar = _interopRequireDefault(require("./tar.js"));
20
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
21
21
  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; }
22
22
  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; }
23
+ 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; }
23
24
  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; }
24
25
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
25
26
  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); }
26
27
  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; } } }; }
27
- 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
28
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
29
29
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
30
30
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -126,70 +126,9 @@ var connect = exports.connect = function connect(mem) {
126
126
  }
127
127
  };
128
128
  };
129
- var postModule = /*#__PURE__*/function () {
130
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
131
- var data, _ref4$tags, tags, signer, t, _tags, _yield$ar$dataitem, id, owner, handle;
132
- return _regeneratorRuntime().wrap(function _callee$(_context) {
133
- while (1) switch (_context.prev = _context.next) {
134
- case 0:
135
- data = _ref4.data, _ref4$tags = _ref4.tags, tags = _ref4$tags === void 0 ? {} : _ref4$tags, signer = _ref4.signer;
136
- t = (0, _ramda.mergeLeft)(tags, {
137
- "Data-Protocol": "ao",
138
- Variant: "ao.TN.1",
139
- Type: "Module",
140
- "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
141
- "Input-Encoding": "JSON-V1",
142
- "Output-Encoding": "JSON-V1",
143
- "Memory-Limit": "1-gb",
144
- "Compute-Limit": "9000000000000"
145
- });
146
- _tags = (0, _utils.buildTags)(null, t);
147
- _context.next = 5;
148
- return ar.dataitem({
149
- tags: _tags,
150
- data: data,
151
- signer: signer
152
- });
153
- case 5:
154
- _yield$ar$dataitem = _context.sent;
155
- id = _yield$ar$dataitem.id;
156
- owner = _yield$ar$dataitem.owner;
157
- _context.next = 10;
158
- return ar.post({
159
- data: data,
160
- signer: signer,
161
- tags: t
162
- });
163
- case 10:
164
- _context.next = 12;
165
- return (0, _aoLoader["default"])(data, {
166
- format: t["Module-Format"],
167
- mode: "test",
168
- WeaveDrive: WeaveDrive
169
- });
170
- case 12:
171
- handle = _context.sent;
172
- // test me
173
- mem.modmap[id] = {
174
- handle: handle,
175
- id: id,
176
- data: data,
177
- format: t["Module-Format"]
178
- };
179
- return _context.abrupt("return", id);
180
- case 15:
181
- case "end":
182
- return _context.stop();
183
- }
184
- }, _callee);
185
- }));
186
- return function postModule(_x) {
187
- return _ref5.apply(this, arguments);
188
- };
189
- }();
190
129
  var spawn = /*#__PURE__*/function () {
191
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
192
- var _opt$module, _opt$tags, _opt$tags2;
130
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
131
+ var _opt$module, _mem$wasms$mod$data, _opt$tags, _opt$tags2;
193
132
  var opt,
194
133
  mod,
195
134
  _module,
@@ -200,7 +139,7 @@ var connect = exports.connect = function connect(mem) {
200
139
  _iterator,
201
140
  _step,
202
141
  v,
203
- _yield$ar$dataitem2,
142
+ _yield$ar$dataitem,
204
143
  id,
205
144
  owner,
206
145
  item,
@@ -222,44 +161,44 @@ var connect = exports.connect = function connect(mem) {
222
161
  _int,
223
162
  cronTags,
224
163
  k,
225
- _args2 = arguments;
226
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
227
- while (1) switch (_context2.prev = _context2.next) {
164
+ _args = arguments;
165
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
166
+ while (1) switch (_context.prev = _context.next) {
228
167
  case 0:
229
- opt = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
168
+ opt = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
230
169
  if (opt.module) {
231
- _context2.next = 3;
170
+ _context.next = 3;
232
171
  break;
233
172
  }
234
173
  throw Error("module missing");
235
174
  case 3:
236
175
  if (opt.scheduler) {
237
- _context2.next = 5;
176
+ _context.next = 5;
238
177
  break;
239
178
  }
240
179
  throw Error("scheduler missing");
241
180
  case 5:
242
181
  mod = (_opt$module = opt.module) !== null && _opt$module !== void 0 ? _opt$module : mem.modules["aos2_0_1"];
243
182
  _module = null;
244
- _context2.next = 9;
183
+ _context.next = 9;
245
184
  return (0, _utils.dirname)();
246
185
  case 9:
247
- __dirname = _context2.sent;
248
- wasm = (0, _fs.readFileSync)((0, _path.resolve)(__dirname, "lua/".concat(mem.wasms[mod].file, ".wasm")));
249
- _context2.next = 13;
186
+ __dirname = _context.sent;
187
+ wasm = (_mem$wasms$mod$data = mem.wasms[mod].data) !== null && _mem$wasms$mod$data !== void 0 ? _mem$wasms$mod$data : (0, _fs.readFileSync)((0, _path.resolve)(__dirname, "lua/".concat(mem.wasms[mod].file, ".wasm")));
188
+ _context.next = 13;
250
189
  return (0, _aoLoader["default"])(wasm, {
251
190
  format: mem.wasms[mod].format,
252
191
  mode: "test",
253
192
  WeaveDrive: WeaveDrive
254
193
  });
255
194
  case 13:
256
- handle = _context2.sent;
195
+ handle = _context.sent;
257
196
  _module = {
258
197
  handle: handle,
259
198
  id: mod
260
199
  };
261
200
  if (mod) {
262
- _context2.next = 17;
201
+ _context.next = 17;
263
202
  break;
264
203
  }
265
204
  throw Error("module not found");
@@ -290,18 +229,18 @@ var connect = exports.connect = function connect(mem) {
290
229
  name: "Type",
291
230
  value: "Process"
292
231
  });
293
- _context2.next = 25;
232
+ _context.next = 25;
294
233
  return ar.dataitem({
295
234
  data: opt.data,
296
235
  signer: opt.signer,
297
236
  tags: (0, _utils.tags)(opt.tags)
298
237
  });
299
238
  case 25:
300
- _yield$ar$dataitem2 = _context2.sent;
301
- id = _yield$ar$dataitem2.id;
302
- owner = _yield$ar$dataitem2.owner;
303
- item = _yield$ar$dataitem2.item;
304
- _context2.next = 31;
239
+ _yield$ar$dataitem = _context.sent;
240
+ id = _yield$ar$dataitem.id;
241
+ owner = _yield$ar$dataitem.owner;
242
+ item = _yield$ar$dataitem.item;
243
+ _context.next = 31;
305
244
  return ar.postItem(item, _test.su.jwk);
306
245
  case 31:
307
246
  _tags = (0, _utils.tags)(opt.tags);
@@ -322,7 +261,7 @@ var connect = exports.connect = function connect(mem) {
322
261
  opt: opt
323
262
  };
324
263
  if (!_tags["On-Boot"]) {
325
- _context2.next = 49;
264
+ _context.next = 49;
326
265
  break;
327
266
  }
328
267
  data = "";
@@ -335,14 +274,14 @@ var connect = exports.connect = function connect(mem) {
335
274
  auth: _test.mu.addr
336
275
  });
337
276
  _t = (0, _utils.tags)(msg.Tags);
338
- _context2.next = 43;
277
+ _context.next = 43;
339
278
  return _module.handle(null, msg, _env);
340
279
  case 43:
341
- res = _context2.sent;
280
+ res = _context.sent;
342
281
  p.memory = res.Memory;
343
282
  delete res.Memory;
344
283
  p.res[id] = res;
345
- _context2.next = 50;
284
+ _context.next = 50;
346
285
  break;
347
286
  case 49:
348
287
  p.height += 1;
@@ -350,35 +289,35 @@ var connect = exports.connect = function connect(mem) {
350
289
  mem.msgs[id] = opt;
351
290
  mem.env[id] = p;
352
291
  if (!_tags["Cron-Interval"]) {
353
- _context2.next = 76;
292
+ _context.next = 76;
354
293
  break;
355
294
  }
356
295
  _tags$CronInterval$s = _tags["Cron-Interval"].split("-"), _tags$CronInterval$s2 = _slicedToArray(_tags$CronInterval$s, 2), num = _tags$CronInterval$s2[0], unit = _tags$CronInterval$s2[1];
357
296
  _int = 0;
358
- _context2.t0 = unit.replace(/s$/, "");
359
- _context2.next = _context2.t0 === "millisecond" ? 58 : _context2.t0 === "second" ? 60 : _context2.t0 === "minute" ? 62 : _context2.t0 === "hour" ? 64 : _context2.t0 === "day" ? 66 : _context2.t0 === "month" ? 68 : _context2.t0 === "year" ? 70 : 72;
297
+ _context.t0 = unit.replace(/s$/, "");
298
+ _context.next = _context.t0 === "millisecond" ? 58 : _context.t0 === "second" ? 60 : _context.t0 === "minute" ? 62 : _context.t0 === "hour" ? 64 : _context.t0 === "day" ? 66 : _context.t0 === "month" ? 68 : _context.t0 === "year" ? 70 : 72;
360
299
  break;
361
300
  case 58:
362
301
  _int = num;
363
- return _context2.abrupt("break", 72);
302
+ return _context.abrupt("break", 72);
364
303
  case 60:
365
304
  _int = num * 1000;
366
- return _context2.abrupt("break", 72);
305
+ return _context.abrupt("break", 72);
367
306
  case 62:
368
307
  _int = num * 1000 * 60;
369
- return _context2.abrupt("break", 72);
308
+ return _context.abrupt("break", 72);
370
309
  case 64:
371
310
  _int = num * 1000 * 60 * 60;
372
- return _context2.abrupt("break", 72);
311
+ return _context.abrupt("break", 72);
373
312
  case 66:
374
313
  _int = num * 1000 * 60 * 60 * 24;
375
- return _context2.abrupt("break", 72);
314
+ return _context.abrupt("break", 72);
376
315
  case 68:
377
316
  _int = num * 1000 * 60 * 60 * 24 * 30;
378
- return _context2.abrupt("break", 72);
317
+ return _context.abrupt("break", 72);
379
318
  case 70:
380
319
  _int = num * 1000 * 60 * 60 * 24 * 365;
381
- return _context2.abrupt("break", 72);
320
+ return _context.abrupt("break", 72);
382
321
  case 72:
383
322
  cronTags = [];
384
323
  for (k in _tags) {
@@ -392,15 +331,15 @@ var connect = exports.connect = function connect(mem) {
392
331
  mem.env[id].cronTags = cronTags;
393
332
  mem.env[id].span = _int;
394
333
  case 76:
395
- return _context2.abrupt("return", id);
334
+ return _context.abrupt("return", id);
396
335
  case 77:
397
336
  case "end":
398
- return _context2.stop();
337
+ return _context.stop();
399
338
  }
400
- }, _callee2);
339
+ }, _callee);
401
340
  }));
402
341
  return function spawn() {
403
- return _ref6.apply(this, arguments);
342
+ return _ref4.apply(this, arguments);
404
343
  };
405
344
  }();
406
345
  function genHashChain(previousHash) {
@@ -413,11 +352,11 @@ var connect = exports.connect = function connect(mem) {
413
352
  return (0, _base64url["default"])(hasher.digest());
414
353
  }
415
354
  var _assign = /*#__PURE__*/function () {
416
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opt) {
355
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(opt) {
417
356
  var _opt$tags3;
418
- var p, _opt, hash, _yield$ar$dataitem3, id, owner, item, _opt$data2, _ref8, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, msg, _env, res, _iterator2, _step2, v, _iterator3, _step3, _v, _tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
419
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
420
- while (1) switch (_context3.prev = _context3.next) {
357
+ var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref6, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, msg, _env, res, _iterator2, _step2, v, _iterator3, _step3, _v, _tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
358
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
359
+ while (1) switch (_context2.prev = _context2.next) {
421
360
  case 0:
422
361
  p = mem.env[opt.process];
423
362
  _opt = mem.msgs[opt.message];
@@ -437,7 +376,7 @@ var connect = exports.connect = function connect(mem) {
437
376
  "Hash-Chain": hash
438
377
  }));
439
378
  p.epochs.push([opt.message]);
440
- _context3.next = 8;
379
+ _context2.next = 8;
441
380
  return ar.dataitem({
442
381
  data: opt.data,
443
382
  signer: opt.signer,
@@ -445,25 +384,25 @@ var connect = exports.connect = function connect(mem) {
445
384
  target: opt.process
446
385
  });
447
386
  case 8:
448
- _yield$ar$dataitem3 = _context3.sent;
449
- id = _yield$ar$dataitem3.id;
450
- owner = _yield$ar$dataitem3.owner;
451
- item = _yield$ar$dataitem3.item;
452
- _context3.next = 14;
387
+ _yield$ar$dataitem2 = _context2.sent;
388
+ id = _yield$ar$dataitem2.id;
389
+ owner = _yield$ar$dataitem2.owner;
390
+ item = _yield$ar$dataitem2.item;
391
+ _context2.next = 14;
453
392
  return ar.postItem(item, _test.su.jwk);
454
393
  case 14:
455
- _context3.prev = 14;
456
- msg = genMsg(opt.message, p, (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "", _opt.tags, (_ref8 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref8 !== void 0 ? _ref8 : owner, _test.mu.addr);
394
+ _context2.prev = 14;
395
+ msg = genMsg(opt.message, p, (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "", _opt.tags, (_ref6 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref6 !== void 0 ? _ref6 : owner, _test.mu.addr);
457
396
  _env = genEnv({
458
397
  pid: p.id,
459
398
  owner: p.owner,
460
399
  module: p.module,
461
400
  auth: _test.mu.addr
462
401
  });
463
- _context3.next = 19;
402
+ _context2.next = 19;
464
403
  return p.handle(p.memory, msg, _env);
465
404
  case 19:
466
- res = _context3.sent;
405
+ res = _context2.sent;
467
406
  p.memory = res.Memory;
468
407
  delete res.Memory;
469
408
  p.res[opt.message] = res;
@@ -473,19 +412,19 @@ var connect = exports.connect = function connect(mem) {
473
412
  }, opt));
474
413
  mem.msgs[opt.message] = _opt;
475
414
  _iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
476
- _context3.prev = 27;
415
+ _context2.prev = 27;
477
416
  _iterator2.s();
478
417
  case 29:
479
418
  if ((_step2 = _iterator2.n()).done) {
480
- _context3.next = 36;
419
+ _context2.next = 36;
481
420
  break;
482
421
  }
483
422
  v = _step2.value;
484
423
  if (!mem.env[v.Target]) {
485
- _context3.next = 34;
424
+ _context2.next = 34;
486
425
  break;
487
426
  }
488
- _context3.next = 34;
427
+ _context2.next = 34;
489
428
  return message({
490
429
  process: v.Target,
491
430
  tags: v.Tags,
@@ -494,31 +433,31 @@ var connect = exports.connect = function connect(mem) {
494
433
  from: opt.process
495
434
  });
496
435
  case 34:
497
- _context3.next = 29;
436
+ _context2.next = 29;
498
437
  break;
499
438
  case 36:
500
- _context3.next = 41;
439
+ _context2.next = 41;
501
440
  break;
502
441
  case 38:
503
- _context3.prev = 38;
504
- _context3.t0 = _context3["catch"](27);
505
- _iterator2.e(_context3.t0);
442
+ _context2.prev = 38;
443
+ _context2.t0 = _context2["catch"](27);
444
+ _iterator2.e(_context2.t0);
506
445
  case 41:
507
- _context3.prev = 41;
446
+ _context2.prev = 41;
508
447
  _iterator2.f();
509
- return _context3.finish(41);
448
+ return _context2.finish(41);
510
449
  case 44:
511
450
  _iterator3 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
512
- _context3.prev = 45;
451
+ _context2.prev = 45;
513
452
  _iterator3.s();
514
453
  case 47:
515
454
  if ((_step3 = _iterator3.n()).done) {
516
- _context3.next = 54;
455
+ _context2.next = 54;
517
456
  break;
518
457
  }
519
458
  _v = _step3.value;
520
459
  _tags = (0, _utils.tags)(_v.Tags);
521
- _context3.next = 52;
460
+ _context2.next = 52;
522
461
  return spawn({
523
462
  module: _tags.Module,
524
463
  scheduler: _test.scheduler,
@@ -528,39 +467,39 @@ var connect = exports.connect = function connect(mem) {
528
467
  signer: _test.mu.signer
529
468
  });
530
469
  case 52:
531
- _context3.next = 47;
470
+ _context2.next = 47;
532
471
  break;
533
472
  case 54:
534
- _context3.next = 59;
473
+ _context2.next = 59;
535
474
  break;
536
475
  case 56:
537
- _context3.prev = 56;
538
- _context3.t1 = _context3["catch"](45);
539
- _iterator3.e(_context3.t1);
476
+ _context2.prev = 56;
477
+ _context2.t1 = _context2["catch"](45);
478
+ _iterator3.e(_context2.t1);
540
479
  case 59:
541
- _context3.prev = 59;
480
+ _context2.prev = 59;
542
481
  _iterator3.f();
543
- return _context3.finish(59);
482
+ return _context2.finish(59);
544
483
  case 62:
545
484
  _iterator4 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
546
- _context3.prev = 63;
485
+ _context2.prev = 63;
547
486
  _iterator4.s();
548
487
  case 65:
549
488
  if ((_step4 = _iterator4.n()).done) {
550
- _context3.next = 86;
489
+ _context2.next = 86;
551
490
  break;
552
491
  }
553
492
  _v2 = _step4.value;
554
493
  _iterator5 = _createForOfIteratorHelper(_v2.Processes);
555
- _context3.prev = 68;
494
+ _context2.prev = 68;
556
495
  _iterator5.s();
557
496
  case 70:
558
497
  if ((_step5 = _iterator5.n()).done) {
559
- _context3.next = 76;
498
+ _context2.next = 76;
560
499
  break;
561
500
  }
562
501
  v2 = _step5.value;
563
- _context3.next = 74;
502
+ _context2.next = 74;
564
503
  return _assign({
565
504
  message: _v2.Message,
566
505
  process: v2,
@@ -568,57 +507,57 @@ var connect = exports.connect = function connect(mem) {
568
507
  signer: _test.mu.signer
569
508
  });
570
509
  case 74:
571
- _context3.next = 70;
510
+ _context2.next = 70;
572
511
  break;
573
512
  case 76:
574
- _context3.next = 81;
513
+ _context2.next = 81;
575
514
  break;
576
515
  case 78:
577
- _context3.prev = 78;
578
- _context3.t2 = _context3["catch"](68);
579
- _iterator5.e(_context3.t2);
516
+ _context2.prev = 78;
517
+ _context2.t2 = _context2["catch"](68);
518
+ _iterator5.e(_context2.t2);
580
519
  case 81:
581
- _context3.prev = 81;
520
+ _context2.prev = 81;
582
521
  _iterator5.f();
583
- return _context3.finish(81);
522
+ return _context2.finish(81);
584
523
  case 84:
585
- _context3.next = 65;
524
+ _context2.next = 65;
586
525
  break;
587
526
  case 86:
588
- _context3.next = 91;
527
+ _context2.next = 91;
589
528
  break;
590
529
  case 88:
591
- _context3.prev = 88;
592
- _context3.t3 = _context3["catch"](63);
593
- _iterator4.e(_context3.t3);
530
+ _context2.prev = 88;
531
+ _context2.t3 = _context2["catch"](63);
532
+ _iterator4.e(_context2.t3);
594
533
  case 91:
595
- _context3.prev = 91;
534
+ _context2.prev = 91;
596
535
  _iterator4.f();
597
- return _context3.finish(91);
536
+ return _context2.finish(91);
598
537
  case 94:
599
- return _context3.abrupt("return", id);
538
+ return _context2.abrupt("return", id);
600
539
  case 97:
601
- _context3.prev = 97;
602
- _context3.t4 = _context3["catch"](14);
603
- console.log(_context3.t4);
540
+ _context2.prev = 97;
541
+ _context2.t4 = _context2["catch"](14);
542
+ console.log(_context2.t4);
604
543
  case 100:
605
- return _context3.abrupt("return", null);
544
+ return _context2.abrupt("return", null);
606
545
  case 101:
607
546
  case "end":
608
- return _context3.stop();
547
+ return _context2.stop();
609
548
  }
610
- }, _callee3, null, [[14, 97], [27, 38, 41, 44], [45, 56, 59, 62], [63, 88, 91, 94], [68, 78, 81, 84]]);
549
+ }, _callee2, null, [[14, 97], [27, 38, 41, 44], [45, 56, 59, 62], [63, 88, 91, 94], [68, 78, 81, 84]]);
611
550
  }));
612
- return function assign(_x2) {
613
- return _ref7.apply(this, arguments);
551
+ return function assign(_x) {
552
+ return _ref5.apply(this, arguments);
614
553
  };
615
554
  }();
616
555
  var message = /*#__PURE__*/function () {
617
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
556
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opt) {
618
557
  var _opt$tags4;
619
- var p, ex, _iterator6, _step6, v, _yield$ar$dataitem4, item, id, owner;
620
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
621
- while (1) switch (_context4.prev = _context4.next) {
558
+ var p, ex, _iterator6, _step6, v, _yield$ar$dataitem3, item, id, owner;
559
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
560
+ while (1) switch (_context3.prev = _context3.next) {
622
561
  case 0:
623
562
  p = mem.env[opt.process];
624
563
  ex = false;
@@ -639,7 +578,7 @@ var connect = exports.connect = function connect(mem) {
639
578
  Type: "Message",
640
579
  SDK: "aoconnect"
641
580
  }));
642
- _context4.next = 7;
581
+ _context3.next = 7;
643
582
  return ar.dataitem({
644
583
  data: opt.data,
645
584
  signer: opt.signer,
@@ -647,15 +586,15 @@ var connect = exports.connect = function connect(mem) {
647
586
  target: opt.process
648
587
  });
649
588
  case 7:
650
- _yield$ar$dataitem4 = _context4.sent;
651
- item = _yield$ar$dataitem4.item;
652
- id = _yield$ar$dataitem4.id;
653
- owner = _yield$ar$dataitem4.owner;
654
- _context4.next = 13;
589
+ _yield$ar$dataitem3 = _context3.sent;
590
+ item = _yield$ar$dataitem3.item;
591
+ id = _yield$ar$dataitem3.id;
592
+ owner = _yield$ar$dataitem3.owner;
593
+ _context3.next = 13;
655
594
  return ar.postItem(item, _test.su.jwk);
656
595
  case 13:
657
596
  mem.msgs[id] = opt;
658
- _context4.next = 16;
597
+ _context3.next = 16;
659
598
  return _assign({
660
599
  message: id,
661
600
  process: opt.process,
@@ -663,24 +602,24 @@ var connect = exports.connect = function connect(mem) {
663
602
  signer: _test.mu.signer
664
603
  });
665
604
  case 16:
666
- return _context4.abrupt("return", id);
605
+ return _context3.abrupt("return", id);
667
606
  case 17:
668
607
  case "end":
669
- return _context4.stop();
608
+ return _context3.stop();
670
609
  }
671
- }, _callee4);
610
+ }, _callee3);
672
611
  }));
673
- return function message(_x3) {
674
- return _ref9.apply(this, arguments);
612
+ return function message(_x2) {
613
+ return _ref7.apply(this, arguments);
675
614
  };
676
615
  }();
677
616
  return {
678
617
  message: message,
679
618
  unmonitor: function () {
680
- var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
619
+ var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
681
620
  var p;
682
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
683
- while (1) switch (_context5.prev = _context5.next) {
621
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
622
+ while (1) switch (_context4.prev = _context4.next) {
684
623
  case 0:
685
624
  p = mem.env[opt.process];
686
625
  try {
@@ -689,28 +628,28 @@ var connect = exports.connect = function connect(mem) {
689
628
  } catch (e) {}
690
629
  case 2:
691
630
  case "end":
692
- return _context5.stop();
631
+ return _context4.stop();
693
632
  }
694
- }, _callee5);
633
+ }, _callee4);
695
634
  }));
696
- function unmonitor(_x4) {
635
+ function unmonitor(_x3) {
697
636
  return _unmonitor.apply(this, arguments);
698
637
  }
699
638
  return unmonitor;
700
639
  }(),
701
640
  monitor: function () {
702
- var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
641
+ var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
703
642
  var p;
704
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
705
- while (1) switch (_context7.prev = _context7.next) {
643
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
644
+ while (1) switch (_context6.prev = _context6.next) {
706
645
  case 0:
707
646
  p = mem.env[opt.process];
708
647
  if ((0, _ramda.isNil)(p.cron)) {
709
- p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
710
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
711
- while (1) switch (_context6.prev = _context6.next) {
648
+ p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
649
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
650
+ while (1) switch (_context5.prev = _context5.next) {
712
651
  case 0:
713
- _context6.next = 2;
652
+ _context5.next = 2;
714
653
  return message({
715
654
  tags: p.cronTags,
716
655
  process: opt.process,
@@ -719,18 +658,18 @@ var connect = exports.connect = function connect(mem) {
719
658
  });
720
659
  case 2:
721
660
  case "end":
722
- return _context6.stop();
661
+ return _context5.stop();
723
662
  }
724
- }, _callee6);
663
+ }, _callee5);
725
664
  })), p.span);
726
665
  }
727
666
  case 2:
728
667
  case "end":
729
- return _context7.stop();
668
+ return _context6.stop();
730
669
  }
731
- }, _callee7);
670
+ }, _callee6);
732
671
  }));
733
- function monitor(_x5) {
672
+ function monitor(_x4) {
734
673
  return _monitor.apply(this, arguments);
735
674
  }
736
675
  return monitor;
@@ -738,40 +677,40 @@ var connect = exports.connect = function connect(mem) {
738
677
  spawn: spawn,
739
678
  assign: _assign,
740
679
  result: function () {
741
- var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
742
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
743
- while (1) switch (_context8.prev = _context8.next) {
680
+ var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
681
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
682
+ while (1) switch (_context7.prev = _context7.next) {
744
683
  case 0:
745
- return _context8.abrupt("return", mem.env[opt.process].res[opt.message]);
684
+ return _context7.abrupt("return", mem.env[opt.process].res[opt.message]);
746
685
  case 1:
747
686
  case "end":
748
- return _context8.stop();
687
+ return _context7.stop();
749
688
  }
750
- }, _callee8);
689
+ }, _callee7);
751
690
  }));
752
- function result(_x6) {
691
+ function result(_x5) {
753
692
  return _result.apply(this, arguments);
754
693
  }
755
694
  return result;
756
695
  }(),
757
696
  results: function () {
758
- var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
697
+ var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
759
698
  var _opt$limit;
760
699
  var p, results, limit, i, _i;
761
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
762
- while (1) switch (_context9.prev = _context9.next) {
700
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
701
+ while (1) switch (_context8.prev = _context8.next) {
763
702
  case 0:
764
703
  p = mem.env[opt.process];
765
704
  results = [];
766
705
  limit = (_opt$limit = opt.limit) !== null && _opt$limit !== void 0 ? _opt$limit : 25;
767
706
  if (!(opt.sort === "DESC")) {
768
- _context9.next = 14;
707
+ _context8.next = 14;
769
708
  break;
770
709
  }
771
710
  i = p.results.length - 1;
772
711
  case 5:
773
712
  if (!(0 < i)) {
774
- _context9.next = 12;
713
+ _context8.next = 12;
775
714
  break;
776
715
  }
777
716
  results.push({
@@ -779,67 +718,67 @@ var connect = exports.connect = function connect(mem) {
779
718
  node: p.res[p.results[i]]
780
719
  });
781
720
  if (!(results.length >= limit)) {
782
- _context9.next = 9;
721
+ _context8.next = 9;
783
722
  break;
784
723
  }
785
- return _context9.abrupt("break", 12);
724
+ return _context8.abrupt("break", 12);
786
725
  case 9:
787
726
  i--;
788
- _context9.next = 5;
727
+ _context8.next = 5;
789
728
  break;
790
729
  case 12:
791
- _context9.next = 22;
730
+ _context8.next = 22;
792
731
  break;
793
732
  case 14:
794
733
  _i = 0;
795
734
  case 15:
796
735
  if (!(_i < p.results.length)) {
797
- _context9.next = 22;
736
+ _context8.next = 22;
798
737
  break;
799
738
  }
800
739
  results.push({
801
740
  node: p.res[p.results[_i]]
802
741
  });
803
742
  if (!(results.length >= limit)) {
804
- _context9.next = 19;
743
+ _context8.next = 19;
805
744
  break;
806
745
  }
807
- return _context9.abrupt("break", 22);
746
+ return _context8.abrupt("break", 22);
808
747
  case 19:
809
748
  _i++;
810
- _context9.next = 15;
749
+ _context8.next = 15;
811
750
  break;
812
751
  case 22:
813
- return _context9.abrupt("return", {
752
+ return _context8.abrupt("return", {
814
753
  edges: results
815
754
  });
816
755
  case 23:
817
756
  case "end":
818
- return _context9.stop();
757
+ return _context8.stop();
819
758
  }
820
- }, _callee9);
759
+ }, _callee8);
821
760
  }));
822
- function results(_x7) {
761
+ function results(_x6) {
823
762
  return _results.apply(this, arguments);
824
763
  }
825
764
  return results;
826
765
  }(),
827
766
  dryrun: function () {
828
- var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
829
- var p, _yield$ar$dataitem5, id, owner, _opt$data3, msg, _env, res;
830
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
831
- while (1) switch (_context10.prev = _context10.next) {
767
+ var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
768
+ var p, _yield$ar$dataitem4, id, owner, _opt$data3, msg, _env, res;
769
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
770
+ while (1) switch (_context9.prev = _context9.next) {
832
771
  case 0:
833
772
  p = mem.env[opt.process];
834
- _context10.next = 3;
773
+ _context9.next = 3;
835
774
  return ar.dataitem(_objectSpread(_objectSpread({}, opt), {}, {
836
775
  target: opt.process
837
776
  }));
838
777
  case 3:
839
- _yield$ar$dataitem5 = _context10.sent;
840
- id = _yield$ar$dataitem5.id;
841
- owner = _yield$ar$dataitem5.owner;
842
- _context10.prev = 6;
778
+ _yield$ar$dataitem4 = _context9.sent;
779
+ id = _yield$ar$dataitem4.id;
780
+ owner = _yield$ar$dataitem4.owner;
781
+ _context9.prev = 6;
843
782
  msg = genMsg(id, p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, _test.mu.addr, true);
844
783
  _env = genEnv({
845
784
  pid: p.id,
@@ -847,24 +786,24 @@ var connect = exports.connect = function connect(mem) {
847
786
  module: p.module,
848
787
  auth: _test.mu.addr
849
788
  });
850
- _context10.next = 11;
789
+ _context9.next = 11;
851
790
  return p.handle(p.memory, msg, _env);
852
791
  case 11:
853
- res = _context10.sent;
854
- return _context10.abrupt("return", res);
792
+ res = _context9.sent;
793
+ return _context9.abrupt("return", res);
855
794
  case 15:
856
- _context10.prev = 15;
857
- _context10.t0 = _context10["catch"](6);
858
- console.log(_context10.t0);
795
+ _context9.prev = 15;
796
+ _context9.t0 = _context9["catch"](6);
797
+ console.log(_context9.t0);
859
798
  case 18:
860
- return _context10.abrupt("return", null);
799
+ return _context9.abrupt("return", null);
861
800
  case 19:
862
801
  case "end":
863
- return _context10.stop();
802
+ return _context9.stop();
864
803
  }
865
- }, _callee10, null, [[6, 15]]);
804
+ }, _callee9, null, [[6, 15]]);
866
805
  }));
867
- function dryrun(_x8) {
806
+ function dryrun(_x7) {
868
807
  return _dryrun.apply(this, arguments);
869
808
  }
870
809
  return dryrun;
package/cjs/tao.js CHANGED
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports["default"] = void 0;
8
8
  var _ao = _interopRequireDefault(require("./ao.js"));
9
+ var _aoconnect = require("@permaweb/aoconnect");
9
10
  var _utils = require("./utils.js");
10
11
  var _tar = _interopRequireDefault(require("./tar.js"));
11
- var _aoconnect = require("./aoconnect.js");
12
+ var _aoconnect2 = require("./aoconnect.js");
12
13
  var _test = require("./test.js");
14
+ var _ramda = require("ramda");
13
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
14
16
  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; }
15
17
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
@@ -38,7 +40,7 @@ var AO = /*#__PURE__*/function (_MAO) {
38
40
  in_memory: true
39
41
  })]);
40
42
  _this.in_memory = true;
41
- var _connect = (0, _aoconnect.connect)(opt.mem),
43
+ var _connect = (0, _aoconnect2.connect)(opt.mem),
42
44
  modules = _connect.modules,
43
45
  results = _connect.results,
44
46
  assign = _connect.assign,
@@ -58,6 +60,7 @@ var AO = /*#__PURE__*/function (_MAO) {
58
60
  _this.dryrun = dryrun;
59
61
  _this.monitor = monitor;
60
62
  _this.unmonitor = unmonitor;
63
+ _this.mem = mem;
61
64
  _this.ar = new _tar["default"]({
62
65
  mem: mem
63
66
  });
@@ -87,6 +90,77 @@ var AO = /*#__PURE__*/function (_MAO) {
87
90
  }
88
91
  return init;
89
92
  }()
93
+ }, {
94
+ key: "postModule",
95
+ value: function () {
96
+ var _postModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
97
+ var data, _ref$tags, tags, jwk, err, _yield$this$ar$checkW, t, _tags, signer, _yield$this$ar$datait, id, owner;
98
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
99
+ while (1) switch (_context2.prev = _context2.next) {
100
+ case 0:
101
+ data = _ref.data, _ref$tags = _ref.tags, tags = _ref$tags === void 0 ? {} : _ref$tags, jwk = _ref.jwk;
102
+ err = null;
103
+ _context2.next = 4;
104
+ return this.ar.checkWallet({
105
+ jwk: jwk
106
+ });
107
+ case 4:
108
+ _yield$this$ar$checkW = _context2.sent;
109
+ jwk = _yield$this$ar$checkW.jwk;
110
+ err = _yield$this$ar$checkW.err;
111
+ if (!err) {
112
+ _context2.next = 9;
113
+ break;
114
+ }
115
+ return _context2.abrupt("return", {
116
+ err: err
117
+ });
118
+ case 9:
119
+ t = (0, _ramda.mergeLeft)(tags, {
120
+ "Data-Protocol": "ao",
121
+ Variant: "ao.TN.1",
122
+ Type: "Module",
123
+ "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
124
+ "Input-Encoding": "JSON-V1",
125
+ "Output-Encoding": "JSON-V1",
126
+ "Memory-Limit": "1-gb",
127
+ "Compute-Limit": "9000000000000"
128
+ });
129
+ _tags = (0, _utils.buildTags)(null, t);
130
+ signer = (0, _aoconnect.createDataItemSigner)(jwk);
131
+ _context2.next = 14;
132
+ return this.ar.dataitem({
133
+ tags: _tags,
134
+ data: data,
135
+ signer: signer
136
+ });
137
+ case 14:
138
+ _yield$this$ar$datait = _context2.sent;
139
+ id = _yield$this$ar$datait.id;
140
+ owner = _yield$this$ar$datait.owner;
141
+ _context2.next = 19;
142
+ return this.ar.post({
143
+ data: data,
144
+ tags: t,
145
+ jwk: jwk
146
+ });
147
+ case 19:
148
+ this.mem.wasms[id] = {
149
+ data: data,
150
+ format: t["Module-Format"]
151
+ };
152
+ return _context2.abrupt("return", id);
153
+ case 21:
154
+ case "end":
155
+ return _context2.stop();
156
+ }
157
+ }, _callee2, this);
158
+ }));
159
+ function postModule(_x2) {
160
+ return _postModule.apply(this, arguments);
161
+ }
162
+ return postModule;
163
+ }()
90
164
  }]);
91
165
  }(_ao["default"]);
92
166
  var _default = exports["default"] = AO;
package/esm/aoconnect.js CHANGED
@@ -83,40 +83,15 @@ export const connect = mem => {
83
83
  }
84
84
  }
85
85
 
86
- const postModule = async ({ data, tags = {}, signer }) => {
87
- const t = mergeLeft(tags, {
88
- "Data-Protocol": "ao",
89
- Variant: "ao.TN.1",
90
- Type: "Module",
91
- "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
92
- "Input-Encoding": "JSON-V1",
93
- "Output-Encoding": "JSON-V1",
94
- "Memory-Limit": "1-gb",
95
- "Compute-Limit": "9000000000000",
96
- })
97
- const _tags = buildTags(null, t)
98
- const { id, owner } = await ar.dataitem({ tags: _tags, data, signer })
99
- await ar.post({ data, signer, tags: t })
100
- const handle = await AoLoader(data, {
101
- format: t["Module-Format"],
102
- mode: "test",
103
- WeaveDrive,
104
- })
105
-
106
- // test me
107
- mem.modmap[id] = { handle, id, data, format: t["Module-Format"] }
108
- return id
109
- }
110
-
111
86
  const spawn = async (opt = {}) => {
112
87
  if (!opt.module) throw Error("module missing")
113
88
  if (!opt.scheduler) throw Error("scheduler missing")
114
89
  let mod = opt.module ?? mem.modules["aos2_0_1"]
115
90
  let _module = null
116
91
  const __dirname = await dirname()
117
- const wasm = readFileSync(
118
- resolve(__dirname, `lua/${mem.wasms[mod].file}.wasm`),
119
- )
92
+ const wasm =
93
+ mem.wasms[mod].data ??
94
+ readFileSync(resolve(__dirname, `lua/${mem.wasms[mod].file}.wasm`))
120
95
  const handle = await AoLoader(wasm, {
121
96
  format: mem.wasms[mod].format,
122
97
  mode: "test",
package/esm/tao.js CHANGED
@@ -1,8 +1,11 @@
1
1
  import MAO from "./ao.js"
2
- import { srcs } from "./utils.js"
2
+ import { createDataItemSigner } from "@permaweb/aoconnect"
3
+ import { srcs, buildTags } from "./utils.js"
3
4
  import AR from "./tar.js"
4
5
  import { connect } from "./aoconnect.js"
5
6
  import { acc } from "./test.js"
7
+ import { mergeLeft } from "ramda"
8
+
6
9
  class AO extends MAO {
7
10
  constructor(opt = {}) {
8
11
  super({ ...opt, in_memory: true })
@@ -28,6 +31,7 @@ class AO extends MAO {
28
31
  this.dryrun = dryrun
29
32
  this.monitor = monitor
30
33
  this.unmonitor = unmonitor
34
+ this.mem = mem
31
35
  this.ar = new AR({ mem })
32
36
  }
33
37
 
@@ -36,6 +40,29 @@ class AO extends MAO {
36
40
  await this.ar.init(jwk)
37
41
  return this
38
42
  }
43
+
44
+ async postModule({ data, tags = {}, jwk }) {
45
+ let err = null
46
+ ;({ jwk, err } = await this.ar.checkWallet({ jwk }))
47
+ if (err) return { err }
48
+ const t = mergeLeft(tags, {
49
+ "Data-Protocol": "ao",
50
+ Variant: "ao.TN.1",
51
+ Type: "Module",
52
+ "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
53
+ "Input-Encoding": "JSON-V1",
54
+ "Output-Encoding": "JSON-V1",
55
+ "Memory-Limit": "1-gb",
56
+ "Compute-Limit": "9000000000000",
57
+ })
58
+
59
+ const _tags = buildTags(null, t)
60
+ const signer = createDataItemSigner(jwk)
61
+ const { id, owner } = await this.ar.dataitem({ tags: _tags, data, signer })
62
+ await this.ar.post({ data, tags: t, jwk })
63
+ this.mem.wasms[id] = { data, format: t["Module-Format"] }
64
+ return id
65
+ }
39
66
  }
40
67
 
41
68
  export default AO
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",