wao 0.8.2 → 0.8.4

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
@@ -136,49 +136,122 @@ var connect = exports.connect = function connect(mem) {
136
136
  return _ref4.apply(this, arguments);
137
137
  };
138
138
  }();
139
- var genEnv = function genEnv(_ref5) {
140
- var pid = _ref5.pid,
141
- _ref5$owner = _ref5.owner,
142
- owner = _ref5$owner === void 0 ? "" : _ref5$owner,
143
- _ref5$module = _ref5.module,
144
- module = _ref5$module === void 0 ? "" : _ref5$module,
145
- _ref5$auth = _ref5.auth,
146
- auth = _ref5$auth === void 0 ? "" : _ref5$auth;
147
- return {
148
- Process: {
149
- Id: pid,
150
- Tags: [{
151
- name: "Data-Protocol",
152
- value: "ao"
153
- }, {
154
- name: "Variant",
155
- value: "ao.TN.1"
156
- }, {
157
- name: "Type",
158
- value: "Process"
159
- }, {
160
- name: "Authority",
161
- value: auth
162
- }],
163
- Owner: owner
164
- },
165
- Module: {
166
- Id: module,
167
- Tags: [{
168
- name: "Data-Protocol",
169
- value: "ao"
170
- }, {
171
- name: "Variant",
172
- value: "ao.TN.1"
173
- }, {
174
- name: "Type",
175
- value: "Module"
176
- }]
177
- }
139
+ var genEnv = /*#__PURE__*/function () {
140
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
141
+ var _yield$mem$get$tags, _yield$mem$get, _yield$mem$get$tags2, _yield$mem$get2;
142
+ var pid, _ref5$owner, owner, _ref5$module, module;
143
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
144
+ while (1) switch (_context2.prev = _context2.next) {
145
+ case 0:
146
+ pid = _ref5.pid, _ref5$owner = _ref5.owner, owner = _ref5$owner === void 0 ? "" : _ref5$owner, _ref5$module = _ref5.module, module = _ref5$module === void 0 ? "" : _ref5$module;
147
+ _context2.t0 = pid;
148
+ _context2.next = 4;
149
+ return mem.get("txs", pid);
150
+ case 4:
151
+ _context2.t3 = _yield$mem$get = _context2.sent;
152
+ _context2.t2 = _context2.t3 === null;
153
+ if (_context2.t2) {
154
+ _context2.next = 8;
155
+ break;
156
+ }
157
+ _context2.t2 = _yield$mem$get === void 0;
158
+ case 8:
159
+ if (!_context2.t2) {
160
+ _context2.next = 12;
161
+ break;
162
+ }
163
+ _context2.t4 = void 0;
164
+ _context2.next = 13;
165
+ break;
166
+ case 12:
167
+ _context2.t4 = _yield$mem$get.tags;
168
+ case 13:
169
+ _context2.t5 = _yield$mem$get$tags = _context2.t4;
170
+ _context2.t1 = _context2.t5 !== null;
171
+ if (!_context2.t1) {
172
+ _context2.next = 17;
173
+ break;
174
+ }
175
+ _context2.t1 = _yield$mem$get$tags !== void 0;
176
+ case 17:
177
+ if (!_context2.t1) {
178
+ _context2.next = 21;
179
+ break;
180
+ }
181
+ _context2.t6 = _yield$mem$get$tags;
182
+ _context2.next = 22;
183
+ break;
184
+ case 21:
185
+ _context2.t6 = [];
186
+ case 22:
187
+ _context2.t7 = _context2.t6;
188
+ _context2.t8 = owner;
189
+ _context2.t9 = {
190
+ Id: _context2.t0,
191
+ Tags: _context2.t7,
192
+ Owner: _context2.t8
193
+ };
194
+ _context2.t10 = module;
195
+ _context2.next = 28;
196
+ return mem.get("txs", module);
197
+ case 28:
198
+ _context2.t13 = _yield$mem$get2 = _context2.sent;
199
+ _context2.t12 = _context2.t13 === null;
200
+ if (_context2.t12) {
201
+ _context2.next = 32;
202
+ break;
203
+ }
204
+ _context2.t12 = _yield$mem$get2 === void 0;
205
+ case 32:
206
+ if (!_context2.t12) {
207
+ _context2.next = 36;
208
+ break;
209
+ }
210
+ _context2.t14 = void 0;
211
+ _context2.next = 37;
212
+ break;
213
+ case 36:
214
+ _context2.t14 = _yield$mem$get2.tags;
215
+ case 37:
216
+ _context2.t15 = _yield$mem$get$tags2 = _context2.t14;
217
+ _context2.t11 = _context2.t15 !== null;
218
+ if (!_context2.t11) {
219
+ _context2.next = 41;
220
+ break;
221
+ }
222
+ _context2.t11 = _yield$mem$get$tags2 !== void 0;
223
+ case 41:
224
+ if (!_context2.t11) {
225
+ _context2.next = 45;
226
+ break;
227
+ }
228
+ _context2.t16 = _yield$mem$get$tags2;
229
+ _context2.next = 46;
230
+ break;
231
+ case 45:
232
+ _context2.t16 = [];
233
+ case 46:
234
+ _context2.t17 = _context2.t16;
235
+ _context2.t18 = {
236
+ Id: _context2.t10,
237
+ Tags: _context2.t17
238
+ };
239
+ return _context2.abrupt("return", {
240
+ Process: _context2.t9,
241
+ Module: _context2.t18
242
+ });
243
+ case 49:
244
+ case "end":
245
+ return _context2.stop();
246
+ }
247
+ }, _callee2);
248
+ }));
249
+ return function genEnv(_x7) {
250
+ return _ref6.apply(this, arguments);
178
251
  };
