@stellar/stellar-sdk 15.0.0 → 15.1.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 (97) hide show
  1. package/dist/stellar-sdk-minimal.js +711 -264
  2. package/dist/stellar-sdk-minimal.min.js +1 -1
  3. package/dist/stellar-sdk-no-axios.js +711 -264
  4. package/dist/stellar-sdk-no-axios.min.js +1 -1
  5. package/dist/stellar-sdk-no-eventsource.js +335 -207
  6. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  7. package/dist/stellar-sdk.js +335 -207
  8. package/dist/stellar-sdk.min.js +1 -1
  9. package/lib/bindings/config.js +1 -3
  10. package/lib/contract/assembled_transaction.d.ts +5 -0
  11. package/lib/contract/assembled_transaction.js +23 -22
  12. package/lib/contract/spec.js +18 -6
  13. package/lib/contract/utils.js +13 -13
  14. package/lib/federation/server.js +6 -3
  15. package/lib/federation/utils.d.ts +1 -0
  16. package/lib/federation/utils.js +11 -0
  17. package/lib/horizon/account_response.d.ts +1 -0
  18. package/lib/horizon/account_response.js +26 -13
  19. package/lib/horizon/call_builder.js +6 -5
  20. package/lib/horizon/horizon_axios_client.js +3 -2
  21. package/lib/horizon/server.js +3 -1
  22. package/lib/horizon/server_api.d.ts +1 -0
  23. package/lib/http-client/fetch-client.js +435 -64
  24. package/lib/minimal/bindings/config.js +1 -3
  25. package/lib/minimal/contract/assembled_transaction.d.ts +5 -0
  26. package/lib/minimal/contract/assembled_transaction.js +23 -22
  27. package/lib/minimal/contract/spec.js +18 -6
  28. package/lib/minimal/contract/utils.js +13 -13
  29. package/lib/minimal/federation/server.js +6 -3
  30. package/lib/minimal/federation/utils.d.ts +1 -0
  31. package/lib/minimal/federation/utils.js +11 -0
  32. package/lib/minimal/horizon/account_response.d.ts +1 -0
  33. package/lib/minimal/horizon/account_response.js +26 -13
  34. package/lib/minimal/horizon/call_builder.js +6 -5
  35. package/lib/minimal/horizon/horizon_axios_client.js +3 -2
  36. package/lib/minimal/horizon/server.js +3 -1
  37. package/lib/minimal/horizon/server_api.d.ts +1 -0
  38. package/lib/minimal/http-client/fetch-client.js +435 -64
  39. package/lib/minimal/rpc/api.d.ts +15 -0
  40. package/lib/minimal/rpc/axios.js +1 -1
  41. package/lib/minimal/rpc/parsers.d.ts +1 -0
  42. package/lib/minimal/rpc/parsers.js +26 -2
  43. package/lib/minimal/rpc/server.d.ts +1 -0
  44. package/lib/minimal/rpc/server.js +134 -117
  45. package/lib/minimal/webauth/challenge_transaction.js +3 -0
  46. package/lib/no-axios/bindings/config.js +1 -3
  47. package/lib/no-axios/contract/assembled_transaction.d.ts +5 -0
  48. package/lib/no-axios/contract/assembled_transaction.js +23 -22
  49. package/lib/no-axios/contract/spec.js +18 -6
  50. package/lib/no-axios/contract/utils.js +13 -13
  51. package/lib/no-axios/federation/server.js +6 -3
  52. package/lib/no-axios/federation/utils.d.ts +1 -0
  53. package/lib/no-axios/federation/utils.js +11 -0
  54. package/lib/no-axios/horizon/account_response.d.ts +1 -0
  55. package/lib/no-axios/horizon/account_response.js +26 -13
  56. package/lib/no-axios/horizon/call_builder.js +6 -5
  57. package/lib/no-axios/horizon/horizon_axios_client.js +3 -2
  58. package/lib/no-axios/horizon/server.js +3 -1
  59. package/lib/no-axios/horizon/server_api.d.ts +1 -0
  60. package/lib/no-axios/http-client/fetch-client.js +435 -64
  61. package/lib/no-axios/rpc/api.d.ts +15 -0
  62. package/lib/no-axios/rpc/axios.js +1 -1
  63. package/lib/no-axios/rpc/parsers.d.ts +1 -0
  64. package/lib/no-axios/rpc/parsers.js +26 -2
  65. package/lib/no-axios/rpc/server.d.ts +1 -0
  66. package/lib/no-axios/rpc/server.js +134 -117
  67. package/lib/no-axios/webauth/challenge_transaction.js +3 -0
  68. package/lib/no-eventsource/bindings/config.js +1 -3
  69. package/lib/no-eventsource/contract/assembled_transaction.d.ts +5 -0
  70. package/lib/no-eventsource/contract/assembled_transaction.js +23 -22
  71. package/lib/no-eventsource/contract/spec.js +18 -6
  72. package/lib/no-eventsource/contract/utils.js +13 -13
  73. package/lib/no-eventsource/federation/server.js +6 -3
  74. package/lib/no-eventsource/federation/utils.d.ts +1 -0
  75. package/lib/no-eventsource/federation/utils.js +11 -0
  76. package/lib/no-eventsource/horizon/account_response.d.ts +1 -0
  77. package/lib/no-eventsource/horizon/account_response.js +26 -13
  78. package/lib/no-eventsource/horizon/call_builder.js +6 -5
  79. package/lib/no-eventsource/horizon/horizon_axios_client.js +3 -2
  80. package/lib/no-eventsource/horizon/server.js +3 -1
  81. package/lib/no-eventsource/horizon/server_api.d.ts +1 -0
  82. package/lib/no-eventsource/http-client/fetch-client.js +435 -64
  83. package/lib/no-eventsource/rpc/api.d.ts +15 -0
  84. package/lib/no-eventsource/rpc/axios.js +1 -1
  85. package/lib/no-eventsource/rpc/parsers.d.ts +1 -0
  86. package/lib/no-eventsource/rpc/parsers.js +26 -2
  87. package/lib/no-eventsource/rpc/server.d.ts +1 -0
  88. package/lib/no-eventsource/rpc/server.js +134 -117
  89. package/lib/no-eventsource/webauth/challenge_transaction.js +3 -0
  90. package/lib/rpc/api.d.ts +15 -0
  91. package/lib/rpc/axios.js +1 -1
  92. package/lib/rpc/parsers.d.ts +1 -0
  93. package/lib/rpc/parsers.js +26 -2
  94. package/lib/rpc/server.d.ts +1 -0
  95. package/lib/rpc/server.js +134 -117
  96. package/lib/webauth/challenge_transaction.js +3 -0
  97. package/package.json +6 -5
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.parseRawEvents = parseRawEvents;
7
+ exports.parseRawLatestLedger = parseRawLatestLedger;
7
8
  exports.parseRawLedger = parseRawLedger;
