@stellar/stellar-sdk 12.1.0 → 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.
Files changed (65) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +1336 -1101
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/browser.d.ts +1 -1
  6. package/lib/browser.js +4 -4
  7. package/lib/config.js +5 -2
  8. package/lib/contract/assembled_transaction.d.ts +26 -30
  9. package/lib/contract/assembled_transaction.js +28 -36
  10. package/lib/contract/client.d.ts +0 -1
  11. package/lib/contract/client.js +2 -2
  12. package/lib/contract/index.d.ts +0 -1
  13. package/lib/contract/index.js +1 -18
  14. package/lib/contract/sent_transaction.d.ts +9 -10
  15. package/lib/contract/sent_transaction.js +2 -1
  16. package/lib/contract/spec.d.ts +1 -1
  17. package/lib/contract/spec.js +921 -956
  18. package/lib/contract/types.d.ts +5 -0
  19. package/lib/contract/types.js +4 -1
  20. package/lib/contract/utils.d.ts +0 -5
  21. package/lib/contract/utils.js +4 -18
  22. package/lib/errors.d.ts +4 -4
  23. package/lib/federation/server.d.ts +1 -1
  24. package/lib/horizon/account_call_builder.d.ts +2 -3
  25. package/lib/horizon/account_response.d.ts +1 -1
  26. package/lib/horizon/assets_call_builder.d.ts +2 -3
  27. package/lib/horizon/call_builder.d.ts +8 -8
  28. package/lib/horizon/call_builder.js +10 -13
  29. package/lib/horizon/claimable_balances_call_builder.d.ts +3 -4
  30. package/lib/horizon/effect_call_builder.d.ts +2 -3
  31. package/lib/horizon/friendbot_builder.d.ts +0 -1
  32. package/lib/horizon/horizon_api.d.ts +5 -1
  33. package/lib/horizon/horizon_axios_client.js +6 -6
  34. package/lib/horizon/ledger_call_builder.d.ts +2 -3
  35. package/lib/horizon/liquidity_pool_call_builder.d.ts +2 -4
  36. package/lib/horizon/offer_call_builder.d.ts +2 -3
  37. package/lib/horizon/operation_call_builder.d.ts +3 -4
  38. package/lib/horizon/orderbook_call_builder.d.ts +0 -1
  39. package/lib/horizon/path_call_builder.d.ts +1 -2
  40. package/lib/horizon/payment_call_builder.d.ts +2 -3
  41. package/lib/horizon/server.d.ts +29 -10
  42. package/lib/horizon/server.js +98 -55
  43. package/lib/horizon/strict_receive_path_call_builder.d.ts +1 -2
  44. package/lib/horizon/strict_send_path_call_builder.d.ts +1 -2
  45. package/lib/horizon/trade_aggregation_call_builder.d.ts +9 -10
  46. package/lib/horizon/trade_aggregation_call_builder.js +3 -7
  47. package/lib/horizon/trades_call_builder.d.ts +2 -3
  48. package/lib/horizon/transaction_call_builder.d.ts +3 -4
  49. package/lib/horizon/types/assets.d.ts +1 -1
  50. package/lib/horizon/types/effects.d.ts +1 -1
  51. package/lib/horizon/types/offer.d.ts +1 -1
  52. package/lib/index.d.ts +0 -1
  53. package/lib/rpc/api.d.ts +89 -11
  54. package/lib/rpc/browser.d.ts +1 -1
  55. package/lib/rpc/browser.js +4 -4
  56. package/lib/rpc/index.d.ts +0 -1
  57. package/lib/rpc/jsonrpc.js +3 -3
  58. package/lib/rpc/parsers.d.ts +5 -3
  59. package/lib/rpc/parsers.js +52 -23
  60. package/lib/rpc/server.d.ts +51 -18
  61. package/lib/rpc/server.js +200 -153
  62. package/lib/rpc/transaction.d.ts +3 -4
  63. package/lib/rpc/transaction.js +23 -25
  64. package/lib/webauth/utils.js +3 -3
  65. package/package.json +24 -24
