@stellar/stellar-sdk 14.2.0 → 14.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/stellar-sdk-minimal.js +273 -210
- package/dist/stellar-sdk-minimal.min.js +1 -1
- package/dist/stellar-sdk-no-axios.js +273 -210
- package/dist/stellar-sdk-no-axios.min.js +1 -1
- package/dist/stellar-sdk-no-eventsource.js +273 -210
- package/dist/stellar-sdk-no-eventsource.min.js +1 -1
- package/dist/stellar-sdk.js +273 -210
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/contract/assembled_transaction.js +9 -4
- package/lib/contract/client.d.ts +1 -1
- package/lib/contract/client.js +25 -14
- package/lib/contract/sent_transaction.js +9 -4
- package/lib/contract/spec.js +10 -2
- package/lib/contract/types.d.ts +9 -1
- package/lib/errors/account_requires_memo.d.ts +0 -1
- package/lib/errors/account_requires_memo.js +0 -4
- package/lib/errors/bad_request.d.ts +0 -1
- package/lib/errors/bad_request.js +2 -8
- package/lib/errors/bad_response.d.ts +0 -1
- package/lib/errors/bad_response.js +2 -8
- package/lib/errors/network.d.ts +0 -1
- package/lib/errors/network.js +0 -3
- package/lib/errors/not_found.d.ts +0 -1
- package/lib/errors/not_found.js +2 -8
- package/lib/horizon/account_call_builder.d.ts +2 -1
- package/lib/horizon/account_call_builder.js +3 -3
- package/lib/horizon/assets_call_builder.d.ts +2 -1
- package/lib/horizon/assets_call_builder.js +2 -2
- package/lib/horizon/call_builder.d.ts +3 -1
- package/lib/horizon/call_builder.js +4 -3
- package/lib/horizon/claimable_balances_call_builder.d.ts +2 -1
- package/lib/horizon/claimable_balances_call_builder.js +3 -3
- package/lib/horizon/effect_call_builder.d.ts +2 -1
- package/lib/horizon/effect_call_builder.js +2 -2
- package/lib/horizon/friendbot_builder.d.ts +2 -1
- package/lib/horizon/friendbot_builder.js +2 -2
- package/lib/horizon/horizon_axios_client.d.ts +2 -2
- package/lib/horizon/horizon_axios_client.js +38 -30
- package/lib/horizon/index.d.ts +1 -1
- package/lib/horizon/index.js +1 -10
- package/lib/horizon/ledger_call_builder.d.ts +2 -1
- package/lib/horizon/ledger_call_builder.js +2 -2
- package/lib/horizon/liquidity_pool_call_builder.d.ts +2 -1
- package/lib/horizon/liquidity_pool_call_builder.js +3 -3
- package/lib/horizon/offer_call_builder.d.ts +2 -1
- package/lib/horizon/offer_call_builder.js +3 -3
- package/lib/horizon/operation_call_builder.d.ts +2 -1
- package/lib/horizon/operation_call_builder.js +3 -3
- package/lib/horizon/orderbook_call_builder.d.ts +2 -1
- package/lib/horizon/orderbook_call_builder.js +2 -2
- package/lib/horizon/path_call_builder.d.ts +2 -1
- package/lib/horizon/path_call_builder.js +2 -2
- package/lib/horizon/payment_call_builder.d.ts +2 -1
- package/lib/horizon/payment_call_builder.js +2 -2
- package/lib/horizon/server.d.ts +25 -10
- package/lib/horizon/server.js +23 -30
- package/lib/horizon/strict_receive_path_call_builder.d.ts +2 -1
- package/lib/horizon/strict_receive_path_call_builder.js +2 -2
- package/lib/horizon/strict_send_path_call_builder.d.ts +2 -1
- package/lib/horizon/strict_send_path_call_builder.js +2 -2
- package/lib/horizon/trade_aggregation_call_builder.d.ts +2 -1
- package/lib/horizon/trade_aggregation_call_builder.js +2 -2
- package/lib/horizon/trades_call_builder.d.ts +2 -1
- package/lib/horizon/trades_call_builder.js +2 -2
- package/lib/horizon/transaction_call_builder.d.ts +2 -1
- package/lib/horizon/transaction_call_builder.js +3 -3
- package/lib/minimal/contract/assembled_transaction.js +9 -4
- package/lib/minimal/contract/client.d.ts +1 -1
- package/lib/minimal/contract/client.js +25 -14
- package/lib/minimal/contract/sent_transaction.js +9 -4
- package/lib/minimal/contract/spec.js +10 -2
- package/lib/minimal/contract/types.d.ts +9 -1
- package/lib/minimal/errors/account_requires_memo.d.ts +0 -1
- package/lib/minimal/errors/account_requires_memo.js +0 -4
- package/lib/minimal/errors/bad_request.d.ts +0 -1
- package/lib/minimal/errors/bad_request.js +2 -8
- package/lib/minimal/errors/bad_response.d.ts +0 -1
- package/lib/minimal/errors/bad_response.js +2 -8
- package/lib/minimal/errors/network.d.ts +0 -1
- package/lib/minimal/errors/network.js +0 -3
- package/lib/minimal/errors/not_found.d.ts +0 -1
- package/lib/minimal/errors/not_found.js +2 -8
- package/lib/minimal/horizon/account_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/account_call_builder.js +3 -3
- package/lib/minimal/horizon/assets_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/assets_call_builder.js +2 -2
- package/lib/minimal/horizon/call_builder.d.ts +3 -1
- package/lib/minimal/horizon/call_builder.js +4 -3
- package/lib/minimal/horizon/claimable_balances_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/claimable_balances_call_builder.js +3 -3
- package/lib/minimal/horizon/effect_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/effect_call_builder.js +2 -2
- package/lib/minimal/horizon/friendbot_builder.d.ts +2 -1
- package/lib/minimal/horizon/friendbot_builder.js +2 -2
- package/lib/minimal/horizon/horizon_axios_client.d.ts +2 -2
- package/lib/minimal/horizon/horizon_axios_client.js +38 -30
- package/lib/minimal/horizon/index.d.ts +1 -1
- package/lib/minimal/horizon/index.js +1 -10
- package/lib/minimal/horizon/ledger_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/ledger_call_builder.js +2 -2
- package/lib/minimal/horizon/liquidity_pool_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/liquidity_pool_call_builder.js +3 -3
- package/lib/minimal/horizon/offer_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/offer_call_builder.js +3 -3
- package/lib/minimal/horizon/operation_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/operation_call_builder.js +3 -3
- package/lib/minimal/horizon/orderbook_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/orderbook_call_builder.js +2 -2
- package/lib/minimal/horizon/path_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/path_call_builder.js +2 -2
- package/lib/minimal/horizon/payment_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/payment_call_builder.js +2 -2
- package/lib/minimal/horizon/server.d.ts +25 -10
- package/lib/minimal/horizon/server.js +23 -30
- package/lib/minimal/horizon/strict_receive_path_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/strict_receive_path_call_builder.js +2 -2
- package/lib/minimal/horizon/strict_send_path_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/strict_send_path_call_builder.js +2 -2
- package/lib/minimal/horizon/trade_aggregation_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/trade_aggregation_call_builder.js +2 -2
- package/lib/minimal/horizon/trades_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/trades_call_builder.js +2 -2
- package/lib/minimal/horizon/transaction_call_builder.d.ts +2 -1
- package/lib/minimal/horizon/transaction_call_builder.js +3 -3
- package/lib/minimal/rpc/api.d.ts +132 -0
- package/lib/minimal/rpc/axios.d.ts +1 -2
- package/lib/minimal/rpc/axios.js +17 -9
- package/lib/minimal/rpc/index.d.ts +0 -1
- package/lib/minimal/rpc/index.js +0 -9
- package/lib/minimal/rpc/jsonrpc.d.ts +2 -1
- package/lib/minimal/rpc/jsonrpc.js +4 -6
- package/lib/minimal/rpc/parsers.d.ts +1 -0
- package/lib/minimal/rpc/parsers.js +23 -0
- package/lib/minimal/rpc/server.d.ts +82 -20
- package/lib/minimal/rpc/server.js +56 -19
- package/lib/minimal/webauth/errors.d.ts +0 -2
- package/lib/minimal/webauth/errors.js +2 -8
- package/lib/no-axios/contract/assembled_transaction.js +9 -4
- package/lib/no-axios/contract/client.d.ts +1 -1
- package/lib/no-axios/contract/client.js +25 -14
- package/lib/no-axios/contract/sent_transaction.js +9 -4
- package/lib/no-axios/contract/spec.js +10 -2
- package/lib/no-axios/contract/types.d.ts +9 -1
- package/lib/no-axios/errors/account_requires_memo.d.ts +0 -1
- package/lib/no-axios/errors/account_requires_memo.js +0 -4
- package/lib/no-axios/errors/bad_request.d.ts +0 -1
- package/lib/no-axios/errors/bad_request.js +2 -8
- package/lib/no-axios/errors/bad_response.d.ts +0 -1
- package/lib/no-axios/errors/bad_response.js +2 -8
- package/lib/no-axios/errors/network.d.ts +0 -1
- package/lib/no-axios/errors/network.js +0 -3
- package/lib/no-axios/errors/not_found.d.ts +0 -1
- package/lib/no-axios/errors/not_found.js +2 -8
- package/lib/no-axios/horizon/account_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/account_call_builder.js +3 -3
- package/lib/no-axios/horizon/assets_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/assets_call_builder.js +2 -2
- package/lib/no-axios/horizon/call_builder.d.ts +3 -1
- package/lib/no-axios/horizon/call_builder.js +4 -3
- package/lib/no-axios/horizon/claimable_balances_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/claimable_balances_call_builder.js +3 -3
- package/lib/no-axios/horizon/effect_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/effect_call_builder.js +2 -2
- package/lib/no-axios/horizon/friendbot_builder.d.ts +2 -1
- package/lib/no-axios/horizon/friendbot_builder.js +2 -2
- package/lib/no-axios/horizon/horizon_axios_client.d.ts +2 -2
- package/lib/no-axios/horizon/horizon_axios_client.js +38 -30
- package/lib/no-axios/horizon/index.d.ts +1 -1
- package/lib/no-axios/horizon/index.js +1 -10
- package/lib/no-axios/horizon/ledger_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/ledger_call_builder.js +2 -2
- package/lib/no-axios/horizon/liquidity_pool_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/liquidity_pool_call_builder.js +3 -3
- package/lib/no-axios/horizon/offer_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/offer_call_builder.js +3 -3
- package/lib/no-axios/horizon/operation_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/operation_call_builder.js +3 -3
- package/lib/no-axios/horizon/orderbook_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/orderbook_call_builder.js +2 -2
- package/lib/no-axios/horizon/path_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/path_call_builder.js +2 -2
- package/lib/no-axios/horizon/payment_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/payment_call_builder.js +2 -2
- package/lib/no-axios/horizon/server.d.ts +25 -10
- package/lib/no-axios/horizon/server.js +23 -30
- package/lib/no-axios/horizon/strict_receive_path_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/strict_receive_path_call_builder.js +2 -2
- package/lib/no-axios/horizon/strict_send_path_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/strict_send_path_call_builder.js +2 -2
- package/lib/no-axios/horizon/trade_aggregation_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/trade_aggregation_call_builder.js +2 -2
- package/lib/no-axios/horizon/trades_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/trades_call_builder.js +2 -2
- package/lib/no-axios/horizon/transaction_call_builder.d.ts +2 -1
- package/lib/no-axios/horizon/transaction_call_builder.js +3 -3
- package/lib/no-axios/rpc/api.d.ts +132 -0
- package/lib/no-axios/rpc/axios.d.ts +1 -2
- package/lib/no-axios/rpc/axios.js +17 -9
- package/lib/no-axios/rpc/index.d.ts +0 -1
- package/lib/no-axios/rpc/index.js +0 -9
- package/lib/no-axios/rpc/jsonrpc.d.ts +2 -1
- package/lib/no-axios/rpc/jsonrpc.js +4 -6
- package/lib/no-axios/rpc/parsers.d.ts +1 -0
- package/lib/no-axios/rpc/parsers.js +23 -0
- package/lib/no-axios/rpc/server.d.ts +82 -20
- package/lib/no-axios/rpc/server.js +56 -19
- package/lib/no-axios/webauth/errors.d.ts +0 -2
- package/lib/no-axios/webauth/errors.js +2 -8
- package/lib/no-eventsource/contract/assembled_transaction.js +9 -4
- package/lib/no-eventsource/contract/client.d.ts +1 -1
- package/lib/no-eventsource/contract/client.js +25 -14
- package/lib/no-eventsource/contract/sent_transaction.js +9 -4
- package/lib/no-eventsource/contract/spec.js +10 -2
- package/lib/no-eventsource/contract/types.d.ts +9 -1
- package/lib/no-eventsource/errors/account_requires_memo.d.ts +0 -1
- package/lib/no-eventsource/errors/account_requires_memo.js +0 -4
- package/lib/no-eventsource/errors/bad_request.d.ts +0 -1
- package/lib/no-eventsource/errors/bad_request.js +2 -8
- package/lib/no-eventsource/errors/bad_response.d.ts +0 -1
- package/lib/no-eventsource/errors/bad_response.js +2 -8
- package/lib/no-eventsource/errors/network.d.ts +0 -1
- package/lib/no-eventsource/errors/network.js +0 -3
- package/lib/no-eventsource/errors/not_found.d.ts +0 -1
- package/lib/no-eventsource/errors/not_found.js +2 -8
- package/lib/no-eventsource/horizon/account_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/account_call_builder.js +3 -3
- package/lib/no-eventsource/horizon/assets_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/assets_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/call_builder.d.ts +3 -1
- package/lib/no-eventsource/horizon/call_builder.js +4 -3
- package/lib/no-eventsource/horizon/claimable_balances_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/claimable_balances_call_builder.js +3 -3
- package/lib/no-eventsource/horizon/effect_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/effect_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/friendbot_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/friendbot_builder.js +2 -2
- package/lib/no-eventsource/horizon/horizon_axios_client.d.ts +2 -2
- package/lib/no-eventsource/horizon/horizon_axios_client.js +38 -30
- package/lib/no-eventsource/horizon/index.d.ts +1 -1
- package/lib/no-eventsource/horizon/index.js +1 -10
- package/lib/no-eventsource/horizon/ledger_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/ledger_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/liquidity_pool_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/liquidity_pool_call_builder.js +3 -3
- package/lib/no-eventsource/horizon/offer_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/offer_call_builder.js +3 -3
- package/lib/no-eventsource/horizon/operation_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/operation_call_builder.js +3 -3
- package/lib/no-eventsource/horizon/orderbook_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/orderbook_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/path_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/path_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/payment_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/payment_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/server.d.ts +25 -10
- package/lib/no-eventsource/horizon/server.js +23 -30
- package/lib/no-eventsource/horizon/strict_receive_path_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/strict_receive_path_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/strict_send_path_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/strict_send_path_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/trade_aggregation_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/trade_aggregation_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/trades_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/trades_call_builder.js +2 -2
- package/lib/no-eventsource/horizon/transaction_call_builder.d.ts +2 -1
- package/lib/no-eventsource/horizon/transaction_call_builder.js +3 -3
- package/lib/no-eventsource/rpc/api.d.ts +132 -0
- package/lib/no-eventsource/rpc/axios.d.ts +1 -2
- package/lib/no-eventsource/rpc/axios.js +17 -9
- package/lib/no-eventsource/rpc/index.d.ts +0 -1
- package/lib/no-eventsource/rpc/index.js +0 -9
- package/lib/no-eventsource/rpc/jsonrpc.d.ts +2 -1
- package/lib/no-eventsource/rpc/jsonrpc.js +4 -6
- package/lib/no-eventsource/rpc/parsers.d.ts +1 -0
- package/lib/no-eventsource/rpc/parsers.js +23 -0
- package/lib/no-eventsource/rpc/server.d.ts +82 -20
- package/lib/no-eventsource/rpc/server.js +56 -19
- package/lib/no-eventsource/webauth/errors.d.ts +0 -2
- package/lib/no-eventsource/webauth/errors.js +2 -8
- package/lib/rpc/api.d.ts +132 -0
- package/lib/rpc/axios.d.ts +1 -2
- package/lib/rpc/axios.js +17 -9
- package/lib/rpc/index.d.ts +0 -1
- package/lib/rpc/index.js +0 -9
- package/lib/rpc/jsonrpc.d.ts +2 -1
- package/lib/rpc/jsonrpc.js +4 -6
- package/lib/rpc/parsers.d.ts +1 -0
- package/lib/rpc/parsers.js +23 -0
- package/lib/rpc/server.d.ts +82 -20
- package/lib/rpc/server.js +56 -19
- package/lib/webauth/errors.d.ts +0 -2
- package/lib/webauth/errors.js +2 -8
- package/package.json +20 -45
|
@@ -19,10 +19,10 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
19
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
20
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
21
21
|
var TradesCallBuilder = exports.TradesCallBuilder = function (_CallBuilder) {
|
|
22
|
-
function TradesCallBuilder(serverUrl) {
|
|
22
|
+
function TradesCallBuilder(serverUrl, httpClient) {
|
|
23
23
|
var _this;
|
|
24
24
|
_classCallCheck(this, TradesCallBuilder);
|
|
25
|
-
_this = _callSuper(this, TradesCallBuilder, [serverUrl, "trades"]);
|
|
25
|
+
_this = _callSuper(this, TradesCallBuilder, [serverUrl, httpClient, "trades"]);
|
|
26
26
|
_this.url.segment("trades");
|
|
27
27
|
return _this;
|
|
28
28
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CallBuilder } from "./call_builder";
|
|
2
2
|
import { ServerApi } from "./server_api";
|
|
3
|
+
import { HttpClient } from "../http-client";
|
|
3
4
|
/**
|
|
4
5
|
* Creates a new {@link TransactionCallBuilder} pointed to server defined by serverUrl.
|
|
5
6
|
*
|
|
@@ -14,7 +15,7 @@ import { ServerApi } from "./server_api";
|
|
|
14
15
|
* @param {string} serverUrl Horizon server URL.
|
|
15
16
|
*/
|
|
16
17
|
export declare class TransactionCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.TransactionRecord>> {
|
|
17
|
-
constructor(serverUrl: URI);
|
|
18
|
+
constructor(serverUrl: URI, httpClient: HttpClient);
|
|
18
19
|
/**
|
|
19
20
|
* The transaction details endpoint provides information on a single transaction. The transaction hash provided in the hash argument specifies which transaction to load.
|
|
20
21
|
* @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/retrieve-a-transaction|Transaction Details}
|
|
@@ -19,10 +19,10 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
19
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
20
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
21
21
|
var TransactionCallBuilder = exports.TransactionCallBuilder = function (_CallBuilder) {
|
|
22
|
-
function TransactionCallBuilder(serverUrl) {
|
|
22
|
+
function TransactionCallBuilder(serverUrl, httpClient) {
|
|
23
23
|
var _this;
|
|
24
24
|
_classCallCheck(this, TransactionCallBuilder);
|
|
25
|
-
_this = _callSuper(this, TransactionCallBuilder, [serverUrl, "transactions"]);
|
|
25
|
+
_this = _callSuper(this, TransactionCallBuilder, [serverUrl, httpClient, "transactions"]);
|
|
26
26
|
_this.url.segment("transactions");
|
|
27
27
|
return _this;
|
|
28
28
|
}
|
|
@@ -30,7 +30,7 @@ var TransactionCallBuilder = exports.TransactionCallBuilder = function (_CallBui
|
|
|
30
30
|
return _createClass(TransactionCallBuilder, [{
|
|
31
31
|
key: "transaction",
|
|
32
32
|
value: function transaction(transactionId) {
|
|
33
|
-
var builder = new _call_builder.CallBuilder(this.url.clone());
|
|
33
|
+
var builder = new _call_builder.CallBuilder(this.url.clone(), this.httpClient);
|
|
34
34
|
builder.filter.push([transactionId]);
|
|
35
35
|
return builder;
|
|
36
36
|
}
|
|
@@ -179,6 +179,55 @@ export declare namespace Api {
|
|
|
179
179
|
latestLedgerCloseTime: string;
|
|
180
180
|
oldestLedgerCloseTime: string;
|
|
181
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Request parameters for fetching events from the Stellar network.
|
|
184
|
+
*
|
|
185
|
+
* **Important**: This type enforces mutually exclusive pagination modes:
|
|
186
|
+
* - **Ledger range mode**: Use `startLedger` and `endLedger` (cursor must be omitted)
|
|
187
|
+
* - **Cursor pagination mode**: Use `cursor` (startLedger and endLedger must be omitted)
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* // ✅ Correct: Ledger range mode
|
|
191
|
+
* const rangeRequest: GetEventsRequest = {
|
|
192
|
+
* filters: [],
|
|
193
|
+
* startLedger: 1000,
|
|
194
|
+
* endLedger: 2000,
|
|
195
|
+
* limit: 100
|
|
196
|
+
* };
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* // ✅ Correct: Cursor pagination mode
|
|
200
|
+
* const cursorRequest: GetEventsRequest = {
|
|
201
|
+
* filters: [],
|
|
202
|
+
* cursor: "some-cursor-value",
|
|
203
|
+
* limit: 100
|
|
204
|
+
* };
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* // ❌ Invalid: Cannot mix cursor with ledger range
|
|
208
|
+
* const invalidRequest = {
|
|
209
|
+
* filters: [],
|
|
210
|
+
* startLedger: 1000, // ❌ Cannot use with cursor
|
|
211
|
+
* endLedger: 2000, // ❌ Cannot use with cursor
|
|
212
|
+
* cursor: "cursor", // ❌ Cannot use with ledger range
|
|
213
|
+
* limit: 100
|
|
214
|
+
* };
|
|
215
|
+
*
|
|
216
|
+
* @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents | getEvents API reference}
|
|
217
|
+
*/
|
|
218
|
+
export type GetEventsRequest = {
|
|
219
|
+
filters: Api.EventFilter[];
|
|
220
|
+
startLedger: number;
|
|
221
|
+
endLedger: number;
|
|
222
|
+
cursor?: never;
|
|
223
|
+
limit?: number;
|
|
224
|
+
} | {
|
|
225
|
+
filters: Api.EventFilter[];
|
|
226
|
+
cursor: string;
|
|
227
|
+
startLedger?: never;
|
|
228
|
+
endLedger?: never;
|
|
229
|
+
limit?: number;
|
|
230
|
+
};
|
|
182
231
|
export interface GetEventsResponse extends RetentionState {
|
|
183
232
|
events: EventResponse[];
|
|
184
233
|
cursor: string;
|
|
@@ -386,5 +435,88 @@ export declare namespace Api {
|
|
|
386
435
|
liveUntilLedgerSeq?: number;
|
|
387
436
|
};
|
|
388
437
|
}
|
|
438
|
+
/**
|
|
439
|
+
* Request parameters for fetching a sequential list of ledgers.
|
|
440
|
+
*
|
|
441
|
+
* This type supports two distinct pagination modes that are mutually exclusive:
|
|
442
|
+
* - **Ledger-based pagination**: Use `startLedger` to begin fetching from a specific ledger sequence
|
|
443
|
+
* - **Cursor-based pagination**: Use `cursor` to continue from a previous response's pagination token
|
|
444
|
+
*
|
|
445
|
+
* @typedef {object} GetLedgersRequest
|
|
446
|
+
* @property {number} [startLedger] - Ledger sequence number to start fetching from (inclusive).
|
|
447
|
+
* Must be omitted if cursor is provided. Cannot be less than the oldest ledger or greater
|
|
448
|
+
* than the latest ledger stored on the RPC node.
|
|
449
|
+
* @property {object} [pagination] - Pagination configuration for the request.
|
|
450
|
+
* @property {string} [pagination.cursor] - Page cursor for continuing pagination from a previous
|
|
451
|
+
* response. Must be omitted if startLedger is provided.
|
|
452
|
+
* @property {number} [pagination.limit=100] - Maximum number of ledgers to return per page.
|
|
453
|
+
* Valid range: 1-10000. Defaults to 100 if not specified.
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* // Ledger-based pagination - start from specific ledger
|
|
457
|
+
* const ledgerRequest: GetLedgersRequest = {
|
|
458
|
+
* startLedger: 36233,
|
|
459
|
+
* pagination: {
|
|
460
|
+
* limit: 10
|
|
461
|
+
* }
|
|
462
|
+
* };
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* // Cursor-based pagination - continue from previous response
|
|
466
|
+
* const cursorRequest: GetLedgersRequest = {
|
|
467
|
+
* pagination: {
|
|
468
|
+
* cursor: "36234",
|
|
469
|
+
* limit: 5
|
|
470
|
+
* }
|
|
471
|
+
* };
|
|
472
|
+
*
|
|
473
|
+
* @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers | getLedgers API reference}
|
|
474
|
+
*/
|
|
475
|
+
export type GetLedgersRequest = {
|
|
476
|
+
startLedger: number;
|
|
477
|
+
pagination?: {
|
|
478
|
+
cursor?: never;
|
|
479
|
+
limit?: number;
|
|
480
|
+
};
|
|
481
|
+
} | {
|
|
482
|
+
startLedger?: never;
|
|
483
|
+
pagination: {
|
|
484
|
+
cursor: string;
|
|
485
|
+
limit?: number;
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
/** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers */
|
|
489
|
+
export interface GetLedgersResponse {
|
|
490
|
+
ledgers: LedgerResponse[];
|
|
491
|
+
latestLedger: number;
|
|
492
|
+
latestLedgerCloseTime: number;
|
|
493
|
+
oldestLedger: number;
|
|
494
|
+
oldestLedgerCloseTime: number;
|
|
495
|
+
cursor: string;
|
|
496
|
+
}
|
|
497
|
+
export interface RawGetLedgersResponse {
|
|
498
|
+
ledgers: RawLedgerResponse[];
|
|
499
|
+
latestLedger: number;
|
|
500
|
+
latestLedgerCloseTime: number;
|
|
501
|
+
oldestLedger: number;
|
|
502
|
+
oldestLedgerCloseTime: number;
|
|
503
|
+
cursor: string;
|
|
504
|
+
}
|
|
505
|
+
export interface LedgerResponse {
|
|
506
|
+
hash: string;
|
|
507
|
+
sequence: number;
|
|
508
|
+
ledgerCloseTime: string;
|
|
509
|
+
headerXdr: xdr.LedgerHeaderHistoryEntry;
|
|
510
|
+
metadataXdr: xdr.LedgerCloseMeta;
|
|
511
|
+
}
|
|
512
|
+
export interface RawLedgerResponse {
|
|
513
|
+
hash: string;
|
|
514
|
+
sequence: number;
|
|
515
|
+
ledgerCloseTime: string;
|
|
516
|
+
/** a base-64 encoded {@link xdr.LedgerHeaderHistoryEntry} instance */
|
|
517
|
+
headerXdr: string;
|
|
518
|
+
/** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */
|
|
519
|
+
metadataXdr: string;
|
|
520
|
+
}
|
|
389
521
|
export {};
|
|
390
522
|
}
|
|
@@ -3,13 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createHttpClient = createHttpClient;
|
|
7
|
+
exports.version = void 0;
|
|
7
8
|
var _httpClient = require("../http-client");
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
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); }
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
var version = exports.version = "14.3.1";
|
|
16
|
+
function createHttpClient(headers) {
|
|
17
|
+
return (0, _httpClient.create)({
|
|
18
|
+
headers: _objectSpread(_objectSpread({}, headers), {}, {
|
|
19
|
+
"X-Client-Name": "js-stellar-sdk",
|
|
20
|
+
"X-Client-Version": version
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @module rpc */
|
|
2
2
|
export * from "./api";
|
|
3
3
|
export { RpcServer as Server, BasicSleepStrategy, LinearSleepStrategy, Durability, } from "./server";
|
|
4
|
-
export { default as AxiosClient } from "./axios";
|
|
5
4
|
export { parseRawSimulation, parseRawEvents } from "./parsers";
|
|
6
5
|
export * from "./transaction";
|
|
7
6
|
declare const _default: any;
|
|
@@ -8,16 +8,9 @@ var _exportNames = {
|
|
|
8
8
|
BasicSleepStrategy: true,
|
|
9
9
|
LinearSleepStrategy: true,
|
|
10
10
|
Durability: true,
|
|
11
|
-
AxiosClient: true,
|
|
12
11
|
parseRawSimulation: true,
|
|
13
12
|
parseRawEvents: true
|
|
14
13
|
};
|
|
15
|
-
Object.defineProperty(exports, "AxiosClient", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function get() {
|
|
18
|
-
return _axios.default;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
14
|
Object.defineProperty(exports, "BasicSleepStrategy", {
|
|
22
15
|
enumerable: true,
|
|
23
16
|
get: function get() {
|
|
@@ -68,7 +61,6 @@ Object.keys(_api).forEach(function (key) {
|
|
|
68
61
|
});
|
|
69
62
|
});
|
|
70
63
|
var _server = require("./server");
|
|
71
|
-
var _axios = _interopRequireDefault(require("./axios"));
|
|
72
64
|
var _parsers = require("./parsers");
|
|
73
65
|
var _transaction = require("./transaction");
|
|
74
66
|
Object.keys(_transaction).forEach(function (key) {
|
|
@@ -82,5 +74,4 @@ Object.keys(_transaction).forEach(function (key) {
|
|
|
82
74
|
}
|
|
83
75
|
});
|
|
84
76
|
});
|
|
85
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
86
77
|
var _default = exports.default = module.exports;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HttpClient } from "../http-client";
|
|
1
2
|
export type Id = string | number;
|
|
2
3
|
export interface Request<T> {
|
|
3
4
|
jsonrpc: "2.0";
|
|
@@ -32,4 +33,4 @@ export interface Error<E = any> {
|
|
|
32
33
|
* @returns {Promise<T>}
|
|
33
34
|
* @private
|
|
34
35
|
*/
|
|
35
|
-
export declare function postObject<T>(url: string, method: string, param?: any): Promise<T>;
|
|
36
|
+
export declare function postObject<T>(client: HttpClient, url: string, method: string, param?: any): Promise<T>;
|
|
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.postObject = postObject;
|
|
7
|
-
var _axios = _interopRequireDefault(require("./axios"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
7
|
function _regenerator() { var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
10
8
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
11
9
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
@@ -13,11 +11,11 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
|
|
|
13
11
|
function hasOwnProperty(obj, prop) {
|
|
14
12
|
return obj.hasOwnProperty(prop);
|
|
15
13
|
}
|
|
16
|
-
function postObject(_x, _x2) {
|
|
14
|
+
function postObject(_x, _x2, _x3) {
|
|
17
15
|
return _postObject.apply(this, arguments);
|
|
18
16
|
}
|
|
19
17
|
function _postObject() {
|
|
20
|
-
_postObject = _asyncToGenerator(_regenerator().m(function _callee(url, method) {
|
|
18
|
+
_postObject = _asyncToGenerator(_regenerator().m(function _callee(client, url, method) {
|
|
21
19
|
var param,
|
|
22
20
|
response,
|
|
23
21
|
_response$data,
|
|
@@ -25,9 +23,9 @@ function _postObject() {
|
|
|
25
23
|
return _regenerator().w(function (_context) {
|
|
26
24
|
while (1) switch (_context.n) {
|
|
27
25
|
case 0:
|
|
28
|
-
param = _args.length >
|
|
26
|
+
param = _args.length > 3 && _args[3] !== undefined ? _args[3] : null;
|
|
29
27
|
_context.n = 1;
|
|
30
|
-
return
|
|
28
|
+
return client.post(url, {
|
|
31
29
|
jsonrpc: "2.0",
|
|
32
30
|
id: 1,
|
|
33
31
|
method: method,
|
|
@@ -43,3 +43,4 @@ export declare function parseRawLedgerEntries(raw: Api.RawGetLedgerEntriesRespon
|
|
|
43
43
|
* @returns {Api.SimulateTransactionResponse} the original parameter (if already parsed), parsed otherwise
|
|
44
44
|
*/
|
|
45
45
|
export declare function parseRawSimulation(sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse): Api.SimulateTransactionResponse;
|
|
46
|
+
export declare function parseRawLedger(raw: Api.RawLedgerResponse): Api.LedgerResponse;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.parseRawEvents = parseRawEvents;
|
|
7
|
+
exports.parseRawLedger = parseRawLedger;
|
|
7
8
|
exports.parseRawLedgerEntries = parseRawLedgerEntries;
|
|
8
9
|
exports.parseRawSendTransaction = parseRawSendTransaction;
|
|
9
10
|
exports.parseRawSimulation = parseRawSimulation;
|
|
@@ -172,4 +173,26 @@ function parseRawSimulation(sim) {
|
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
175
|
return parseSuccessful(sim, base);
|
|
176
|
+
}
|
|
177
|
+
function parseRawLedger(raw) {
|
|
178
|
+
if (!raw.metadataXdr || !raw.headerXdr) {
|
|
179
|
+
var missingFields;
|
|
180
|
+
if (!raw.metadataXdr && !raw.headerXdr) {
|
|
181
|
+
missingFields = "metadataXdr and headerXdr";
|
|
182
|
+
} else if (!raw.metadataXdr) {
|
|
183
|
+
missingFields = "metadataXdr";
|
|
184
|
+
} else {
|
|
185
|
+
missingFields = "headerXdr";
|
|
186
|
+
}
|
|
187
|
+
throw new TypeError("invalid ledger missing fields: ".concat(missingFields));
|
|
188
|
+
}
|
|
189
|
+
var metadataXdr = _stellarBase.xdr.LedgerCloseMeta.fromXDR(raw.metadataXdr, "base64");
|
|
190
|
+
var headerXdr = _stellarBase.xdr.LedgerHeaderHistoryEntry.fromXDR(raw.headerXdr, "base64");
|
|
191
|
+
return {
|
|
192
|
+
hash: raw.hash,
|
|
193
|
+
sequence: raw.sequence,
|
|
194
|
+
ledgerCloseTime: raw.ledgerCloseTime,
|
|
195
|
+
metadataXdr: metadataXdr,
|
|
196
|
+
headerXdr: headerXdr
|
|
197
|
+
};
|
|
175
198
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import URI from "urijs";
|
|
2
2
|
import { Account, Address, Asset, Contract, FeeBumpTransaction, Transaction, xdr } from "@stellar/stellar-base";
|
|
3
3
|
import { Api } from "./api";
|
|
4
|
+
import { HttpClient } from "../http-client";
|
|
4
5
|
/**
|
|
5
6
|
* Default transaction submission timeout for RPC requests, in milliseconds
|
|
6
7
|
* @constant {number}
|
|
@@ -20,14 +21,6 @@ export declare enum Durability {
|
|
|
20
21
|
Temporary = "temporary",
|
|
21
22
|
Persistent = "persistent"
|
|
22
23
|
}
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {object} GetEventsRequest Describes the complex filter combinations available for event queries.
|
|
25
|
-
* @property {Array.<module:rpc.Api.EventFilter>} filters Filters to use when querying events from the RPC server.
|
|
26
|
-
* @property {number} [startLedger] Ledger number (inclusive) to begin querying events.
|
|
27
|
-
* @property {string} [cursor] Page cursor (exclusive) to begin querying events.
|
|
28
|
-
* @property {number} [limit=100] The maximum number of events that should be returned in the RPC response.
|
|
29
|
-
* @memberof module:rpc.Server
|
|
30
|
-
*/
|
|
31
24
|
/**
|
|
32
25
|
* @typedef {object} ResourceLeeway Describes additional resource leeways for transaction simulation.
|
|
33
26
|
* @property {number} cpuInstructions Simulate the transaction with more CPU instructions available.
|
|
@@ -41,20 +34,33 @@ export declare enum Durability {
|
|
|
41
34
|
* @memberof module:rpc.Server
|
|
42
35
|
*/
|
|
43
36
|
export declare namespace RpcServer {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
limit?: number;
|
|
50
|
-
}
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use `Api.GetEventsRequest` instead.
|
|
39
|
+
* @see {@link Api.GetEventsRequest}
|
|
40
|
+
*/
|
|
41
|
+
type GetEventsRequest = Api.GetEventsRequest;
|
|
51
42
|
interface PollingOptions {
|
|
52
43
|
attempts?: number;
|
|
53
44
|
sleepStrategy?: SleepStrategy;
|
|
54
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Describes additional resource leeways for transaction simulation.
|
|
48
|
+
* @property {number} cpuInstructions Simulate the transaction with more CPU instructions available.
|
|
49
|
+
* @memberof module:rpc.Server
|
|
50
|
+
*/
|
|
55
51
|
interface ResourceLeeway {
|
|
56
52
|
cpuInstructions: number;
|
|
57
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Options for configuring connections to RPC servers.
|
|
56
|
+
*
|
|
57
|
+
* @property {boolean} allowHttp - Allow connecting to http servers, default: `false`. This must be set to false in production deployments!
|
|
58
|
+
* @property {number} timeout - Allow a timeout, default: 0. Allows user to avoid nasty lag.
|
|
59
|
+
* @property {Record<string, string>} headers - Additional headers that should be added to any requests to the RPC server.
|
|
60
|
+
*
|
|
61
|
+
* @alias module:rpc.Server.Options
|
|
62
|
+
* @memberof module:rpc.Server
|
|
63
|
+
*/
|
|
58
64
|
interface Options {
|
|
59
65
|
allowHttp?: boolean;
|
|
60
66
|
timeout?: number;
|
|
@@ -86,6 +92,21 @@ export type SleepStrategy = (iter: number) => number;
|
|
|
86
92
|
*/
|
|
87
93
|
export declare class RpcServer {
|
|
88
94
|
readonly serverURL: URI;
|
|
95
|
+
/**
|
|
96
|
+
* HTTP client instance for making requests to Horizon.
|
|
97
|
+
* Exposes interceptors, defaults, and other configuration options.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* // Add authentication header
|
|
101
|
+
* server.httpClient.defaults.headers['Authorization'] = 'Bearer token';
|
|
102
|
+
*
|
|
103
|
+
* // Add request interceptor
|
|
104
|
+
* server.httpClient.interceptors.request.use((config) => {
|
|
105
|
+
* console.log('Request:', config.url);
|
|
106
|
+
* return config;
|
|
107
|
+
* });
|
|
108
|
+
*/
|
|
109
|
+
readonly httpClient: HttpClient;
|
|
89
110
|
constructor(serverURL: string, opts?: RpcServer.Options);
|
|
90
111
|
/**
|
|
91
112
|
* Fetch a minimal set of current info about a Stellar account.
|
|
@@ -365,20 +386,21 @@ export declare class RpcServer {
|
|
|
365
386
|
/**
|
|
366
387
|
* Fetch all events that match a given set of filters.
|
|
367
388
|
*
|
|
368
|
-
* The given filters (see {@link
|
|
389
|
+
* The given filters (see {@link Api.EventFilter}
|
|
369
390
|
* for detailed fields) are combined only in a logical OR fashion, and all of
|
|
370
391
|
* the fields in each filter are optional.
|
|
371
392
|
*
|
|
372
393
|
* To page through events, use the `pagingToken` field on the relevant
|
|
373
394
|
* {@link Api.EventResponse} object to set the `cursor` parameter.
|
|
374
395
|
*
|
|
375
|
-
* @param {
|
|
396
|
+
* @param {Api.GetEventsRequest} request Event filters {@link Api.GetEventsRequest},
|
|
376
397
|
* @returns {Promise<Api.GetEventsResponse>} A paginatable set of the events
|
|
377
398
|
* matching the given event filters
|
|
378
399
|
*
|
|
379
400
|
* @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents | getEvents docs}
|
|
380
401
|
*
|
|
381
402
|
* @example
|
|
403
|
+
*
|
|
382
404
|
* server.getEvents({
|
|
383
405
|
* startLedger: 1000,
|
|
384
406
|
* endLedger: 2000,
|
|
@@ -402,8 +424,8 @@ export declare class RpcServer {
|
|
|
402
424
|
* limit: 10,
|
|
403
425
|
* });
|
|
404
426
|
*/
|
|
405
|
-
getEvents(request:
|
|
406
|
-
_getEvents(request:
|
|
427
|
+
getEvents(request: Api.GetEventsRequest): Promise<Api.GetEventsResponse>;
|
|
428
|
+
_getEvents(request: Api.GetEventsRequest): Promise<Api.RawGetEventsResponse>;
|
|
407
429
|
/**
|
|
408
430
|
* Fetch metadata about the network this Soroban RPC server is connected to.
|
|
409
431
|
*
|
|
@@ -624,7 +646,7 @@ export declare class RpcServer {
|
|
|
624
646
|
* off" if it already exists)
|
|
625
647
|
* @throws If Friendbot is not configured on this network or request failure
|
|
626
648
|
*
|
|
627
|
-
* @see {@link https://developers.stellar.org/docs/learn/networks#friendbot | Friendbot docs}
|
|
649
|
+
* @see {@link https://developers.stellar.org/docs/learn/fundamentals/networks#friendbot | Friendbot docs}
|
|
628
650
|
* @see {@link module:Friendbot.Api.Response}
|
|
629
651
|
*
|
|
630
652
|
* @example
|
|
@@ -692,4 +714,44 @@ export declare class RpcServer {
|
|
|
692
714
|
* "Address has no XLM");
|
|
693
715
|
*/
|
|
694
716
|
getSACBalance(address: string | Address, sac: Asset, networkPassphrase?: string): Promise<Api.BalanceResponse>;
|
|
717
|
+
/**
|
|
718
|
+
* Fetch a detailed list of ledgers starting from a specified point.
|
|
719
|
+
*
|
|
720
|
+
* Returns ledger data with support for pagination as long as the requested
|
|
721
|
+
* pages fall within the history retention of the RPC provider.
|
|
722
|
+
*
|
|
723
|
+
* @param {Api.GetLedgersRequest} request - The request parameters for fetching ledgers. {@link Api.GetLedgersRequest}
|
|
724
|
+
* @returns {Promise<Api.GetLedgersResponse>} A promise that resolves to the
|
|
725
|
+
* ledgers response containing an array of ledger data and pagination info. {@link Api.GetLedgersResponse}
|
|
726
|
+
*
|
|
727
|
+
* @throws {Error} If startLedger is less than the oldest ledger stored in this
|
|
728
|
+
* node, or greater than the latest ledger seen by this node.
|
|
729
|
+
*
|
|
730
|
+
* @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers | getLedgers docs}
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* // Fetch ledgers starting from a specific sequence number
|
|
734
|
+
* server.getLedgers({
|
|
735
|
+
* startLedger: 36233,
|
|
736
|
+
* limit: 10
|
|
737
|
+
* }).then((response) => {
|
|
738
|
+
* console.log("Ledgers:", response.ledgers);
|
|
739
|
+
* console.log("Latest Ledger:", response.latestLedger);
|
|
740
|
+
* console.log("Cursor:", response.cursor);
|
|
741
|
+
* });
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* // Paginate through ledgers using cursor
|
|
745
|
+
* const firstPage = await server.getLedgers({
|
|
746
|
+
* startLedger: 36233,
|
|
747
|
+
* limit: 5
|
|
748
|
+
* });
|
|
749
|
+
*
|
|
750
|
+
* const nextPage = await server.getLedgers({
|
|
751
|
+
* cursor: firstPage.cursor,
|
|
752
|
+
* limit: 5
|
|
753
|
+
* });
|
|
754
|
+
*/
|
|
755
|
+
getLedgers(request: Api.GetLedgersRequest): Promise<Api.GetLedgersResponse>;
|
|
756
|
+
_getLedgers(request: Api.GetLedgersRequest): Promise<Api.RawGetLedgersResponse>;
|
|
695
757
|
}
|