wao 0.16.5 → 0.17.0

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 CHANGED
@@ -7,7 +7,7 @@ exports["default"] = void 0;
7
7
  var WarpArBundles = _interopRequireWildcard(require("warp-arbundles"));
8
8
  var _ar4 = _interopRequireDefault(require("./ar.js"));
9
9
  var _md = _interopRequireDefault(require("md5"));
10
- var _aoconnect = require("@permaweb/aoconnect");
10
+ var _aoconnectWao = require("aoconnect-wao");
11
11
  var _ramda = require("ramda");
12
12
  var _utils = require("./utils.js");
13
13
  var _WarpArBundles$defaul;
@@ -122,6 +122,7 @@ var AO = /*#__PURE__*/function () {
122
122
  port: _port
123
123
  };
124
124
  this.wao = opt.wao;
125
+ this.variant = opt.variant;
125
126
  if ((0, _ramda.isNil)(this.wao)) this.wao = in_memory || !(0, _ramda.isNil)((_ar2 = ar) === null || _ar2 === void 0 ? void 0 : _ar2.port);
126
127
  if (!module) {
127
128
  switch (module_type) {
@@ -141,7 +142,7 @@ var AO = /*#__PURE__*/function () {
141
142
  this.ar = new _ar4["default"](_ar);
142
143
  }
143
144
  if (!in_memory && aoconnect) {
144
- var _connect = (0, _aoconnect.connect)(aoconnect),
145
+ var _connect = (0, _aoconnectWao.connect)(aoconnect),
145
146
  _results = _connect.results,
146
147
  _assign = _connect.assign,
147
148
  _result = _connect.result,
@@ -159,14 +160,14 @@ var AO = /*#__PURE__*/function () {
159
160
  this.monitor = _monitor;
160
161
  this.unmonitor = _unmonitor;
161
162
  } else {
162
- this.assign = _aoconnect.assign;
163
- this.result = _aoconnect.result;
164
- this.results = _aoconnect.results;
165
- this.message = _aoconnect.message;
166
- this.spawn = _aoconnect.spawn;
167
- this.dryrun = _aoconnect.dryrun;
168
- this.monitor = _aoconnect.monitor;
169
- this.unmonitor = _aoconnect.unmonitor;
163
+ this.assign = _aoconnectWao.assign;
164
+ this.result = _aoconnectWao.result;
165
+ this.results = _aoconnectWao.results;
166
+ this.message = _aoconnectWao.message;
167
+ this.spawn = _aoconnectWao.spawn;
168
+ this.dryrun = _aoconnectWao.dryrun;
169
+ this.monitor = _aoconnectWao.monitor;
170
+ this.unmonitor = _aoconnectWao.unmonitor;
170
171
  }
171
172
  if (this.wao) {
172
173
  this.module = _utils.srcs.module_wao;
@@ -206,9 +207,9 @@ var AO = /*#__PURE__*/function () {
206
207
  if (wallet !== null && wallet !== void 0 && wallet.n && typeof window !== "undefined") {
207
208
  return createDataItemSigner2(wallet);
208
209
  } else if (wallet.test) {
209
- return (0, _aoconnect.createDataItemSigner)(wallet.jwk);
210
+ return (0, _aoconnectWao.createDataItemSigner)(wallet.jwk);
210
211
  } else {
211
- return (0, _aoconnect.createDataItemSigner)(wallet);
212
+ return (0, _aoconnectWao.createDataItemSigner)(wallet);
212
213
  }
213
214
  }
214
215
  }, {
@@ -427,15 +428,17 @@ var AO = /*#__PURE__*/function () {
427
428
  key: "postModule",
428
429
  value: function () {
429
430
  var _postModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
430
- var _this = this;
431
+ var _this$protocol,
432
+ _this$variant,
433
+ _this = this;
431
434
  var data, jwk, _ref6$tags, tags, _ref6$overwrite, overwrite, _tags, fns;
432
435
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
433
436
  while (1) switch (_context5.prev = _context5.next) {
434
437
  case 0:
435
438
  data = _ref6.data, jwk = _ref6.jwk, _ref6$tags = _ref6.tags, tags = _ref6$tags === void 0 ? {} : _ref6$tags, _ref6$overwrite = _ref6.overwrite, overwrite = _ref6$overwrite === void 0 ? false : _ref6$overwrite;
436
439
  _tags = (0, _ramda.mergeLeft)(tags, {
437
- "Data-Protocol": "ao",
438
- Variant: "ao.TN.1",
440
+ "Data-Protocol": (_this$protocol = this.protocol) !== null && _this$protocol !== void 0 ? _this$protocol : "ao",
441
+ Variant: (_this$variant = this.variant) !== null && _this$variant !== void 0 ? _this$variant : "ao.TN.1",
439
442
  Type: "Module",
440
443
  "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
441
444
  "Input-Encoding": "JSON-V1",
@@ -477,15 +480,17 @@ var AO = /*#__PURE__*/function () {
477
480
  key: "postScheduler",
478
481
  value: function () {
479
482
  var _postScheduler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref8) {
480
- var _this2 = this;
483
+ var _this$protocol2,
484
+ _this$variant2,
485
+ _this2 = this;
481
486
  var jwk, url, _ref8$tags, tags, _ref8$overwrite, overwrite, _tags, then, fns;
482
487
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
483
488
  while (1) switch (_context7.prev = _context7.next) {
484
489
  case 0:
485
490
  jwk = _ref8.jwk, url = _ref8.url, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, _ref8$overwrite = _ref8.overwrite, overwrite = _ref8$overwrite === void 0 ? false : _ref8$overwrite;
486
491
  _tags = (0, _ramda.mergeLeft)(tags, {
487
- "Data-Protocol": "ao",
488
- Variant: "ao.TN.1",
492
+ "Data-Protocol": (_this$protocol2 = this.protocol) !== null && _this$protocol2 !== void 0 ? _this$protocol2 : "ao",
493
+ Variant: (_this$variant2 = this.variant) !== null && _this$variant2 !== void 0 ? _this$variant2 : "ao.TN.1",
489
494
  Type: "Scheduler-Location",
490
495
  Url: url,
491
496
  "Time-To-Live": "3600000"
@@ -588,6 +593,7 @@ var AO = /*#__PURE__*/function () {
588
593
  _tags = (0, _utils.buildTags)(null, tags);
589
594
  _context8.next = 17;
590
595
  return this.spawn({
596
+ variant: this.variant,
591
597
  memory: memory,
592
598
  module: module,
593
599
  scheduler: scheduler,
@@ -991,6 +997,7 @@ var AO = /*#__PURE__*/function () {
991
997
  _tags = (0, _utils.buildTags)(act, tags);
992
998
  _context12.next = 11;
993
999
  return this.message({
1000
+ variant: this.variant,
994
1001
  process: pid,
995
1002
  signer: this.toSigner(jwk),
996
1003
  tags: _tags,
@@ -5,16 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
+ var _arweave = _interopRequireDefault(require("arweave"));
8
9
  var WarpArBundles = _interopRequireWildcard(require("warp-arbundles"));
9
10
  var _crypto = _interopRequireDefault(require("crypto"));
10
11
  var _base64url = _interopRequireDefault(require("base64url"));
11
12
  var _utils = require("./utils.js");
12
13
  var _weavedrive = _interopRequireDefault(require("./weavedrive.js"));
13
14
  var _ramda = require("ramda");
14
- var _WarpArBundles$defaul;
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
15
+ var _Arweave$default, _WarpArBundles$defaul;
16
16
  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); }
17
17
  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; }
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
19
  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; }
19
20
  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; }
20
21
  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; }
@@ -30,6 +31,8 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
30
31
  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; }
31
32
  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; } }
32
33
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
34
+ var Arweave = (_Arweave$default = _arweave["default"]["default"]) !== null && _Arweave$default !== void 0 ? _Arweave$default : _arweave["default"];
35
+ var arweave = Arweave.init();
33
36
  var pkg = (_WarpArBundles$defaul = WarpArBundles["default"]) !== null && _WarpArBundles$defaul !== void 0 ? _WarpArBundles$defaul : WarpArBundles;
34
37
  var DataItem = pkg.DataItem;
35
38
  var onRecovery = {};
@@ -52,7 +55,8 @@ var _default = exports["default"] = function _default() {
52
55
  log = _ref2$log === void 0 ? false : _ref2$log,
53
56
  _ref2$extensions = _ref2.extensions,
54
57
  extensions = _ref2$extensions === void 0 ? {} : _ref2$extensions,
55
- hb = _ref2.hb;
58
+ hb = _ref2.hb,
59
+ variant = _ref2.variant;
56
60
  var isMem = ((_mem = mem) === null || _mem === void 0 ? void 0 : _mem.__type__) === "mem";
57
61
  if (!isMem) {
58
62
  var _mem2;
@@ -60,8 +64,9 @@ var _default = exports["default"] = function _default() {
60
64
  cache: cache
61
65
  };
62
66
  if ((_mem2 = mem) !== null && _mem2 !== void 0 && _mem2.SU_URL) {
63
- args = (0, _ramda.mergeLeft)(mem, args);
64
67
  args.scheduler = scheduler;
68
+ args.variant = variant;
69
+ args = (0, _ramda.mergeLeft)(mem, args);
65
70
  }
66
71
  mem = new ArMem(args);
67
72
  }
@@ -398,9 +403,8 @@ var _default = exports["default"] = function _default() {
398
403
  case 37:
399
404
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : []), {
400
405
  "Data-Protocol": "ao",
401
- Variant: "ao.TN.1",
406
+ Variant: variant !== null && variant !== void 0 ? variant : "ao.TN.1",
402
407
  Type: "Process",
403
- SDK: "aoconnect",
404
408
  Module: mod,
405
409
  Scheduler: opt.scheduler,
406
410
  "Content-Type": "text/plain",
@@ -664,7 +668,7 @@ var _default = exports["default"] = function _default() {
664
668
  var _assign = /*#__PURE__*/function () {
665
669
  var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
666
670
  var _opt$tags2;
667
- var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref10, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, raw_owner, hashBuffer, msg, _env, _yield$mem$getTx3, _yield$mem$getWasm2, format, mod, wasm, wdrive, start, res, _msg, _iterator3, _step3, v, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
671
+ var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref10, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, msg, _env, _yield$mem$getTx3, _yield$mem$getWasm2, format, mod, wasm, wdrive, start, res, _msg, _iterator3, _step3, v, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
668
672
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
669
673
  while (1) switch (_context4.prev = _context4.next) {
670
674
  case 0:
@@ -694,189 +698,181 @@ var _default = exports["default"] = function _default() {
694
698
  _context4.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
695
699
  _context4.t3 = Date.now();
696
700
  _context4.t4 = p.epochs.length;
697
- _context4.next = 18;
701
+ _context4.t5 = variant !== null && variant !== void 0 ? variant : "ao.TN.1";
702
+ _context4.next = 19;
698
703
  return mem.get("height");
699
- case 18:
700
- _context4.t5 = _context4.sent;
701
- _context4.t6 = opt.process;
702
- _context4.t7 = opt.message;
703
- _context4.t8 = hash;
704
- _context4.t9 = {
704
+ case 19:
705
+ _context4.t6 = _context4.sent;
706
+ _context4.t7 = opt.process;
707
+ _context4.t8 = opt.message;
708
+ _context4.t9 = hash;
709
+ _context4.t10 = {
705
710
  Timestamp: _context4.t3,
706
711
  Epoch: _context4.t4,
707
712
  Nonce: "0",
708
713
  "Data-Protocol": "ao",
709
- Variant: "ao.TN.1",
710
- SDK: "aoconnect",
714
+ Variant: _context4.t5,
711
715
  Type: "Assignment",
712
- "Block-Height": _context4.t5,
713
- Process: _context4.t6,
714
- Message: _context4.t7,
715
- "Hash-Chain": _context4.t8
716
+ "Block-Height": _context4.t6,
717
+ Process: _context4.t7,
718
+ Message: _context4.t8,
719
+ "Hash-Chain": _context4.t9
716
720
  };
717
- _context4.t10 = (0, _context4.t1)(_context4.t2, _context4.t9);
718
- opt.tags = (0, _context4.t0)(null, _context4.t10);
721
+ _context4.t11 = (0, _context4.t1)(_context4.t2, _context4.t10);
722
+ opt.tags = (0, _context4.t0)(null, _context4.t11);
719
723
  p.epochs.push([opt.message]);
720
- _context4.next = 28;
724
+ _context4.next = 29;
721
725
  return ar.dataitem({
722
726
  data: opt.data,
723
727
  signer: opt.signer,
724
728
  tags: (0, _utils.tags)(opt.tags),
725
729
  target: opt.process
726
730
  });
727
- case 28:
731
+ case 29:
728
732
  _yield$ar$dataitem2 = _context4.sent;
729
733
  id = _yield$ar$dataitem2.id;
730
734
  owner = _yield$ar$dataitem2.owner;
731
735
  item = _yield$ar$dataitem2.item;
732
736
  if (!opt.message_item) {
733
- _context4.next = 37;
737
+ _context4.next = 38;
734
738
  break;
735
739
  }
736
- _context4.next = 35;
740
+ _context4.next = 36;
737
741
  return ar.postItems([opt.message_item, item], su.jwk);
738
- case 35:
739
- _context4.next = 39;
742
+ case 36:
743
+ _context4.next = 40;
740
744
  break;
741
- case 37:
742
- _context4.next = 39;
745
+ case 38:
746
+ _context4.next = 40;
743
747
  return ar.postItems(item, su.jwk);
744
- case 39:
745
- _context4.prev = 39;
748
+ case 40:
749
+ _context4.prev = 40;
746
750
  data = (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";
747
751
  _tags = _opt.tags;
748
752
  from = (_ref10 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref10 !== void 0 ? _ref10 : owner;
749
753
  if (!_opt.item) {
750
- _context4.next = 60;
754
+ _context4.next = 51;
751
755
  break;
752
756
  }
753
- _context4.prev = 44;
754
757
  data = _base64url["default"].decode(_opt.item.data);
755
758
  _tags = _opt.item.tags;
756
759
  if (from) {
757
- _context4.next = 55;
760
+ _context4.next = 51;
758
761
  break;
759
762
  }
760
- raw_owner = _opt.item.rawOwner;
761
- _context4.t11 = Buffer;
762
- _context4.next = 52;
763
- return _crypto["default"].subtle.digest("SHA-256", raw_owner);
764
- case 52:
765
- _context4.t12 = _context4.sent;
766
- hashBuffer = _context4.t11.from.call(_context4.t11, _context4.t12);
767
- from = _base64url["default"].encode(hashBuffer);
768
- case 55:
769
- _context4.next = 60;
770
- break;
771
- case 57:
772
- _context4.prev = 57;
773
- _context4.t13 = _context4["catch"](44);
774
- console.log(_context4.t13);
775
- case 60:
776
- _context4.next = 62;
763
+ _context4.next = 50;
764
+ return arweave.wallets.jwkToAddress({
765
+ kty: "RSA",
766
+ n: _opt.item.owner,
767
+ e: "AQAB"
768
+ });
769
+ case 50:
770
+ from = _context4.sent;
771
+ case 51:
772
+ _context4.next = 53;
777
773
  return genMsg(opt.message, p, data, _tags, from, mu.addr);
778
- case 62:
774
+ case 53:
779
775
  msg = _context4.sent;
780
- _context4.next = 65;
776
+ _context4.next = 56;
781
777
  return genEnv({
782
778
  pid: p.id,
783
779
  owner: p.owner,
784
780
  module: p.module
785
781
  });
786
- case 65:
782
+ case 56:
787
783
  _env = _context4.sent;
788
784
  if (p.handle) {
789
- _context4.next = 98;
785
+ _context4.next = 89;
790
786
  break;
791
787
  }
792
- _context4.next = 69;
788
+ _context4.next = 60;
793
789
  return mem.getWasm(p.modulea);
794
- case 69:
790
+ case 60:
795
791
  _yield$mem$getWasm2 = _context4.sent;
796
792
  format = _yield$mem$getWasm2.format;
797
793
  mod = _yield$mem$getWasm2.mod;
798
794
  wasm = _yield$mem$getWasm2.wasm;
799
795
  wdrive = extensions[p.extention];
800
- _context4.t14 = AoLoader;
801
- _context4.t15 = wasm;
802
- _context4.t16 = format;
803
- _context4.t17 = wdrive;
804
- _context4.next = 80;
796
+ _context4.t12 = AoLoader;
797
+ _context4.t13 = wasm;
798
+ _context4.t14 = format;
799
+ _context4.t15 = wdrive;
800
+ _context4.next = 71;
805
801
  return mem.getTx(p.id);
806
- case 80:
807
- _context4.t19 = _yield$mem$getTx3 = _context4.sent;
808
- _context4.t18 = _context4.t19 === null;
809
- if (_context4.t18) {
810
- _context4.next = 84;
802
+ case 71:
803
+ _context4.t17 = _yield$mem$getTx3 = _context4.sent;
804
+ _context4.t16 = _context4.t17 === null;
805
+ if (_context4.t16) {
806
+ _context4.next = 75;
811
807
  break;
812
808
  }
813
- _context4.t18 = _yield$mem$getTx3 === void 0;
814
- case 84:
815
- if (!_context4.t18) {
816
- _context4.next = 88;
809
+ _context4.t16 = _yield$mem$getTx3 === void 0;
810
+ case 75:
811
+ if (!_context4.t16) {
812
+ _context4.next = 79;
817
813
  break;
818
814
  }
819
- _context4.t20 = void 0;
820
- _context4.next = 89;
815
+ _context4.t18 = void 0;
816
+ _context4.next = 80;
821
817
  break;
822
- case 88:
823
- _context4.t20 = _yield$mem$getTx3.item;
824
- case 89:
825
- _context4.t21 = _context4.t20;
826
- _context4.next = 92;
818
+ case 79:
819
+ _context4.t18 = _yield$mem$getTx3.item;
820
+ case 80:
821
+ _context4.t19 = _context4.t18;
822
+ _context4.next = 83;
827
823
  return mem.getTx(mod);
828
- case 92:
829
- _context4.t22 = _context4.sent;
830
- _context4.t23 = {
831
- format: _context4.t16,
832
- WeaveDrive: _context4.t17,
833
- spawn: _context4.t21,
834
- module: _context4.t22
824
+ case 83:
825
+ _context4.t20 = _context4.sent;
826
+ _context4.t21 = {
827
+ format: _context4.t14,
828
+ WeaveDrive: _context4.t15,
829
+ spawn: _context4.t19,
830
+ module: _context4.t20
835
831
  };
836
- _context4.next = 96;
837
- return (0, _context4.t14)(_context4.t15, _context4.t23);
838
- case 96:
832
+ _context4.next = 87;
833
+ return (0, _context4.t12)(_context4.t13, _context4.t21);
834
+ case 87:
839
835
  p.handle = _context4.sent;
840
836
  mem.env[opt.process].handle = p.handle;
841
- case 98:
837
+ case 89:
842
838
  if (p.compressed) {
843
839
  start = Date.now();
844
840
  p.memory = mem.decompress(p.memory, p.original_size);
845
841
  p.compressed = false;
846
842
  }
847
- _context4.next = 101;
843
+ _context4.next = 92;
848
844
  return p.handle(p.memory, msg, _env);
849
- case 101:
845
+ case 92:
850
846
  res = _context4.sent;
851
847
  p.memory = res.Memory;
852
848
  delete res.Memory;
853
849
  p.results.push(opt.message);
854
- _context4.next = 107;
850
+ _context4.next = 98;
855
851
  return mem.set(p, "env", opt.process);
856
- case 107:
852
+ case 98:
857
853
  _msg = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
858
854
  res: res
859
855
  });
860
- _context4.next = 110;
856
+ _context4.next = 101;
861
857
  return mem.set(_msg, "msgs", opt.message);
862
- case 110:
858
+ case 101:
863
859
  _iterator3 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
864
- _context4.prev = 111;
860
+ _context4.prev = 102;
865
861
  _iterator3.s();
866
- case 113:
862
+ case 104:
867
863
  if ((_step3 = _iterator3.n()).done) {
868
- _context4.next = 122;
864
+ _context4.next = 113;
869
865
  break;
870
866
  }
871
867
  v = _step3.value;
872
- _context4.next = 117;
868
+ _context4.next = 108;
873
869
  return mem.get("env", v.Target);
874
- case 117:
870
+ case 108:
875
871
  if (!_context4.sent) {
876
- _context4.next = 120;
872
+ _context4.next = 111;
877
873
  break;
878
874
  }
879
- _context4.next = 120;
875
+ _context4.next = 111;
880
876
  return message({
881
877
  "for": opt.message,
882
878
  process: v.Target,
@@ -885,32 +881,32 @@ var _default = exports["default"] = function _default() {
885
881
  signer: mu.signer,
886
882
  from: opt.process
887
883
  });
888
- case 120:
889
- _context4.next = 113;
884
+ case 111:
885
+ _context4.next = 104;
890
886
  break;
891
- case 122:
892
- _context4.next = 127;
887
+ case 113:
888
+ _context4.next = 118;
893
889
  break;
894
- case 124:
895
- _context4.prev = 124;
896
- _context4.t24 = _context4["catch"](111);
897
- _iterator3.e(_context4.t24);
898
- case 127:
899
- _context4.prev = 127;
890
+ case 115:
891
+ _context4.prev = 115;
892
+ _context4.t22 = _context4["catch"](102);
893
+ _iterator3.e(_context4.t22);
894
+ case 118:
895
+ _context4.prev = 118;
900
896
  _iterator3.f();
901
- return _context4.finish(127);
902
- case 130:
897
+ return _context4.finish(118);
898
+ case 121:
903
899
  _iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
904
- _context4.prev = 131;
900
+ _context4.prev = 122;
905
901
  _iterator4.s();
906
- case 133:
902
+ case 124:
907
903
  if ((_step4 = _iterator4.n()).done) {
908
- _context4.next = 140;
904
+ _context4.next = 131;
909
905
  break;
910
906
  }
911
907
  _v = _step4.value;
912
908
  __tags = (0, _utils.tags)(_v.Tags);
913
- _context4.next = 138;
909
+ _context4.next = 129;
914
910
  return spawn({
915
911
  "for": opt.message,
916
912
  module: __tags.Module,
@@ -920,87 +916,87 @@ var _default = exports["default"] = function _default() {
920
916
  from: __tags["From-Process"],
921
917
  signer: mu.signer
922
918
  });
923
- case 138:
924
- _context4.next = 133;
919
+ case 129:
920
+ _context4.next = 124;
925
921
  break;
926
- case 140:
927
- _context4.next = 145;
922
+ case 131:
923
+ _context4.next = 136;
928
924
  break;
929
- case 142:
930
- _context4.prev = 142;
931
- _context4.t25 = _context4["catch"](131);
932
- _iterator4.e(_context4.t25);
933
- case 145:
934
- _context4.prev = 145;
925
+ case 133:
926
+ _context4.prev = 133;
927
+ _context4.t23 = _context4["catch"](122);
928
+ _iterator4.e(_context4.t23);
929
+ case 136:
930
+ _context4.prev = 136;
935
931
  _iterator4.f();
936
- return _context4.finish(145);
937
- case 148:
932
+ return _context4.finish(136);
933
+ case 139:
938
934
  _iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
939
- _context4.prev = 149;
935
+ _context4.prev = 140;
940
936
  _iterator5.s();
941
- case 151:
937
+ case 142:
942
938
  if ((_step5 = _iterator5.n()).done) {
943
- _context4.next = 172;
939
+ _context4.next = 163;
944
940
  break;
945
941
  }
946
942
  _v2 = _step5.value;
947
943
  _iterator6 = _createForOfIteratorHelper(_v2.Processes);
948
- _context4.prev = 154;
944
+ _context4.prev = 145;
949
945
  _iterator6.s();
950
- case 156:
946
+ case 147:
951
947
  if ((_step6 = _iterator6.n()).done) {
952
- _context4.next = 162;
948
+ _context4.next = 153;
953
949
  break;
954
950
  }
955
951
  v2 = _step6.value;
956
- _context4.next = 160;
952
+ _context4.next = 151;
957
953
  return _assign({
958
954
  message: _v2.Message,
959
955
  process: v2,
960
956
  from: opt.process,
961
957
  signer: mu.signer
962
958
  });
963
- case 160:
964
- _context4.next = 156;
959
+ case 151:
960
+ _context4.next = 147;
965
961
  break;
966
- case 162:
967
- _context4.next = 167;
962
+ case 153:
963
+ _context4.next = 158;
968
964
  break;
969
- case 164:
970
- _context4.prev = 164;
971
- _context4.t26 = _context4["catch"](154);
972
- _iterator6.e(_context4.t26);
973
- case 167:
974
- _context4.prev = 167;
965
+ case 155:
966
+ _context4.prev = 155;
967
+ _context4.t24 = _context4["catch"](145);
968
+ _iterator6.e(_context4.t24);
969
+ case 158:
970
+ _context4.prev = 158;
975
971
  _iterator6.f();
976
- return _context4.finish(167);
977
- case 170:
978
- _context4.next = 151;
972
+ return _context4.finish(158);
973
+ case 161:
974
+ _context4.next = 142;
979
975
  break;
980
- case 172:
981
- _context4.next = 177;
976
+ case 163:
977
+ _context4.next = 168;
982
978
  break;
979
+ case 165:
980
+ _context4.prev = 165;
981
+ _context4.t25 = _context4["catch"](140);
982
+ _iterator5.e(_context4.t25);
983
+ case 168:
984
+ _context4.prev = 168;
985
+ _iterator5.f();
986
+ return _context4.finish(168);
987
+ case 171:
988
+ return _context4.abrupt("return", id);
983
989
  case 174:
984
990
  _context4.prev = 174;
985
- _context4.t27 = _context4["catch"](149);
986
- _iterator5.e(_context4.t27);
991
+ _context4.t26 = _context4["catch"](40);
992
+ console.log(_context4.t26);
987
993
  case 177:
988
- _context4.prev = 177;
989
- _iterator5.f();
990
- return _context4.finish(177);
991
- case 180:
992
- return _context4.abrupt("return", id);
993
- case 183:
994
- _context4.prev = 183;
995
- _context4.t28 = _context4["catch"](39);
996
- console.log(_context4.t28);
997
- case 186:
998
994
  return _context4.abrupt("return", null);
999
- case 187:
995
+ case 178:
1000
996
  case "end":
1001
997
  return _context4.stop();
1002
998
  }
1003
- }, _callee4, null, [[39, 183], [44, 57], [111, 124, 127, 130], [131, 142, 145, 148], [149, 174, 177, 180], [154, 164, 167, 170]]);
999
+ }, _callee4, null, [[40, 174], [102, 115, 118, 121], [122, 133, 136, 139], [140, 165, 168, 171], [145, 155, 158, 161]]);
1004
1000
  }));
1005
1001
  return function assign(_x8) {
1006
1002
  return _ref9.apply(this, arguments);
@@ -1089,9 +1085,8 @@ var _default = exports["default"] = function _default() {
1089
1085
  }
1090
1086
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
1091
1087
  "Data-Protocol": "ao",
1092
- Variant: "ao.TN.1",
1093
- Type: "Message",
1094
- SDK: "aoconnect"
1088
+ Variant: variant !== null && variant !== void 0 ? variant : "ao.TN.1",
1089
+ Type: "Message"
1095
1090
  }));
1096
1091
  if (!opt["for"]) {
1097
1092
  _context5.next = 71;
package/cjs/armem-base.js CHANGED
@@ -57,8 +57,10 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
57
57
  scheduler = _ref.scheduler,
58
58
  cache = _ref.cache,
59
59
  init = _ref.init,
60
- Waosm = _ref.Waosm;
60
+ Waosm = _ref.Waosm,
61
+ variant = _ref.variant;
61
62
  _classCallCheck(this, ArMemBase);
63
+ this.variant = variant;
62
64
  this.__type__ = "mem";
63
65
  this._init = init;
64
66
  this.Waosm = Waosm;
@@ -239,6 +241,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
239
241
  }
240
242
  var txs = [];
241
243
  for (var _k in this.modules) {
244
+ var _this$variant;
242
245
  var key = this.modules[_k];
243
246
  txs.push(key);
244
247
  this.txs[key] = {
@@ -246,7 +249,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
246
249
  block: 0,
247
250
  tags: (0, _utils.buildTags)(null, {
248
251
  "Data-Protocol": "ao",
249
- Variant: "ao.TN.1",
252
+ Variant: (_this$variant = this.variant) !== null && _this$variant !== void 0 ? _this$variant : "ao.TN.1",
250
253
  Type: "Module",
251
254
  "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
252
255
  "Input-Encoding": "JSON-V1",
@@ -258,6 +261,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
258
261
  };
259
262
  }
260
263
  if (this.scheduler && this.SU_URL) {
264
+ var _this$variant2;
261
265
  var _key = this.scheduler;
262
266
  txs.push(_key);
263
267
  this.addrmap[this.scheduler] = {
@@ -269,7 +273,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
269
273
  owner: this.scheduler,
270
274
  tags: (0, _utils.buildTags)(null, {
271
275
  "Data-Protocol": "ao",
272
- Variant: "ao.TN.1",
276
+ Variant: (_this$variant2 = this.variant) !== null && _this$variant2 !== void 0 ? _this$variant2 : "ao.TN.1",
273
277
  Type: "Scheduler-Location",
274
278
  Url: this.SU_URL,
275
279
  "Time-To-Live": 1000 * 60 * 60 * 24 * 365 * 10
package/cjs/armem-web.js CHANGED
@@ -46,7 +46,7 @@ var ArMem = exports["default"] = /*#__PURE__*/function (_Base) {
46
46
  init: _waosm["default"],
47
47
  Waosm: _waosm.Waosm
48
48
  })]);
49
- _this.db = (0, _lfdb["default"])(_this);
49
+ _this.db = (0, _lfdb["default"])(_this, args.cache);
50
50
  _this.initSync();
51
51
  return _this;
52
52
  }
package/cjs/bao.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports["default"] = void 0;
8
8
  var _ao = _interopRequireDefault(require("./ao.js"));
9
- var _aoconnect = require("@permaweb/aoconnect");
9
+ var _aoconnectWao = require("aoconnect-wao");
10
10
  var _utils = require("./utils.js");
11
11
  var _ramda = require("ramda");
12
12
  var _hb = _interopRequireDefault(require("./hb.js"));
@@ -81,9 +81,10 @@ var AO = /*#__PURE__*/function (_MAO) {
81
81
  in_memory: true
82
82
  })]);
83
83
  _this.in_memory = true;
84
- _this.createDataItemSigner = (_opt$createDataItemSi = opt.createDataItemSigner) !== null && _opt$createDataItemSi !== void 0 ? _opt$createDataItemSi : _aoconnect.createDataItemSigner;
84
+ _this.createDataItemSigner = (_opt$createDataItemSi = opt.createDataItemSigner) !== null && _opt$createDataItemSi !== void 0 ? _opt$createDataItemSi : _aoconnectWao.createDataItemSigner;
85
85
  _this.hb = opt.hb;
86
86
  var _opt$connect = opt.connect(opt.mem, {
87
+ variant: opt.variant,
87
88
  extensions: opt.extensions,
88
89
  cache: opt.cache,
89
90
  reset: opt.reset,
@@ -224,6 +225,7 @@ var AO = /*#__PURE__*/function (_MAO) {
224
225
  key: "postModule",
225
226
  value: function () {
226
227
  var _postModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref4) {
228
+ var _this$variant;
227
229
  var data, _ref4$tags, tags, jwk, err, _yield$this$ar$checkW, t, signer, _yield$this$ar$datait, id, owner, item;
228
230
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
229
231
  while (1) switch (_context5.prev = _context5.next) {
@@ -248,7 +250,7 @@ var AO = /*#__PURE__*/function (_MAO) {
248
250
  case 9:
249
251
  t = (0, _ramda.mergeLeft)(tags, {
250
252
  "Data-Protocol": "ao",
251
- Variant: "ao.TN.1",
253
+ Variant: (_this$variant = this.variant) !== null && _this$variant !== void 0 ? _this$variant : "ao.TN.1",
252
254
  Type: "Module",
253
255
  "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
254
256
  "Input-Encoding": "JSON-V1",
package/cjs/helpers.js CHANGED
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.setup = exports.ok = exports.fail = exports.Testnet = exports.Src = void 0;
8
8
  var _index = require("./index.js");
9
9
  var _assert = _interopRequireDefault(require("assert"));
10
- var _aoconnect3 = require("@permaweb/aoconnect");
10
+ var _aoconnectWao = require("aoconnect-wao");
11
11
  var _path = require("path");
12
12
  var _fs = require("fs");
13
13
  var _utils = require("./utils.js");
package/cjs/lfdb.js CHANGED
@@ -14,22 +14,25 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
14
14
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
15
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
16
16
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
17
- var _default = exports["default"] = function _default(_this) {
17
+ var _default = exports["default"] = function _default(_this, prefix) {
18
+ var k = function k(key) {
19
+ return prefix ? "".concat(prefix, "-").concat(key) : key;
20
+ };
18
21
  return {
19
22
  put: function () {
20
23
  var _put = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, val) {
21
- var _val, k, _arr, _iterator, _step, v, __val, k2, _val2, _k;
24
+ var _val, _k, _arr, _iterator, _step, v, __val, k2, _val2, _k2;
22
25
  return _regeneratorRuntime().wrap(function _callee$(_context) {
23
26
  while (1) switch (_context.prev = _context.next) {
24
27
  case 0:
25
28
  _val = null;
26
29
  if (_typeof(val) === "object" && !(0, _ramda.is)(Array, val)) {
27
30
  _val = {};
28
- for (k in val) {
29
- if (typeof val[k] !== "function") {
30
- if ((0, _ramda.is)(Array, val[k])) {
31
+ for (_k in val) {
32
+ if (typeof val[_k] !== "function") {
33
+ if ((0, _ramda.is)(Array, val[_k])) {
31
34
  _arr = [];
32
- _iterator = _createForOfIteratorHelper(val[k]);
35
+ _iterator = _createForOfIteratorHelper(val[_k]);
33
36
  try {
34
37
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
35
38
  v = _step.value;
@@ -48,25 +51,25 @@ var _default = exports["default"] = function _default(_this) {
48
51
  } finally {
49
52
  _iterator.f();
50
53
  }
51
- _val[k] = _arr;
52
- } else if (_typeof(val[k]) === "object" && !(val[k] instanceof Uint8Array) && !(val[k] instanceof ArrayBuffer)) {
54
+ _val[_k] = _arr;
55
+ } else if (_typeof(val[_k]) === "object" && !(val[_k] instanceof Uint8Array) && !(val[_k] instanceof ArrayBuffer)) {
53
56
  _val2 = {};
54
- for (_k in val[k]) {
55
- if (typeof val[k][_k] !== "function") _val2[_k] = val[k][_k];
57
+ for (_k2 in val[_k]) {
58
+ if (typeof val[_k][_k2] !== "function") _val2[_k2] = val[_k][_k2];
56
59
  }
57
- _val[k] = _val2;
60
+ _val[_k] = _val2;
58
61
  } else {
59
- _val[k] = val[k];
62
+ _val[_k] = val[_k];
60
63
  }
61
64
  }
62
65
  }
63
66
  } else _val = val;
64
67
  _context.next = 4;
65
- return _localforage["default"].setItem(key, _val);
68
+ return _localforage["default"].setItem(k(key), _val);
66
69
  case 4:
67
70
  _this.keys[key] = true;
68
71
  _context.next = 7;
69
- return _localforage["default"].setItem("keys", (0, _ramda.keys)(_this.keys));
72
+ return _localforage["default"].setItem(k("keys"), (0, _ramda.keys)(_this.keys));
70
73
  case 7:
71
74
  case "end":
72
75
  return _context.stop();
@@ -84,7 +87,7 @@ var _default = exports["default"] = function _default(_this) {
84
87
  while (1) switch (_context2.prev = _context2.next) {
85
88
  case 0:
86
89
  _context2.next = 2;
87
- return _localforage["default"].getItem(key);
90
+ return _localforage["default"].getItem(k(key));
88
91
  case 2:
89
92
  return _context2.abrupt("return", _context2.sent);
90
93
  case 3:
@@ -100,7 +103,7 @@ var _default = exports["default"] = function _default(_this) {
100
103
  }(),
101
104
  getKeys: function () {
102
105
  var _getKeys = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
103
- var start, end, _yield$lf$getItem, _keys, _iterator2, _step2, v, __keys, k, sp;
106
+ var start, end, _yield$lf$getItem, _keys, _iterator2, _step2, v, __keys, _k3, sp;
104
107
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
105
108
  while (1) switch (_context3.prev = _context3.next) {
106
109
  case 0:
@@ -110,7 +113,7 @@ var _default = exports["default"] = function _default(_this) {
110
113
  break;
111
114
  }
112
115
  _context3.next = 4;
113
- return _localforage["default"].getItem("keys");
116
+ return _localforage["default"].getItem(k("keys"));
114
117
  case 4:
115
118
  _context3.t1 = _yield$lf$getItem = _context3.sent;
116
119
  _context3.t0 = _context3.t1 !== null;
@@ -145,9 +148,9 @@ var _default = exports["default"] = function _default(_this) {
145
148
  }
146
149
  case 17:
147
150
  __keys = [];
148
- for (k in _this.keys) {
149
- sp = k.split(".");
150
- if (sp[0] === start) __keys.push(k);
151
+ for (_k3 in _this.keys) {
152
+ sp = _k3.split(".");
153
+ if (sp[0] === start) __keys.push(_k3);
151
154
  }
152
155
  return _context3.abrupt("return", __keys);
153
156
  case 20:
package/esm/ao.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  dryrun,
15
15
  monitor,
16
16
  unmonitor,
17
- } from "@permaweb/aoconnect"
17
+ } from "aoconnect-wao"
18
18
 
19
19
  import {
20
20
  dissoc,
@@ -96,6 +96,7 @@ class AO {
96
96
  if (!aoconnect && _port) aoconnect = optAO(_port)
97
97
  if (!ar && _port) ar = { port: _port }
98
98
  this.wao = opt.wao
99
+ this.variant = opt.variant
99
100
  if (isNil(this.wao)) this.wao = in_memory || !isNil(ar?.port)
100
101
  if (!module) {
101
102
  switch (module_type) {
@@ -311,8 +312,8 @@ class AO {
311
312
 
312
313
  async postModule({ data, jwk, tags = {}, overwrite = false }) {
313
314
  const _tags = mergeLeft(tags, {
314
- "Data-Protocol": "ao",
315
- Variant: "ao.TN.1",
315
+ "Data-Protocol": this.protocol ?? "ao",
316
+ Variant: this.variant ?? "ao.TN.1",
316
317
  Type: "Module",
317
318
  "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
318
319
  "Input-Encoding": "JSON-V1",
@@ -336,8 +337,8 @@ class AO {
336
337
 
337
338
  async postScheduler({ jwk, url, tags = {}, overwrite = false }) {
338
339
  const _tags = mergeLeft(tags, {
339
- "Data-Protocol": "ao",
340
- Variant: "ao.TN.1",
340
+ "Data-Protocol": this.protocol ?? "ao",
341
+ Variant: this.variant ?? "ao.TN.1",
341
342
  Type: "Scheduler-Location",
342
343
  Url: url,
343
344
  "Time-To-Live": "3600000",
@@ -370,6 +371,7 @@ class AO {
370
371
  if (!tags.Authority && this.authority) tags.Authority = this.authority
371
372
  let _tags = buildTags(null, tags)
372
373
  pid = await this.spawn({
374
+ variant: this.variant,
373
375
  memory,
374
376
  module,
375
377
  scheduler,
@@ -515,6 +517,7 @@ class AO {
515
517
  if (err) return { err }
516
518
  let _tags = buildTags(act, tags)
517
519
  const mid = await this.message({
520
+ variant: this.variant,
518
521
  process: pid,
519
522
  signer: this.toSigner(jwk),
520
523
  tags: _tags,
@@ -1,3 +1,6 @@
1
+ import _Arweave from "arweave"
2
+ const Arweave = _Arweave.default ?? _Arweave
3
+ const arweave = Arweave.init()
1
4
  import * as WarpArBundles from "warp-arbundles"
2
5
  const pkg = WarpArBundles.default ?? WarpArBundles
3
6
  const { DataItem } = pkg
@@ -30,13 +33,14 @@ let onRecovery = {}
30
33
  let ongoing = {}
31
34
 
32
35
  export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
33
- return (mem, { cache, log = false, extensions = {}, hb } = {}) => {
36
+ return (mem, { cache, log = false, extensions = {}, hb, variant } = {}) => {
34
37
  const isMem = mem?.__type__ === "mem"
35
38
  if (!isMem) {
36
39
  let args = { cache }
37
40
  if (mem?.SU_URL) {
38
- args = mergeLeft(mem, args)
39
41
  args.scheduler = scheduler
42
+ args.variant = variant
43
+ args = mergeLeft(mem, args)
40
44
  }
41
45
  mem = new ArMem(args)
42
46
  }
@@ -132,9 +136,8 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
132
136
  null,
133
137
  mergeLeft(tags(opt.tags ?? []), {
134
138
  "Data-Protocol": "ao",
135
- Variant: "ao.TN.1",
139
+ Variant: variant ?? "ao.TN.1",
136
140
  Type: "Process",
137
- SDK: "aoconnect",
138
141
  Module: mod,
139
142
  Scheduler: opt.scheduler,
140
143
  "Content-Type": "text/plain",
@@ -283,8 +286,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
283
286
  Epoch: p.epochs.length,
284
287
  Nonce: "0",
285
288
  "Data-Protocol": "ao",
286
- Variant: "ao.TN.1",
287
- SDK: "aoconnect",
289
+ Variant: variant ?? "ao.TN.1",
288
290
  Type: "Assignment",
289
291
  "Block-Height": await mem.get("height"),
290
292
  Process: opt.process,
@@ -309,18 +311,14 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
309
311
  let _tags = _opt.tags
310
312
  let from = _opt.from ?? opt.from ?? owner
311
313
  if (_opt.item) {
312
- try {
313
- data = base64url.decode(_opt.item.data)
314
- _tags = _opt.item.tags
315
- if (!from) {
316
- const raw_owner = _opt.item.rawOwner
317
- const hashBuffer = Buffer.from(
318
- await crypto.subtle.digest("SHA-256", raw_owner)
319
- )
320
- from = base64url.encode(hashBuffer)
321
- }
322
- } catch (e) {
323
- console.log(e)
314
+ data = base64url.decode(_opt.item.data)
315
+ _tags = _opt.item.tags
316
+ if (!from) {
317
+ from = await arweave.wallets.jwkToAddress({
318
+ kty: "RSA",
319
+ n: _opt.item.owner,
320
+ e: "AQAB",
321
+ })
324
322
  }
325
323
  }
326
324
  // check: is owner=mu.addr right?
@@ -432,9 +430,8 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
432
430
  null,
433
431
  mergeLeft(tags(opt.tags ?? []), {
434
432
  "Data-Protocol": "ao",
435
- Variant: "ao.TN.1",
433
+ Variant: variant ?? "ao.TN.1",
436
434
  Type: "Message",
437
- SDK: "aoconnect",
438
435
  })
439
436
  )
440
437
  if (opt.for) {
package/esm/armem-base.js CHANGED
@@ -32,7 +32,9 @@ export default class ArMemBase {
32
32
  cache,
33
33
  init,
34
34
  Waosm,
35
+ variant,
35
36
  } = {}) {
37
+ this.variant = variant
36
38
  this.__type__ = "mem"
37
39
  this._init = init
38
40
  this.Waosm = Waosm
@@ -125,7 +127,7 @@ export default class ArMemBase {
125
127
  block: 0,
126
128
  tags: buildTags(null, {
127
129
  "Data-Protocol": "ao",
128
- Variant: "ao.TN.1",
130
+ Variant: this.variant ?? "ao.TN.1",
129
131
  Type: "Module",
130
132
  "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
131
133
  "Input-Encoding": "JSON-V1",
@@ -146,7 +148,7 @@ export default class ArMemBase {
146
148
  owner: this.scheduler,
147
149
  tags: buildTags(null, {
148
150
  "Data-Protocol": "ao",
149
- Variant: "ao.TN.1",
151
+ Variant: this.variant ?? "ao.TN.1",
150
152
  Type: "Scheduler-Location",
151
153
  Url: this.SU_URL,
152
154
  "Time-To-Live": 1000 * 60 * 60 * 24 * 365 * 10,
package/esm/armem-web.js CHANGED
@@ -8,7 +8,7 @@ const wasm = { sqlite, aos2_0_3, aos2_0_1 }
8
8
  export default class ArMem extends Base {
9
9
  constructor(args = {}) {
10
10
  super({ ...args, init, Waosm })
11
- this.db = db(this)
11
+ this.db = db(this, args.cache)
12
12
  this.initSync()
13
13
  }
14
14
  async _getWasm(file) {
package/esm/bao.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import MAO from "./ao.js"
2
- import { createDataItemSigner } from "@permaweb/aoconnect"
2
+ import { createDataItemSigner } from "aoconnect-wao"
3
3
  import { srcs, buildTags } from "./utils.js"
4
4
  import { mergeLeft, is, map } from "ramda"
5
5
  import HB from "./hb.js"
@@ -68,6 +68,7 @@ class AO extends MAO {
68
68
  recover,
69
69
  mem,
70
70
  } = opt.connect(opt.mem, {
71
+ variant: opt.variant,
71
72
  extensions: opt.extensions,
72
73
  cache: opt.cache,
73
74
  reset: opt.reset,
@@ -114,7 +115,7 @@ class AO extends MAO {
114
115
  if (err) return { err }
115
116
  const t = mergeLeft(tags, {
116
117
  "Data-Protocol": "ao",
117
- Variant: "ao.TN.1",
118
+ Variant: this.variant ?? "ao.TN.1",
118
119
  Type: "Module",
119
120
  "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
120
121
  "Input-Encoding": "JSON-V1",
package/esm/helpers.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AR, AO } from "./index.js"
2
2
  import assert from "assert"
3
- import { createDataItemSigner, connect } from "@permaweb/aoconnect"
3
+
4
+ import { createDataItemSigner, connect } from "aoconnect-wao"
4
5
  import { dirname as _dirname, resolve } from "path"
5
6
  import { mkdirSync, existsSync, writeFileSync, readFileSync } from "fs"
6
7
  import { optAO } from "./utils.js"
@@ -33,7 +34,7 @@ export class Src {
33
34
  data(file, ext = "lua") {
34
35
  return readFileSync(
35
36
  `${this.dir}/${file}.${ext}`,
36
- ext === "wasm" ? null : "utf8",
37
+ ext === "wasm" ? null : "utf8"
37
38
  )
38
39
  }
39
40
  async upload(file, ext = "lua") {
package/esm/lfdb.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import lf from "localforage"
2
2
  import { is, keys } from "ramda"
3
3
 
4
- export default _this => {
4
+ export default (_this, prefix) => {
5
+ const k = key => (prefix ? `${prefix}-${key}` : key)
5
6
  return {
6
7
  put: async (key, val) => {
7
8
  let _val = null
@@ -44,14 +45,14 @@ export default _this => {
44
45
  }
45
46
  }
46
47
  } else _val = val
47
- await lf.setItem(key, _val)
48
+ await lf.setItem(k(key), _val)
48
49
  _this.keys[key] = true
49
- await lf.setItem("keys", keys(_this.keys))
50
+ await lf.setItem(k("keys"), keys(_this.keys))
50
51
  },
51
- get: async key => await lf.getItem(key),
52
+ get: async key => await lf.getItem(k(key)),
52
53
  getKeys: async ({ start, end }) => {
53
54
  if (!_this.keyInit) {
54
- const _keys = (await lf.getItem("keys")) ?? []
55
+ const _keys = (await lf.getItem(k("keys"))) ?? []
55
56
  _this.keys = {}
56
57
  for (const v of _keys) _this.keys[v] = true
57
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.16.5",
3
+ "version": "0.17.0",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"
@@ -31,7 +31,7 @@
31
31
  "@dha-team/arbundles": "^1.0.1",
32
32
  "@permaweb/ao-loader": "^0.0.44",
33
33
  "@permaweb/aoconnect": "^0.0.62",
34
- "aoconnect-wao": "https://gitpkg.vercel.app/weavedb/ao/connect?abd2992689dc5983d5cd48b38fb997b0532f192a&scripts.postinstall=npm%20install%20--ignore-scripts%20%26%26%20npm%20run%20build",
34
+ "aoconnect-wao": "https://gitpkg.vercel.app/weavedb/ao/connect?5cef9f0c1a4e8872308bbe0a7d004e44a7e008b6&scripts.postinstall=npm%20install%20--ignore-scripts%20%26%26%20npm%20run%20build",
35
35
  "arbundles": "^0.11.1",
36
36
  "arjson": "^0.0.2",
37
37
  "arweave": "^1.15.1",