package/lib/rpc/api.d.ts CHANGED
@@ -20,28 +20,29 @@ export declare namespace Api {
20
20
  key: string;
21
21
  /** a base-64 encoded {@link xdr.LedgerEntryData} instance */
22
22
  xdr: string;
23
- /** optional, a future ledger number upon which this entry will expire
23
+ /**
24
+ * optional, a future ledger number upon which this entry will expire
24
25
  * based on https://github.com/stellar/soroban-tools/issues/1010
25
26
  */
26
27
  liveUntilLedgerSeq?: number;
27
28
  }
28
- /** An XDR-parsed version of {@link RawLedgerEntryResult} */
29
+ /** An XDR-parsed version of {@link this.RawLedgerEntryResult} */
29
30
  export interface GetLedgerEntriesResponse {
30
31
  entries: LedgerEntryResult[];
31
32
  latestLedger: number;
32
33
  }
33
- /** @see https://soroban.stellar.org/api/methods/getLedgerEntries */
34
+ /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries */
34
35
  export interface RawGetLedgerEntriesResponse {
35
36
  entries?: RawLedgerEntryResult[];
36
37
  latestLedger: number;
37
38
  }
38
- /** @see https://soroban.stellar.org/api/methods/getNetwork */
39
+ /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getNetwork */
39
40
  export interface GetNetworkResponse {
40
41
  friendbotUrl?: string;
41
42
  passphrase: string;
42
43
  protocolVersion: string;
43
44
  }
