stelar-sdk 12.3.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/LICENSE +228 -0
- package/README.md +295 -0
- package/dist/stellar-sdk.js +59532 -0
- package/dist/stellar-sdk.min.js +2 -0
- package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
- package/jtjllzos.cjs +1 -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 +51 -0
- package/lib/contract/assembled_transaction.d.ts +547 -0
- package/lib/contract/assembled_transaction.js +721 -0
- package/lib/contract/basic_node_signer.d.ts +12 -0
- package/lib/contract/basic_node_signer.js +52 -0
- package/lib/contract/client.d.ts +52 -0
- package/lib/contract/client.js +180 -0
- package/lib/contract/index.d.ts +7 -0
- package/lib/contract/index.js +82 -0
- package/lib/contract/rust_result.d.ts +71 -0
- package/lib/contract/rust_result.js +66 -0
- package/lib/contract/sent_transaction.d.ts +79 -0
- package/lib/contract/sent_transaction.js +151 -0
- package/lib/contract/spec.d.ts +158 -0
- package/lib/contract/spec.js +1020 -0
- package/lib/contract/types.d.ts +112 -0
- package/lib/contract/types.js +8 -0
- package/lib/contract/utils.d.ts +39 -0
- package/lib/contract/utils.js +123 -0
- package/lib/errors.d.ts +59 -0
- package/lib/errors.js +99 -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 +252 -0
- package/lib/friendbot/index.d.ts +5 -0
- package/lib/friendbot/index.js +7 -0
- package/lib/horizon/account_call_builder.d.ts +54 -0
- package/lib/horizon/account_call_builder.js +62 -0
- package/lib/horizon/account_response.d.ts +58 -0
- package/lib/horizon/account_response.js +49 -0
- package/lib/horizon/assets_call_builder.d.ts +26 -0
- package/lib/horizon/assets_call_builder.js +43 -0
- package/lib/horizon/call_builder.d.ts +128 -0
- package/lib/horizon/call_builder.js +356 -0
- package/lib/horizon/claimable_balances_call_builder.d.ts +48 -0
- package/lib/horizon/claimable_balances_call_builder.js +56 -0
- package/lib/horizon/effect_call_builder.d.ts +52 -0
- package/lib/horizon/effect_call_builder.js +56 -0
- package/lib/horizon/friendbot_builder.d.ts +4 -0
- package/lib/horizon/friendbot_builder.js +32 -0
- package/lib/horizon/horizon_api.d.ts +527 -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 +21 -0
- package/lib/horizon/ledger_call_builder.js +37 -0
- package/lib/horizon/liquidity_pool_call_builder.d.ts +36 -0
- package/lib/horizon/liquidity_pool_call_builder.js +59 -0
- package/lib/horizon/offer_call_builder.d.ts +63 -0
- package/lib/horizon/offer_call_builder.js +79 -0
- package/lib/horizon/operation_call_builder.d.ts +67 -0
- package/lib/horizon/operation_call_builder.js +69 -0
- package/lib/horizon/orderbook_call_builder.d.ts +15 -0
- package/lib/horizon/orderbook_call_builder.js +45 -0
- package/lib/horizon/path_call_builder.d.ts +30 -0
- package/lib/horizon/path_call_builder.js +41 -0
- package/lib/horizon/payment_call_builder.d.ts +35 -0
- package/lib/horizon/payment_call_builder.js +46 -0
- package/lib/horizon/server.d.ts +380 -0
- package/lib/horizon/server.js +549 -0
- package/lib/horizon/server_api.d.ts +278 -0
- package/lib/horizon/server_api.js +19 -0
- package/lib/horizon/strict_receive_path_call_builder.d.ts +33 -0
- package/lib/horizon/strict_receive_path_call_builder.js +50 -0
- package/lib/horizon/strict_send_path_call_builder.d.ts +33 -0
- package/lib/horizon/strict_send_path_call_builder.js +50 -0
- package/lib/horizon/trade_aggregation_call_builder.d.ts +47 -0
- package/lib/horizon/trade_aggregation_call_builder.js +76 -0
- package/lib/horizon/trades_call_builder.d.ts +49 -0
- package/lib/horizon/trades_call_builder.js +72 -0
- package/lib/horizon/transaction_call_builder.d.ts +57 -0
- package/lib/horizon/transaction_call_builder.js +64 -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 +37 -0
- package/lib/index.js +77 -0
- package/lib/rpc/api.d.ts +348 -0
- package/lib/rpc/api.js +32 -0
- package/lib/rpc/axios.d.ts +3 -0
- package/lib/rpc/axios.js +16 -0
- package/lib/rpc/browser.d.ts +6 -0
- package/lib/rpc/browser.js +37 -0
- package/lib/rpc/index.d.ts +7 -0
- package/lib/rpc/index.js +72 -0
- package/lib/rpc/jsonrpc.d.ts +27 -0
- package/lib/rpc/jsonrpc.js +52 -0
- package/lib/rpc/parsers.d.ts +19 -0
- package/lib/rpc/parsers.js +155 -0
- package/lib/rpc/server.d.ts +514 -0
- package/lib/rpc/server.js +737 -0
- package/lib/rpc/transaction.d.ts +19 -0
- package/lib/rpc/transaction.js +53 -0
- package/lib/rpc/utils.d.ts +1 -0
- package/lib/rpc/utils.js +9 -0
- package/lib/stellartoml/index.d.ts +121 -0
- package/lib/stellartoml/index.js +77 -0
- package/lib/utils.d.ts +12 -0
- package/lib/utils.js +31 -0
- package/lib/webauth/errors.d.ts +4 -0
- package/lib/webauth/errors.js +36 -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 +155 -0
- package/types/dom-monkeypatch.d.ts +126 -0
@@ -0,0 +1,69 @@
|
|
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(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
10
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
11
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
13
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
15
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
16
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
18
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
19
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
20
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
21
|
+
var OperationCallBuilder = exports.OperationCallBuilder = function (_CallBuilder) {
|
22
|
+
function OperationCallBuilder(serverUrl) {
|
23
|
+
var _this;
|
24
|
+
_classCallCheck(this, OperationCallBuilder);
|
25
|
+
_this = _callSuper(this, OperationCallBuilder, [serverUrl, "operations"]);
|
26
|
+
_this.url.segment("operations");
|
27
|
+
return _this;
|
28
|
+
}
|
29
|
+
_inherits(OperationCallBuilder, _CallBuilder);
|
30
|
+
return _createClass(OperationCallBuilder, [{
|
31
|
+
key: "operation",
|
32
|
+
value: function operation(operationId) {
|
33
|
+
var builder = new _call_builder.CallBuilder(this.url.clone());
|
34
|
+
builder.filter.push([operationId]);
|
35
|
+
return builder;
|
36
|
+
}
|
37
|
+
}, {
|
38
|
+
key: "forAccount",
|
39
|
+
value: function forAccount(accountId) {
|
40
|
+
return this.forEndpoint("accounts", accountId);
|
41
|
+
}
|
42
|
+
}, {
|
43
|
+
key: "forClaimableBalance",
|
44
|
+
value: function forClaimableBalance(claimableBalanceId) {
|
45
|
+
return this.forEndpoint("claimable_balances", claimableBalanceId);
|
46
|
+
}
|
47
|
+
}, {
|
48
|
+
key: "forLedger",
|
49
|
+
value: function forLedger(sequence) {
|
50
|
+
return this.forEndpoint("ledgers", sequence.toString());
|
51
|
+
}
|
52
|
+
}, {
|
53
|
+
key: "forTransaction",
|
54
|
+
value: function forTransaction(transactionId) {
|
55
|
+
return this.forEndpoint("transactions", transactionId);
|
56
|
+
}
|
57
|
+
}, {
|
58
|
+
key: "forLiquidityPool",
|
59
|
+
value: function forLiquidityPool(poolId) {
|
60
|
+
return this.forEndpoint("liquidity_pools", poolId);
|
61
|
+
}
|
62
|
+
}, {
|
63
|
+
key: "includeFailed",
|
64
|
+
value: function includeFailed(value) {
|
65
|
+
this.url.setQuery("include_failed", value.toString());
|
66
|
+
return this;
|
67
|
+
}
|
68
|
+
}]);
|
69
|
+
}(_call_builder.CallBuilder);
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { Asset } from "@stellar/stellar-base";
|
2
|
+
import { CallBuilder } from "./call_builder";
|
3
|
+
import { ServerApi } from "./server_api";
|
4
|
+
/**
|
5
|
+
* Creates a new {@link OrderbookCallBuilder} pointed to server defined by serverUrl.
|
6
|
+
*
|
7
|
+
* Do not create this object directly, use {@link Server#orderbook}.
|
8
|
+
* @see [Orderbook Details](https://developers.stellar.org/api/aggregations/order-books/)
|
9
|
+
* @param {string} serverUrl serverUrl Horizon server URL.
|
10
|
+
* @param {Asset} selling Asset being sold
|
11
|
+
* @param {Asset} buying Asset being bought
|
12
|
+
*/
|
13
|
+
export declare class OrderbookCallBuilder extends CallBuilder<ServerApi.OrderbookRecord> {
|
14
|
+
constructor(serverUrl: URI, selling: Asset, buying: Asset);
|
15
|
+
}
|
@@ -0,0 +1,45 @@
|
|
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.OrderbookCallBuilder = void 0;
|
8
|
+
var _call_builder = require("./call_builder");
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
13
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
15
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
16
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
18
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
19
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
20
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
21
|
+
var OrderbookCallBuilder = exports.OrderbookCallBuilder = function (_CallBuilder) {
|
22
|
+
function OrderbookCallBuilder(serverUrl, selling, buying) {
|
23
|
+
var _this;
|
24
|
+
_classCallCheck(this, OrderbookCallBuilder);
|
25
|
+
_this = _callSuper(this, OrderbookCallBuilder, [serverUrl]);
|
26
|
+
_this.url.segment("order_book");
|
27
|
+
if (!selling.isNative()) {
|
28
|
+
_this.url.setQuery("selling_asset_type", selling.getAssetType());
|
29
|
+
_this.url.setQuery("selling_asset_code", selling.getCode());
|
30
|
+
_this.url.setQuery("selling_asset_issuer", selling.getIssuer());
|
31
|
+
} else {
|
32
|
+
_this.url.setQuery("selling_asset_type", "native");
|
33
|
+
}
|
34
|
+
if (!buying.isNative()) {
|
35
|
+
_this.url.setQuery("buying_asset_type", buying.getAssetType());
|
36
|
+
_this.url.setQuery("buying_asset_code", buying.getCode());
|
37
|
+
_this.url.setQuery("buying_asset_issuer", buying.getIssuer());
|
38
|
+
} else {
|
39
|
+
_this.url.setQuery("buying_asset_type", "native");
|
40
|
+
}
|
41
|
+
return _this;
|
42
|
+
}
|
43
|
+
_inherits(OrderbookCallBuilder, _CallBuilder);
|
44
|
+
return _createClass(OrderbookCallBuilder);
|
45
|
+
}(_call_builder.CallBuilder);
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { Asset } from "@stellar/stellar-base";
|
2
|
+
import { CallBuilder } from "./call_builder";
|
3
|
+
import { ServerApi } from "./server_api";
|
4
|
+
/**
|
5
|
+
* The Stellar Network allows payments to be made across assets through path payments. A path payment specifies a
|
6
|
+
* series of assets to route a payment through, from source asset (the asset debited from the payer) to destination
|
7
|
+
* asset (the asset credited to the payee).
|
8
|
+
*
|
9
|
+
* A path search is specified using:
|
10
|
+
*
|
11
|
+
* * The destination address
|
12
|
+
* * The source address
|
13
|
+
* * The asset and amount that the destination account should receive
|
14
|
+
*
|
15
|
+
* As part of the search, horizon will load a list of assets available to the source address and will find any
|
16
|
+
* payment paths from those source assets to the desired destination asset. The search's amount parameter will be
|
17
|
+
* used to determine if there a given path can satisfy a payment of the desired amount.
|
18
|
+
*
|
19
|
+
* Do not create this object directly, use {@link Server#paths}.
|
20
|
+
* @see [Find Payment Paths](https://developers.stellar.org/api/aggregations/paths/)
|
21
|
+
* @augments CallBuilder
|
22
|
+
* @param {string} serverUrl Horizon server URL.
|
23
|
+
* @param {string} source The sender's account ID. Any returned path must use a source that the sender can hold.
|
24
|
+
* @param {string} destination The destination account ID that any returned path should use.
|
25
|
+
* @param {Asset} destinationAsset The destination asset.
|
26
|
+
* @param {string} destinationAmount The amount, denominated in the destination asset, that any returned path should be able to satisfy.
|
27
|
+
*/
|
28
|
+
export declare class PathCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.PaymentPathRecord>> {
|
29
|
+
constructor(serverUrl: URI, source: string, destination: string, destinationAsset: Asset, destinationAmount: string);
|
30
|
+
}
|
@@ -0,0 +1,41 @@
|
|
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.PathCallBuilder = void 0;
|
8
|
+
var _call_builder = require("./call_builder");
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
13
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
15
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
16
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
18
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
19
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
20
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
21
|
+
var PathCallBuilder = exports.PathCallBuilder = function (_CallBuilder) {
|
22
|
+
function PathCallBuilder(serverUrl, source, destination, destinationAsset, destinationAmount) {
|
23
|
+
var _this;
|
24
|
+
_classCallCheck(this, PathCallBuilder);
|
25
|
+
_this = _callSuper(this, PathCallBuilder, [serverUrl]);
|
26
|
+
_this.url.segment("paths");
|
27
|
+
_this.url.setQuery("destination_account", destination);
|
28
|
+
_this.url.setQuery("source_account", source);
|
29
|
+
_this.url.setQuery("destination_amount", destinationAmount);
|
30
|
+
if (!destinationAsset.isNative()) {
|
31
|
+
_this.url.setQuery("destination_asset_type", destinationAsset.getAssetType());
|
32
|
+
_this.url.setQuery("destination_asset_code", destinationAsset.getCode());
|
33
|
+
_this.url.setQuery("destination_asset_issuer", destinationAsset.getIssuer());
|
34
|
+
} else {
|
35
|
+
_this.url.setQuery("destination_asset_type", "native");
|
36
|
+
}
|
37
|
+
return _this;
|
38
|
+
}
|
39
|
+
_inherits(PathCallBuilder, _CallBuilder);
|
40
|
+
return _createClass(PathCallBuilder);
|
41
|
+
}(_call_builder.CallBuilder);
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { CallBuilder } from "./call_builder";
|
2
|
+
import { ServerApi } from "./server_api";
|
3
|
+
/**
|
4
|
+
* Creates a new {@link PaymentCallBuilder} pointed to server defined by serverUrl.
|
5
|
+
*
|
6
|
+
* Do not create this object directly, use {@link Server#payments}.
|
7
|
+
* @see [All Payments](https://developers.stellar.org/api/horizon/resources/list-all-payments/)
|
8
|
+
* @class
|
9
|
+
* @augments CallBuilder
|
10
|
+
* @param {string} serverUrl Horizon server URL.
|
11
|
+
*/
|
12
|
+
export declare class PaymentCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.PaymentOperationRecord | ServerApi.CreateAccountOperationRecord | ServerApi.AccountMergeOperationRecord | ServerApi.PathPaymentOperationRecord | ServerApi.PathPaymentStrictSendOperationRecord | ServerApi.InvokeHostFunctionOperationRecord>> {
|
13
|
+
constructor(serverUrl: URI);
|
14
|
+
/**
|
15
|
+
* This endpoint responds with a collection of Payment operations where the given account was either the sender or receiver.
|
16
|
+
* @see [Payments for Account](https://developers.stellar.org/api/horizon/resources/get-payments-by-account-id)
|
17
|
+
* @param {string} accountId For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
18
|
+
* @returns {PaymentCallBuilder} this PaymentCallBuilder instance
|
19
|
+
*/
|
20
|
+
forAccount(accountId: string): this;
|
21
|
+
/**
|
22
|
+
* This endpoint represents all payment operations that are part of a valid transactions in a given ledger.
|
23
|
+
* @see [Payments for Ledger](https://developers.stellar.org/api/horizon/resources/retrieve-a-ledgers-payments)
|
24
|
+
* @param {number|string} sequence Ledger sequence
|
25
|
+
* @returns {PaymentCallBuilder} this PaymentCallBuilder instance
|
26
|
+
*/
|
27
|
+
forLedger(sequence: number | string): this;
|
28
|
+
/**
|
29
|
+
* This endpoint represents all payment operations that are part of a given transaction.
|
30
|
+
* @see [Payments for Transaction](https://developers.stellar.org/api/resources/transactions/payments/)
|
31
|
+
* @param {string} transactionId Transaction ID
|
32
|
+
* @returns {PaymentCallBuilder} this PaymentCallBuilder instance
|
33
|
+
*/
|
34
|
+
forTransaction(transactionId: string): this;
|
35
|
+
}
|
@@ -0,0 +1,46 @@
|
|
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.PaymentCallBuilder = void 0;
|
8
|
+
var _call_builder = require("./call_builder");
|
9
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
10
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
11
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
13
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
15
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
16
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
18
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
19
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
20
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
21
|
+
var PaymentCallBuilder = exports.PaymentCallBuilder = function (_CallBuilder) {
|
22
|
+
function PaymentCallBuilder(serverUrl) {
|
23
|
+
var _this;
|
24
|
+
_classCallCheck(this, PaymentCallBuilder);
|
25
|
+
_this = _callSuper(this, PaymentCallBuilder, [serverUrl, "payments"]);
|
26
|
+
_this.url.segment("payments");
|
27
|
+
return _this;
|
28
|
+
}
|
29
|
+
_inherits(PaymentCallBuilder, _CallBuilder);
|
30
|
+
return _createClass(PaymentCallBuilder, [{
|
31
|
+
key: "forAccount",
|
32
|
+
value: function forAccount(accountId) {
|
33
|
+
return this.forEndpoint("accounts", accountId);
|
34
|
+
}
|
35
|
+
}, {
|
36
|
+
key: "forLedger",
|
37
|
+
value: function forLedger(sequence) {
|
38
|
+
return this.forEndpoint("ledgers", sequence.toString());
|
39
|
+
}
|
40
|
+
}, {
|
41
|
+
key: "forTransaction",
|
42
|
+
value: function forTransaction(transactionId) {
|
43
|
+
return this.forEndpoint("transactions", transactionId);
|
44
|
+
}
|
45
|
+
}]);
|
46
|
+
}(_call_builder.CallBuilder);
|