@stellar/stellar-sdk 14.1.1 → 14.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.
Files changed (171) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +14 -20
  3. package/dist/stellar-sdk-minimal.js +532 -375
  4. package/dist/stellar-sdk-minimal.min.js +1 -1
  5. package/dist/stellar-sdk-no-axios.js +532 -375
  6. package/dist/stellar-sdk-no-axios.min.js +1 -1
  7. package/dist/stellar-sdk-no-eventsource.js +781 -551
  8. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  9. package/dist/stellar-sdk.js +781 -551
  10. package/dist/stellar-sdk.min.js +1 -1
  11. package/lib/contract/client.js +2 -2
  12. package/lib/contract/spec.js +10 -2
  13. package/lib/contract/utils.js +7 -7
  14. package/lib/errors/account_requires_memo.d.ts +0 -1
  15. package/lib/errors/account_requires_memo.js +0 -4
  16. package/lib/errors/bad_request.d.ts +0 -1
  17. package/lib/errors/bad_request.js +2 -8
  18. package/lib/errors/bad_response.d.ts +0 -1
  19. package/lib/errors/bad_response.js +2 -8
  20. package/lib/errors/network.d.ts +0 -1
  21. package/lib/errors/network.js +0 -3
  22. package/lib/errors/not_found.d.ts +0 -1
  23. package/lib/errors/not_found.js +2 -8
  24. package/lib/federation/index.d.ts +2 -2
  25. package/lib/horizon/call_builder.js +1 -1
  26. package/lib/horizon/horizon_api.js +0 -1
  27. package/lib/horizon/horizon_axios_client.js +4 -4
  28. package/lib/horizon/index.d.ts +1 -1
  29. package/lib/horizon/types/effects.d.ts +41 -41
  30. package/lib/horizon/types/trade.d.ts +1 -1
  31. package/lib/http-client/fetch-client.d.ts +2 -2
  32. package/lib/http-client/fetch-client.js +16 -16
  33. package/lib/http-client/index.js +2 -2
  34. package/lib/http-client/types.d.ts +2 -2
  35. package/lib/index.d.ts +11 -11
  36. package/lib/index.js +2 -2
  37. package/lib/minimal/contract/client.js +2 -2
  38. package/lib/minimal/contract/spec.js +10 -2
  39. package/lib/minimal/contract/utils.js +7 -7
  40. package/lib/minimal/errors/account_requires_memo.d.ts +0 -1
  41. package/lib/minimal/errors/account_requires_memo.js +0 -4
  42. package/lib/minimal/errors/bad_request.d.ts +0 -1
  43. package/lib/minimal/errors/bad_request.js +2 -8
  44. package/lib/minimal/errors/bad_response.d.ts +0 -1
  45. package/lib/minimal/errors/bad_response.js +2 -8
  46. package/lib/minimal/errors/network.d.ts +0 -1
  47. package/lib/minimal/errors/network.js +0 -3
  48. package/lib/minimal/errors/not_found.d.ts +0 -1
  49. package/lib/minimal/errors/not_found.js +2 -8
  50. package/lib/minimal/federation/index.d.ts +2 -2
  51. package/lib/minimal/horizon/call_builder.js +1 -1
  52. package/lib/minimal/horizon/horizon_api.js +0 -1
  53. package/lib/minimal/horizon/horizon_axios_client.js +4 -4
  54. package/lib/minimal/horizon/index.d.ts +1 -1
  55. package/lib/minimal/horizon/types/effects.d.ts +41 -41
  56. package/lib/minimal/horizon/types/trade.d.ts +1 -1
  57. package/lib/minimal/http-client/fetch-client.d.ts +2 -2
  58. package/lib/minimal/http-client/fetch-client.js +16 -16
  59. package/lib/minimal/http-client/index.js +2 -2
  60. package/lib/minimal/http-client/types.d.ts +2 -2
  61. package/lib/minimal/index.d.ts +11 -11
  62. package/lib/minimal/index.js +2 -2
  63. package/lib/minimal/rpc/api.d.ts +148 -8
  64. package/lib/minimal/rpc/api.js +3 -3
  65. package/lib/minimal/rpc/axios.js +3 -3
  66. package/lib/minimal/rpc/browser.d.ts +2 -2
  67. package/lib/minimal/rpc/index.d.ts +1 -1
  68. package/lib/minimal/rpc/parsers.d.ts +3 -2
  69. package/lib/minimal/rpc/parsers.js +42 -19
  70. package/lib/minimal/rpc/server.d.ts +123 -31
  71. package/lib/minimal/rpc/server.js +425 -267
  72. package/lib/minimal/rpc/transaction.d.ts +2 -2
  73. package/lib/minimal/rpc/transaction.js +6 -6
  74. package/lib/minimal/webauth/errors.d.ts +0 -2
  75. package/lib/minimal/webauth/errors.js +2 -8
  76. package/lib/minimal/webauth/index.d.ts +2 -2
  77. package/lib/no-axios/contract/client.js +2 -2
  78. package/lib/no-axios/contract/spec.js +10 -2
  79. package/lib/no-axios/contract/utils.js +7 -7
  80. package/lib/no-axios/errors/account_requires_memo.d.ts +0 -1
  81. package/lib/no-axios/errors/account_requires_memo.js +0 -4
  82. package/lib/no-axios/errors/bad_request.d.ts +0 -1
  83. package/lib/no-axios/errors/bad_request.js +2 -8
  84. package/lib/no-axios/errors/bad_response.d.ts +0 -1
  85. package/lib/no-axios/errors/bad_response.js +2 -8
  86. package/lib/no-axios/errors/network.d.ts +0 -1
  87. package/lib/no-axios/errors/network.js +0 -3
  88. package/lib/no-axios/errors/not_found.d.ts +0 -1
  89. package/lib/no-axios/errors/not_found.js +2 -8
  90. package/lib/no-axios/federation/index.d.ts +2 -2
  91. package/lib/no-axios/horizon/call_builder.js +1 -1
  92. package/lib/no-axios/horizon/horizon_api.js +0 -1
  93. package/lib/no-axios/horizon/horizon_axios_client.js +4 -4
  94. package/lib/no-axios/horizon/index.d.ts +1 -1
  95. package/lib/no-axios/horizon/types/effects.d.ts +41 -41
  96. package/lib/no-axios/horizon/types/trade.d.ts +1 -1
  97. package/lib/no-axios/http-client/fetch-client.d.ts +2 -2
  98. package/lib/no-axios/http-client/fetch-client.js +16 -16
  99. package/lib/no-axios/http-client/index.js +2 -2
  100. package/lib/no-axios/http-client/types.d.ts +2 -2
  101. package/lib/no-axios/index.d.ts +11 -11
  102. package/lib/no-axios/index.js +2 -2
  103. package/lib/no-axios/rpc/api.d.ts +148 -8
  104. package/lib/no-axios/rpc/api.js +3 -3
  105. package/lib/no-axios/rpc/axios.js +3 -3
  106. package/lib/no-axios/rpc/browser.d.ts +2 -2
  107. package/lib/no-axios/rpc/index.d.ts +1 -1
  108. package/lib/no-axios/rpc/parsers.d.ts +3 -2
  109. package/lib/no-axios/rpc/parsers.js +42 -19
  110. package/lib/no-axios/rpc/server.d.ts +123 -31
  111. package/lib/no-axios/rpc/server.js +425 -267
  112. package/lib/no-axios/rpc/transaction.d.ts +2 -2
  113. package/lib/no-axios/rpc/transaction.js +6 -6
  114. package/lib/no-axios/webauth/errors.d.ts +0 -2
  115. package/lib/no-axios/webauth/errors.js +2 -8
  116. package/lib/no-axios/webauth/index.d.ts +2 -2
  117. package/lib/no-eventsource/contract/client.js +2 -2
  118. package/lib/no-eventsource/contract/spec.js +10 -2
  119. package/lib/no-eventsource/contract/utils.js +7 -7
  120. package/lib/no-eventsource/errors/account_requires_memo.d.ts +0 -1
  121. package/lib/no-eventsource/errors/account_requires_memo.js +0 -4
  122. package/lib/no-eventsource/errors/bad_request.d.ts +0 -1
  123. package/lib/no-eventsource/errors/bad_request.js +2 -8
  124. package/lib/no-eventsource/errors/bad_response.d.ts +0 -1
  125. package/lib/no-eventsource/errors/bad_response.js +2 -8
  126. package/lib/no-eventsource/errors/network.d.ts +0 -1
  127. package/lib/no-eventsource/errors/network.js +0 -3
  128. package/lib/no-eventsource/errors/not_found.d.ts +0 -1
  129. package/lib/no-eventsource/errors/not_found.js +2 -8
  130. package/lib/no-eventsource/federation/index.d.ts +2 -2
  131. package/lib/no-eventsource/horizon/call_builder.js +1 -1
  132. package/lib/no-eventsource/horizon/horizon_api.js +0 -1
  133. package/lib/no-eventsource/horizon/horizon_axios_client.js +4 -4
  134. package/lib/no-eventsource/horizon/index.d.ts +1 -1
  135. package/lib/no-eventsource/horizon/types/effects.d.ts +41 -41
  136. package/lib/no-eventsource/horizon/types/trade.d.ts +1 -1
  137. package/lib/no-eventsource/http-client/fetch-client.d.ts +2 -2
  138. package/lib/no-eventsource/http-client/fetch-client.js +16 -16
  139. package/lib/no-eventsource/http-client/index.js +2 -2
  140. package/lib/no-eventsource/http-client/types.d.ts +2 -2
  141. package/lib/no-eventsource/index.d.ts +11 -11
  142. package/lib/no-eventsource/index.js +2 -2
  143. package/lib/no-eventsource/rpc/api.d.ts +148 -8
  144. package/lib/no-eventsource/rpc/api.js +3 -3
  145. package/lib/no-eventsource/rpc/axios.js +3 -3
  146. package/lib/no-eventsource/rpc/browser.d.ts +2 -2
  147. package/lib/no-eventsource/rpc/index.d.ts +1 -1
  148. package/lib/no-eventsource/rpc/parsers.d.ts +3 -2
  149. package/lib/no-eventsource/rpc/parsers.js +42 -19
  150. package/lib/no-eventsource/rpc/server.d.ts +123 -31
  151. package/lib/no-eventsource/rpc/server.js +425 -267
  152. package/lib/no-eventsource/rpc/transaction.d.ts +2 -2
  153. package/lib/no-eventsource/rpc/transaction.js +6 -6
  154. package/lib/no-eventsource/webauth/errors.d.ts +0 -2
  155. package/lib/no-eventsource/webauth/errors.js +2 -8
  156. package/lib/no-eventsource/webauth/index.d.ts +2 -2
  157. package/lib/rpc/api.d.ts +148 -8
  158. package/lib/rpc/api.js +3 -3
  159. package/lib/rpc/axios.js +3 -3
  160. package/lib/rpc/browser.d.ts +2 -2
  161. package/lib/rpc/index.d.ts +1 -1
  162. package/lib/rpc/parsers.d.ts +3 -2
  163. package/lib/rpc/parsers.js +42 -19
  164. package/lib/rpc/server.d.ts +123 -31
  165. package/lib/rpc/server.js +425 -267
  166. package/lib/rpc/transaction.d.ts +2 -2
  167. package/lib/rpc/transaction.js +6 -6
  168. package/lib/webauth/errors.d.ts +0 -2
  169. package/lib/webauth/errors.js +2 -8
  170. package/lib/webauth/index.d.ts +2 -2
  171. package/package.json +17 -9