44
- /** @see https://soroban.stellar.org/api/methods/getLatestLedger */
45
+ /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLatestLedger */
45
46
  export interface GetLatestLedgerResponse {
46
47
  id: string;
47
48
  sequence: number;
@@ -52,7 +53,7 @@ export declare namespace Api {
52
53
  NOT_FOUND = "NOT_FOUND",
53
54
  FAILED = "FAILED"
54
55
  }
55
- /** @see https://soroban.stellar.org/api/methods/getTransaction */
56
+ /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction */
56
57
  export type GetTransactionResponse = GetSuccessfulTransactionResponse | GetFailedTransactionResponse | GetMissingTransactionResponse;
57
58
  interface GetAnyTransactionResponse {
58
59
  status: GetTransactionStatus;
@@ -73,6 +74,7 @@ export declare namespace Api {
73
74
  envelopeXdr: xdr.TransactionEnvelope;
74
75
  resultXdr: xdr.TransactionResult;
75
76
  resultMetaXdr: xdr.TransactionMeta;
77
+ diagnosticEventsXdr?: xdr.DiagnosticEvent[];
76
78
  }
77
79
  export interface GetSuccessfulTransactionResponse extends GetAnyTransactionResponse {
78
80
  status: GetTransactionStatus.SUCCESS;
@@ -83,6 +85,7 @@ export declare namespace Api {
83
85
  envelopeXdr: xdr.TransactionEnvelope;
84
86
  resultXdr: xdr.TransactionResult;
85
87
  resultMetaXdr: xdr.TransactionMeta;
88
+ diagnosticEventsXdr?: xdr.DiagnosticEvent[];
86
89
  returnValue?: xdr.ScVal;
87
90
  }
88
91
  export interface RawGetTransactionResponse {
@@ -98,6 +101,51 @@ export declare namespace Api {
98
101
  resultMetaXdr?: string;
99
102
  ledger?: number;
100
103
  createdAt?: number;
104
+ diagnosticEventsXdr?: string[];
105
+ }
106
+ export interface GetTransactionsRequest {
107
+ startLedger: number;
108
+ cursor?: string;
109
+ limit?: number;
110
+ }
111
+ export interface RawTransactionInfo {
112
+ status: GetTransactionStatus;
113
+ ledger: number;
114
+ createdAt: number;
115
+ applicationOrder: number;
116
+ feeBump: boolean;
117
+ envelopeXdr?: string;
118
+ resultXdr?: string;
119
+ resultMetaXdr?: string;
120
+ diagnosticEventsXdr?: string[];
121
+ }
122
+ export interface TransactionInfo {
123
+ status: GetTransactionStatus;
124
+ ledger: number;
125
+ createdAt: number;
126
+ applicationOrder: number;
127
+ feeBump: boolean;
128
+ envelopeXdr: xdr.TransactionEnvelope;
129
+ resultXdr: xdr.TransactionResult;
130
+ resultMetaXdr: xdr.TransactionMeta;
131
+ returnValue?: xdr.ScVal;
132
+ diagnosticEventsXdr?: xdr.DiagnosticEvent[];
133
+ }
134
+ export interface GetTransactionsResponse {
135
+ transactions: TransactionInfo[];
136
+ latestLedger: number;
137
+ latestLedgerCloseTimestamp: number;
138
+ oldestLedger: number;
139
+ oldestLedgerCloseTimestamp: number;
140
+ cursor: string;
141
+ }
142
+ export interface RawGetTransactionsResponse {
143
+ transactions: RawTransactionInfo[];
144
+ latestLedger: number;
145
+ latestLedgerCloseTimestamp: number;
146
+ oldestLedger: number;
147
+ oldestLedgerCloseTimestamp: number;
148
+ cursor: string;
101
149
  }
102
150
  export type EventType = 'contract' | 'system' | 'diagnostic';
103
151
  export interface EventFilter {
@@ -178,7 +226,7 @@ export declare namespace Api {
178
226
  retval: xdr.ScVal;
179
227
  }
180
228
  /**
181
- * Simplifies {@link RawSimulateTransactionResponse} into separate interfaces
229
+ * Simplifies {@link Api.RawSimulateTransactionResponse} into separate interfaces
182
230
  * based on status:
183
231
  * - on success, this includes all fields, though `result` is only present
184
232
  * if an invocation was simulated (since otherwise there's nothing to
@@ -187,7 +235,7 @@ export declare namespace Api {
187
235
  * fields
188
236
  * - for all other errors, this only includes error fields
189
237
  *
190
- * @see https://soroban.stellar.org/api/methods/simulateTransaction#returns
238
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction
191
239
  */
192
240
  export type SimulateTransactionResponse = SimulateTransactionSuccessResponse | SimulateTransactionRestoreResponse | SimulateTransactionErrorResponse;
193
241
  export interface BaseSimulateTransactionResponse {
@@ -199,7 +247,6 @@ export declare namespace Api {
199
247
  * The field is always present, but may be empty in cases where:
200
248
  * - you didn't simulate an invocation or
201
249
  * - there were no events
202
- * @see {@link humanizeEvents}
203
250
  */
204
251
  events: xdr.DiagnosticEvent[];
205
252
  /** a private field to mark the schema as parsed */
@@ -243,7 +290,7 @@ export declare namespace Api {
243
290
  auth?: string[];
244
291
  xdr: string;
245
292
  }
246
- /** @see https://soroban.stellar.org/api/methods/simulateTransaction#returns */
293
+ /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction */
247
294
  export interface RawSimulateTransactionResponse {
248
295
  id: string;
249
296
  latestLedger: number;
@@ -253,7 +300,8 @@ export declare namespace Api {
253
300
  /** These are xdr.DiagnosticEvents in base64 */
254
301
  events?: string[];
255
302
  minResourceFee?: string;
256
- /** This will only contain a single element if present, because only a single
303
+ /**
304
+ * This will only contain a single element if present, because only a single
257
305
  * invokeHostFunctionOperation is supported per transaction.
258
306
  * */
259
307
  results?: RawSimulateHostFunctionResult[];
@@ -266,5 +314,35 @@ export declare namespace Api {
266
314
  /** State Difference information */
267
315
  stateChanges?: RawLedgerEntryChange[];
268
316
  }
317
+ export interface GetVersionInfoResponse {
318
+ version: string;
319
+ commit_hash: string;
320
+ build_time_stamp: string;
321
+ captive_core_version: string;
322
+ protocol_version: number;
323
+ }
324
+ export interface GetFeeStatsResponse {
325
+ sorobanInclusionFee: FeeDistribution;
326
+ inclusionFee: FeeDistribution;
327
+ latestLedger: number;
328
+ }
329
+ interface FeeDistribution {
330
+ max: string;
331
+ min: string;
332
+ mode: string;
333
+ p10: string;
334
+ p20: string;
335
+ p30: string;
336
+ p40: string;
337
+ p50: string;
338
+ p60: string;
339
+ p70: string;
340
+ p80: string;
341
+ p90: string;
342
+ p95: string;
343
+ p99: string;
344
+ transactionCount: string;
345
+ ledgerCount: number;
346
+ }
269
347
  export {};
270
348
  }
@@ -1,6 +1,6 @@
1
+ import axios from 'axios';
1
2
  export * from './index';
2
3
  export * as StellarBase from '@stellar/stellar-base';
3
- import axios from 'axios';
4
4
  export { axios };
5
5
  declare const _default: any;
6
6
  export default _default;
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  var _exportNames = {
8
- StellarBase: true,
9
- axios: true
8
+ axios: true,
9
+ StellarBase: true
10
10
  };
11
11
  exports.StellarBase = void 0;
12
12
  Object.defineProperty(exports, "axios", {
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "axios", {
16
16
  }
17
17
  });
18
18
  exports.default = void 0;
19
+ var _axios = _interopRequireDefault(require("axios"));
19
20
  var _index = require("./index");
20
21
  Object.keys(_index).forEach(function (key) {
21
22
  if (key === "default" || key === "__esModule") return;
@@ -30,8 +31,7 @@ Object.keys(_index).forEach(function (key) {
30
31
  });
31
32
  var _StellarBase = _interopRequireWildcard(require("@stellar/stellar-base"));
32
33
  exports.StellarBase = _StellarBase;
33
- var _axios = _interopRequireDefault(require("axios"));
34
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
35
34
  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); }
36
35
  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; }
36
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
37
37
  var _default = exports.default = module.exports;
@@ -1,4 +1,3 @@
1
- /// <reference path="../../types/dom-monkeypatch.d.ts" />
2
1
  export * from "./api";
3
2
  export { Server, Durability } from "./server";
4
3
  export { default as AxiosClient } from "./axios";
@@ -10,6 +10,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
10
10
  function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
11
11
  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); }
12
12
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
13
+ function hasOwnProperty(obj, prop) {
14
+ return obj.hasOwnProperty(prop);
15
+ }
13
16
  function postObject(_x, _x2) {
14
17
  return _postObject.apply(this, arguments);
15
18
  }
@@ -46,7 +49,4 @@ function _postObject() {
46
49
  }, _callee);
47
50
  }));
48
51
  return _postObject.apply(this, arguments);
49
- }
50
- function hasOwnProperty(obj, prop) {
51
- return obj.hasOwnProperty(prop);
52
52
  }
