@stellar/stellar-sdk 13.0.0-rc.1 → 13.0.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 (82) hide show
  1. package/CHANGELOG.md +127 -2
  2. package/dist/stellar-sdk-minimal.js +385 -99
  3. package/dist/stellar-sdk-minimal.min.js +1 -1
  4. package/dist/stellar-sdk-no-axios.js +402 -102
  5. package/dist/stellar-sdk-no-axios.min.js +1 -1
  6. package/dist/stellar-sdk-no-eventsource.js +385 -99
  7. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  8. package/dist/stellar-sdk.js +402 -102
  9. package/dist/stellar-sdk.min.js +1 -1
  10. package/lib/contract/assembled_transaction.d.ts +75 -3
  11. package/lib/contract/assembled_transaction.js +123 -34
  12. package/lib/contract/basic_node_signer.d.ts +3 -2
  13. package/lib/contract/basic_node_signer.js +16 -8
  14. package/lib/contract/client.d.ts +13 -1
  15. package/lib/contract/client.js +159 -48
  16. package/lib/contract/types.d.ts +72 -8
  17. package/lib/contract/types.js +1 -0
  18. package/lib/horizon/call_builder.d.ts +1 -1
  19. package/lib/horizon/horizon_axios_client.js +1 -1
  20. package/lib/horizon/server_api.d.ts +1 -0
  21. package/lib/horizon/server_api.js +5 -0
  22. package/lib/horizon/types/effects.d.ts +51 -51
  23. package/lib/horizon/types/trade.d.ts +3 -2
  24. package/lib/http-client/types.d.ts +1 -0
  25. package/lib/minimal/contract/assembled_transaction.d.ts +75 -3
  26. package/lib/minimal/contract/assembled_transaction.js +123 -34
  27. package/lib/minimal/contract/basic_node_signer.d.ts +3 -2
  28. package/lib/minimal/contract/basic_node_signer.js +16 -8
  29. package/lib/minimal/contract/client.d.ts +13 -1
  30. package/lib/minimal/contract/client.js +159 -48
  31. package/lib/minimal/contract/types.d.ts +72 -8
  32. package/lib/minimal/contract/types.js +1 -0
  33. package/lib/minimal/horizon/call_builder.d.ts +1 -1
  34. package/lib/minimal/horizon/horizon_axios_client.js +1 -1
  35. package/lib/minimal/horizon/server_api.d.ts +1 -0
  36. package/lib/minimal/horizon/server_api.js +5 -0
  37. package/lib/minimal/horizon/types/effects.d.ts +51 -51
  38. package/lib/minimal/horizon/types/trade.d.ts +3 -2
  39. package/lib/minimal/http-client/types.d.ts +1 -0
  40. package/lib/minimal/rpc/axios.js +1 -1
  41. package/lib/minimal/stellartoml/index.d.ts +1 -0
  42. package/lib/minimal/stellartoml/index.js +2 -0
  43. package/lib/no-axios/contract/assembled_transaction.d.ts +75 -3
  44. package/lib/no-axios/contract/assembled_transaction.js +123 -34
  45. package/lib/no-axios/contract/basic_node_signer.d.ts +3 -2
  46. package/lib/no-axios/contract/basic_node_signer.js +16 -8
  47. package/lib/no-axios/contract/client.d.ts +13 -1
  48. package/lib/no-axios/contract/client.js +159 -48
  49. package/lib/no-axios/contract/types.d.ts +72 -8
  50. package/lib/no-axios/contract/types.js +1 -0
  51. package/lib/no-axios/horizon/call_builder.d.ts +1 -1
  52. package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
  53. package/lib/no-axios/horizon/server_api.d.ts +1 -0
  54. package/lib/no-axios/horizon/server_api.js +5 -0
  55. package/lib/no-axios/horizon/types/effects.d.ts +51 -51
  56. package/lib/no-axios/horizon/types/trade.d.ts +3 -2
  57. package/lib/no-axios/http-client/types.d.ts +1 -0
  58. package/lib/no-axios/rpc/axios.js +1 -1
  59. package/lib/no-axios/stellartoml/index.d.ts +1 -0
  60. package/lib/no-axios/stellartoml/index.js +2 -0
  61. package/lib/no-eventsource/contract/assembled_transaction.d.ts +75 -3
  62. package/lib/no-eventsource/contract/assembled_transaction.js +123 -34
  63. package/lib/no-eventsource/contract/basic_node_signer.d.ts +3 -2
  64. package/lib/no-eventsource/contract/basic_node_signer.js +16 -8
  65. package/lib/no-eventsource/contract/client.d.ts +13 -1
  66. package/lib/no-eventsource/contract/client.js +159 -48
  67. package/lib/no-eventsource/contract/types.d.ts +72 -8
  68. package/lib/no-eventsource/contract/types.js +1 -0
  69. package/lib/no-eventsource/horizon/call_builder.d.ts +1 -1
  70. package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
  71. package/lib/no-eventsource/horizon/server_api.d.ts +1 -0
  72. package/lib/no-eventsource/horizon/server_api.js +5 -0
  73. package/lib/no-eventsource/horizon/types/effects.d.ts +51 -51
  74. package/lib/no-eventsource/horizon/types/trade.d.ts +3 -2
  75. package/lib/no-eventsource/http-client/types.d.ts +1 -0
  76. package/lib/no-eventsource/rpc/axios.js +1 -1
  77. package/lib/no-eventsource/stellartoml/index.d.ts +1 -0
  78. package/lib/no-eventsource/stellartoml/index.js +2 -0
  79. package/lib/rpc/axios.js +1 -1
  80. package/lib/stellartoml/index.d.ts +1 -0
  81. package/lib/stellartoml/index.js +2 -0
  82. package/package.json +2 -2
@@ -11063,6 +11063,12 @@ exports.walkInvocationTree = walkInvocationTree;
11063
11063
  var _asset = __webpack_require__(1764);
11064
11064
  var _address = __webpack_require__(1180);
11065
11065
  var _scval = __webpack_require__(7177);
