wao 0.16.7 → 0.18.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
@@ -8,6 +8,7 @@ var WarpArBundles = _interopRequireWildcard(require("warp-arbundles"));
8
8
  var _ar4 = _interopRequireDefault(require("./ar.js"));
9
9
  var _md = _interopRequireDefault(require("md5"));
10
10
  var _aoconnect = require("@permaweb/aoconnect");
11
+ var _aoconnectWao = require("aoconnect-wao");
11
12
  var _ramda = require("ramda");
12
13
  var _utils = require("./utils.js");
13
14
  var _WarpArBundles$defaul;
@@ -122,6 +123,7 @@ var AO = /*#__PURE__*/function () {
122
123
  port: _port
123
124
  };
124
125
  this.wao = opt.wao;
126
+ this.variant = opt.variant;
125
127
  if ((0, _ramda.isNil)(this.wao)) this.wao = in_memory || !(0, _ramda.isNil)((_ar2 = ar) === null || _ar2 === void 0 ? void 0 : _ar2.port);
126
128
  if (!module) {
127
129
  switch (module_type) {
@@ -141,7 +143,7 @@ var AO = /*#__PURE__*/function () {
141
143
  this.ar = new _ar4["default"](_ar);
142
144
  }
143
145
  if (!in_memory && aoconnect) {
144
- var _connect = (0, _aoconnect.connect)(aoconnect),
146
+ var _connect = (0, _aoconnectWao.connect)(aoconnect),
145
147
  _results = _connect.results,
146
148
  _assign = _connect.assign,
147
149
  _result = _connect.result,
@@ -159,14 +161,14 @@ var AO = /*#__PURE__*/function () {
159
161
  this.monitor = _monitor;
160
162
  this.unmonitor = _unmonitor;
161
163
  } 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;
164
+ this.assign = _aoconnectWao.assign;
165
+ this.result = _aoconnectWao.result;
166
+ this.results = _aoconnectWao.results;
167
+ this.message = _aoconnectWao.message;
168
+ this.spawn = _aoconnectWao.spawn;
169
+ this.dryrun = _aoconnectWao.dryrun;
170
+ this.monitor = _aoconnectWao.monitor;
171
+ this.unmonitor = _aoconnectWao.unmonitor;
170
172
  }
171
173
  if (this.wao) {
172
174
  this.module = _utils.srcs.module_wao;
@@ -427,15 +429,17 @@ var AO = /*#__PURE__*/function () {
427
429
  key: "postModule",
428
430
  value: function () {
429
431
  var _postModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
430
- var _this = this;
432
+ var _this$protocol,
433
+ _this$variant,
434
+ _this = this;
431
435
  var data, jwk, _ref6$tags, tags, _ref6$overwrite, overwrite, _tags, fns;
432
436
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
433
437
  while (1) switch (_context5.prev = _context5.next) {
434
438
  case 0:
435
439
  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
440
  _tags = (0, _ramda.mergeLeft)(tags, {
437
- "Data-Protocol": "ao",
438
- Variant: "ao.TN.1",
441
+ "Data-Protocol": (_this$protocol = this.protocol) !== null && _this$protocol !== void 0 ? _this$protocol : "ao",
442
+ Variant: (_this$variant = this.variant) !== null && _this$variant !== void 0 ? _this$variant : "ao.TN.1",
439
443
  Type: "Module",
440
444
  "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
441
445
  "Input-Encoding": "JSON-V1",
@@ -477,15 +481,17 @@ var AO = /*#__PURE__*/function () {
477
481
  key: "postScheduler",
478
482
  value: function () {
479
483
  var _postScheduler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref8) {
480
- var _this2 = this;
484
+ var _this$protocol2,
485
+ _this$variant2,
486
+ _this2 = this;
481
487
  var jwk, url, _ref8$tags, tags, _ref8$overwrite, overwrite, _tags, then, fns;
482
488
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
483
489
  while (1) switch (_context7.prev = _context7.next) {
484
490
  case 0:
485
491
  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
492
  _tags = (0, _ramda.mergeLeft)(tags, {
487
- "Data-Protocol": "ao",
488
- Variant: "ao.TN.1",
493
+ "Data-Protocol": (_this$protocol2 = this.protocol) !== null && _this$protocol2 !== void 0 ? _this$protocol2 : "ao",
494
+ Variant: (_this$variant2 = this.variant) !== null && _this$variant2 !== void 0 ? _this$variant2 : "ao.TN.1",
489
495
  Type: "Scheduler-Location",
490
496
  Url: url,
491
497
  "Time-To-Live": "3600000"
@@ -588,6 +594,7 @@ var AO = /*#__PURE__*/function () {
588
594
  _tags = (0, _utils.buildTags)(null, tags);
589
595
  _context8.next = 17;
590
596
  return this.spawn({
597
+ variant: this.variant,
591
598
  memory: memory,
592
599
  module: module,
593
600
  scheduler: scheduler,
@@ -991,6 +998,7 @@ var AO = /*#__PURE__*/function () {
991
998
  _tags = (0, _utils.buildTags)(act, tags);
992
999
  _context12.next = 11;
993
1000
  return this.message({
1001
+ variant: this.variant,
994
1002
  process: pid,
995
1003
  signer: this.toSigner(jwk),
996
1004
  tags: _tags,
@@ -55,7 +55,8 @@ var _default = exports["default"] = function _default() {
55
55
  log = _ref2$log === void 0 ? false : _ref2$log,
56
56
  _ref2$extensions = _ref2.extensions,
57
57
  extensions = _ref2$extensions === void 0 ? {} : _ref2$extensions,
58
- hb = _ref2.hb;
58
+ hb = _ref2.hb,
59
+ variant = _ref2.variant;
59
60
  var isMem = ((_mem = mem) === null || _mem === void 0 ? void 0 : _mem.__type__) === "mem";
60
61
  if (!isMem) {
61
62
  var _mem2;
@@ -63,8 +64,9 @@ var _default = exports["default"] = function _default() {
63
64
  cache: cache
64
65
  };
65
66
  if ((_mem2 = mem) !== null && _mem2 !== void 0 && _mem2.SU_URL) {
66
- args = (0, _ramda.mergeLeft)(mem, args);
67
67
  args.scheduler = scheduler;
68
+ args.variant = variant;
69
+ args = (0, _ramda.mergeLeft)(mem, args);
68
70
  }
69
71
  mem = new ArMem(args);
70
72
  }
@@ -401,9 +403,8 @@ var _default = exports["default"] = function _default() {
401
403
  case 37:
402
404
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : []), {
403
405
  "Data-Protocol": "ao",
404
- Variant: "ao.TN.1",
406
+ Variant: variant !== null && variant !== void 0 ? variant : "ao.TN.1",
405
407
  Type: "Process",
406
- SDK: "aoconnect",
407
408
  Module: mod,
408
409
  Scheduler: opt.scheduler,
409
410
  "Content-Type": "text/plain",
@@ -697,181 +698,181 @@ var _default = exports["default"] = function _default() {
697
698
  _context4.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
698
699
  _context4.t3 = Date.now();
699
700
  _context4.t4 = p.epochs.length;
700
- _context4.next = 18;
701
+ _context4.t5 = variant !== null && variant !== void 0 ? variant : "ao.TN.1";
702
+ _context4.next = 19;
701
703
  return mem.get("height");
702
- case 18:
703
- _context4.t5 = _context4.sent;
704
- _context4.t6 = opt.process;
705
- _context4.t7 = opt.message;
706
- _context4.t8 = hash;
707
- _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 = {
708
710
  Timestamp: _context4.t3,
709
711
  Epoch: _context4.t4,
710
712
  Nonce: "0",
711
713
  "Data-Protocol": "ao",
712
- Variant: "ao.TN.1",
713
- SDK: "aoconnect",
714
+ Variant: _context4.t5,
714
715
  Type: "Assignment",
715
- "Block-Height": _context4.t5,
716
- Process: _context4.t6,
717
- Message: _context4.t7,
718
- "Hash-Chain": _context4.t8
716
+ "Block-Height": _context4.t6,
717
+ Process: _context4.t7,
718
+ Message: _context4.t8,
719
+ "Hash-Chain": _context4.t9
719
720
  };
720
- _context4.t10 = (0, _context4.t1)(_context4.t2, _context4.t9);
721
- 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);
722
723
  p.epochs.push([opt.message]);
723
- _context4.next = 28;
724
+ _context4.next = 29;
724
725
  return ar.dataitem({
725
726
  data: opt.data,
726
727
  signer: opt.signer,
727
728
  tags: (0, _utils.tags)(opt.tags),
728
729
  target: opt.process
729
730
  });
730
- case 28:
731
+ case 29:
731
732
  _yield$ar$dataitem2 = _context4.sent;
732
733
  id = _yield$ar$dataitem2.id;
733
734
  owner = _yield$ar$dataitem2.owner;
734
735
  item = _yield$ar$dataitem2.item;
735
736
  if (!opt.message_item) {
736
- _context4.next = 37;
737
+ _context4.next = 38;
737
738
  break;
738
739
  }
739
- _context4.next = 35;
740
+ _context4.next = 36;
740
741
  return ar.postItems([opt.message_item, item], su.jwk);
741
- case 35:
742
- _context4.next = 39;
742
+ case 36:
743
+ _context4.next = 40;
743
744
  break;
744
- case 37:
745
- _context4.next = 39;
745
+ case 38:
746
+ _context4.next = 40;
746
747
  return ar.postItems(item, su.jwk);
747
- case 39:
748
- _context4.prev = 39;
748
+ case 40:
749
+ _context4.prev = 40;
749
750
  data = (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";
750
751
  _tags = _opt.tags;
751
752
  from = (_ref10 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref10 !== void 0 ? _ref10 : owner;
752
753
  if (!_opt.item) {
753
- _context4.next = 50;
754
+ _context4.next = 51;
754
755
  break;
755
756
  }
756
757
  data = _base64url["default"].decode(_opt.item.data);
757
758
  _tags = _opt.item.tags;
758
759
  if (from) {
759
- _context4.next = 50;
760
+ _context4.next = 51;
760
761
  break;
761
762
  }
762
- _context4.next = 49;
763
+ _context4.next = 50;
763
764
  return arweave.wallets.jwkToAddress({
764
765
  kty: "RSA",
765
766
  n: _opt.item.owner,
766
767
  e: "AQAB"
767
768
  });
768
- case 49:
769
- from = _context4.sent;
770
769
  case 50:
771
- _context4.next = 52;
770
+ from = _context4.sent;
771
+ case 51:
772
+ _context4.next = 53;
772
773
  return genMsg(opt.message, p, data, _tags, from, mu.addr);
773
- case 52:
774
+ case 53:
774
775
  msg = _context4.sent;
775
- _context4.next = 55;
776
+ _context4.next = 56;
776
777
  return genEnv({
777
778
  pid: p.id,
778
779
  owner: p.owner,
779
780
  module: p.module
780
781
  });
781
- case 55:
782
+ case 56:
782
783
  _env = _context4.sent;
783
784
  if (p.handle) {
784
- _context4.next = 88;
785
+ _context4.next = 89;
785
786
  break;
786
787
  }
787
- _context4.next = 59;
788
+ _context4.next = 60;
788
789
  return mem.getWasm(p.modulea);
789
- case 59:
790
+ case 60:
790
791
  _yield$mem$getWasm2 = _context4.sent;
791
792
  format = _yield$mem$getWasm2.format;
792
793
  mod = _yield$mem$getWasm2.mod;
793
794
  wasm = _yield$mem$getWasm2.wasm;
794
795
  wdrive = extensions[p.extention];
795
- _context4.t11 = AoLoader;
796
- _context4.t12 = wasm;
797
- _context4.t13 = format;
798
- _context4.t14 = wdrive;
799
- _context4.next = 70;
796
+ _context4.t12 = AoLoader;
797
+ _context4.t13 = wasm;
798
+ _context4.t14 = format;
799
+ _context4.t15 = wdrive;
800
+ _context4.next = 71;
800
801
  return mem.getTx(p.id);
801
- case 70:
802
- _context4.t16 = _yield$mem$getTx3 = _context4.sent;
803
- _context4.t15 = _context4.t16 === null;
804
- if (_context4.t15) {
805
- _context4.next = 74;
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;
806
807
  break;
807
808
  }
808
- _context4.t15 = _yield$mem$getTx3 === void 0;
809
- case 74:
810
- if (!_context4.t15) {
811
- _context4.next = 78;
809
+ _context4.t16 = _yield$mem$getTx3 === void 0;
810
+ case 75:
811
+ if (!_context4.t16) {
812
+ _context4.next = 79;
812
813
  break;
813
814
  }
814
- _context4.t17 = void 0;
815
- _context4.next = 79;
815
+ _context4.t18 = void 0;
816
+ _context4.next = 80;
816
817
  break;
817
- case 78:
818
- _context4.t17 = _yield$mem$getTx3.item;
819
818
  case 79:
820
- _context4.t18 = _context4.t17;
821
- _context4.next = 82;
819
+ _context4.t18 = _yield$mem$getTx3.item;
820
+ case 80:
821
+ _context4.t19 = _context4.t18;
822
+ _context4.next = 83;
822
823
  return mem.getTx(mod);
823
- case 82:
824
- _context4.t19 = _context4.sent;
825
- _context4.t20 = {
826
- format: _context4.t13,
827
- WeaveDrive: _context4.t14,
828
- spawn: _context4.t18,
829
- module: _context4.t19
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
830
831
  };
831
- _context4.next = 86;
832
- return (0, _context4.t11)(_context4.t12, _context4.t20);
833
- case 86:
832
+ _context4.next = 87;
833
+ return (0, _context4.t12)(_context4.t13, _context4.t21);
834
+ case 87:
834
835
  p.handle = _context4.sent;
835
836
  mem.env[opt.process].handle = p.handle;
836
- case 88:
837
+ case 89:
837
838
  if (p.compressed) {
838
839
  start = Date.now();
839
840
  p.memory = mem.decompress(p.memory, p.original_size);
840
841
  p.compressed = false;
841
842
  }
842
- _context4.next = 91;
843
+ _context4.next = 92;
843
844
  return p.handle(p.memory, msg, _env);
844
- case 91:
845
+ case 92:
845
846
  res = _context4.sent;
846
847
  p.memory = res.Memory;
847
848
  delete res.Memory;
848
849
  p.results.push(opt.message);
849
- _context4.next = 97;
850
+ _context4.next = 98;
850
851
  return mem.set(p, "env", opt.process);
851
- case 97:
852
+ case 98:
852
853
  _msg = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
853
854
  res: res
854
855
  });
855
- _context4.next = 100;
856
+ _context4.next = 101;
856
857
  return mem.set(_msg, "msgs", opt.message);
857
- case 100:
858
+ case 101:
858
859
  _iterator3 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
859
- _context4.prev = 101;
860
+ _context4.prev = 102;
860
861
  _iterator3.s();
861
- case 103:
862
+ case 104:
862
863
  if ((_step3 = _iterator3.n()).done) {
863
- _context4.next = 112;
864
+ _context4.next = 113;
864
865
  break;
865
866
  }
866
867
  v = _step3.value;
867
- _context4.next = 107;
868
+ _context4.next = 108;
868
869
  return mem.get("env", v.Target);
869
- case 107:
870
+ case 108:
870
871
  if (!_context4.sent) {
871
- _context4.next = 110;
872
+ _context4.next = 111;
872
873
  break;
873
874
  }
874
- _context4.next = 110;
875
+ _context4.next = 111;
875
876
  return message({
876
877
  "for": opt.message,
877
878
  process: v.Target,
@@ -880,32 +881,32 @@ var _default = exports["default"] = function _default() {
880
881
  signer: mu.signer,
881
882
  from: opt.process
882
883
  });
883
- case 110:
884
- _context4.next = 103;
884
+ case 111:
885
+ _context4.next = 104;
885
886
  break;
886
- case 112:
887
- _context4.next = 117;
887
+ case 113:
888
+ _context4.next = 118;
888
889
  break;
889
- case 114:
890
- _context4.prev = 114;
891
- _context4.t21 = _context4["catch"](101);
892
- _iterator3.e(_context4.t21);
893
- case 117:
894
- _context4.prev = 117;
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;
895
896
  _iterator3.f();
896
- return _context4.finish(117);
897
- case 120:
897
+ return _context4.finish(118);
898
+ case 121:
898
899
  _iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
899
- _context4.prev = 121;
900
+ _context4.prev = 122;
900
901
  _iterator4.s();
901
- case 123:
902
+ case 124:
902
903
  if ((_step4 = _iterator4.n()).done) {
903
- _context4.next = 130;
904
+ _context4.next = 131;
904
905
  break;
905
906
  }
906
907
  _v = _step4.value;
907
908
  __tags = (0, _utils.tags)(_v.Tags);
908
- _context4.next = 128;
909
+ _context4.next = 129;
909
910
  return spawn({
910
911
  "for": opt.message,
911
912
  module: __tags.Module,
@@ -915,87 +916,87 @@ var _default = exports["default"] = function _default() {
915
916
  from: __tags["From-Process"],
916
917
  signer: mu.signer
917
918
  });
918
- case 128:
919
- _context4.next = 123;
919
+ case 129:
920
+ _context4.next = 124;
920
921
  break;
921
- case 130:
922
- _context4.next = 135;
922
+ case 131:
923
+ _context4.next = 136;
923
924
  break;
924
- case 132:
925
- _context4.prev = 132;
926
- _context4.t22 = _context4["catch"](121);
927
- _iterator4.e(_context4.t22);
928
- case 135:
929
- _context4.prev = 135;
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;
930
931
  _iterator4.f();
931
- return _context4.finish(135);
932
- case 138:
932
+ return _context4.finish(136);
933
+ case 139:
933
934
  _iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
934
- _context4.prev = 139;
935
+ _context4.prev = 140;
935
936
  _iterator5.s();
936
- case 141:
937
+ case 142:
937
938
  if ((_step5 = _iterator5.n()).done) {
938
- _context4.next = 162;
939
+ _context4.next = 163;
939
940
  break;
940
941
  }
941
942
  _v2 = _step5.value;
942
943
  _iterator6 = _createForOfIteratorHelper(_v2.Processes);
943
- _context4.prev = 144;
944
+ _context4.prev = 145;
944
945
  _iterator6.s();
945
- case 146:
946
+ case 147:
946
947
  if ((_step6 = _iterator6.n()).done) {
947
- _context4.next = 152;
948
+ _context4.next = 153;
948
949
  break;
949
950
  }
950
951
  v2 = _step6.value;
951
- _context4.next = 150;
952
+ _context4.next = 151;
952
953
  return _assign({
953
954
  message: _v2.Message,
954
955
  process: v2,
955
956
  from: opt.process,
956
957
  signer: mu.signer
957
958
  });
958
- case 150:
959
- _context4.next = 146;
959
+ case 151:
960
+ _context4.next = 147;
960
961
  break;
961
- case 152:
962
- _context4.next = 157;
962
+ case 153:
963
+ _context4.next = 158;
963
964
  break;
964
- case 154:
965
- _context4.prev = 154;
966
- _context4.t23 = _context4["catch"](144);
967
- _iterator6.e(_context4.t23);
968
- case 157:
969
- _context4.prev = 157;
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;
970
971
  _iterator6.f();
971
- return _context4.finish(157);
972
- case 160:
973
- _context4.next = 141;
972
+ return _context4.finish(158);
973
+ case 161:
974
+ _context4.next = 142;
974
975
  break;
975
- case 162:
976
- _context4.next = 167;
976
+ case 163:
977
+ _context4.next = 168;
977
978
  break;
978
- case 164:
979
- _context4.prev = 164;
980
- _context4.t24 = _context4["catch"](139);
981
- _iterator5.e(_context4.t24);
982
- case 167:
983
- _context4.prev = 167;
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;
984
985
  _iterator5.f();
985
- return _context4.finish(167);
986
- case 170:
986
+ return _context4.finish(168);
987
+ case 171:
987
988
  return _context4.abrupt("return", id);
988
- case 173:
989
- _context4.prev = 173;
990
- _context4.t25 = _context4["catch"](39);
991
- console.log(_context4.t25);
992
- case 176:
993
- return _context4.abrupt("return", null);
989
+ case 174:
990
+ _context4.prev = 174;
991
+ _context4.t26 = _context4["catch"](40);
992
+ console.log(_context4.t26);
994
993
  case 177:
994
+ return _context4.abrupt("return", null);
995
+ case 178:
995
996
  case "end":
996
997
  return _context4.stop();
997
998
  }
998
- }, _callee4, null, [[39, 173], [101, 114, 117, 120], [121, 132, 135, 138], [139, 164, 167, 170], [144, 154, 157, 160]]);
999
+ }, _callee4, null, [[40, 174], [102, 115, 118, 121], [122, 133, 136, 139], [140, 165, 168, 171], [145, 155, 158, 161]]);
999
1000
  }));
1000
1001
  return function assign(_x8) {
1001
1002
  return _ref9.apply(this, arguments);
@@ -1084,9 +1085,8 @@ var _default = exports["default"] = function _default() {
1084
1085
  }
1085
1086
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
1086
1087
  "Data-Protocol": "ao",
1087
- Variant: "ao.TN.1",
1088
- Type: "Message",
1089
- SDK: "aoconnect"
1088
+ Variant: variant !== null && variant !== void 0 ? variant : "ao.TN.1",
1089
+ Type: "Message"
1090
1090
  }));
1091
1091
  if (!opt["for"]) {
1092
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
@@ -84,6 +84,7 @@ var AO = /*#__PURE__*/function (_MAO) {
84
84
  _this.createDataItemSigner = (_opt$createDataItemSi = opt.createDataItemSigner) !== null && _opt$createDataItemSi !== void 0 ? _opt$createDataItemSi : _aoconnect.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
@@ -3,8 +3,9 @@ const pkg = WarpArBundles.default ?? WarpArBundles
3
3
  const { createData, ArweaveSigner } = pkg
4
4
  import AR from "./ar.js"
5
5
  import md5 from "md5"
6
+ import { createDataItemSigner } from "@permaweb/aoconnect"
7
+
6
8
  import {
7
- createDataItemSigner,
8
9
  connect,
9
10
  assign,
10
11
  result,
@@ -14,7 +15,7 @@ import {
14
15
  dryrun,
15
16
  monitor,
16
17
  unmonitor,
17
- } from "@permaweb/aoconnect"
18
+ } from "aoconnect-wao"
18
19
 
19
20
  import {
20
21
  dissoc,
@@ -96,6 +97,7 @@ class AO {
96
97
  if (!aoconnect && _port) aoconnect = optAO(_port)
97
98
  if (!ar && _port) ar = { port: _port }
98
99
  this.wao = opt.wao
100
+ this.variant = opt.variant
99
101
  if (isNil(this.wao)) this.wao = in_memory || !isNil(ar?.port)
100
102
  if (!module) {
101
103
  switch (module_type) {
@@ -311,8 +313,8 @@ class AO {
311
313
 
312
314
  async postModule({ data, jwk, tags = {}, overwrite = false }) {
313
315
  const _tags = mergeLeft(tags, {
314
- "Data-Protocol": "ao",
315
- Variant: "ao.TN.1",
316
+ "Data-Protocol": this.protocol ?? "ao",
317
+ Variant: this.variant ?? "ao.TN.1",
316
318
  Type: "Module",
317
319
  "Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
318
320
  "Input-Encoding": "JSON-V1",
@@ -336,8 +338,8 @@ class AO {
336
338
 
337
339
  async postScheduler({ jwk, url, tags = {}, overwrite = false }) {
338
340
  const _tags = mergeLeft(tags, {
339
- "Data-Protocol": "ao",
340
- Variant: "ao.TN.1",
341
+ "Data-Protocol": this.protocol ?? "ao",
342
+ Variant: this.variant ?? "ao.TN.1",
341
343
  Type: "Scheduler-Location",
342
344
  Url: url,
343
345
  "Time-To-Live": "3600000",
@@ -370,6 +372,7 @@ class AO {
370
372
  if (!tags.Authority && this.authority) tags.Authority = this.authority
371
373
  let _tags = buildTags(null, tags)
372
374
  pid = await this.spawn({
375
+ variant: this.variant,
373
376
  memory,
374
377
  module,
375
378
  scheduler,
@@ -515,6 +518,7 @@ class AO {
515
518
  if (err) return { err }
516
519
  let _tags = buildTags(act, tags)
517
520
  const mid = await this.message({
521
+ variant: this.variant,
518
522
  process: pid,
519
523
  signer: this.toSigner(jwk),
520
524
  tags: _tags,
@@ -33,13 +33,14 @@ let onRecovery = {}
33
33
  let ongoing = {}
34
34
 
35
35
  export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
36
- return (mem, { cache, log = false, extensions = {}, hb } = {}) => {
36
+ return (mem, { cache, log = false, extensions = {}, hb, variant } = {}) => {
37
37
  const isMem = mem?.__type__ === "mem"
38
38
  if (!isMem) {
39
39
  let args = { cache }
40
40
  if (mem?.SU_URL) {
41
- args = mergeLeft(mem, args)
42
41
  args.scheduler = scheduler
42
+ args.variant = variant
43
+ args = mergeLeft(mem, args)
43
44
  }
44
45
  mem = new ArMem(args)
45
46
  }
@@ -135,9 +136,8 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
135
136
  null,
136
137
  mergeLeft(tags(opt.tags ?? []), {
137
138
  "Data-Protocol": "ao",
138
- Variant: "ao.TN.1",
139
+ Variant: variant ?? "ao.TN.1",
139
140
  Type: "Process",
140
- SDK: "aoconnect",
141
141
  Module: mod,
142
142
  Scheduler: opt.scheduler,
143
143
  "Content-Type": "text/plain",
@@ -286,8 +286,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
286
286
  Epoch: p.epochs.length,
287
287
  Nonce: "0",
288
288
  "Data-Protocol": "ao",
289
- Variant: "ao.TN.1",
290
- SDK: "aoconnect",
289
+ Variant: variant ?? "ao.TN.1",
291
290
  Type: "Assignment",
292
291
  "Block-Height": await mem.get("height"),
293
292
  Process: opt.process,
@@ -431,9 +430,8 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
431
430
  null,
432
431
  mergeLeft(tags(opt.tags ?? []), {
433
432
  "Data-Protocol": "ao",
434
- Variant: "ao.TN.1",
433
+ Variant: variant ?? "ao.TN.1",
435
434
  Type: "Message",
436
- SDK: "aoconnect",
437
435
  })
438
436
  )
439
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
@@ -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.7",
3
+ "version": "0.18.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",