wao 0.9.2 → 0.10.2
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 +31 -32
- package/cjs/aoconnect-base.js +197 -175
- package/cjs/armem-base.js +300 -116
- package/cjs/armem-web.js +11 -1
- package/cjs/armem.js +8 -1
- package/cjs/{ar-base.js → bar.js} +29 -30
- package/cjs/build.js +8 -0
- package/cjs/compress.js +165 -0
- package/cjs/server.js +66 -46
- package/cjs/tar.js +2 -2
- package/cjs/tgql.js +81 -78
- package/cjs/waosm/waosm.js +332 -0
- package/cjs/waosm-node/waosm.js +21 -0
- package/cjs/waosm-node/waosm_bg.js +193 -0
- package/cjs/waosm-node.js +28 -0
- package/cjs/war.js +2 -2
- package/esm/ao.js +7 -7
- package/esm/aoconnect-base.js +25 -24
- package/esm/armem-base.js +91 -11
- package/esm/armem-web.js +2 -1
- package/esm/armem.js +2 -1
- package/esm/{ar-base.js → bar.js} +9 -15
- package/esm/build.js +7 -0
- package/esm/compress.js +113 -0
- package/esm/lfdb.js +1 -3
- package/esm/server.js +5 -5
- package/esm/tar.js +1 -1
- package/esm/tgql.js +2 -2
- package/esm/waosm/README.md +79 -0
- package/esm/waosm/package.json +14 -0
- package/esm/waosm/waosm.d.ts +46 -0
- package/esm/waosm/waosm.js +264 -0
- package/esm/waosm/waosm_bg.wasm +0 -0
- package/esm/waosm/waosm_bg.wasm.d.ts +10 -0
- package/esm/waosm-node/README.md +79 -0
- package/esm/waosm-node/waosm.d.ts +12 -0
- package/esm/waosm-node/waosm.js +4 -0
- package/esm/waosm-node/waosm_bg.js +171 -0
- package/esm/waosm-node/waosm_bg.wasm +0 -0
- package/esm/waosm-node/waosm_bg.wasm.d.ts +10 -0
- package/esm/waosm-node.js +13 -0
- package/esm/war.js +1 -1
- package/package.json +4 -1
package/cjs/armem-base.js
CHANGED
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _arweave = _interopRequireDefault(require("arweave"));
|
|
9
|
+
var _arbundles = require("arbundles");
|
|
10
|
+
var _compress = require("./compress.js");
|
|
9
11
|
var _ramda = require("ramda");
|
|
10
12
|
var _utils = require("./utils.js");
|
|
13
|
+
var _base64url = _interopRequireDefault(require("base64url"));
|
|
11
14
|
var _Arweave$default;
|
|
12
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
16
|
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; } } }; }
|
|
@@ -31,9 +34,15 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
31
34
|
SU_URL = _ref.SU_URL,
|
|
32
35
|
GATEWAY_URL = _ref.GATEWAY_URL,
|
|
33
36
|
scheduler = _ref.scheduler,
|
|
34
|
-
cache = _ref.cache
|
|
37
|
+
cache = _ref.cache,
|
|
38
|
+
init = _ref.init,
|
|
39
|
+
Compressor = _ref.Compressor,
|
|
40
|
+
Decompressor = _ref.Decompressor;
|
|
35
41
|
_classCallCheck(this, ArMemBase);
|
|
36
42
|
this.__type__ = "mem";
|
|
43
|
+
this._init = init;
|
|
44
|
+
this.Compressor = Compressor;
|
|
45
|
+
this.Decompressor = Decompressor;
|
|
37
46
|
this.isInit = false;
|
|
38
47
|
this.keyInit = false;
|
|
39
48
|
this.keys = {};
|
|
@@ -48,6 +57,32 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
48
57
|
this.SU_URL = SU_URL;
|
|
49
58
|
}
|
|
50
59
|
return _createClass(ArMemBase, [{
|
|
60
|
+
key: "owner",
|
|
61
|
+
value: function () {
|
|
62
|
+
var _owner = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(di) {
|
|
63
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
64
|
+
while (1) switch (_context.prev = _context.next) {
|
|
65
|
+
case 0:
|
|
66
|
+
_context.t0 = _base64url["default"];
|
|
67
|
+
_context.t1 = Buffer;
|
|
68
|
+
_context.next = 4;
|
|
69
|
+
return crypto.subtle.digest("SHA-256", di.rawOwner);
|
|
70
|
+
case 4:
|
|
71
|
+
_context.t2 = _context.sent;
|
|
72
|
+
_context.t3 = _context.t1.from.call(_context.t1, _context.t2);
|
|
73
|
+
return _context.abrupt("return", _context.t0.encode.call(_context.t0, _context.t3));
|
|
74
|
+
case 7:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context.stop();
|
|
77
|
+
}
|
|
78
|
+
}, _callee);
|
|
79
|
+
}));
|
|
80
|
+
function owner(_x) {
|
|
81
|
+
return _owner.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
return owner;
|
|
84
|
+
}()
|
|
85
|
+
}, {
|
|
51
86
|
key: "getAnchor",
|
|
52
87
|
value: function getAnchor() {
|
|
53
88
|
return this.blocks.length === 0 ? "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM" : (0, _ramda.last)(this.blockmap[(0, _ramda.last)(this.blocks)].txs);
|
|
@@ -55,28 +90,28 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
55
90
|
}, {
|
|
56
91
|
key: "get",
|
|
57
92
|
value: function () {
|
|
58
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
93
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, field) {
|
|
59
94
|
var _this$key;
|
|
60
|
-
return _regeneratorRuntime().wrap(function
|
|
61
|
-
while (1) switch (
|
|
95
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
96
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
62
97
|
case 0:
|
|
63
|
-
|
|
98
|
+
_context2.next = 2;
|
|
64
99
|
return this.init();
|
|
65
100
|
case 2:
|
|
66
101
|
if (field) {
|
|
67
|
-
|
|
102
|
+
_context2.next = 4;
|
|
68
103
|
break;
|
|
69
104
|
}
|
|
70
|
-
return
|
|
105
|
+
return _context2.abrupt("return", this[key]);
|
|
71
106
|
case 4:
|
|
72
|
-
return
|
|
107
|
+
return _context2.abrupt("return", (_this$key = this[key]) === null || _this$key === void 0 ? void 0 : _this$key[field]);
|
|
73
108
|
case 5:
|
|
74
109
|
case "end":
|
|
75
|
-
return
|
|
110
|
+
return _context2.stop();
|
|
76
111
|
}
|
|
77
|
-
},
|
|
112
|
+
}, _callee2, this);
|
|
78
113
|
}));
|
|
79
|
-
function get(
|
|
114
|
+
function get(_x2, _x3) {
|
|
80
115
|
return _get.apply(this, arguments);
|
|
81
116
|
}
|
|
82
117
|
return get;
|
|
@@ -84,44 +119,60 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
84
119
|
}, {
|
|
85
120
|
key: "set",
|
|
86
121
|
value: function () {
|
|
87
|
-
var _set = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
88
|
-
var _this$key2;
|
|
89
|
-
return _regeneratorRuntime().wrap(function
|
|
90
|
-
while (1) switch (
|
|
122
|
+
var _set = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val, key, field) {
|
|
123
|
+
var _this$key2, memory;
|
|
124
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
125
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
91
126
|
case 0:
|
|
92
|
-
|
|
127
|
+
_context3.next = 2;
|
|
93
128
|
return this.init();
|
|
94
129
|
case 2:
|
|
95
130
|
if (field) {
|
|
96
|
-
|
|
131
|
+
_context3.next = 9;
|
|
97
132
|
break;
|
|
98
133
|
}
|
|
99
134
|
this[key] = val;
|
|
100
135
|
if (!this.db) {
|
|
101
|
-
|
|
136
|
+
_context3.next = 7;
|
|
102
137
|
break;
|
|
103
138
|
}
|
|
104
|
-
|
|
139
|
+
_context3.next = 7;
|
|
105
140
|
return this.db.put("".concat(key), this[key]);
|
|
106
141
|
case 7:
|
|
107
|
-
|
|
142
|
+
_context3.next = 21;
|
|
108
143
|
break;
|
|
109
144
|
case 9:
|
|
110
145
|
(_this$key2 = this[key]) !== null && _this$key2 !== void 0 ? _this$key2 : this[key] = {};
|
|
111
146
|
this[key][field] = val;
|
|
112
147
|
if (!this.db) {
|
|
113
|
-
|
|
148
|
+
_context3.next = 21;
|
|
114
149
|
break;
|
|
115
150
|
}
|
|
116
|
-
|
|
151
|
+
if (!(key === "env")) {
|
|
152
|
+
_context3.next = 19;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
memory = val.memory;
|
|
156
|
+
try {
|
|
157
|
+
memory = Array.from(this.compressor.compress(val.memory));
|
|
158
|
+
} catch (e) {
|
|
159
|
+
memory = (0, _compress.compress)(val.memory);
|
|
160
|
+
}
|
|
161
|
+
_context3.next = 17;
|
|
162
|
+
return this.db.put("".concat(key, ".").concat(field), (0, _ramda.assoc)("memory", memory, this[key][field]));
|
|
163
|
+
case 17:
|
|
164
|
+
_context3.next = 21;
|
|
165
|
+
break;
|
|
166
|
+
case 19:
|
|
167
|
+
_context3.next = 21;
|
|
117
168
|
return this.db.put("".concat(key, ".").concat(field), this[key][field]);
|
|
118
|
-
case
|
|
169
|
+
case 21:
|
|
119
170
|
case "end":
|
|
120
|
-
return
|
|
171
|
+
return _context3.stop();
|
|
121
172
|
}
|
|
122
|
-
},
|
|
173
|
+
}, _callee3, this);
|
|
123
174
|
}));
|
|
124
|
-
function set(
|
|
175
|
+
function set(_x4, _x5, _x6) {
|
|
125
176
|
return _set.apply(this, arguments);
|
|
126
177
|
}
|
|
127
178
|
return set;
|
|
@@ -129,9 +180,9 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
129
180
|
}, {
|
|
130
181
|
key: "initSync",
|
|
131
182
|
value: function initSync() {
|
|
183
|
+
this.items = {};
|
|
132
184
|
this.addrmap = {};
|
|
133
185
|
this.txs = {};
|
|
134
|
-
this.jwks = {};
|
|
135
186
|
this.blocks = [];
|
|
136
187
|
this.blockmap = {};
|
|
137
188
|
this.env = {};
|
|
@@ -208,30 +259,30 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
208
259
|
}, {
|
|
209
260
|
key: "putAll",
|
|
210
261
|
value: function () {
|
|
211
|
-
var _putAll = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
262
|
+
var _putAll = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key) {
|
|
212
263
|
var k;
|
|
213
|
-
return _regeneratorRuntime().wrap(function
|
|
214
|
-
while (1) switch (
|
|
264
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
265
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
215
266
|
case 0:
|
|
216
|
-
|
|
267
|
+
_context4.t0 = _regeneratorRuntime().keys(this[key]);
|
|
217
268
|
case 1:
|
|
218
|
-
if ((
|
|
219
|
-
|
|
269
|
+
if ((_context4.t1 = _context4.t0()).done) {
|
|
270
|
+
_context4.next = 7;
|
|
220
271
|
break;
|
|
221
272
|
}
|
|
222
|
-
k =
|
|
223
|
-
|
|
273
|
+
k = _context4.t1.value;
|
|
274
|
+
_context4.next = 5;
|
|
224
275
|
return this.set(this[key][k], key, k);
|
|
225
276
|
case 5:
|
|
226
|
-
|
|
277
|
+
_context4.next = 1;
|
|
227
278
|
break;
|
|
228
279
|
case 7:
|
|
229
280
|
case "end":
|
|
230
|
-
return
|
|
281
|
+
return _context4.stop();
|
|
231
282
|
}
|
|
232
|
-
},
|
|
283
|
+
}, _callee4, this);
|
|
233
284
|
}));
|
|
234
|
-
function putAll(
|
|
285
|
+
function putAll(_x7) {
|
|
235
286
|
return _putAll.apply(this, arguments);
|
|
236
287
|
}
|
|
237
288
|
return putAll;
|
|
@@ -239,197 +290,330 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
239
290
|
}, {
|
|
240
291
|
key: "init",
|
|
241
292
|
value: function () {
|
|
242
|
-
var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
243
|
-
var _i, _arr, v, _i2, _arr2, _this$_v, _v, items, _iterator, _step, v2, key, field, _i3, _arr3, _v2, _i4, _arr4, _v3;
|
|
244
|
-
return _regeneratorRuntime().wrap(function
|
|
245
|
-
while (1) switch (
|
|
293
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
294
|
+
var _i, _arr, v, _i2, _arr2, _this$_v, _v, items, _iterator, _step, v2, key, field, v3, _i3, _arr3, _v2, _i4, _arr4, _v3;
|
|
295
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
296
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
246
297
|
case 0:
|
|
247
298
|
if (!this.isInit) {
|
|
248
|
-
|
|
299
|
+
_context5.next = 2;
|
|
249
300
|
break;
|
|
250
301
|
}
|
|
251
|
-
return
|
|
302
|
+
return _context5.abrupt("return");
|
|
252
303
|
case 2:
|
|
253
304
|
this.isInit = true;
|
|
305
|
+
if (!(typeof this._init === "function")) {
|
|
306
|
+
_context5.next = 6;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
_context5.next = 6;
|
|
310
|
+
return this._init();
|
|
311
|
+
case 6:
|
|
312
|
+
this.compressor = new this.Compressor();
|
|
313
|
+
this.decompressor = new this.Decompressor();
|
|
254
314
|
if (!this.db) {
|
|
255
|
-
|
|
315
|
+
_context5.next = 59;
|
|
256
316
|
break;
|
|
257
317
|
}
|
|
258
318
|
_i = 0, _arr = ["height", "blocks"];
|
|
259
|
-
case
|
|
319
|
+
case 10:
|
|
260
320
|
if (!(_i < _arr.length)) {
|
|
261
|
-
|
|
321
|
+
_context5.next = 18;
|
|
262
322
|
break;
|
|
263
323
|
}
|
|
264
324
|
v = _arr[_i];
|
|
265
|
-
|
|
325
|
+
_context5.next = 14;
|
|
266
326
|
return this.get(v);
|
|
267
|
-
case
|
|
268
|
-
this[v] =
|
|
269
|
-
case
|
|
327
|
+
case 14:
|
|
328
|
+
this[v] = _context5.sent;
|
|
329
|
+
case 15:
|
|
270
330
|
_i++;
|
|
271
|
-
|
|
331
|
+
_context5.next = 10;
|
|
272
332
|
break;
|
|
273
|
-
case
|
|
274
|
-
_i2 = 0, _arr2 = ["
|
|
275
|
-
case
|
|
333
|
+
case 18:
|
|
334
|
+
_i2 = 0, _arr2 = ["items", "txs", "env", "modules", "wasms", "addrmap", "blockmap", "modmap", "msgs"];
|
|
335
|
+
case 19:
|
|
276
336
|
if (!(_i2 < _arr2.length)) {
|
|
277
|
-
|
|
337
|
+
_context5.next = 57;
|
|
278
338
|
break;
|
|
279
339
|
}
|
|
280
340
|
_v = _arr2[_i2];
|
|
281
341
|
(_this$_v = this[_v]) !== null && _this$_v !== void 0 ? _this$_v : this[_v] = {};
|
|
282
|
-
|
|
342
|
+
_context5.next = 24;
|
|
283
343
|
return this.db.getKeys({
|
|
284
344
|
start: _v,
|
|
285
345
|
end: _v + "a"
|
|
286
346
|
});
|
|
287
|
-
case
|
|
288
|
-
items =
|
|
347
|
+
case 24:
|
|
348
|
+
items = _context5.sent;
|
|
289
349
|
_iterator = _createForOfIteratorHelper(items || []);
|
|
290
|
-
|
|
350
|
+
_context5.prev = 26;
|
|
291
351
|
_iterator.s();
|
|
292
|
-
case
|
|
352
|
+
case 28:
|
|
293
353
|
if ((_step = _iterator.n()).done) {
|
|
294
|
-
|
|
354
|
+
_context5.next = 46;
|
|
295
355
|
break;
|
|
296
356
|
}
|
|
297
357
|
v2 = _step.value;
|
|
298
358
|
key = v2.split(".")[0];
|
|
299
359
|
field = v2.split(".")[1];
|
|
300
360
|
if (!(key === _v)) {
|
|
301
|
-
|
|
361
|
+
_context5.next = 44;
|
|
302
362
|
break;
|
|
303
363
|
}
|
|
304
|
-
|
|
364
|
+
if (!key.match(/^env/)) {
|
|
365
|
+
_context5.next = 41;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
_context5.next = 36;
|
|
305
369
|
return this.db.get(v2);
|
|
306
|
-
case
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
370
|
+
case 36:
|
|
371
|
+
v3 = _context5.sent;
|
|
372
|
+
if ((0, _ramda.is)(Array, v3.memory)) {
|
|
373
|
+
try {
|
|
374
|
+
v3.memory = this.decompressor.decompress(v3.memory);
|
|
375
|
+
} catch (e) {
|
|
376
|
+
v3.memory = (0, _compress.decompress)(v3.memory);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
this[_v][field] = v3;
|
|
380
|
+
_context5.next = 44;
|
|
310
381
|
break;
|
|
311
|
-
case
|
|
312
|
-
|
|
382
|
+
case 41:
|
|
383
|
+
_context5.next = 43;
|
|
384
|
+
return this.db.get(v2);
|
|
385
|
+
case 43:
|
|
386
|
+
this[_v][field] = _context5.sent;
|
|
387
|
+
case 44:
|
|
388
|
+
_context5.next = 28;
|
|
313
389
|
break;
|
|
314
|
-
case
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
390
|
+
case 46:
|
|
391
|
+
_context5.next = 51;
|
|
392
|
+
break;
|
|
393
|
+
case 48:
|
|
394
|
+
_context5.prev = 48;
|
|
395
|
+
_context5.t0 = _context5["catch"](26);
|
|
396
|
+
_iterator.e(_context5.t0);
|
|
397
|
+
case 51:
|
|
398
|
+
_context5.prev = 51;
|
|
320
399
|
_iterator.f();
|
|
321
|
-
return
|
|
322
|
-
case
|
|
400
|
+
return _context5.finish(51);
|
|
401
|
+
case 54:
|
|
323
402
|
_i2++;
|
|
324
|
-
|
|
403
|
+
_context5.next = 19;
|
|
325
404
|
break;
|
|
326
|
-
case
|
|
327
|
-
|
|
405
|
+
case 57:
|
|
406
|
+
_context5.next = 75;
|
|
328
407
|
break;
|
|
329
|
-
case
|
|
408
|
+
case 59:
|
|
330
409
|
_i3 = 0, _arr3 = ["height", "blocks"];
|
|
331
|
-
case
|
|
410
|
+
case 60:
|
|
332
411
|
if (!(_i3 < _arr3.length)) {
|
|
333
|
-
|
|
412
|
+
_context5.next = 67;
|
|
334
413
|
break;
|
|
335
414
|
}
|
|
336
415
|
_v2 = _arr3[_i3];
|
|
337
|
-
|
|
416
|
+
_context5.next = 64;
|
|
338
417
|
return this.set(this[_v2], _v2);
|
|
339
|
-
case
|
|
418
|
+
case 64:
|
|
340
419
|
_i3++;
|
|
341
|
-
|
|
420
|
+
_context5.next = 60;
|
|
342
421
|
break;
|
|
343
|
-
case
|
|
422
|
+
case 67:
|
|
344
423
|
_i4 = 0, _arr4 = ["modules", "wasms", "addrmap", "blockmap"];
|
|
345
|
-
case
|
|
424
|
+
case 68:
|
|
346
425
|
if (!(_i4 < _arr4.length)) {
|
|
347
|
-
|
|
426
|
+
_context5.next = 75;
|
|
348
427
|
break;
|
|
349
428
|
}
|
|
350
429
|
_v3 = _arr4[_i4];
|
|
351
|
-
|
|
430
|
+
_context5.next = 72;
|
|
352
431
|
return this.putAll(_v3);
|
|
353
|
-
case
|
|
432
|
+
case 72:
|
|
354
433
|
_i4++;
|
|
355
|
-
|
|
434
|
+
_context5.next = 68;
|
|
356
435
|
break;
|
|
357
|
-
case
|
|
436
|
+
case 75:
|
|
358
437
|
case "end":
|
|
359
|
-
return
|
|
438
|
+
return _context5.stop();
|
|
360
439
|
}
|
|
361
|
-
},
|
|
440
|
+
}, _callee5, this, [[26, 48, 51, 54]]);
|
|
362
441
|
}));
|
|
363
442
|
function init() {
|
|
364
443
|
return _init.apply(this, arguments);
|
|
365
444
|
}
|
|
366
445
|
return init;
|
|
367
446
|
}()
|
|
447
|
+
}, {
|
|
448
|
+
key: "getTx",
|
|
449
|
+
value: function () {
|
|
450
|
+
var _getTx = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id) {
|
|
451
|
+
var tx, bundle, _iterator2, _step2, di, data, data_size, data_type, _iterator3, _step3, t, owner;
|
|
452
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
453
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
454
|
+
case 0:
|
|
455
|
+
tx = this.txs[id];
|
|
456
|
+
if (!tx.bundle) {
|
|
457
|
+
_context6.next = 44;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
_context6.prev = 2;
|
|
461
|
+
bundle = new _arbundles.Bundle(this.txs[tx.bundle].data);
|
|
462
|
+
_iterator2 = _createForOfIteratorHelper(bundle.items);
|
|
463
|
+
_context6.prev = 5;
|
|
464
|
+
_iterator2.s();
|
|
465
|
+
case 7:
|
|
466
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
467
|
+
_context6.next = 32;
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
di = _step2.value;
|
|
471
|
+
if (!(id === di.id)) {
|
|
472
|
+
_context6.next = 30;
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
data = di.data;
|
|
476
|
+
data_size = Buffer.byteLength(di.rawData).toString();
|
|
477
|
+
data_type = "";
|
|
478
|
+
_iterator3 = _createForOfIteratorHelper(di.tags);
|
|
479
|
+
try {
|
|
480
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
481
|
+
t = _step3.value;
|
|
482
|
+
if (t.name === "Content-Type") data_type = t.value;
|
|
483
|
+
}
|
|
484
|
+
} catch (err) {
|
|
485
|
+
_iterator3.e(err);
|
|
486
|
+
} finally {
|
|
487
|
+
_iterator3.f();
|
|
488
|
+
}
|
|
489
|
+
_context6.next = 17;
|
|
490
|
+
return this.owner(di);
|
|
491
|
+
case 17:
|
|
492
|
+
owner = _context6.sent;
|
|
493
|
+
_context6.t0 = {
|
|
494
|
+
size: data_size,
|
|
495
|
+
type: data_type
|
|
496
|
+
};
|
|
497
|
+
_context6.t1 = di.anchor;
|
|
498
|
+
_context6.t2 = di.signature;
|
|
499
|
+
_context6.t3 = di.target;
|
|
500
|
+
_context6.next = 24;
|
|
501
|
+
return di.id;
|
|
502
|
+
case 24:
|
|
503
|
+
_context6.t4 = _context6.sent;
|
|
504
|
+
_context6.t5 = di;
|
|
505
|
+
_context6.t6 = owner;
|
|
506
|
+
_context6.t7 = di.tags;
|
|
507
|
+
_context6.t8 = data;
|
|
508
|
+
tx = {
|
|
509
|
+
_data: _context6.t0,
|
|
510
|
+
anchor: _context6.t1,
|
|
511
|
+
signature: _context6.t2,
|
|
512
|
+
recipient: _context6.t3,
|
|
513
|
+
id: _context6.t4,
|
|
514
|
+
item: _context6.t5,
|
|
515
|
+
owner: _context6.t6,
|
|
516
|
+
tags: _context6.t7,
|
|
517
|
+
data: _context6.t8
|
|
518
|
+
};
|
|
519
|
+
case 30:
|
|
520
|
+
_context6.next = 7;
|
|
521
|
+
break;
|
|
522
|
+
case 32:
|
|
523
|
+
_context6.next = 37;
|
|
524
|
+
break;
|
|
525
|
+
case 34:
|
|
526
|
+
_context6.prev = 34;
|
|
527
|
+
_context6.t9 = _context6["catch"](5);
|
|
528
|
+
_iterator2.e(_context6.t9);
|
|
529
|
+
case 37:
|
|
530
|
+
_context6.prev = 37;
|
|
531
|
+
_iterator2.f();
|
|
532
|
+
return _context6.finish(37);
|
|
533
|
+
case 40:
|
|
534
|
+
_context6.next = 44;
|
|
535
|
+
break;
|
|
536
|
+
case 42:
|
|
537
|
+
_context6.prev = 42;
|
|
538
|
+
_context6.t10 = _context6["catch"](2);
|
|
539
|
+
case 44:
|
|
540
|
+
return _context6.abrupt("return", tx);
|
|
541
|
+
case 45:
|
|
542
|
+
case "end":
|
|
543
|
+
return _context6.stop();
|
|
544
|
+
}
|
|
545
|
+
}, _callee6, this, [[2, 42], [5, 34, 37, 40]]);
|
|
546
|
+
}));
|
|
547
|
+
function getTx(_x8) {
|
|
548
|
+
return _getTx.apply(this, arguments);
|
|
549
|
+
}
|
|
550
|
+
return getTx;
|
|
551
|
+
}()
|
|
368
552
|
}, {
|
|
369
553
|
key: "getWasm",
|
|
370
554
|
value: function () {
|
|
371
|
-
var _getWasm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
555
|
+
var _getWasm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(module) {
|
|
372
556
|
var _format;
|
|
373
557
|
var mod, format, _wasm, wasm, tx;
|
|
374
|
-
return _regeneratorRuntime().wrap(function
|
|
375
|
-
while (1) switch (
|
|
558
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
559
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
376
560
|
case 0:
|
|
377
561
|
mod = module !== null && module !== void 0 ? module : this.modules.aos2_0_1;
|
|
378
562
|
if (mod) {
|
|
379
|
-
|
|
563
|
+
_context7.next = 3;
|
|
380
564
|
break;
|
|
381
565
|
}
|
|
382
566
|
throw Error("module not found");
|
|
383
567
|
case 3:
|
|
384
568
|
format = null;
|
|
385
|
-
|
|
569
|
+
_context7.next = 6;
|
|
386
570
|
return this.wasms[mod];
|
|
387
571
|
case 6:
|
|
388
|
-
_wasm =
|
|
572
|
+
_wasm = _context7.sent;
|
|
389
573
|
wasm = _wasm === null || _wasm === void 0 ? void 0 : _wasm.data;
|
|
390
574
|
if (wasm) {
|
|
391
|
-
|
|
575
|
+
_context7.next = 22;
|
|
392
576
|
break;
|
|
393
577
|
}
|
|
394
578
|
if (!(_wasm !== null && _wasm !== void 0 && _wasm.file)) {
|
|
395
|
-
|
|
579
|
+
_context7.next = 16;
|
|
396
580
|
break;
|
|
397
581
|
}
|
|
398
|
-
|
|
582
|
+
_context7.next = 12;
|
|
399
583
|
return this._getWasm(this.wasms[mod].file);
|
|
400
584
|
case 12:
|
|
401
|
-
wasm =
|
|
585
|
+
wasm = _context7.sent;
|
|
402
586
|
format = _wasm.format;
|
|
403
|
-
|
|
587
|
+
_context7.next = 20;
|
|
404
588
|
break;
|
|
405
589
|
case 16:
|
|
406
|
-
|
|
407
|
-
return this.
|
|
590
|
+
_context7.next = 18;
|
|
591
|
+
return this.getTx(mod);
|
|
408
592
|
case 18:
|
|
409
|
-
tx =
|
|
593
|
+
tx = _context7.sent;
|
|
410
594
|
if (tx) {
|
|
411
595
|
wasm = Buffer.from(tx.data, "base64");
|
|
412
596
|
format = (0, _utils.tags)(tx.tags)["Module-Format"];
|
|
413
597
|
}
|
|
414
598
|
case 20:
|
|
415
|
-
|
|
599
|
+
_context7.next = 23;
|
|
416
600
|
break;
|
|
417
601
|
case 22:
|
|
418
602
|
format = _wasm.format;
|
|
419
603
|
case 23:
|
|
420
604
|
(_format = format) !== null && _format !== void 0 ? _format : format = "wasm64-unknown-emscripten-draft_2024_02_15";
|
|
421
|
-
return
|
|
605
|
+
return _context7.abrupt("return", {
|
|
422
606
|
format: format,
|
|
423
607
|
mod: mod,
|
|
424
608
|
wasm: wasm
|
|
425
609
|
});
|
|
426
610
|
case 25:
|
|
427
611
|
case "end":
|
|
428
|
-
return
|
|
612
|
+
return _context7.stop();
|
|
429
613
|
}
|
|
430
|
-
},
|
|
614
|
+
}, _callee7, this);
|
|
431
615
|
}));
|
|
432
|
-
function getWasm(
|
|
616
|
+
function getWasm(_x9) {
|
|
433
617
|
return _getWasm.apply(this, arguments);
|
|
434
618
|
}
|
|
435
619
|
return getWasm;
|