@stellar/stellar-sdk 12.1.0 → 12.2.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 (64) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/stellar-sdk.js +848 -815
  3. package/dist/stellar-sdk.min.js +1 -1
  4. package/lib/browser.d.ts +1 -1
  5. package/lib/browser.js +4 -4
  6. package/lib/config.js +5 -2
  7. package/lib/contract/assembled_transaction.d.ts +25 -27
  8. package/lib/contract/assembled_transaction.js +6 -6
  9. package/lib/contract/client.d.ts +0 -1
  10. package/lib/contract/client.js +2 -2
  11. package/lib/contract/index.d.ts +0 -1
  12. package/lib/contract/index.js +1 -18
  13. package/lib/contract/sent_transaction.d.ts +9 -10
  14. package/lib/contract/sent_transaction.js +2 -1
  15. package/lib/contract/spec.d.ts +1 -1
  16. package/lib/contract/spec.js +921 -956
  17. package/lib/contract/types.d.ts +5 -0
  18. package/lib/contract/types.js +4 -1
  19. package/lib/contract/utils.d.ts +0 -5
  20. package/lib/contract/utils.js +4 -18
  21. package/lib/errors.d.ts +4 -4
  22. package/lib/federation/server.d.ts +1 -1
  23. package/lib/horizon/account_call_builder.d.ts +2 -3
  24. package/lib/horizon/account_response.d.ts +1 -1
  25. package/lib/horizon/assets_call_builder.d.ts +2 -3
  26. package/lib/horizon/call_builder.d.ts +8 -8
  27. package/lib/horizon/call_builder.js +2 -6
  28. package/lib/horizon/claimable_balances_call_builder.d.ts +3 -4
  29. package/lib/horizon/effect_call_builder.d.ts +2 -3
  30. package/lib/horizon/friendbot_builder.d.ts +0 -1
  31. package/lib/horizon/horizon_api.d.ts +5 -1
  32. package/lib/horizon/horizon_axios_client.js +6 -6
  33. package/lib/horizon/ledger_call_builder.d.ts +2 -3
  34. package/lib/horizon/liquidity_pool_call_builder.d.ts +2 -4
  35. package/lib/horizon/offer_call_builder.d.ts +2 -3
  36. package/lib/horizon/operation_call_builder.d.ts +3 -4
  37. package/lib/horizon/orderbook_call_builder.d.ts +0 -1
  38. package/lib/horizon/path_call_builder.d.ts +1 -2
  39. package/lib/horizon/payment_call_builder.d.ts +2 -3
  40. package/lib/horizon/server.d.ts +29 -10
  41. package/lib/horizon/server.js +98 -55
  42. package/lib/horizon/strict_receive_path_call_builder.d.ts +1 -2
  43. package/lib/horizon/strict_send_path_call_builder.d.ts +1 -2
  44. package/lib/horizon/trade_aggregation_call_builder.d.ts +9 -10
  45. package/lib/horizon/trade_aggregation_call_builder.js +3 -7
  46. package/lib/horizon/trades_call_builder.d.ts +2 -3
  47. package/lib/horizon/transaction_call_builder.d.ts +3 -4
  48. package/lib/horizon/types/assets.d.ts +1 -1
  49. package/lib/horizon/types/effects.d.ts +1 -1
  50. package/lib/horizon/types/offer.d.ts +1 -1
  51. package/lib/index.d.ts +0 -1
  52. package/lib/rpc/api.d.ts +29 -5
  53. package/lib/rpc/browser.d.ts +1 -1
  54. package/lib/rpc/browser.js +4 -4
  55. package/lib/rpc/index.d.ts +0 -1
  56. package/lib/rpc/jsonrpc.js +3 -3
  57. package/lib/rpc/parsers.d.ts +3 -3
  58. package/lib/rpc/parsers.js +23 -23
  59. package/lib/rpc/server.d.ts +13 -7
  60. package/lib/rpc/server.js +48 -56
  61. package/lib/rpc/transaction.d.ts +3 -4
  62. package/lib/rpc/transaction.js +23 -25
  63. package/lib/webauth/utils.js +3 -3
  64. package/package.json +17 -17