179
- };
252
+ }();
180
253
  var spawn = /*#__PURE__*/function () {
181
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
254
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
182
255
  var _opt$tags, _opt$memory;
183
256
  var opt,
184
257
  _yield$mem$getWasm,
@@ -206,7 +279,7 @@ var connect = exports.connect = function connect(mem) {
206
279
  p,
207
280
  _opt$data,
208
281
  _yield$mem$get$data,
209
- _yield$mem$get,
282
+ _yield$mem$get3,
210
283
  data,
211
284
  msg,
212
285
  _env,
@@ -217,27 +290,27 @@ var connect = exports.connect = function connect(mem) {
217
290
  _int,
218
291
  cronTags,
219
292
  _k,
220
- _args2 = arguments;
221
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
222
- while (1) switch (_context2.prev = _context2.next) {
293
+ _args3 = arguments;
294
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
295
+ while (1) switch (_context3.prev = _context3.next) {
223
296
  case 0:
224
- opt = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
297
+ opt = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
225
298
  if (opt.module) {
226
- _context2.next = 3;
299
+ _context3.next = 3;
227
300
  break;
228
301
  }
229
302
  throw Error("module missing");
230
303
  case 3:
231
304
  if (opt.scheduler) {
232
- _context2.next = 5;
305
+ _context3.next = 5;
233
306
  break;
234
307
  }
235
308
  throw Error("scheduler missing");
236
309
  case 5:
237
- _context2.next = 7;
310
+ _context3.next = 7;
238
311
  return mem.getWasm(opt.module, mem);
239
312
  case 7:
240
- _yield$mem$getWasm = _context2.sent;
313
+ _yield$mem$getWasm = _context3.sent;
241
314
  mod = _yield$mem$getWasm.mod;
242
315
  wasm = _yield$mem$getWasm.wasm;
243
316
  format = _yield$mem$getWasm.format;
@@ -248,7 +321,8 @@ var connect = exports.connect = function connect(mem) {
248
321
  SDK: "aoconnect",
249
322
  Module: mod,
250
323
  Scheduler: opt.scheduler,
251
- "Content-Type": "text/plain"
324
+ "Content-Type": "text/plain",
325
+ Authority: _test.mu.addr
252
326
  }));
253
327
  ex = false;
254
328
  _iterator = _createForOfIteratorHelper(opt.tags);
@@ -266,7 +340,7 @@ var connect = exports.connect = function connect(mem) {
266
340
  name: "Type",
267
341
  value: "Process"
268
342
  });
269
- _context2.next = 18;
343
+ _context3.next = 18;
270
344
  return ar.dataitem({
271
345
  item: opt.item,
272
346
  data: opt.data,
@@ -274,14 +348,14 @@ var connect = exports.connect = function connect(mem) {
274
348
  tags: (0, _utils.tags)(opt.tags)
275
349
  });
276
350
  case 18:
277
- _yield$ar$dataitem = _context2.sent;
351
+ _yield$ar$dataitem = _context3.sent;
278
352
  id = _yield$ar$dataitem.id;
279
353
  owner = _yield$ar$dataitem.owner;
280
354
  item = _yield$ar$dataitem.item;
281
355
  __tags = _yield$ar$dataitem.tags;
282
356
  opt.tags = (0, _utils.buildTags)(null, __tags);
283
357
  if (opt.item) opt.data = _base64url["default"].decode(item.data);
284
- _context2.next = 27;
358
+ _context3.next = 27;
285
359
  return ar.postItems(item, _test.su.jwk);
286
360
  case 27:
287
361
  now = Date.now;
@@ -289,37 +363,37 @@ var connect = exports.connect = function connect(mem) {
289
363
  ext = t.Extension || "WeaveDrive";
290
364
  wdrive = extensions[ext];
291
365
  handle = null;
292
- _context2.prev = 32;
293
- _context2.t0 = _aoLoader["default"];
294
- _context2.t1 = wasm;
295
- _context2.t2 = format;
296
- _context2.t3 = wdrive;
297
- _context2.t4 = item;
298
- _context2.next = 40;
366
+ _context3.prev = 32;
367
+ _context3.t0 = _aoLoader["default"];
368
+ _context3.t1 = wasm;
369
+ _context3.t2 = format;
370
+ _context3.t3 = wdrive;
371
+ _context3.t4 = item;
372
+ _context3.next = 40;
299
373
  return mem.get("txs", mod);
300
374
  case 40:
301
- _context2.t5 = _context2.sent;
302
- _context2.t6 = {
303
- format: _context2.t2,
304
- WeaveDrive: _context2.t3,
305
- spawn: _context2.t4,
306
- module: _context2.t5
375
+ _context3.t5 = _context3.sent;
376
+ _context3.t6 = {
377
+ format: _context3.t2,
378
+ WeaveDrive: _context3.t3,
379
+ spawn: _context3.t4,
380
+ module: _context3.t5
307
381
  };
308
- _context2.next = 44;
309
- return (0, _context2.t0)(_context2.t1, _context2.t6);
382
+ _context3.next = 44;
383
+ return (0, _context3.t0)(_context3.t1, _context3.t6);
310
384
  case 44:
311
- handle = _context2.sent;
312
- _context2.next = 49;
385
+ handle = _context3.sent;
386
+ _context3.next = 49;
313
387
  break;
314
388
  case 47:
315
- _context2.prev = 47;
316
- _context2.t7 = _context2["catch"](32);
389
+ _context3.prev = 47;
390
+ _context3.t7 = _context3["catch"](32);
317
391
  case 49:
318
392
  if (handle) {
319
- _context2.next = 51;
393
+ _context3.next = 51;
320
394
  break;
321
395
  }
322
- return _context2.abrupt("return", null);
396
+ return _context3.abrupt("return", null);
323
397
  case 51:
324
398
  _module = null;
325
399
  _module = {
@@ -348,122 +422,124 @@ var connect = exports.connect = function connect(mem) {
348
422
  opt: opt
349
423
  };
350
424
  if (!memory) {
351
- _context2.next = 61;
425
+ _context3.next = 61;
352
426
  break;
353
427
  }
354
- _context2.next = 101;
428
+ _context3.next = 103;
355
429
  break;
356
430
  case 61:
357
431
  if (!(_tags["On-Boot"] || true)) {
358
- _context2.next = 100;
432
+ _context3.next = 102;
359
433
  break;
360
434
  }
361
435
  data = "";
362
436
  if (!(_tags["On-Boot"] === "Data")) {
363
- _context2.next = 67;
437
+ _context3.next = 67;
364
438
  break;
365
439
  }
366
440
  data = (_opt$data = opt.data) !== null && _opt$data !== void 0 ? _opt$data : "";
367
- _context2.next = 88;
441
+ _context3.next = 88;
368
442
  break;
369
443
  case 67:
370
- _context2.next = 69;
444
+ _context3.next = 69;
371
445
  return mem.get("msgs", _tags["On-Boot"]);
372
446
  case 69:
373
- _context2.t10 = _yield$mem$get = _context2.sent;
374
- _context2.t9 = _context2.t10 === null;
375
- if (_context2.t9) {
376
- _context2.next = 73;
447
+ _context3.t10 = _yield$mem$get3 = _context3.sent;
448
+ _context3.t9 = _context3.t10 === null;
449
+ if (_context3.t9) {
450
+ _context3.next = 73;
377
451
  break;
378
452
  }
379
- _context2.t9 = _yield$mem$get === void 0;
453
+ _context3.t9 = _yield$mem$get3 === void 0;
380
454
  case 73:
381
- if (!_context2.t9) {
382
- _context2.next = 77;
455
+ if (!_context3.t9) {
456
+ _context3.next = 77;
383
457
  break;
384
458
  }
385
- _context2.t11 = void 0;
386
- _context2.next = 78;
459
+ _context3.t11 = void 0;
460
+ _context3.next = 78;
387
461
  break;
388
462
  case 77:
389
- _context2.t11 = _yield$mem$get.data;
463
+ _context3.t11 = _yield$mem$get3.data;
390
464
  case 78:
391
- _context2.t12 = _yield$mem$get$data = _context2.t11;
392
- _context2.t8 = _context2.t12 !== null;
393
- if (!_context2.t8) {
394
- _context2.next = 82;
465
+ _context3.t12 = _yield$mem$get$data = _context3.t11;
466
+ _context3.t8 = _context3.t12 !== null;
467
+ if (!_context3.t8) {
468
+ _context3.next = 82;
395
469
  break;
396
470
  }
397
- _context2.t8 = _yield$mem$get$data !== void 0;
471
+ _context3.t8 = _yield$mem$get$data !== void 0;
398
472
  case 82:
399
- if (!_context2.t8) {
400
- _context2.next = 86;
473
+ if (!_context3.t8) {
474
+ _context3.next = 86;
401
475
  break;
402
476
  }
403
- _context2.t13 = _yield$mem$get$data;
404
- _context2.next = 87;
477
+ _context3.t13 = _yield$mem$get$data;
478
+ _context3.next = 87;
405
479
  break;
406
480
  case 86:
407
- _context2.t13 = "";
481
+ _context3.t13 = "";
408
482
  case 87:
409
- data = _context2.t13;
483
+ data = _context3.t13;
410
484
  case 88:
411
- _context2.next = 90;
485
+ _context3.next = 90;
412
486
  return genMsg(id, p, data, opt.tags, owner, _test.mu.addr, true);
413
487
  case 90:
414
- msg = _context2.sent;
415
- _env = genEnv({
488
+ msg = _context3.sent;
489
+ _context3.next = 93;
490
+ return genEnv({
416
491
  pid: p.id,
417
492
  owner: p.owner,
418
- module: p.module,
419
- auth: _test.mu.addr
493
+ module: p.module
420
494
  });
421
- _context2.next = 94;
495
+ case 93:
496
+ _env = _context3.sent;
497
+ _context3.next = 96;
422
498
  return _module.handle(null, msg, _env);
423
- case 94:
424
- res = _context2.sent;
499
+ case 96:
500
+ res = _context3.sent;
425
501
  p.memory = res.Memory;
426
502
  delete res.Memory;
427
503
  p.res[id] = res;
428
- _context2.next = 101;
504
+ _context3.next = 103;
429
505
  break;
430
- case 100:
506
+ case 102:
431
507
  p.height += 1;
432
- case 101:
433
- _context2.next = 103;
434
- return mem.set(opt, "msgs", id);
435
508
  case 103:
509
+ _context3.next = 105;
510
+ return mem.set(opt, "msgs", id);
511
+ case 105:
436
512
  if (!_tags["Cron-Interval"]) {
437
- _context2.next = 127;
513
+ _context3.next = 129;
438
514
  break;
439
515
  }
440
516
  _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];
441
517
  _int = 0;
442
- _context2.t14 = unit.replace(/s$/, "");
443
- _context2.next = _context2.t14 === "millisecond" ? 109 : _context2.t14 === "second" ? 111 : _context2.t14 === "minute" ? 113 : _context2.t14 === "hour" ? 115 : _context2.t14 === "day" ? 117 : _context2.t14 === "month" ? 119 : _context2.t14 === "year" ? 121 : 123;
518
+ _context3.t14 = unit.replace(/s$/, "");
519
+ _context3.next = _context3.t14 === "millisecond" ? 111 : _context3.t14 === "second" ? 113 : _context3.t14 === "minute" ? 115 : _context3.t14 === "hour" ? 117 : _context3.t14 === "day" ? 119 : _context3.t14 === "month" ? 121 : _context3.t14 === "year" ? 123 : 125;
444
520
  break;
445
- case 109:
446
- _int = num;
447
- return _context2.abrupt("break", 123);
448
521
  case 111:
449
- _int = num * 1000;
450
- return _context2.abrupt("break", 123);
522
+ _int = num;
523
+ return _context3.abrupt("break", 125);
451
524
  case 113:
452
- _int = num * 1000 * 60;
453
- return _context2.abrupt("break", 123);
525
+ _int = num * 1000;
526
+ return _context3.abrupt("break", 125);
454
527
  case 115:
455
- _int = num * 1000 * 60 * 60;
456
- return _context2.abrupt("break", 123);
528
+ _int = num * 1000 * 60;
529
+ return _context3.abrupt("break", 125);
457
530
  case 117:
458
- _int = num * 1000 * 60 * 60 * 24;
459
- return _context2.abrupt("break", 123);
531
+ _int = num * 1000 * 60 * 60;
532
+ return _context3.abrupt("break", 125);
460
533
  case 119:
461
- _int = num * 1000 * 60 * 60 * 24 * 30;
462
- return _context2.abrupt("break", 123);
534
+ _int = num * 1000 * 60 * 60 * 24;
535
+ return _context3.abrupt("break", 125);
463
536
  case 121:
464
- _int = num * 1000 * 60 * 60 * 24 * 365;
465
- return _context2.abrupt("break", 123);
537
+ _int = num * 1000 * 60 * 60 * 24 * 30;
538
+ return _context3.abrupt("break", 125);
466
539
  case 123:
540
+ _int = num * 1000 * 60 * 60 * 24 * 365;
541
+ return _context3.abrupt("break", 125);
542
+ case 125:
467
543
  cronTags = [];
468
544
  for (_k in _tags) {
469
545
  if (/^Cron-Tag-/.test(_k)) {
@@ -475,19 +551,19 @@ var connect = exports.connect = function connect(mem) {
475
551
  }
476
552
  p.cronTags = cronTags;
477
553
  p.span = _int;
478
- case 127:
479
- _context2.next = 129;
480
- return mem.set(p, "env", id);
481
554
  case 129:
482
- return _context2.abrupt("return", id);
483
- case 130:
555
+ _context3.next = 131;
556
+ return mem.set(p, "env", id);
557
+ case 131:
558
+ return _context3.abrupt("return", id);
559
+ case 132:
484
560
  case "end":
485
- return _context2.stop();
561
+ return _context3.stop();
486
562
  }
487
- }, _callee2, null, [[32, 47]]);
563
+ }, _callee3, null, [[32, 47]]);
488
564
  }));
489
565
  return function spawn() {
490
- return _ref6.apply(this, arguments);
566
+ return _ref7.apply(this, arguments);
491
567
  };
492
568
  }();
493
569
  function genHashChain(previousHash) {
@@ -500,57 +576,57 @@ var connect = exports.connect = function connect(mem) {
500
576
  return (0, _base64url["default"])(hasher.digest());
501
577
  }
502
578
  var _assign = /*#__PURE__*/function () {
503
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opt) {
579
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
504
580
  var _opt$tags2;
505
- var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref8, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, raw_owner, hashBuffer, msg, _env, _yield$mem$getWasm2, format, mod, wasm, wdrive, res, _iterator2, _step2, v, _iterator3, _step3, _v, __tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
506
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
507
- while (1) switch (_context3.prev = _context3.next) {
581
+ var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref9, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, raw_owner, hashBuffer, msg, _env, _yield$mem$getWasm2, format, mod, wasm, wdrive, res, _iterator2, _step2, v, _iterator3, _step3, _v, __tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
582
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
583
+ while (1) switch (_context4.prev = _context4.next) {
508
584
  case 0:
509
- _context3.next = 2;
585
+ _context4.next = 2;
510
586
  return mem.get("env", opt.process);
511
587
  case 2:
512
- p = _context3.sent;
588
+ p = _context4.sent;
513
589
  if (p) {
514
- _context3.next = 5;
590
+ _context4.next = 5;
515
591
  break;
516
592
  }
517
- return _context3.abrupt("return", null);
593
+ return _context4.abrupt("return", null);
518
594
  case 5:
519
- _context3.next = 7;
595
+ _context4.next = 7;
520
596
  return mem.get("msgs", opt.message);
521
597
  case 7:
522
- _opt = _context3.sent;
598
+ _opt = _context4.sent;
523
599
  hash = genHashChain(p.hash, opt.message);
524
600
  p.hash = hash;
525
- _context3.t0 = _utils.buildTags;
526
- _context3.t1 = _ramda.mergeLeft;
527
- _context3.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
528
- _context3.t3 = Date.now();
529
- _context3.t4 = p.epochs.length;
530
- _context3.next = 17;
601
+ _context4.t0 = _utils.buildTags;
602
+ _context4.t1 = _ramda.mergeLeft;
603
+ _context4.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
604
+ _context4.t3 = Date.now();
605
+ _context4.t4 = p.epochs.length;
606
+ _context4.next = 17;
531
607
  return mem.get("height");
532
608
  case 17:
533
- _context3.t5 = _context3.sent;
534
- _context3.t6 = opt.process;
535
- _context3.t7 = opt.message;
536
- _context3.t8 = hash;
537
- _context3.t9 = {
538
- Timestamp: _context3.t3,
539
- Epoch: _context3.t4,
609
+ _context4.t5 = _context4.sent;
610
+ _context4.t6 = opt.process;
611
+ _context4.t7 = opt.message;
612
+ _context4.t8 = hash;
613
+ _context4.t9 = {
614
+ Timestamp: _context4.t3,
615
+ Epoch: _context4.t4,
540
616
  Nonce: "0",
541
617
  "Data-Protocol": "ao",
542
618
  Variant: "ao.TN.1",
543
619
  SDK: "aoconnect",
544
620
  Type: "Assignment",
545
- "Block-Height": _context3.t5,
546
- Process: _context3.t6,
547
- Message: _context3.t7,
548
- "Hash-Chain": _context3.t8
621
+ "Block-Height": _context4.t5,
622
+ Process: _context4.t6,
623
+ Message: _context4.t7,
624
+ "Hash-Chain": _context4.t8
549
625
  };
550
- _context3.t10 = (0, _context3.t1)(_context3.t2, _context3.t9);
551
- opt.tags = (0, _context3.t0)(null, _context3.t10);
626
+ _context4.t10 = (0, _context4.t1)(_context4.t2, _context4.t9);
627
+ opt.tags = (0, _context4.t0)(null, _context4.t10);
552
628
  p.epochs.push([opt.message]);
553
- _context3.next = 27;
629
+ _context4.next = 27;
554
630
  return ar.dataitem({
555
631
  data: opt.data,
556
632
  signer: opt.signer,
@@ -558,101 +634,103 @@ var connect = exports.connect = function connect(mem) {
558
634
  target: opt.process
559
635
  });
560
636
  case 27:
561
- _yield$ar$dataitem2 = _context3.sent;
637
+ _yield$ar$dataitem2 = _context4.sent;
562
638
  id = _yield$ar$dataitem2.id;
563
639
  owner = _yield$ar$dataitem2.owner;
564
640
  item = _yield$ar$dataitem2.item;
565
641
  if (!opt.message_item) {
566
- _context3.next = 36;
642
+ _context4.next = 36;
567
643
  break;
568
644
  }
569
- _context3.next = 34;
645
+ _context4.next = 34;
570
646
  return ar.postItems([opt.message_item, item], _test.su.jwk);
571
647
  case 34:
572
- _context3.next = 38;
648
+ _context4.next = 38;
573
649
  break;
574
650
  case 36:
575
- _context3.next = 38;
651
+ _context4.next = 38;
576
652
  return ar.postItems(item, _test.su.jwk);
577
653
  case 38:
578
- _context3.prev = 38;
654
+ _context4.prev = 38;
579
655
  data = (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";
580
656
  _tags = _opt.tags;
581
- from = (_ref8 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref8 !== void 0 ? _ref8 : owner;
657
+ from = (_ref9 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref9 !== void 0 ? _ref9 : owner;
582
658
  if (!_opt.item) {
583
- _context3.next = 59;
659
+ _context4.next = 59;
584
660
  break;
585
661
  }
586
- _context3.prev = 43;
662
+ _context4.prev = 43;
587
663
  data = _base64url["default"].decode(_opt.item.data);
588
664
  _tags = _opt.item.tags;
589
665
  if (from) {
590
- _context3.next = 54;
666
+ _context4.next = 54;
591
667
  break;
592
668
  }
593
669
  raw_owner = _opt.item.rawOwner;
594
- _context3.t11 = Buffer;
595
- _context3.next = 51;
670
+ _context4.t11 = Buffer;
671
+ _context4.next = 51;
596
672
  return _crypto["default"].subtle.digest("SHA-256", raw_owner);
597
673
  case 51:
598
- _context3.t12 = _context3.sent;
599
- hashBuffer = _context3.t11.from.call(_context3.t11, _context3.t12);
674
+ _context4.t12 = _context4.sent;
675
+ hashBuffer = _context4.t11.from.call(_context4.t11, _context4.t12);
600
676
  from = _base64url["default"].encode(hashBuffer);
601
677
  case 54:
602
- _context3.next = 59;
678
+ _context4.next = 59;
603
679
  break;
604
680
  case 56:
605
- _context3.prev = 56;
606
- _context3.t13 = _context3["catch"](43);
607
- console.log(_context3.t13);
681
+ _context4.prev = 56;
682
+ _context4.t13 = _context4["catch"](43);
683
+ console.log(_context4.t13);
608
684
  case 59:
609
- _context3.next = 61;
685
+ _context4.next = 61;
610
686
  return genMsg(opt.message, p, data, _tags, from, _test.mu.addr);
611
687
  case 61:
612
- msg = _context3.sent;
613
- _env = genEnv({
688
+ msg = _context4.sent;
689
+ _context4.next = 64;
690
+ return genEnv({
614
691
  pid: p.id,
615
692
  owner: p.owner,
616
- module: p.module,
617
- auth: _test.mu.addr
693
+ module: p.module
618
694
  });
695
+ case 64:
696
+ _env = _context4.sent;
619
697
  if (p.handle) {
620
- _context3.next = 84;
698
+ _context4.next = 86;
621
699
  break;
622
700
  }
623
- _context3.next = 66;
701
+ _context4.next = 68;
624
702
  return mem.getWasm(p.modulea);
625
- case 66:
626
- _yield$mem$getWasm2 = _context3.sent;
703
+ case 68:
704
+ _yield$mem$getWasm2 = _context4.sent;
627
705
  format = _yield$mem$getWasm2.format;
628
706
  mod = _yield$mem$getWasm2.mod;
629
707
  wasm = _yield$mem$getWasm2.wasm;
630
708
  wdrive = extensions[p.extention];
631
- _context3.t14 = _aoLoader["default"];
632
- _context3.t15 = wasm;
633
- _context3.t16 = format;
634
- _context3.t17 = wdrive;
635
- _context3.t18 = new DataItem(p.item);
636
- _context3.next = 78;
709
+ _context4.t14 = _aoLoader["default"];
710
+ _context4.t15 = wasm;
711
+ _context4.t16 = format;
712
+ _context4.t17 = wdrive;
713
+ _context4.t18 = new DataItem(p.item);
714
+ _context4.next = 80;
637
715
  return mem.get("txs", mod);
638
- case 78:
639
- _context3.t19 = _context3.sent;
640
- _context3.t20 = {
641
- format: _context3.t16,
642
- WeaveDrive: _context3.t17,
643
- spawn: _context3.t18,
644
- module: _context3.t19
716
+ case 80:
717
+ _context4.t19 = _context4.sent;
718
+ _context4.t20 = {
719
+ format: _context4.t16,
720
+ WeaveDrive: _context4.t17,
721
+ spawn: _context4.t18,
722
+ module: _context4.t19
645
723
  };
646
- _context3.next = 82;
647
- return (0, _context3.t14)(_context3.t15, _context3.t20);
648
- case 82:
649
- p.handle = _context3.sent;
650
- mem.env[opt.process].handle = p.handle;
724
+ _context4.next = 84;
725
+ return (0, _context4.t14)(_context4.t15, _context4.t20);
651
726
  case 84:
652
- _context3.next = 86;
653
- return p.handle(p.memory, msg, _env);
727
+ p.handle = _context4.sent;
728
+ mem.env[opt.process].handle = p.handle;
654
729
  case 86:
655
- res = _context3.sent;
730
+ _context4.next = 88;
731
+ return p.handle(p.memory, msg, _env);
732
+ case 88:
733
+ res = _context4.sent;
656
734
  p.memory = res.Memory;
657
735
  delete res.Memory;
658
736
  p.res[opt.message] = res;
@@ -660,29 +738,29 @@ var connect = exports.connect = function connect(mem) {
660
738
  p.txs.unshift(_objectSpread({
661
739
  id: id
662
740
  }, opt));
663
- _context3.next = 94;
741
+ _context4.next = 96;
664
742
  return mem.set(p, "env", opt.process);
665
- case 94:
666
- _context3.next = 96;
667
- return mem.set(_opt, "msgs", opt.message);
668
743
  case 96:
744
+ _context4.next = 98;
745
+ return mem.set(_opt, "msgs", opt.message);
746
+ case 98:
669
747
  _iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
670
- _context3.prev = 97;
748
+ _context4.prev = 99;
671
749
  _iterator2.s();
672
- case 99:
750
+ case 101:
673
751
  if ((_step2 = _iterator2.n()).done) {
674
- _context3.next = 108;
752
+ _context4.next = 110;
675
753
  break;
676
754
  }
677
755
  v = _step2.value;
678
- _context3.next = 103;
756
+ _context4.next = 105;
679
757
  return mem.get("env", v.Target);
680
- case 103:
681
- if (!_context3.sent) {
682
- _context3.next = 106;
758
+ case 105:
759
+ if (!_context4.sent) {
760
+ _context4.next = 108;
683
761
  break;
684
762
  }
685
- _context3.next = 106;
763
+ _context4.next = 108;
686
764
  return message({
687
765
  process: v.Target,
688
766
  tags: v.Tags,
@@ -690,32 +768,32 @@ var connect = exports.connect = function connect(mem) {
690
768
  signer: _test.mu.signer,
691
769
  from: opt.process
692
770
  });
693
- case 106:
694
- _context3.next = 99;
695
- break;
696
771
  case 108:
697
- _context3.next = 113;
772
+ _context4.next = 101;
698
773
  break;
699
774
  case 110:
700
- _context3.prev = 110;
701
- _context3.t21 = _context3["catch"](97);
702
- _iterator2.e(_context3.t21);
703
- case 113:
704
- _context3.prev = 113;
775
+ _context4.next = 115;
776
+ break;
777
+ case 112:
778
+ _context4.prev = 112;
779
+ _context4.t21 = _context4["catch"](99);
780
+ _iterator2.e(_context4.t21);
781
+ case 115:
782
+ _context4.prev = 115;
705
783
  _iterator2.f();
706
- return _context3.finish(113);
707
- case 116:
784
+ return _context4.finish(115);
785
+ case 118:
708
786
  _iterator3 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
709
- _context3.prev = 117;
787
+ _context4.prev = 119;
710
788
  _iterator3.s();
711
- case 119:
789
+ case 121:
712
790
  if ((_step3 = _iterator3.n()).done) {
713
- _context3.next = 126;
791
+ _context4.next = 128;
714
792
  break;
715
793
  }
716
794
  _v = _step3.value;
717
795
  __tags = (0, _utils.tags)(_v.Tags);
718
- _context3.next = 124;
796
+ _context4.next = 126;
719
797
  return spawn({
720
798
  module: __tags.Module,
721
799
  scheduler: _test.scheduler,
@@ -724,115 +802,115 @@ var connect = exports.connect = function connect(mem) {
724
802
  from: __tags["From-Process"],
725
803
  signer: _test.mu.signer
726
804
  });
727
- case 124:
728
- _context3.next = 119;
729
- break;
730
805
  case 126:
731
- _context3.next = 131;
806
+ _context4.next = 121;
732
807
  break;
733
808
  case 128:
734
- _context3.prev = 128;
735
- _context3.t22 = _context3["catch"](117);
736
- _iterator3.e(_context3.t22);
737
- case 131:
738
- _context3.prev = 131;
809
+ _context4.next = 133;
810
+ break;
811
+ case 130:
812
+ _context4.prev = 130;
813
+ _context4.t22 = _context4["catch"](119);
814
+ _iterator3.e(_context4.t22);
815
+ case 133:
816
+ _context4.prev = 133;
739
817
  _iterator3.f();
740
- return _context3.finish(131);
741
- case 134:
818
+ return _context4.finish(133);
819
+ case 136:
742
820
  _iterator4 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
743
- _context3.prev = 135;
821
+ _context4.prev = 137;
744
822
  _iterator4.s();
745
- case 137:
823
+ case 139:
746
824
  if ((_step4 = _iterator4.n()).done) {
747
- _context3.next = 158;
825
+ _context4.next = 160;
748
826
  break;
749
827
  }
750
828
  _v2 = _step4.value;
751
829
  _iterator5 = _createForOfIteratorHelper(_v2.Processes);
752
- _context3.prev = 140;
830
+ _context4.prev = 142;
753
831
  _iterator5.s();
754
- case 142:
832
+ case 144:
755
833
  if ((_step5 = _iterator5.n()).done) {
756
- _context3.next = 148;
834
+ _context4.next = 150;
757
835
  break;
758
836
  }
759
837
  v2 = _step5.value;
760
- _context3.next = 146;
838
+ _context4.next = 148;
761
839
  return _assign({
762
840
  message: _v2.Message,
763
841
  process: v2,
764
842
  from: opt.process,
765
843
  signer: _test.mu.signer
766
844
  });
767
- case 146:
768
- _context3.next = 142;
769
- break;
770
845
  case 148:
771
- _context3.next = 153;
846
+ _context4.next = 144;
772
847
  break;
773
848
  case 150:
774
- _context3.prev = 150;
775
- _context3.t23 = _context3["catch"](140);
776
- _iterator5.e(_context3.t23);
777
- case 153:
778
- _context3.prev = 153;
779
- _iterator5.f();
780
- return _context3.finish(153);
781
- case 156:
782
- _context3.next = 137;
849
+ _context4.next = 155;
783
850
  break;
851
+ case 152:
852
+ _context4.prev = 152;
853
+ _context4.t23 = _context4["catch"](142);
854
+ _iterator5.e(_context4.t23);
855
+ case 155:
856
+ _context4.prev = 155;
857
+ _iterator5.f();
858
+ return _context4.finish(155);
784
859
  case 158:
785
- _context3.next = 163;
860
+ _context4.next = 139;
786
861
  break;
787
862
  case 160:
788
- _context3.prev = 160;
789
- _context3.t24 = _context3["catch"](135);
790
- _iterator4.e(_context3.t24);
791
- case 163:
792
- _context3.prev = 163;
863
+ _context4.next = 165;
864
+ break;
865
+ case 162:
866
+ _context4.prev = 162;
867
+ _context4.t24 = _context4["catch"](137);
868
+ _iterator4.e(_context4.t24);
869
+ case 165:
870
+ _context4.prev = 165;
793
871
  _iterator4.f();
794
- return _context3.finish(163);
795
- case 166:
796
- return _context3.abrupt("return", id);
797
- case 169:
798
- _context3.prev = 169;
799
- _context3.t25 = _context3["catch"](38);
800
- console.log(_context3.t25);
801
- case 172:
802
- return _context3.abrupt("return", null);
803
- case 173:
872
+ return _context4.finish(165);
873
+ case 168:
874
+ return _context4.abrupt("return", id);
875
+ case 171:
876
+ _context4.prev = 171;
877
+ _context4.t25 = _context4["catch"](38);
878
+ console.log(_context4.t25);
879
+ case 174:
880
+ return _context4.abrupt("return", null);
881
+ case 175:
804
882
  case "end":
805
- return _context3.stop();
883
+ return _context4.stop();
806
884
  }
807
- }, _callee3, null, [[38, 169], [43, 56], [97, 110, 113, 116], [117, 128, 131, 134], [135, 160, 163, 166], [140, 150, 153, 156]]);
885
+ }, _callee4, null, [[38, 171], [43, 56], [99, 112, 115, 118], [119, 130, 133, 136], [137, 162, 165, 168], [142, 152, 155, 158]]);
808
886
  }));
809
- return function assign(_x7) {
810
- return _ref7.apply(this, arguments);
887
+ return function assign(_x8) {
888
+ return _ref8.apply(this, arguments);
811
889
  };
812
890
  }();
813
891
  var message = /*#__PURE__*/function () {
814
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
892
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
815
893
  var _opt$item$id, _opt$item, _opt$owner;
816
894
  var p, ex, id, owner, item, _opt$tags3, _iterator6, _step6, v, _yield$ar$dataitem3;
817
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
818
- while (1) switch (_context4.prev = _context4.next) {
895
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
896
+ while (1) switch (_context5.prev = _context5.next) {
819
897
  case 0:
820
- _context4.next = 2;
898
+ _context5.next = 2;
821
899
  return mem.get("env", opt.process);
822
900
  case 2:
823
- p = _context4.sent;
901
+ p = _context5.sent;
824
902
  if (p) {
825
- _context4.next = 5;
903
+ _context5.next = 5;
826
904
  break;
827
905
  }
828
- return _context4.abrupt("return", null);
906
+ return _context5.abrupt("return", null);
829
907
  case 5:
830
908
  ex = false;
831
909
  id = (_opt$item$id = opt === null || opt === void 0 || (_opt$item = opt.item) === null || _opt$item === void 0 ? void 0 : _opt$item.id) !== null && _opt$item$id !== void 0 ? _opt$item$id : "";
832
910
  owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
833
911
  item = opt.item;
834
912
  if (!(!opt.item && opt.signer)) {
835
- _context4.next = 19;
913
+ _context5.next = 19;
836
914
  break;
837
915
  }
838
916
  _iterator6 = _createForOfIteratorHelper(opt.tags);
@@ -852,7 +930,7 @@ var connect = exports.connect = function connect(mem) {
852
930
  Type: "Message",
853
931
  SDK: "aoconnect"
854
932
  }));
855
- _context4.next = 15;
933
+ _context5.next = 15;
856
934
  return ar.dataitem({
857
935
  data: opt.data,
858
936
  signer: opt.signer,
@@ -860,15 +938,15 @@ var connect = exports.connect = function connect(mem) {
860
938
  target: opt.process
861
939
  });
862
940
  case 15:
863
- _yield$ar$dataitem3 = _context4.sent;
941
+ _yield$ar$dataitem3 = _context5.sent;
864
942
  item = _yield$ar$dataitem3.item;
865
943
  id = _yield$ar$dataitem3.id;
866
944
  owner = _yield$ar$dataitem3.owner;
867
945
  case 19:
868
- _context4.next = 21;
946
+ _context5.next = 21;
869
947
  return mem.set(opt, "msgs", id);
870
948
  case 21:
871
- _context4.next = 23;
949
+ _context5.next = 23;
872
950
  return _assign({
873
951
  message_item: item,
874
952
  message: id,
@@ -877,60 +955,60 @@ var connect = exports.connect = function connect(mem) {
877
955
  signer: _test.mu.signer
878
956
  });
879
957
  case 23:
880
- return _context4.abrupt("return", id);
958
+ return _context5.abrupt("return", id);
881
959
  case 24:
882
960
  case "end":
883
- return _context4.stop();
961
+ return _context5.stop();
884
962
  }
885
- }, _callee4);
963
+ }, _callee5);
886
964
  }));
887
- return function message(_x8) {
888
- return _ref9.apply(this, arguments);
965
+ return function message(_x9) {
966
+ return _ref10.apply(this, arguments);
889
967
  };
890
968
  }();
891
969
  return {
892
970
  message: message,
893
971
  unmonitor: function () {
894
- var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
972
+ var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
895
973
  var p;
896
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
897
- while (1) switch (_context5.prev = _context5.next) {
974
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
975
+ while (1) switch (_context6.prev = _context6.next) {
898
976
  case 0:
899
- _context5.next = 2;
977
+ _context6.next = 2;
900
978
  return mem.get("env", opt.process);
901
979
  case 2:
902
- p = _context5.sent;
980
+ p = _context6.sent;
903
981
  try {
904
982
  clearInterval(p.cron);
905
983
  p.cron = null;
906
984
  } catch (e) {}
907
985
  case 4:
908
986
  case "end":
909
- return _context5.stop();
987
+ return _context6.stop();
910
988
  }
911
- }, _callee5);
989
+ }, _callee6);
912
990
  }));
913
- function unmonitor(_x9) {
991
+ function unmonitor(_x10) {
914
992
  return _unmonitor.apply(this, arguments);
915
993
  }
916
994
  return unmonitor;
917
995
  }(),
918
996
  monitor: function () {
919
- var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
997
+ var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
920
998
  var p;
921
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
922
- while (1) switch (_context7.prev = _context7.next) {
999
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1000
+ while (1) switch (_context8.prev = _context8.next) {
923
1001
  case 0:
924
- _context7.next = 2;
1002
+ _context8.next = 2;
925
1003
  return mem.get("env", opt.process);
926
1004
  case 2:
927
- p = _context7.sent;
1005
+ p = _context8.sent;
928
1006
  if ((0, _ramda.isNil)(p.cron)) {
929
- p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
930
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
931
- while (1) switch (_context6.prev = _context6.next) {
1007
+ p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
1008
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1009
+ while (1) switch (_context7.prev = _context7.next) {
932
1010
  case 0:
933
- _context6.next = 2;
1011
+ _context7.next = 2;
934
1012
  return message({
935
1013
  tags: p.cronTags,
936
1014
  process: opt.process,
@@ -939,18 +1017,18 @@ var connect = exports.connect = function connect(mem) {
939
1017
  });
940
1018
  case 2:
941
1019
  case "end":
942
- return _context6.stop();
1020
+ return _context7.stop();
943
1021
  }
944
- }, _callee6);
1022
+ }, _callee7);
945
1023
  })), p.span);
946
1024
  }