11066
+ 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); }
11067
+ 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; }
11068
+ 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; }
11069
+ 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; }
11070
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
11071
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11066
11072
  /**
11067
11073
  * @typedef CreateInvocation
11068
11074
  *
@@ -11076,6 +11082,9 @@ var _scval = __webpack_require__(7177);
11076
11082
  * @prop {string} wasm.address contract address of this deployment
11077
11083
  * @prop {string} wasm.salt hex salt that the user consumed when creating
11078
11084
  * this contract (encoded in the resulting address)
11085
+ * @prop {any[]} [wasm.constructorArgs] a list of natively-represented values
11086
+ * (see {@link scValToNative}) that are passed to the constructor when
11087
+ * creating this contract
11079
11088
  */
11080
11089
 
11081
11090
  /**
@@ -11084,8 +11093,8 @@ var _scval = __webpack_require__(7177);
11084
11093
  * @prop {string} source the strkey of the contract (C...) being invoked
11085
11094
  * @prop {string} function the name of the function being invoked
11086
11095
  * @prop {any[]} args the natively-represented parameters to the function
11087
- * invocation (see {@link scValToNative}) for rules on how they're
11088
- * represented a JS types
11096
+ * invocation (see {@link scValToNative} for rules on how they're
11097
+ * represented a JS types)
11089
11098
  */
11090
11099
 
11091
11100
  /**
@@ -11146,7 +11155,7 @@ function buildInvocationTree(root) {
11146
11155
  /** @type {InvocationTree} */
11147
11156
  var output = {};
11148
11157
 
11149
- /** @type {xdr.CreateContractArgs | xdr.InvokeContractArgs} */
11158
+ /** @type {xdr.CreateContractArgs|xdr.CreateContractArgsV2|xdr.InvokeContractArgs} */
11150
11159
  var inner = fn.value();
11151
11160
  switch (fn["switch"]().value) {
11152
11161
  // sorobanAuthorizedFunctionTypeContractFn
@@ -11162,8 +11171,11 @@ function buildInvocationTree(root) {
11162
11171
  break;
11163
11172
 
11164
11173
  // sorobanAuthorizedFunctionTypeCreateContractHostFn
11165
- case 1:
11174
+ // sorobanAuthorizedFunctionTypeCreateContractV2HostFn
11175
+ case 1: // fallthrough: just no ctor args in V1
11176
+ case 2:
11166
11177
  {
11178
+ var createV2 = fn["switch"]().value === 2;
11167
11179
  output.type = 'create';
11168
11180
  output.args = {};
11169
11181
 
@@ -11187,11 +11199,15 @@ function buildInvocationTree(root) {
11187
11199
  /** @type {xdr.ContractIdPreimageFromAddress} */
11188
11200
  var details = preimage.fromAddress();
11189
11201
  output.args.type = 'wasm';
11190
- output.args.wasm = {
11202
+ output.args.wasm = _objectSpread({
11191
11203
  salt: details.salt().toString('hex'),
11192
11204
  hash: exec.wasmHash().toString('hex'),
11193
11205
  address: _address.Address.fromScAddress(details.address()).toString()
11194
- };
11206
+ }, createV2 && {
11207
+ constructorArgs: inner.constructorArgs().map(function (arg) {
11208
+ return (0, _scval.scValToNative)(arg);
11209
+ })
11210
+ });
11195
11211
  break;
11196
11212
  }
11197
11213
 
@@ -21620,6 +21636,7 @@ var Err = function () {
21620
21636
  }]);
21621
21637
  }();
21622
21638
  ;// ./src/contract/types.ts
21639
+
21623
21640
  var DEFAULT_TIMEOUT = 5 * 60;
21624
21641
  var NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
21625
21642
  ;// ./src/contract/utils.ts
@@ -22012,7 +22029,10 @@ var AssembledTransaction = function () {
22012
22029
  signTransaction,
22013
22030
  sigsNeeded,
22014
22031
  timeoutInSeconds,
22032
+ signOpts,
22033
+ _yield$signTransactio,
22015
22034
  signature,
22035
+ error,
22016
22036
  _args2 = arguments;
22017
22037
  return assembled_transaction_regeneratorRuntime().wrap(function _callee2$(_context2) {
22018
22038
  while (1) switch (_context2.prev = _context2.next) {
@@ -22051,14 +22071,21 @@ var AssembledTransaction = function () {
22051
22071
  timebounds: undefined,
22052
22072
  sorobanData: _this.simulationData.transactionData
22053
22073
  }).setTimeout(timeoutInSeconds).build();
22054
- _context2.next = 14;
22055
- return signTransaction(_this.built.toXDR(), {
22074
+ signOpts = {
22056
22075
  networkPassphrase: _this.options.networkPassphrase
22057
- });
22058
- case 14:
22059
- signature = _context2.sent;
22076
+ };
22077
+ if (_this.options.address) signOpts.address = _this.options.address;
22078
+ if (_this.options.submit !== undefined) signOpts.submit = _this.options.submit;
22079
+ if (_this.options.submitUrl) signOpts.submitUrl = _this.options.submitUrl;
22080
+ _context2.next = 18;
22081
+ return signTransaction(_this.built.toXDR(), signOpts);
22082
+ case 18:
22083
+ _yield$signTransactio = _context2.sent;
22084
+ signature = _yield$signTransactio.signedTxXdr;
22085
+ error = _yield$signTransactio.error;
22086
+ _this.handleWalletError(error);
22060
22087
  _this.signed = lib.TransactionBuilder.fromXDR(signature, _this.options.networkPassphrase);
22061
- case 16:
22088
+ case 23:
22062
22089
  case "end":
22063
22090
  return _context2.stop();
22064
22091
  }
@@ -22070,27 +22097,37 @@ var AssembledTransaction = function () {
22070
22097
  force,
22071
22098
  _ref6$signTransaction,
22072
22099
  signTransaction,
22100
+ originalSubmit,
22073
22101
  _args3 = arguments;
22074
22102
  return assembled_transaction_regeneratorRuntime().wrap(function _callee3$(_context3) {
22075
22103
  while (1) switch (_context3.prev = _context3.next) {
22076
22104
  case 0:
22077
22105
  _ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, _ref6$force = _ref6.force, force = _ref6$force === void 0 ? false : _ref6$force, _ref6$signTransaction = _ref6.signTransaction, signTransaction = _ref6$signTransaction === void 0 ? _this.options.signTransaction : _ref6$signTransaction;
22078
22106
  if (_this.signed) {
22079
- _context3.next = 4;
22107
+ _context3.next = 10;
22080
22108
  break;
22081
22109
  }
22082
- _context3.next = 4;
22110
+ originalSubmit = _this.options.submit;
22111
+ if (_this.options.submit) {
22112
+ _this.options.submit = false;
22113
+ }
22114
+ _context3.prev = 4;
22115
+ _context3.next = 7;
22083
22116
  return _this.sign({
22084
22117
  force: force,
22085
22118
  signTransaction: signTransaction
22086
22119
  });
22087
- case 4:
22120
+ case 7:
22121
+ _context3.prev = 7;
22122
+ _this.options.submit = originalSubmit;
22123
+ return _context3.finish(7);
22124
+ case 10:
22088
22125
  return _context3.abrupt("return", _this.send());
22089
- case 5:
22126
+ case 11:
22090
22127
  case "end":
22091
22128
  return _context3.stop();
22092
22129
  }
22093
- }, _callee3);
22130
+ }, _callee3, null, [[4,, 7, 10]]);
22094
22131
  })));
