wao 0.3.1 → 0.4.1
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/accounts.js +12 -12
- package/cjs/ao.js +6 -1
- package/cjs/aoconnect.js +414 -1475
- package/cjs/ar.js +39 -65
- package/cjs/armem.js +54 -0
- package/cjs/gql.js +393 -0
- package/cjs/index.js +7 -0
- package/cjs/tao.js +9 -9
- package/cjs/tar.js +280 -0
- package/cjs/test.js +57 -3
- package/cjs/tgql.js +733 -0
- package/cjs/utils.js +42 -8
- package/cjs/weavedrive.js +979 -0
- package/esm/accounts.js +36 -30
- package/esm/ao.js +4 -1
- package/esm/aoconnect.js +66 -808
- package/esm/ar.js +8 -24
- package/esm/armem.js +42 -0
- package/esm/gql.js +219 -0
- package/esm/index.js +2 -1
- package/esm/tao.js +7 -9
- package/esm/tar.js +106 -0
- package/esm/test.js +13 -2
- package/esm/tgql.js +282 -0
- package/esm/utils.js +10 -14
- package/esm/weavedrive.js +709 -0
- package/package.json +1 -1
package/cjs/ar.js
CHANGED
|
@@ -8,6 +8,7 @@ var _arweave2 = _interopRequireDefault(require("arweave"));
|
|
|
8
8
|
var _arbundles = require("arbundles");
|
|
9
9
|
var _utils = require("./utils.js");
|
|
10
10
|
var _ramda = require("ramda");
|
|
11
|
+
var _gql = _interopRequireDefault(require("./gql.js"));
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
13
|
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
14
|
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; }
|
|
@@ -38,13 +39,16 @@ var AR = /*#__PURE__*/function () {
|
|
|
38
39
|
port: port,
|
|
39
40
|
protocol: protocol
|
|
40
41
|
};
|
|
41
|
-
if (!_arweave.host) _arweave.host = port === 443 ? "arweave.net" : "
|
|
42
|
+
if (!_arweave.host) _arweave.host = port === 443 ? "arweave.net" : "localhost";
|
|
42
43
|
if (!_arweave.protocol) _arweave.protocol = (0, _utils.isLocalhost)(_arweave.host) ? "http" : "https";
|
|
43
44
|
if (!_arweave.port) _arweave.port = (0, _utils.isLocalhost)(_arweave.host) ? 1984 : 443;
|
|
44
45
|
this.port = _arweave.port;
|
|
45
|
-
this.arweave = _arweave2["default"].init(_arweave);
|
|
46
46
|
this.host = _arweave.host;
|
|
47
47
|
this.protocol = _arweave.protocol;
|
|
48
|
+
this.arweave = _arweave2["default"].init(_arweave);
|
|
49
|
+
this.gql = new _gql["default"]({
|
|
50
|
+
url: "".concat(_arweave.protocol, "://").concat(_arweave.host, ":").concat(_arweave.port, "/graphql")
|
|
51
|
+
});
|
|
48
52
|
}
|
|
49
53
|
return _createClass(AR, [{
|
|
50
54
|
key: "isArConnect",
|
|
@@ -695,29 +699,35 @@ var AR = /*#__PURE__*/function () {
|
|
|
695
699
|
key: "tx",
|
|
696
700
|
value: function () {
|
|
697
701
|
var _tx = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(txid) {
|
|
698
|
-
var
|
|
699
|
-
var json;
|
|
702
|
+
var _yield$this$gql$txs$;
|
|
700
703
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
701
704
|
while (1) switch (_context12.prev = _context12.next) {
|
|
702
705
|
case 0:
|
|
703
706
|
_context12.next = 2;
|
|
704
|
-
return
|
|
705
|
-
|
|
706
|
-
headers: {
|
|
707
|
-
"Content-Type": "application/json"
|
|
708
|
-
},
|
|
709
|
-
body: JSON.stringify({
|
|
710
|
-
query: (0, _utils.query)(txid)
|
|
711
|
-
})
|
|
712
|
-
}).then(function (r) {
|
|
713
|
-
return r.json();
|
|
707
|
+
return this.gql.txs({
|
|
708
|
+
id: txid
|
|
714
709
|
});
|
|
715
710
|
case 2:
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
711
|
+
_context12.t1 = _yield$this$gql$txs$ = _context12.sent[0];
|
|
712
|
+
_context12.t0 = _context12.t1 !== null;
|
|
713
|
+
if (!_context12.t0) {
|
|
714
|
+
_context12.next = 6;
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
_context12.t0 = _yield$this$gql$txs$ !== void 0;
|
|
718
|
+
case 6:
|
|
719
|
+
if (!_context12.t0) {
|
|
720
|
+
_context12.next = 10;
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
_context12.t2 = _yield$this$gql$txs$;
|
|
724
|
+
_context12.next = 11;
|
|
725
|
+
break;
|
|
726
|
+
case 10:
|
|
727
|
+
_context12.t2 = null;
|
|
728
|
+
case 11:
|
|
729
|
+
return _context12.abrupt("return", _context12.t2);
|
|
730
|
+
case 12:
|
|
721
731
|
case "end":
|
|
722
732
|
return _context12.stop();
|
|
723
733
|
}
|
|
@@ -728,66 +738,30 @@ var AR = /*#__PURE__*/function () {
|
|
|
728
738
|
}
|
|
729
739
|
return tx;
|
|
730
740
|
}()
|
|
731
|
-
}, {
|
|
732
|
-
key: "txs",
|
|
733
|
-
value: function () {
|
|
734
|
-
var _txs = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(to) {
|
|
735
|
-
var json;
|
|
736
|
-
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
737
|
-
while (1) switch (_context13.prev = _context13.next) {
|
|
738
|
-
case 0:
|
|
739
|
-
_context13.next = 2;
|
|
740
|
-
return fetch("".concat(this.protocol, "://").concat(this.host, ":").concat(this.port, "/graphql"), {
|
|
741
|
-
method: "POST",
|
|
742
|
-
headers: {
|
|
743
|
-
"Content-Type": "application/json"
|
|
744
|
-
},
|
|
745
|
-
body: JSON.stringify({
|
|
746
|
-
query: (0, _utils.queries)(to)
|
|
747
|
-
})
|
|
748
|
-
}).then(function (r) {
|
|
749
|
-
return r.json();
|
|
750
|
-
});
|
|
751
|
-
case 2:
|
|
752
|
-
json = _context13.sent;
|
|
753
|
-
return _context13.abrupt("return", json.data.transactions.edges.map(function (v) {
|
|
754
|
-
return v.node;
|
|
755
|
-
}));
|
|
756
|
-
case 4:
|
|
757
|
-
case "end":
|
|
758
|
-
return _context13.stop();
|
|
759
|
-
}
|
|
760
|
-
}, _callee13, this);
|
|
761
|
-
}));
|
|
762
|
-
function txs(_x15) {
|
|
763
|
-
return _txs.apply(this, arguments);
|
|
764
|
-
}
|
|
765
|
-
return txs;
|
|
766
|
-
}()
|
|
767
741
|
}, {
|
|
768
742
|
key: "data",
|
|
769
743
|
value: function () {
|
|
770
|
-
var _data = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
744
|
+
var _data = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(txid) {
|
|
771
745
|
var string,
|
|
772
|
-
|
|
773
|
-
return _regeneratorRuntime().wrap(function
|
|
774
|
-
while (1) switch (
|
|
746
|
+
_args13 = arguments;
|
|
747
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
748
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
775
749
|
case 0:
|
|
776
|
-
string =
|
|
777
|
-
|
|
750
|
+
string = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : false;
|
|
751
|
+
_context13.next = 3;
|
|
778
752
|
return this.arweave.transactions.getData(txid, {
|
|
779
753
|
decode: true,
|
|
780
754
|
string: string
|
|
781
755
|
});
|
|
782
756
|
case 3:
|
|
783
|
-
return
|
|
757
|
+
return _context13.abrupt("return", _context13.sent);
|
|
784
758
|
case 4:
|
|
785
759
|
case "end":
|
|
786
|
-
return
|
|
760
|
+
return _context13.stop();
|
|
787
761
|
}
|
|
788
|
-
},
|
|
762
|
+
}, _callee13, this);
|
|
789
763
|
}));
|
|
790
|
-
function data(
|
|
764
|
+
function data(_x15) {
|
|
791
765
|
return _data.apply(this, arguments);
|
|
792
766
|
}
|
|
793
767
|
return data;
|
package/cjs/armem.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
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 _arweave = _interopRequireDefault(require("arweave"));
|
|
9
|
+
var _ramda = require("ramda");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
|
+
var ArMem = exports["default"] = /*#__PURE__*/_createClass(function ArMem() {
|
|
17
|
+
var _this = this;
|
|
18
|
+
_classCallCheck(this, ArMem);
|
|
19
|
+
this.__type__ = "mem";
|
|
20
|
+
this.arweave = _arweave["default"].init();
|
|
21
|
+
this.arweave.transactions.getTransactionAnchor = function () {
|
|
22
|
+
return _this.blocks.length === 0 ? "" : (0, _ramda.last)(_this.blockmap[(0, _ramda.last)(_this.blocks)].txs);
|
|
23
|
+
};
|
|
24
|
+
this.arweave.transactions.getPrice = function () {
|
|
25
|
+
return 0;
|
|
26
|
+
};
|
|
27
|
+
this.txs = {};
|
|
28
|
+
this.jwks = {};
|
|
29
|
+
this.height = 0;
|
|
30
|
+
this.blocks = [];
|
|
31
|
+
this.blockmap = {};
|
|
32
|
+
this.env = {};
|
|
33
|
+
this.modules = {
|
|
34
|
+
aos2_0_1: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
|
|
35
|
+
aos1: "cNlipBptaF9JeFAf4wUmpi43EojNanIBos3EfNrEOWo",
|
|
36
|
+
sqlite: "ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw"
|
|
37
|
+
};
|
|
38
|
+
this.modmap = {};
|
|
39
|
+
this.msgs = {};
|
|
40
|
+
this.wasms = {
|
|
41
|
+
"Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM": {
|
|
42
|
+
file: "aos2_0_1",
|
|
43
|
+
format: "wasm64-unknown-emscripten-draft_2024_02_15"
|
|
44
|
+
},
|
|
45
|
+
cNlipBptaF9JeFAf4wUmpi43EojNanIBos3EfNrEOWo: {
|
|
46
|
+
file: "aos_1",
|
|
47
|
+
format: "wasm64-unknown-emscripten-draft_2024_02_15"
|
|
48
|
+
},
|
|
49
|
+
ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw: {
|
|
50
|
+
file: "sqlite",
|
|
51
|
+
format: "wasm64-unknown-emscripten-draft_2024_02_15"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
});
|
package/cjs/gql.js
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
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 _ramda = require("ramda");
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
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); }
|
|
14
|
+
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); }); }; }
|
|
15
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
|
+
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
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
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; } } }; }
|
|
21
|
+
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; } }
|
|
22
|
+
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; }
|
|
23
|
+
var full = "id anchor signature recipient owner { address key } fee { winston ar } quantity { winston ar } data { size type } tags { name value } block { id timestamp height previous } parent { id }";
|
|
24
|
+
var full_blocks = "id timestamp height previous";
|
|
25
|
+
var subs = {
|
|
26
|
+
owner: ["address", "key"],
|
|
27
|
+
fee: ["winston", "ar"],
|
|
28
|
+
quantity: ["winston", "ar"],
|
|
29
|
+
data: ["size", "type"],
|
|
30
|
+
tags: ["name", "value"],
|
|
31
|
+
block: ["id", "timestamp", "height", "previous"],
|
|
32
|
+
parent: ["id"]
|
|
33
|
+
};
|
|
34
|
+
var field = function field(key) {
|
|
35
|
+
var val = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
36
|
+
if ((0, _ramda.includes)(key, ["id", "anchor", "signature", "recipient"])) {
|
|
37
|
+
return key;
|
|
38
|
+
} else if (subs[key]) {
|
|
39
|
+
var _subs = [];
|
|
40
|
+
if (val === true) val = subs[key];else if ((0, _ramda.is)(Object, val) && !(0, _ramda.is)(Array, val)) {
|
|
41
|
+
var _val = [];
|
|
42
|
+
var isTrue = false;
|
|
43
|
+
var isFalse = false;
|
|
44
|
+
for (var k in val) if (val[k] === true) isTrue = true;else if (val[k] === false) isFalse = true;
|
|
45
|
+
if (!isTrue && isFalse) {
|
|
46
|
+
var _iterator = _createForOfIteratorHelper(subs[key]),
|
|
47
|
+
_step;
|
|
48
|
+
try {
|
|
49
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
50
|
+
var _k = _step.value;
|
|
51
|
+
if (val[_k] !== false) _val.push(_k);
|
|
52
|
+
}
|
|
53
|
+
} catch (err) {
|
|
54
|
+
_iterator.e(err);
|
|
55
|
+
} finally {
|
|
56
|
+
_iterator.f();
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
for (var _k2 in val) if (val[_k2] === true) _val.push(_k2);
|
|
60
|
+
}
|
|
61
|
+
val = _val;
|
|
62
|
+
} else if (!(0, _ramda.is)(Array, val)) val = subs[key];
|
|
63
|
+
var _iterator2 = _createForOfIteratorHelper(val),
|
|
64
|
+
_step2;
|
|
65
|
+
try {
|
|
66
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
67
|
+
var v2 = _step2.value;
|
|
68
|
+
if ((0, _ramda.is)(String, v2) && (0, _ramda.includes)(v2, subs[key])) _subs.push(v2);
|
|
69
|
+
}
|
|
70
|
+
} catch (err) {
|
|
71
|
+
_iterator2.e(err);
|
|
72
|
+
} finally {
|
|
73
|
+
_iterator2.f();
|
|
74
|
+
}
|
|
75
|
+
if (_subs.length === 0) return null;
|
|
76
|
+
return "".concat(key, " { ").concat(_subs.join(" "), " }");
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
};
|
|
80
|
+
var field_blocks = function field_blocks(key) {
|
|
81
|
+
var val = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
82
|
+
if ((0, _ramda.includes)(key, ["id", "timestamp", "height", "previous"])) {
|
|
83
|
+
return key;
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
87
|
+
var query = function query() {
|
|
88
|
+
var _block2, _block3;
|
|
89
|
+
var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90
|
+
var cond = [];
|
|
91
|
+
var tags = [];
|
|
92
|
+
for (var k in (_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : {}) {
|
|
93
|
+
var _opt$tags;
|
|
94
|
+
if ((0, _ramda.is)(String, opt.tags[k])) {
|
|
95
|
+
tags.push("{ name: \"".concat(k, "\", values: [\"").concat(opt.tags[k], "\"] }"));
|
|
96
|
+
} else if ((0, _ramda.is)(Array, opt.tags[k])) {
|
|
97
|
+
tags.push("{ name: \"".concat(k, "\", values: [").concat((0, _ramda.map)(function (v) {
|
|
98
|
+
return "\"".concat(v, "\"");
|
|
99
|
+
}, opt.tags[k]).join(", "), "] }"));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (tags.length > 0) cond.push("tags: [".concat(tags.join(", "), "]"));
|
|
103
|
+
var recipients = null;
|
|
104
|
+
if ((0, _ramda.is)(Array, opt.recipients)) recipients = opt.recipients;else if ((0, _ramda.is)(String, opt.recipient)) recipients = [opt.recipient];
|
|
105
|
+
if (!(0, _ramda.isNil)(recipients) && recipients.length > 0) {
|
|
106
|
+
cond.push("recipients: [".concat((0, _ramda.map)(function (v) {
|
|
107
|
+
return "\"".concat(v, "\"");
|
|
108
|
+
}, recipients).join(", "), "]"));
|
|
109
|
+
}
|
|
110
|
+
var owners = null;
|
|
111
|
+
if ((0, _ramda.is)(Array, opt.owners)) owners = opt.owners;else if ((0, _ramda.is)(String, opt.owner)) owners = [opt.owner];
|
|
112
|
+
if (!(0, _ramda.isNil)(owners) && owners.length > 0) {
|
|
113
|
+
cond.push("owners: [".concat((0, _ramda.map)(function (v) {
|
|
114
|
+
return "\"".concat(v, "\"");
|
|
115
|
+
}, owners).join(", "), "]"));
|
|
116
|
+
}
|
|
117
|
+
var ids = null;
|
|
118
|
+
if ((0, _ramda.is)(Array, opt.ids)) ids = opt.ids;else if ((0, _ramda.is)(String, opt.id)) ids = [opt.id];
|
|
119
|
+
if (!(0, _ramda.isNil)(ids) && ids.length > 0) {
|
|
120
|
+
cond.push("ids: [".concat((0, _ramda.map)(function (v) {
|
|
121
|
+
return "\"".concat(v, "\"");
|
|
122
|
+
}, ids).join(", "), "]"));
|
|
123
|
+
}
|
|
124
|
+
var _block = opt.block;
|
|
125
|
+
if ((0, _ramda.is)(Number, opt.block)) {
|
|
126
|
+
_block = {
|
|
127
|
+
min: opt.block,
|
|
128
|
+
max: opt.block
|
|
129
|
+
};
|
|
130
|
+
} else if ((0, _ramda.is)(Array, opt.block) && opt.block.length > 0) {
|
|
131
|
+
_block = {};
|
|
132
|
+
if (!(0, _ramda.isNil)(opt.block[0])) _block.min = opt.block[0];
|
|
133
|
+
if (!(0, _ramda.isNil)(opt.block[1])) _block.max = opt.block[1];
|
|
134
|
+
}
|
|
135
|
+
if (!(0, _ramda.isNil)((_block2 = _block) === null || _block2 === void 0 ? void 0 : _block2.max) || !(0, _ramda.isNil)((_block3 = _block) === null || _block3 === void 0 ? void 0 : _block3.min)) {
|
|
136
|
+
var block = [];
|
|
137
|
+
if (!(0, _ramda.isNil)(_block.min)) block.push("min: ".concat(_block.min));
|
|
138
|
+
if (!(0, _ramda.isNil)(_block.max)) block.push("max: ".concat(_block.max));
|
|
139
|
+
if (block.length > 0) cond.push("block : {".concat(block.join(", "), "}"));
|
|
140
|
+
}
|
|
141
|
+
if (opt.first) cond.push("first: ".concat(opt.first));
|
|
142
|
+
if (opt.after) cond.push("after: \"".concat(opt.after, "\""));
|
|
143
|
+
if (opt.asc) cond.push("sort: HEIGHT_ASC");
|
|
144
|
+
var _cond = "";
|
|
145
|
+
if (cond.length > 0) _cond = "(".concat(cond.join(", "), ")");
|
|
146
|
+
var fields = [];
|
|
147
|
+
if ((0, _ramda.is)(Array, opt.fields) && opt.fields.length > 0) {
|
|
148
|
+
var _iterator3 = _createForOfIteratorHelper(opt.fields),
|
|
149
|
+
_step3;
|
|
150
|
+
try {
|
|
151
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
152
|
+
var v = _step3.value;
|
|
153
|
+
if ((0, _ramda.is)(String, v)) {
|
|
154
|
+
var fld = field(v);
|
|
155
|
+
if (fld) fields.push(fld);
|
|
156
|
+
} else if ((0, _ramda.is)(Object, v) && !(0, _ramda.is)(Array, v)) {
|
|
157
|
+
for (var _k3 in v) {
|
|
158
|
+
var _fld = field(_k3, v[_k3]);
|
|
159
|
+
if (_fld) fields.push(_fld);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
} catch (err) {
|
|
164
|
+
_iterator3.e(err);
|
|
165
|
+
} finally {
|
|
166
|
+
_iterator3.f();
|
|
167
|
+
}
|
|
168
|
+
} else if ((0, _ramda.is)(Object, opt.fields) && !(0, _ramda.is)(Array, opt.fields)) {
|
|
169
|
+
for (var _k4 in opt.fields) {
|
|
170
|
+
var _fld2 = field(_k4, opt.fields[_k4]);
|
|
171
|
+
if (_fld2) fields.push(_fld2);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
var _fields = fields.length > 0 ? fields.join(" ") : full;
|
|
175
|
+
return "query {\n transactions ".concat(_cond, "{\n edges { cursor node { ").concat(_fields, " } }\n }\n}");
|
|
176
|
+
};
|
|
177
|
+
var query_blocks = function query_blocks() {
|
|
178
|
+
var _height2, _height3;
|
|
179
|
+
var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
180
|
+
var cond = [];
|
|
181
|
+
var _height = opt.height;
|
|
182
|
+
if ((0, _ramda.is)(Number, opt.height)) {
|
|
183
|
+
_height = {
|
|
184
|
+
min: opt.height,
|
|
185
|
+
max: opt.height
|
|
186
|
+
};
|
|
187
|
+
} else if ((0, _ramda.is)(Array, opt.height) && opt.height.length > 0) {
|
|
188
|
+
_height = {};
|
|
189
|
+
if (!(0, _ramda.isNil)(opt.height[0])) _height.min = opt.height[0];
|
|
190
|
+
if (!(0, _ramda.isNil)(opt.height[1])) _height.max = opt.height[1];
|
|
191
|
+
}
|
|
192
|
+
if (!(0, _ramda.isNil)((_height2 = _height) === null || _height2 === void 0 ? void 0 : _height2.max) || !(0, _ramda.isNil)((_height3 = _height) === null || _height3 === void 0 ? void 0 : _height3.min)) {
|
|
193
|
+
var height = [];
|
|
194
|
+
if (!(0, _ramda.isNil)(_height.min)) height.push("min: ".concat(_height.min));
|
|
195
|
+
if (!(0, _ramda.isNil)(_height.max)) height.push("max: ".concat(_height.max));
|
|
196
|
+
if (height.length > 0) cond.push("height : {".concat(height.join(", "), "}"));
|
|
197
|
+
}
|
|
198
|
+
if (opt.first) cond.push("first: ".concat(opt.first));
|
|
199
|
+
if (opt.after) cond.push("after: \"".concat(opt.after, "\""));
|
|
200
|
+
if (opt.asc) cond.push("sort: HEIGHT_ASC");
|
|
201
|
+
var _cond = "";
|
|
202
|
+
if (cond.length > 0) _cond = "(".concat(cond.join(", "), ")");
|
|
203
|
+
var fields = [];
|
|
204
|
+
if ((0, _ramda.is)(Array, opt.fields) && opt.fields.length > 0) {
|
|
205
|
+
var _fields2 = [];
|
|
206
|
+
var _iterator4 = _createForOfIteratorHelper(opt.fields),
|
|
207
|
+
_step4;
|
|
208
|
+
try {
|
|
209
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
210
|
+
var v = _step4.value;
|
|
211
|
+
if ((0, _ramda.is)(String, v)) {
|
|
212
|
+
var fld = field_blocks(v);
|
|
213
|
+
if (fld) _fields2.push(fld);
|
|
214
|
+
} else if ((0, _ramda.is)(Object, v) && !(0, _ramda.is)(Array, v)) {
|
|
215
|
+
for (var k in v) {
|
|
216
|
+
var _fld3 = field_blocks(k, v[k]);
|
|
217
|
+
if (_fld3) _fields2.push(_fld3);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
} catch (err) {
|
|
222
|
+
_iterator4.e(err);
|
|
223
|
+
} finally {
|
|
224
|
+
_iterator4.f();
|
|
225
|
+
}
|
|
226
|
+
} else if ((0, _ramda.is)(Object, opt.fields) && !(0, _ramda.is)(Array, opt.fields)) {
|
|
227
|
+
for (var _k5 in opt.fields) {
|
|
228
|
+
var _fld4 = field_blocks(_k5, opt.fields[_k5]);
|
|
229
|
+
if (_fld4) fields.push(_fld4);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
var _fields = fields.length > 0 ? fields.join(" ") : full_blocks;
|
|
233
|
+
return "query {\n blocks ".concat(_cond, "{\n edges { cursor node { ").concat(_fields, " } }\n }\n}");
|
|
234
|
+
};
|
|
235
|
+
var GQL = exports["default"] = /*#__PURE__*/function () {
|
|
236
|
+
function GQL(_ref) {
|
|
237
|
+
var _ref$url = _ref.url,
|
|
238
|
+
url = _ref$url === void 0 ? "https://arweave.net/graphql" : _ref$url;
|
|
239
|
+
_classCallCheck(this, GQL);
|
|
240
|
+
this.url = url;
|
|
241
|
+
}
|
|
242
|
+
return _createClass(GQL, [{
|
|
243
|
+
key: "_fetch",
|
|
244
|
+
value: function () {
|
|
245
|
+
var _fetch2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, tar) {
|
|
246
|
+
var json;
|
|
247
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
248
|
+
while (1) switch (_context.prev = _context.next) {
|
|
249
|
+
case 0:
|
|
250
|
+
_context.next = 2;
|
|
251
|
+
return fetch(this.url, {
|
|
252
|
+
method: "POST",
|
|
253
|
+
headers: {
|
|
254
|
+
"Content-Type": "application/json"
|
|
255
|
+
},
|
|
256
|
+
body: JSON.stringify({
|
|
257
|
+
query: query
|
|
258
|
+
})
|
|
259
|
+
}).then(function (r) {
|
|
260
|
+
return r.json();
|
|
261
|
+
});
|
|
262
|
+
case 2:
|
|
263
|
+
json = _context.sent;
|
|
264
|
+
return _context.abrupt("return", (0, _ramda.map)(function (v) {
|
|
265
|
+
return _objectSpread({
|
|
266
|
+
cursor: v.cursor
|
|
267
|
+
}, v.node);
|
|
268
|
+
})(json.data[tar].edges));
|
|
269
|
+
case 4:
|
|
270
|
+
case "end":
|
|
271
|
+
return _context.stop();
|
|
272
|
+
}
|
|
273
|
+
}, _callee, this);
|
|
274
|
+
}));
|
|
275
|
+
function _fetch(_x, _x2) {
|
|
276
|
+
return _fetch2.apply(this, arguments);
|
|
277
|
+
}
|
|
278
|
+
return _fetch;
|
|
279
|
+
}()
|
|
280
|
+
}, {
|
|
281
|
+
key: "fetch",
|
|
282
|
+
value: function () {
|
|
283
|
+
var _fetch3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
284
|
+
var _this = this;
|
|
285
|
+
var opt,
|
|
286
|
+
query,
|
|
287
|
+
tar,
|
|
288
|
+
data,
|
|
289
|
+
cursor,
|
|
290
|
+
next,
|
|
291
|
+
_args3 = arguments;
|
|
292
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
293
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
294
|
+
case 0:
|
|
295
|
+
opt = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
296
|
+
query = _args3.length > 1 ? _args3[1] : undefined;
|
|
297
|
+
tar = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : "transactions";
|
|
298
|
+
_context3.next = 5;
|
|
299
|
+
return this._fetch(query, tar);
|
|
300
|
+
case 5:
|
|
301
|
+
data = _context3.sent;
|
|
302
|
+
if (!(opt.next === true)) {
|
|
303
|
+
_context3.next = 13;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
cursor = null;
|
|
307
|
+
if (data.length > 0) cursor = (0, _ramda.last)(data).cursor;
|
|
308
|
+
next = !cursor ? null : /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
309
|
+
var _opt;
|
|
310
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
311
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
312
|
+
case 0:
|
|
313
|
+
_opt = (0, _ramda.clone)(opt);
|
|
314
|
+
_opt.after = cursor;
|
|
315
|
+
_context2.next = 4;
|
|
316
|
+
return _this.txs(_opt);
|
|
317
|
+
case 4:
|
|
318
|
+
return _context2.abrupt("return", _context2.sent);
|
|
319
|
+
case 5:
|
|
320
|
+
case "end":
|
|
321
|
+
return _context2.stop();
|
|
322
|
+
}
|
|
323
|
+
}, _callee2);
|
|
324
|
+
}));
|
|
325
|
+
return _context3.abrupt("return", {
|
|
326
|
+
data: data,
|
|
327
|
+
next: next
|
|
328
|
+
});
|
|
329
|
+
case 13:
|
|
330
|
+
return _context3.abrupt("return", data);
|
|
331
|
+
case 14:
|
|
332
|
+
case "end":
|
|
333
|
+
return _context3.stop();
|
|
334
|
+
}
|
|
335
|
+
}, _callee3, this);
|
|
336
|
+
}));
|
|
337
|
+
function fetch() {
|
|
338
|
+
return _fetch3.apply(this, arguments);
|
|
339
|
+
}
|
|
340
|
+
return fetch;
|
|
341
|
+
}()
|
|
342
|
+
}, {
|
|
343
|
+
key: "txs",
|
|
344
|
+
value: function () {
|
|
345
|
+
var _txs = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
346
|
+
var opt,
|
|
347
|
+
_args4 = arguments;
|
|
348
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
349
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
350
|
+
case 0:
|
|
351
|
+
opt = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
352
|
+
_context4.next = 3;
|
|
353
|
+
return this.fetch(opt, query(opt));
|
|
354
|
+
case 3:
|
|
355
|
+
return _context4.abrupt("return", _context4.sent);
|
|
356
|
+
case 4:
|
|
357
|
+
case "end":
|
|
358
|
+
return _context4.stop();
|
|
359
|
+
}
|
|
360
|
+
}, _callee4, this);
|
|
361
|
+
}));
|
|
362
|
+
function txs() {
|
|
363
|
+
return _txs.apply(this, arguments);
|
|
364
|
+
}
|
|
365
|
+
return txs;
|
|
366
|
+
}()
|
|
367
|
+
}, {
|
|
368
|
+
key: "blocks",
|
|
369
|
+
value: function () {
|
|
370
|
+
var _blocks = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
371
|
+
var opt,
|
|
372
|
+
_args5 = arguments;
|
|
373
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
374
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
375
|
+
case 0:
|
|
376
|
+
opt = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
377
|
+
_context5.next = 3;
|
|
378
|
+
return this.fetch(opt, query_blocks(opt), "blocks");
|
|
379
|
+
case 3:
|
|
380
|
+
return _context5.abrupt("return", _context5.sent);
|
|
381
|
+
case 4:
|
|
382
|
+
case "end":
|
|
383
|
+
return _context5.stop();
|
|
384
|
+
}
|
|
385
|
+
}, _callee5, this);
|
|
386
|
+
}));
|
|
387
|
+
function blocks() {
|
|
388
|
+
return _blocks.apply(this, arguments);
|
|
389
|
+
}
|
|
390
|
+
return blocks;
|
|
391
|
+
}()
|
|
392
|
+
}]);
|
|
393
|
+
}();
|
package/cjs/index.js
CHANGED
|
@@ -15,6 +15,13 @@ Object.defineProperty(exports, "AR", {
|
|
|
15
15
|
return _ar["default"];
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "GQL", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _gql["default"];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
var _ar = _interopRequireDefault(require("./ar.js"));
|
|
19
25
|
var _ao = _interopRequireDefault(require("./ao.js"));
|
|
26
|
+
var _gql = _interopRequireDefault(require("./gql.js"));
|
|
20
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|