@@ -52,7 +52,7 @@ var InterceptorManager = function () {
52
52
  function getFormConfig(config) {
53
53
  var formConfig = config || {};
54
54
  formConfig.headers = new Headers(formConfig.headers || {});
55
- formConfig.headers.set('Content-Type', 'application/x-www-form-urlencoded');
55
+ formConfig.headers.set("Content-Type", "application/x-www-form-urlencoded");
56
56
  return formConfig;
57
57
  }
58
58
  function createFetchClient() {
@@ -84,7 +84,7 @@ function createFetchClient() {
84
84
  if (config.cancelToken) {
85
85
  config.cancelToken.promise.then(function () {
86
86
  abortController.abort();
87
- reject(new Error('Request canceled'));
87
+ reject(new Error("Request canceled"));
88
88
  });
89
89
  }
90
90
  var modifiedConfig = config;
@@ -108,7 +108,7 @@ function createFetchClient() {
108
108
  }
109
109
  var adapter = modifiedConfig.adapter || _this.defaults.adapter;
110
110
  if (!adapter) {
111
- throw new Error('No adapter available');
111
+ throw new Error("No adapter available");
112
112
  }
113
113
  var responsePromise = adapter(modifiedConfig).then(function (axiosResponse) {
114
114
  var httpClientResponse = {
@@ -129,13 +129,13 @@ function createFetchClient() {
129
129
  var _loop = function _loop(_i) {
130
130
  responsePromise = responsePromise.then(function (response) {
131
131
  var fulfilledInterceptor = _chain[_i];
132
- if (typeof fulfilledInterceptor === 'function') {
132
+ if (typeof fulfilledInterceptor === "function") {
133
133
  return fulfilledInterceptor(response);
134
134
  }
135
135
  return response;
136
136
  }, function (error) {
137
137
  var rejectedInterceptor = _chain[_i + 1];
138
- if (typeof rejectedInterceptor === 'function') {
138
+ if (typeof rejectedInterceptor === "function") {
139
139
  return rejectedInterceptor(error);
140
140
  }
141
141
  throw error;
@@ -153,45 +153,45 @@ function createFetchClient() {
153
153
  get: function get(url, config) {
154
154
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), config), {}, {
155
155
  url: url,
156
- method: 'get'
156
+ method: "get"
157
157
  }));
158
158
  },
159
159
  delete: function _delete(url, config) {
160
160
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), config), {}, {
161
161
  url: url,
162
- method: 'delete'
162
+ method: "delete"
163
163
  }));
164
164
  },
165
165
  head: function head(url, config) {
166
166
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), config), {}, {
167
167
  url: url,
168
- method: 'head'
168
+ method: "head"
169
169
  }));
170
170
  },
171
171
  options: function options(url, config) {
172
172
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), config), {}, {
173
173
  url: url,
174
- method: 'options'
174
+ method: "options"
175
175
  }));