@@ -1,17 +1,19 @@
1
1
  import { Api } from './api';
2
2
  export declare function parseRawSendTransaction(r: Api.RawSendTransactionResponse): Api.SendTransactionResponse;
3
+ export declare function parseTransactionInfo(raw: Api.RawTransactionInfo | Api.RawGetTransactionResponse): Omit<Api.TransactionInfo, 'status'>;
4
+ export declare function parseRawTransactions(r: Api.RawTransactionInfo): Api.TransactionInfo;
3
5
  export declare function parseRawEvents(r: Api.RawGetEventsResponse): Api.GetEventsResponse;
4
6
  export declare function parseRawLedgerEntries(raw: Api.RawGetLedgerEntriesResponse): Api.GetLedgerEntriesResponse;
5
7
  /**
6
8
  * Converts a raw response schema into one with parsed XDR fields and a
7
9
  * simplified interface.
10
+ * Warning: This API is only exported for testing purposes and should not be
11
+ * relied on or considered "stable".
8
12
  *
9
- * @param raw the raw response schema (parsed ones are allowed, best-effort
13
+ * @param {Api.SimulateTransactionResponse|Api.RawSimulateTransactionResponse} sim the raw response schema (parsed ones are allowed, best-effort
10
14
  * detected, and returned untouched)
11
15
  *
12
16
  * @returns the original parameter (if already parsed), parsed otherwise
13
17
  *
14
- * @warning This API is only exported for testing purposes and should not be
15
- * relied on or considered "stable".
16
18
  */