947
1025
  case 4:
948
1026
  case "end":
949
- return _context7.stop();
1027
+ return _context8.stop();
950
1028
  }
951
- }, _callee7);
1029
+ }, _callee8);
952
1030
  }));
953
- function monitor(_x10) {
1031
+ function monitor(_x11) {
954
1032
  return _monitor.apply(this, arguments);
955
1033
  }
956
1034
  return monitor;
@@ -959,47 +1037,47 @@ var connect = exports.connect = function connect(mem) {
959
1037
  assign: _assign,
960
1038
  ar: ar,
961
1039
  result: function () {
962
- var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
963
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
964
- while (1) switch (_context8.prev = _context8.next) {
1040
+ var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
1041
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1042
+ while (1) switch (_context9.prev = _context9.next) {
965
1043
  case 0:
966
- _context8.next = 2;
1044
+ _context9.next = 2;
967
1045
  return mem.get("env", opt.process);
968
1046
  case 2:
969
- _context8.t0 = opt.message;
970
- return _context8.abrupt("return", _context8.sent.res[_context8.t0]);
1047
+ _context9.t0 = opt.message;
1048
+ return _context9.abrupt("return", _context9.sent.res[_context9.t0]);
971
1049
  case 4:
972
1050
  case "end":
973
- return _context8.stop();
1051
+ return _context9.stop();
974
1052
  }
975
- }, _callee8);
1053
+ }, _callee9);
976
1054
  }));