22095
22132
  assembled_transaction_defineProperty(this, "needsNonInvokerSigningBy", function () {
22096
22133
  var _rawInvokeHostFunctio;
@@ -22205,18 +22242,21 @@ var AssembledTransaction = function () {
22205
22242
  _context6.t1 = entry;
22206
22243
  _context6.t2 = function () {
22207
22244
  var _ref11 = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee5(preimage) {
22245
+ var _yield$sign, signedAuthEntry, error;
22208
22246
  return assembled_transaction_regeneratorRuntime().wrap(function _callee5$(_context5) {
22209
22247
  while (1) switch (_context5.prev = _context5.next) {
22210
22248
  case 0:
22211
- _context5.t0 = Buffer;
22212
- _context5.next = 3;
22249
+ _context5.next = 2;
22213
22250
  return sign(preimage.toXDR("base64"), {
22214
- accountToSign: address
22251
+ address: address
22215
22252
  });
22216
- case 3:
22217
- _context5.t1 = _context5.sent;
22218
- return _context5.abrupt("return", _context5.t0.from.call(_context5.t0, _context5.t1, "base64"));
22219
- case 5:
22253
+ case 2:
22254
+ _yield$sign = _context5.sent;
22255
+ signedAuthEntry = _yield$sign.signedAuthEntry;
22256
+ error = _yield$sign.error;
22257
+ _this.handleWalletError(error);
22258
+ return _context5.abrupt("return", Buffer.from(signedAuthEntry, "base64"));
22259
+ case 7:
22220
22260
  case "end":
22221
22261
  return _context5.stop();
22222
22262
  }
@@ -22304,6 +22344,26 @@ var AssembledTransaction = function () {
22304
22344
  if (!this.built) throw new Error("Transaction has not yet been simulated; " + "call `AssembledTransaction.simulate` first.");
22305
22345
  return (_this$built2 = this.built) === null || _this$built2 === void 0 ? void 0 : _this$built2.toEnvelope().toXDR('base64');
22306
22346
  }
22347
+ }, {
22348
+ key: "handleWalletError",
22349
+ value: function handleWalletError(error) {
22350
+ if (!error) return;
22351
+ var message = error.message,
22352
+ code = error.code;
22353
+ var fullMessage = "".concat(message).concat(error.ext ? " (".concat(error.ext.join(', '), ")") : '');
22354
+ switch (code) {
22355
+ case -1:
22356
+ throw new AssembledTransaction.Errors.InternalWalletError(fullMessage);
22357
+ case -2:
22358
+ throw new AssembledTransaction.Errors.ExternalServiceError(fullMessage);
22359
+ case -3:
22360
+ throw new AssembledTransaction.Errors.InvalidClientRequest(fullMessage);
22361
+ case -4:
22362
+ throw new AssembledTransaction.Errors.UserRejected(fullMessage);
22363
+ default:
22364
+ throw new Error("Unhandled error: ".concat(fullMessage));
22365
+ }
22366
+ }
22307
22367
  }, {
22308
22368
  key: "simulationData",
22309
22369
  get: function get() {
@@ -22319,7 +22379,7 @@ var AssembledTransaction = function () {
22319
22379
  throw new AssembledTransaction.Errors.NotYetSimulated("Transaction has not yet been simulated");
22320
22380
  }
22321
22381
  if (api/* Api */.j.isSimulationError(simulation)) {
22322
- throw new Error("Transaction simulation failed: \"".concat(simulation.error, "\""));
22382
+ throw new AssembledTransaction.Errors.SimulationFailed("Transaction simulation failed: \"".concat(simulation.error, "\""));
22323
22383
  }
22324
22384
  if (api/* Api */.j.isSimulationRestore(simulation)) {
22325
22385
  throw new AssembledTransaction.Errors.ExpiredState("You need to restore some contract state before you can invoke this method.\n" + 'You can set `restore` to true in the method options in order to ' + 'automatically restore the contract state when needed.');
@@ -22495,41 +22555,47 @@ var AssembledTransaction = function () {
22495
22555
  }
22496
22556
  }, {
22497
22557
  key: "build",
22558
+ value: function build(options) {
22559
+ var _options$args;
22560
+ var contract = new lib.Contract(options.contractId);
22561
+ return AssembledTransaction.buildWithOp(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : []))), options);
22562
+ }
22563
+ }, {
22564
+ key: "buildWithOp",
22498
22565
  value: (function () {
22499
- var _build = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee9(options) {
22500
- var _options$fee, _options$args, _options$timeoutInSec;
22501
- var tx, contract, account;
22566
+ var _buildWithOp = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee9(operation, options) {
22567
+ var _options$fee, _options$timeoutInSec;
22568
+ var tx, account;
22502
22569
  return assembled_transaction_regeneratorRuntime().wrap(function _callee9$(_context10) {
22503
22570
  while (1) switch (_context10.prev = _context10.next) {
22504
22571
  case 0:
22505
22572
  tx = new AssembledTransaction(options);
22506
- contract = new lib.Contract(options.contractId);
22507
- _context10.next = 4;
22573
+ _context10.next = 3;
22508
22574
  return getAccount(options, tx.server);
22509
- case 4:
22575
+ case 3:
22510
22576
  account = _context10.sent;
22511
22577
  tx.raw = new lib.TransactionBuilder(account, {
22512
22578
  fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : lib.BASE_FEE,
22513
22579
  networkPassphrase: options.networkPassphrase
22514
- }).addOperation(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : [])))).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : DEFAULT_TIMEOUT);
22580
+ }).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : DEFAULT_TIMEOUT).addOperation(operation);
22515
22581
  if (!options.simulate) {
22516
- _context10.next = 9;
22582
+ _context10.next = 8;
22517
22583
  break;
22518
22584
  }
22519
- _context10.next = 9;
22585
+ _context10.next = 8;
22520
22586
  return tx.simulate();
22521
- case 9:
22587
+ case 8:
22522
22588
  return _context10.abrupt("return", tx);
22523
- case 10:
22589
+ case 9:
22524
22590
  case "end":
22525
22591
  return _context10.stop();
22526
22592
  }
22527
22593
  }, _callee9);
22528
22594
  }));