17
19
  export declare function parseRawSimulation(sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse): Api.SimulateTransactionResponse;
@@ -7,6 +7,8 @@ exports.parseRawEvents = parseRawEvents;
7
7
  exports.parseRawLedgerEntries = parseRawLedgerEntries;
8
8
  exports.parseRawSendTransaction = parseRawSendTransaction;
9
9
  exports.parseRawSimulation = parseRawSimulation;
10
+ exports.parseRawTransactions = parseRawTransactions;
11
+ exports.parseTransactionInfo = parseTransactionInfo;
10
12
  var _stellarBase = require("@stellar/stellar-base");
11
13
  var _api = require("./api");
12
14
  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); }
@@ -20,7 +22,7 @@ function parseRawSendTransaction(r) {
20
22
  diagnosticEventsXdr = r.diagnosticEventsXdr;
21
23
  delete r.errorResultXdr;
22
24
  delete r.diagnosticEventsXdr;
23
- if (!!errorResultXdr) {
25
+ if (errorResultXdr) {
24
26
  return _objectSpread(_objectSpread(_objectSpread({}, r), diagnosticEventsXdr !== undefined && diagnosticEventsXdr.length > 0 && {
25
27
  diagnosticEvents: diagnosticEventsXdr.map(function (evt) {
26
28
  return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
@@ -31,6 +33,33 @@ function parseRawSendTransaction(r) {
31
33
  }
32
34
  return _objectSpread({}, r);
33
35
  }
36
+ function parseTransactionInfo(raw) {
37
+ var meta = _stellarBase.xdr.TransactionMeta.fromXDR(raw.resultMetaXdr, 'base64');
38
+ var info = {
39
+ ledger: raw.ledger,
40
+ createdAt: raw.createdAt,
41
+ applicationOrder: raw.applicationOrder,
42
+ feeBump: raw.feeBump,
43
+ envelopeXdr: _stellarBase.xdr.TransactionEnvelope.fromXDR(raw.envelopeXdr, 'base64'),
44
+ resultXdr: _stellarBase.xdr.TransactionResult.fromXDR(raw.resultXdr, 'base64'),
45
+ resultMetaXdr: meta
46
+ };
47
+ if (meta.switch() === 3 && meta.v3().sorobanMeta() !== null) {
48
+ var _meta$v3$sorobanMeta;
49
+ info.returnValue = (_meta$v3$sorobanMeta = meta.v3().sorobanMeta()) === null || _meta$v3$sorobanMeta === void 0 ? void 0 : _meta$v3$sorobanMeta.returnValue();
50
+ }
51
+ if ('diagnosticEventsXdr' in raw && raw.diagnosticEventsXdr) {
52
+ info.diagnosticEventsXdr = raw.diagnosticEventsXdr.map(function (diagnosticEvent) {
53
+ return _stellarBase.xdr.DiagnosticEvent.fromXDR(diagnosticEvent, 'base64');
54
+ });
55
+ }
56
+ return info;
57
+ }
58
+ function parseRawTransactions(r) {
59
+ return _objectSpread({
60
+ status: r.status
61
+ }, parseTransactionInfo(r));
62
+ }
34
63
  function parseRawEvents(r) {
35
64
  var _r$events;
36
65
  return {
@@ -67,27 +96,6 @@ function parseRawLedgerEntries(raw) {
67
96
  })
68
97
  };
69
98
  }
70
- function parseRawSimulation(sim) {
71
- var _sim$events$map, _sim$events;
72
- var looksRaw = _api.Api.isSimulationRaw(sim);
73
- if (!looksRaw) {
74
- return sim;
75
- }
76
- var base = {
77
- _parsed: true,
78
- id: sim.id,
79
- latestLedger: sim.latestLedger,
80
- events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
81
- return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
82
- })) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
83
- };
84
- if (typeof sim.error === 'string') {
85
- return _objectSpread(_objectSpread({}, base), {}, {
86
- error: sim.error
87
- });
88
- }
89
- return parseSuccessful(sim, base);
90
- }
91
99
  function parseSuccessful(sim, partial) {
92
100
  var _sim$results$length, _sim$results, _sim$stateChanges$len, _sim$stateChanges, _sim$stateChanges2;
93
101
  var success = _objectSpread(_objectSpread(_objectSpread({}, partial), {}, {
@@ -101,7 +109,7 @@ function parseSuccessful(sim, partial) {
101
109
  auth: ((_row$auth = row.auth) !== null && _row$auth !== void 0 ? _row$auth : []).map(function (entry) {
102
110
  return _stellarBase.xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64');
103
111
  }),
104
- retval: !!row.xdr ? _stellarBase.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellarBase.xdr.ScVal.scvVoid()
112
+ retval: row.xdr ? _stellarBase.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellarBase.xdr.ScVal.scvVoid()
105
113
  };
106
114
  })[0]
107
115
  }), ((_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) && {
@@ -123,4 +131,25 @@ function parseSuccessful(sim, partial) {
123
131
  transactionData: new _stellarBase.SorobanDataBuilder(sim.restorePreamble.transactionData)
124
132
  }
125
133
  });
134
+ }
135
+ function parseRawSimulation(sim) {
136
+ var _sim$events$map, _sim$events;
137
+ var looksRaw = _api.Api.isSimulationRaw(sim);
138
+ if (!looksRaw) {
139
+ return sim;
140
+ }
141
+ var base = {
142
+ _parsed: true,
143
+ id: sim.id,
144
+ latestLedger: sim.latestLedger,
145
+ events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
146
+ return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
147
+ })) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
148
+ };
149
+ if (typeof sim.error === 'string') {
150
+ return _objectSpread(_objectSpread({}, base), {}, {
151
+ error: sim.error
152
+ });
153
+ }
154
+ return parseSuccessful(sim, base);
126
155
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import URI from 'urijs';
3
2
  import { Account, Address, Contract, FeeBumpTransaction, Transaction, xdr } from '@stellar/stellar-base';
