wao 0.36.2 → 0.36.3
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/bundler.js +219 -0
- package/cjs/hb.js +32 -19
- package/cjs/hyperbeam.js +8 -3
- package/esm/bundler.js +117 -0
- package/esm/hb.js +24 -14
- package/esm/hyperbeam.js +14 -4
- package/package.json +3 -2
package/cjs/bundler.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _express = _interopRequireDefault(require("express"));
|
|
9
|
+
var _turboSdk = require("@ardrive/turbo-sdk");
|
|
10
|
+
var _arbundles = require("@dha-team/arbundles");
|
|
11
|
+
var _cors = _interopRequireDefault(require("cors"));
|
|
12
|
+
var _bodyParser = _interopRequireDefault(require("body-parser"));
|
|
13
|
+
var _hbsig = require("hbsig");
|
|
14
|
+
var _ramda = require("ramda");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
17
|
+
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); }
|
|
18
|
+
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); }); }; }
|
|
19
|
+
var timestamp = 0;
|
|
20
|
+
var height = 0;
|
|
21
|
+
var last_checked = 0;
|
|
22
|
+
var nonce = 0;
|
|
23
|
+
var toMsg = function toMsg(req) {
|
|
24
|
+
var msg = req.headers;
|
|
25
|
+
if (req.body) msg.body = req.body.toString("binary");
|
|
26
|
+
return msg;
|
|
27
|
+
};
|
|
28
|
+
var bundler = function bundler() {
|
|
29
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
30
|
+
_ref$port = _ref.port,
|
|
31
|
+
port = _ref$port === void 0 ? 4001 : _ref$port,
|
|
32
|
+
jwk = _ref.jwk,
|
|
33
|
+
_ref$timeout = _ref.timeout,
|
|
34
|
+
timeout = _ref$timeout === void 0 ? 1000 * 60 : _ref$timeout;
|
|
35
|
+
var app = (0, _express["default"])();
|
|
36
|
+
app.use((0, _cors["default"])());
|
|
37
|
+
app.use(_bodyParser["default"].raw({
|
|
38
|
+
type: "*/*",
|
|
39
|
+
limit: "100mb"
|
|
40
|
+
}));
|
|
41
|
+
app.post("/tx", /*#__PURE__*/function () {
|
|
42
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(req, res) {
|
|
43
|
+
var out, k, _out$body$commitments, _out$body, _out$body2, msg, signer, tags, type, _i, _Object$values, tagObj, opt, di, _res, dis, _out$blockHeight, _out$blockTimestamp, json, atags, _tags, _k, _signer, di2, res2;
|
|
44
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
45
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
if (Buffer.isBuffer(req.body)) {
|
|
48
|
+
_context2.next = 3;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
console.log("BD: Invalid body | expected raw Buffer");
|
|
52
|
+
return _context2.abrupt("return", res.status(400).send("Invalid body: expected raw Buffer"));
|
|
53
|
+
case 3:
|
|
54
|
+
res.status(200).send("success");
|
|
55
|
+
_context2.prev = 4;
|
|
56
|
+
out = (0, _hbsig.structured_to)((0, _hbsig.httpsig_from)(toMsg(req)));
|
|
57
|
+
_context2.t0 = _regeneratorRuntime().keys((_out$body$commitments = (_out$body = out.body) === null || _out$body === void 0 ? void 0 : _out$body.commitments) !== null && _out$body$commitments !== void 0 ? _out$body$commitments : {});
|
|
58
|
+
case 7:
|
|
59
|
+
if ((_context2.t1 = _context2.t0()).done) {
|
|
60
|
+
_context2.next = 57;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
k = _context2.t1.value;
|
|
64
|
+
msg = (_out$body2 = out.body) === null || _out$body2 === void 0 ? void 0 : _out$body2.commitments[k];
|
|
65
|
+
signer = {
|
|
66
|
+
signatureType: 1,
|
|
67
|
+
signatureLength: 512,
|
|
68
|
+
ownerLength: 512,
|
|
69
|
+
publicKey: msg.owner,
|
|
70
|
+
sign: function () {
|
|
71
|
+
var _sign = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
72
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
73
|
+
while (1) switch (_context.prev = _context.next) {
|
|
74
|
+
case 0:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context.stop();
|
|
77
|
+
}
|
|
78
|
+
}, _callee);
|
|
79
|
+
}));
|
|
80
|
+
function sign() {
|
|
81
|
+
return _sign.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
return sign;
|
|
84
|
+
}()
|
|
85
|
+
};
|
|
86
|
+
tags = [];
|
|
87
|
+
type = null;
|
|
88
|
+
if (msg["original-tags"]) {
|
|
89
|
+
for (_i = 0, _Object$values = Object.values(msg["original-tags"]); _i < _Object$values.length; _i++) {
|
|
90
|
+
tagObj = _Object$values[_i];
|
|
91
|
+
tags.push({
|
|
92
|
+
name: tagObj.name,
|
|
93
|
+
value: tagObj.value
|
|
94
|
+
});
|
|
95
|
+
if (tagObj.name === "Type") {
|
|
96
|
+
type = tagObj.value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
opt = {
|
|
101
|
+
tags: tags
|
|
102
|
+
};
|
|
103
|
+
if (type !== "Process") opt.target = out.process;
|
|
104
|
+
_context2.next = 18;
|
|
105
|
+
return (0, _arbundles.createData)(out.data || "", signer, opt);
|
|
106
|
+
case 18:
|
|
107
|
+
di = _context2.sent;
|
|
108
|
+
_context2.next = 21;
|
|
109
|
+
return di.setSignature(msg.signature);
|
|
110
|
+
case 21:
|
|
111
|
+
_context2.next = 23;
|
|
112
|
+
return fetch("https://up.arweave.net:443/tx", {
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers: {
|
|
115
|
+
"Content-Type": "application/octet-stream"
|
|
116
|
+
},
|
|
117
|
+
body: di.binary
|
|
118
|
+
});
|
|
119
|
+
case 23:
|
|
120
|
+
_res = _context2.sent;
|
|
121
|
+
console.log(_res === null || _res === void 0 ? void 0 : _res.status, di.tags);
|
|
122
|
+
dis = [di];
|
|
123
|
+
if (!(type === "Message")) {
|
|
124
|
+
_context2.next = 55;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (out["block-timestamp"]) {
|
|
128
|
+
_context2.next = 41;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
_context2.prev = 28;
|
|
132
|
+
if (!(Date.now() - last_checked > timeout)) {
|
|
133
|
+
_context2.next = 36;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
_context2.next = 32;
|
|
137
|
+
return fetch("https://arweave.net/block/current").then(function (r) {
|
|
138
|
+
return r.json();
|
|
139
|
+
});
|
|
140
|
+
case 32:
|
|
141
|
+
json = _context2.sent;
|
|
142
|
+
height = json.height;
|
|
143
|
+
timestamp = json.timestamp;
|
|
144
|
+
last_checked = Date.now();
|
|
145
|
+
case 36:
|
|
146
|
+
_context2.next = 41;
|
|
147
|
+
break;
|
|
148
|
+
case 38:
|
|
149
|
+
_context2.prev = 38;
|
|
150
|
+
_context2.t2 = _context2["catch"](28);
|
|
151
|
+
console.log(_context2.t2);
|
|
152
|
+
case 41:
|
|
153
|
+
atags = {
|
|
154
|
+
Process: out.process,
|
|
155
|
+
Epoch: out.epoch,
|
|
156
|
+
Nonce: Number(++nonce).toString(),
|
|
157
|
+
"Hash-Chain": out["hash-chain"],
|
|
158
|
+
"Block-Height": Number((_out$blockHeight = out["block-height"]) !== null && _out$blockHeight !== void 0 ? _out$blockHeight : height).toString(),
|
|
159
|
+
Tmestamp: Number((_out$blockTimestamp = out["block-timestamp"]) !== null && _out$blockTimestamp !== void 0 ? _out$blockTimestamp : timestamp).toString(),
|
|
160
|
+
"Data-Protocol": "ao",
|
|
161
|
+
Slot: Number(out.slot).toString(),
|
|
162
|
+
Variant: "ao.WDB.1",
|
|
163
|
+
Type: "Assignment",
|
|
164
|
+
Message: di.id
|
|
165
|
+
};
|
|
166
|
+
_tags = [];
|
|
167
|
+
if (msg["original-tags"]) {
|
|
168
|
+
for (_k in atags) _tags.push({
|
|
169
|
+
name: _k,
|
|
170
|
+
value: atags[_k]
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
_signer = new _turboSdk.ArweaveSigner(jwk);
|
|
174
|
+
_context2.next = 47;
|
|
175
|
+
return (0, _arbundles.createData)("", _signer, {
|
|
176
|
+
tags: _tags
|
|
177
|
+
});
|
|
178
|
+
case 47:
|
|
179
|
+
di2 = _context2.sent;
|
|
180
|
+
_context2.next = 50;
|
|
181
|
+
return di2.sign(_signer);
|
|
182
|
+
case 50:
|
|
183
|
+
dis.push(di2);
|
|
184
|
+
_context2.next = 53;
|
|
185
|
+
return fetch("https://up.arweave.net:443/tx", {
|
|
186
|
+
method: "POST",
|
|
187
|
+
headers: {
|
|
188
|
+
"Content-Type": "application/octet-stream"
|
|
189
|
+
},
|
|
190
|
+
body: di2.binary
|
|
191
|
+
});
|
|
192
|
+
case 53:
|
|
193
|
+
res2 = _context2.sent;
|
|
194
|
+
console.log(res2 === null || res2 === void 0 ? void 0 : res2.status, di2.tags);
|
|
195
|
+
case 55:
|
|
196
|
+
_context2.next = 7;
|
|
197
|
+
break;
|
|
198
|
+
case 57:
|
|
199
|
+
_context2.next = 62;
|
|
200
|
+
break;
|
|
201
|
+
case 59:
|
|
202
|
+
_context2.prev = 59;
|
|
203
|
+
_context2.t3 = _context2["catch"](4);
|
|
204
|
+
console.log(_context2.t3);
|
|
205
|
+
case 62:
|
|
206
|
+
case "end":
|
|
207
|
+
return _context2.stop();
|
|
208
|
+
}
|
|
209
|
+
}, _callee2, null, [[4, 59], [28, 38]]);
|
|
210
|
+
}));
|
|
211
|
+
return function (_x, _x2) {
|
|
212
|
+
return _ref2.apply(this, arguments);
|
|
213
|
+
};
|
|
214
|
+
}());
|
|
215
|
+
return app.listen(port, function () {
|
|
216
|
+
return console.log("BD on port ".concat(port));
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
var _default = exports["default"] = bundler;
|
package/cjs/hb.js
CHANGED
|
@@ -677,17 +677,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
677
677
|
key: "post104",
|
|
678
678
|
value: function () {
|
|
679
679
|
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref9) {
|
|
680
|
-
var _ref9$path, path, _ref9$tags, tags, _ref9$data, data, _tags, signer, di, res
|
|
680
|
+
var _ref9$path, path, _ref9$tags, tags, _ref9$data, data, target, _tags, signer, di, res;
|
|
681
681
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
682
682
|
while (1) switch (_context19.prev = _context19.next) {
|
|
683
683
|
case 0:
|
|
684
|
-
_ref9$path = _ref9.path, path = _ref9$path === void 0 ? "/~process@1.0/schedule" : _ref9$path, _ref9$tags = _ref9.tags, tags = _ref9$tags === void 0 ? {} : _ref9$tags, _ref9$data = _ref9.data, data = _ref9$data === void 0 ? "1984" : _ref9$data;
|
|
684
|
+
_ref9$path = _ref9.path, path = _ref9$path === void 0 ? "/~process@1.0/schedule" : _ref9$path, _ref9$tags = _ref9.tags, tags = _ref9$tags === void 0 ? {} : _ref9$tags, _ref9$data = _ref9.data, data = _ref9$data === void 0 ? "1984" : _ref9$data, target = _ref9.target;
|
|
685
685
|
_tags = (0, _utils.buildTags)((0, _ramda.mergeLeft)(tags, {
|
|
686
686
|
signingFormat: "ANS-104"
|
|
687
687
|
}));
|
|
688
688
|
signer = new _sdk.ArweaveSigner(this.jwk);
|
|
689
689
|
di = (0, _arbundles.createData)(data, signer, {
|
|
690
|
-
tags: _tags
|
|
690
|
+
tags: _tags,
|
|
691
|
+
target: target
|
|
691
692
|
});
|
|
692
693
|
_context19.next = 6;
|
|
693
694
|
return di.sign(signer);
|
|
@@ -710,10 +711,9 @@ var HB = /*#__PURE__*/function () {
|
|
|
710
711
|
case 13:
|
|
711
712
|
_context19.t2 = _context19.sent;
|
|
712
713
|
_context19.t3 = (0, _context19.t1)(_context19.t2);
|
|
713
|
-
|
|
714
|
-
res.out = _headers;
|
|
714
|
+
res.out = (0, _context19.t0)(_context19.t3);
|
|
715
715
|
return _context19.abrupt("return", res);
|
|
716
|
-
case
|
|
716
|
+
case 17:
|
|
717
717
|
case "end":
|
|
718
718
|
return _context19.stop();
|
|
719
719
|
}
|
|
@@ -753,6 +753,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
753
753
|
});
|
|
754
754
|
_context20.next = 6;
|
|
755
755
|
return this.post104({
|
|
756
|
+
target: pid,
|
|
756
757
|
path: "/".concat(pid, "/schedule"),
|
|
757
758
|
tags: _tags,
|
|
758
759
|
data: data !== null && data !== void 0 ? data : "1984"
|
|
@@ -856,9 +857,9 @@ var HB = /*#__PURE__*/function () {
|
|
|
856
857
|
case 10:
|
|
857
858
|
_context22.t2 = _context22.t1;
|
|
858
859
|
tags = {
|
|
859
|
-
"
|
|
860
|
-
|
|
861
|
-
|
|
860
|
+
"Data-Protocol": "ao",
|
|
861
|
+
Variant: "ao.N.1",
|
|
862
|
+
Authority: _context22.t0,
|
|
862
863
|
module: _context22.t2,
|
|
863
864
|
"execution-device": "lua@5.3a",
|
|
864
865
|
"push-device": "push@1.0",
|
|
@@ -919,19 +920,31 @@ var HB = /*#__PURE__*/function () {
|
|
|
919
920
|
key: "slot",
|
|
920
921
|
value: function () {
|
|
921
922
|
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref13) {
|
|
922
|
-
var pid, _ref13$path, path;
|
|
923
|
+
var pid, _ref13$path, path, res;
|
|
923
924
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
924
925
|
while (1) switch (_context24.prev = _context24.next) {
|
|
925
926
|
case 0:
|
|
926
927
|
pid = _ref13.pid, _ref13$path = _ref13.path, path = _ref13$path === void 0 ? "" : _ref13$path;
|
|
927
928
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
928
|
-
|
|
929
|
+
if (!(this.format === "ans104")) {
|
|
930
|
+
_context24.next = 9;
|
|
931
|
+
break;
|
|
932
|
+
}
|
|
933
|
+
_context24.next = 5;
|
|
934
|
+
return this.get({
|
|
935
|
+
path: "/".concat(pid, "/slot").concat(path)
|
|
936
|
+
});
|
|
937
|
+
case 5:
|
|
938
|
+
res = _context24.sent;
|
|
939
|
+
return _context24.abrupt("return", res.out);
|
|
940
|
+
case 9:
|
|
941
|
+
_context24.next = 11;
|
|
929
942
|
return this.getJSON({
|
|
930
943
|
path: "/".concat(pid, "/slot").concat(path)
|
|
931
944
|
});
|
|
932
|
-
case
|
|
945
|
+
case 11:
|
|
933
946
|
return _context24.abrupt("return", _context24.sent);
|
|
934
|
-
case
|
|
947
|
+
case 12:
|
|
935
948
|
case "end":
|
|
936
949
|
return _context24.stop();
|
|
937
950
|
}
|
|
@@ -1095,9 +1108,9 @@ var HB = /*#__PURE__*/function () {
|
|
|
1095
1108
|
return this.setInfo();
|
|
1096
1109
|
case 3:
|
|
1097
1110
|
t = (0, _ramda.mergeLeft)(tags, {
|
|
1098
|
-
"
|
|
1099
|
-
|
|
1100
|
-
|
|
1111
|
+
"Data-Protocol": "ao",
|
|
1112
|
+
Variant: "ao.TN.1",
|
|
1113
|
+
Authority: this.operator,
|
|
1101
1114
|
module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
1102
1115
|
device: "process@1.0",
|
|
1103
1116
|
"execution-device": "stack@1.0",
|
|
@@ -1602,9 +1615,9 @@ var HB = /*#__PURE__*/function () {
|
|
|
1602
1615
|
image = _context39.t0;
|
|
1603
1616
|
case 14:
|
|
1604
1617
|
tags = {
|
|
1605
|
-
"
|
|
1606
|
-
|
|
1607
|
-
|
|
1618
|
+
"Data-Protocol": "ao",
|
|
1619
|
+
Variant: "ao.N.1",
|
|
1620
|
+
Authority: this.operator,
|
|
1608
1621
|
image: image,
|
|
1609
1622
|
"execution-device": "stack@1.0",
|
|
1610
1623
|
"push-device": "push@1.0",
|
package/cjs/hyperbeam.js
CHANGED
|
@@ -52,6 +52,8 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
52
52
|
_ref$simple_pay = _ref.simple_pay,
|
|
53
53
|
simple_pay = _ref$simple_pay === void 0 ? false : _ref$simple_pay,
|
|
54
54
|
simple_pay_price = _ref.simple_pay_price,
|
|
55
|
+
bundler_ans104 = _ref.bundler_ans104,
|
|
56
|
+
bundler_httpsig = _ref.bundler_httpsig,
|
|
55
57
|
p4_non_chargable_routes = _ref.p4_non_chargable_routes,
|
|
56
58
|
p4_lua = _ref.p4_lua,
|
|
57
59
|
store_prefix = _ref.store_prefix,
|
|
@@ -106,7 +108,9 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
106
108
|
this.cmake = cmake;
|
|
107
109
|
this.port = port;
|
|
108
110
|
this.url = "http://localhost:".concat(this.port);
|
|
109
|
-
this.bundler = bundler;
|
|
111
|
+
if (bundler) this.bundler = "http://localhost::".concat(bundler);
|
|
112
|
+
this.bundler_ans104 = bundler_ans104;
|
|
113
|
+
if (bundler_httpsig) this.bundler = bundler_httpsig;
|
|
110
114
|
this.as = as;
|
|
111
115
|
this.gateway = gateway;
|
|
112
116
|
if (Array.isArray(this.faff)) {
|
|
@@ -378,7 +382,8 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
378
382
|
|
|
379
383
|
// store option will be overwritten by hb.erl
|
|
380
384
|
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, "\">> }] }]") : "";
|
|
381
|
-
var _bundler = this.bundler ? ", bundler_httpsig => <<\"
|
|
385
|
+
var _bundler = this.bundler ? ", bundler_httpsig => <<\"".concat(this.bundler, "\">>") : "";
|
|
386
|
+
var _bundler_ans104 = this.bundler_ans104 === false ? ", bundler_ans104 => false" : this.bundler_ans104 ? ", bundler_ans104 => <<\"http://localhost:".concat(this.bundler_ans104, "\">>") : "";
|
|
382
387
|
/*
|
|
383
388
|
const _routes = `, routes => [#{ <<"template">> => <<"/result/.*">>, <<"node">> => #{ <<"prefix">> => <<"http://localhost:${this.cu}">> } }, #{ <<\"template\">> => <<\"/dry-run\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:${this.cu}\">> } }, #{ <<"template">> => <<"/graphql">>, <<"nodes">> => [#{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => httpc, protocol => http2 } }, #{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => gun, protocol => http2 } }] }, #{ <<"template">> => <<"/raw">>, <<"node">> => #{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => gun, protocol => http2 } } }]`
|
|
384
389
|
*/
|
|
@@ -394,7 +399,7 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
394
399
|
return "<<\"".concat(addr, "\">>");
|
|
395
400
|
})(this.faff).join(", "), " ]");
|
|
396
401
|
var _on = this.p4_lua ? ", on => #{ <<\"request\">> => ".concat(processor, ", <<\"response\">> => ").concat(processor, " }") : this.simple_pay ? ", 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\">> } }" : "";
|
|
397
|
-
var start = "hb:start_mainnet(#{ ".concat(_port).concat(_gateway).concat(_wallet).concat(_faff).concat(_bundler).concat(_on).concat(_p4_non_chargable).concat(_operator).concat(_spp).concat(_devices).concat(_node_processes, "}).");
|
|
402
|
+
var start = "hb:start_mainnet(#{ ".concat(_port).concat(_gateway).concat(_wallet).concat(_faff).concat(_bundler).concat(_bundler_ans104).concat(_on).concat(_p4_non_chargable).concat(_operator).concat(_spp).concat(_devices).concat(_node_processes, "}).");
|
|
398
403
|
return start;
|
|
399
404
|
}
|
|
400
405
|
}, {
|
package/esm/bundler.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import express from "express"
|
|
2
|
+
import { ArweaveSigner, TurboFactory } from "@ardrive/turbo-sdk"
|
|
3
|
+
import { createData } from "@dha-team/arbundles"
|
|
4
|
+
import cors from "cors"
|
|
5
|
+
import bodyParser from "body-parser"
|
|
6
|
+
import { httpsig_from, structured_to } from "hbsig"
|
|
7
|
+
import { keys, omit } from "ramda"
|
|
8
|
+
|
|
9
|
+
let timestamp = 0
|
|
10
|
+
let height = 0
|
|
11
|
+
let last_checked = 0
|
|
12
|
+
let nonce = 0
|
|
13
|
+
|
|
14
|
+
const toMsg = req => {
|
|
15
|
+
let msg = req.headers
|
|
16
|
+
if (req.body) msg.body = req.body.toString("binary")
|
|
17
|
+
return msg
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const bundler = ({ port = 4001, jwk, timeout = 1000 * 60 } = {}) => {
|
|
21
|
+
const app = express()
|
|
22
|
+
app.use(cors())
|
|
23
|
+
app.use(bodyParser.raw({ type: "*/*", limit: "100mb" }))
|
|
24
|
+
app.post("/tx", async (req, res) => {
|
|
25
|
+
if (!Buffer.isBuffer(req.body)) {
|
|
26
|
+
console.log("BD: Invalid body | expected raw Buffer")
|
|
27
|
+
return res.status(400).send("Invalid body: expected raw Buffer")
|
|
28
|
+
}
|
|
29
|
+
res.status(200).send("success")
|
|
30
|
+
try {
|
|
31
|
+
const out = structured_to(httpsig_from(toMsg(req)))
|
|
32
|
+
for (const k in out.body?.commitments ?? {}) {
|
|
33
|
+
const msg = out.body?.commitments[k]
|
|
34
|
+
const signer = {
|
|
35
|
+
signatureType: 1,
|
|
36
|
+
signatureLength: 512,
|
|
37
|
+
ownerLength: 512,
|
|
38
|
+
publicKey: msg.owner,
|
|
39
|
+
sign: async () => {},
|
|
40
|
+
}
|
|
41
|
+
const tags = []
|
|
42
|
+
let type = null
|
|
43
|
+
if (msg["original-tags"]) {
|
|
44
|
+
for (const tagObj of Object.values(msg["original-tags"])) {
|
|
45
|
+
tags.push({ name: tagObj.name, value: tagObj.value })
|
|
46
|
+
if (tagObj.name === "Type") {
|
|
47
|
+
type = tagObj.value
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let opt = { tags }
|
|
52
|
+
if (type !== "Process") opt.target = out.process
|
|
53
|
+
const di = await createData(out.data || "", signer, opt)
|
|
54
|
+
await di.setSignature(msg.signature)
|
|
55
|
+
const res = await fetch("https://up.arweave.net:443/tx", {
|
|
56
|
+
method: "POST",
|
|
57
|
+
headers: {
|
|
58
|
+
"Content-Type": "application/octet-stream",
|
|
59
|
+
},
|
|
60
|
+
body: di.binary,
|
|
61
|
+
})
|
|
62
|
+
console.log(res?.status, di.tags)
|
|
63
|
+
const dis = [di]
|
|
64
|
+
if (type === "Message") {
|
|
65
|
+
if (!out["block-timestamp"]) {
|
|
66
|
+
try {
|
|
67
|
+
if (Date.now() - last_checked > timeout) {
|
|
68
|
+
const json = await fetch(
|
|
69
|
+
"https://arweave.net/block/current"
|
|
70
|
+
).then(r => r.json())
|
|
71
|
+
height = json.height
|
|
72
|
+
timestamp = json.timestamp
|
|
73
|
+
last_checked = Date.now()
|
|
74
|
+
}
|
|
75
|
+
} catch (e) {
|
|
76
|
+
console.log(e)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const atags = {
|
|
80
|
+
Process: out.process,
|
|
81
|
+
Epoch: out.epoch,
|
|
82
|
+
Nonce: Number(++nonce).toString(),
|
|
83
|
+
"Hash-Chain": out["hash-chain"],
|
|
84
|
+
"Block-Height": Number(out["block-height"] ?? height).toString(),
|
|
85
|
+
Tmestamp: Number(out["block-timestamp"] ?? timestamp).toString(),
|
|
86
|
+
"Data-Protocol": "ao",
|
|
87
|
+
Slot: Number(out.slot).toString(),
|
|
88
|
+
Variant: "ao.WDB.1",
|
|
89
|
+
Type: "Assignment",
|
|
90
|
+
Message: di.id,
|
|
91
|
+
}
|
|
92
|
+
const tags = []
|
|
93
|
+
if (msg["original-tags"]) {
|
|
94
|
+
for (const k in atags) tags.push({ name: k, value: atags[k] })
|
|
95
|
+
}
|
|
96
|
+
const signer = new ArweaveSigner(jwk)
|
|
97
|
+
const di2 = await createData("", signer, { tags })
|
|
98
|
+
await di2.sign(signer)
|
|
99
|
+
dis.push(di2)
|
|
100
|
+
const res2 = await fetch("https://up.arweave.net:443/tx", {
|
|
101
|
+
method: "POST",
|
|
102
|
+
headers: {
|
|
103
|
+
"Content-Type": "application/octet-stream",
|
|
104
|
+
},
|
|
105
|
+
body: di2.binary,
|
|
106
|
+
})
|
|
107
|
+
console.log(res2?.status, di2.tags)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
} catch (e) {
|
|
111
|
+
console.log(e)
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
return app.listen(port, () => console.log(`BD on port ${port}`))
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export default bundler
|
package/esm/hb.js
CHANGED
|
@@ -160,10 +160,15 @@ class HB {
|
|
|
160
160
|
})
|
|
161
161
|
return { slot: res.out.slot, res, pid }
|
|
162
162
|
}
|
|
163
|
-
async post104({
|
|
163
|
+
async post104({
|
|
164
|
+
path = "/~process@1.0/schedule",
|
|
165
|
+
tags = {},
|
|
166
|
+
data = "1984",
|
|
167
|
+
target,
|
|
168
|
+
}) {
|
|
164
169
|
const _tags = buildTags(mergeLeft(tags, { signingFormat: "ANS-104" }))
|
|
165
170
|
const signer = new ArweaveSigner(this.jwk)
|
|
166
|
-
const di = createData(data, signer, { tags: _tags })
|
|
171
|
+
const di = createData(data, signer, { tags: _tags, target })
|
|
167
172
|
await di.sign(signer)
|
|
168
173
|
let res = await fetch(`${this.url}${path}`, {
|
|
169
174
|
method: "POST",
|
|
@@ -173,8 +178,7 @@ class HB {
|
|
|
173
178
|
},
|
|
174
179
|
body: di.binary,
|
|
175
180
|
})
|
|
176
|
-
|
|
177
|
-
res.out = _headers
|
|
181
|
+
res.out = structured_to(httpsig_from(await toMsg(res)))
|
|
178
182
|
return res
|
|
179
183
|
}
|
|
180
184
|
|
|
@@ -183,6 +187,7 @@ class HB {
|
|
|
183
187
|
if (this.format === "ans104") {
|
|
184
188
|
let _tags = mergeLeft(tags, { Type: "Message" })
|
|
185
189
|
res = await this.post104({
|
|
190
|
+
target: pid,
|
|
186
191
|
path: `/${pid}/schedule`,
|
|
187
192
|
tags: _tags,
|
|
188
193
|
data: data ?? "1984",
|
|
@@ -205,9 +210,9 @@ class HB {
|
|
|
205
210
|
async spawnLua(lua) {
|
|
206
211
|
await this.setInfo()
|
|
207
212
|
const tags = {
|
|
208
|
-
"
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
"Data-Protocol": "ao",
|
|
214
|
+
Variant: "ao.N.1",
|
|
215
|
+
Authority: this.operator,
|
|
211
216
|
module: this.lua ?? (await this.getLua()),
|
|
212
217
|
"execution-device": "lua@5.3a",
|
|
213
218
|
"push-device": "push@1.0",
|
|
@@ -228,7 +233,12 @@ class HB {
|
|
|
228
233
|
|
|
229
234
|
async slot({ pid, path = "" }) {
|
|
230
235
|
if (path && !/^\//.test(path)) path = "/" + path
|
|
231
|
-
|
|
236
|
+
if (this.format === "ans104") {
|
|
237
|
+
const res = await this.get({ path: `/${pid}/slot${path}` })
|
|
238
|
+
return res.out
|
|
239
|
+
} else {
|
|
240
|
+
return await this.getJSON({ path: `/${pid}/slot${path}` })
|
|
241
|
+
}
|
|
232
242
|
}
|
|
233
243
|
|
|
234
244
|
async messages({ pid, from, to } = {}) {
|
|
@@ -283,9 +293,9 @@ class HB {
|
|
|
283
293
|
async spawnLegacy({ module, tags = {}, data } = {}) {
|
|
284
294
|
await this.setInfo()
|
|
285
295
|
let t = mergeLeft(tags, {
|
|
286
|
-
"
|
|
287
|
-
|
|
288
|
-
|
|
296
|
+
"Data-Protocol": "ao",
|
|
297
|
+
Variant: "ao.TN.1",
|
|
298
|
+
Authority: this.operator,
|
|
289
299
|
module: module ?? "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
290
300
|
device: "process@1.0",
|
|
291
301
|
"execution-device": "stack@1.0",
|
|
@@ -398,9 +408,9 @@ class HB {
|
|
|
398
408
|
await this.setInfo()
|
|
399
409
|
image ??= this.image ?? (await this.getImage())
|
|
400
410
|
const tags = {
|
|
401
|
-
"
|
|
402
|
-
|
|
403
|
-
|
|
411
|
+
"Data-Protocol": "ao",
|
|
412
|
+
Variant: "ao.N.1",
|
|
413
|
+
Authority: this.operator,
|
|
404
414
|
image,
|
|
405
415
|
"execution-device": "stack@1.0",
|
|
406
416
|
"push-device": "push@1.0",
|
package/esm/hyperbeam.js
CHANGED
|
@@ -24,6 +24,8 @@ export default class HyperBEAM {
|
|
|
24
24
|
faff,
|
|
25
25
|
simple_pay = false,
|
|
26
26
|
simple_pay_price,
|
|
27
|
+
bundler_ans104,
|
|
28
|
+
bundler_httpsig,
|
|
27
29
|
p4_non_chargable_routes,
|
|
28
30
|
p4_lua,
|
|
29
31
|
store_prefix,
|
|
@@ -66,7 +68,9 @@ export default class HyperBEAM {
|
|
|
66
68
|
this.cmake = cmake
|
|
67
69
|
this.port = port
|
|
68
70
|
this.url = `http://localhost:${this.port}`
|
|
69
|
-
this.bundler = bundler
|
|
71
|
+
if (bundler) this.bundler = `http://localhost::${bundler}`
|
|
72
|
+
this.bundler_ans104 = bundler_ans104
|
|
73
|
+
if (bundler_httpsig) this.bundler = bundler_httpsig
|
|
70
74
|
this.as = as
|
|
71
75
|
this.gateway = gateway
|
|
72
76
|
if (Array.isArray(this.faff)) {
|
|
@@ -221,9 +225,15 @@ export default class HyperBEAM {
|
|
|
221
225
|
const _store = this.store_prefix
|
|
222
226
|
? `, store => [#{ <<"store-module">> => hb_store_fs, <<"prefix">> => <<"${this.store_prefix}">> }, #{ <<"store-module">> => hb_store_gateway, <<"subindex">> => [#{ <<"name">> => <<"Data-Protocol">>, <<"value">> => <<"ao">> }], <<"store">> => [#{ <<"store-module">> => hb_store_fs, <<"prefix">> => <<"${this.store_prefix}">> }] }, #{ <<"store-module">> => hb_store_gateway, <<"store">> => [#{ <<"store-module">> => hb_store_fs, <<"prefix">> => <<"${this.store_prefix}">> }] }]`
|
|
223
227
|
: ""
|
|
224
|
-
|
|
225
|
-
? `, bundler_httpsig => <<"
|
|
228
|
+
let _bundler = this.bundler
|
|
229
|
+
? `, bundler_httpsig => <<"${this.bundler}">>`
|
|
226
230
|
: ""
|
|
231
|
+
let _bundler_ans104 =
|
|
232
|
+
this.bundler_ans104 === false
|
|
233
|
+
? ", bundler_ans104 => false"
|
|
234
|
+
: this.bundler_ans104
|
|
235
|
+
? `, bundler_ans104 => <<"http://localhost:${this.bundler_ans104}">>`
|
|
236
|
+
: ""
|
|
227
237
|
/*
|
|
228
238
|
const _routes = `, routes => [#{ <<"template">> => <<"/result/.*">>, <<"node">> => #{ <<"prefix">> => <<"http://localhost:${this.cu}">> } }, #{ <<\"template\">> => <<\"/dry-run\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:${this.cu}\">> } }, #{ <<"template">> => <<"/graphql">>, <<"nodes">> => [#{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => httpc, protocol => http2 } }, #{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => gun, protocol => http2 } }] }, #{ <<"template">> => <<"/raw">>, <<"node">> => #{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => gun, protocol => http2 } } }]`
|
|
229
239
|
*/
|
|
@@ -260,7 +270,7 @@ export default class HyperBEAM {
|
|
|
260
270
|
: !isNil(this.faff)
|
|
261
271
|
? `, 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">> } }`
|
|
262
272
|
: ""
|
|
263
|
-
const start = `hb:start_mainnet(#{ ${_port}${_gateway}${_wallet}${_faff}${_bundler}${_on}${_p4_non_chargable}${_operator}${_spp}${_devices}${_node_processes}}).`
|
|
273
|
+
const start = `hb:start_mainnet(#{ ${_port}${_gateway}${_wallet}${_faff}${_bundler}${_bundler_ans104}${_on}${_p4_non_chargable}${_operator}${_spp}${_devices}${_node_processes}}).`
|
|
264
274
|
return start
|
|
265
275
|
}
|
|
266
276
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wao",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.3",
|
|
4
4
|
"bin": {
|
|
5
5
|
"wao": "./cjs/cli.js",
|
|
6
6
|
"wao-esm": "./esm/cli.js"
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ar.io/sdk": "^3.20.0",
|
|
35
|
+
"@ardrive/turbo-sdk": "^1.31.1",
|
|
35
36
|
"@bokuweb/zstd-wasm": "^0.0.22",
|
|
36
37
|
"@dha-team/arbundles": "^1.0.4",
|
|
37
38
|
"@permaweb/ao-loader": "^0.0.44",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"express": "^5.1.0",
|
|
50
51
|
"fast-sha256": "^1.3.0",
|
|
51
52
|
"graphql": "^16.10.0",
|
|
52
|
-
"hbsig": "^0.1.
|
|
53
|
+
"hbsig": "^0.1.5",
|
|
53
54
|
"http-message-signatures": "^1.0.4",
|
|
54
55
|
"lmdb": "^3.2.2",
|
|
55
56
|
"localforage": "^1.10.0",
|