22529
- function build(_x4) {
22530
- return _build.apply(this, arguments);
22595
+ function buildWithOp(_x4, _x5) {
22596
+ return _buildWithOp.apply(this, arguments);
22531
22597
  }
22532
- return build;
22598
+ return buildWithOp;
22533
22599
  }())
22534
22600
  }, {
22535
22601
  key: "buildFootprintRestoreTransaction",
@@ -22557,7 +22623,7 @@ var AssembledTransaction = function () {
22557
22623
  }
22558
22624
  }, _callee10);
22559
22625
  }));
22560
- function buildFootprintRestoreTransaction(_x5, _x6, _x7, _x8) {
22626
+ function buildFootprintRestoreTransaction(_x6, _x7, _x8, _x9) {
22561
22627
  return _buildFootprintRestoreTransaction.apply(this, arguments);
22562
22628
  }
22563
22629
  return buildFootprintRestoreTransaction;
@@ -22628,6 +22694,46 @@ assembled_transaction_defineProperty(AssembledTransaction, "Errors", {
22628
22694
  }
22629
22695
  assembled_transaction_inherits(FakeAccountError, _Error8);
22630
22696
  return assembled_transaction_createClass(FakeAccountError);
22697
+ }(assembled_transaction_wrapNativeSuper(Error)),
22698
+ SimulationFailed: function (_Error9) {
22699
+ function SimulationFailedError() {
22700
+ assembled_transaction_classCallCheck(this, SimulationFailedError);
22701
+ return assembled_transaction_callSuper(this, SimulationFailedError, arguments);
22702
+ }
22703
+ assembled_transaction_inherits(SimulationFailedError, _Error9);
22704
+ return assembled_transaction_createClass(SimulationFailedError);
22705
+ }(assembled_transaction_wrapNativeSuper(Error)),
22706
+ InternalWalletError: function (_Error10) {
22707
+ function InternalWalletError() {
22708
+ assembled_transaction_classCallCheck(this, InternalWalletError);
22709
+ return assembled_transaction_callSuper(this, InternalWalletError, arguments);
22710
+ }
22711
+ assembled_transaction_inherits(InternalWalletError, _Error10);
22712
+ return assembled_transaction_createClass(InternalWalletError);
22713
+ }(assembled_transaction_wrapNativeSuper(Error)),
22714
+ ExternalServiceError: function (_Error11) {
22715
+ function ExternalServiceError() {
22716
+ assembled_transaction_classCallCheck(this, ExternalServiceError);
22717
+ return assembled_transaction_callSuper(this, ExternalServiceError, arguments);
22718
+ }
22719
+ assembled_transaction_inherits(ExternalServiceError, _Error11);
22720
+ return assembled_transaction_createClass(ExternalServiceError);
22721
+ }(assembled_transaction_wrapNativeSuper(Error)),
22722
+ InvalidClientRequest: function (_Error12) {
22723
+ function InvalidClientRequestError() {
22724
+ assembled_transaction_classCallCheck(this, InvalidClientRequestError);
22725
+ return assembled_transaction_callSuper(this, InvalidClientRequestError, arguments);
22726
+ }
22727
+ assembled_transaction_inherits(InvalidClientRequestError, _Error12);
22728
+ return assembled_transaction_createClass(InvalidClientRequestError);
22729
+ }(assembled_transaction_wrapNativeSuper(Error)),
22730
+ UserRejected: function (_Error13) {
22731
+ function UserRejectedError() {
22732
+ assembled_transaction_classCallCheck(this, UserRejectedError);
22733
+ return assembled_transaction_callSuper(this, UserRejectedError, arguments);
22734
+ }
22735
+ assembled_transaction_inherits(UserRejectedError, _Error13);
22736
+ return assembled_transaction_createClass(UserRejectedError);
22631
22737
  }(assembled_transaction_wrapNativeSuper(Error))
22632
22738
  });
22633
22739
  ;// ./src/contract/basic_node_signer.ts