4
3
  import { Api } from './api';
@@ -30,7 +29,7 @@ export declare namespace Server {
30
29
  * Handles the network connection to a Soroban RPC instance, exposing an
31
30
  * interface for requests to that instance.
32
31
  *
33
- * @constructor
32
+ * @class
34
33
  *
35
34
  * @param {string} serverURL Soroban-RPC Server URL (ex.
36
35
  * `http://localhost:8000/soroban/rpc`).
@@ -57,7 +56,7 @@ export declare class Server {
57
56
  * @returns {Promise<Account>} a promise to the {@link Account} object with
58
57
  * a populated sequence number
59
58
  *
60
- * @see https://soroban.stellar.org/api/methods/getLedgerEntries
59
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries
61
60
  * @example
62
61
  * const accountId = "GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4";
63
62
  * server.getAccount(accountId).then((account) => {
@@ -72,7 +71,7 @@ export declare class Server {
72
71
  * {@link Api.GetHealthResponse} object with the status of the
73
72
  * server (e.g. "healthy").
74
73
  *
75
- * @see https://soroban.stellar.org/api/methods/getHealth
74
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getHealth
76
75
  * @example
77
76
  * server.getHealth().then((health) => {
78
77
  * console.log("status:", health.status);
@@ -85,6 +84,8 @@ export declare class Server {
85
84
  * Allows you to directly inspect the current state of a contract. This is a
86
85
  * backup way to access your contract data which may not be available via
87
86
  * events or {@link Server.simulateTransaction}.
87
+ * Warning: If the data entry in question is a 'temporary' entry, it's
88
+ * entirely possible that it has expired out of existence.
88
89
  *
89
90
  * @param {string|Address|Contract} contract the contract ID containing the
90
91
  * data to load as a strkey (`C...` form), a {@link Contract}, or an
@@ -96,10 +97,7 @@ export declare class Server {
96
97
  *
97
98
  * @returns {Promise<Api.LedgerEntryResult>} the current data value
98
99
  *
99
- * @warning If the data entry in question is a 'temporary' entry, it's
100
- * entirely possible that it has expired out of existence.
101
- *
102
- * @see https://soroban.stellar.org/api/methods/getLedgerEntries
100
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries
103
101
  * @example
104
102
  * const contractId = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5";
105
103
  * const key = xdr.ScVal.scvSymbol("counter");
@@ -176,7 +174,7 @@ export declare class Server {
176
174
  * on-chain values for the given ledger keys
177
175
  *
178
176
  * @see Server._getLedgerEntries
179
- * @see https://soroban.stellar.org/api/methods/getLedgerEntries
177
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries
180
178
  * @example
181
179
  * const contractId = "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM";
182
180
  * const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({
@@ -206,7 +204,7 @@ export declare class Server {
206
204
  * @returns {Promise<Api.GetTransactionResponse>} the status,
207
205
  * result, and other details about the transaction
208
206
  *
209
- * @see https://soroban.stellar.org/api/methods/getTransaction
207
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction
210
208
  * @example
211
209
  * const transactionHash = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a";
212
210
  * server.getTransaction(transactionHash).then((tx) => {
@@ -218,6 +216,26 @@ export declare class Server {
218
216
  */
219
217
  getTransaction(hash: string): Promise<Api.GetTransactionResponse>;
220
218
  _getTransaction(hash: string): Promise<Api.RawGetTransactionResponse>;
219
+ /**
220
+ * Fetch transactions starting from a given start ledger or a cursor. The end ledger is the latest ledger
221
+ * in that RPC instance.
222
+ *
223
+ * @param {Api.GetTransactionsRequest} request - The request parameters.
224
+ * @returns {Promise<Api.GetTransactionsResponse>} - A promise that resolves to the transactions response.
225
+ *
226
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransactions
227
+ * @example
228
+ * server.getTransactions({
229
+ * startLedger: 10000,
230
+ * limit: 10,
231
+ * }).then((response) => {
232
+ * console.log("Transactions:", response.transactions);
233
+ * console.log("Latest Ledger:", response.latestLedger);
234
+ * console.log("Cursor:", response.cursor);
235
+ * });
236
+ */
237
+ getTransactions(request: Api.GetTransactionsRequest): Promise<Api.GetTransactionsResponse>;
238
+ private _getTransactions;
221
239
  /**
222
240
  * Fetch all events that match a given set of filters.
223
241
  *
@@ -232,7 +250,7 @@ export declare class Server {
232
250
  * @returns {Promise<Api.GetEventsResponse>} a paginatable set of the
233
251
  * events matching the given event filters
234
252
  *
235
- * @see https://soroban.stellar.org/api/methods/getEvents
253
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents
236
254
  * @example
237
255
  * server.getEvents({
238
256
  * startLedger: 1000,
@@ -264,7 +282,7 @@ export declare class Server {
264
282
  * @returns {Promise<Api.GetNetworkResponse>} metadata about the
265
283
  * current network this RPC server is connected to
266
284
  *
267
- * @see https://soroban.stellar.org/api/methods/getNetwork
285
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getNetwork
268
286
  * @example
269
287
  * server.getNetwork().then((network) => {
270
288
  * console.log("friendbotUrl:", network.friendbotUrl);
@@ -280,7 +298,7 @@ export declare class Server {
280
298
  * @returns {Promise<Api.GetLatestLedgerResponse>} metadata about the
281
299
  * latest ledger on the network that this RPC server is connected to
282
300
  *
283
- * @see https://soroban.stellar.org/api/methods/getLatestLedger
301
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLatestLedger
284
302
  * @example
285
303
  * server.getLatestLedger().then((response) => {
286
304
  * console.log("hash:", response.id);
@@ -293,7 +311,7 @@ export declare class Server {
293
311
  * Submit a trial contract invocation to get back return values, expected
294
312
  * ledger footprint, expected authorizations, and expected costs.
295
313
  *
296
- * @param {Transaction | FeeBumpTransaction} transaction the transaction to
314
+ * @param {Transaction | FeeBumpTransaction} tx the transaction to
297
315
  * simulate, which should include exactly one operation (one of
298
316
  * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTTLOp}, or
299
317
  * {@link xdr.RestoreFootprintOp}). Any provided footprint or auth
@@ -304,7 +322,7 @@ export declare class Server {
304
322
  * the transaction
305
323
  *
306
324
  * @see https://developers.stellar.org/docs/glossary/transactions/
307
- * @see https://soroban.stellar.org/api/methods/simulateTransaction
325
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction
308
326
  * @see Server.prepareTransaction
309
327
  * @see assembleTransaction
310
328
  *
@@ -350,7 +368,7 @@ export declare class Server {
350
368
  * if you want to inspect estimated fees for a given transaction in detail
351
369
  * first, then re-assemble it manually or via {@link assembleTransaction}.
352
370
  *
353
- * @param {Transaction | FeeBumpTransaction} transaction the transaction to
371
+ * @param {Transaction | FeeBumpTransaction} tx the transaction to
354
372
  * prepare. It should include exactly one operation, which must be one of
355
373
  * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTTLOp},
356
374
  * or {@link xdr.RestoreFootprintOp}.
@@ -368,7 +386,7 @@ export declare class Server {
368
386
  * fees discovered from the simulation.
369
387
  *
370
388
  * @see assembleTransaction
371
- * @see https://soroban.stellar.org/api/methods/simulateTransaction
389
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction
372
390
  * @throws {jsonrpc.Error<any>|Error|Api.SimulateTransactionErrorResponse}
373
391
  * if simulation fails
374
392
  * @example
@@ -416,7 +434,7 @@ export declare class Server {
416
434
  * transaction id, status, and any error if available
417
435
  *
418
436
  * @see https://developers.stellar.org/docs/glossary/transactions/
419
- * @see https://soroban.stellar.org/api/methods/sendTransaction
437
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/sendTransaction
420
438
  * @example
421
439
  * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
422
440
  * const contract = new StellarSdk.Contract(contractId);
@@ -478,4 +496,19 @@ export declare class Server {
478
496
  * });
479
497
  */
480
498
  requestAirdrop(address: string | Pick<Account, 'accountId'>, friendbotUrl?: string): Promise<Account>;
499
+ /**
500
+ * Provides an analysis of the recent fee stats for regular and smart
501
+ * contract operations.
502
+ *
503
+ * @returns {Promise<Api.GetFeeStatsResponse>} the fee stats
504
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getFeeStats
505
+ */
506
+ getFeeStats(): Promise<Api.GetFeeStatsResponse>;
507
+ /**
508
+ * Provides information about the current version details of the Soroban RPC and captive-core
509
+ *
510
+ * @returns {Promise<Api.GetVersionInfoResponse>} the version info
511
+ * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getVersionInfo
512
+ */
513
+ getVersionInfo(): Promise<Api.GetVersionInfoResponse>;
481
514
  }