@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,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.SERVER_TIME_MAP = exports.AxiosClient = void 0;
|
|
7
|
+
exports.getCurrentServerTime = getCurrentServerTime;
|
|
8
|
+
exports.version = void 0;
|
|
9
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
10
|
+
var _urijs = _interopRequireDefault(require("urijs"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
var version = exports.version = require("../../package.json").version;
|
|
13
|
+
var SERVER_TIME_MAP = exports.SERVER_TIME_MAP = {};
|
|
14
|
+
var AxiosClient = exports.AxiosClient = _axios.default.create({
|
|
15
|
+
headers: {
|
|
16
|
+
"X-Client-Name": "js-stellar-sdk",
|
|
17
|
+
"X-Client-Version": version
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
function _toSeconds(ms) {
|
|
21
|
+
return Math.floor(ms / 1000);
|
|
22
|
+
}
|
|
23
|
+
AxiosClient.interceptors.response.use(function interceptorHorizonResponse(response) {
|
|
24
|
+
var hostname = (0, _urijs.default)(response.config.url).hostname();
|
|
25
|
+
var serverTime = _toSeconds(Date.parse(response.headers.date));
|
|
26
|
+
var localTimeRecorded = _toSeconds(new Date().getTime());
|
|
27
|
+
if (!isNaN(serverTime)) {
|
|
28
|
+
SERVER_TIME_MAP[hostname] = {
|
|
29
|
+
serverTime: serverTime,
|
|
30
|
+
localTimeRecorded: localTimeRecorded
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return response;
|
|
34
|
+
});
|
|
35
|
+
var _default = exports.default = AxiosClient;
|
|
36
|
+
function getCurrentServerTime(hostname) {
|
|
37
|
+
var entry = SERVER_TIME_MAP[hostname];
|
|
38
|
+
if (!entry || !entry.localTimeRecorded || !entry.serverTime) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
var serverTime = entry.serverTime,
|
|
42
|
+
localTimeRecorded = entry.localTimeRecorded;
|
|
43
|
+
var currentTime = _toSeconds(new Date().getTime());
|
|
44
|
+
if (currentTime - localTimeRecorded > 60 * 5) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return currentTime - localTimeRecorded + serverTime;
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./horizon_api";
|
|
2
|
+
export * from "./server_api";
|
|
3
|
+
export * from "./account_response";
|
|
4
|
+
export { Server } from "./server";
|
|
5
|
+
export { default as AxiosClient, SERVER_TIME_MAP, getCurrentServerTime } from "./horizon_axios_client";
|
|
6
|
+
declare const _default: any;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
var _exportNames = {
|
|
8
|
+
Server: true,
|
|
9
|
+
AxiosClient: true,
|
|
10
|
+
SERVER_TIME_MAP: true,
|
|
11
|
+
getCurrentServerTime: true
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "AxiosClient", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _horizon_axios_client.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "SERVER_TIME_MAP", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _horizon_axios_client.SERVER_TIME_MAP;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "Server", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _server.Server;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
exports.default = void 0;
|
|
32
|
+
Object.defineProperty(exports, "getCurrentServerTime", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _horizon_axios_client.getCurrentServerTime;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var _horizon_api = require("./horizon_api");
|
|
39
|
+
Object.keys(_horizon_api).forEach(function (key) {
|
|
40
|
+
if (key === "default" || key === "__esModule") return;
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
|
+
if (key in exports && exports[key] === _horizon_api[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _horizon_api[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _server_api = require("./server_api");
|
|
51
|
+
Object.keys(_server_api).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
54
|
+
if (key in exports && exports[key] === _server_api[key]) return;
|
|
55
|
+
Object.defineProperty(exports, key, {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function get() {
|
|
58
|
+
return _server_api[key];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
var _account_response = require("./account_response");
|
|
63
|
+
Object.keys(_account_response).forEach(function (key) {
|
|
64
|
+
if (key === "default" || key === "__esModule") return;
|
|
65
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
66
|
+
if (key in exports && exports[key] === _account_response[key]) return;
|
|
67
|
+
Object.defineProperty(exports, key, {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function get() {
|
|
70
|
+
return _account_response[key];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
var _server = require("./server");
|
|
75
|
+
var _horizon_axios_client = _interopRequireWildcard(require("./horizon_axios_client"));
|
|
76
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
77
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
78
|
+
var _default = exports.default = module.exports;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="urijs" />
|
|
2
|
+
import { CallBuilder } from "./call_builder";
|
|
3
|
+
import { ServerApi } from "./server_api";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new {@link LedgerCallBuilder} pointed to server defined by serverUrl.
|
|
6
|
+
* Do not create this object directly, use {@link Server#ledgers}.
|
|
7
|
+
*
|
|
8
|
+
* @see [All Ledgers](https://developers.stellar.org/api/resources/ledgers/list/)
|
|
9
|
+
* @constructor
|
|
10
|
+
* @class LedgerCallBuilder
|
|
11
|
+
* @extends CallBuilder
|
|
12
|
+
* @param {string} serverUrl Horizon server URL.
|
|
13
|
+
*/
|
|
14
|
+
export declare class LedgerCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.LedgerRecord>> {
|
|
15
|
+
constructor(serverUrl: URI);
|
|
16
|
+
/**
|
|
17
|
+
* Provides information on a single ledger.
|
|
18
|
+
* @param {number|string} sequence Ledger sequence
|
|
19
|
+
* @returns {LedgerCallBuilder} current LedgerCallBuilder instance
|
|
20
|
+
*/
|
|
21
|
+
ledger(sequence: number | string): this;
|
|
22
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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.LedgerCallBuilder = 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 LedgerCallBuilder = exports.LedgerCallBuilder = function (_CallBuilder) {
|
|
22
|
+
_inherits(LedgerCallBuilder, _CallBuilder);
|
|
23
|
+
var _super = _createSuper(LedgerCallBuilder);
|
|
24
|
+
function LedgerCallBuilder(serverUrl) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, LedgerCallBuilder);
|
|
27
|
+
_this = _super.call(this, serverUrl);
|
|
28
|
+
_this.url.segment("ledgers");
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
_createClass(LedgerCallBuilder, [{
|
|
32
|
+
key: "ledger",
|
|
33
|
+
value: function ledger(sequence) {
|
|
34
|
+
this.filter.push(["ledgers", sequence.toString()]);
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
}]);
|
|
38
|
+
return LedgerCallBuilder;
|
|
39
|
+
}(_call_builder.CallBuilder);
|
|
@@ -0,0 +1,38 @@
|
|
|
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 LiquidityPoolCallBuilder} pointed to server defined by serverUrl.
|
|
7
|
+
* Do not create this object directly, use {@link Server#liquidityPools}.
|
|
8
|
+
*
|
|
9
|
+
* @class LiquidityPoolCallBuilder
|
|
10
|
+
* @extends CallBuilder
|
|
11
|
+
* @constructor
|
|
12
|
+
* @param {string} serverUrl Horizon server URL.
|
|
13
|
+
*/
|
|
14
|
+
export declare class LiquidityPoolCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.LiquidityPoolRecord>> {
|
|
15
|
+
constructor(serverUrl: URI);
|
|
16
|
+
/**
|
|
17
|
+
* Filters out pools whose reserves don't exactly match these assets.
|
|
18
|
+
*
|
|
19
|
+
* @see Asset
|
|
20
|
+
* @param {Asset[]} assets
|
|
21
|
+
* @returns {LiquidityPoolCallBuilder} current LiquidityPoolCallBuilder instance
|
|
22
|
+
*/
|
|
23
|
+
forAssets(...assets: Asset[]): this;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves all pools an account is participating in.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} id the participant account to filter by
|
|
28
|
+
* @returns {LiquidityPoolCallBuilder} current LiquidityPoolCallBuilder instance
|
|
29
|
+
*/
|
|
30
|
+
forAccount(id: string): this;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves a specific liquidity pool by ID.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} id the hash/ID of the liquidity pool
|
|
35
|
+
* @returns {CallBuilder} a new CallBuilder instance for the /liquidity_pools/:id endpoint
|
|
36
|
+
*/
|
|
37
|
+
liquidityPoolId(id: string): CallBuilder<ServerApi.LiquidityPoolRecord>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.LiquidityPoolCallBuilder = 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 LiquidityPoolCallBuilder = exports.LiquidityPoolCallBuilder = function (_CallBuilder) {
|
|
22
|
+
_inherits(LiquidityPoolCallBuilder, _CallBuilder);
|
|
23
|
+
var _super = _createSuper(LiquidityPoolCallBuilder);
|
|
24
|
+
function LiquidityPoolCallBuilder(serverUrl) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, LiquidityPoolCallBuilder);
|
|
27
|
+
_this = _super.call(this, serverUrl);
|
|
28
|
+
_this.url.segment("liquidity_pools");
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
_createClass(LiquidityPoolCallBuilder, [{
|
|
32
|
+
key: "forAssets",
|
|
33
|
+
value: function forAssets() {
|
|
34
|
+
for (var _len = arguments.length, assets = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
|
+
assets[_key] = arguments[_key];
|
|
36
|
+
}
|
|
37
|
+
var assetList = assets.map(function (asset) {
|
|
38
|
+
return asset.toString();
|
|
39
|
+
}).join(",");
|
|
40
|
+
this.url.setQuery("reserves", assetList);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "forAccount",
|
|
45
|
+
value: function forAccount(id) {
|
|
46
|
+
this.url.setQuery("account", id);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "liquidityPoolId",
|
|
51
|
+
value: function liquidityPoolId(id) {
|
|
52
|
+
if (!id.match(/[a-fA-F0-9]{64}/)) {
|
|
53
|
+
throw new TypeError("".concat(id, " does not look like a liquidity pool ID"));
|
|
54
|
+
}
|
|
55
|
+
var builder = new _call_builder.CallBuilder(this.url.clone());
|
|
56
|
+
builder.filter.push([id.toLowerCase()]);
|
|
57
|
+
return builder;
|
|
58
|
+
}
|
|
59
|
+
}]);
|
|
60
|
+
return LiquidityPoolCallBuilder;
|
|
61
|
+
}(_call_builder.CallBuilder);
|
|
@@ -0,0 +1,64 @@
|
|
|
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 OfferCallBuilder} pointed to server defined by serverUrl.
|
|
7
|
+
* Do not create this object directly, use {@link Server#offers}.
|
|
8
|
+
*
|
|
9
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/)
|
|
10
|
+
* @class OfferCallBuilder
|
|
11
|
+
* @constructor
|
|
12
|
+
* @extends CallBuilder
|
|
13
|
+
* @param {string} serverUrl Horizon server URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare class OfferCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.OfferRecord>> {
|
|
16
|
+
constructor(serverUrl: URI);
|
|
17
|
+
/**
|
|
18
|
+
* The offer details endpoint provides information on a single offer. The offer ID provided in the id
|
|
19
|
+
* argument specifies which offer to load.
|
|
20
|
+
* @see [Offer Details](https://developers.stellar.org/api/resources/offers/single/)
|
|
21
|
+
* @param {string} offerId Offer ID
|
|
22
|
+
* @returns {CallBuilder<ServerApi.OfferRecord>} CallBuilder<ServerApi.OfferRecord> OperationCallBuilder instance
|
|
23
|
+
*/
|
|
24
|
+
offer(offerId: string): CallBuilder<ServerApi.OfferRecord>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns all offers where the given account is involved.
|
|
27
|
+
*
|
|
28
|
+
* @see [Offers](https://developers.stellar.org/api/resources/accounts/offers/)
|
|
29
|
+
* @param {string} id For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
30
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
|
31
|
+
*/
|
|
32
|
+
forAccount(id: string): this;
|
|
33
|
+
/**
|
|
34
|
+
* Returns all offers buying an asset.
|
|
35
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/list/)
|
|
36
|
+
* @see Asset
|
|
37
|
+
* @param {Asset} asset For example: `new Asset('USD','GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD')`
|
|
38
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
|
39
|
+
*/
|
|
40
|
+
buying(asset: Asset): this;
|
|
41
|
+
/**
|
|
42
|
+
* Returns all offers selling an asset.
|
|
43
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/list/)
|
|
44
|
+
* @see Asset
|
|
45
|
+
* @param {Asset} asset For example: `new Asset('EUR','GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD')`
|
|
46
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
|
47
|
+
*/
|
|
48
|
+
selling(asset: Asset): this;
|
|
49
|
+
/**
|
|
50
|
+
* This endpoint filters offers where the given account is sponsoring the offer entry.
|
|
51
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/list/)
|
|
52
|
+
* @param {string} id For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
53
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
|
54
|
+
*/
|
|
55
|
+
sponsor(id: string): this;
|
|
56
|
+
/**
|
|
57
|
+
* This endpoint filters offers where the given account is the seller.
|
|
58
|
+
*
|
|
59
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/list/)
|
|
60
|
+
* @param {string} seller For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
61
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
|
62
|
+
*/
|
|
63
|
+
seller(seller: string): this;
|
|
64
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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.OfferCallBuilder = 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 OfferCallBuilder = exports.OfferCallBuilder = function (_CallBuilder) {
|
|
22
|
+
_inherits(OfferCallBuilder, _CallBuilder);
|
|
23
|
+
var _super = _createSuper(OfferCallBuilder);
|
|
24
|
+
function OfferCallBuilder(serverUrl) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, OfferCallBuilder);
|
|
27
|
+
_this = _super.call(this, serverUrl, "offers");
|
|
28
|
+
_this.url.segment("offers");
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
_createClass(OfferCallBuilder, [{
|
|
32
|
+
key: "offer",
|
|
33
|
+
value: function offer(offerId) {
|
|
34
|
+
var builder = new _call_builder.CallBuilder(this.url.clone());
|
|
35
|
+
builder.filter.push([offerId]);
|
|
36
|
+
return builder;
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
key: "forAccount",
|
|
40
|
+
value: function forAccount(id) {
|
|
41
|
+
return this.forEndpoint("accounts", id);
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "buying",
|
|
45
|
+
value: function buying(asset) {
|
|
46
|
+
if (!asset.isNative()) {
|
|
47
|
+
this.url.setQuery("buying_asset_type", asset.getAssetType());
|
|
48
|
+
this.url.setQuery("buying_asset_code", asset.getCode());
|
|
49
|
+
this.url.setQuery("buying_asset_issuer", asset.getIssuer());
|
|
50
|
+
} else {
|
|
51
|
+
this.url.setQuery("buying_asset_type", "native");
|
|
52
|
+
}
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
key: "selling",
|
|
57
|
+
value: function selling(asset) {
|
|
58
|
+
if (!asset.isNative()) {
|
|
59
|
+
this.url.setQuery("selling_asset_type", asset.getAssetType());
|
|
60
|
+
this.url.setQuery("selling_asset_code", asset.getCode());
|
|
61
|
+
this.url.setQuery("selling_asset_issuer", asset.getIssuer());
|
|
62
|
+
} else {
|
|
63
|
+
this.url.setQuery("selling_asset_type", "native");
|
|
64
|
+
}
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "sponsor",
|
|
69
|
+
value: function sponsor(id) {
|
|
70
|
+
this.url.setQuery("sponsor", id);
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "seller",
|
|
75
|
+
value: function seller(_seller) {
|
|
76
|
+
this.url.setQuery("seller", _seller);
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
}]);
|
|
80
|
+
return OfferCallBuilder;
|
|
81
|
+
}(_call_builder.CallBuilder);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/// <reference types="urijs" />
|
|
2
|
+
import { CallBuilder } from "./call_builder";
|
|
3
|
+
import { ServerApi } from "./server_api";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new {@link OperationCallBuilder} pointed to server defined by serverUrl.
|
|
6
|
+
* Do not create this object directly, use {@link Server#operations}.
|
|
7
|
+
*
|
|
8
|
+
* @see [All Operations](https://developers.stellar.org/api/resources/operations/)
|
|
9
|
+
* @class OperationCallBuilder
|
|
10
|
+
* @constructor
|
|
11
|
+
* @extends CallBuilder
|
|
12
|
+
* @param {string} serverUrl Horizon server URL.
|
|
13
|
+
*/
|
|
14
|
+
export declare class OperationCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.OperationRecord>> {
|
|
15
|
+
constructor(serverUrl: URI);
|
|
16
|
+
/**
|
|
17
|
+
* The operation details endpoint provides information on a single operation. The operation ID provided in the id
|
|
18
|
+
* argument specifies which operation to load.
|
|
19
|
+
* @see [Operation Details](https://developers.stellar.org/api/resources/operations/single/)
|
|
20
|
+
* @param {number} operationId Operation ID
|
|
21
|
+
* @returns {CallBuilder} this OperationCallBuilder instance
|
|
22
|
+
*/
|
|
23
|
+
operation(operationId: string): CallBuilder<ServerApi.OperationRecord>;
|
|
24
|
+
/**
|
|
25
|
+
* This endpoint represents all operations that were included in valid transactions that affected a particular account.
|
|
26
|
+
* @see [Operations for Account](https://developers.stellar.org/api/resources/accounts/operations/)
|
|
27
|
+
* @param {string} accountId For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
|
28
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
|
29
|
+
*/
|
|
30
|
+
forAccount(accountId: string): this;
|
|
31
|
+
/**
|
|
32
|
+
* This endpoint represents all operations that reference a given claimable_balance.
|
|
33
|
+
* @see [Operations for Claimable Balance](https://developers.stellar.org/api/resources/claimablebalances/operations/)
|
|
34
|
+
* @param {string} claimableBalanceId Claimable Balance ID
|
|
35
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
|
36
|
+
*/
|
|
37
|
+
forClaimableBalance(claimableBalanceId: string): this;
|
|
38
|
+
/**
|
|
39
|
+
* This endpoint returns all operations that occurred in a given ledger.
|
|
40
|
+
*
|
|
41
|
+
* @see [Operations for Ledger](https://developers.stellar.org/api/resources/ledgers/operations/)
|
|
42
|
+
* @param {number|string} sequence Ledger sequence
|
|
43
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
|
44
|
+
*/
|
|
45
|
+
forLedger(sequence: number | string): this;
|
|
46
|
+
/**
|
|
47
|
+
* This endpoint represents all operations that are part of a given transaction.
|
|
48
|
+
* @see [Operations for Transaction](https://developers.stellar.org/api/resources/transactions/operations/)
|
|
49
|
+
* @param {string} transactionId Transaction ID
|
|
50
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
|
51
|
+
*/
|
|
52
|
+
forTransaction(transactionId: string): this;
|
|
53
|
+
/**
|
|
54
|
+
* This endpoint represents all operations involving a particular liquidity pool.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} poolId liquidity pool ID
|
|
57
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
|
58
|
+
*/
|
|
59
|
+
forLiquidityPool(poolId: string): this;
|
|
60
|
+
/**
|
|
61
|
+
* Adds a parameter defining whether to include failed transactions.
|
|
62
|
+
* By default, only operations of successful transactions are returned.
|
|
63
|
+
*
|
|
64
|
+
* @param {bool} value Set to `true` to include operations of failed transactions.
|
|
65
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
|
66
|
+
*/
|
|
67
|
+
includeFailed(value: boolean): this;
|
|
68
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.OperationCallBuilder = 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 OperationCallBuilder = exports.OperationCallBuilder = function (_CallBuilder) {
|
|
22
|
+
_inherits(OperationCallBuilder, _CallBuilder);
|
|
23
|
+
var _super = _createSuper(OperationCallBuilder);
|
|
24
|
+
function OperationCallBuilder(serverUrl) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, OperationCallBuilder);
|
|
27
|
+
_this = _super.call(this, serverUrl, "operations");
|
|
28
|
+
_this.url.segment("operations");
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
_createClass(OperationCallBuilder, [{
|
|
32
|
+
key: "operation",
|
|
33
|
+
value: function operation(operationId) {
|
|
34
|
+
var builder = new _call_builder.CallBuilder(this.url.clone());
|
|
35
|
+
builder.filter.push([operationId]);
|
|
36
|
+
return builder;
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
key: "forAccount",
|
|
40
|
+
value: function forAccount(accountId) {
|
|
41
|
+
return this.forEndpoint("accounts", accountId);
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "forClaimableBalance",
|
|
45
|
+
value: function forClaimableBalance(claimableBalanceId) {
|
|
46
|
+
return this.forEndpoint("claimable_balances", claimableBalanceId);
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "forLedger",
|
|
50
|
+
value: function forLedger(sequence) {
|
|
51
|
+
return this.forEndpoint("ledgers", sequence.toString());
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "forTransaction",
|
|
55
|
+
value: function forTransaction(transactionId) {
|
|
56
|
+
return this.forEndpoint("transactions", transactionId);
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "forLiquidityPool",
|
|
60
|
+
value: function forLiquidityPool(poolId) {
|
|
61
|
+
return this.forEndpoint("liquidity_pools", poolId);
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "includeFailed",
|
|
65
|
+
value: function includeFailed(value) {
|
|
66
|
+
this.url.setQuery("include_failed", value.toString());
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
}]);
|
|
70
|
+
return OperationCallBuilder;
|
|
71
|
+
}(_call_builder.CallBuilder);
|
|
@@ -0,0 +1,16 @@
|
|
|
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 OrderbookCallBuilder} pointed to server defined by serverUrl.
|
|
7
|
+
*
|
|
8
|
+
* Do not create this object directly, use {@link Server#orderbook}.
|
|
9
|
+
* @see [Orderbook Details](https://developers.stellar.org/api/aggregations/order-books/)
|
|
10
|
+
* @param {string} serverUrl serverUrl Horizon server URL.
|
|
11
|
+
* @param {Asset} selling Asset being sold
|
|
12
|
+
* @param {Asset} buying Asset being bought
|
|
13
|
+
*/
|
|
14
|
+
export declare class OrderbookCallBuilder extends CallBuilder<ServerApi.OrderbookRecord> {
|
|
15
|
+
constructor(serverUrl: URI, selling: Asset, buying: Asset);
|
|
16
|
+
}
|