977
- function result(_x11) {
1055
+ function result(_x12) {
978
1056
  return _result.apply(this, arguments);
979
1057
  }
980
1058
  return result;
981
1059
  }(),
982
1060
  results: function () {
983
- var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
1061
+ var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
984
1062
  var _opt$limit;
985
1063
  var p, results, limit, i, _i;
986
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
987
- while (1) switch (_context9.prev = _context9.next) {
1064
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1065
+ while (1) switch (_context10.prev = _context10.next) {
988
1066
  case 0:
989
- _context9.next = 2;
1067
+ _context10.next = 2;
990
1068
  return mem.get("env", opt.process);
991
1069
  case 2:
992
- p = _context9.sent;
1070
+ p = _context10.sent;
993
1071
  results = [];
994
1072
  limit = (_opt$limit = opt.limit) !== null && _opt$limit !== void 0 ? _opt$limit : 25;
995
1073
  if (!(opt.sort === "DESC")) {
996
- _context9.next = 16;
1074
+ _context10.next = 16;
997
1075
  break;
998
1076
  }
999
1077
  i = p.results.length - 1;
1000
1078
  case 7:
1001
1079
  if (!(0 < i)) {
1002
- _context9.next = 14;
1080
+ _context10.next = 14;
1003
1081
  break;
1004
1082
  }
1005
1083
  results.push({
@@ -1007,85 +1085,85 @@ var connect = exports.connect = function connect(mem) {
1007
1085
  node: p.res[p.results[i]]
1008
1086
  });
1009
1087
  if (!(results.length >= limit)) {
1010
- _context9.next = 11;
1088
+ _context10.next = 11;
1011
1089
  break;
1012
1090
  }
1013
- return _context9.abrupt("break", 14);
1091
+ return _context10.abrupt("break", 14);
1014
1092
  case 11:
1015
1093
  i--;
1016
- _context9.next = 7;
1094
+ _context10.next = 7;
1017
1095
  break;
1018
1096
  case 14:
1019
- _context9.next = 24;
1097
+ _context10.next = 24;
1020
1098
  break;
1021
1099
  case 16:
1022
1100
  _i = 0;
1023
1101
  case 17:
1024
1102
  if (!(_i < p.results.length)) {
1025
- _context9.next = 24;
1103
+ _context10.next = 24;
1026
1104
  break;
1027
1105
  }
1028
1106
  results.push({
1029
1107
  node: p.res[p.results[_i]]
1030
1108
  });
1031
1109
  if (!(results.length >= limit)) {
1032
- _context9.next = 21;
1110
+ _context10.next = 21;
1033
1111
  break;
1034
1112
  }
1035
- return _context9.abrupt("break", 24);
1113
+ return _context10.abrupt("break", 24);
1036
1114
  case 21:
1037
1115
  _i++;
1038
- _context9.next = 17;
1116
+ _context10.next = 17;
1039
1117
  break;
1040
1118
  case 24:
1041
- return _context9.abrupt("return", {
1119
+ return _context10.abrupt("return", {
1042
1120
  edges: results
1043
1121
  });
1044
1122
  case 25:
1045
1123
  case "end":
1046
- return _context9.stop();
1124
+ return _context10.stop();
1047
1125
  }
1048
- }, _callee9);
1126
+ }, _callee10);
1049
1127
  }));
