wao 0.2.1 → 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 +123 -96
- package/cjs/ar.js +63 -60
- package/cjs/helpers.js +7 -28
- package/cjs/lua/aos.wasm +0 -0
- package/cjs/lua/sqlite.wasm +0 -0
- package/cjs/test.js +32 -0
- package/esm/ao.js +1 -1
- package/esm/aoconnect.js +44 -21
- package/esm/ar.js +2 -0
- package/esm/helpers.js +2 -5
- package/esm/lua/aos.wasm +0 -0
- package/esm/lua/sqlite.wasm +0 -0
- 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,56 +79,32 @@ 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": {
|
|
119
87
|
file: "aos2_0_1",
|
|
120
88
|
format: "wasm64-unknown-emscripten-draft_2024_02_15"
|
|
89
|
+
},
|
|
90
|
+
cNlipBptaF9JeFAf4wUmpi43EojNanIBos3EfNrEOWo: {
|
|
91
|
+
file: "aos_1",
|
|
92
|
+
format: "wasm64-unknown-emscripten-draft_2024_02_15"
|
|
93
|
+
},
|
|
94
|
+
ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw: {
|
|
95
|
+
file: "sqlite",
|
|
96
|
+
format: "wasm64-unknown-emscripten-draft_2024_02_15"
|
|
121
97
|
}
|
|
122
98
|
};
|
|
123
99
|
var modules = {
|
|
124
|
-
aos_2_0_1: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM"
|
|
100
|
+
aos_2_0_1: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
|
|
101
|
+
aos_1: "cNlipBptaF9JeFAf4wUmpi43EojNanIBos3EfNrEOWo",
|
|
102
|
+
sqlite: "ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw"
|
|
125
103
|
};
|
|
126
104
|
var modmap = {};
|
|
127
105
|
var env = {
|
|
128
106
|
msgs: {}
|
|
129
107
|
};
|
|
130
|
-
var mu = _accounts["default"].mu;
|
|
131
108
|
var transform = function transform(input) {
|
|
132
109
|
var _input$Tags;
|
|
133
110
|
var output = {
|
|
@@ -267,7 +244,7 @@ var connect = exports.connect = function connect() {
|
|
|
267
244
|
"Memory-Limit": "1-gb",
|
|
268
245
|
"Compute-Limit": "9000000000000"
|
|
269
246
|
});
|
|
270
|
-
_tags = buildTags(t);
|
|
247
|
+
_tags = (0, _utils.buildTags)(t);
|
|
271
248
|
_context3.next = 5;
|
|
272
249
|
return parse({
|
|
273
250
|
tags: _tags,
|
|
@@ -301,22 +278,22 @@ var connect = exports.connect = function connect() {
|
|
|
301
278
|
}();
|
|
302
279
|
var _message = /*#__PURE__*/function () {
|
|
303
280
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
|
|
304
|
-
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;
|
|
305
282
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
306
283
|
while (1) switch (_context4.prev = _context4.next) {
|
|
307
284
|
case 0:
|
|
308
285
|
p = env[opt.process];
|
|
309
286
|
ex = false;
|
|
310
|
-
|
|
287
|
+
_iterator = _createForOfIteratorHelper(opt.tags);
|
|
311
288
|
try {
|
|
312
|
-
for (
|
|
313
|
-
_v =
|
|
289
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
290
|
+
_v = _step.value;
|
|
314
291
|
if (_v.name === "Type") ex = true;
|
|
315
292
|
}
|
|
316
293
|
} catch (err) {
|
|
317
|
-
|
|
294
|
+
_iterator.e(err);
|
|
318
295
|
} finally {
|
|
319
|
-
|
|
296
|
+
_iterator.f();
|
|
320
297
|
}
|
|
321
298
|
if (!ex) opt.tags.push({
|
|
322
299
|
name: "Type",
|
|
@@ -348,15 +325,15 @@ var connect = exports.connect = function connect() {
|
|
|
348
325
|
id: id
|
|
349
326
|
}, opt));
|
|
350
327
|
env.msgs[id] = opt;
|
|
351
|
-
|
|
328
|
+
_iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
|
|
352
329
|
_context4.prev = 23;
|
|
353
|
-
|
|
330
|
+
_iterator2.s();
|
|
354
331
|
case 25:
|
|
355
|
-
if ((
|
|
332
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
356
333
|
_context4.next = 32;
|
|
357
334
|
break;
|
|
358
335
|
}
|
|
359
|
-
v =
|
|
336
|
+
v = _step2.value;
|
|
360
337
|
if (!env[v.Target]) {
|
|
361
338
|
_context4.next = 30;
|
|
362
339
|
break;
|
|
@@ -378,10 +355,10 @@ var connect = exports.connect = function connect() {
|
|
|
378
355
|
case 34:
|
|
379
356
|
_context4.prev = 34;
|
|
380
357
|
_context4.t0 = _context4["catch"](23);
|
|
381
|
-
|
|
358
|
+
_iterator2.e(_context4.t0);
|
|
382
359
|
case 37:
|
|
383
360
|
_context4.prev = 37;
|
|
384
|
-
|
|
361
|
+
_iterator2.f();
|
|
385
362
|
return _context4.finish(37);
|
|
386
363
|
case 40:
|
|
387
364
|
return _context4.abrupt("return", id);
|
|
@@ -402,29 +379,30 @@ var connect = exports.connect = function connect() {
|
|
|
402
379
|
};
|
|
403
380
|
}();
|
|
404
381
|
return {
|
|
382
|
+
scheduler: "GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",
|
|
405
383
|
modules: modules,
|
|
406
|
-
accounts:
|
|
384
|
+
accounts: acc,
|
|
407
385
|
message: _message,
|
|
408
386
|
txs: function () {
|
|
409
387
|
var _txs2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(pid) {
|
|
410
|
-
var _txs,
|
|
388
|
+
var _txs, _iterator3, _step3, v;
|
|
411
389
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
412
390
|
while (1) switch (_context5.prev = _context5.next) {
|
|
413
391
|
case 0:
|
|
414
392
|
_txs = [];
|
|
415
|
-
|
|
393
|
+
_iterator3 = _createForOfIteratorHelper(env[pid].txs);
|
|
416
394
|
try {
|
|
417
|
-
for (
|
|
418
|
-
v =
|
|
395
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
396
|
+
v = _step3.value;
|
|
419
397
|
_txs.push({
|
|
420
398
|
tags: v.tags,
|
|
421
399
|
id: v.id
|
|
422
400
|
});
|
|
423
401
|
}
|
|
424
402
|
} catch (err) {
|
|
425
|
-
|
|
403
|
+
_iterator3.e(err);
|
|
426
404
|
} finally {
|
|
427
|
-
|
|
405
|
+
_iterator3.f();
|
|
428
406
|
}
|
|
429
407
|
return _context5.abrupt("return", _txs);
|
|
430
408
|
case 4:
|
|
@@ -448,84 +426,133 @@ var connect = exports.connect = function connect() {
|
|
|
448
426
|
handle,
|
|
449
427
|
_module,
|
|
450
428
|
ex,
|
|
451
|
-
|
|
452
|
-
|
|
429
|
+
_iterator4,
|
|
430
|
+
_step4,
|
|
453
431
|
v,
|
|
454
432
|
_yield$parse3,
|
|
455
433
|
id,
|
|
456
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,
|
|
457
445
|
_args6 = arguments;
|
|
458
446
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
459
447
|
while (1) switch (_context6.prev = _context6.next) {
|
|
460
448
|
case 0:
|
|
461
449
|
opt = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
450
|
+
if (opt.module) {
|
|
451
|
+
_context6.next = 3;
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
throw Error("module.missing");
|
|
455
|
+
case 3:
|
|
456
|
+
if (opt.scheduler) {
|
|
457
|
+
_context6.next = 5;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
throw Error("scheduler.missing");
|
|
461
|
+
case 5:
|
|
462
462
|
mod = (_opt$module = opt.module) !== null && _opt$module !== void 0 ? _opt$module : modules["aos_2_0_1"];
|
|
463
463
|
if (!(!modmap[mod] && wasms[mod])) {
|
|
464
|
-
_context6.next =
|
|
464
|
+
_context6.next = 15;
|
|
465
465
|
break;
|
|
466
466
|
}
|
|
467
|
-
_context6.next =
|
|
467
|
+
_context6.next = 9;
|
|
468
468
|
return dirname();
|
|
469
|
-
case
|
|
469
|
+
case 9:
|
|
470
470
|
_dirname = _context6.sent;
|
|
471
471
|
wasm = (0, _fs.readFileSync)((0, _path.resolve)(_dirname, "lua/".concat(wasms[mod].file, ".wasm")));
|
|
472
|
-
_context6.next =
|
|
472
|
+
_context6.next = 13;
|
|
473
473
|
return (0, _aoLoader["default"])(wasm, {
|
|
474
474
|
format: wasms[mod].format
|
|
475
475
|
});
|
|
476
|
-
case
|
|
476
|
+
case 13:
|
|
477
477
|
handle = _context6.sent;
|
|
478
478
|
modmap[mod] = {
|
|
479
479
|
handle: handle,
|
|
480
480
|
id: mod
|
|
481
481
|
};
|
|
482
|
-
case
|
|
482
|
+
case 15:
|
|
483
483
|
if (mod) {
|
|
484
|
-
_context6.next =
|
|
484
|
+
_context6.next = 17;
|
|
485
485
|
break;
|
|
486
486
|
}
|
|
487
487
|
throw Error("module not found");
|
|
488
|
-
case
|
|
488
|
+
case 17:
|
|
489
489
|
_module = modmap[mod];
|
|
490
490
|
ex = false;
|
|
491
491
|
(_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : opt.tags = [];
|
|
492
|
-
|
|
492
|
+
_iterator4 = _createForOfIteratorHelper(opt.tags);
|
|
493
493
|
try {
|
|
494
|
-
for (
|
|
495
|
-
v =
|
|
494
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
495
|
+
v = _step4.value;
|
|
496
496
|
if (v.name === "Type") ex = true;
|
|
497
497
|
}
|
|
498
498
|
} catch (err) {
|
|
499
|
-
|
|
499
|
+
_iterator4.e(err);
|
|
500
500
|
} finally {
|
|
501
|
-
|
|
501
|
+
_iterator4.f();
|
|
502
502
|
}
|
|
503
503
|
if (!ex) opt.tags.push({
|
|
504
504
|
name: "Type",
|
|
505
505
|
value: "Process"
|
|
506
506
|
});
|
|
507
|
-
_context6.next =
|
|
507
|
+
_context6.next = 25;
|
|
508
508
|
return parse(opt);
|
|
509
|
-
case
|
|
509
|
+
case 25:
|
|
510
510
|
_yield$parse3 = _context6.sent;
|
|
511
511
|
id = _yield$parse3.id;
|
|
512
512
|
owner = _yield$parse3.owner;
|
|
513
|
-
|
|
514
|
-
|
|
513
|
+
_tags = (0, _utils.tags)(opt.tags);
|
|
514
|
+
res = null;
|
|
515
|
+
memory = null;
|
|
516
|
+
p = {
|
|
515
517
|
id: id,
|
|
516
518
|
handle: _module.handle,
|
|
517
519
|
module: _module.id,
|
|
518
|
-
memory:
|
|
520
|
+
memory: memory,
|
|
519
521
|
owner: owner,
|
|
520
|
-
height:
|
|
521
|
-
res: {
|
|
522
|
-
id: null
|
|
523
|
-
},
|
|
522
|
+
height: 0,
|
|
523
|
+
res: _defineProperty({}, id, res),
|
|
524
524
|
results: [id],
|
|
525
525
|
txs: []
|
|
526
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;
|
|
527
554
|
return _context6.abrupt("return", id);
|
|
528
|
-
case
|
|
555
|
+
case 49:
|
|
529
556
|
case "end":
|
|
530
557
|
return _context6.stop();
|
|
531
558
|
}
|
|
@@ -538,7 +565,7 @@ var connect = exports.connect = function connect() {
|
|
|
538
565
|
}(),
|
|
539
566
|
assign: function () {
|
|
540
567
|
var _assign = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
|
|
541
|
-
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;
|
|
542
569
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
543
570
|
while (1) switch (_context7.prev = _context7.next) {
|
|
544
571
|
case 0:
|
|
@@ -551,7 +578,7 @@ var connect = exports.connect = function connect() {
|
|
|
551
578
|
id = _yield$parse4.id;
|
|
552
579
|
owner = _yield$parse4.owner;
|
|
553
580
|
_context7.prev = 7;
|
|
554
|
-
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);
|
|
555
582
|
_env = genEnv({
|
|
556
583
|
pid: p.id,
|
|
557
584
|
owner: p.owner,
|
|
@@ -570,15 +597,15 @@ var connect = exports.connect = function connect() {
|
|
|
570
597
|
id: id
|
|
571
598
|
}, _opt));
|
|
572
599
|
env.msgs[id] = _opt;
|
|
573
|
-
|
|
600
|
+
_iterator5 = _createForOfIteratorHelper((_res$Messages2 = res.Messages) !== null && _res$Messages2 !== void 0 ? _res$Messages2 : []);
|
|
574
601
|
_context7.prev = 20;
|
|
575
|
-
|
|
602
|
+
_iterator5.s();
|
|
576
603
|
case 22:
|
|
577
|
-
if ((
|
|
604
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
578
605
|
_context7.next = 29;
|
|
579
606
|
break;
|
|
580
607
|
}
|
|
581
|
-
v =
|
|
608
|
+
v = _step5.value;
|
|
582
609
|
if (!env[v.Target]) {
|
|
583
610
|
_context7.next = 27;
|
|
584
611
|
break;
|
|
@@ -600,10 +627,10 @@ var connect = exports.connect = function connect() {
|
|
|
600
627
|
case 31:
|
|
601
628
|
_context7.prev = 31;
|
|
602
629
|
_context7.t0 = _context7["catch"](20);
|
|
603
|
-
|
|
630
|
+
_iterator5.e(_context7.t0);
|
|
604
631
|
case 34:
|
|
605
632
|
_context7.prev = 34;
|
|
606
|
-
|
|
633
|
+
_iterator5.f();
|
|
607
634
|
return _context7.finish(34);
|
|
608
635
|
case 37:
|
|
609
636
|
return _context7.abrupt("return", id);
|
|
@@ -713,7 +740,7 @@ var connect = exports.connect = function connect() {
|
|
|
713
740
|
}(),
|
|
714
741
|
dryrun: function () {
|
|
715
742
|
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
|
|
716
|
-
var p, _yield$parse5, id, owner, _opt$
|
|
743
|
+
var p, _yield$parse5, id, owner, _opt$data5, msg, _env, res;
|
|
717
744
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
718
745
|
while (1) switch (_context10.prev = _context10.next) {
|
|
719
746
|
case 0:
|
|
@@ -725,7 +752,7 @@ var connect = exports.connect = function connect() {
|
|
|
725
752
|
id = _yield$parse5.id;
|
|
726
753
|
owner = _yield$parse5.owner;
|
|
727
754
|
_context10.prev = 6;
|
|
728
|
-
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);
|
|
729
756
|
_env = genEnv({
|
|
730
757
|
pid: p.id,
|
|
731
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);
|
|
@@ -270,7 +249,7 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
270
249
|
auth = _context3.sent.address;
|
|
271
250
|
case 43:
|
|
272
251
|
_context3.next = 45;
|
|
273
|
-
return src.upload("
|
|
252
|
+
return src.upload("sqlite", "wasm");
|
|
274
253
|
case 45:
|
|
275
254
|
wasm = _context3.sent;
|
|
276
255
|
_context3.next = 48;
|
|
@@ -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/lua/aos.wasm
ADDED
|
Binary file
|
|
Binary file
|
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 = {
|
|
@@ -55,13 +44,22 @@ export const connect = () => {
|
|
|
55
44
|
file: "aos2_0_1",
|
|
56
45
|
format: "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
57
46
|
},
|
|
47
|
+
cNlipBptaF9JeFAf4wUmpi43EojNanIBos3EfNrEOWo: {
|
|
48
|
+
file: "aos_1",
|
|
49
|
+
format: "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
50
|
+
},
|
|
51
|
+
ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw: {
|
|
52
|
+
file: "sqlite",
|
|
53
|
+
format: "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
54
|
+
},
|
|
58
55
|
}
|
|
59
56
|
let modules = {
|
|
60
57
|
aos_2_0_1: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
|
|
58
|
+
aos_1: "cNlipBptaF9JeFAf4wUmpi43EojNanIBos3EfNrEOWo",
|
|
59
|
+
sqlite: "ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw",
|
|
61
60
|
}
|
|
62
61
|
let modmap = {}
|
|
63
62
|
let env = { msgs: {} }
|
|
64
|
-
let mu = accounts.mu
|
|
65
63
|
const transform = input => {
|
|
66
64
|
const output = { Tags: [] }
|
|
67
65
|
if (input.Data) output.Data = input.Data
|
|
@@ -196,8 +194,9 @@ export const connect = () => {
|
|
|
196
194
|
}
|
|
197
195
|
|
|
198
196
|
return {
|
|
197
|
+
scheduler: "GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",
|
|
199
198
|
modules,
|
|
200
|
-
accounts:
|
|
199
|
+
accounts: acc,
|
|
201
200
|
message,
|
|
202
201
|
txs: async pid => {
|
|
203
202
|
let _txs = []
|
|
@@ -205,6 +204,8 @@ export const connect = () => {
|
|
|
205
204
|
return _txs
|
|
206
205
|
},
|
|
207
206
|
spawn: async (opt = {}) => {
|
|
207
|
+
if (!opt.module) throw Error("module.missing")
|
|
208
|
+
if (!opt.scheduler) throw Error("scheduler.missing")
|
|
208
209
|
let mod = opt.module ?? modules["aos_2_0_1"]
|
|
209
210
|
if (!modmap[mod] && wasms[mod]) {
|
|
210
211
|
const __dirname = await dirname()
|
|
@@ -221,18 +222,40 @@ export const connect = () => {
|
|
|
221
222
|
for (let v of opt.tags) if (v.name === "Type") ex = true
|
|
222
223
|
if (!ex) opt.tags.push({ name: "Type", value: "Process" })
|
|
223
224
|
const { id, owner } = await parse(opt)
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
const _tags = tags(opt.tags)
|
|
226
|
+
let res = null
|
|
227
|
+
let memory = null
|
|
228
|
+
let p = {
|
|
226
229
|
id: id,
|
|
227
230
|
handle: _module.handle,
|
|
228
231
|
module: _module.id,
|
|
229
|
-
memory
|
|
232
|
+
memory,
|
|
230
233
|
owner,
|
|
231
|
-
height:
|
|
232
|
-
res: { id:
|
|
234
|
+
height: 0,
|
|
235
|
+
res: { [id]: res },
|
|
233
236
|
results: [id],
|
|
234
237
|
txs: [],
|
|
235
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
|
|
236
259
|
return id
|
|
237
260
|
},
|
|
238
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"
|
|
@@ -87,7 +85,7 @@ export const setup = async ({
|
|
|
87
85
|
}
|
|
88
86
|
|
|
89
87
|
// ao
|
|
90
|
-
const wasm = await src.upload("
|
|
88
|
+
const wasm = await src.upload("sqlite", "wasm")
|
|
91
89
|
const wasm2 = await src.upload("aos", "wasm")
|
|
92
90
|
const wasm_aos2 = await src.upload("aos2_0_1", "wasm")
|
|
93
91
|
|
|
@@ -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/lua/aos.wasm
ADDED
|
Binary file
|
|
Binary file
|
package/esm/test.js
ADDED