@@ -5,13 +5,13 @@ export declare function parseRawLedgerEntries(raw: Api.RawGetLedgerEntriesRespon
5
5
  /**
6
6
  * Converts a raw response schema into one with parsed XDR fields and a
7
7
  * simplified interface.
8
+ * Warning: This API is only exported for testing purposes and should not be
9
+ * relied on or considered "stable".
8
10
  *
9
- * @param raw the raw response schema (parsed ones are allowed, best-effort
11
+ * @param {Api.SimulateTransactionResponse|Api.RawSimulateTransactionResponse} sim the raw response schema (parsed ones are allowed, best-effort
10
12
  * detected, and returned untouched)
11
13
  *
12
14
  * @returns the original parameter (if already parsed), parsed otherwise
13
15
  *
14
- * @warning This API is only exported for testing purposes and should not be
15
- * relied on or considered "stable".
16
16
  */
17
17
  export declare function parseRawSimulation(sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse): Api.SimulateTransactionResponse;
@@ -20,7 +20,7 @@ function parseRawSendTransaction(r) {
20
20
  diagnosticEventsXdr = r.diagnosticEventsXdr;
21
21
  delete r.errorResultXdr;
22
22
  delete r.diagnosticEventsXdr;
23
- if (!!errorResultXdr) {
23
+ if (errorResultXdr) {
24
24
  return _objectSpread(_objectSpread(_objectSpread({}, r), diagnosticEventsXdr !== undefined && diagnosticEventsXdr.length > 0 && {
25
25
  diagnosticEvents: diagnosticEventsXdr.map(function (evt) {
26
26
  return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
@@ -67,27 +67,6 @@ function parseRawLedgerEntries(raw) {
67
67
  })
68
68
  };
69
69
  }
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
70
  function parseSuccessful(sim, partial) {
92
71
  var _sim$results$length, _sim$results, _sim$stateChanges$len, _sim$stateChanges, _sim$stateChanges2;
93
72
  var success = _objectSpread(_objectSpread(_objectSpread({}, partial), {}, {
@@ -101,7 +80,7 @@ function parseSuccessful(sim, partial) {
101
80
  auth: ((_row$auth = row.auth) !== null && _row$auth !== void 0 ? _row$auth : []).map(function (entry) {
102
81
  return _stellarBase.xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64');
103
82
  }),
104
- retval: !!row.xdr ? _stellarBase.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellarBase.xdr.ScVal.scvVoid()
83
+ retval: row.xdr ? _stellarBase.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellarBase.xdr.ScVal.scvVoid()
105
84
  };
106
85
  })[0]
107
86
  }), ((_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 +102,25 @@ function parseSuccessful(sim, partial) {
123
102
  transactionData: new _stellarBase.SorobanDataBuilder(sim.restorePreamble.transactionData)
124
103
  }
125
104
  });
105
+ }
106
+ function parseRawSimulation(sim) {
107
+ var _sim$events$map, _sim$events;
108
+ var looksRaw = _api.Api.isSimulationRaw(sim);
109
+ if (!looksRaw) {
110
+ return sim;
111
+ }
112
+ var base = {
113
+ _parsed: true,
114
+ id: sim.id,
115
+ latestLedger: sim.latestLedger,
116
+ events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
117
+ return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
118
+ })) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
119
+ };
120
+ if (typeof sim.error === 'string') {
121
+ return _objectSpread(_objectSpread({}, base), {}, {
122
+ error: sim.error
123
+ });
124
+ }
125
+ return parseSuccessful(sim, base);
126
126
  }
@@ -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`).
@@ -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,9 +97,6 @@ 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
100
  * @see https://soroban.stellar.org/api/methods/getLedgerEntries
103
101
  * @example
104
102
  * const contractId = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5";
@@ -293,7 +291,7 @@ export declare class Server {
293
291
  * Submit a trial contract invocation to get back return values, expected
294
292
  * ledger footprint, expected authorizations, and expected costs.
295
293
  *
296
- * @param {Transaction | FeeBumpTransaction} transaction the transaction to
294
+ * @param {Transaction | FeeBumpTransaction} tx the transaction to
297
295
  * simulate, which should include exactly one operation (one of
298
296
  * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTTLOp}, or
299
297
  * {@link xdr.RestoreFootprintOp}). Any provided footprint or auth
@@ -350,7 +348,7 @@ export declare class Server {
350
348
  * if you want to inspect estimated fees for a given transaction in detail
351
349
  * first, then re-assemble it manually or via {@link assembleTransaction}.
352
350
  *
353
- * @param {Transaction | FeeBumpTransaction} transaction the transaction to
351
+ * @param {Transaction | FeeBumpTransaction} tx the transaction to
354
352
  * prepare. It should include exactly one operation, which must be one of
355
353
  * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTTLOp},
356
354
  * or {@link xdr.RestoreFootprintOp}.
@@ -478,4 +476,12 @@ export declare class Server {
478
476
  * });
479
477
  */
480
478
  requestAirdrop(address: string | Pick<Account, 'accountId'>, friendbotUrl?: string): Promise<Account>;
479
+ /**
480
+ * Provides an analysis of the recent fee stats for regular and smart
481
+ * contract operations.
482
+ *
483
+ * @returns {Promise<Api.GetFeeStatsResponse>} the fee stats
484
+ * @see https://soroban.stellar.org/api/methods/getFeeStats
485
+ */
486
+ getFeeStats(): Promise<Api.GetFeeStatsResponse>;
481
487
  }
package/lib/rpc/server.js CHANGED
@@ -15,9 +15,6 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
15
15
  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; }
16
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
17
  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); }
18
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
19
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
20
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
21
18
  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; }
22
19
  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; }
23
20
  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; }
@@ -35,12 +32,37 @@ var Durability = exports.Durability = function (Durability) {
35
32
  Durability["Persistent"] = "persistent";
36
33
  return Durability;
37
34
  }({});
35
+ function findCreatedAccountSequenceInTransactionMeta(meta) {
36
+ var _operations$flatMap$f;
37
+ var operations = [];
38
+ switch (meta.switch()) {
39
+ case 0:
40
+ operations = meta.operations();
41
+ break;
42
+ case 1:
43
+ case 2:
44
+ case 3:
45
+ operations = meta.value().operations();
46
+ break;
47
+ default:
48
+ throw new Error('Unexpected transaction meta switch value');
49
+ }
50
+ var sequenceNumber = (_operations$flatMap$f = operations.flatMap(function (op) {
51
+ return op.changes();
52
+ }).find(function (c) {
53
+ return c.switch() === _stellarBase.xdr.LedgerEntryChangeType.ledgerEntryCreated() && c.created().data().switch() === _stellarBase.xdr.LedgerEntryType.account();
54
+ })) === null || _operations$flatMap$f === void 0 || (_operations$flatMap$f = _operations$flatMap$f.created()) === null || _operations$flatMap$f === void 0 || (_operations$flatMap$f = _operations$flatMap$f.data()) === null || _operations$flatMap$f === void 0 || (_operations$flatMap$f = _operations$flatMap$f.account()) === null || _operations$flatMap$f === void 0 || (_operations$flatMap$f = _operations$flatMap$f.seqNum()) === null || _operations$flatMap$f === void 0 ? void 0 : _operations$flatMap$f.toString();
55
+ if (sequenceNumber) {
56
+ return sequenceNumber;
57
+ }
58
+ throw new Error('No account created in transaction');
59
+ }
38
60
  var Server = exports.Server = function () {
39
61
  function Server(serverURL) {
40
62
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
41
63
  _classCallCheck(this, Server);
42
64
  this.serverURL = (0, _urijs.default)(serverURL);
43
- if (opts.headers && Object.keys(opts.headers).length === 0) {
65
+ if (opts.headers && Object.keys(opts.headers).length !== 0) {
44
66
  _axios.default.interceptors.request.use(function (config) {
45
67
  config.headers = Object.assign(config.headers, opts.headers);
46
68
  return config;
@@ -433,11 +455,8 @@ var Server = exports.Server = function () {
433
455
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
434
456
  while (1) switch (_context12.prev = _context12.next) {
435
457
  case 0:
436
- _context12.next = 2;
437
- return jsonrpc.postObject(this.serverURL.toString(), 'getNetwork');
438
- case 2:
439
- return _context12.abrupt("return", _context12.sent);
440
- case 3:
458
+ return _context12.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getNetwork'));
459
+ case 1:
441
460
  case "end":
442
461
  return _context12.stop();
443
462
  }
@@ -527,7 +546,7 @@ var Server = exports.Server = function () {
527
546
  _context16.next = 5;
528
547
  break;
529
548
  }
530
- throw simResponse.error;
549
+ throw new Error(simResponse.error);
531
550
  case 5:
532
551
  return _context16.abrupt("return", (0, _transaction.assembleTransaction)(tx, simResponse).build());
533
552
  case 6:
@@ -640,51 +659,24 @@ var Server = exports.Server = function () {
640
659
  }
641
660
  return requestAirdrop;
642
661
  }())
643
- }]);
644
- }();
645
- function findCreatedAccountSequenceInTransactionMeta(meta) {
646
- var operations = [];
647
- switch (meta.switch()) {
648
- case 0:
649
- operations = meta.operations();
650
- break;
651
- case 1:
652
- case 2:
653
- case 3:
654
- operations = meta.value().operations();
655
- break;
656
- default:
657
- throw new Error('Unexpected transaction meta switch value');
658
- }
659
- var _iterator = _createForOfIteratorHelper(operations),
660
- _step;
661
- try {
662
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
663
- var op = _step.value;
664
- var _iterator2 = _createForOfIteratorHelper(op.changes()),
665
- _step2;
666
- try {
667
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
668
- var c = _step2.value;
669
- if (c.switch() !== _stellarBase.xdr.LedgerEntryChangeType.ledgerEntryCreated()) {
670
- continue;
671
- }
672
- var data = c.created().data();
673
- if (data.switch() !== _stellarBase.xdr.LedgerEntryType.account()) {
674
- continue;
662
+ }, {
663
+ key: "getFeeStats",
664
+ value: (function () {
665
+ var _getFeeStats = _asyncToGenerator(_regeneratorRuntime().mark(function _callee20() {
666
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
667
+ while (1) switch (_context20.prev = _context20.next) {
668
+ case 0:
669
+ return _context20.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getFeeStats'));
670
+ case 1:
671
+ case "end":
672
+ return _context20.stop();
675
673
  }
676
- return data.account().seqNum().toString();
677
- }
678
- } catch (err) {
679
- _iterator2.e(err);
680
- } finally {
681
- _iterator2.f();
674
+ }, _callee20, this);
675
+ }));
676
+ function getFeeStats() {
677
+ return _getFeeStats.apply(this, arguments);
682
678
  }
683
- }
684
- } catch (err) {
685
- _iterator.e(err);
686
- } finally {
687
- _iterator.f();
688
- }
689
- throw new Error('No account created in transaction');
690
- }
679
+ return getFeeStats;
680
+ }())
681
+ }]);
682
+ }();
@@ -2,6 +2,9 @@ import { FeeBumpTransaction, Transaction, TransactionBuilder } from '@stellar/st
2
2
  import { Api } from './api';
3
3
  /**
4
4
  * Combines the given raw transaction alongside the simulation results.
5
+ * If the given transaction already has authorization entries in a host
6
+ * function invocation (see {@link Operation.invokeHostFunction}), **the
7
+ * simulation entries are ignored**.
5
8
  *
6
9
  * @param raw the initial transaction, w/o simulation applied
7
10
  * @param simulation the Soroban RPC simulation result (see
@@ -10,10 +13,6 @@ import { Api } from './api';
10
13
  * @returns a new, cloned transaction with the proper auth and resource (fee,
11
14
  * footprint) simulation data applied
12
15
  *
13
- * @note if the given transaction already has authorization entries in a host
14
- * function invocation (see {@link Operation.invokeHostFunction}), **the
15
- * simulation entries are ignored**.
16
- *
17
16
  * @see {Server.simulateTransaction}
18
17
  * @see {Server.prepareTransaction}
19
18
  */
@@ -7,8 +7,20 @@ exports.assembleTransaction = assembleTransaction;
7
7
  var _stellarBase = require("@stellar/stellar-base");
8
8
  var _api = require("./api");
9
9
  var _parsers = require("./parsers");
10
+ function isSorobanTransaction(tx) {
11
+ if (tx.operations.length !== 1) {
12
+ return false;
13
+ }
14
+ switch (tx.operations[0].type) {
15
+ case 'invokeHostFunction':
16
+ case 'extendFootprintTtl':
17
+ case 'restoreFootprint':
18
+ return true;
19
+ default:
20
+ return false;
21
+ }
22
+ }
10
23
  function assembleTransaction(raw, simulation) {
11
- var _invokeOp$auth;
12
24
  if ('innerTransaction' in raw) {
13
25
  return assembleTransaction(raw.innerTransaction, simulation);
14
26
  }
@@ -26,30 +38,16 @@ function assembleTransaction(raw, simulation) {
26
38
  sorobanData: success.transactionData.build(),
27
39
  networkPassphrase: raw.networkPassphrase
28
40
  });
29
- switch (raw.operations[0].type) {
30
- case 'invokeHostFunction':
31
- txnBuilder.clearOperations();
32
- var invokeOp = raw.operations[0];
33
- var existingAuth = (_invokeOp$auth = invokeOp.auth) !== null && _invokeOp$auth !== void 0 ? _invokeOp$auth : [];
34
- txnBuilder.addOperation(_stellarBase.Operation.invokeHostFunction({
35
- source: invokeOp.source,
36
- func: invokeOp.func,
37
- auth: existingAuth.length > 0 ? existingAuth : success.result.auth
38
- }));
39
- break;
41
+ if (raw.operations[0].type === 'invokeHostFunction') {
42
+ var _invokeOp$auth;
43
+ txnBuilder.clearOperations();
44
+ var invokeOp = raw.operations[0];
45
+ var existingAuth = (_invokeOp$auth = invokeOp.auth) !== null && _invokeOp$auth !== void 0 ? _invokeOp$auth : [];
46
+ txnBuilder.addOperation(_stellarBase.Operation.invokeHostFunction({
47
+ source: invokeOp.source,
48
+ func: invokeOp.func,
49
+ auth: existingAuth.length > 0 ? existingAuth : success.result.auth
50
+ }));
40
51
  }
41
52
  return txnBuilder;
42
- }
43
- function isSorobanTransaction(tx) {
44
- if (tx.operations.length !== 1) {
45
- return false;
46
- }
47
- switch (tx.operations[0].type) {
48
- case 'invokeHostFunction':
49
- case 'extendFootprintTtl':
50
- case 'restoreFootprint':
51
- return true;
52
- default:
53
- return false;
54
- }
55
53
  }
@@ -214,7 +214,7 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
214
214
  try {
215
215
  serverKP = _stellarBase.Keypair.fromPublicKey(serverAccountID);
216
216
  } catch (err) {
217
- throw new Error("Couldn't infer keypair from the provided 'serverAccountID': " + err.message);
217
+ throw new Error("Couldn't infer keypair from the provided 'serverAccountID': ".concat(err.message));
218
218
  }
219
219
  var clientSigners = new Set();
220
220
  var _iterator2 = _createForOfIteratorHelper(signers),
@@ -273,7 +273,7 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
273
273
  }
274
274
  }
275
275
  if (!serverSignatureFound) {
276
- throw new _errors.InvalidChallengeError("Transaction not signed by server: '" + serverKP.publicKey() + "'");
276
+ throw new _errors.InvalidChallengeError("Transaction not signed by server: '".concat(serverKP.publicKey(), "'"));
277
277
  }
278
278
  if (clientSigningKey && !clientSigningKeySignatureFound) {
279
279
  throw new _errors.InvalidChallengeError("Transaction not signed by the source account of the 'client_domain' " + "ManageData operation");
@@ -309,7 +309,7 @@ function gatherTxSigners(transaction, signers) {
309
309
  try {
310
310
  keypair = _stellarBase.Keypair.fromPublicKey(signer);
311
311
  } catch (err) {
312
- throw new _errors.InvalidChallengeError("Signer is not a valid address: " + err.message);
312
+ throw new _errors.InvalidChallengeError("Signer is not a valid address: ".concat(err.message));
313
313
  }
314
314
  for (var i = 0; i < txSignatures.length; i++) {
315
315
  var decSig = txSignatures[i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar/stellar-sdk",
3
- "version": "12.1.0",
3
+ "version": "12.2.0",
4
4
  "description": "A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.",
5
5
  "keywords": [
6
6
  "stellar"
@@ -93,26 +93,26 @@
93
93
  ]
94
94
  },
95
95
  "devDependencies": {
96
- "@babel/cli": "^7.24.7",
97
- "@babel/core": "^7.24.7",
96
+ "@babel/cli": "^7.24.8",
97
+ "@babel/core": "^7.24.9",
98
98
  "@babel/eslint-plugin": "^7.24.7",
99
- "@babel/preset-env": "^7.24.7",
99
+ "@babel/preset-env": "^7.24.8",
100
100
  "@babel/preset-typescript": "^7.24.7",
101
101
  "@babel/register": "^7.24.6",
102
- "@definitelytyped/dtslint": "^0.2.20",
102
+ "@definitelytyped/dtslint": "^0.2.22",
103
103
  "@istanbuljs/nyc-config-babel": "3.0.0",
104
104
  "@stellar/tsconfig": "^1.0.2",
105
105
  "@types/chai": "^4.3.14",
106
106
  "@types/detect-node": "^2.0.0",
107
107
  "@types/eventsource": "^1.1.12",
108
108
  "@types/json-schema": "^7.0.15",
109
- "@types/lodash": "^4.17.5",
110
- "@types/mocha": "^10.0.2",
111
- "@types/node": "^20.14.2",
109
+ "@types/lodash": "^4.17.7",
110
+ "@types/mocha": "^10.0.7",
111
+ "@types/node": "^20.14.11",
112
112
  "@types/randombytes": "^2.0.1",
113
113
  "@types/sinon": "^17.0.2",
114
114
  "@types/urijs": "^1.19.20",
115
- "@typescript-eslint/parser": "^7.13.0",
115
+ "@typescript-eslint/parser": "^7.16.1",
116
116
  "axios-mock-adapter": "^1.22.0",
117
117
  "babel-loader": "^9.1.3",
118
118
  "babel-plugin-istanbul": "^6.1.1",
@@ -127,13 +127,13 @@
127
127
  "eslint-config-airbnb-typescript": "^18.0.0",
128
128
  "eslint-config-prettier": "^9.0.0",
129
129
  "eslint-plugin-import": "^2.29.1",
130
- "eslint-plugin-jsdoc": "^48.2.12",
130
+ "eslint-plugin-jsdoc": "^48.8.0",
131
131
  "eslint-plugin-node": "^11.1.0",
132
132
  "eslint-plugin-prefer-import": "^0.0.1",
133
- "eslint-plugin-prettier": "^5.1.2",
133
+ "eslint-plugin-prettier": "^5.2.1",
134
134
  "eslint-webpack-plugin": "^4.2.0",
135
135
  "ghooks": "^2.0.4",
136
- "husky": "^9.0.11",
136
+ "husky": "^9.1.1",
137
137
  "jsdoc": "^4.0.2",
138
138
  "json-schema-faker": "^0.5.6",
139
139
  "karma": "^6.4.3",
@@ -147,22 +147,22 @@
147
147
  "lint-staged": "^15.2.7",
148
148
  "lodash": "^4.17.21",
149
149
  "minami": "^1.1.1",
150
- "mocha": "^10.3.0",
150
+ "mocha": "^10.6.0",
151
151
  "node-polyfill-webpack-plugin": "^3.0.0",
152
152
  "nyc": "^15.1.0",
153
- "prettier": "^3.3.2",
153
+ "prettier": "^3.3.3",
154
154
  "randombytes": "^2.1.0",
155
155
  "sinon": "^17.0.1",
156
156
  "sinon-chai": "^3.7.0",
157
157
  "taffydb": "^2.7.3",
158
158
  "terser-webpack-plugin": "^5.3.10",
159
159
  "ts-node": "^10.9.2",
160
- "typescript": "^5.4.3",
161
- "webpack": "^5.92.0",
160
+ "typescript": "^5.5.3",
161
+ "webpack": "^5.93.0",
162
162
  "webpack-cli": "^5.0.1"
163
163
  },
164
164
  "dependencies": {
165
- "@stellar/stellar-base": "^12.0.1",
165
+ "@stellar/stellar-base": "^12.1.0",
166
166
  "axios": "^1.7.2",
167
167
  "bignumber.js": "^9.1.2",
168
168
  "eventsource": "^2.0.2",