1050
- function results(_x12) {
1128
+ function results(_x13) {
1051
1129
  return _results.apply(this, arguments);
1052
1130
  }
1053
1131
  return results;
1054
1132
  }(),
1055
1133
  dryrun: function () {
1056
- var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
1134
+ var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(opt) {
1057
1135
  var _opt$id, _opt$owner2;
1058
1136
  var p, id, owner, _yield$ar$dataitem4, _opt$data3, cloneMemory, msg, _env, _yield$mem$getWasm3, format, mod, wasm, wdrive, res;
1059
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1060
- while (1) switch (_context10.prev = _context10.next) {
1137
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1138
+ while (1) switch (_context11.prev = _context11.next) {
1061
1139
  case 0:
1062
- _context10.next = 2;
1140
+ _context11.next = 2;
1063
1141
  return mem.get("env", opt.process);
1064
1142
  case 2:
1065
- p = _context10.sent;
1143
+ p = _context11.sent;
1066
1144
  if (p) {
1067
- _context10.next = 5;
1145
+ _context11.next = 5;
1068
1146
  break;
1069
1147
  }
1070
- return _context10.abrupt("return", null);
1148
+ return _context11.abrupt("return", null);
1071
1149
  case 5:
1072
1150
  id = (_opt$id = opt.id) !== null && _opt$id !== void 0 ? _opt$id : "";
1073
1151
  owner = (_opt$owner2 = opt.owner) !== null && _opt$owner2 !== void 0 ? _opt$owner2 : "";
1074
1152
  if (!(!opt.id && opt.signer)) {
1075
- _context10.next = 14;
1153
+ _context11.next = 14;
1076
1154
  break;
1077
1155
  }
1078
1156
  ;
1079
- _context10.next = 11;
1157
+ _context11.next = 11;
1080
1158
  return ar.dataitem(_objectSpread(_objectSpread({}, opt), {}, {
1081
1159
  target: opt.process
1082
1160
  }));
1083
1161
  case 11:
1084
- _yield$ar$dataitem4 = _context10.sent;
1162
+ _yield$ar$dataitem4 = _context11.sent;
1085
1163
  id = _yield$ar$dataitem4.id;
1086
1164
  owner = _yield$ar$dataitem4.owner;
1087
1165
  case 14:
1088
- _context10.prev = 14;
1166
+ _context11.prev = 14;
1089
1167
  cloneMemory = function cloneMemory(memory) {
1090
1168
  var buffer = memory.buffer.slice(0);
1091
1169
  return new WebAssembly.Memory({
@@ -1094,67 +1172,69 @@ var connect = exports.connect = function connect(mem) {
1094
1172
  shared: memory.shared || false
1095
1173
  });
1096
1174
  };
1097
- _context10.next = 18;
1175
+ _context11.next = 18;
1098
1176
  return genMsg(id, p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, _test.mu.addr, true);
1099
1177
  case 18:
1100
- msg = _context10.sent;
1101
- _env = genEnv({
1178
+ msg = _context11.sent;
1179
+ _context11.next = 21;
1180
+ return genEnv({
1102
1181
  pid: p.id,
1103
1182
  owner: p.owner,
1104
- module: p.module,
1105
- auth: _test.mu.addr
1183
+ module: p.module
1106
1184
  });
1185
+ case 21:
1186
+ _env = _context11.sent;
1107
1187
  if (p.handle) {
1108
- _context10.next = 41;
1188
+ _context11.next = 43;
1109
1189
  break;
1110
1190
  }
1111
- _context10.next = 23;
1191
+ _context11.next = 25;
1112
1192
  return mem.getWasm(p.modulea);
1113
- case 23:
1114
- _yield$mem$getWasm3 = _context10.sent;
1193
+ case 25:
1194
+ _yield$mem$getWasm3 = _context11.sent;
1115
1195
  format = _yield$mem$getWasm3.format;
1116
1196
  mod = _yield$mem$getWasm3.mod;
1117
1197
  wasm = _yield$mem$getWasm3.wasm;
1118
1198
  wdrive = extensions[p.extention];
1119
- _context10.t0 = _aoLoader["default"];
1120
- _context10.t1 = wasm;
1121
- _context10.t2 = format;
1122
- _context10.t3 = wdrive;
1123
- _context10.t4 = new DataItem(p.item);
1124
- _context10.next = 35;
1199
+ _context11.t0 = _aoLoader["default"];
1200
+ _context11.t1 = wasm;
1201
+ _context11.t2 = format;
1202
+ _context11.t3 = wdrive;
1203
+ _context11.t4 = new DataItem(p.item);
1204
+ _context11.next = 37;
1125
1205
  return mem.get("txs", mod);
1126
- case 35:
1127
- _context10.t5 = _context10.sent;
1128
- _context10.t6 = {
1129
- format: _context10.t2,
1130
- WeaveDrive: _context10.t3,
1131
- spawn: _context10.t4,
1132
- module: _context10.t5
1206
+ case 37:
1207
+ _context11.t5 = _context11.sent;
1208
+ _context11.t6 = {
1209
+ format: _context11.t2,
1210
+ WeaveDrive: _context11.t3,
1211
+ spawn: _context11.t4,
1212
+ module: _context11.t5
1133
1213
  };
1134
- _context10.next = 39;
1135
- return (0, _context10.t0)(_context10.t1, _context10.t6);
1136
- case 39:
1137
- p.handle = _context10.sent;
1138
- mem.env[opt.process].handle = p.handle;
1214
+ _context11.next = 41;
1215
+ return (0, _context11.t0)(_context11.t1, _context11.t6);
1139
1216
  case 41:
1140
- _context10.next = 43;
1141
- return p.handle(p.memory, msg, _env);
1217
+ p.handle = _context11.sent;
1218
+ mem.env[opt.process].handle = p.handle;
1142
1219
  case 43:
1143
- res = _context10.sent;
1144
- return _context10.abrupt("return", res);
1145
- case 47:
1146
- _context10.prev = 47;
1147
- _context10.t7 = _context10["catch"](14);
1148
- console.log(_context10.t7);
1149
- case 50:
1150
- return _context10.abrupt("return", null);
1151
- case 51:
1220
+ _context11.next = 45;
1221
+ return p.handle(p.memory, msg, _env);
1222
+ case 45:
1223
+ res = _context11.sent;
1224
+ return _context11.abrupt("return", res);
1225
+ case 49:
1226
+ _context11.prev = 49;
1227
+ _context11.t7 = _context11["catch"](14);
1228
+ console.log(_context11.t7);
1229
+ case 52:
1230
+ return _context11.abrupt("return", null);
1231
+ case 53:
1152
1232
  case "end":
1153
- return _context10.stop();
1233
+ return _context11.stop();
1154
1234
  }
1155
- }, _callee10, null, [[14, 47]]);
1235
+ }, _callee11, null, [[14, 49]]);
1156
1236
  }));
1157
- function dryrun(_x13) {
1237
+ function dryrun(_x14) {
1158
1238
  return _dryrun.apply(this, arguments);
1159
1239
  }
1160
1240
  return dryrun;