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,96 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.HorizonApi = void 0;
|
7
|
+
var HorizonApi;
|
8
|
+
(function (_HorizonApi) {
|
9
|
+
var LiquidityPoolType = function (LiquidityPoolType) {
|
10
|
+
LiquidityPoolType["constantProduct"] = "constant_product";
|
11
|
+
return LiquidityPoolType;
|
12
|
+
}({});
|
13
|
+
_HorizonApi.LiquidityPoolType = LiquidityPoolType;
|
14
|
+
var OperationResponseType = function (OperationResponseType) {
|
15
|
+
OperationResponseType["createAccount"] = "create_account";
|
16
|
+
OperationResponseType["payment"] = "payment";
|
17
|
+
OperationResponseType["pathPayment"] = "path_payment_strict_receive";
|
18
|
+
OperationResponseType["createPassiveOffer"] = "create_passive_sell_offer";
|
19
|
+
OperationResponseType["manageOffer"] = "manage_sell_offer";
|
20
|
+
OperationResponseType["setOptions"] = "set_options";
|
21
|
+
OperationResponseType["changeTrust"] = "change_trust";
|
22
|
+
OperationResponseType["allowTrust"] = "allow_trust";
|
23
|
+
OperationResponseType["accountMerge"] = "account_merge";
|
24
|
+
OperationResponseType["inflation"] = "inflation";
|
25
|
+
OperationResponseType["manageData"] = "manage_data";
|
26
|
+
OperationResponseType["bumpSequence"] = "bump_sequence";
|
27
|
+
OperationResponseType["manageBuyOffer"] = "manage_buy_offer";
|
28
|
+
OperationResponseType["pathPaymentStrictSend"] = "path_payment_strict_send";
|
29
|
+
OperationResponseType["createClaimableBalance"] = "create_claimable_balance";
|
30
|
+
OperationResponseType["claimClaimableBalance"] = "claim_claimable_balance";
|
31
|
+
OperationResponseType["beginSponsoringFutureReserves"] = "begin_sponsoring_future_reserves";
|
32
|
+
OperationResponseType["endSponsoringFutureReserves"] = "end_sponsoring_future_reserves";
|
33
|
+
OperationResponseType["revokeSponsorship"] = "revoke_sponsorship";
|
34
|
+
OperationResponseType["clawback"] = "clawback";
|
35
|
+
OperationResponseType["clawbackClaimableBalance"] = "clawback_claimable_balance";
|
36
|
+
OperationResponseType["setTrustLineFlags"] = "set_trust_line_flags";
|
37
|
+
OperationResponseType["liquidityPoolDeposit"] = "liquidity_pool_deposit";
|
38
|
+
OperationResponseType["liquidityPoolWithdraw"] = "liquidity_pool_withdraw";
|
39
|
+
OperationResponseType["invokeHostFunction"] = "invoke_host_function";
|
40
|
+
OperationResponseType["bumpFootprintExpiration"] = "bump_footprint_expiration";
|
41
|
+
OperationResponseType["restoreFootprint"] = "restore_footprint";
|
42
|
+
return OperationResponseType;
|
43
|
+
}({});
|
44
|
+
_HorizonApi.OperationResponseType = OperationResponseType;
|
45
|
+
var OperationResponseTypeI = function (OperationResponseTypeI) {
|
46
|
+
OperationResponseTypeI[OperationResponseTypeI["createAccount"] = 0] = "createAccount";
|
47
|
+
OperationResponseTypeI[OperationResponseTypeI["payment"] = 1] = "payment";
|
48
|
+
OperationResponseTypeI[OperationResponseTypeI["pathPayment"] = 2] = "pathPayment";
|
49
|
+
OperationResponseTypeI[OperationResponseTypeI["createPassiveOffer"] = 3] = "createPassiveOffer";
|
50
|
+
OperationResponseTypeI[OperationResponseTypeI["manageOffer"] = 4] = "manageOffer";
|
51
|
+
OperationResponseTypeI[OperationResponseTypeI["setOptions"] = 5] = "setOptions";
|
52
|
+
OperationResponseTypeI[OperationResponseTypeI["changeTrust"] = 6] = "changeTrust";
|
53
|
+
OperationResponseTypeI[OperationResponseTypeI["allowTrust"] = 7] = "allowTrust";
|
54
|
+
OperationResponseTypeI[OperationResponseTypeI["accountMerge"] = 8] = "accountMerge";
|
55
|
+
OperationResponseTypeI[OperationResponseTypeI["inflation"] = 9] = "inflation";
|
56
|
+
OperationResponseTypeI[OperationResponseTypeI["manageData"] = 10] = "manageData";
|
57
|
+
OperationResponseTypeI[OperationResponseTypeI["bumpSequence"] = 11] = "bumpSequence";
|
58
|
+
OperationResponseTypeI[OperationResponseTypeI["manageBuyOffer"] = 12] = "manageBuyOffer";
|
59
|
+
OperationResponseTypeI[OperationResponseTypeI["pathPaymentStrictSend"] = 13] = "pathPaymentStrictSend";
|
60
|
+
OperationResponseTypeI[OperationResponseTypeI["createClaimableBalance"] = 14] = "createClaimableBalance";
|
61
|
+
OperationResponseTypeI[OperationResponseTypeI["claimClaimableBalance"] = 15] = "claimClaimableBalance";
|
62
|
+
OperationResponseTypeI[OperationResponseTypeI["beginSponsoringFutureReserves"] = 16] = "beginSponsoringFutureReserves";
|
63
|
+
OperationResponseTypeI[OperationResponseTypeI["endSponsoringFutureReserves"] = 17] = "endSponsoringFutureReserves";
|
64
|
+
OperationResponseTypeI[OperationResponseTypeI["revokeSponsorship"] = 18] = "revokeSponsorship";
|
65
|
+
OperationResponseTypeI[OperationResponseTypeI["clawback"] = 19] = "clawback";
|
66
|
+
OperationResponseTypeI[OperationResponseTypeI["clawbackClaimableBalance"] = 20] = "clawbackClaimableBalance";
|
67
|
+
OperationResponseTypeI[OperationResponseTypeI["setTrustLineFlags"] = 21] = "setTrustLineFlags";
|
68
|
+
OperationResponseTypeI[OperationResponseTypeI["liquidityPoolDeposit"] = 22] = "liquidityPoolDeposit";
|
69
|
+
OperationResponseTypeI[OperationResponseTypeI["liquidityPoolWithdraw"] = 23] = "liquidityPoolWithdraw";
|
70
|
+
OperationResponseTypeI[OperationResponseTypeI["invokeHostFunction"] = 24] = "invokeHostFunction";
|
71
|
+
OperationResponseTypeI[OperationResponseTypeI["bumpFootprintExpiration"] = 25] = "bumpFootprintExpiration";
|
72
|
+
OperationResponseTypeI[OperationResponseTypeI["restoreFootprint"] = 26] = "restoreFootprint";
|
73
|
+
return OperationResponseTypeI;
|
74
|
+
}({});
|
75
|
+
_HorizonApi.OperationResponseTypeI = OperationResponseTypeI;
|
76
|
+
;
|
77
|
+
var TransactionFailedResultCodes = function (TransactionFailedResultCodes) {
|
78
|
+
TransactionFailedResultCodes["TX_FAILED"] = "tx_failed";
|
79
|
+
TransactionFailedResultCodes["TX_BAD_SEQ"] = "tx_bad_seq";
|
80
|
+
TransactionFailedResultCodes["TX_BAD_AUTH"] = "tx_bad_auth";
|
81
|
+
TransactionFailedResultCodes["TX_BAD_AUTH_EXTRA"] = "tx_bad_auth_extra";
|
82
|
+
TransactionFailedResultCodes["TX_FEE_BUMP_INNER_SUCCESS"] = "tx_fee_bump_inner_success";
|
83
|
+
TransactionFailedResultCodes["TX_FEE_BUMP_INNER_FAILED"] = "tx_fee_bump_inner_failed";
|
84
|
+
TransactionFailedResultCodes["TX_NOT_SUPPORTED"] = "tx_not_supported";
|
85
|
+
TransactionFailedResultCodes["TX_SUCCESS"] = "tx_success";
|
86
|
+
TransactionFailedResultCodes["TX_TOO_EARLY"] = "tx_too_early";
|
87
|
+
TransactionFailedResultCodes["TX_TOO_LATE"] = "tx_too_late";
|
88
|
+
TransactionFailedResultCodes["TX_MISSING_OPERATION"] = "tx_missing_operation";
|
89
|
+
TransactionFailedResultCodes["TX_INSUFFICIENT_BALANCE"] = "tx_insufficient_balance";
|
90
|
+
TransactionFailedResultCodes["TX_NO_SOURCE_ACCOUNT"] = "tx_no_source_account";
|
91
|
+
TransactionFailedResultCodes["TX_INSUFFICIENT_FEE"] = "tx_insufficient_fee";
|
92
|
+
TransactionFailedResultCodes["TX_INTERNAL_ERROR"] = "tx_internal_error";
|
93
|
+
return TransactionFailedResultCodes;
|
94
|
+
}({});
|
95
|
+
_HorizonApi.TransactionFailedResultCodes = TransactionFailedResultCodes;
|
96
|
+
})(HorizonApi || (exports.HorizonApi = HorizonApi = {}));
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export declare const version: any;
|
2
|
+
export interface ServerTime {
|
3
|
+
serverTime: number;
|
4
|
+
localTimeRecorded: number;
|
5
|
+
}
|
6
|
+
/**
|
7
|
+
* keep a local map of server times
|
8
|
+
* (export this purely for testing purposes)
|
9
|
+
*
|
10
|
+
* each entry will map the server domain to the last-known time and the local
|
11
|
+
* time it was recorded, ex:
|
12
|
+
*
|
13
|
+
* "horizon-testnet.stellar.org": {
|
14
|
+
* serverTime: 1552513039,
|
15
|
+
* localTimeRecorded: 1552513052
|
16
|
+
* }
|
17
|
+
*/
|
18
|
+
export declare const SERVER_TIME_MAP: Record<string, ServerTime>;
|
19
|
+
export declare const AxiosClient: import("axios").AxiosInstance;
|
20
|
+
export default AxiosClient;
|
21
|
+
/**
|
22
|
+
* Given a hostname, get the current time of that server (i.e., use the last-
|
23
|
+
* recorded server time and offset it by the time since then.) If there IS no
|
24
|
+
* recorded server time, or it's been 5 minutes since the last, return null.
|
25
|
+
* @param {string} hostname Hostname of a Horizon server.
|
26
|
+
* @returns {number} The UNIX timestamp (in seconds, not milliseconds)
|
27
|
+
* representing the current time on that server, or `null` if we don't have
|
28
|
+
* a record of that time.
|
29
|
+
*/
|
30
|
+
export declare function getCurrentServerTime(hostname: string): number | null;
|
@@ -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(e) { return e && e.__esModule ? e : { default: e }; }
|
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 (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 (!Number.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 && {}.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,21 @@
|
|
1
|
+
import { CallBuilder } from "./call_builder";
|
2
|
+
import { ServerApi } from "./server_api";
|
3
|
+
/**
|
4
|
+
* Creates a new {@link LedgerCallBuilder} pointed to server defined by serverUrl.
|
5
|
+
* Do not create this object directly, use {@link Server#ledgers}.
|
6
|
+
*
|
7
|
+
* @see [All Ledgers](https://developers.stellar.org/api/resources/ledgers/list/)
|
8
|
+
* @class
|
9
|
+
* @class LedgerCallBuilder
|
10
|
+
* @augments CallBuilder
|
11
|
+
* @param {string} serverUrl Horizon server URL.
|
12
|
+
*/
|
13
|
+
export declare class LedgerCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.LedgerRecord>> {
|
14
|
+
constructor(serverUrl: URI);
|
15
|
+
/**
|
16
|
+
* Provides information on a single ledger.
|
17
|
+
* @param {number|string} sequence Ledger sequence
|
18
|
+
* @returns {LedgerCallBuilder} current LedgerCallBuilder instance
|
19
|
+
*/
|
20
|
+
ledger(sequence: number | string): this;
|
21
|
+
}
|
@@ -0,0 +1,37 @@
|
|
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(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 LedgerCallBuilder = exports.LedgerCallBuilder = function (_CallBuilder) {
|
22
|
+
function LedgerCallBuilder(serverUrl) {
|
23
|
+
var _this;
|
24
|
+
_classCallCheck(this, LedgerCallBuilder);
|
25
|
+
_this = _callSuper(this, LedgerCallBuilder, [serverUrl]);
|
26
|
+
_this.url.segment("ledgers");
|
27
|
+
return _this;
|
28
|
+
}
|
29
|
+
_inherits(LedgerCallBuilder, _CallBuilder);
|
30
|
+
return _createClass(LedgerCallBuilder, [{
|
31
|
+
key: "ledger",
|
32
|
+
value: function ledger(sequence) {
|
33
|
+
this.filter.push(["ledgers", sequence.toString()]);
|
34
|
+
return this;
|
35
|
+
}
|
36
|
+
}]);
|
37
|
+
}(_call_builder.CallBuilder);
|
@@ -0,0 +1,36 @@
|
|
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 LiquidityPoolCallBuilder} pointed to server defined by serverUrl.
|
6
|
+
* Do not create this object directly, use {@link Server#liquidityPools}.
|
7
|
+
*
|
8
|
+
* @class LiquidityPoolCallBuilder
|
9
|
+
* @augments CallBuilder
|
10
|
+
* @class
|
11
|
+
* @param {string} serverUrl Horizon server URL.
|
12
|
+
*/
|
13
|
+
export declare class LiquidityPoolCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.LiquidityPoolRecord>> {
|
14
|
+
constructor(serverUrl: URI);
|
15
|
+
/**
|
16
|
+
* Filters out pools whose reserves don't exactly match these assets.
|
17
|
+
*
|
18
|
+
* @see Asset
|
19
|
+
* @returns {LiquidityPoolCallBuilder} current LiquidityPoolCallBuilder instance
|
20
|
+
*/
|
21
|
+
forAssets(...assets: Asset[]): this;
|
22
|
+
/**
|
23
|
+
* Retrieves all pools an account is participating in.
|
24
|
+
*
|
25
|
+
* @param {string} id the participant account to filter by
|
26
|
+
* @returns {LiquidityPoolCallBuilder} current LiquidityPoolCallBuilder instance
|
27
|
+
*/
|
28
|
+
forAccount(id: string): this;
|
29
|
+
/**
|
30
|
+
* Retrieves a specific liquidity pool by ID.
|
31
|
+
*
|
32
|
+
* @param {string} id the hash/ID of the liquidity pool
|
33
|
+
* @returns {CallBuilder} a new CallBuilder instance for the /liquidity_pools/:id endpoint
|
34
|
+
*/
|
35
|
+
liquidityPoolId(id: string): CallBuilder<ServerApi.LiquidityPoolRecord>;
|
36
|
+
}
|
@@ -0,0 +1,59 @@
|
|
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(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 LiquidityPoolCallBuilder = exports.LiquidityPoolCallBuilder = function (_CallBuilder) {
|
22
|
+
function LiquidityPoolCallBuilder(serverUrl) {
|
23
|
+
var _this;
|
24
|
+
_classCallCheck(this, LiquidityPoolCallBuilder);
|
25
|
+
_this = _callSuper(this, LiquidityPoolCallBuilder, [serverUrl]);
|
26
|
+
_this.url.segment("liquidity_pools");
|
27
|
+
return _this;
|
28
|
+
}
|
29
|
+
_inherits(LiquidityPoolCallBuilder, _CallBuilder);
|
30
|
+
return _createClass(LiquidityPoolCallBuilder, [{
|
31
|
+
key: "forAssets",
|
32
|
+
value: function forAssets() {
|
33
|
+
for (var _len = arguments.length, assets = new Array(_len), _key = 0; _key < _len; _key++) {
|
34
|
+
assets[_key] = arguments[_key];
|
35
|
+
}
|
36
|
+
var assetList = assets.map(function (asset) {
|
37
|
+
return asset.toString();
|
38
|
+
}).join(",");
|
39
|
+
this.url.setQuery("reserves", assetList);
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
}, {
|
43
|
+
key: "forAccount",
|
44
|
+
value: function forAccount(id) {
|
45
|
+
this.url.setQuery("account", id);
|
46
|
+
return this;
|
47
|
+
}
|
48
|
+
}, {
|
49
|
+
key: "liquidityPoolId",
|
50
|
+
value: function liquidityPoolId(id) {
|
51
|
+
if (!id.match(/[a-fA-F0-9]{64}/)) {
|
52
|
+
throw new TypeError("".concat(id, " does not look like a liquidity pool ID"));
|
53
|
+
}
|
54
|
+
var builder = new _call_builder.CallBuilder(this.url.clone());
|
55
|
+
builder.filter.push([id.toLowerCase()]);
|
56
|
+
return builder;
|
57
|
+
}
|
58
|
+
}]);
|
59
|
+
}(_call_builder.CallBuilder);
|
@@ -0,0 +1,63 @@
|
|
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 OfferCallBuilder} pointed to server defined by serverUrl.
|
6
|
+
* Do not create this object directly, use {@link Server#offers}.
|
7
|
+
*
|
8
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/)
|
9
|
+
* @class OfferCallBuilder
|
10
|
+
* @class
|
11
|
+
* @augments CallBuilder
|
12
|
+
* @param {string} serverUrl Horizon server URL.
|
13
|
+
*/
|
14
|
+
export declare class OfferCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.OfferRecord>> {
|
15
|
+
constructor(serverUrl: URI);
|
16
|
+
/**
|
17
|
+
* The offer details endpoint provides information on a single offer. The offer ID provided in the id
|
18
|
+
* argument specifies which offer to load.
|
19
|
+
* @see [Offer Details](https://developers.stellar.org/api/resources/offers/single/)
|
20
|
+
* @param {string} offerId Offer ID
|
21
|
+
* @returns {CallBuilder<ServerApi.OfferRecord>} CallBuilder<ServerApi.OfferRecord> OperationCallBuilder instance
|
22
|
+
*/
|
23
|
+
offer(offerId: string): CallBuilder<ServerApi.OfferRecord>;
|
24
|
+
/**
|
25
|
+
* Returns all offers where the given account is involved.
|
26
|
+
*
|
27
|
+
* @see [Offers](https://developers.stellar.org/api/resources/accounts/offers/)
|
28
|
+
* @param {string} id For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
29
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
30
|
+
*/
|
31
|
+
forAccount(id: string): this;
|
32
|
+
/**
|
33
|
+
* Returns all offers buying an asset.
|
34
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/list/)
|
35
|
+
* @see Asset
|
36
|
+
* @param {Asset} asset For example: `new Asset('USD','GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD')`
|
37
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
38
|
+
*/
|
39
|
+
buying(asset: Asset): this;
|
40
|
+
/**
|
41
|
+
* Returns all offers selling an asset.
|
42
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/list/)
|
43
|
+
* @see Asset
|
44
|
+
* @param {Asset} asset For example: `new Asset('EUR','GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD')`
|
45
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
46
|
+
*/
|
47
|
+
selling(asset: Asset): this;
|
48
|
+
/**
|
49
|
+
* This endpoint filters offers where the given account is sponsoring the offer entry.
|
50
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/list/)
|
51
|
+
* @param {string} id For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
52
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
53
|
+
*/
|
54
|
+
sponsor(id: string): this;
|
55
|
+
/**
|
56
|
+
* This endpoint filters offers where the given account is the seller.
|
57
|
+
*
|
58
|
+
* @see [Offers](https://developers.stellar.org/api/resources/offers/list/)
|
59
|
+
* @param {string} seller For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
60
|
+
* @returns {OfferCallBuilder} current OfferCallBuilder instance
|
61
|
+
*/
|
62
|
+
seller(seller: string): this;
|
63
|
+
}
|
@@ -0,0 +1,79 @@
|
|
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(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 OfferCallBuilder = exports.OfferCallBuilder = function (_CallBuilder) {
|
22
|
+
function OfferCallBuilder(serverUrl) {
|
23
|
+
var _this;
|
24
|
+
_classCallCheck(this, OfferCallBuilder);
|
25
|
+
_this = _callSuper(this, OfferCallBuilder, [serverUrl, "offers"]);
|
26
|
+
_this.url.segment("offers");
|
27
|
+
return _this;
|
28
|
+
}
|
29
|
+
_inherits(OfferCallBuilder, _CallBuilder);
|
30
|
+
return _createClass(OfferCallBuilder, [{
|
31
|
+
key: "offer",
|
32
|
+
value: function offer(offerId) {
|
33
|
+
var builder = new _call_builder.CallBuilder(this.url.clone());
|
34
|
+
builder.filter.push([offerId]);
|
35
|
+
return builder;
|
36
|
+
}
|
37
|
+
}, {
|
38
|
+
key: "forAccount",
|
39
|
+
value: function forAccount(id) {
|
40
|
+
return this.forEndpoint("accounts", id);
|
41
|
+
}
|
42
|
+
}, {
|
43
|
+
key: "buying",
|
44
|
+
value: function buying(asset) {
|
45
|
+
if (!asset.isNative()) {
|
46
|
+
this.url.setQuery("buying_asset_type", asset.getAssetType());
|
47
|
+
this.url.setQuery("buying_asset_code", asset.getCode());
|
48
|
+
this.url.setQuery("buying_asset_issuer", asset.getIssuer());
|
49
|
+
} else {
|
50
|
+
this.url.setQuery("buying_asset_type", "native");
|
51
|
+
}
|
52
|
+
return this;
|
53
|
+
}
|
54
|
+
}, {
|
55
|
+
key: "selling",
|
56
|
+
value: function selling(asset) {
|
57
|
+
if (!asset.isNative()) {
|
58
|
+
this.url.setQuery("selling_asset_type", asset.getAssetType());
|
59
|
+
this.url.setQuery("selling_asset_code", asset.getCode());
|
60
|
+
this.url.setQuery("selling_asset_issuer", asset.getIssuer());
|
61
|
+
} else {
|
62
|
+
this.url.setQuery("selling_asset_type", "native");
|
63
|
+
}
|
64
|
+
return this;
|
65
|
+
}
|
66
|
+
}, {
|
67
|
+
key: "sponsor",
|
68
|
+
value: function sponsor(id) {
|
69
|
+
this.url.setQuery("sponsor", id);
|
70
|
+
return this;
|
71
|
+
}
|
72
|
+
}, {
|
73
|
+
key: "seller",
|
74
|
+
value: function seller(_seller) {
|
75
|
+
this.url.setQuery("seller", _seller);
|
76
|
+
return this;
|
77
|
+
}
|
78
|
+
}]);
|
79
|
+
}(_call_builder.CallBuilder);
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import { CallBuilder } from "./call_builder";
|
2
|
+
import { ServerApi } from "./server_api";
|
3
|
+
/**
|
4
|
+
* Creates a new {@link OperationCallBuilder} pointed to server defined by serverUrl.
|
5
|
+
* Do not create this object directly, use {@link Server#operations}.
|
6
|
+
*
|
7
|
+
* @see [All Operations](https://developers.stellar.org/api/resources/operations/)
|
8
|
+
* @class OperationCallBuilder
|
9
|
+
* @class
|
10
|
+
* @augments CallBuilder
|
11
|
+
* @param {string} serverUrl Horizon server URL.
|
12
|
+
*/
|
13
|
+
export declare class OperationCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.OperationRecord>> {
|
14
|
+
constructor(serverUrl: URI);
|
15
|
+
/**
|
16
|
+
* The operation details endpoint provides information on a single operation. The operation ID provided in the id
|
17
|
+
* argument specifies which operation to load.
|
18
|
+
* @see [Operation Details](https://developers.stellar.org/api/resources/operations/single/)
|
19
|
+
* @param {number} operationId Operation ID
|
20
|
+
* @returns {CallBuilder} this OperationCallBuilder instance
|
21
|
+
*/
|
22
|
+
operation(operationId: string): CallBuilder<ServerApi.OperationRecord>;
|
23
|
+
/**
|
24
|
+
* This endpoint represents all operations that were included in valid transactions that affected a particular account.
|
25
|
+
* @see [Operations for Account](https://developers.stellar.org/api/resources/accounts/operations/)
|
26
|
+
* @param {string} accountId For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
|
27
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
28
|
+
*/
|
29
|
+
forAccount(accountId: string): this;
|
30
|
+
/**
|
31
|
+
* This endpoint represents all operations that reference a given claimable_balance.
|
32
|
+
* @see [Operations for Claimable Balance](https://developers.stellar.org/api/resources/claimablebalances/operations/)
|
33
|
+
* @param {string} claimableBalanceId Claimable Balance ID
|
34
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
35
|
+
*/
|
36
|
+
forClaimableBalance(claimableBalanceId: string): this;
|
37
|
+
/**
|
38
|
+
* This endpoint returns all operations that occurred in a given ledger.
|
39
|
+
*
|
40
|
+
* @see [Operations for Ledger](https://developers.stellar.org/api/resources/ledgers/operations/)
|
41
|
+
* @param {number|string} sequence Ledger sequence
|
42
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
43
|
+
*/
|
44
|
+
forLedger(sequence: number | string): this;
|
45
|
+
/**
|
46
|
+
* This endpoint represents all operations that are part of a given transaction.
|
47
|
+
* @see [Operations for Transaction](https://developers.stellar.org/api/resources/transactions/operations/)
|
48
|
+
* @param {string} transactionId Transaction ID
|
49
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
50
|
+
*/
|
51
|
+
forTransaction(transactionId: string): this;
|
52
|
+
/**
|
53
|
+
* This endpoint represents all operations involving a particular liquidity pool.
|
54
|
+
*
|
55
|
+
* @param {string} poolId liquidity pool ID
|
56
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
57
|
+
*/
|
58
|
+
forLiquidityPool(poolId: string): this;
|
59
|
+
/**
|
60
|
+
* Adds a parameter defining whether to include failed transactions.
|
61
|
+
* By default, only operations of successful transactions are returned.
|
62
|
+
*
|
63
|
+
* @param {boolean} value Set to `true` to include operations of failed transactions.
|
64
|
+
* @returns {OperationCallBuilder} this OperationCallBuilder instance
|
65
|
+
*/
|
66
|
+
includeFailed(value: boolean): this;
|
67
|
+
}
|