wao 0.24.0 → 0.24.2
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/hb.js +493 -326
- package/cjs/hyperbeam.js +32 -2
- package/cjs/signer.js +352 -196
- package/cjs/utils.js +1 -0
- package/esm/hb.js +121 -81
- package/esm/hyperbeam.js +21 -4
- package/esm/signer.js +172 -27
- package/esm/utils.js +1 -0
- package/package.json +1 -1
package/cjs/hyperbeam.js
CHANGED
|
@@ -12,6 +12,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
12
12
|
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; }
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
16
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
|
+
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; }
|
|
15
18
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
19
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
17
20
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -27,6 +30,7 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
27
30
|
bundler = _ref.bundler,
|
|
28
31
|
gateway = _ref.gateway,
|
|
29
32
|
wallet = _ref.wallet,
|
|
33
|
+
clearCache = _ref.clearCache,
|
|
30
34
|
_ref$cwd = _ref.cwd,
|
|
31
35
|
cwd = _ref$cwd === void 0 ? "./HyperBEAM" : _ref$cwd,
|
|
32
36
|
c = _ref.c,
|
|
@@ -41,8 +45,32 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
41
45
|
store_prefix = _ref.store_prefix,
|
|
42
46
|
operator = _ref.operator;
|
|
43
47
|
_classCallCheck(this, HyperBEAM);
|
|
48
|
+
if (clearCache) {
|
|
49
|
+
var dirname = (0, _path.resolve)(process.cwd(), cwd);
|
|
50
|
+
var _iterator = _createForOfIteratorHelper((0, _fs.readdirSync)(dirname)),
|
|
51
|
+
_step;
|
|
52
|
+
try {
|
|
53
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
54
|
+
var v = _step.value;
|
|
55
|
+
if (/^cache-/.test(v)) {
|
|
56
|
+
try {
|
|
57
|
+
(0, _fs.rmSync)((0, _path.resolve)(dirname, v), {
|
|
58
|
+
recursive: true,
|
|
59
|
+
force: true
|
|
60
|
+
});
|
|
61
|
+
} catch (e) {
|
|
62
|
+
console.log(e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} catch (err) {
|
|
67
|
+
_iterator.e(err);
|
|
68
|
+
} finally {
|
|
69
|
+
_iterator.f();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
44
72
|
this.cu = cu;
|
|
45
|
-
this.store_prefix = store_prefix
|
|
73
|
+
this.store_prefix = store_prefix ? "cache-mainnet-" + Math.floor(Math.random() * 10000000) : "cache-mainnet";
|
|
46
74
|
this.p4_lua = p4_lua;
|
|
47
75
|
this.simplePay = simplePay;
|
|
48
76
|
this.spp = simplePayPrice;
|
|
@@ -92,6 +120,8 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
92
120
|
wallet = _ref2$wallet === void 0 ? ".wallet.json" : _ref2$wallet;
|
|
93
121
|
var _wallet = ", priv_key_location => <<\"".concat(wallet, "\">>");
|
|
94
122
|
var _gateway = gateway ? ", gateway => <<\"http://localhost:".concat(gateway, "\">>") : "";
|
|
123
|
+
|
|
124
|
+
// store option will be overwritten by hb.erl
|
|
95
125
|
var _store = this.store_prefix ? ", store => [#{ <<\"store-module\">> => hb_store_fs, <<\"prefix\">> => <<\"".concat(this.store_prefix, "\">> }, #{ <<\"store-module\">> => hb_store_gateway, <<\"subindex\">> => [#{ <<\"name\">> => <<\"Data-Protocol\">>, <<\"value\">> => <<\"ao\">> }], <<\"store\">> => [#{ <<\"store-module\">> => hb_store_fs, <<\"prefix\">> => <<\"").concat(this.store_prefix, "\">> }] }, #{ <<\"store-module\">> => hb_store_gateway, <<\"store\">> => [#{ <<\"store-module\">> => hb_store_fs, <<\"prefix\">> => <<\"").concat(this.store_prefix, "\">> }] }]") : "";
|
|
96
126
|
var _bundler = this.bundler ? ", bundler_httpsig => <<\"http://localhost:".concat(this.bundler, "\">>") : "";
|
|
97
127
|
var _routes = ", routes => [#{ <<\"template\">> => <<\"/result/.*\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:".concat(this.cu, "\">> } }, #{ <<\"template\">> => <<\"/dry-run\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:").concat(this.cu, "\">> } }, #{ <<\"template\">> => <<\"/graphql\">>, <<\"nodes\">> => [#{ <<\"prefix\">> => <<\"http://localhost:").concat(gateway, "\">>, <<\"opts\">> => #{ http_client => httpc, protocol => http2 } }, #{ <<\"prefix\">> => <<\"http://localhost:").concat(gateway, "\">>, <<\"opts\">> => #{ http_client => gun, protocol => http2 } }] }, #{ <<\"template\">> => <<\"/raw\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:").concat(gateway, "\">>, <<\"opts\">> => #{ http_client => gun, protocol => http2 } } }]");
|
|
@@ -105,7 +135,7 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
105
135
|
return "<<\"".concat(addr, "\">>");
|
|
106
136
|
})(this.faff).join(", "), " ]");
|
|
107
137
|
var _on = this.p4_lua ? ", on => #{ <<\"request\">> => ".concat(processor, ", <<\"response\">> => ").concat(processor, " }") : this.simplePay ? ", on => #{ <<\"request\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"simple-pay@1.0\">>, <<\"ledger-device\">> => <<\"simple-pay@1.0\">> }, <<\"response\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"simple-pay@1.0\">>, <<\"ledger-device\">> => <<\"simple-pay@1.0\">> } }" : !(0, _ramda.isNil)(this.faff) ? ", on => #{ <<\"request\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"faff@1.0\">>, <<\"ledger-device\">> => <<\"faff@1.0\">> }, <<\"response\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"faff@1.0\">>, <<\"ledger-device\">> => <<\"faff@1.0\">> } }" : "";
|
|
108
|
-
var start = "hb:start_mainnet(#{ ".concat(_port).concat(_gateway).concat(_wallet).concat(
|
|
138
|
+
var start = "hb:start_mainnet(#{ ".concat(_port).concat(_gateway).concat(_wallet).concat(_faff).concat(_bundler).concat(_routes).concat(_on).concat(_p4_non_chargable).concat(_operator).concat(_spp).concat(_node_processes, "}).");
|
|
109
139
|
return start;
|
|
110
140
|
}
|
|
111
141
|
}, {
|