176
176
  },
177
177
  post: function post(url, data, config) {
178
178
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), config), {}, {
179
179
  url: url,
180
- method: 'post',
180
+ method: "post",
181
181
  data: data
182
182
  }));
183
183
  },
184
184
  put: function put(url, data, config) {
185
185
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), config), {}, {
186
186
  url: url,
187
- method: 'put',
187
+ method: "put",
188
188
  data: data
189
189
  }));
190
190
  },
191
191
  patch: function patch(url, data, config) {
192
192
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), config), {}, {
193
193
  url: url,
194
- method: 'patch',
194
+ method: "patch",
195
195
  data: data
196
196
  }));
197
197
  },
@@ -199,7 +199,7 @@ function createFetchClient() {
199
199
  var formConfig = getFormConfig(config);
200
200
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), formConfig), {}, {
201
201
  url: url,
202
- method: 'post',
202
+ method: "post",
203
203
  data: data
204
204
  }));
205
205
  },
@@ -207,7 +207,7 @@ function createFetchClient() {
207
207
  var formConfig = getFormConfig(config);
208
208
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), formConfig), {}, {
209
209
  url: url,
210
- method: 'put',
210
+ method: "put",
211
211
  data: data
212
212
  }));
213
213
  },
@@ -215,13 +215,13 @@ function createFetchClient() {
215
215
  var formConfig = getFormConfig(config);
216
216
  return this.makeRequest(_objectSpread(_objectSpread(_objectSpread({}, this.defaults), formConfig), {}, {
217
217
  url: url,
218
- method: 'patch',
218
+ method: "patch",
219
219
  data: data
220
220
  }));
221
221
  },
