wao 0.25.3 → 0.26.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 +235 -110
- package/cjs/armem-base.js +6 -5
- package/cjs/hb.js +185 -101
- package/cjs/hyperbeam.js +18 -15
- package/cjs/lua/aos_wamr.js +1 -0
- package/cjs/lua/hyper-aos.js +1 -0
- package/cjs/signer.js +35 -6
- package/cjs/utils.js +2 -1
- package/esm/ao.js +106 -46
- package/esm/armem-base.js +5 -2
- package/esm/hb.js +35 -13
- package/esm/hyperbeam.js +12 -9
- package/esm/lua/aos_wamr.js +1 -0
- package/esm/lua/hyper-aos.js +1 -0
- package/esm/signer.js +21 -4
- package/esm/utils.js +3 -1
- package/package.json +1 -1
- package/cjs/lua/aos2-wamr.wasm +0 -0
- package/cjs/lua/hyper-aos.lua +0 -2563
- package/esm/lua/aos2-wamr.wasm +0 -0
- package/esm/lua/hyper-aos.lua +0 -2563
package/cjs/ao.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var WarpArBundles = _interopRequireWildcard(require("warp-arbundles"));
|
|
8
8
|
var _ar4 = _interopRequireDefault(require("./ar.js"));
|
|
9
|
+
var _hb2 = _interopRequireDefault(require("./hb.js"));
|
|
9
10
|
var _md = _interopRequireDefault(require("md5"));
|
|
10
11
|
var _aoconnect = require("@permaweb/aoconnect-69");
|
|
11
12
|
var _ramda = require("ramda");
|
|
@@ -104,6 +105,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
104
105
|
opt = {};
|
|
105
106
|
}
|
|
106
107
|
var _opt = opt,
|
|
108
|
+
_hb = _opt.hb,
|
|
107
109
|
_opt$authority = _opt.authority,
|
|
108
110
|
authority = _opt$authority === void 0 ? _utils.srcs.authority : _opt$authority,
|
|
109
111
|
module = _opt.module,
|
|
@@ -116,6 +118,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
116
118
|
_opt$in_memory = _opt.in_memory,
|
|
117
119
|
in_memory = _opt$in_memory === void 0 ? false : _opt$in_memory,
|
|
118
120
|
port = _opt.port;
|
|
121
|
+
if (_hb) this.hb = new _hb2["default"]();
|
|
119
122
|
if (!_port && port) _port = port;
|
|
120
123
|
if (!aoconnect && _port) aoconnect = (0, _utils.optAO)(_port);
|
|
121
124
|
if (!ar && _port) ar = {
|
|
@@ -123,6 +126,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
123
126
|
};
|
|
124
127
|
this.wao = opt.wao;
|
|
125
128
|
this.variant = opt.variant;
|
|
129
|
+
this.module_type = module_type;
|
|
126
130
|
if ((0, _ramda.isNil)(this.wao)) this.wao = in_memory || !(0, _ramda.isNil)((_ar2 = ar) === null || _ar2 === void 0 ? void 0 : _ar2.port);
|
|
127
131
|
if (!module) {
|
|
128
132
|
switch (module_type) {
|
|
@@ -132,6 +136,9 @@ var AO = /*#__PURE__*/function () {
|
|
|
132
136
|
case "aos2":
|
|
133
137
|
module = _utils.srcs.module_aos2;
|
|
134
138
|
break;
|
|
139
|
+
case "mainnet":
|
|
140
|
+
module = _utils.srcs.module_mainnet;
|
|
141
|
+
break;
|
|
135
142
|
default:
|
|
136
143
|
module = _utils.srcs.module;
|
|
137
144
|
}
|
|
@@ -174,6 +181,9 @@ var AO = /*#__PURE__*/function () {
|
|
|
174
181
|
this.module = (_module = module) !== null && _module !== void 0 ? _module : _utils.srcs.module_wao;
|
|
175
182
|
this.scheduler = _utils.srcs.scheduler_wao;
|
|
176
183
|
this.authority = _utils.srcs.authority_wao;
|
|
184
|
+
} else if (this.module_type === "mainnet") {
|
|
185
|
+
var _module2;
|
|
186
|
+
this.module = (_module2 = module) !== null && _module2 !== void 0 ? _module2 : _utils.srcs.module_mainnet;
|
|
177
187
|
} else {
|
|
178
188
|
this.module = module;
|
|
179
189
|
this.scheduler = scheduler;
|
|
@@ -190,8 +200,15 @@ var AO = /*#__PURE__*/function () {
|
|
|
190
200
|
_context3.next = 2;
|
|
191
201
|
return this.ar.init(jwk);
|
|
192
202
|
case 2:
|
|
203
|
+
if (!this.hb) {
|
|
204
|
+
_context3.next = 5;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
_context3.next = 5;
|
|
208
|
+
return this.hb.init(this.ar.jwk);
|
|
209
|
+
case 5:
|
|
193
210
|
return _context3.abrupt("return", this);
|
|
194
|
-
case
|
|
211
|
+
case 6:
|
|
195
212
|
case "end":
|
|
196
213
|
return _context3.stop();
|
|
197
214
|
}
|
|
@@ -439,7 +456,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
439
456
|
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;
|
|
440
457
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
441
458
|
"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",
|
|
459
|
+
Variant: ((_this$variant = this.variant) !== null && _this$variant !== void 0 ? _this$variant : this.module_type === "mainnet") ? "ao.TN.1" : "ao.TN.1",
|
|
443
460
|
Type: "Module",
|
|
444
461
|
"Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
445
462
|
"Input-Encoding": "JSON-V1",
|
|
@@ -491,7 +508,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
491
508
|
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;
|
|
492
509
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
493
510
|
"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",
|
|
511
|
+
Variant: ((_this$variant2 = this.variant) !== null && _this$variant2 !== void 0 ? _this$variant2 : this.module_type === "mainnet") ? "ao.TN.1" : "ao.TN.1",
|
|
495
512
|
Type: "Scheduler-Location",
|
|
496
513
|
Url: url,
|
|
497
514
|
"Time-To-Live": "3600000"
|
|
@@ -549,7 +566,6 @@ var AO = /*#__PURE__*/function () {
|
|
|
549
566
|
var _spwn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
550
567
|
var _ref11,
|
|
551
568
|
boot,
|
|
552
|
-
_ref11$module,
|
|
553
569
|
module,
|
|
554
570
|
_ref11$scheduler,
|
|
555
571
|
scheduler,
|
|
@@ -562,13 +578,15 @@ var AO = /*#__PURE__*/function () {
|
|
|
562
578
|
err,
|
|
563
579
|
_yield$this$ar$checkW,
|
|
564
580
|
pid,
|
|
565
|
-
|
|
581
|
+
_yield$this$hb$spawnL,
|
|
582
|
+
_module3,
|
|
583
|
+
_tags2,
|
|
566
584
|
p,
|
|
567
585
|
_args8 = arguments;
|
|
568
586
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
569
587
|
while (1) switch (_context8.prev = _context8.next) {
|
|
570
588
|
case 0:
|
|
571
|
-
_ref11 = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {}, boot = _ref11.boot,
|
|
589
|
+
_ref11 = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {}, boot = _ref11.boot, module = _ref11.module, _ref11$scheduler = _ref11.scheduler, scheduler = _ref11$scheduler === void 0 ? this.scheduler : _ref11$scheduler, memory = _ref11.memory, jwk = _ref11.jwk, _ref11$tags = _ref11.tags, tags = _ref11$tags === void 0 ? {} : _ref11$tags, data = _ref11.data, auth = _ref11.auth;
|
|
572
590
|
err = null;
|
|
573
591
|
_context8.next = 4;
|
|
574
592
|
return this.ar.checkWallet({
|
|
@@ -590,38 +608,63 @@ var AO = /*#__PURE__*/function () {
|
|
|
590
608
|
_context8.prev = 10;
|
|
591
609
|
if (boot) tags["On-Boot"] = boot;
|
|
592
610
|
if (auth) tags.Authority = auth;
|
|
593
|
-
if (!
|
|
594
|
-
|
|
611
|
+
if (!this.hb) {
|
|
612
|
+
_context8.next = 23;
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
;
|
|
595
616
|
_context8.next = 17;
|
|
617
|
+
return this.hb.spawnLegacy({
|
|
618
|
+
module: module,
|
|
619
|
+
tags: tags,
|
|
620
|
+
data: data
|
|
621
|
+
});
|
|
622
|
+
case 17:
|
|
623
|
+
_yield$this$hb$spawnL = _context8.sent;
|
|
624
|
+
pid = _yield$this$hb$spawnL.pid;
|
|
625
|
+
_context8.next = 21;
|
|
626
|
+
return this.hb.computeLegacy({
|
|
627
|
+
pid: pid,
|
|
628
|
+
slot: 0
|
|
629
|
+
});
|
|
630
|
+
case 21:
|
|
631
|
+
_context8.next = 29;
|
|
632
|
+
break;
|
|
633
|
+
case 23:
|
|
634
|
+
(_module3 = module) !== null && _module3 !== void 0 ? _module3 : module = this.module;
|
|
635
|
+
if (!tags.Authority && this.authority) tags.Authority = this.authority;
|
|
636
|
+
_tags2 = (0, _utils.buildTags)(null, tags);
|
|
637
|
+
_context8.next = 28;
|
|
596
638
|
return this.spawn({
|
|
597
639
|
variant: this.variant,
|
|
598
640
|
memory: memory,
|
|
599
641
|
module: module,
|
|
600
642
|
scheduler: scheduler,
|
|
601
643
|
signer: this.toSigner(jwk),
|
|
602
|
-
tags:
|
|
644
|
+
tags: _tags2,
|
|
603
645
|
data: (0, _utils.jsonToStr)(data)
|
|
604
646
|
});
|
|
605
|
-
case
|
|
647
|
+
case 28:
|
|
606
648
|
pid = _context8.sent;
|
|
607
|
-
|
|
649
|
+
case 29:
|
|
650
|
+
_context8.next = 34;
|
|
608
651
|
break;
|
|
609
|
-
case
|
|
610
|
-
_context8.prev =
|
|
652
|
+
case 31:
|
|
653
|
+
_context8.prev = 31;
|
|
611
654
|
_context8.t0 = _context8["catch"](10);
|
|
612
655
|
err = _context8.t0;
|
|
613
|
-
case
|
|
656
|
+
case 34:
|
|
614
657
|
p = pid ? this.p(pid) : null;
|
|
615
658
|
return _context8.abrupt("return", {
|
|
616
659
|
err: err,
|
|
617
660
|
pid: pid,
|
|
618
661
|
p: p
|
|
619
662
|
});
|
|
620
|
-
case
|
|
663
|
+
case 36:
|
|
621
664
|
case "end":
|
|
622
665
|
return _context8.stop();
|
|
623
666
|
}
|
|
624
|
-
}, _callee8, this, [[10,
|
|
667
|
+
}, _callee8, this, [[10, 31]]);
|
|
625
668
|
}));
|
|
626
669
|
function spwn() {
|
|
627
670
|
return _spwn.apply(this, arguments);
|
|
@@ -637,7 +680,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
637
680
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
638
681
|
while (1) switch (_context11.prev = _context11.next) {
|
|
639
682
|
case 0:
|
|
640
|
-
jwk = _ref12.jwk, pid = _ref12.pid, mid = _ref12.mid, _ref12$check = _ref12.check, check = _ref12$check === void 0 ? [] : _ref12$check, get = _ref12.get, _ref12$timeout = _ref12.timeout, timeout = _ref12$timeout === void 0 ?
|
|
683
|
+
jwk = _ref12.jwk, pid = _ref12.pid, mid = _ref12.mid, _ref12$check = _ref12.check, check = _ref12$check === void 0 ? [] : _ref12$check, get = _ref12.get, _ref12$timeout = _ref12.timeout, timeout = _ref12$timeout === void 0 ? 5000 : _ref12$timeout, _ref12$mode = _ref12.mode, mode = _ref12$mode === void 0 ? "aoconnect" : _ref12$mode, _ref12$limit = _ref12.limit, limit = _ref12$limit === void 0 ? 25 : _ref12$limit;
|
|
641
684
|
err = null;
|
|
642
685
|
hash = null;
|
|
643
686
|
getNewTxs = /*#__PURE__*/function () {
|
|
@@ -810,13 +853,34 @@ var AO = /*#__PURE__*/function () {
|
|
|
810
853
|
from: _context11.t1
|
|
811
854
|
};
|
|
812
855
|
_txs = [_context11.t2];
|
|
813
|
-
|
|
856
|
+
if (!this.hb) {
|
|
857
|
+
_context11.next = 23;
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
860
|
+
_context11.next = 18;
|
|
861
|
+
return this.hb.computeLegacy({
|
|
862
|
+
pid: pid,
|
|
863
|
+
slot: mid
|
|
864
|
+
});
|
|
865
|
+
case 18:
|
|
866
|
+
res = _context11.sent;
|
|
867
|
+
_context11.next = 21;
|
|
868
|
+
return this.hb.get({
|
|
869
|
+
path: "/".concat(pid, "/push"),
|
|
870
|
+
slot: mid
|
|
871
|
+
});
|
|
872
|
+
case 21:
|
|
873
|
+
_context11.next = 26;
|
|
874
|
+
break;
|
|
875
|
+
case 23:
|
|
876
|
+
_context11.next = 25;
|
|
814
877
|
return this.result({
|
|
815
878
|
process: pid,
|
|
816
879
|
message: mid
|
|
817
880
|
});
|
|
818
|
-
case
|
|
881
|
+
case 25:
|
|
819
882
|
res = _context11.sent;
|
|
883
|
+
case 26:
|
|
820
884
|
hash = getHash(res);
|
|
821
885
|
_txmap = _defineProperty({}, mid, {
|
|
822
886
|
checked: false,
|
|
@@ -827,131 +891,131 @@ var AO = /*#__PURE__*/function () {
|
|
|
827
891
|
res: res
|
|
828
892
|
});
|
|
829
893
|
checked = false;
|
|
830
|
-
case
|
|
894
|
+
case 30:
|
|
831
895
|
_iterator5 = _createForOfIteratorHelper(_txs);
|
|
832
|
-
_context11.prev =
|
|
896
|
+
_context11.prev = 31;
|
|
833
897
|
_iterator5.s();
|
|
834
|
-
case
|
|
898
|
+
case 33:
|
|
835
899
|
if ((_step5 = _iterator5.n()).done) {
|
|
836
|
-
_context11.next =
|
|
900
|
+
_context11.next = 47;
|
|
837
901
|
break;
|
|
838
902
|
}
|
|
839
903
|
v = _step5.value;
|
|
840
904
|
if (_txmap[v.id].checked) {
|
|
841
|
-
_context11.next =
|
|
905
|
+
_context11.next = 45;
|
|
842
906
|
break;
|
|
843
907
|
}
|
|
844
908
|
_txmap[v.id].checked = true;
|
|
845
909
|
if (!(0, _ramda.isNil)(_txmap[v.id].res)) {
|
|
846
|
-
_context11.next =
|
|
910
|
+
_context11.next = 42;
|
|
847
911
|
break;
|
|
848
912
|
}
|
|
849
|
-
_context11.next =
|
|
913
|
+
_context11.next = 40;
|
|
850
914
|
return this.result({
|
|
851
915
|
process: pid,
|
|
852
916
|
message: v.id
|
|
853
917
|
});
|
|
854
|
-
case
|
|
918
|
+
case 40:
|
|
855
919
|
_res = _context11.sent;
|
|
856
920
|
_txmap[v.id].res = _res;
|
|
857
|
-
case
|
|
921
|
+
case 42:
|
|
858
922
|
if (!(0, _ramda.isNil)(check) && check.length > 0) {
|
|
859
923
|
checked = (0, _utils.allChecked)(check, _txmap[v.id].res, v.from);
|
|
860
924
|
} else {
|
|
861
925
|
checked = true;
|
|
862
926
|
}
|
|
863
927
|
if (!checked) {
|
|
864
|
-
_context11.next =
|
|
928
|
+
_context11.next = 45;
|
|
865
929
|
break;
|
|
866
930
|
}
|
|
867
|
-
return _context11.abrupt("break",
|
|
868
|
-
case
|
|
869
|
-
_context11.next =
|
|
931
|
+
return _context11.abrupt("break", 47);
|
|
932
|
+
case 45:
|
|
933
|
+
_context11.next = 33;
|
|
870
934
|
break;
|
|
871
|
-
case
|
|
872
|
-
_context11.next =
|
|
935
|
+
case 47:
|
|
936
|
+
_context11.next = 52;
|
|
873
937
|
break;
|
|
874
|
-
case
|
|
875
|
-
_context11.prev =
|
|
876
|
-
_context11.t3 = _context11["catch"](
|
|
938
|
+
case 49:
|
|
939
|
+
_context11.prev = 49;
|
|
940
|
+
_context11.t3 = _context11["catch"](31);
|
|
877
941
|
_iterator5.e(_context11.t3);
|
|
878
|
-
case
|
|
879
|
-
_context11.prev =
|
|
942
|
+
case 52:
|
|
943
|
+
_context11.prev = 52;
|
|
880
944
|
_iterator5.f();
|
|
881
|
-
return _context11.finish(
|
|
882
|
-
case
|
|
945
|
+
return _context11.finish(52);
|
|
946
|
+
case 55:
|
|
883
947
|
if (!checked) {
|
|
884
|
-
_context11.next =
|
|
948
|
+
_context11.next = 57;
|
|
885
949
|
break;
|
|
886
950
|
}
|
|
887
|
-
return _context11.abrupt("break",
|
|
888
|
-
case
|
|
889
|
-
_context11.next =
|
|
951
|
+
return _context11.abrupt("break", 62);
|
|
952
|
+
case 57:
|
|
953
|
+
_context11.next = 59;
|
|
890
954
|
return (0, _utils.wait)(1000);
|
|
891
|
-
case
|
|
892
|
-
_context11.next =
|
|
955
|
+
case 59:
|
|
956
|
+
_context11.next = 61;
|
|
893
957
|
return getNewTxs(pid, _txs, _txmap);
|
|
894
|
-
case
|
|
958
|
+
case 61:
|
|
895
959
|
if (Date.now() - start < timeout) {
|
|
896
|
-
_context11.next =
|
|
960
|
+
_context11.next = 30;
|
|
897
961
|
break;
|
|
898
962
|
}
|
|
899
|
-
case
|
|
963
|
+
case 62:
|
|
900
964
|
if (checked) {
|
|
901
|
-
_context11.next =
|
|
965
|
+
_context11.next = 66;
|
|
902
966
|
break;
|
|
903
967
|
}
|
|
904
968
|
err = "something went wrong!";
|
|
905
|
-
_context11.next =
|
|
969
|
+
_context11.next = 90;
|
|
906
970
|
break;
|
|
907
|
-
case
|
|
971
|
+
case 66:
|
|
908
972
|
_context11.t4 = _utils.mergeOut;
|
|
909
973
|
_context11.t5 = out;
|
|
910
|
-
_context11.next =
|
|
974
|
+
_context11.next = 70;
|
|
911
975
|
return checkOut(get, _txs, _txmap, out);
|
|
912
|
-
case
|
|
976
|
+
case 70:
|
|
913
977
|
_context11.t6 = _context11.sent;
|
|
914
978
|
_context11.t7 = get;
|
|
915
979
|
out = (0, _context11.t4)(_context11.t5, _context11.t6, _context11.t7);
|
|
916
980
|
if (!(!(0, _utils.isOutComplete)(out, get) && !(0, _ramda.isNil)(get))) {
|
|
917
|
-
_context11.next =
|
|
981
|
+
_context11.next = 90;
|
|
918
982
|
break;
|
|
919
983
|
}
|
|
920
|
-
case
|
|
984
|
+
case 74:
|
|
921
985
|
if (!(Date.now() - start < timeout)) {
|
|
922
|
-
_context11.next =
|
|
986
|
+
_context11.next = 90;
|
|
923
987
|
break;
|
|
924
988
|
}
|
|
925
|
-
_context11.next =
|
|
989
|
+
_context11.next = 77;
|
|
926
990
|
return getNewTxs(pid, _txs, _txmap);
|
|
927
|
-
case
|
|
991
|
+
case 77:
|
|
928
992
|
_context11.t8 = _utils.mergeOut;
|
|
929
993
|
_context11.t9 = out;
|
|
930
|
-
_context11.next =
|
|
994
|
+
_context11.next = 81;
|
|
931
995
|
return checkOut(get, _txs, _txmap, out);
|
|
932
|
-
case
|
|
996
|
+
case 81:
|
|
933
997
|
_context11.t10 = _context11.sent;
|
|
934
998
|
_context11.t11 = get;
|
|
935
999
|
out = (0, _context11.t8)(_context11.t9, _context11.t10, _context11.t11);
|
|
936
1000
|
if (!(0, _utils.isOutComplete)(out, get)) {
|
|
937
|
-
_context11.next =
|
|
1001
|
+
_context11.next = 86;
|
|
938
1002
|
break;
|
|
939
1003
|
}
|
|
940
|
-
return _context11.abrupt("break",
|
|
941
|
-
case
|
|
942
|
-
_context11.next =
|
|
1004
|
+
return _context11.abrupt("break", 90);
|
|
1005
|
+
case 86:
|
|
1006
|
+
_context11.next = 88;
|
|
943
1007
|
return (0, _utils.wait)(1000);
|
|
944
|
-
case
|
|
945
|
-
_context11.next =
|
|
1008
|
+
case 88:
|
|
1009
|
+
_context11.next = 74;
|
|
946
1010
|
break;
|
|
947
|
-
case
|
|
948
|
-
_context11.next =
|
|
1011
|
+
case 90:
|
|
1012
|
+
_context11.next = 95;
|
|
949
1013
|
break;
|
|
950
|
-
case
|
|
951
|
-
_context11.prev =
|
|
1014
|
+
case 92:
|
|
1015
|
+
_context11.prev = 92;
|
|
952
1016
|
_context11.t12 = _context11["catch"](7);
|
|
953
1017
|
err = _context11.t12;
|
|
954
|
-
case
|
|
1018
|
+
case 95:
|
|
955
1019
|
return _context11.abrupt("return", {
|
|
956
1020
|
mid: mid,
|
|
957
1021
|
res: res,
|
|
@@ -959,11 +1023,11 @@ var AO = /*#__PURE__*/function () {
|
|
|
959
1023
|
out: out,
|
|
960
1024
|
results: results
|
|
961
1025
|
});
|
|
962
|
-
case
|
|
1026
|
+
case 96:
|
|
963
1027
|
case "end":
|
|
964
1028
|
return _context11.stop();
|
|
965
1029
|
}
|
|
966
|
-
}, _callee11, this, [[7,
|
|
1030
|
+
}, _callee11, this, [[7, 92], [31, 49, 52, 55]]);
|
|
967
1031
|
}));
|
|
968
1032
|
function res(_x7) {
|
|
969
1033
|
return _res2.apply(this, arguments);
|
|
@@ -974,11 +1038,11 @@ var AO = /*#__PURE__*/function () {
|
|
|
974
1038
|
key: "msg",
|
|
975
1039
|
value: function () {
|
|
976
1040
|
var _msg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref15) {
|
|
977
|
-
var pid, jwk, data, _ref15$act, act, _ref15$tags, tags, _ref15$check, check, get, _ref15$timeout, timeout, _ref15$mode, mode, _ref15$limit, limit, err, _yield$this$ar$checkW2,
|
|
1041
|
+
var pid, jwk, data, _ref15$act, act, _ref15$tags, tags, _ref15$check, check, get, _ref15$timeout, timeout, _ref15$mode, mode, _ref15$limit, limit, err, _yield$this$ar$checkW2, _yield$this$hb$schedu, mid, _tags3, _mid;
|
|
978
1042
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
979
1043
|
while (1) switch (_context12.prev = _context12.next) {
|
|
980
1044
|
case 0:
|
|
981
|
-
pid = _ref15.pid, jwk = _ref15.jwk, data = _ref15.data, _ref15$act = _ref15.act, act = _ref15$act === void 0 ? "Eval" : _ref15$act, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, _ref15$check = _ref15.check, check = _ref15$check === void 0 ? [] : _ref15$check, get = _ref15.get, _ref15$timeout = _ref15.timeout, timeout = _ref15$timeout === void 0 ?
|
|
1045
|
+
pid = _ref15.pid, jwk = _ref15.jwk, data = _ref15.data, _ref15$act = _ref15.act, act = _ref15$act === void 0 ? "Eval" : _ref15$act, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, _ref15$check = _ref15.check, check = _ref15$check === void 0 ? [] : _ref15$check, get = _ref15.get, _ref15$timeout = _ref15.timeout, timeout = _ref15$timeout === void 0 ? 5000 : _ref15$timeout, _ref15$mode = _ref15.mode, mode = _ref15$mode === void 0 ? "aoconnect" : _ref15$mode, _ref15$limit = _ref15.limit, limit = _ref15$limit === void 0 ? 25 : _ref15$limit;
|
|
982
1046
|
_context12.next = 3;
|
|
983
1047
|
return this.ar.checkWallet({
|
|
984
1048
|
jwk: jwk
|
|
@@ -995,21 +1059,49 @@ var AO = /*#__PURE__*/function () {
|
|
|
995
1059
|
err: err
|
|
996
1060
|
});
|
|
997
1061
|
case 8:
|
|
998
|
-
|
|
1062
|
+
if (!this.hb) {
|
|
1063
|
+
_context12.next = 18;
|
|
1064
|
+
break;
|
|
1065
|
+
}
|
|
999
1066
|
_context12.next = 11;
|
|
1067
|
+
return this.hb.scheduleLegacy({
|
|
1068
|
+
pid: pid,
|
|
1069
|
+
tags: tags !== null && tags !== void 0 ? tags : {},
|
|
1070
|
+
action: act,
|
|
1071
|
+
data: data
|
|
1072
|
+
});
|
|
1073
|
+
case 11:
|
|
1074
|
+
_yield$this$hb$schedu = _context12.sent;
|
|
1075
|
+
mid = _yield$this$hb$schedu.slot;
|
|
1076
|
+
_context12.next = 15;
|
|
1077
|
+
return this.res({
|
|
1078
|
+
pid: pid,
|
|
1079
|
+
mid: mid,
|
|
1080
|
+
jwk: jwk,
|
|
1081
|
+
check: check,
|
|
1082
|
+
get: get,
|
|
1083
|
+
timeout: timeout,
|
|
1084
|
+
mode: mode,
|
|
1085
|
+
limit: limit
|
|
1086
|
+
});
|
|
1087
|
+
case 15:
|
|
1088
|
+
return _context12.abrupt("return", _context12.sent);
|
|
1089
|
+
case 18:
|
|
1090
|
+
_tags3 = (0, _utils.buildTags)(act, tags);
|
|
1091
|
+
_context12.next = 21;
|
|
1000
1092
|
return this.message({
|
|
1001
1093
|
variant: this.variant,
|
|
1002
1094
|
process: pid,
|
|
1003
1095
|
signer: this.toSigner(jwk),
|
|
1004
|
-
tags:
|
|
1096
|
+
tags: _tags3,
|
|
1005
1097
|
data: (0, _utils.jsonToStr)(data)
|
|
1006
1098
|
});
|
|
1007
|
-
case
|
|
1008
|
-
|
|
1009
|
-
_context12.next =
|
|
1099
|
+
case 21:
|
|
1100
|
+
_mid = _context12.sent;
|
|
1101
|
+
_context12.next = 24;
|
|
1010
1102
|
return this.res({
|
|
1011
1103
|
pid: pid,
|
|
1012
|
-
mid:
|
|
1104
|
+
mid: _mid,
|
|
1013
1105
|
jwk: jwk,
|
|
1014
1106
|
check: check,
|
|
1015
1107
|
get: get,
|
|
@@ -1017,9 +1109,9 @@ var AO = /*#__PURE__*/function () {
|
|
|
1017
1109
|
mode: mode,
|
|
1018
1110
|
limit: limit
|
|
1019
1111
|
});
|
|
1020
|
-
case
|
|
1112
|
+
case 24:
|
|
1021
1113
|
return _context12.abrupt("return", _context12.sent);
|
|
1022
|
-
case
|
|
1114
|
+
case 25:
|
|
1023
1115
|
case "end":
|
|
1024
1116
|
return _context12.stop();
|
|
1025
1117
|
}
|
|
@@ -1107,7 +1199,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
1107
1199
|
key: "dry",
|
|
1108
1200
|
value: function () {
|
|
1109
1201
|
var _dry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref17) {
|
|
1110
|
-
var pid, jwk, data, _ref17$act, act, _ref17$tags, tags, _ref17$check, check, get, err, _yield$this$ar$checkW4, res, out, _tags,
|
|
1202
|
+
var pid, jwk, data, _ref17$act, act, _ref17$tags, tags, _ref17$check, check, get, err, _yield$this$ar$checkW4, res, out, _tags, checks;
|
|
1111
1203
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1112
1204
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1113
1205
|
case 0:
|
|
@@ -1132,37 +1224,53 @@ var AO = /*#__PURE__*/function () {
|
|
|
1132
1224
|
res = null, out = null;
|
|
1133
1225
|
_tags = (0, _utils.buildTags)(act, tags);
|
|
1134
1226
|
_context14.prev = 11;
|
|
1135
|
-
|
|
1227
|
+
if (!this.hb) {
|
|
1228
|
+
_context14.next = 18;
|
|
1229
|
+
break;
|
|
1230
|
+
}
|
|
1231
|
+
_context14.next = 15;
|
|
1232
|
+
return this.hb.dryrun({
|
|
1233
|
+
action: act,
|
|
1234
|
+
pid: pid,
|
|
1235
|
+
tags: tags,
|
|
1236
|
+
data: (0, _utils.jsonToStr)(data)
|
|
1237
|
+
});
|
|
1238
|
+
case 15:
|
|
1239
|
+
res = _context14.sent;
|
|
1240
|
+
_context14.next = 21;
|
|
1241
|
+
break;
|
|
1242
|
+
case 18:
|
|
1243
|
+
_context14.next = 20;
|
|
1136
1244
|
return this.dryrun({
|
|
1137
1245
|
process: pid,
|
|
1138
1246
|
signer: this.toSigner(jwk),
|
|
1139
1247
|
tags: _tags,
|
|
1140
1248
|
data: (0, _utils.jsonToStr)(data)
|
|
1141
1249
|
});
|
|
1142
|
-
case
|
|
1143
|
-
|
|
1144
|
-
|
|
1250
|
+
case 20:
|
|
1251
|
+
res = _context14.sent;
|
|
1252
|
+
case 21:
|
|
1145
1253
|
checks = [];
|
|
1146
1254
|
if (!(0, _ramda.is)(Array, check)) check = [check];
|
|
1147
1255
|
if (!(0, _utils.allChecked)(check, res)) err = "something went wrong";
|
|
1148
1256
|
if (!err && !(0, _ramda.isNil)(get)) out = (0, _utils.getTagVal)(get, res);
|
|
1149
|
-
_context14.next =
|
|
1257
|
+
_context14.next = 30;
|
|
1150
1258
|
break;
|
|
1151
|
-
case
|
|
1152
|
-
_context14.prev =
|
|
1259
|
+
case 27:
|
|
1260
|
+
_context14.prev = 27;
|
|
1153
1261
|
_context14.t0 = _context14["catch"](11);
|
|
1154
1262
|
err = _context14.t0;
|
|
1155
|
-
case
|
|
1263
|
+
case 30:
|
|
1156
1264
|
return _context14.abrupt("return", {
|
|
1157
1265
|
res: res,
|
|
1158
1266
|
err: err,
|
|
1159
1267
|
out: out
|
|
1160
1268
|
});
|
|
1161
|
-
case
|
|
1269
|
+
case 31:
|
|
1162
1270
|
case "end":
|
|
1163
1271
|
return _context14.stop();
|
|
1164
1272
|
}
|
|
1165
|
-
}, _callee14, this, [[11,
|
|
1273
|
+
}, _callee14, this, [[11, 27]]);
|
|
1166
1274
|
}));
|
|
1167
1275
|
function dry(_x17) {
|
|
1168
1276
|
return _dry.apply(this, arguments);
|
|
@@ -1185,21 +1293,38 @@ var AO = /*#__PURE__*/function () {
|
|
|
1185
1293
|
res = null;
|
|
1186
1294
|
_context16.prev = 5;
|
|
1187
1295
|
sort = asc ? "ASC" : "DESC";
|
|
1188
|
-
|
|
1296
|
+
if (!this.hb) {
|
|
1297
|
+
_context16.next = 13;
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
_context16.next = 10;
|
|
1301
|
+
return this.hb.results({
|
|
1302
|
+
process: pid,
|
|
1303
|
+
limit: limit,
|
|
1304
|
+
sort: sort,
|
|
1305
|
+
from: cursor
|
|
1306
|
+
});
|
|
1307
|
+
case 10:
|
|
1308
|
+
res = _context16.sent;
|
|
1309
|
+
_context16.next = 16;
|
|
1310
|
+
break;
|
|
1311
|
+
case 13:
|
|
1312
|
+
_context16.next = 15;
|
|
1189
1313
|
return this.results({
|
|
1190
1314
|
process: pid,
|
|
1191
1315
|
limit: limit,
|
|
1192
1316
|
sort: sort,
|
|
1193
|
-
|
|
1317
|
+
from: cursor
|
|
1194
1318
|
});
|
|
1195
|
-
case
|
|
1319
|
+
case 15:
|
|
1196
1320
|
res = _context16.sent;
|
|
1321
|
+
case 16:
|
|
1197
1322
|
if (res.edges) {
|
|
1198
|
-
_context16.next =
|
|
1323
|
+
_context16.next = 18;
|
|
1199
1324
|
break;
|
|
1200
1325
|
}
|
|
1201
1326
|
return _context16.abrupt("return", null);
|
|
1202
|
-
case
|
|
1327
|
+
case 18:
|
|
1203
1328
|
msgs = (0, _ramda.map)(function (v) {
|
|
1204
1329
|
return _objectSpread({
|
|
1205
1330
|
cursor: v.cursor
|
|
@@ -1216,7 +1341,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
1216
1341
|
process: pid,
|
|
1217
1342
|
limit: limit,
|
|
1218
1343
|
sort: sort,
|
|
1219
|
-
|
|
1344
|
+
from: (0, _ramda.last)(res.edges).cursor
|
|
1220
1345
|
});
|
|
1221
1346
|
case 2:
|
|
1222
1347
|
return _context15.abrupt("return", _context15.sent);
|
|
@@ -1231,23 +1356,23 @@ var AO = /*#__PURE__*/function () {
|
|
|
1231
1356
|
};
|
|
1232
1357
|
}();
|
|
1233
1358
|
}
|
|
1234
|
-
_context16.next =
|
|
1359
|
+
_context16.next = 25;
|
|
1235
1360
|
break;
|
|
1236
|
-
case
|
|
1237
|
-
_context16.prev =
|
|
1361
|
+
case 22:
|
|
1362
|
+
_context16.prev = 22;
|
|
1238
1363
|
_context16.t0 = _context16["catch"](5);
|
|
1239
1364
|
err = _context16.t0;
|
|
1240
|
-
case
|
|
1365
|
+
case 25:
|
|
1241
1366
|
return _context16.abrupt("return", {
|
|
1242
1367
|
err: err,
|
|
1243
1368
|
out: msgs,
|
|
1244
1369
|
res: res
|
|
1245
1370
|
});
|
|
1246
|
-
case
|
|
1371
|
+
case 26:
|
|
1247
1372
|
case "end":
|
|
1248
1373
|
return _context16.stop();
|
|
1249
1374
|
}
|
|
1250
|
-
}, _callee16, this, [[5,
|
|
1375
|
+
}, _callee16, this, [[5, 22]]);
|
|
1251
1376
|
}));
|
|
1252
1377
|
function ress(_x18) {
|
|
1253
1378
|
return _ress.apply(this, arguments);
|
|
@@ -1748,10 +1873,10 @@ var getParams = function getParams(tags, opts) {
|
|
|
1748
1873
|
var _opts = opts;
|
|
1749
1874
|
if ((!(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.get) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.check) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.jwk) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.data) || (0, _ramda.is)(Boolean, tags) || (0, _ramda.is)(String, tags)) && (0, _ramda.isNil)(opts)) {
|
|
1750
1875
|
_opts = tags;
|
|
1751
|
-
_tags =
|
|
1876
|
+
_tags = {};
|
|
1752
1877
|
}
|
|
1753
1878
|
if ((0, _ramda.isNil)(_opts)) _opts = {
|
|
1754
|
-
get:
|
|
1879
|
+
get: false
|
|
1755
1880
|
};else if ((0, _ramda.is)(Boolean, _opts) || (0, _ramda.is)(String, _opts)) _opts = {
|
|
1756
1881
|
get: _opts
|
|
1757
1882
|
};
|