wao 0.25.3 → 0.25.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/armem-base.js CHANGED
@@ -225,7 +225,8 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
225
225
  this.msgs = {};
226
226
  this.wasms = {
227
227
  "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s": {
228
- file: "aos2_0_6"
228
+ file: "aos2_0_6",
229
+ variant: "ao.TN.1"
229
230
  },
230
231
  "WASM32-D8q2OmZ4Mok00sD2Y_6SYEQ7Hjx-6VZ_jl3g": {
231
232
  file: "aos2_0_4_32",
@@ -248,7 +249,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
248
249
  }
249
250
  var txs = [];
250
251
  for (var key in this.wasms) {
251
- var _this$variant, _w$format, _w$input_encoding, _w$output_encoding, _w$memory_limit, _w$compute_limit, _w$extension;
252
+ var _ref2, _w$variant, _w$format, _w$input_encoding, _w$output_encoding, _w$memory_limit, _w$compute_limit, _w$extension;
252
253
  var w = this.wasms[key];
253
254
  txs.push(key);
254
255
  this.txs[key] = {
@@ -256,7 +257,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
256
257
  block: 0,
257
258
  tags: (0, _utils.buildTags)(null, {
258
259
  "Data-Protocol": "ao",
259
- Variant: (_this$variant = this.variant) !== null && _this$variant !== void 0 ? _this$variant : "ao.TN.1",
260
+ Variant: (_ref2 = (_w$variant = w.variant) !== null && _w$variant !== void 0 ? _w$variant : this.variant) !== null && _ref2 !== void 0 ? _ref2 : "ao.TN.1",
260
261
  Type: "Module",
261
262
  "Module-Format": (_w$format = w.format) !== null && _w$format !== void 0 ? _w$format : "wasm64-unknown-emscripten-draft_2024_02_15",
262
263
  "Input-Encoding": (_w$input_encoding = w.input_encoding) !== null && _w$input_encoding !== void 0 ? _w$input_encoding : "JSON-V1",
@@ -268,7 +269,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
268
269
  };
269
270
  }
270
271
  if (this.scheduler && this.SU_URL) {
271
- var _this$variant2;
272
+ var _this$variant;
272
273
  var _key = this.scheduler;
273
274
  txs.push(_key);
274
275
  this.addrmap[this.scheduler] = {
@@ -280,7 +281,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
280
281
  owner: this.scheduler,
281
282
  tags: (0, _utils.buildTags)(null, {
282
283
  "Data-Protocol": "ao",
283
- Variant: (_this$variant2 = this.variant) !== null && _this$variant2 !== void 0 ? _this$variant2 : "ao.TN.1",
284
+ Variant: (_this$variant = this.variant) !== null && _this$variant !== void 0 ? _this$variant : "ao.TN.1",
284
285
  Type: "Scheduler-Location",
285
286
  Url: this.SU_URL,
286
287
  "Time-To-Live": 1000 * 60 * 60 * 24 * 365 * 10
package/cjs/hb.js CHANGED
@@ -10,7 +10,10 @@ var _utils = require("./utils.js");
10
10
  var _signer = require("./signer.js");
11
11
  var _path4 = require("path");
12
12
  var _fs = require("fs");
13
+ var _hyperAos = _interopRequireDefault(require("./lua/hyper-aos.js"));
14
+ var _aos_wamr = _interopRequireDefault(require("./lua/aos_wamr.js"));
13
15
  var _excluded = ["path"];
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
14
17
  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
18
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
16
19
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
@@ -335,7 +338,7 @@ var HB = /*#__PURE__*/function () {
335
338
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
336
339
  while (1) switch (_context10.prev = _context10.next) {
337
340
  case 0:
338
- wasm = (0, _fs.readFileSync)((0, _path4.resolve)(import.meta.dirname, "./lua/aos2-wamr.wasm"));
341
+ wasm = Buffer.from(_aos_wamr["default"], "base64");
339
342
  _context10.next = 3;
340
343
  return this.cacheModule(wasm, "application/wasm");
341
344
  case 3:
@@ -362,7 +365,7 @@ var HB = /*#__PURE__*/function () {
362
365
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
363
366
  while (1) switch (_context11.prev = _context11.next) {
364
367
  case 0:
365
- lua = (0, _fs.readFileSync)((0, _path4.resolve)(import.meta.dirname, "./lua/hyper-aos.lua"));
368
+ lua = Buffer.from(_hyperAos["default"], "base64");
366
369
  _context11.next = 3;
367
370
  return this.cacheModule(lua, "application/lua");
368
371
  case 3:
@@ -1028,6 +1031,7 @@ var HB = /*#__PURE__*/function () {
1028
1031
  Type: "Process",
1029
1032
  image: image,
1030
1033
  "execution-device": "stack@1.0",
1034
+ "push-device": "push@1.0",
1031
1035
  "device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "patch@1.0", "multipass@1.0"],
1032
1036
  "output-prefix": "wasm",
1033
1037
  "patch-from": "/results/outbox",
@@ -1106,6 +1110,7 @@ var HB = /*#__PURE__*/function () {
1106
1110
  Type: "Process",
1107
1111
  module: lua,
1108
1112
  "execution-device": "lua@5.3a",
1113
+ "push-device": "push@1.0",
1109
1114
  "patch-from": "/results/outbox"
1110
1115
  });
1111
1116
  case 18:
@@ -1321,10 +1326,11 @@ var HB = /*#__PURE__*/function () {
1321
1326
  Authority: this._info.address,
1322
1327
  "scheduler-location": this._info.address,
1323
1328
  "random-seed": seed(16),
1324
- module: "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
1329
+ module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
1325
1330
  device: "process@1.0",
1326
1331
  "scheduler-device": "scheduler@1.0",
1327
1332
  "execution-device": "stack@1.0",
1333
+ "push-device": "push@1.0",
1328
1334
  "device-stack": ["genesis-wasm@1.0", "patch@1.0"],
1329
1335
  "patch-from": "/results/outbox",
1330
1336
  "stack-keys": ["init", "compute", "snapshot", "normalize"]
@@ -1345,44 +1351,93 @@ var HB = /*#__PURE__*/function () {
1345
1351
  return spawnLegacy;
1346
1352
  }()
1347
1353
  }, {
1348
- key: "dryrun",
1354
+ key: "results",
1349
1355
  value: function () {
1350
- var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
1356
+ var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
1351
1357
  var _ref15,
1352
- _ref15$tags,
1358
+ process,
1359
+ limit,
1360
+ _ref15$sort,
1361
+ sort,
1362
+ from,
1363
+ to,
1364
+ params,
1365
+ addParam,
1366
+ res,
1367
+ _args34 = arguments;
1368
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
1369
+ while (1) switch (_context34.prev = _context34.next) {
1370
+ case 0:
1371
+ _ref15 = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {}, process = _ref15.process, limit = _ref15.limit, _ref15$sort = _ref15.sort, sort = _ref15$sort === void 0 ? "DESC" : _ref15$sort, from = _ref15.from, to = _ref15.to;
1372
+ params = "";
1373
+ addParam = function addParam(key, val) {
1374
+ params += params === "" ? "?" : "&";
1375
+ params += "".concat(key, "=").concat(val);
1376
+ };
1377
+ if (limit) addParam("limit", limit);
1378
+ if (sort) addParam("sort", sort);
1379
+ if (from) addParam("from", from);
1380
+ if (to) addParam("to", to);
1381
+ _context34.next = 9;
1382
+ return this.post({
1383
+ path: "/~relay@1.0/call",
1384
+ method: "GET",
1385
+ "relay-path": "".concat(this.cu, "/results/").concat(process).concat(params),
1386
+ "content-type": "application/json"
1387
+ });
1388
+ case 9:
1389
+ res = _context34.sent;
1390
+ return _context34.abrupt("return", JSON.parse(res.body));
1391
+ case 11:
1392
+ case "end":
1393
+ return _context34.stop();
1394
+ }
1395
+ }, _callee34, this);
1396
+ }));
1397
+ function results() {
1398
+ return _results.apply(this, arguments);
1399
+ }
1400
+ return results;
1401
+ }()
1402
+ }, {
1403
+ key: "dryrun",
1404
+ value: function () {
1405
+ var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
1406
+ var _ref16,
1407
+ _ref16$tags,
1353
1408
  tags,
1354
1409
  pid,
1355
1410
  action,
1356
1411
  data,
1357
1412
  json,
1358
1413
  res,
1359
- _args34 = arguments;
1360
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
1361
- while (1) switch (_context34.prev = _context34.next) {
1414
+ _args35 = arguments;
1415
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
1416
+ while (1) switch (_context35.prev = _context35.next) {
1362
1417
  case 0:
1363
- _ref15 = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {}, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, pid = _ref15.pid, action = _ref15.action, data = _ref15.data;
1418
+ _ref16 = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {}, _ref16$tags = _ref16.tags, tags = _ref16$tags === void 0 ? {} : _ref16$tags, pid = _ref16.pid, action = _ref16.action, data = _ref16.data;
1364
1419
  if (typeof action === "string") tags.Action = action;
1365
1420
  json = {
1366
1421
  Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
1367
1422
  Owner: this.addr
1368
1423
  };
1369
1424
  if (data) json.Data = data;
1370
- _context34.next = 6;
1425
+ _context35.next = 6;
1371
1426
  return this.post({
1372
1427
  path: "/~relay@1.0/call",
1373
- "relay-method": "POST",
1428
+ method: "POST",
1374
1429
  "relay-path": "".concat(this.cu, "/dry-run?process-id=").concat(pid),
1375
1430
  "content-type": "application/json",
1376
1431
  "relay-body": JSON.stringify(json)
1377
1432
  });
1378
1433
  case 6:
1379
- res = _context34.sent;
1380
- return _context34.abrupt("return", JSON.parse(res.body));
1434
+ res = _context35.sent;
1435
+ return _context35.abrupt("return", JSON.parse(res.body));
1381
1436
  case 8:
1382
1437
  case "end":
1383
- return _context34.stop();
1438
+ return _context35.stop();
1384
1439
  }
1385
- }, _callee34, this);
1440
+ }, _callee35, this);
1386
1441
  }));
1387
1442
  function dryrun() {
1388
1443
  return _dryrun.apply(this, arguments);
@@ -1392,27 +1447,27 @@ var HB = /*#__PURE__*/function () {
1392
1447
  }, {
1393
1448
  key: "post",
1394
1449
  value: function () {
1395
- var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(obj, json) {
1450
+ var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(obj, json) {
1396
1451
  var _json;
1397
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
1398
- while (1) switch (_context35.prev = _context35.next) {
1452
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
1453
+ while (1) switch (_context36.prev = _context36.next) {
1399
1454
  case 0:
1400
1455
  _json = json ? "/~json@1.0/serialize" : "";
1401
1456
  obj.path += _json;
1402
- _context35.t0 = this;
1403
- _context35.next = 5;
1457
+ _context36.t0 = this;
1458
+ _context36.next = 5;
1404
1459
  return this.sign(obj);
1405
1460
  case 5:
1406
- _context35.t1 = _context35.sent;
1407
- _context35.next = 8;
1408
- return _context35.t0.send.call(_context35.t0, _context35.t1);
1461
+ _context36.t1 = _context36.sent;
1462
+ _context36.next = 8;
1463
+ return _context36.t0.send.call(_context36.t0, _context36.t1);
1409
1464
  case 8:
1410
- return _context35.abrupt("return", _context35.sent);
1465
+ return _context36.abrupt("return", _context36.sent);
1411
1466
  case 9:
1412
1467
  case "end":
1413
- return _context35.stop();
1468
+ return _context36.stop();
1414
1469
  }
1415
- }, _callee35, this);
1470
+ }, _callee36, this);
1416
1471
  }));
1417
1472
  function post(_x27, _x28) {
1418
1473
  return _post.apply(this, arguments);
@@ -1422,7 +1477,7 @@ var HB = /*#__PURE__*/function () {
1422
1477
  }, {
1423
1478
  key: "get",
1424
1479
  value: function () {
1425
- var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(_ref16) {
1480
+ var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(_ref17) {
1426
1481
  var _path3;
1427
1482
  var path,
1428
1483
  params,
@@ -1433,12 +1488,12 @@ var HB = /*#__PURE__*/function () {
1433
1488
  k,
1434
1489
  response,
1435
1490
  headers,
1436
- _args36 = arguments;
1437
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
1438
- while (1) switch (_context36.prev = _context36.next) {
1491
+ _args37 = arguments;
1492
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
1493
+ while (1) switch (_context37.prev = _context37.next) {
1439
1494
  case 0:
1440
- path = _ref16.path, params = _objectWithoutProperties(_ref16, _excluded);
1441
- json = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : false;
1495
+ path = _ref17.path, params = _objectWithoutProperties(_ref17, _excluded);
1496
+ json = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : false;
1442
1497
  _json = json ? "/~json@1.0/serialize" : "";
1443
1498
  (_path3 = path) !== null && _path3 !== void 0 ? _path3 : path = "/~message@1.0";
1444
1499
  if (!/^\//.test(path)) path = "/" + path;
@@ -1450,32 +1505,32 @@ var HB = /*#__PURE__*/function () {
1450
1505
  i++;
1451
1506
  }
1452
1507
  }
1453
- _context36.next = 9;
1508
+ _context37.next = 9;
1454
1509
  return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
1455
1510
  case 9:
1456
- response = _context36.sent;
1511
+ response = _context37.sent;
1457
1512
  headers = {};
1458
1513
  response.headers.forEach(function (v, k) {
1459
1514
  return headers[k] = v;
1460
1515
  });
1461
- _context36.t0 = response;
1462
- _context36.t1 = headers;
1463
- _context36.next = 16;
1516
+ _context37.t0 = response;
1517
+ _context37.t1 = headers;
1518
+ _context37.next = 16;
1464
1519
  return response.text();
1465
1520
  case 16:
1466
- _context36.t2 = _context36.sent;
1467
- _context36.t3 = response.status;
1468
- return _context36.abrupt("return", {
1469
- response: _context36.t0,
1470
- headers: _context36.t1,
1471
- body: _context36.t2,
1472
- status: _context36.t3
1521
+ _context37.t2 = _context37.sent;
1522
+ _context37.t3 = response.status;
1523
+ return _context37.abrupt("return", {
1524
+ response: _context37.t0,
1525
+ headers: _context37.t1,
1526
+ body: _context37.t2,
1527
+ status: _context37.t3
1473
1528
  });
1474
1529
  case 19:
1475
1530
  case "end":
1476
- return _context36.stop();
1531
+ return _context37.stop();
1477
1532
  }
1478
- }, _callee36, this);
1533
+ }, _callee37, this);
1479
1534
  }));
1480
1535
  function get(_x29) {
1481
1536
  return _get.apply(this, arguments);
@@ -1485,21 +1540,21 @@ var HB = /*#__PURE__*/function () {
1485
1540
  }, {
1486
1541
  key: "postJSON",
1487
1542
  value: function () {
1488
- var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(args) {
1543
+ var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(args) {
1489
1544
  var res;
1490
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
1491
- while (1) switch (_context37.prev = _context37.next) {
1545
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
1546
+ while (1) switch (_context38.prev = _context38.next) {
1492
1547
  case 0:
1493
- _context37.next = 2;
1548
+ _context38.next = 2;
1494
1549
  return this.post(args, true);
1495
1550
  case 2:
1496
- res = _context37.sent;
1497
- return _context37.abrupt("return", JSON.parse(res.body));
1551
+ res = _context38.sent;
1552
+ return _context38.abrupt("return", JSON.parse(res.body));
1498
1553
  case 4:
1499
1554
  case "end":
1500
- return _context37.stop();
1555
+ return _context38.stop();
1501
1556
  }
1502
- }, _callee37, this);
1557
+ }, _callee38, this);
1503
1558
  }));
1504
1559
  function postJSON(_x30) {
1505
1560
  return _postJSON.apply(this, arguments);
@@ -1509,21 +1564,21 @@ var HB = /*#__PURE__*/function () {
1509
1564
  }, {
1510
1565
  key: "getJSON",
1511
1566
  value: function () {
1512
- var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(args) {
1567
+ var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(args) {
1513
1568
  var res;
1514
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
1515
- while (1) switch (_context38.prev = _context38.next) {
1569
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
1570
+ while (1) switch (_context39.prev = _context39.next) {
1516
1571
  case 0:
1517
- _context38.next = 2;
1572
+ _context39.next = 2;
1518
1573
  return this.get(args, true);
1519
1574
  case 2:
1520
- res = _context38.sent;
1521
- return _context38.abrupt("return", JSON.parse(res.body));
1575
+ res = _context39.sent;
1576
+ return _context39.abrupt("return", JSON.parse(res.body));
1522
1577
  case 4:
1523
1578
  case "end":
1524
- return _context38.stop();
1579
+ return _context39.stop();
1525
1580
  }
1526
- }, _callee38, this);
1581
+ }, _callee39, this);
1527
1582
  }));
1528
1583
  function getJSON(_x31) {
1529
1584
  return _getJSON.apply(this, arguments);
package/cjs/hyperbeam.js CHANGED
@@ -40,16 +40,17 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
40
40
  cwd = _ref$cwd === void 0 ? "./HyperBEAM" : _ref$cwd,
41
41
  c = _ref.c,
42
42
  cmake = _ref.cmake,
43
- _ref$legacy = _ref.legacy,
44
- legacy = _ref$legacy === void 0 ? false : _ref$legacy,
45
43
  faff = _ref.faff,
46
44
  _ref$simplePay = _ref.simplePay,
47
45
  simplePay = _ref$simplePay === void 0 ? false : _ref$simplePay,
48
46
  simplePayPrice = _ref.simplePayPrice,
49
47
  p4_lua = _ref.p4_lua,
50
48
  store_prefix = _ref.store_prefix,
51
- operator = _ref.operator;
49
+ operator = _ref.operator,
50
+ _ref$console = _ref.console,
51
+ console = _ref$console === void 0 ? true : _ref$console;
52
52
  _classCallCheck(this, HyperBEAM);
53
+ this.console = console;
53
54
  if (clearCache) {
54
55
  var dirname = (0, _path.resolve)(process.cwd(), cwd);
55
56
  var _iterator = _createForOfIteratorHelper((0, _fs.readdirSync)(dirname)),
@@ -102,18 +103,20 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
102
103
  env: _objectSpread(_objectSpread({}, process.env), this.genEnv()),
103
104
  cwd: (0, _path.resolve)(process.cwd(), this.cwd)
104
105
  });
105
- this.hbeam.stdout.on("data", function (chunk) {
106
- return console.log(chunk.toString());
107
- });
108
- this.hbeam.stderr.on("data", function (err) {
109
- return console.error(err.toString());
110
- });
111
- this.hbeam.on("error", function (err) {
112
- return console.error("failed to start process: ".concat(err));
113
- });
114
- this.hbeam.on("close", function (code) {
115
- return console.log("child process exited with code ".concat(code));
116
- });
106
+ if (this.console) {
107
+ this.hbeam.stdout.on("data", function (chunk) {
108
+ return console.log(chunk.toString());
109
+ });
110
+ this.hbeam.stderr.on("data", function (err) {
111
+ return console.error(err.toString());
112
+ });
113
+ this.hbeam.on("error", function (err) {
114
+ return console.error("failed to start process: ".concat(err));
115
+ });
116
+ this.hbeam.on("close", function (code) {
117
+ return console.log("child process exited with code ".concat(code));
118
+ });
119
+ }
117
120
  }
118
121
  }, {
119
122
  key: "ok",