222
222
  CancelToken: _types.CancelToken,
223
223
  isCancel: function isCancel(value) {
224
- return value instanceof Error && value.message === 'Request canceled';
224
+ return value instanceof Error && value.message === "Request canceled";
225
225
  }
226
226
  };
227
227
  return httpClient;
@@ -23,11 +23,11 @@ Object.keys(_types).forEach(function (key) {
23
23
  var httpClient;
24
24
  var create;
25
25
  if (true) {
26
- var axiosModule = require('./axios-client');
26
+ var axiosModule = require("./axios-client");
27
27
  exports.httpClient = httpClient = axiosModule.axiosClient;
28
28
  exports.create = create = axiosModule.create;
29
29
  } else {
30
- var fetchModule = require('./fetch-client');
30
+ var fetchModule = require("./fetch-client");
31
31
  exports.httpClient = httpClient = fetchModule.fetchClient;
32
32
  exports.create = create = fetchModule.create;
33
33
  }
@@ -1,7 +1,7 @@
1
1
  export type HttpResponseHeaders = Record<string, string | boolean | undefined> & {
2
- 'set-cookie'?: string[];
2
+ "set-cookie"?: string[];
3
3
  };
4
- export interface HttpClientDefaults extends Omit<HttpClientRequestConfig, 'headers'> {
4
+ export interface HttpClientDefaults extends Omit<HttpClientRequestConfig, "headers"> {
5
5
  headers?: [string, string][] | Record<string, string> | Headers | undefined;
6
6
  }
7
7
  export interface HttpClientResponse<T = any> {
@@ -1,11 +1,11 @@
1
- export * from './errors';
2
- export { Config } from './config';
3
- export { Utils } from './utils';
4
- export * as StellarToml from './stellartoml';
5
- export * as Federation from './federation';
6
- export * as WebAuth from './webauth';
7
- export * as Friendbot from './friendbot';
8
- export * as Horizon from './horizon';
1
+ export * from "./errors";
2
+ export { Config } from "./config";
3
+ export { Utils } from "./utils";
4
+ export * as StellarToml from "./stellartoml";
5
+ export * as Federation from "./federation";
6
+ export * as WebAuth from "./webauth";
7
+ export * as Friendbot from "./friendbot";
8
+ export * as Horizon from "./horizon";
9
9
  /**
10
10
  * Tools for interacting with the Soroban RPC server, such as `Server`,
11
11
  * `assembleTransaction`, and the `Api` types. You can import these from the
@@ -15,7 +15,7 @@ export * as Horizon from './horizon';
15
15
  * @example
16
16
  * import { Server } from '@stellar/stellar-sdk/rpc';
17
17
  */
18
- export * as rpc from './rpc';
18
+ export * as rpc from "./rpc";
19
19
  /**
20
20
  * Tools for interacting with smart contracts, such as `Client`, `Spec`, and
21
21
  * `AssembledTransaction`. You can import these from the `/contract`
@@ -26,7 +26,7 @@ export * as rpc from './rpc';
26
26
  * import { Client } from '@stellar/stellar-sdk/contract';
27
27
  * @private
28
28
  */
29
- export * as contract from './contract';
30
- export * from '@stellar/stellar-base';
29
+ export * as contract from "./contract";
30
+ export * from "@stellar/stellar-base";
31
31
  declare const _default: any;
32
32
  export default _default;
@@ -71,9 +71,9 @@ Object.keys(_stellarBase).forEach(function (key) {
71
71
  });
72
72
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
73
73
  var _default = exports.default = module.exports;
74
- if (typeof global.__USE_AXIOS__ === 'undefined') {
74
+ if (typeof global.__USE_AXIOS__ === "undefined") {
75
75
  global.__USE_AXIOS__ = true;
76
76
  }
77
- if (typeof global.__USE_EVENTSOURCE__ === 'undefined') {
77
+ if (typeof global.__USE_EVENTSOURCE__ === "undefined") {
78
78
  global.__USE_EVENTSOURCE__ = false;
79
79
  }
@@ -1,7 +1,7 @@
1
- import { Contract, SorobanDataBuilder, xdr } from '@stellar/stellar-base';
1
+ import { Contract, SorobanDataBuilder, xdr } from "@stellar/stellar-base";
2
2
  export declare namespace Api {
3
3
  export interface GetHealthResponse {
4
- status: 'healthy';
4
+ status: "healthy";
5
5
  }
6
6
  export interface LedgerEntryResult {
7
7
  lastModifiedLedgerSeq?: number;
@@ -103,11 +103,19 @@ export declare namespace Api {
103
103
  diagnosticEventsXdr?: string[];
104
104
  events?: RawTransactionEvents;
105
105
  }
106
- export interface GetTransactionsRequest {
106
+ export type GetTransactionsRequest = {
107
107
  startLedger: number;
108
- cursor?: string;
109
- limit?: number;
110
- }
108
+ pagination?: {
109
+ cursor?: never;
110
+ limit?: number;
111
+ };
112
+ } | {
113
+ startLedger?: never;
114
+ pagination: {
115
+ cursor: string;
116
+ limit?: number;
117
+ };
118
+ };
111
119
  export interface RawTransactionEvents {
112
120
  transactionEventsXdr?: string[];
113
121
  contractEventsXdr?: string[][];
@@ -159,7 +167,7 @@ export declare namespace Api {
159
167
  oldestLedgerCloseTimestamp: number;
160
168
  cursor: string;
161
169
  }
162
- export type EventType = 'contract' | 'system';
170
+ export type EventType = "contract" | "system";
163
171
  export interface EventFilter {
164
172
  type?: EventType;
165
173
  contractIds?: string[];
@@ -171,6 +179,55 @@ export declare namespace Api {
171
179
  latestLedgerCloseTime: string;
172
180
  oldestLedgerCloseTime: string;
173
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
+ };
174
231
  export interface GetEventsResponse extends RetentionState {
175
232
  events: EventResponse[];
176
233
  cursor: string;
@@ -214,7 +271,7 @@ export declare namespace Api {
214
271
  before: xdr.LedgerEntry | null;
215
272
  after: xdr.LedgerEntry | null;
216
273
  }
217
- export type SendTransactionStatus = 'PENDING' | 'DUPLICATE' | 'TRY_AGAIN_LATER' | 'ERROR';
274
+ export type SendTransactionStatus = "PENDING" | "DUPLICATE" | "TRY_AGAIN_LATER" | "ERROR";
218
275
  export interface SendTransactionResponse extends BaseSendTransactionResponse {
219
276
  errorResult?: xdr.TransactionResult;
220
277
  diagnosticEvents?: xdr.DiagnosticEvent[];
@@ -378,5 +435,88 @@ export declare namespace Api {
378
435
  liveUntilLedgerSeq?: number;
379
436
  };
380
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
+ }
381
521
  export {};
382
522
  }
@@ -14,15 +14,15 @@ var Api;
14
14
  }({});
15
15
  _Api.GetTransactionStatus = GetTransactionStatus;
16
16
  function isSimulationError(sim) {
17
- return 'error' in sim;
17
+ return "error" in sim;
18
18
  }
19
19
  _Api.isSimulationError = isSimulationError;
20
20
  function isSimulationSuccess(sim) {
21
- return 'transactionData' in sim;
21
+ return "transactionData" in sim;
22
22
  }
23
23
  _Api.isSimulationSuccess = isSimulationSuccess;
24
24
  function isSimulationRestore(sim) {
25
- return isSimulationSuccess(sim) && 'restorePreamble' in sim && !!sim.restorePreamble.transactionData;
25
+ return isSimulationSuccess(sim) && "restorePreamble" in sim && !!sim.restorePreamble.transactionData;
26
26
  }
27
27
  _Api.isSimulationRestore = isSimulationRestore;
28
28
  function isSimulationRaw(sim) {
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.default = exports.AxiosClient = void 0;
7
7
  var _httpClient = require("../http-client");
8
- var version = exports.version = "14.1.1";
8
+ var version = exports.version = "14.3.0";
9
9
  var AxiosClient = exports.AxiosClient = (0, _httpClient.create)({
10
10
  headers: {
11
- 'X-Client-Name': 'js-soroban-client',
12
- 'X-Client-Version': version
11
+ "X-Client-Name": "js-soroban-client",
12
+ "X-Client-Version": version
13
13
  }
14
14
  });
15
15
  var _default = exports.default = AxiosClient;
@@ -1,4 +1,4 @@
1
- export * from './index';
2
- export * as StellarBase from '@stellar/stellar-base';
1
+ export * from "./index";
2
+ export * as StellarBase from "@stellar/stellar-base";
3
3
  declare const _default: any;
4
4
  export default _default;
@@ -1,6 +1,6 @@
1
1
  /** @module rpc */
2
2
  export * from "./api";
3
- export { RpcServer as Server, BasicSleepStrategy, LinearSleepStrategy, Durability } from "./server";
3
+ export { RpcServer as Server, BasicSleepStrategy, LinearSleepStrategy, Durability, } from "./server";
4
4
  export { default as AxiosClient } from "./axios";
5
5
  export { parseRawSimulation, parseRawEvents } from "./parsers";
6
6
  export * from "./transaction";
@@ -1,4 +1,4 @@
1
- import { Api } from './api';
1
+ import { Api } from "./api";
2
2
  /**
3
3
  * Parse the response from invoking the `submitTransaction` method of a RPC server.
4
4
  * @memberof module:rpc
@@ -8,7 +8,7 @@ import { Api } from './api';
8
8
  * @returns {Api.SendTransactionResponse} transaction response parsed from the RPC server's response
9
9
  */
10
10
  export declare function parseRawSendTransaction(raw: Api.RawSendTransactionResponse): Api.SendTransactionResponse;
11
- export declare function parseTransactionInfo(raw: Api.RawTransactionInfo | Api.RawGetTransactionResponse): Omit<Api.TransactionInfo, 'status' | 'txHash'>;
11
+ export declare function parseTransactionInfo(raw: Api.RawTransactionInfo | Api.RawGetTransactionResponse): Omit<Api.TransactionInfo, "status" | "txHash">;
12
12
  export declare function parseRawTransactions(r: Api.RawTransactionInfo): Api.TransactionInfo;
13
13
  /**
14
14
  * Parse and return the retrieved events, if any, from a raw response from a
@@ -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;
@@ -25,24 +26,24 @@ function parseRawSendTransaction(raw) {
25
26
  if (errorResultXdr) {
26
27
  return _objectSpread(_objectSpread(_objectSpread({}, raw), diagnosticEventsXdr !== undefined && diagnosticEventsXdr.length > 0 && {
27
28
  diagnosticEvents: diagnosticEventsXdr.map(function (evt) {
28
- return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
29
+ return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, "base64");
29
30
  })
30
31
  }), {}, {
31
- errorResult: _stellarBase.xdr.TransactionResult.fromXDR(errorResultXdr, 'base64')
32
+ errorResult: _stellarBase.xdr.TransactionResult.fromXDR(errorResultXdr, "base64")
32
33
  });
33
34
  }
34
35
  return _objectSpread({}, raw);
35
36
  }
36
37
  function parseTransactionInfo(raw) {
37
38
  var _raw$events$contractE, _raw$events, _raw$events$transacti, _raw$events2;
38
- var meta = _stellarBase.xdr.TransactionMeta.fromXDR(raw.resultMetaXdr, 'base64');
39
+ var meta = _stellarBase.xdr.TransactionMeta.fromXDR(raw.resultMetaXdr, "base64");
39
40
  var info = {
40
41
  ledger: raw.ledger,
41
42
  createdAt: raw.createdAt,
42
43
  applicationOrder: raw.applicationOrder,
43
44
  feeBump: raw.feeBump,
44
- envelopeXdr: _stellarBase.xdr.TransactionEnvelope.fromXDR(raw.envelopeXdr, 'base64'),
45
- resultXdr: _stellarBase.xdr.TransactionResult.fromXDR(raw.resultXdr, 'base64'),
45
+ envelopeXdr: _stellarBase.xdr.TransactionEnvelope.fromXDR(raw.envelopeXdr, "base64"),
46
+ resultXdr: _stellarBase.xdr.TransactionResult.fromXDR(raw.resultXdr, "base64"),
46
47
  resultMetaXdr: meta,
47
48
  events: {
48
49
  contractEventsXdr: ((_raw$events$contractE = (_raw$events = raw.events) === null || _raw$events === void 0 ? void 0 : _raw$events.contractEventsXdr) !== null && _raw$events$contractE !== void 0 ? _raw$events$contractE : []).map(function (lst) {
@@ -66,7 +67,7 @@ function parseTransactionInfo(raw) {
66
67
  }
67
68
  if (raw.diagnosticEventsXdr) {
68
69
  info.diagnosticEventsXdr = raw.diagnosticEventsXdr.map(function (e) {
69
- return _stellarBase.xdr.DiagnosticEvent.fromXDR(e, 'base64');
70
+ return _stellarBase.xdr.DiagnosticEvent.fromXDR(e, "base64");
70
71
  });
71
72
  }
72
73
  return info;
@@ -88,13 +89,13 @@ function parseRawEvents(raw) {
88
89
  events: ((_raw$events3 = raw.events) !== null && _raw$events3 !== void 0 ? _raw$events3 : []).map(function (evt) {
89
90
  var clone = _objectSpread({}, evt);
90
91
  delete clone.contractId;
91
- return _objectSpread(_objectSpread(_objectSpread({}, clone), evt.contractId !== '' && {
92
+ return _objectSpread(_objectSpread(_objectSpread({}, clone), evt.contractId !== "" && {
92
93
  contractId: new _stellarBase.Contract(evt.contractId)
93
94
  }), {}, {
94
95
  topic: evt.topic.map(function (topic) {
95
- return _stellarBase.xdr.ScVal.fromXDR(topic, 'base64');
96
+ return _stellarBase.xdr.ScVal.fromXDR(topic, "base64");
96
97
  }),
97
- value: _stellarBase.xdr.ScVal.fromXDR(evt.value, 'base64')
98
+ value: _stellarBase.xdr.ScVal.fromXDR(evt.value, "base64")
98
99
  });
99
100
  })
100
101
  };
@@ -109,8 +110,8 @@ function parseRawLedgerEntries(raw) {
109
110
  }
110
111
  return _objectSpread({
111
112
  lastModifiedLedgerSeq: rawEntry.lastModifiedLedgerSeq,
112
- key: _stellarBase.xdr.LedgerKey.fromXDR(rawEntry.key, 'base64'),
113
- val: _stellarBase.xdr.LedgerEntryData.fromXDR(rawEntry.xdr, 'base64')
113
+ key: _stellarBase.xdr.LedgerKey.fromXDR(rawEntry.key, "base64"),
114
+ val: _stellarBase.xdr.LedgerEntryData.fromXDR(rawEntry.xdr, "base64")
114
115
  }, rawEntry.liveUntilLedgerSeq !== undefined && {
115
116
  liveUntilLedgerSeq: rawEntry.liveUntilLedgerSeq
116
117
  });
@@ -127,22 +128,22 @@ function parseSuccessful(sim, partial) {
127
128
  var _row$auth;
128
129
  return {
129
130
  auth: ((_row$auth = row.auth) !== null && _row$auth !== void 0 ? _row$auth : []).map(function (entry) {
130
- return _stellarBase.xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64');
131
+ return _stellarBase.xdr.SorobanAuthorizationEntry.fromXDR(entry, "base64");
131
132
  }),
132
- retval: row.xdr ? _stellarBase.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellarBase.xdr.ScVal.scvVoid()
133
+ retval: row.xdr ? _stellarBase.xdr.ScVal.fromXDR(row.xdr, "base64") : _stellarBase.xdr.ScVal.scvVoid()
133
134
  };
134
135
  })[0]
135
136
  }), ((_sim$stateChanges$len = (_sim$stateChanges = sim.stateChanges) === null || _sim$stateChanges === void 0 ? void 0 : _sim$stateChanges.length) !== null && _sim$stateChanges$len !== void 0 ? _sim$stateChanges$len : 0 > 0) && {
136
137
  stateChanges: (_sim$stateChanges2 = sim.stateChanges) === null || _sim$stateChanges2 === void 0 ? void 0 : _sim$stateChanges2.map(function (entryChange) {
137
138
  return {
138
139
  type: entryChange.type,
139
- key: _stellarBase.xdr.LedgerKey.fromXDR(entryChange.key, 'base64'),
140
- before: entryChange.before ? _stellarBase.xdr.LedgerEntry.fromXDR(entryChange.before, 'base64') : null,
141
- after: entryChange.after ? _stellarBase.xdr.LedgerEntry.fromXDR(entryChange.after, 'base64') : null
140
+ key: _stellarBase.xdr.LedgerKey.fromXDR(entryChange.key, "base64"),
141
+ before: entryChange.before ? _stellarBase.xdr.LedgerEntry.fromXDR(entryChange.before, "base64") : null,
142
+ after: entryChange.after ? _stellarBase.xdr.LedgerEntry.fromXDR(entryChange.after, "base64") : null
142
143
  };
143
144
  })
144
145
  });
145
- if (!sim.restorePreamble || sim.restorePreamble.transactionData === '') {
146
+ if (!sim.restorePreamble || sim.restorePreamble.transactionData === "") {
146
147
  return success;
147
148
  }
148
149
  return _objectSpread(_objectSpread({}, success), {}, {
@@ -163,13 +164,35 @@ function parseRawSimulation(sim) {
163
164
  id: sim.id,
164
165
  latestLedger: sim.latestLedger,
165
166
  events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
166
- return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
167
+ return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, "base64");
167
168
  })) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
168
169
  };
169
- if (typeof sim.error === 'string') {
170
+ if (typeof sim.error === "string") {
170
171
  return _objectSpread(_objectSpread({}, base), {}, {
171
172
  error: sim.error
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
  }