@@ -22640,38 +22746,46 @@ function basic_node_signer_asyncToGenerator(n) { return function () { var t = th
22640
22746
  var basicNodeSigner = function basicNodeSigner(keypair, networkPassphrase) {
22641
22747
  return {
22642
22748
  signTransaction: function () {
22643
- var _signTransaction = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee(tx) {
22749
+ var _signTransaction = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee(xdr, opts) {
22644
22750
  var t;
22645
22751
  return basic_node_signer_regeneratorRuntime().wrap(function _callee$(_context) {
22646
22752
  while (1) switch (_context.prev = _context.next) {
22647
22753
  case 0:
22648
- t = lib.TransactionBuilder.fromXDR(tx, networkPassphrase);
22754
+ t = lib.TransactionBuilder.fromXDR(xdr, (opts === null || opts === void 0 ? void 0 : opts.networkPassphrase) || networkPassphrase);
22649
22755
  t.sign(keypair);
22650
- return _context.abrupt("return", t.toXDR());
22756
+ return _context.abrupt("return", {
22757
+ signedTxXdr: t.toXDR(),
22758
+ signerAddress: keypair.publicKey()
22759
+ });
22651
22760
  case 3:
22652
22761
  case "end":
22653
22762
  return _context.stop();
22654
22763
  }
22655
22764
  }, _callee);
22656
22765
  }));
22657
- function signTransaction(_x) {
22766
+ function signTransaction(_x, _x2) {
22658
22767
  return _signTransaction.apply(this, arguments);
22659
22768
  }
22660
22769
  return signTransaction;
22661
22770
  }(),
22662
22771
  signAuthEntry: function () {
22663
- var _signAuthEntry = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee2(entryXdr) {
22772
+ var _signAuthEntry = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee2(authEntry) {
22773
+ var signedAuthEntry;
22664
22774
  return basic_node_signer_regeneratorRuntime().wrap(function _callee2$(_context2) {
22665
22775
  while (1) switch (_context2.prev = _context2.next) {
22666
22776
  case 0:
22667
- return _context2.abrupt("return", keypair.sign((0,lib.hash)(basic_node_signer_Buffer.from(entryXdr, "base64"))).toString("base64"));
22668
- case 1:
22777
+ signedAuthEntry = keypair.sign((0,lib.hash)(basic_node_signer_Buffer.from(authEntry, "base64"))).toString("base64");
22778
+ return _context2.abrupt("return", {
22779
+ signedAuthEntry: signedAuthEntry,
22780
+ signerAddress: keypair.publicKey()
22781
+ });
22782
+ case 2:
22669
22783
  case "end":
22670
22784
  return _context2.stop();
22671
22785
  }
22672
22786
  }, _callee2);
22673
22787
  }));
22674
- function signAuthEntry(_x2) {
22788
+ function signAuthEntry(_x3) {
22675
22789
  return _signAuthEntry.apply(this, arguments);
22676
22790
  }
22677
22791
  return signAuthEntry;
@@ -23696,11 +23810,10 @@ var Spec = function () {
23696
23810
  }();
23697
23811
  ;// ./src/contract/client.ts
23698
23812
  /* provided dependency */ var client_Buffer = __webpack_require__(8287)["Buffer"];
23699
- var _excluded = ["method"];
23700
23813
  function client_typeof(o) { "@babel/helpers - typeof"; return client_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; }, client_typeof(o); }
23814
+ var _excluded = ["method"],
23815
+ _excluded2 = ["wasmHash", "salt", "format", "fee", "timeoutInSeconds", "simulate"];
23701
23816
  function client_regeneratorRuntime() { "use strict"; client_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" == client_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(client_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; }
23702
- function client_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); }
23703
- function client_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
23704
23817
  function client_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; }
23705
23818
  function client_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? client_ownKeys(Object(t), !0).forEach(function (r) { client_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : client_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23706
23819
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
@@ -23711,10 +23824,86 @@ function client_createClass(e, r, t) { return r && client_defineProperties(e.pro
23711
23824
  function client_defineProperty(e, r, t) { return (r = client_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
23712
23825
  function client_toPropertyKey(t) { var i = client_toPrimitive(t, "string"); return "symbol" == client_typeof(i) ? i : i + ""; }
23713
23826
  function client_toPrimitive(t, r) { if ("object" != client_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != client_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23827
+ function client_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); }
23828
+ function client_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
23829
+
23714
23830
 
23715
23831
 
23716
23832
 
23717
23833
 
23834
+ var CONSTRUCTOR_FUNC = "__constructor";
23835
+ function specFromWasm(_x) {
23836
+ return _specFromWasm.apply(this, arguments);
23837
+ }
23838
+ function _specFromWasm() {
23839
+ _specFromWasm = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee5(wasm) {
23840
+ var wasmModule, xdrSections, bufferSection, specEntryArray, spec;
23841
+ return client_regeneratorRuntime().wrap(function _callee5$(_context5) {
23842
+ while (1) switch (_context5.prev = _context5.next) {
23843
+ case 0:
23844
+ _context5.next = 2;
23845
+ return WebAssembly.compile(wasm);
23846
+ case 2:
23847
+ wasmModule = _context5.sent;
23848
+ xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
23849
+ if (!(xdrSections.length === 0)) {
23850
+ _context5.next = 6;
23851
+ break;
23852
+ }
23853
+ throw new Error("Could not obtain contract spec from wasm");
23854
+ case 6:
23855
+ bufferSection = client_Buffer.from(xdrSections[0]);
23856
+ specEntryArray = processSpecEntryStream(bufferSection);
23857
+ spec = new Spec(specEntryArray);
23858
+ return _context5.abrupt("return", spec);
23859
+ case 10:
23860
+ case "end":
23861
+ return _context5.stop();
23862
+ }
23863
+ }, _callee5);
23864
+ }));
23865
+ return _specFromWasm.apply(this, arguments);
23866
+ }
23867
+ function specFromWasmHash(_x2, _x3) {
23868
+ return _specFromWasmHash.apply(this, arguments);
23869
+ }
23870
+ function _specFromWasmHash() {
23871
+ _specFromWasmHash = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee6(wasmHash, options) {
23872
+ var format,
23873
+ rpcUrl,
23874
+ allowHttp,
23875
+ serverOpts,
23876
+ server,
23877
+ wasm,
23878
+ _args6 = arguments;
23879
+ return client_regeneratorRuntime().wrap(function _callee6$(_context6) {
23880
+ while (1) switch (_context6.prev = _context6.next) {
23881
+ case 0:
23882
+ format = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : "hex";
23883
+ if (!(!options || !options.rpcUrl)) {
23884
+ _context6.next = 3;
23885
+ break;
23886
+ }
23887
+ throw new TypeError("options must contain rpcUrl");
23888
+ case 3:
23889
+ rpcUrl = options.rpcUrl, allowHttp = options.allowHttp;
23890
+ serverOpts = {
23891
+ allowHttp: allowHttp
23892
+ };
23893
+ server = new rpc.Server(rpcUrl, serverOpts);
23894
+ _context6.next = 8;
23895
+ return server.getContractWasmByHash(wasmHash, format);
23896
+ case 8:
23897
+ wasm = _context6.sent;
23898
+ return _context6.abrupt("return", specFromWasm(wasm));
23899
+ case 10:
23900
+ case "end":
23901
+ return _context6.stop();
23902
+ }
23903
+ }, _callee6);
23904
+ }));
23905
+ return _specFromWasmHash.apply(this, arguments);
23906
+ }
23718
23907
  var Client = function () {
23719
23908
  function Client(spec, options) {
23720
23909
  var _this = this;
@@ -23737,6 +23926,9 @@ var Client = function () {
23737
23926
  this.options = options;
23738
23927
  this.spec.funcs().forEach(function (xdrFn) {
23739
23928
  var method = xdrFn.name().toString();
23929
+ if (method === CONSTRUCTOR_FUNC) {
23930
+ return;
23931
+ }
23740
23932
  var assembleTransaction = function assembleTransaction(args, methodOptions) {
23741
23933
  return AssembledTransaction.build(client_objectSpread(client_objectSpread(client_objectSpread({
23742
23934
  method: method,
@@ -23758,22 +23950,65 @@ var Client = function () {
23758
23950
  });
23759
23951
  }
23760
23952
  return client_createClass(Client, null, [{
23953
+ key: "deploy",
23954
+ value: function () {
23955
+ var _deploy = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee(args, options) {
23956
+ var wasmHash, salt, format, fee, timeoutInSeconds, simulate, clientOptions, spec, operation;
23957
+ return client_regeneratorRuntime().wrap(function _callee$(_context) {
23958
+ while (1) switch (_context.prev = _context.next) {
23959
+ case 0:
23960
+ wasmHash = options.wasmHash, salt = options.salt, format = options.format, fee = options.fee, timeoutInSeconds = options.timeoutInSeconds, simulate = options.simulate, clientOptions = _objectWithoutProperties(options, _excluded2);
23961
+ _context.next = 3;
23962
+ return specFromWasmHash(wasmHash, clientOptions, format);
23963
+ case 3:
23964
+ spec = _context.sent;
23965
+ operation = lib.Operation.createCustomContract({
23966
+ address: new lib.Address(options.publicKey),
23967
+ wasmHash: typeof wasmHash === "string" ? client_Buffer.from(wasmHash, format !== null && format !== void 0 ? format : "hex") : wasmHash,
23968
+ salt: salt,
23969
+ constructorArgs: args ? spec.funcArgsToScVals(CONSTRUCTOR_FUNC, args) : []
23970
+ });
23971
+ return _context.abrupt("return", AssembledTransaction.buildWithOp(operation, client_objectSpread(client_objectSpread({
23972
+ fee: fee,
23973
+ timeoutInSeconds: timeoutInSeconds,
23974
+ simulate: simulate
23975
+ }, clientOptions), {}, {
23976
+ contractId: "ignored",
23977
+ method: CONSTRUCTOR_FUNC,
23978
+ parseResultXdr: function parseResultXdr(result) {
23979
+ return new Client(spec, client_objectSpread(client_objectSpread({}, clientOptions), {}, {
23980
+ contractId: lib.Address.fromScVal(result).toString()
23981
+ }));
23982
+ }
23983
+ })));
23984
+ case 6:
23985
+ case "end":
23986
+ return _context.stop();
23987
+ }
23988
+ }, _callee);
23989
+ }));
23990
+ function deploy(_x4, _x5) {
23991
+ return _deploy.apply(this, arguments);
23992
+ }
23993
+ return deploy;
23994
+ }()
23995
+ }, {
23761
23996
  key: "fromWasmHash",
23762
23997
  value: (function () {
23763
- var _fromWasmHash = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee(wasmHash, options) {
23998
+ var _fromWasmHash = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee2(wasmHash, options) {
23764
23999
  var format,
23765
24000
  rpcUrl,
23766
24001
  allowHttp,
23767
24002
  serverOpts,
23768
24003
  server,
23769
24004
  wasm,
23770
- _args = arguments;
23771
- return client_regeneratorRuntime().wrap(function _callee$(_context) {
23772
- while (1) switch (_context.prev = _context.next) {
24005
+ _args2 = arguments;
24006
+ return client_regeneratorRuntime().wrap(function _callee2$(_context2) {
24007
+ while (1) switch (_context2.prev = _context2.next) {
23773
24008
  case 0:
23774
- format = _args.length > 2 && _args[2] !== undefined ? _args[2] : "hex";
24009
+ format = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : "hex";
23775
24010
  if (!(!options || !options.rpcUrl)) {
23776
- _context.next = 3;
24011
+ _context2.next = 3;
23777
24012
  break;
23778
24013
  }
23779
24014
  throw new TypeError('options must contain rpcUrl');
@@ -23783,18 +24018,18 @@ var Client = function () {
23783
24018
  allowHttp: allowHttp
23784
24019
  };
23785
24020
  server = new rpc.Server(rpcUrl, serverOpts);
23786
- _context.next = 8;
24021
+ _context2.next = 8;
23787
24022
  return server.getContractWasmByHash(wasmHash, format);
23788
24023
  case 8:
23789
- wasm = _context.sent;
23790
- return _context.abrupt("return", Client.fromWasm(wasm, options));
24024
+ wasm = _context2.sent;
24025
+ return _context2.abrupt("return", Client.fromWasm(wasm, options));
23791
24026
  case 10:
23792
24027
  case "end":
23793
- return _context.stop();
24028
+ return _context2.stop();
23794
24029
  }
23795
- }, _callee);
24030
+ }, _callee2);
23796
24031
  }));
23797
- function fromWasmHash(_x, _x2) {
24032
+ function fromWasmHash(_x6, _x7) {
23798
24033
  return _fromWasmHash.apply(this, arguments);
23799
24034
  }
23800
24035
  return fromWasmHash;
@@ -23802,33 +24037,23 @@ var Client = function () {
23802
24037
  }, {
23803
24038
  key: "fromWasm",
23804
24039
  value: (function () {
23805
- var _fromWasm = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee2(wasm, options) {
23806
- var wasmModule, xdrSections, bufferSection, specEntryArray, spec;
23807
- return client_regeneratorRuntime().wrap(function _callee2$(_context2) {
23808
- while (1) switch (_context2.prev = _context2.next) {
24040
+ var _fromWasm = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee3(wasm, options) {
24041
+ var spec;
24042
+ return client_regeneratorRuntime().wrap(function _callee3$(_context3) {
24043
+ while (1) switch (_context3.prev = _context3.next) {
23809
24044
  case 0:
23810
- _context2.next = 2;
23811
- return WebAssembly.compile(wasm);
24045
+ _context3.next = 2;
24046
+ return specFromWasm(wasm);
23812
24047
  case 2:
23813
- wasmModule = _context2.sent;
23814
- xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
23815
- if (!(xdrSections.length === 0)) {
23816
- _context2.next = 6;
23817
- break;
23818
- }
23819
- throw new Error('Could not obtain contract spec from wasm');
23820
- case 6:
23821
- bufferSection = client_Buffer.from(xdrSections[0]);
23822
- specEntryArray = processSpecEntryStream(bufferSection);
23823
- spec = new Spec(specEntryArray);
23824
- return _context2.abrupt("return", new Client(spec, options));
23825
- case 10:
24048
+ spec = _context3.sent;
24049
+ return _context3.abrupt("return", new Client(spec, options));
24050
+ case 4:
23826
24051
  case "end":
23827
- return _context2.stop();
24052
+ return _context3.stop();
23828
24053
  }
23829
- }, _callee2);
24054
+ }, _callee3);
23830
24055
  }));
23831
- function fromWasm(_x3, _x4) {
24056
+ function fromWasm(_x8, _x9) {
23832
24057
  return _fromWasm.apply(this, arguments);
23833
24058
  }
23834
24059
  return fromWasm;
@@ -23836,13 +24061,13 @@ var Client = function () {
23836
24061
  }, {
23837
24062
  key: "from",
23838
24063
  value: (function () {
23839
- var _from = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee3(options) {
24064
+ var _from = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee4(options) {
23840
24065
  var rpcUrl, contractId, allowHttp, serverOpts, server, wasm;
23841
- return client_regeneratorRuntime().wrap(function _callee3$(_context3) {
23842
- while (1) switch (_context3.prev = _context3.next) {
24066
+ return client_regeneratorRuntime().wrap(function _callee4$(_context4) {
24067
+ while (1) switch (_context4.prev = _context4.next) {
23843
24068
  case 0:
23844
24069
  if (!(!options || !options.rpcUrl || !options.contractId)) {
23845
- _context3.next = 2;
24070
+ _context4.next = 2;
23846
24071
  break;
23847
24072
  }
23848
24073
  throw new TypeError('options must contain rpcUrl and contractId');
@@ -23852,18 +24077,18 @@ var Client = function () {
23852
24077
  allowHttp: allowHttp
23853
24078
  };
23854
24079
  server = new rpc.Server(rpcUrl, serverOpts);
23855
- _context3.next = 7;
24080
+ _context4.next = 7;
23856
24081
  return server.getContractWasmByContractId(contractId);
23857
24082
  case 7:
23858
- wasm = _context3.sent;
23859
- return _context3.abrupt("return", Client.fromWasm(wasm, options));
24083
+ wasm = _context4.sent;
24084
+ return _context4.abrupt("return", Client.fromWasm(wasm, options));
23860
24085
  case 9:
23861
24086
  case "end":
23862
- return _context3.stop();
24087
+ return _context4.stop();
23863
24088
  }
23864
- }, _callee3);
24089
+ }, _callee4);
23865
24090
  }));
23866
- function from(_x5) {
24091
+ function from(_x10) {
23867
24092
  return _from.apply(this, arguments);
23868
24093
  }
23869
24094
  return from;
@@ -24353,7 +24578,7 @@ var Api;
24353
24578
 
24354
24579
  /***/ }),
24355
24580
 
24356
- /***/ 2731:
24581
+ /***/ 8733:
24357
24582
  /***/ ((module, __webpack_exports__, __webpack_require__) => {
24358
24583
 
24359
24584
  "use strict";
@@ -24463,10 +24688,69 @@ var HorizonApi;
24463
24688
  }({});
24464
24689
  _HorizonApi.TransactionFailedResultCodes = TransactionFailedResultCodes;
24465
24690
  })(HorizonApi || (HorizonApi = {}));
24691
+ ;// ./src/horizon/types/effects.ts
24692
+ var effects_EffectType = function (EffectType) {
24693
+ EffectType[EffectType["account_created"] = 0] = "account_created";
24694
+ EffectType[EffectType["account_removed"] = 1] = "account_removed";
24695
+ EffectType[EffectType["account_credited"] = 2] = "account_credited";
24696
+ EffectType[EffectType["account_debited"] = 3] = "account_debited";
24697
+ EffectType[EffectType["account_thresholds_updated"] = 4] = "account_thresholds_updated";
24698
+ EffectType[EffectType["account_home_domain_updated"] = 5] = "account_home_domain_updated";
24699
+ EffectType[EffectType["account_flags_updated"] = 6] = "account_flags_updated";
24700
+ EffectType[EffectType["account_inflation_destination_updated"] = 7] = "account_inflation_destination_updated";
24701
+ EffectType[EffectType["signer_created"] = 10] = "signer_created";
24702
+ EffectType[EffectType["signer_removed"] = 11] = "signer_removed";
24703
+ EffectType[EffectType["signer_updated"] = 12] = "signer_updated";
24704
+ EffectType[EffectType["trustline_created"] = 20] = "trustline_created";
24705
+ EffectType[EffectType["trustline_removed"] = 21] = "trustline_removed";
24706
+ EffectType[EffectType["trustline_updated"] = 22] = "trustline_updated";
24707
+ EffectType[EffectType["trustline_authorized"] = 23] = "trustline_authorized";
24708
+ EffectType[EffectType["trustline_deauthorized"] = 24] = "trustline_deauthorized";
24709
+ EffectType[EffectType["trustline_authorized_to_maintain_liabilities"] = 25] = "trustline_authorized_to_maintain_liabilities";
24710
+ EffectType[EffectType["trustline_flags_updated"] = 26] = "trustline_flags_updated";
24711
+ EffectType[EffectType["offer_created"] = 30] = "offer_created";
24712
+ EffectType[EffectType["offer_removed"] = 31] = "offer_removed";
24713
+ EffectType[EffectType["offer_updated"] = 32] = "offer_updated";
24714
+ EffectType[EffectType["trade"] = 33] = "trade";
24715
+ EffectType[EffectType["data_created"] = 40] = "data_created";
24716
+ EffectType[EffectType["data_removed"] = 41] = "data_removed";
24717
+ EffectType[EffectType["data_updated"] = 42] = "data_updated";
24718
+ EffectType[EffectType["sequence_bumped"] = 43] = "sequence_bumped";
24719
+ EffectType[EffectType["claimable_balance_created"] = 50] = "claimable_balance_created";
24720
+ EffectType[EffectType["claimable_balance_claimant_created"] = 51] = "claimable_balance_claimant_created";
24721
+ EffectType[EffectType["claimable_balance_claimed"] = 52] = "claimable_balance_claimed";
24722
+ EffectType[EffectType["account_sponsorship_created"] = 60] = "account_sponsorship_created";
24723
+ EffectType[EffectType["account_sponsorship_updated"] = 61] = "account_sponsorship_updated";
24724
+ EffectType[EffectType["account_sponsorship_removed"] = 62] = "account_sponsorship_removed";
24725
+ EffectType[EffectType["trustline_sponsorship_created"] = 63] = "trustline_sponsorship_created";
24726
+ EffectType[EffectType["trustline_sponsorship_updated"] = 64] = "trustline_sponsorship_updated";
24727
+ EffectType[EffectType["trustline_sponsorship_removed"] = 65] = "trustline_sponsorship_removed";
24728
+ EffectType[EffectType["data_sponsorship_created"] = 66] = "data_sponsorship_created";
24729
+ EffectType[EffectType["data_sponsorship_updated"] = 67] = "data_sponsorship_updated";
24730
+ EffectType[EffectType["data_sponsorship_removed"] = 68] = "data_sponsorship_removed";
24731
+ EffectType[EffectType["claimable_balance_sponsorship_created"] = 69] = "claimable_balance_sponsorship_created";
24732
+ EffectType[EffectType["claimable_balance_sponsorship_updated"] = 70] = "claimable_balance_sponsorship_updated";
24733
+ EffectType[EffectType["claimable_balance_sponsorship_removed"] = 71] = "claimable_balance_sponsorship_removed";
24734
+ EffectType[EffectType["signer_sponsorship_created"] = 72] = "signer_sponsorship_created";
24735
+ EffectType[EffectType["signer_sponsorship_updated"] = 73] = "signer_sponsorship_updated";
24736
+ EffectType[EffectType["signer_sponsorship_removed"] = 74] = "signer_sponsorship_removed";
24737
+ EffectType[EffectType["claimable_balance_clawed_back"] = 80] = "claimable_balance_clawed_back";
24738
+ EffectType[EffectType["liquidity_pool_deposited"] = 90] = "liquidity_pool_deposited";
24739
+ EffectType[EffectType["liquidity_pool_withdrew"] = 91] = "liquidity_pool_withdrew";
24740
+ EffectType[EffectType["liquidity_pool_trade"] = 92] = "liquidity_pool_trade";
24741
+ EffectType[EffectType["liquidity_pool_created"] = 93] = "liquidity_pool_created";
24742
+ EffectType[EffectType["liquidity_pool_removed"] = 94] = "liquidity_pool_removed";
24743
+ EffectType[EffectType["liquidity_pool_revoked"] = 95] = "liquidity_pool_revoked";
24744
+ EffectType[EffectType["contract_credited"] = 96] = "contract_credited";
24745
+ EffectType[EffectType["contract_debited"] = 97] = "contract_debited";
24746
+ return EffectType;
24747
+ }({});
24466
24748
  ;// ./src/horizon/server_api.ts
24467
24749
 
24750
+
24468
24751
  var ServerApi;
24469
24752
  (function (_ServerApi) {
24753
+ var EffectType = _ServerApi.EffectType = effects_EffectType;
24470
24754
  var TradeType = function (TradeType) {
24471
24755
  TradeType["all"] = "all";
24472
24756
  TradeType["liquidityPools"] = "liquidity_pool";
@@ -27446,7 +27730,7 @@ var http_client = __webpack_require__(9983);
27446
27730
  function horizon_axios_client_typeof(o) { "@babel/helpers - typeof"; return horizon_axios_client_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; }, horizon_axios_client_typeof(o); }
27447
27731
 
27448
27732
 
27449
- var version = "13.0.0-rc.1";
27733
+ var version = "13.0.0";
27450
27734
  var SERVER_TIME_MAP = {};
27451
27735
  var AxiosClient = (0,http_client/* create */.vt)({
27452
27736
  headers: {
@@ -33362,7 +33646,7 @@ __webpack_require__.r(__webpack_exports__);
33362
33646
  /* harmony import */ var _federation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7600);
33363
33647
  /* harmony import */ var _webauth__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5479);
33364
33648
  /* harmony import */ var _friendbot__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8242);
33365
- /* harmony import */ var _horizon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2731);
33649
+ /* harmony import */ var _horizon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8733);
33366
33650
  /* harmony import */ var _rpc__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3496);
33367
33651
  /* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(6299);
33368
33652
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(356);
@@ -33467,7 +33751,7 @@ var lib = __webpack_require__(356);
33467
33751
  var http_client = __webpack_require__(9983);
33468
33752
  ;// ./src/rpc/axios.ts
33469
33753
 
33470
- var version = "13.0.0-rc.1";
33754
+ var version = "13.0.0";
33471
33755
  var AxiosClient = (0,http_client/* create */.vt)({
33472
33756
  headers: {
33473
33757
  'X-Client-Name': 'js-soroban-client',
@@ -34667,6 +34951,7 @@ var Resolver = function () {
34667
34951
  key: "resolve",
34668
34952
  value: (function () {
34669
34953
  var _resolve = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(domain) {
34954
+ var _opts$allowedRedirect;
34670
34955
  var opts,
34671
34956
  allowHttp,
34672
34957
  timeout,
@@ -34680,6 +34965,7 @@ var Resolver = function () {
34680
34965
  timeout = typeof opts.timeout === "undefined" ? _config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.getTimeout() : opts.timeout;
34681
34966
  protocol = allowHttp ? "http" : "https";
34682
34967
  return _context.abrupt("return", _http_client__WEBPACK_IMPORTED_MODULE_1__/* .httpClient */ .ok.get("".concat(protocol, "://").concat(domain, "/.well-known/stellar.toml"), {
34968
+ maxRedirects: (_opts$allowedRedirect = opts.allowedRedirects) !== null && _opts$allowedRedirect !== void 0 ? _opts$allowedRedirect : 0,
34683
34969
  maxContentLength: STELLAR_TOML_MAX_SIZE,
34684
34970
  cancelToken: timeout ? new CancelToken(function (cancel) {
34685
34971
  return setTimeout(function () {