8
9
  exports.parseRawLedgerEntries = parseRawLedgerEntries;
9
10
  exports.parseRawSendTransaction = parseRawSendTransaction;
@@ -126,7 +127,7 @@ function parseSuccessful(sim, partial) {
126
127
  var success = _objectSpread(_objectSpread(_objectSpread({}, partial), {}, {
127
128
  transactionData: new _stellarBase.SorobanDataBuilder(sim.transactionData),
128
129
  minResourceFee: sim.minResourceFee
129
- }, ((_sim$results$length = (_sim$results = sim.results) === null || _sim$results === void 0 ? void 0 : _sim$results.length) !== null && _sim$results$length !== void 0 ? _sim$results$length : 0 > 0) && {
130
+ }, ((_sim$results$length = (_sim$results = sim.results) === null || _sim$results === void 0 ? void 0 : _sim$results.length) !== null && _sim$results$length !== void 0 ? _sim$results$length : 0) > 0 && {
130
131
  result: sim.results.map(function (row) {
131
132
  var _row$auth;
132
133
  return {
@@ -136,7 +137,7 @@ function parseSuccessful(sim, partial) {
136
137
  retval: row.xdr ? _stellarBase.xdr.ScVal.fromXDR(row.xdr, "base64") : _stellarBase.xdr.ScVal.scvVoid()
137
138
  };
138
139
  })[0]
139
- }), ((_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) && {
140
+ }), ((_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 && {
140
141
  stateChanges: (_sim$stateChanges2 = sim.stateChanges) === null || _sim$stateChanges2 === void 0 ? void 0 : _sim$stateChanges2.map(function (entryChange) {
141
142
  return {
142
143
  type: entryChange.type,
@@ -198,4 +199,27 @@ function parseRawLedger(raw) {
198
199
  metadataXdr: metadataXdr,
199
200
  headerXdr: headerXdr
200
201
  };
202
+ }
203
+ function parseRawLatestLedger(raw) {
204
+ var headerXdr = _stellarBase.xdr.LedgerHeader.fromXDR(raw.headerXdr, "base64");
205
+ var metadataXdr = _stellarBase.xdr.LedgerCloseMeta.fromXDR(raw.metadataXdr, "base64");
206
+ var missingFields;
207
+ if (!raw.metadataXdr && !raw.headerXdr) {
208
+ missingFields = "metadataXdr and headerXdr";
209
+ } else if (!raw.metadataXdr) {
210
+ missingFields = "metadataXdr";
211
+ } else if (!raw.headerXdr) {
212
+ missingFields = "headerXdr";
213
+ }
214
+ if (missingFields) {
215
+ throw new TypeError("invalid getLatestLedger response missing fields: ".concat(missingFields));
216
+ }
217
+ return {
218
+ id: raw.id,
219
+ sequence: raw.sequence,
220
+ protocolVersion: raw.protocolVersion,
221
+ closeTime: raw.closeTime,
222
+ headerXdr: headerXdr,
223
+ metadataXdr: metadataXdr
224
+ };
201
225
  }
@@ -491,6 +491,7 @@ export declare class RpcServer {
491
491
  * });
492
492
  */
493
493
  getLatestLedger(): Promise<Api.GetLatestLedgerResponse>;
494
+ _getLatestLedger(): Promise<Api.RawGetLatestLedgerResponse>;
494
495
  /**
495
496
  * Submit a trial contract invocation to get back return values, expected
496
497
  * ledger footprint, expected authorizations, and expected costs.
@@ -275,9 +275,10 @@ var RpcServer = exports.RpcServer = function () {
275
275
  latestLedger: ll.sequence,
276
276
  balanceEntry: {
277
277
  amount: tl.balance().toString(),
278
- authorized: Boolean(tl.flags() & _stellarBase.AuthRequiredFlag),
279
- clawback: Boolean(tl.flags() & _stellarBase.AuthClawbackEnabledFlag),
280
- revocable: Boolean(tl.flags() & _stellarBase.AuthRevocableFlag)
278
+ authorized: Boolean(tl.flags() & 0x1),
279
+ clawback: Boolean(tl.flags() & 0x4),
280
+ authorizedToMaintainLiabilities: Boolean(tl.flags() & 0x2),
281
+ revocable: Boolean(tl.flags() & 0x2)
281
282
  }
282
283
  });
283
284
  case 6:
@@ -525,7 +526,7 @@ var RpcServer = exports.RpcServer = function () {
525
526
  maxAttempts = ((_opts$attempts = opts === null || opts === void 0 ? void 0 : opts.attempts) !== null && _opts$attempts !== void 0 ? _opts$attempts : 0) < 1 ? DEFAULT_GET_TRANSACTION_TIMEOUT : (_opts$attempts2 = opts === null || opts === void 0 ? void 0 : opts.attempts) !== null && _opts$attempts2 !== void 0 ? _opts$attempts2 : DEFAULT_GET_TRANSACTION_TIMEOUT;
526
527
  attempt = 1;
527
528
  case 1:
528
- if (!(attempt < maxAttempts)) {
529
+ if (!(attempt <= maxAttempts)) {
529
530
  _context1.n = 5;
530
531
  break;
531
532
  }
@@ -708,30 +709,46 @@ var RpcServer = exports.RpcServer = function () {
708
709
  }, {
709
710
  key: "getLatestLedger",
710
711
  value: (function () {
711
- var _getLatestLedger = _asyncToGenerator(_regenerator().m(function _callee17() {
712
+ var _getLatestLedger2 = _asyncToGenerator(_regenerator().m(function _callee17() {
712
713
  return _regenerator().w(function (_context17) {
713
714
  while (1) switch (_context17.n) {
714
715
  case 0:
715
- return _context17.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "getLatestLedger"));
716
+ return _context17.a(2, this._getLatestLedger().then(_parsers.parseRawLatestLedger));
716
717
  }
717
718
  }, _callee17, this);
718
719
  }));
719
720
  function getLatestLedger() {
720
- return _getLatestLedger.apply(this, arguments);
721
+ return _getLatestLedger2.apply(this, arguments);
721
722
  }
722
723
  return getLatestLedger;
723
724
  }())
724
725
  }, {
725
- key: "simulateTransaction",
726
- value: (function () {
727
- var _simulateTransaction2 = _asyncToGenerator(_regenerator().m(function _callee18(tx, addlResources, authMode) {
726
+ key: "_getLatestLedger",
727
+ value: function () {
728
+ var _getLatestLedger3 = _asyncToGenerator(_regenerator().m(function _callee18() {
728
729
  return _regenerator().w(function (_context18) {
729
730
  while (1) switch (_context18.n) {
730
731
  case 0:
731
- return _context18.a(2, this._simulateTransaction(tx, addlResources, authMode).then(_parsers.parseRawSimulation));
732
+ return _context18.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "getLatestLedger"));
732
733
  }
733
734
  }, _callee18, this);
734
735
  }));
736
+ function _getLatestLedger() {
737
+ return _getLatestLedger3.apply(this, arguments);
738
+ }
739
+ return _getLatestLedger;
740
+ }()
741
+ }, {
742
+ key: "simulateTransaction",
743
+ value: (function () {
744
+ var _simulateTransaction2 = _asyncToGenerator(_regenerator().m(function _callee19(tx, addlResources, authMode) {
745
+ return _regenerator().w(function (_context19) {
746
+ while (1) switch (_context19.n) {
747
+ case 0:
748
+ return _context19.a(2, this._simulateTransaction(tx, addlResources, authMode).then(_parsers.parseRawSimulation));
749
+ }
750
+ }, _callee19, this);
751
+ }));
735
752
  function simulateTransaction(_x20, _x21, _x22) {
736
753
  return _simulateTransaction2.apply(this, arguments);
737
754
  }
@@ -740,11 +757,11 @@ var RpcServer = exports.RpcServer = function () {
740
757
  }, {
741
758
  key: "_simulateTransaction",
742
759
  value: function () {
743
- var _simulateTransaction3 = _asyncToGenerator(_regenerator().m(function _callee19(transaction, addlResources, authMode) {
744
- return _regenerator().w(function (_context19) {
745
- while (1) switch (_context19.n) {
760
+ var _simulateTransaction3 = _asyncToGenerator(_regenerator().m(function _callee20(transaction, addlResources, authMode) {
761
+ return _regenerator().w(function (_context20) {
762
+ while (1) switch (_context20.n) {
746
763
  case 0:
747
- return _context19.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "simulateTransaction", _objectSpread({
764
+ return _context20.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "simulateTransaction", _objectSpread({
748
765
  transaction: transaction.toXDR(),
749
766
  authMode: authMode
750
767
  }, addlResources !== undefined && {
@@ -753,7 +770,7 @@ var RpcServer = exports.RpcServer = function () {
753
770
  }
754
771
  })));
755
772
  }
756
- }, _callee19, this);
773
+ }, _callee20, this);
757
774
  }));
758
775
  function _simulateTransaction(_x23, _x24, _x25) {
759
776
  return _simulateTransaction3.apply(this, arguments);
@@ -763,24 +780,24 @@ var RpcServer = exports.RpcServer = function () {
763
780
  }, {
764
781
  key: "prepareTransaction",
765
782
  value: (function () {
766
- var _prepareTransaction = _asyncToGenerator(_regenerator().m(function _callee20(tx) {
783
+ var _prepareTransaction = _asyncToGenerator(_regenerator().m(function _callee21(tx) {
767
784
  var simResponse;
768
- return _regenerator().w(function (_context20) {
769
- while (1) switch (_context20.n) {
785
+ return _regenerator().w(function (_context21) {
786
+ while (1) switch (_context21.n) {
770
787
  case 0:
771
- _context20.n = 1;
788
+ _context21.n = 1;
772
789
  return this.simulateTransaction(tx);
773
790
  case 1:
774
- simResponse = _context20.v;
791
+ simResponse = _context21.v;
775
792
  if (!_api.Api.isSimulationError(simResponse)) {
776
- _context20.n = 2;
793
+ _context21.n = 2;
777
794
  break;
778
795
  }
779
796
  throw new Error(simResponse.error);
780
797
  case 2:
781
- return _context20.a(2, (0, _transaction.assembleTransaction)(tx, simResponse).build());
798
+ return _context21.a(2, (0, _transaction.assembleTransaction)(tx, simResponse).build());
782
799
  }
783
- }, _callee20, this);
800
+ }, _callee21, this);
784
801
  }));
785
802
  function prepareTransaction(_x26) {
786
803
  return _prepareTransaction.apply(this, arguments);
@@ -790,13 +807,13 @@ var RpcServer = exports.RpcServer = function () {
790
807
  }, {
791
808
  key: "sendTransaction",
792
809
  value: (function () {
793
- var _sendTransaction2 = _asyncToGenerator(_regenerator().m(function _callee21(transaction) {
794
- return _regenerator().w(function (_context21) {
795
- while (1) switch (_context21.n) {
810
+ var _sendTransaction2 = _asyncToGenerator(_regenerator().m(function _callee22(transaction) {
811
+ return _regenerator().w(function (_context22) {
812
+ while (1) switch (_context22.n) {
796
813
  case 0:
797
- return _context21.a(2, this._sendTransaction(transaction).then(_parsers.parseRawSendTransaction));
814
+ return _context22.a(2, this._sendTransaction(transaction).then(_parsers.parseRawSendTransaction));
798
815
  }
799
- }, _callee21, this);
816
+ }, _callee22, this);
800
817
  }));
801
818
  function sendTransaction(_x27) {
802
819
  return _sendTransaction2.apply(this, arguments);
@@ -806,15 +823,15 @@ var RpcServer = exports.RpcServer = function () {
806
823
  }, {
807
824
  key: "_sendTransaction",
808
825
  value: function () {
809
- var _sendTransaction3 = _asyncToGenerator(_regenerator().m(function _callee22(transaction) {
810
- return _regenerator().w(function (_context22) {
811
- while (1) switch (_context22.n) {
826
+ var _sendTransaction3 = _asyncToGenerator(_regenerator().m(function _callee23(transaction) {
827
+ return _regenerator().w(function (_context23) {
828
+ while (1) switch (_context23.n) {
812
829
  case 0:
813
- return _context22.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "sendTransaction", {
830
+ return _context23.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "sendTransaction", {
814
831
  transaction: transaction.toXDR()
815
832
  }));
816
833
  }
817
- }, _callee22, this);
834
+ }, _callee23, this);
818
835
  }));
819
836
  function _sendTransaction(_x28) {
820
837
  return _sendTransaction3.apply(this, arguments);
@@ -824,74 +841,74 @@ var RpcServer = exports.RpcServer = function () {
824
841
  }, {
825
842
  key: "requestAirdrop",
826
843
  value: (function () {
827
- var _requestAirdrop = _asyncToGenerator(_regenerator().m(function _callee23(address, friendbotUrl) {
828
- var account, response, meta, txMeta, sequence, _error$response, _error$response$detai, _t6, _t7;
829
- return _regenerator().w(function (_context23) {
830
- while (1) switch (_context23.p = _context23.n) {
844
+ var _requestAirdrop = _asyncToGenerator(_regenerator().m(function _callee24(address, friendbotUrl) {
845
+ var account, response, meta, txMeta, sequence, _error$response, _error$response$data, _t6, _t7;
846
+ return _regenerator().w(function (_context24) {
847
+ while (1) switch (_context24.p = _context24.n) {
831
848
  case 0:
832
849
  account = typeof address === "string" ? address : address.accountId();
833
850
  _t6 = friendbotUrl;
834
851
  if (_t6) {
835
- _context23.n = 2;
852
+ _context24.n = 2;
836
853
  break;
837
854
  }
838
- _context23.n = 1;
855
+ _context24.n = 1;
839
856
  return this.getNetwork();
840
857
  case 1:
841
- _t6 = _context23.v.friendbotUrl;
858
+ _t6 = _context24.v.friendbotUrl;
842
859
  case 2:
843
860
  friendbotUrl = _t6;
844
861
  if (friendbotUrl) {
845
- _context23.n = 3;
862
+ _context24.n = 3;
846
863
  break;
847
864
  }
848
865
  throw new Error("No friendbot URL configured for current network");
849
866
  case 3:
850
- _context23.p = 3;
851
- _context23.n = 4;
867
+ _context24.p = 3;
868
+ _context24.n = 4;
852
869
  return this.httpClient.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
853
870
  case 4:
854
- response = _context23.v;
871
+ response = _context24.v;
855
872
  if (response.data.result_meta_xdr) {
856
- _context23.n = 7;
873
+ _context24.n = 7;
857
874
  break;
858
875
  }
859
- _context23.n = 5;
876
+ _context24.n = 5;
860
877
  return this.getTransaction(response.data.hash);
861
878
  case 5:
862
- txMeta = _context23.v;
879
+ txMeta = _context24.v;
863
880
  if (!(txMeta.status !== _api.Api.GetTransactionStatus.SUCCESS)) {
864
- _context23.n = 6;
881
+ _context24.n = 6;
865
882
  break;
866
883
  }
867
884
  throw new Error("Funding account ".concat(address, " failed"));
868
885
  case 6:
869
886
  meta = txMeta.resultMetaXdr;
870
- _context23.n = 8;
887
+ _context24.n = 8;
871
888
  break;
872
889
  case 7:
873
890
  meta = _stellarBase.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, "base64");
874
891
  case 8:
875
892
  sequence = findCreatedAccountSequenceInTransactionMeta(meta);
876
- return _context23.a(2, new _stellarBase.Account(account, sequence));
893
+ return _context24.a(2, new _stellarBase.Account(account, sequence));
877
894
  case 9:
878
- _context23.p = 9;
879
- _t7 = _context23.v;
895
+ _context24.p = 9;
896
+ _t7 = _context24.v;
880
897
  if (!(((_error$response = _t7.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
881
- _context23.n = 10;
898
+ _context24.n = 10;
882
899
  break;
883
900
  }
884
- if (!((_error$response$detai = _t7.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes("createAccountAlreadyExist"))) {
885
- _context23.n = 10;
901
+ if (!((_error$response$data = _t7.response.data) !== null && _error$response$data !== void 0 && (_error$response$data = _error$response$data.detail) !== null && _error$response$data !== void 0 && _error$response$data.includes("createAccountAlreadyExist"))) {
902
+ _context24.n = 10;
886
903
  break;
887
904
  }
888
- return _context23.a(2, this.getAccount(account));
905
+ return _context24.a(2, this.getAccount(account));
889
906
  case 10:
890
907
  throw _t7;
891
908
  case 11:
892
- return _context23.a(2);
909
+ return _context24.a(2);
893
910
  }
894
- }, _callee23, this, [[3, 9]]);
911
+ }, _callee24, this, [[3, 9]]);
895
912
  }));
896
913
  function requestAirdrop(_x29, _x30) {
897
914
  return _requestAirdrop.apply(this, arguments);
@@ -901,64 +918,64 @@ var RpcServer = exports.RpcServer = function () {
901
918
  }, {
902
919
  key: "fundAddress",
903
920
  value: (function () {
904
- var _fundAddress = _asyncToGenerator(_regenerator().m(function _callee24(address, friendbotUrl) {
905
- var response, txResponse, _error$response2, _error$response$data$, _error$response$data, _t8, _t9;
906
- return _regenerator().w(function (_context24) {
907
- while (1) switch (_context24.p = _context24.n) {
921
+ var _fundAddress = _asyncToGenerator(_regenerator().m(function _callee25(address, friendbotUrl) {
922
+ var response, txResponse, _error$response2, _error$response$data$, _error$response$data2, _t8, _t9;
923
+ return _regenerator().w(function (_context25) {
924
+ while (1) switch (_context25.p = _context25.n) {
908
925
  case 0:
909
926
  if (!(!_stellarBase.StrKey.isValidEd25519PublicKey(address) && !_stellarBase.StrKey.isValidContract(address))) {
910
- _context24.n = 1;
927
+ _context25.n = 1;
911
928
  break;
912
929
  }
913
930
  throw new Error("Invalid address: ".concat(address, ". Expected a Stellar account (G...) or contract (C...) address."));
914
931
  case 1:
915
932
  _t8 = friendbotUrl;
916
933
  if (_t8) {
917
- _context24.n = 3;
934
+ _context25.n = 3;
918
935
  break;
919
936
  }
920
- _context24.n = 2;
937
+ _context25.n = 2;
921
938
  return this.getNetwork();
922
939
  case 2:
923
- _t8 = _context24.v.friendbotUrl;
940
+ _t8 = _context25.v.friendbotUrl;
924
941
  case 3:
925
942
  friendbotUrl = _t8;
926
943
  if (friendbotUrl) {
927
- _context24.n = 4;
944
+ _context25.n = 4;
928
945
  break;
929
946
  }
930
947
  throw new Error("No friendbot URL configured for current network");
931
948
  case 4:
932
- _context24.p = 4;
933
- _context24.n = 5;
949
+ _context25.p = 4;
950
+ _context25.n = 5;
934
951
  return this.httpClient.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(address)));
935
952
  case 5:
936
- response = _context24.v;
937
- _context24.n = 6;
953
+ response = _context25.v;
954
+ _context25.n = 6;
938
955
  return this.getTransaction(response.data.hash);
939
956
  case 6:
940
- txResponse = _context24.v;
957
+ txResponse = _context25.v;
941
958
  if (!(txResponse.status !== _api.Api.GetTransactionStatus.SUCCESS)) {
942
- _context24.n = 7;
959
+ _context25.n = 7;
943
960
  break;
944
961
  }
945
962
  throw new Error("Funding address ".concat(address, " failed: transaction status ").concat(txResponse.status));
946
963
  case 7:
947
- return _context24.a(2, txResponse);
964
+ return _context25.a(2, txResponse);
948
965
  case 8:
949
- _context24.p = 8;
950
- _t9 = _context24.v;
966
+ _context25.p = 8;
967
+ _t9 = _context25.v;
951
968
  if (!(((_error$response2 = _t9.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 400)) {
952
- _context24.n = 9;
969
+ _context25.n = 9;
953
970
  break;
954
971
  }
955
- throw new Error((_error$response$data$ = (_error$response$data = _t9.response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.detail) !== null && _error$response$data$ !== void 0 ? _error$response$data$ : "Bad Request");
972
+ throw new Error((_error$response$data$ = (_error$response$data2 = _t9.response.data) === null || _error$response$data2 === void 0 ? void 0 : _error$response$data2.detail) !== null && _error$response$data$ !== void 0 ? _error$response$data$ : "Bad Request");
956
973
  case 9:
957
974
  throw _t9;
958
975
  case 10:
959
- return _context24.a(2);
976
+ return _context25.a(2);
960
977
  }
961
- }, _callee24, this, [[4, 8]]);
978
+ }, _callee25, this, [[4, 8]]);
962
979
  }));
963
980
  function fundAddress(_x31, _x32) {
964
981
  return _fundAddress.apply(this, arguments);
@@ -968,13 +985,13 @@ var RpcServer = exports.RpcServer = function () {
968
985
  }, {
969
986
  key: "getFeeStats",
970
987
  value: (function () {
971
- var _getFeeStats = _asyncToGenerator(_regenerator().m(function _callee25() {
972
- return _regenerator().w(function (_context25) {
973
- while (1) switch (_context25.n) {
988
+ var _getFeeStats = _asyncToGenerator(_regenerator().m(function _callee26() {
989
+ return _regenerator().w(function (_context26) {
990
+ while (1) switch (_context26.n) {
974
991
  case 0:
975
- return _context25.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "getFeeStats"));
992
+ return _context26.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "getFeeStats"));
976
993
  }
977
- }, _callee25, this);
994
+ }, _callee26, this);
978
995
  }));
979
996
  function getFeeStats() {
980
997
  return _getFeeStats.apply(this, arguments);
@@ -984,13 +1001,13 @@ var RpcServer = exports.RpcServer = function () {
984
1001
  }, {
985
1002
  key: "getVersionInfo",
986
1003
  value: (function () {
987
- var _getVersionInfo = _asyncToGenerator(_regenerator().m(function _callee26() {
988
- return _regenerator().w(function (_context26) {
989
- while (1) switch (_context26.n) {
1004
+ var _getVersionInfo = _asyncToGenerator(_regenerator().m(function _callee27() {
1005
+ return _regenerator().w(function (_context27) {
1006
+ while (1) switch (_context27.n) {
990
1007
  case 0:
991
- return _context26.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "getVersionInfo"));
1008
+ return _context27.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "getVersionInfo"));
992
1009
  }
993
- }, _callee26, this);
1010
+ }, _callee27, this);
994
1011
  }));
995
1012
  function getVersionInfo() {
996
1013
  return _getVersionInfo.apply(this, arguments);
@@ -1000,32 +1017,32 @@ var RpcServer = exports.RpcServer = function () {
1000
1017
  }, {
1001
1018
  key: "getSACBalance",
1002
1019
  value: (function () {
1003
- var _getSACBalance = _asyncToGenerator(_regenerator().m(function _callee27(address, sac, networkPassphrase) {
1020
+ var _getSACBalance = _asyncToGenerator(_regenerator().m(function _callee28(address, sac, networkPassphrase) {
1004
1021
  var addressString, passphrase, sacId, key, ledgerKey, response, _response$entries$2, lastModifiedLedgerSeq, liveUntilLedgerSeq, val, entry, _t0;
1005
- return _regenerator().w(function (_context27) {
1006
- while (1) switch (_context27.n) {
1022
+ return _regenerator().w(function (_context28) {
1023
+ while (1) switch (_context28.n) {
1007
1024
  case 0:
1008
1025
  addressString = address instanceof _stellarBase.Address ? address.toString() : address;
1009
1026
  if (_stellarBase.StrKey.isValidContract(addressString)) {
1010
- _context27.n = 1;
1027
+ _context28.n = 1;
1011
1028
  break;
1012
1029
  }
1013
1030
  throw new TypeError("expected contract ID, got ".concat(addressString));
1014
1031
  case 1:
1015
1032
  if (!(networkPassphrase !== null && networkPassphrase !== void 0)) {
1016
- _context27.n = 2;
1033
+ _context28.n = 2;
1017
1034
  break;
1018
1035
  }
1019
1036
  _t0 = networkPassphrase;
1020
- _context27.n = 4;
1037
+ _context28.n = 4;
1021
1038
  break;
1022
1039
  case 2:
1023
- _context27.n = 3;
1040
+ _context28.n = 3;
1024
1041
  return this.getNetwork().then(function (n) {
1025
1042
  return n.passphrase;
1026
1043
  });
1027
1044
  case 3:
1028
- _t0 = _context27.v;
1045
+ _t0 = _context28.v;
1029
1046
  case 4:
1030
1047
  passphrase = _t0;
1031
1048
  sacId = sac.contractId(passphrase);
@@ -1037,29 +1054,29 @@ var RpcServer = exports.RpcServer = function () {
1037
1054
  durability: _stellarBase.xdr.ContractDataDurability.persistent(),
1038
1055
  key: key
1039
1056
  }));
1040
- _context27.n = 5;
1057
+ _context28.n = 5;
1041
1058
  return this.getLedgerEntries(ledgerKey);
1042
1059
  case 5:
1043
- response = _context27.v;
1060
+ response = _context28.v;
1044
1061
  if (!(response.entries.length === 0)) {
1045
- _context27.n = 6;
1062
+ _context28.n = 6;
1046
1063
  break;
1047
1064
  }
1048
- return _context27.a(2, {
1065
+ return _context28.a(2, {
1049
1066
  latestLedger: response.latestLedger
1050
1067
  });
1051
1068
  case 6:
1052
1069
  _response$entries$2 = response.entries[0], lastModifiedLedgerSeq = _response$entries$2.lastModifiedLedgerSeq, liveUntilLedgerSeq = _response$entries$2.liveUntilLedgerSeq, val = _response$entries$2.val;
1053
1070
  if (!(val.switch().value !== _stellarBase.xdr.LedgerEntryType.contractData().value)) {
1054
- _context27.n = 7;
1071
+ _context28.n = 7;
1055
1072
  break;
1056
1073
  }
1057
- return _context27.a(2, {
1074
+ return _context28.a(2, {
1058
1075
  latestLedger: response.latestLedger
1059
1076
  });
1060
1077
  case 7:
1061
1078
  entry = (0, _stellarBase.scValToNative)(val.contractData().val());
1062
- return _context27.a(2, {
1079
+ return _context28.a(2, {
1063
1080
  latestLedger: response.latestLedger,
1064
1081
  balanceEntry: {
1065
1082
  liveUntilLedgerSeq: liveUntilLedgerSeq,
@@ -1070,7 +1087,7 @@ var RpcServer = exports.RpcServer = function () {
1070
1087
  }
1071
1088
  });
1072
1089
  }
1073
- }, _callee27, this);
1090
+ }, _callee28, this);
1074
1091
  }));
1075
1092
  function getSACBalance(_x33, _x34, _x35) {
1076
1093
  return _getSACBalance.apply(this, arguments);
@@ -1080,11 +1097,11 @@ var RpcServer = exports.RpcServer = function () {
1080
1097
  }, {
1081
1098
  key: "getLedgers",
1082
1099
  value: (function () {
1083
- var _getLedgers2 = _asyncToGenerator(_regenerator().m(function _callee28(request) {
1084
- return _regenerator().w(function (_context28) {
1085
- while (1) switch (_context28.n) {
1100
+ var _getLedgers2 = _asyncToGenerator(_regenerator().m(function _callee29(request) {
1101
+ return _regenerator().w(function (_context29) {
1102
+ while (1) switch (_context29.n) {
1086
1103
  case 0:
1087
- return _context28.a(2, this._getLedgers(request).then(function (raw) {
1104
+ return _context29.a(2, this._getLedgers(request).then(function (raw) {
1088
1105
  var result = {
1089
1106
  ledgers: (raw.ledgers || []).map(_parsers.parseRawLedger),
1090
1107
  latestLedger: raw.latestLedger,
@@ -1096,7 +1113,7 @@ var RpcServer = exports.RpcServer = function () {
1096
1113
  return result;
1097
1114
  }));
1098
1115
  }
1099
- }, _callee28, this);
1116
+ }, _callee29, this);
1100
1117
  }));
1101
1118
  function getLedgers(_x36) {
1102
1119
  return _getLedgers2.apply(this, arguments);
@@ -1106,13 +1123,13 @@ var RpcServer = exports.RpcServer = function () {
1106
1123
  }, {
1107
1124
  key: "_getLedgers",
1108
1125
  value: function () {
1109
- var _getLedgers3 = _asyncToGenerator(_regenerator().m(function _callee29(request) {
1110
- return _regenerator().w(function (_context29) {
1111
- while (1) switch (_context29.n) {
1126
+ var _getLedgers3 = _asyncToGenerator(_regenerator().m(function _callee30(request) {
1127
+ return _regenerator().w(function (_context30) {
1128
+ while (1) switch (_context30.n) {
1112
1129
  case 0:
1113
- return _context29.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "getLedgers", request));
1130
+ return _context30.a(2, jsonrpc.postObject(this.httpClient, this.serverURL.toString(), "getLedgers", request));
1114
1131
  }
1115
- }, _callee29, this);
1132
+ }, _callee30, this);
1116
1133
  }));
1117
1134
  function _getLedgers(_x37) {
1118
1135
  return _getLedgers3.apply(this, arguments);
@@ -273,6 +273,9 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
273
273
  if (clientSigningKey) {
274
274
  signersFound.splice(signersFound.indexOf(clientSigningKey), 1);
275
275
  }
276
+ if (signersFound.length === 0) {
277
+ throw new _errors.InvalidChallengeError("None of the given signers match the transaction signatures");
278
+ }
276
279
  return signersFound;
277
280
  }
278
281
  function verifyChallengeTxThreshold(challengeTx, serverAccountID, networkPassphrase, threshold, signerSummary, homeDomains, webAuthDomain) {
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ConfigGenerator = void 0;
7
- var _package = _interopRequireDefault(require("../../package.json"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
7
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
8
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
11
9
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
@@ -41,7 +39,7 @@ var ConfigGenerator = exports.ConfigGenerator = function () {
41
39
  build: "tsc"
42
40
  },
43
41
  dependencies: {
44
- "@stellar/stellar-sdk": "^".concat(_package.default.version),
42
+ "@stellar/stellar-sdk": "^".concat("15.1.0"),
45
43
  buffer: "6.0.3"
46
44
  },
47
45
  devDependencies: {
@@ -227,6 +227,11 @@ export declare class AssembledTransaction<T> {
227
227
  * ```
228
228
  */
229
229
  raw?: TransactionBuilder;
230
+ /**
231
+ * Stores the original operation from `buildWithOp` for reuse during
232
+ * automatic state restoration rebuilds.
233
+ */
234
+ private originalOp?;
230
235
  /**
231
236
  * The Transaction as it was built with `raw.build()` right before
232
237
  * simulation. Once this is set, modifying `raw` will have no effect unless