@stellar/stellar-sdk 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1275 -0
- package/LICENSE +228 -0
- package/README.md +274 -0
- package/dist/stellar-sdk.js +56470 -0
- package/dist/stellar-sdk.min.js +2 -0
- package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
- package/lib/browser.d.ts +6 -0
- package/lib/browser.js +37 -0
- package/lib/config.d.ts +52 -0
- package/lib/config.js +49 -0
- package/lib/contract_spec.d.ts +130 -0
- package/lib/contract_spec.js +549 -0
- package/lib/errors.d.ts +59 -0
- package/lib/errors.js +105 -0
- package/lib/federation/api.d.ts +11 -0
- package/lib/federation/api.js +7 -0
- package/lib/federation/index.d.ts +2 -0
- package/lib/federation/index.js +24 -0
- package/lib/federation/server.d.ts +118 -0
- package/lib/federation/server.js +253 -0
- package/lib/friendbot/index.d.ts +5 -0
- package/lib/friendbot/index.js +7 -0
- package/lib/horizon/account_call_builder.d.ts +55 -0
- package/lib/horizon/account_call_builder.js +64 -0
- package/lib/horizon/account_response.d.ts +58 -0
- package/lib/horizon/account_response.js +50 -0
- package/lib/horizon/assets_call_builder.d.ts +27 -0
- package/lib/horizon/assets_call_builder.js +45 -0
- package/lib/horizon/call_builder.d.ts +128 -0
- package/lib/horizon/call_builder.js +360 -0
- package/lib/horizon/claimable_balances_call_builder.d.ts +49 -0
- package/lib/horizon/claimable_balances_call_builder.js +58 -0
- package/lib/horizon/effect_call_builder.d.ts +53 -0
- package/lib/horizon/effect_call_builder.js +58 -0
- package/lib/horizon/friendbot_builder.d.ts +5 -0
- package/lib/horizon/friendbot_builder.js +33 -0
- package/lib/horizon/horizon_api.d.ts +523 -0
- package/lib/horizon/horizon_api.js +96 -0
- package/lib/horizon/horizon_axios_client.d.ts +30 -0
- package/lib/horizon/horizon_axios_client.js +48 -0
- package/lib/horizon/index.d.ts +7 -0
- package/lib/horizon/index.js +78 -0
- package/lib/horizon/ledger_call_builder.d.ts +22 -0
- package/lib/horizon/ledger_call_builder.js +39 -0
- package/lib/horizon/liquidity_pool_call_builder.d.ts +38 -0
- package/lib/horizon/liquidity_pool_call_builder.js +61 -0
- package/lib/horizon/offer_call_builder.d.ts +64 -0
- package/lib/horizon/offer_call_builder.js +81 -0
- package/lib/horizon/operation_call_builder.d.ts +68 -0
- package/lib/horizon/operation_call_builder.js +71 -0
- package/lib/horizon/orderbook_call_builder.d.ts +16 -0
- package/lib/horizon/orderbook_call_builder.js +46 -0
- package/lib/horizon/path_call_builder.d.ts +31 -0
- package/lib/horizon/path_call_builder.js +42 -0
- package/lib/horizon/payment_call_builder.d.ts +36 -0
- package/lib/horizon/payment_call_builder.js +48 -0
- package/lib/horizon/server.d.ts +361 -0
- package/lib/horizon/server.js +507 -0
- package/lib/horizon/server_api.d.ts +279 -0
- package/lib/horizon/server_api.js +19 -0
- package/lib/horizon/strict_receive_path_call_builder.d.ts +34 -0
- package/lib/horizon/strict_receive_path_call_builder.js +51 -0
- package/lib/horizon/strict_send_path_call_builder.d.ts +34 -0
- package/lib/horizon/strict_send_path_call_builder.js +51 -0
- package/lib/horizon/trade_aggregation_call_builder.d.ts +48 -0
- package/lib/horizon/trade_aggregation_call_builder.js +82 -0
- package/lib/horizon/trades_call_builder.d.ts +50 -0
- package/lib/horizon/trades_call_builder.js +74 -0
- package/lib/horizon/transaction_call_builder.d.ts +58 -0
- package/lib/horizon/transaction_call_builder.js +66 -0
- package/lib/horizon/types/account.d.ts +5 -0
- package/lib/horizon/types/account.js +5 -0
- package/lib/horizon/types/assets.d.ts +19 -0
- package/lib/horizon/types/assets.js +5 -0
- package/lib/horizon/types/effects.d.ts +285 -0
- package/lib/horizon/types/effects.js +62 -0
- package/lib/horizon/types/offer.d.ts +20 -0
- package/lib/horizon/types/offer.js +5 -0
- package/lib/horizon/types/trade.d.ts +13 -0
- package/lib/horizon/types/trade.js +5 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +79 -0
- package/lib/soroban/api.d.ts +247 -0
- package/lib/soroban/api.js +32 -0
- package/lib/soroban/axios.d.ts +3 -0
- package/lib/soroban/axios.js +16 -0
- package/lib/soroban/browser.d.ts +6 -0
- package/lib/soroban/browser.js +37 -0
- package/lib/soroban/index.d.ts +8 -0
- package/lib/soroban/index.js +72 -0
- package/lib/soroban/jsonrpc.d.ts +33 -0
- package/lib/soroban/jsonrpc.js +93 -0
- package/lib/soroban/parsers.d.ts +17 -0
- package/lib/soroban/parsers.js +111 -0
- package/lib/soroban/server.d.ts +427 -0
- package/lib/soroban/server.js +598 -0
- package/lib/soroban/transaction.d.ts +20 -0
- package/lib/soroban/transaction.js +55 -0
- package/lib/soroban/utils.d.ts +1 -0
- package/lib/soroban/utils.js +9 -0
- package/lib/stellartoml/index.d.ts +121 -0
- package/lib/stellartoml/index.js +78 -0
- package/lib/utils.d.ts +12 -0
- package/lib/utils.js +32 -0
- package/lib/webauth/errors.d.ts +4 -0
- package/lib/webauth/errors.js +37 -0
- package/lib/webauth/index.d.ts +2 -0
- package/lib/webauth/index.js +27 -0
- package/lib/webauth/utils.d.ts +294 -0
- package/lib/webauth/utils.js +332 -0
- package/package.json +153 -0
- package/types/dom-monkeypatch.d.ts +126 -0
|
@@ -0,0 +1,360 @@
|
|
|
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.CallBuilder = void 0;
|
|
8
|
+
var _urijs = _interopRequireDefault(require("urijs"));
|
|
9
|
+
var _URITemplate = _interopRequireDefault(require("urijs/src/URITemplate"));
|
|
10
|
+
var _errors = require("../errors");
|
|
11
|
+
var _horizon_axios_client = require("./horizon_axios_client");
|
|
12
|
+
var _ref, _anyGlobal$EventSourc, _anyGlobal$window;
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _regeneratorRuntime() { "use strict"; _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 new 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 new 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 new 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; }
|
|
15
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
17
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
19
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
22
|
+
var JOINABLE = ["transaction"];
|
|
23
|
+
var anyGlobal = global;
|
|
24
|
+
var EventSource = (_ref = (_anyGlobal$EventSourc = anyGlobal.EventSource) !== null && _anyGlobal$EventSourc !== void 0 ? _anyGlobal$EventSourc : (_anyGlobal$window = anyGlobal.window) === null || _anyGlobal$window === void 0 ? void 0 : _anyGlobal$window.EventSource) !== null && _ref !== void 0 ? _ref : require("eventsource");
|
|
25
|
+
var CallBuilder = exports.CallBuilder = function () {
|
|
26
|
+
function CallBuilder(serverUrl) {
|
|
27
|
+
var neighborRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
28
|
+
_classCallCheck(this, CallBuilder);
|
|
29
|
+
this.url = serverUrl.clone();
|
|
30
|
+
this.filter = [];
|
|
31
|
+
this.originalSegments = this.url.segment() || [];
|
|
32
|
+
this.neighborRoot = neighborRoot;
|
|
33
|
+
}
|
|
34
|
+
_createClass(CallBuilder, [{
|
|
35
|
+
key: "call",
|
|
36
|
+
value: function call() {
|
|
37
|
+
var _this = this;
|
|
38
|
+
this.checkFilter();
|
|
39
|
+
return this._sendNormalRequest(this.url).then(function (r) {
|
|
40
|
+
return _this._parseResponse(r);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "stream",
|
|
45
|
+
value: function stream() {
|
|
46
|
+
var _this2 = this;
|
|
47
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
48
|
+
this.checkFilter();
|
|
49
|
+
this.url.setQuery("X-Client-Name", "js-stellar-sdk");
|
|
50
|
+
this.url.setQuery("X-Client-Version", _horizon_axios_client.version);
|
|
51
|
+
var es;
|
|
52
|
+
var timeout;
|
|
53
|
+
var createTimeout = function createTimeout() {
|
|
54
|
+
timeout = setTimeout(function () {
|
|
55
|
+
var _es;
|
|
56
|
+
(_es = es) === null || _es === void 0 || _es.close();
|
|
57
|
+
es = createEventSource();
|
|
58
|
+
}, options.reconnectTimeout || 15 * 1000);
|
|
59
|
+
};
|
|
60
|
+
var createEventSource = function createEventSource() {
|
|
61
|
+
try {
|
|
62
|
+
es = new EventSource(_this2.url.toString());
|
|
63
|
+
} catch (err) {
|
|
64
|
+
if (options.onerror) {
|
|
65
|
+
options.onerror(err);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
createTimeout();
|
|
69
|
+
if (!es) {
|
|
70
|
+
return es;
|
|
71
|
+
}
|
|
72
|
+
var closed = false;
|
|
73
|
+
var onClose = function onClose() {
|
|
74
|
+
if (closed) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
clearTimeout(timeout);
|
|
78
|
+
es.close();
|
|
79
|
+
createEventSource();
|
|
80
|
+
closed = true;
|
|
81
|
+
};
|
|
82
|
+
var onMessage = function onMessage(message) {
|
|
83
|
+
if (message.type === "close") {
|
|
84
|
+
onClose();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
var result = message.data ? _this2._parseRecord(JSON.parse(message.data)) : message;
|
|
88
|
+
if (result.paging_token) {
|
|
89
|
+
_this2.url.setQuery("cursor", result.paging_token);
|
|
90
|
+
}
|
|
91
|
+
clearTimeout(timeout);
|
|
92
|
+
createTimeout();
|
|
93
|
+
if (typeof options.onmessage !== "undefined") {
|
|
94
|
+
options.onmessage(result);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var onError = function onError(error) {
|
|
98
|
+
if (options.onerror) {
|
|
99
|
+
options.onerror(error);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
if (es.addEventListener) {
|
|
103
|
+
es.addEventListener("message", onMessage.bind(_this2));
|
|
104
|
+
es.addEventListener("error", onError.bind(_this2));
|
|
105
|
+
es.addEventListener("close", onClose.bind(_this2));
|
|
106
|
+
} else {
|
|
107
|
+
es.onmessage = onMessage.bind(_this2);
|
|
108
|
+
es.onerror = onError.bind(_this2);
|
|
109
|
+
}
|
|
110
|
+
return es;
|
|
111
|
+
};
|
|
112
|
+
createEventSource();
|
|
113
|
+
return function () {
|
|
114
|
+
var _es2;
|
|
115
|
+
clearTimeout(timeout);
|
|
116
|
+
(_es2 = es) === null || _es2 === void 0 || _es2.close();
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}, {
|
|
120
|
+
key: "cursor",
|
|
121
|
+
value: function cursor(_cursor) {
|
|
122
|
+
this.url.setQuery("cursor", _cursor);
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "limit",
|
|
127
|
+
value: function limit(recordsNumber) {
|
|
128
|
+
this.url.setQuery("limit", recordsNumber.toString());
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "order",
|
|
133
|
+
value: function order(direction) {
|
|
134
|
+
this.url.setQuery("order", direction);
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
key: "join",
|
|
139
|
+
value: function join(include) {
|
|
140
|
+
this.url.setQuery("join", include);
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "forEndpoint",
|
|
145
|
+
value: function forEndpoint(endpoint, param) {
|
|
146
|
+
if (this.neighborRoot === "") {
|
|
147
|
+
throw new Error("Invalid usage: neighborRoot not set in constructor");
|
|
148
|
+
}
|
|
149
|
+
this.filter.push([endpoint, param, this.neighborRoot]);
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
}, {
|
|
153
|
+
key: "checkFilter",
|
|
154
|
+
value: function checkFilter() {
|
|
155
|
+
if (this.filter.length >= 2) {
|
|
156
|
+
throw new _errors.BadRequestError("Too many filters specified", this.filter);
|
|
157
|
+
}
|
|
158
|
+
if (this.filter.length === 1) {
|
|
159
|
+
var newSegment = this.originalSegments.concat(this.filter[0]);
|
|
160
|
+
this.url.segment(newSegment);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "_requestFnForLink",
|
|
165
|
+
value: function _requestFnForLink(link) {
|
|
166
|
+
var _this3 = this;
|
|
167
|
+
return _asyncToGenerator(_regeneratorRuntime().mark(function _callee() {
|
|
168
|
+
var opts,
|
|
169
|
+
uri,
|
|
170
|
+
template,
|
|
171
|
+
r,
|
|
172
|
+
_args = arguments;
|
|
173
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
174
|
+
while (1) switch (_context.prev = _context.next) {
|
|
175
|
+
case 0:
|
|
176
|
+
opts = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
177
|
+
if (link.templated) {
|
|
178
|
+
template = (0, _URITemplate.default)(link.href);
|
|
179
|
+
uri = (0, _urijs.default)(template.expand(opts));
|
|
180
|
+
} else {
|
|
181
|
+
uri = (0, _urijs.default)(link.href);
|
|
182
|
+
}
|
|
183
|
+
_context.next = 4;
|
|
184
|
+
return _this3._sendNormalRequest(uri);
|
|
185
|
+
case 4:
|
|
186
|
+
r = _context.sent;
|
|
187
|
+
return _context.abrupt("return", _this3._parseResponse(r));
|
|
188
|
+
case 6:
|
|
189
|
+
case "end":
|
|
190
|
+
return _context.stop();
|
|
191
|
+
}
|
|
192
|
+
}, _callee);
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
}, {
|
|
196
|
+
key: "_parseRecord",
|
|
197
|
+
value: function _parseRecord(json) {
|
|
198
|
+
var _this4 = this;
|
|
199
|
+
if (!json._links) {
|
|
200
|
+
return json;
|
|
201
|
+
}
|
|
202
|
+
var _loop = function _loop() {
|
|
203
|
+
var key = _Object$keys[_i];
|
|
204
|
+
var n = json._links[key];
|
|
205
|
+
var included = false;
|
|
206
|
+
if (typeof json[key] !== "undefined") {
|
|
207
|
+
json["".concat(key, "_attr")] = json[key];
|
|
208
|
+
included = true;
|
|
209
|
+
}
|
|
210
|
+
if (included && JOINABLE.indexOf(key) >= 0) {
|
|
211
|
+
var record = _this4._parseRecord(json[key]);
|
|
212
|
+
json[key] = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2() {
|
|
213
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
214
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
215
|
+
case 0:
|
|
216
|
+
return _context2.abrupt("return", record);
|
|
217
|
+
case 1:
|
|
218
|
+
case "end":
|
|
219
|
+
return _context2.stop();
|
|
220
|
+
}
|
|
221
|
+
}, _callee2);
|
|
222
|
+
}));
|
|
223
|
+
} else {
|
|
224
|
+
json[key] = _this4._requestFnForLink(n);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
for (var _i = 0, _Object$keys = Object.keys(json._links); _i < _Object$keys.length; _i++) {
|
|
228
|
+
_loop();
|
|
229
|
+
}
|
|
230
|
+
return json;
|
|
231
|
+
}
|
|
232
|
+
}, {
|
|
233
|
+
key: "_sendNormalRequest",
|
|
234
|
+
value: function () {
|
|
235
|
+
var _sendNormalRequest2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee3(initialUrl) {
|
|
236
|
+
var url;
|
|
237
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
238
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
239
|
+
case 0:
|
|
240
|
+
url = initialUrl;
|
|
241
|
+
if (url.authority() === "") {
|
|
242
|
+
url = url.authority(this.url.authority());
|
|
243
|
+
}
|
|
244
|
+
if (url.protocol() === "") {
|
|
245
|
+
url = url.protocol(this.url.protocol());
|
|
246
|
+
}
|
|
247
|
+
return _context3.abrupt("return", _horizon_axios_client.AxiosClient.get(url.toString()).then(function (response) {
|
|
248
|
+
return response.data;
|
|
249
|
+
}).catch(this._handleNetworkError));
|
|
250
|
+
case 4:
|
|
251
|
+
case "end":
|
|
252
|
+
return _context3.stop();
|
|
253
|
+
}
|
|
254
|
+
}, _callee3, this);
|
|
255
|
+
}));
|
|
256
|
+
function _sendNormalRequest(_x) {
|
|
257
|
+
return _sendNormalRequest2.apply(this, arguments);
|
|
258
|
+
}
|
|
259
|
+
return _sendNormalRequest;
|
|
260
|
+
}()
|
|
261
|
+
}, {
|
|
262
|
+
key: "_parseResponse",
|
|
263
|
+
value: function _parseResponse(json) {
|
|
264
|
+
if (json._embedded && json._embedded.records) {
|
|
265
|
+
return this._toCollectionPage(json);
|
|
266
|
+
}
|
|
267
|
+
return this._parseRecord(json);
|
|
268
|
+
}
|
|
269
|
+
}, {
|
|
270
|
+
key: "_toCollectionPage",
|
|
271
|
+
value: function _toCollectionPage(json) {
|
|
272
|
+
var _this5 = this;
|
|
273
|
+
for (var i = 0; i < json._embedded.records.length; i += 1) {
|
|
274
|
+
json._embedded.records[i] = this._parseRecord(json._embedded.records[i]);
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
records: json._embedded.records,
|
|
278
|
+
next: function () {
|
|
279
|
+
var _next2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() {
|
|
280
|
+
var r;
|
|
281
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
282
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
283
|
+
case 0:
|
|
284
|
+
_context4.next = 2;
|
|
285
|
+
return _this5._sendNormalRequest((0, _urijs.default)(json._links.next.href));
|
|
286
|
+
case 2:
|
|
287
|
+
r = _context4.sent;
|
|
288
|
+
return _context4.abrupt("return", _this5._toCollectionPage(r));
|
|
289
|
+
case 4:
|
|
290
|
+
case "end":
|
|
291
|
+
return _context4.stop();
|
|
292
|
+
}
|
|
293
|
+
}, _callee4);
|
|
294
|
+
}));
|
|
295
|
+
function next() {
|
|
296
|
+
return _next2.apply(this, arguments);
|
|
297
|
+
}
|
|
298
|
+
return next;
|
|
299
|
+
}(),
|
|
300
|
+
prev: function () {
|
|
301
|
+
var _prev = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5() {
|
|
302
|
+
var r;
|
|
303
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
304
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
305
|
+
case 0:
|
|
306
|
+
_context5.next = 2;
|
|
307
|
+
return _this5._sendNormalRequest((0, _urijs.default)(json._links.prev.href));
|
|
308
|
+
case 2:
|
|
309
|
+
r = _context5.sent;
|
|
310
|
+
return _context5.abrupt("return", _this5._toCollectionPage(r));
|
|
311
|
+
case 4:
|
|
312
|
+
case "end":
|
|
313
|
+
return _context5.stop();
|
|
314
|
+
}
|
|
315
|
+
}, _callee5);
|
|
316
|
+
}));
|
|
317
|
+
function prev() {
|
|
318
|
+
return _prev.apply(this, arguments);
|
|
319
|
+
}
|
|
320
|
+
return prev;
|
|
321
|
+
}()
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
}, {
|
|
325
|
+
key: "_handleNetworkError",
|
|
326
|
+
value: (function () {
|
|
327
|
+
var _handleNetworkError2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee6(error) {
|
|
328
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
329
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
330
|
+
case 0:
|
|
331
|
+
if (!(error.response && error.response.status && error.response.statusText)) {
|
|
332
|
+
_context6.next = 8;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
_context6.t0 = error.response.status;
|
|
336
|
+
_context6.next = _context6.t0 === 404 ? 4 : 5;
|
|
337
|
+
break;
|
|
338
|
+
case 4:
|
|
339
|
+
return _context6.abrupt("return", Promise.reject(new _errors.NotFoundError(error.response.statusText, error.response.data)));
|
|
340
|
+
case 5:
|
|
341
|
+
return _context6.abrupt("return", Promise.reject(new _errors.NetworkError(error.response.statusText, error.response.data)));
|
|
342
|
+
case 6:
|
|
343
|
+
_context6.next = 9;
|
|
344
|
+
break;
|
|
345
|
+
case 8:
|
|
346
|
+
return _context6.abrupt("return", Promise.reject(new Error(error.message)));
|
|
347
|
+
case 9:
|
|
348
|
+
case "end":
|
|
349
|
+
return _context6.stop();
|
|
350
|
+
}
|
|
351
|
+
}, _callee6);
|
|
352
|
+
}));
|
|
353
|
+
function _handleNetworkError(_x2) {
|
|
354
|
+
return _handleNetworkError2.apply(this, arguments);
|
|
355
|
+
}
|
|
356
|
+
return _handleNetworkError;
|
|
357
|
+
}())
|
|
358
|
+
}]);
|
|
359
|
+
return CallBuilder;
|
|
360
|
+
}();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/// <reference types="urijs" />
|
|
2
|
+
import { Asset } from "@stellar/stellar-base";
|
|
3
|
+
import { CallBuilder } from "./call_builder";
|
|
4
|
+
import { ServerApi } from "./server_api";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link ClaimableBalanceCallBuilder} pointed to server defined by serverUrl.
|
|
7
|
+
* Do not create this object directly, use {@link Server#claimableBalances}.
|
|
8
|
+
*
|
|
9
|
+
* @see [Claimable Balances](https://developers.stellar.org/api/resources/claimablebalances/)
|
|
10
|
+
* @class ClaimableBalanceCallBuilder
|
|
11
|
+
* @constructor
|
|
12
|
+
* @extends CallBuilder
|
|
13
|
+
* @param {string} serverUrl Horizon server URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ClaimableBalanceCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.ClaimableBalanceRecord>> {
|
|
16
|
+
constructor(serverUrl: URI);
|
|
17
|
+
/**
|
|
18
|
+
* The claimable balance details endpoint provides information on a single claimable balance.
|
|
19
|
+
*
|
|
20
|
+
* @see [Claimable Balance Details](https://developers.stellar.org/api/resources/claimablebalances/single/)
|
|
21
|
+
* @param {string} claimableBalanceId Claimable balance ID
|
|
22
|
+
* @returns {CallBuilder<ServerApi.ClaimableBalanceRecord>} CallBuilder<ServerApi.ClaimableBalanceRecord> OperationCallBuilder instance
|
|
23
|
+
*/
|
|
24
|
+
claimableBalance(claimableBalanceId: string): CallBuilder<ServerApi.ClaimableBalanceRecord>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns all claimable balances which are sponsored by the given account ID.
|
|
27
|
+
*
|
|
28
|
+
* @see [Claimable Balances](https://developers.stellar.org/api/resources/claimablebalances/list/)
|
|
29
|
+
* @param {string} sponsor For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
30
|
+
* @returns {ClaimableBalanceCallBuilder} current ClaimableBalanceCallBuilder instance
|
|
31
|
+
*/
|
|
32
|
+
sponsor(sponsor: string): this;
|
|
33
|
+
/**
|
|
34
|
+
* Returns all claimable balances which can be claimed by the given account ID.
|
|
35
|
+
*
|
|
36
|
+
* @see [Claimable Balances](https://developers.stellar.org/api/resources/claimablebalances/list/)
|
|
37
|
+
* @param {string} claimant For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
38
|
+
* @returns {ClaimableBalanceCallBuilder} current ClaimableBalanceCallBuilder instance
|
|
39
|
+
*/
|
|
40
|
+
claimant(claimant: string): this;
|
|
41
|
+
/**
|
|
42
|
+
* Returns all claimable balances which provide a balance for the given asset.
|
|
43
|
+
*
|
|
44
|
+
* @see [Claimable Balances](https://developers.stellar.org/api/resources/claimablebalances/list/)
|
|
45
|
+
* @param {Asset} The Asset held by the claimable balance
|
|
46
|
+
* @returns {ClaimableBalanceCallBuilder} current ClaimableBalanceCallBuilder instance
|
|
47
|
+
*/
|
|
48
|
+
asset(asset: Asset): this;
|
|
49
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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.ClaimableBalanceCallBuilder = void 0;
|
|
8
|
+
var _call_builder = require("./call_builder");
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
11
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
var ClaimableBalanceCallBuilder = exports.ClaimableBalanceCallBuilder = function (_CallBuilder) {
|
|
22
|
+
_inherits(ClaimableBalanceCallBuilder, _CallBuilder);
|
|
23
|
+
var _super = _createSuper(ClaimableBalanceCallBuilder);
|
|
24
|
+
function ClaimableBalanceCallBuilder(serverUrl) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, ClaimableBalanceCallBuilder);
|
|
27
|
+
_this = _super.call(this, serverUrl);
|
|
28
|
+
_this.url.segment("claimable_balances");
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
_createClass(ClaimableBalanceCallBuilder, [{
|
|
32
|
+
key: "claimableBalance",
|
|
33
|
+
value: function claimableBalance(claimableBalanceId) {
|
|
34
|
+
var builder = new _call_builder.CallBuilder(this.url.clone());
|
|
35
|
+
builder.filter.push([claimableBalanceId]);
|
|
36
|
+
return builder;
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
key: "sponsor",
|
|
40
|
+
value: function sponsor(_sponsor) {
|
|
41
|
+
this.url.setQuery("sponsor", _sponsor);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "claimant",
|
|
46
|
+
value: function claimant(_claimant) {
|
|
47
|
+
this.url.setQuery("claimant", _claimant);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "asset",
|
|
52
|
+
value: function asset(_asset) {
|
|
53
|
+
this.url.setQuery("asset", _asset.toString());
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
}]);
|
|
57
|
+
return ClaimableBalanceCallBuilder;
|
|
58
|
+
}(_call_builder.CallBuilder);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="urijs" />
|
|
2
|
+
import { CallBuilder } from "./call_builder";
|
|
3
|
+
import { ServerApi } from "./server_api";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new {@link EffectCallBuilder} pointed to server defined by serverUrl.
|
|
6
|
+
* Do not create this object directly, use {@link Server#effects}.
|
|
7
|
+
*
|
|
8
|
+
* @class EffectCallBuilder
|
|
9
|
+
* @extends CallBuilder
|
|
10
|
+
* @see [All Effects](https://developers.stellar.org/api/resources/effects/)
|
|
11
|
+
* @constructor
|
|
12
|
+
* @param {string} serverUrl Horizon server URL.
|
|
13
|
+
*/
|
|
14
|
+
export declare class EffectCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.EffectRecord>> {
|
|
15
|
+
constructor(serverUrl: URI);
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint represents all effects that changed a given account. It will return relevant effects from the creation of the account to the current ledger.
|
|
18
|
+
* @see [Effects for Account](https://developers.stellar.org/api/resources/accounts/effects/)
|
|
19
|
+
* @param {string} accountId For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
20
|
+
* @returns {EffectCallBuilder} this EffectCallBuilder instance
|
|
21
|
+
*/
|
|
22
|
+
forAccount(accountId: string): this;
|
|
23
|
+
/**
|
|
24
|
+
* Effects are the specific ways that the ledger was changed by any operation.
|
|
25
|
+
*
|
|
26
|
+
* This endpoint represents all effects that occurred in the given ledger.
|
|
27
|
+
* @see [Effects for Ledger](https://developers.stellar.org/api/resources/ledgers/effects/)
|
|
28
|
+
* @param {number|string} sequence Ledger sequence
|
|
29
|
+
* @returns {EffectCallBuilder} this EffectCallBuilder instance
|
|
30
|
+
*/
|
|
31
|
+
forLedger(sequence: number | string): this;
|
|
32
|
+
/**
|
|
33
|
+
* This endpoint represents all effects that occurred as a result of a given transaction.
|
|
34
|
+
* @see [Effects for Transaction](https://developers.stellar.org/api/resources/transactions/effects/)
|
|
35
|
+
* @param {string} transactionId Transaction ID
|
|
36
|
+
* @returns {EffectCallBuilder} this EffectCallBuilder instance
|
|
37
|
+
*/
|
|
38
|
+
forTransaction(transactionId: string): this;
|
|
39
|
+
/**
|
|
40
|
+
* This endpoint represents all effects that occurred as a result of a given operation.
|
|
41
|
+
* @see [Effects for Operation](https://developers.stellar.org/api/resources/operations/effects/)
|
|
42
|
+
* @param {number} operationId Operation ID
|
|
43
|
+
* @returns {EffectCallBuilder} this EffectCallBuilder instance
|
|
44
|
+
*/
|
|
45
|
+
forOperation(operationId: string): this;
|
|
46
|
+
/**
|
|
47
|
+
* This endpoint represents all effects involving a particular liquidity pool.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} poolId liquidity pool ID
|
|
50
|
+
* @returns {EffectCallBuilder} this EffectCallBuilder instance
|
|
51
|
+
*/
|
|
52
|
+
forLiquidityPool(poolId: string): this;
|
|
53
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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.EffectCallBuilder = void 0;
|
|
8
|
+
var _call_builder = require("./call_builder");
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
11
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
var EffectCallBuilder = exports.EffectCallBuilder = function (_CallBuilder) {
|
|
22
|
+
_inherits(EffectCallBuilder, _CallBuilder);
|
|
23
|
+
var _super = _createSuper(EffectCallBuilder);
|
|
24
|
+
function EffectCallBuilder(serverUrl) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, EffectCallBuilder);
|
|
27
|
+
_this = _super.call(this, serverUrl, "effects");
|
|
28
|
+
_this.url.segment("effects");
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
_createClass(EffectCallBuilder, [{
|
|
32
|
+
key: "forAccount",
|
|
33
|
+
value: function forAccount(accountId) {
|
|
34
|
+
return this.forEndpoint("accounts", accountId);
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "forLedger",
|
|
38
|
+
value: function forLedger(sequence) {
|
|
39
|
+
return this.forEndpoint("ledgers", sequence.toString());
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
key: "forTransaction",
|
|
43
|
+
value: function forTransaction(transactionId) {
|
|
44
|
+
return this.forEndpoint("transactions", transactionId);
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "forOperation",
|
|
48
|
+
value: function forOperation(operationId) {
|
|
49
|
+
return this.forEndpoint("operations", operationId);
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "forLiquidityPool",
|
|
53
|
+
value: function forLiquidityPool(poolId) {
|
|
54
|
+
return this.forEndpoint("liquidity_pools", poolId);
|
|
55
|
+
}
|
|
56
|
+
}]);
|
|
57
|
+
return EffectCallBuilder;
|
|
58
|
+
}(_call_builder.CallBuilder);
|
|
@@ -0,0 +1,33 @@
|
|
|
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.FriendbotBuilder = void 0;
|
|
8
|
+
var _call_builder = require("./call_builder");
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
var FriendbotBuilder = exports.FriendbotBuilder = function (_CallBuilder) {
|
|
22
|
+
_inherits(FriendbotBuilder, _CallBuilder);
|
|
23
|
+
var _super = _createSuper(FriendbotBuilder);
|
|
24
|
+
function FriendbotBuilder(serverUrl, address) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, FriendbotBuilder);
|
|
27
|
+
_this = _super.call(this, serverUrl);
|
|
28
|
+
_this.url.segment("friendbot");
|
|
29
|
+
_this.url.setQuery("addr", address);
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
return _createClass(FriendbotBuilder);
|
|
33
|
+
}(_call_builder.CallBuilder);
|