@stellar/stellar-sdk 12.2.0 → 12.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -534,7 +534,7 @@ var Asset = exports.Asset = /*#__PURE__*/function () {
534
534
  */
535
535
  }], [{
536
536
  key: "native",
537
- value: function native() {
537
+ value: function _native() {
538
538
  return new Asset('XLM');
539
539
  }
540
540
 
@@ -683,6 +683,10 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
683
683
  * authorization entry that you can pass along to
684
684
  * {@link Operation.invokeHostFunction}
685
685
  *
686
+ * @note If using the `SigningCallback` variation, the signer is assumed to be
687
+ * the entry's credential address. If you need a different key to sign the
688
+ * entry, you will need to use different method (e.g., fork this code).
689
+ *
686
690
  * @see authorizeInvocation
687
691
  * @example
688
692
  * import {
@@ -765,7 +769,7 @@ function authorizeEntry(_x, _x2, _x3) {
765
769
  * @see authorizeEntry
766
770
  */
767
771
  function _authorizeEntry() {
768
- _authorizeEntry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(entry, signer, validUntilLedgerSeq) {
772
+ _authorizeEntry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(entry, signer, validUntilLedgerSeq) {
769
773
  var networkPassphrase,
770
774
  clone,
771
775
  addrAuth,
@@ -799,7 +803,7 @@ function _authorizeEntry() {
799
803
  }));
800
804
  payload = (0, _hashing.hash)(preimage.toXDR());
801
805
  if (!(typeof signer === 'function')) {
802
- _context.next = 17;
806
+ _context.next = 18;
803
807
  break;
804
808
  }
805
809
  _context.t0 = Buffer;
@@ -808,18 +812,19 @@ function _authorizeEntry() {
808
812
  case 13:
809
813
  _context.t1 = _context.sent;
810
814
  signature = _context.t0.from.call(_context.t0, _context.t1);
811
- _context.next = 18;
815
+ publicKey = _address.Address.fromScAddress(addrAuth.address()).toString();
816
+ _context.next = 20;
812
817
  break;
813
- case 17:
814
- signature = Buffer.from(signer.sign(payload));
815
818
  case 18:
816
- publicKey = _address.Address.fromScAddress(addrAuth.address()).toString();
819
+ signature = Buffer.from(signer.sign(payload));
820
+ publicKey = signer.publicKey();
821
+ case 20:
817
822
  if (_keypair.Keypair.fromPublicKey(publicKey).verify(payload, signature)) {
818
- _context.next = 21;
823
+ _context.next = 22;
819
824
  break;
820
825
  }
821
826
  throw new Error("signature doesn't match payload");
822
- case 21:
827
+ case 22:
823
828
  // This structure is defined here:
824
829
  // https://soroban.stellar.org/docs/fundamentals-and-concepts/invoking-contracts-with-transactions#stellar-account-signatures
825
830
  //
@@ -836,7 +841,7 @@ function _authorizeEntry() {
836
841
  });
837
842
  addrAuth.signature(_xdr["default"].ScVal.scvVec([sigScVal]));
838
843
  return _context.abrupt("return", clone);
839
- case 24:
844
+ case 25:
840
845
  case "end":
841
846
  return _context.stop();
842
847
  }
@@ -10593,7 +10598,8 @@ function buildInvocationTree(root) {
10593
10598
  * @param {xdr.SorobanAuthorizedInvocation} [parent] this `node`s parent node,
10594
10599
  * if any (i.e. this doesn't exist at the root)
10595
10600
  *
10596
- * @returns {boolean?} returning `false` is a hint to stop exploring
10601
+ * @returns {boolean|null|void} returning exactly `false` is a hint to stop
10602
+ * exploring, other values are ignored
10597
10603
  */
10598
10604
 
10599
10605
  /**
@@ -21446,33 +21452,11 @@ var AssembledTransaction = function () {
21446
21452
  }
21447
21453
  }, _callee3);
21448
21454
  })));
21449
- assembled_transaction_defineProperty(this, "getStorageExpiration", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee4() {
21450
- var entryRes;
21451
- return assembled_transaction_regeneratorRuntime().wrap(function _callee4$(_context4) {
21452
- while (1) switch (_context4.prev = _context4.next) {
21453
- case 0:
21454
- _context4.next = 2;
21455
- return _this.server.getLedgerEntries(new lib.Contract(_this.options.contractId).getFootprint());
21456
- case 2:
21457
- entryRes = _context4.sent;
21458
- if (!(!entryRes.entries || !entryRes.entries.length || !entryRes.entries[0].liveUntilLedgerSeq)) {
21459
- _context4.next = 5;
21460
- break;
21461
- }
21462
- throw new Error("failed to get ledger entry");
21463
- case 5:
21464
- return _context4.abrupt("return", entryRes.entries[0].liveUntilLedgerSeq);
21465
- case 6:
21466
- case "end":
21467
- return _context4.stop();
21468
- }
21469
- }, _callee4);
21470
- })));
21471
21455
  assembled_transaction_defineProperty(this, "needsNonInvokerSigningBy", function () {
21472
21456
  var _rawInvokeHostFunctio;
21473
- var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21474
- _ref8$includeAlreadyS = _ref8.includeAlreadySigned,
21475
- includeAlreadySigned = _ref8$includeAlreadyS === void 0 ? false : _ref8$includeAlreadyS;
21457
+ var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21458
+ _ref7$includeAlreadyS = _ref7.includeAlreadySigned,
21459
+ includeAlreadySigned = _ref7$includeAlreadyS === void 0 ? false : _ref7$includeAlreadyS;
21476
21460
  if (!_this.built) {
21477
21461
  throw new Error("Transaction has not yet been simulated");
21478
21462
  }
@@ -21488,12 +21472,12 @@ var AssembledTransaction = function () {
21488
21472
  });
21489
21473
  assembled_transaction_defineProperty(this, "signAuthEntries", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee6() {
21490
21474
  var _rawInvokeHostFunctio2;
21491
- var _ref10,
21492
- _ref10$expiration,
21475
+ var _ref9,
21476
+ _ref9$expiration,
21493
21477
  expiration,
21494
- _ref10$signAuthEntry,
21478
+ _ref9$signAuthEntry,
21495
21479
  signAuthEntry,
21496
- _ref10$publicKey,
21480
+ _ref9$publicKey,
21497
21481
  publicKey,
21498
21482
  needsNonInvokerSigningBy,
21499
21483
  rawInvokeHostFunctionOp,
@@ -21508,7 +21492,21 @@ var AssembledTransaction = function () {
21508
21492
  return assembled_transaction_regeneratorRuntime().wrap(function _callee6$(_context6) {
21509
21493
  while (1) switch (_context6.prev = _context6.next) {
21510
21494
  case 0:
21511
- _ref10 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref10$expiration = _ref10.expiration, expiration = _ref10$expiration === void 0 ? _this.getStorageExpiration() : _ref10$expiration, _ref10$signAuthEntry = _ref10.signAuthEntry, signAuthEntry = _ref10$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref10$signAuthEntry, _ref10$publicKey = _ref10.publicKey, publicKey = _ref10$publicKey === void 0 ? _this.options.publicKey : _ref10$publicKey;
21495
+ _ref9 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref9$expiration = _ref9.expiration, expiration = _ref9$expiration === void 0 ? assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee4() {
21496
+ return assembled_transaction_regeneratorRuntime().wrap(function _callee4$(_context4) {
21497
+ while (1) switch (_context4.prev = _context4.next) {
21498
+ case 0:
21499
+ _context4.next = 2;
21500
+ return _this.server.getLatestLedger();
21501
+ case 2:
21502
+ _context4.t0 = _context4.sent.sequence;
21503
+ return _context4.abrupt("return", _context4.t0 + 100);
21504
+ case 4:
21505
+ case "end":
21506
+ return _context4.stop();
21507
+ }
21508
+ }, _callee4);
21509
+ }))() : _ref9$expiration, _ref9$signAuthEntry = _ref9.signAuthEntry, signAuthEntry = _ref9$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref9$signAuthEntry, _ref9$publicKey = _ref9.publicKey, publicKey = _ref9$publicKey === void 0 ? _this.options.publicKey : _ref9$publicKey;
21512
21510
  if (_this.built) {
21513
21511
  _context6.next = 3;
21514
21512
  break;
@@ -26805,10 +26803,10 @@ var CallBuilder = function () {
26805
26803
  timeout = setTimeout(function () {
26806
26804
  var _es;
26807
26805
  (_es = es) === null || _es === void 0 || _es.close();
26808
- es = createEventSource();
26806
+ es = _createEventSource();
26809
26807
  }, options.reconnectTimeout || 15 * 1000);
26810
26808
  };
26811
- var createEventSource = function createEventSource() {
26809
+ var _createEventSource = function createEventSource() {
26812
26810
  try {
26813
26811
  es = new EventSource(_this2.url.toString());
26814
26812
  } catch (err) {
@@ -26827,7 +26825,7 @@ var CallBuilder = function () {
26827
26825
  }
26828
26826
  clearTimeout(timeout);
26829
26827
  es.close();
26830
- createEventSource();
26828
+ _createEventSource();
26831
26829
  closed = true;
26832
26830
  };
26833
26831
  var onMessage = function onMessage(message) {
@@ -26860,7 +26858,7 @@ var CallBuilder = function () {
26860
26858
  }
26861
26859
  return es;
26862
26860
  };
26863
- createEventSource();
26861
+ _createEventSource();
26864
26862
  return function () {
26865
26863
  var _es2;
26866
26864
  clearTimeout(timeout);
@@ -27072,10 +27070,11 @@ var CallBuilder = function () {
27072
27070
  key: "_handleNetworkError",
27073
27071
  value: (function () {
27074
27072
  var _handleNetworkError2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee6(error) {
27073
+ var _error$response$statu, _error$response$statu2;
27075
27074
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
27076
27075
  while (1) switch (_context6.prev = _context6.next) {
27077
27076
  case 0:
27078
- if (!(error.response && error.response.status && error.response.statusText)) {
27077
+ if (!(error.response && error.response.status)) {
27079
27078
  _context6.next = 8;
27080
27079
  break;
27081
27080
  }
@@ -27083,9 +27082,9 @@ var CallBuilder = function () {
27083
27082
  _context6.next = _context6.t0 === 404 ? 4 : 5;
27084
27083
  break;
27085
27084
  case 4:
27086
- return _context6.abrupt("return", Promise.reject(new errors/* NotFoundError */.m_(error.response.statusText, error.response.data)));
27085
+ return _context6.abrupt("return", Promise.reject(new errors/* NotFoundError */.m_((_error$response$statu = error.response.statusText) !== null && _error$response$statu !== void 0 ? _error$response$statu : "Not Found", error.response.data)));
27087
27086
  case 5:
27088
- return _context6.abrupt("return", Promise.reject(new errors/* NetworkError */.Dr(error.response.statusText, error.response.data)));
27087
+ return _context6.abrupt("return", Promise.reject(new errors/* NetworkError */.Dr((_error$response$statu2 = error.response.statusText) !== null && _error$response$statu2 !== void 0 ? _error$response$statu2 : "Unknown", error.response.data)));
27089
27088
  case 6:
27090
27089
  _context6.next = 9;
27091
27090
  break;
@@ -28631,8 +28630,10 @@ __webpack_require__.r(__webpack_exports__);
28631
28630
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
28632
28631
  /* harmony export */ $D: () => (/* binding */ parseRawLedgerEntries),
28633
28632
  /* harmony export */ Af: () => (/* binding */ parseRawSendTransaction),
28633
+ /* harmony export */ WC: () => (/* binding */ parseTransactionInfo),
28634
28634
  /* harmony export */ fG: () => (/* binding */ parseRawEvents),
28635
- /* harmony export */ jr: () => (/* binding */ parseRawSimulation)
28635
+ /* harmony export */ jr: () => (/* binding */ parseRawSimulation),
28636
+ /* harmony export */ tR: () => (/* binding */ parseRawTransactions)
28636
28637
  /* harmony export */ });
28637
28638
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(356);
28638
28639
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__);
@@ -28661,6 +28662,33 @@ function parseRawSendTransaction(r) {
28661
28662
  }
28662
28663
  return _objectSpread({}, r);
28663
28664
  }
28665
+ function parseTransactionInfo(raw) {
28666
+ var meta = _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.TransactionMeta.fromXDR(raw.resultMetaXdr, 'base64');
28667
+ var info = {
28668
+ ledger: raw.ledger,
28669
+ createdAt: raw.createdAt,
28670
+ applicationOrder: raw.applicationOrder,
28671
+ feeBump: raw.feeBump,
28672
+ envelopeXdr: _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.TransactionEnvelope.fromXDR(raw.envelopeXdr, 'base64'),
28673
+ resultXdr: _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.TransactionResult.fromXDR(raw.resultXdr, 'base64'),
28674
+ resultMetaXdr: meta
28675
+ };
28676
+ if (meta.switch() === 3 && meta.v3().sorobanMeta() !== null) {
28677
+ var _meta$v3$sorobanMeta;
28678
+ info.returnValue = (_meta$v3$sorobanMeta = meta.v3().sorobanMeta()) === null || _meta$v3$sorobanMeta === void 0 ? void 0 : _meta$v3$sorobanMeta.returnValue();
28679
+ }
28680
+ if ('diagnosticEventsXdr' in raw && raw.diagnosticEventsXdr) {
28681
+ info.diagnosticEventsXdr = raw.diagnosticEventsXdr.map(function (diagnosticEvent) {
28682
+ return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(diagnosticEvent, 'base64');
28683
+ });
28684
+ }
28685
+ return info;
28686
+ }
28687
+ function parseRawTransactions(r) {
28688
+ return _objectSpread({
28689
+ status: r.status
28690
+ }, parseTransactionInfo(r));
28691
+ }
28664
28692
  function parseRawEvents(r) {
28665
28693
  var _r$events;
28666
28694
  return {
@@ -29169,19 +29197,7 @@ var Server = function () {
29169
29197
  return _context8.abrupt("return", this._getTransaction(hash).then(function (raw) {
29170
29198
  var foundInfo = {};
29171
29199
  if (raw.status !== api/* Api */.j.GetTransactionStatus.NOT_FOUND) {
29172
- var _meta$v3$sorobanMeta;
29173
- var meta = lib.xdr.TransactionMeta.fromXDR(raw.resultMetaXdr, 'base64');
29174
- foundInfo = _objectSpread({
29175
- ledger: raw.ledger,
29176
- createdAt: raw.createdAt,
29177
- applicationOrder: raw.applicationOrder,
29178
- feeBump: raw.feeBump,
29179
- envelopeXdr: lib.xdr.TransactionEnvelope.fromXDR(raw.envelopeXdr, 'base64'),
29180
- resultXdr: lib.xdr.TransactionResult.fromXDR(raw.resultXdr, 'base64'),
29181
- resultMetaXdr: meta
29182
- }, meta.switch() === 3 && meta.v3().sorobanMeta() !== null && raw.status === api/* Api */.j.GetTransactionStatus.SUCCESS && {
29183
- returnValue: (_meta$v3$sorobanMeta = meta.v3().sorobanMeta()) === null || _meta$v3$sorobanMeta === void 0 ? void 0 : _meta$v3$sorobanMeta.returnValue()
29184
- });
29200
+ Object.assign(foundInfo, (0,parsers/* parseTransactionInfo */.WC)(raw));
29185
29201
  }
29186
29202
  var result = _objectSpread({
29187
29203
  status: raw.status,
@@ -29225,20 +29241,68 @@ var Server = function () {
29225
29241
  return _getTransaction;
29226
29242
  }()
29227
29243
  }, {
29228
- key: "getEvents",
29244
+ key: "getTransactions",
29229
29245
  value: (function () {
29230
- var _getEvents2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee10(request) {
29246
+ var _getTransactions2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee10(request) {
29231
29247
  return server_regeneratorRuntime().wrap(function _callee10$(_context10) {
29232
29248
  while (1) switch (_context10.prev = _context10.next) {
29233
29249
  case 0:
29234
- return _context10.abrupt("return", this._getEvents(request).then(parsers/* parseRawEvents */.fG));
29250
+ return _context10.abrupt("return", this._getTransactions(request).then(function (raw) {
29251
+ var result = {
29252
+ transactions: raw.transactions.map(parsers/* parseRawTransactions */.tR),
29253
+ latestLedger: raw.latestLedger,
29254
+ latestLedgerCloseTimestamp: raw.latestLedgerCloseTimestamp,
29255
+ oldestLedger: raw.oldestLedger,
29256
+ oldestLedgerCloseTimestamp: raw.oldestLedgerCloseTimestamp,
29257
+ cursor: raw.cursor
29258
+ };
29259
+ return result;
29260
+ }));
29235
29261
  case 1:
29236
29262
  case "end":
29237
29263
  return _context10.stop();
29238
29264
  }
29239
29265
  }, _callee10, this);
29240
29266
  }));
29241
- function getEvents(_x8) {
29267
+ function getTransactions(_x8) {
29268
+ return _getTransactions2.apply(this, arguments);
29269
+ }
29270
+ return getTransactions;
29271
+ }())
29272
+ }, {
29273
+ key: "_getTransactions",
29274
+ value: function () {
29275
+ var _getTransactions3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee11(request) {
29276
+ return server_regeneratorRuntime().wrap(function _callee11$(_context11) {
29277
+ while (1) switch (_context11.prev = _context11.next) {
29278
+ case 0:
29279
+ return _context11.abrupt("return", postObject(this.serverURL.toString(), 'getTransactions', request));
29280
+ case 1:
29281
+ case "end":
29282
+ return _context11.stop();
29283
+ }
29284
+ }, _callee11, this);
29285
+ }));
29286
+ function _getTransactions(_x9) {
29287
+ return _getTransactions3.apply(this, arguments);
29288
+ }
29289
+ return _getTransactions;
29290
+ }()
29291
+ }, {
29292
+ key: "getEvents",
29293
+ value: (function () {
29294
+ var _getEvents2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee12(request) {
29295
+ return server_regeneratorRuntime().wrap(function _callee12$(_context12) {
29296
+ while (1) switch (_context12.prev = _context12.next) {
29297
+ case 0:
29298
+ return _context12.abrupt("return", this._getEvents(request).then(parsers/* parseRawEvents */.fG));
29299
+ case 1:
29300
+ case "end":
29301
+ return _context12.stop();
29302
+ }
29303
+ }, _callee12, this);
29304
+ }));
29305
+ function getEvents(_x10) {
29242
29306
  return _getEvents2.apply(this, arguments);
29243
29307
  }
29244
29308
  return getEvents;
@@ -29246,12 +29310,12 @@ var Server = function () {
29246
29310
  }, {
29247
29311
  key: "_getEvents",
29248
29312
  value: function () {
29249
- var _getEvents3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee11(request) {
29313
+ var _getEvents3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee13(request) {
29250
29314
  var _request$filters;
29251
- return server_regeneratorRuntime().wrap(function _callee11$(_context11) {
29252
- while (1) switch (_context11.prev = _context11.next) {
29315
+ return server_regeneratorRuntime().wrap(function _callee13$(_context13) {
29316
+ while (1) switch (_context13.prev = _context13.next) {
29253
29317
  case 0:
29254
- return _context11.abrupt("return", postObject(this.serverURL.toString(), 'getEvents', _objectSpread({
29318
+ return _context13.abrupt("return", postObject(this.serverURL.toString(), 'getEvents', _objectSpread({
29255
29319
  filters: (_request$filters = request.filters) !== null && _request$filters !== void 0 ? _request$filters : [],
29256
29320
  pagination: _objectSpread(_objectSpread({}, request.cursor && {
29257
29321
  cursor: request.cursor
@@ -29263,11 +29327,11 @@ var Server = function () {
29263
29327
  })));
29264
29328
  case 1:
29265
29329
  case "end":
29266
- return _context11.stop();
29330
+ return _context13.stop();
29267
29331
  }
29268
- }, _callee11, this);
29332
+ }, _callee13, this);
29269
29333
  }));
29270
- function _getEvents(_x9) {
29334
+ function _getEvents(_x11) {
29271
29335
  return _getEvents3.apply(this, arguments);
29272
29336
  }
29273
29337
  return _getEvents;
@@ -29275,16 +29339,16 @@ var Server = function () {
29275
29339
  }, {
29276
29340
  key: "getNetwork",
29277
29341
  value: (function () {
29278
- var _getNetwork = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee12() {
29279
- return server_regeneratorRuntime().wrap(function _callee12$(_context12) {
29280
- while (1) switch (_context12.prev = _context12.next) {
29342
+ var _getNetwork = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee14() {
29343
+ return server_regeneratorRuntime().wrap(function _callee14$(_context14) {
29344
+ while (1) switch (_context14.prev = _context14.next) {
29281
29345
  case 0:
29282
- return _context12.abrupt("return", postObject(this.serverURL.toString(), 'getNetwork'));
29346
+ return _context14.abrupt("return", postObject(this.serverURL.toString(), 'getNetwork'));
29283
29347
  case 1:
29284
29348
  case "end":
29285
- return _context12.stop();
29349
+ return _context14.stop();
29286
29350
  }
29287
- }, _callee12, this);
29351
+ }, _callee14, this);
29288
29352
  }));
29289
29353
  function getNetwork() {
29290
29354
  return _getNetwork.apply(this, arguments);
@@ -29294,16 +29358,16 @@ var Server = function () {
29294
29358
  }, {
29295
29359
  key: "getLatestLedger",
29296
29360
  value: (function () {
29297
- var _getLatestLedger = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee13() {
29298
- return server_regeneratorRuntime().wrap(function _callee13$(_context13) {
29299
- while (1) switch (_context13.prev = _context13.next) {
29361
+ var _getLatestLedger = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee15() {
29362
+ return server_regeneratorRuntime().wrap(function _callee15$(_context15) {
29363
+ while (1) switch (_context15.prev = _context15.next) {
29300
29364
  case 0:
29301
- return _context13.abrupt("return", postObject(this.serverURL.toString(), 'getLatestLedger'));
29365
+ return _context15.abrupt("return", postObject(this.serverURL.toString(), 'getLatestLedger'));
29302
29366
  case 1:
29303
29367
  case "end":
29304
- return _context13.stop();
29368
+ return _context15.stop();
29305
29369
  }
29306
- }, _callee13, this);
29370
+ }, _callee15, this);
29307
29371
  }));
29308
29372
  function getLatestLedger() {
29309
29373
  return _getLatestLedger.apply(this, arguments);
@@ -29313,18 +29377,18 @@ var Server = function () {
29313
29377
  }, {
29314
29378
  key: "simulateTransaction",
29315
29379
  value: (function () {
29316
- var _simulateTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee14(tx, addlResources) {
29317
- return server_regeneratorRuntime().wrap(function _callee14$(_context14) {
29318
- while (1) switch (_context14.prev = _context14.next) {
29380
+ var _simulateTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee16(tx, addlResources) {
29381
+ return server_regeneratorRuntime().wrap(function _callee16$(_context16) {
29382
+ while (1) switch (_context16.prev = _context16.next) {
29319
29383
  case 0:
29320
- return _context14.abrupt("return", this._simulateTransaction(tx, addlResources).then(parsers/* parseRawSimulation */.jr));
29384
+ return _context16.abrupt("return", this._simulateTransaction(tx, addlResources).then(parsers/* parseRawSimulation */.jr));
29321
29385
  case 1:
29322
29386
  case "end":
29323
- return _context14.stop();
29387
+ return _context16.stop();
29324
29388
  }
29325
- }, _callee14, this);
29389
+ }, _callee16, this);
29326
29390
  }));
29327
- function simulateTransaction(_x10, _x11) {
29391
+ function simulateTransaction(_x12, _x13) {
29328
29392
  return _simulateTransaction2.apply(this, arguments);
29329
29393
  }
29330
29394
  return simulateTransaction;
@@ -29332,11 +29396,11 @@ var Server = function () {
29332
29396
  }, {
29333
29397
  key: "_simulateTransaction",
29334
29398
  value: function () {
29335
- var _simulateTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee15(transaction, addlResources) {
29336
- return server_regeneratorRuntime().wrap(function _callee15$(_context15) {
29337
- while (1) switch (_context15.prev = _context15.next) {
29399
+ var _simulateTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee17(transaction, addlResources) {
29400
+ return server_regeneratorRuntime().wrap(function _callee17$(_context17) {
29401
+ while (1) switch (_context17.prev = _context17.next) {
29338
29402
  case 0:
29339
- return _context15.abrupt("return", postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
29403
+ return _context17.abrupt("return", postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
29340
29404
  transaction: transaction.toXDR()
29341
29405
  }, addlResources !== undefined && {
29342
29406
  resourceConfig: {
@@ -29345,11 +29409,11 @@ var Server = function () {
29345
29409
  })));
29346
29410
  case 1:
29347
29411
  case "end":
29348
- return _context15.stop();
29412
+ return _context17.stop();
29349
29413
  }
29350
- }, _callee15, this);
29414
+ }, _callee17, this);
29351
29415
  }));
29352
- function _simulateTransaction(_x12, _x13) {
29416
+ function _simulateTransaction(_x14, _x15) {
29353
29417
  return _simulateTransaction3.apply(this, arguments);
29354
29418
  }
29355
29419
  return _simulateTransaction;
@@ -29357,29 +29421,29 @@ var Server = function () {
29357
29421
  }, {
29358
29422
  key: "prepareTransaction",
29359
29423
  value: (function () {
29360
- var _prepareTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee16(tx) {
29424
+ var _prepareTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee18(tx) {
29361
29425
  var simResponse;
29362
- return server_regeneratorRuntime().wrap(function _callee16$(_context16) {
29363
- while (1) switch (_context16.prev = _context16.next) {
29426
+ return server_regeneratorRuntime().wrap(function _callee18$(_context18) {
29427
+ while (1) switch (_context18.prev = _context18.next) {
29364
29428
  case 0:
29365
- _context16.next = 2;
29429
+ _context18.next = 2;
29366
29430
  return this.simulateTransaction(tx);
29367
29431
  case 2:
29368
- simResponse = _context16.sent;
29432
+ simResponse = _context18.sent;
29369
29433
  if (!api/* Api */.j.isSimulationError(simResponse)) {
29370
- _context16.next = 5;
29434
+ _context18.next = 5;
29371
29435
  break;
29372
29436
  }
29373
29437
  throw new Error(simResponse.error);
29374
29438
  case 5:
29375
- return _context16.abrupt("return", (0,transaction/* assembleTransaction */.X)(tx, simResponse).build());
29439
+ return _context18.abrupt("return", (0,transaction/* assembleTransaction */.X)(tx, simResponse).build());
29376
29440
  case 6:
29377
29441
  case "end":
29378
- return _context16.stop();
29442
+ return _context18.stop();
29379
29443
  }
29380
- }, _callee16, this);
29444
+ }, _callee18, this);
29381
29445
  }));
29382
- function prepareTransaction(_x14) {
29446
+ function prepareTransaction(_x16) {
29383
29447
  return _prepareTransaction.apply(this, arguments);
29384
29448
  }
29385
29449
  return prepareTransaction;
@@ -29387,18 +29451,18 @@ var Server = function () {
29387
29451
  }, {
29388
29452
  key: "sendTransaction",
29389
29453
  value: (function () {
29390
- var _sendTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee17(transaction) {
29391
- return server_regeneratorRuntime().wrap(function _callee17$(_context17) {
29392
- while (1) switch (_context17.prev = _context17.next) {
29454
+ var _sendTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee19(transaction) {
29455
+ return server_regeneratorRuntime().wrap(function _callee19$(_context19) {
29456
+ while (1) switch (_context19.prev = _context19.next) {
29393
29457
  case 0:
29394
- return _context17.abrupt("return", this._sendTransaction(transaction).then(parsers/* parseRawSendTransaction */.Af));
29458
+ return _context19.abrupt("return", this._sendTransaction(transaction).then(parsers/* parseRawSendTransaction */.Af));
29395
29459
  case 1:
29396
29460
  case "end":
29397
- return _context17.stop();
29461
+ return _context19.stop();
29398
29462
  }
29399
- }, _callee17, this);
29463
+ }, _callee19, this);
29400
29464
  }));
29401
- function sendTransaction(_x15) {
29465
+ function sendTransaction(_x17) {
29402
29466
  return _sendTransaction2.apply(this, arguments);
29403
29467
  }
29404
29468
  return sendTransaction;
@@ -29406,20 +29470,20 @@ var Server = function () {
29406
29470
  }, {
29407
29471
  key: "_sendTransaction",
29408
29472
  value: function () {
29409
- var _sendTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee18(transaction) {
29410
- return server_regeneratorRuntime().wrap(function _callee18$(_context18) {
29411
- while (1) switch (_context18.prev = _context18.next) {
29473
+ var _sendTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee20(transaction) {
29474
+ return server_regeneratorRuntime().wrap(function _callee20$(_context20) {
29475
+ while (1) switch (_context20.prev = _context20.next) {
29412
29476
  case 0:
29413
- return _context18.abrupt("return", postObject(this.serverURL.toString(), 'sendTransaction', {
29477
+ return _context20.abrupt("return", postObject(this.serverURL.toString(), 'sendTransaction', {
29414
29478
  transaction: transaction.toXDR()
29415
29479
  }));
29416
29480
  case 1:
29417
29481
  case "end":
29418
- return _context18.stop();
29482
+ return _context20.stop();
29419
29483
  }
29420
- }, _callee18, this);
29484
+ }, _callee20, this);
29421
29485
  }));
29422
- function _sendTransaction(_x16) {
29486
+ function _sendTransaction(_x18) {
29423
29487
  return _sendTransaction3.apply(this, arguments);
29424
29488
  }
29425
29489
  return _sendTransaction;
@@ -29427,58 +29491,58 @@ var Server = function () {
29427
29491
  }, {
29428
29492
  key: "requestAirdrop",
29429
29493
  value: (function () {
29430
- var _requestAirdrop = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee19(address, friendbotUrl) {
29494
+ var _requestAirdrop = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee21(address, friendbotUrl) {
29431
29495
  var account, response, meta, sequence, _error$response, _error$response$detai;
29432
- return server_regeneratorRuntime().wrap(function _callee19$(_context19) {
29433
- while (1) switch (_context19.prev = _context19.next) {
29496
+ return server_regeneratorRuntime().wrap(function _callee21$(_context21) {
29497
+ while (1) switch (_context21.prev = _context21.next) {
29434
29498
  case 0:
29435
29499
  account = typeof address === 'string' ? address : address.accountId();
29436
- _context19.t0 = friendbotUrl;
29437
- if (_context19.t0) {
29438
- _context19.next = 6;
29500
+ _context21.t0 = friendbotUrl;
29501
+ if (_context21.t0) {
29502
+ _context21.next = 6;
29439
29503
  break;
29440
29504
  }
29441
- _context19.next = 5;
29505
+ _context21.next = 5;
29442
29506
  return this.getNetwork();
29443
29507
  case 5:
29444
- _context19.t0 = _context19.sent.friendbotUrl;
29508
+ _context21.t0 = _context21.sent.friendbotUrl;
29445
29509
  case 6:
29446
- friendbotUrl = _context19.t0;
29510
+ friendbotUrl = _context21.t0;
29447
29511
  if (friendbotUrl) {
29448
- _context19.next = 9;
29512
+ _context21.next = 9;
29449
29513
  break;
29450
29514
  }
29451
29515
  throw new Error('No friendbot URL configured for current network');
29452
29516
  case 9:
29453
- _context19.prev = 9;
29454
- _context19.next = 12;
29517
+ _context21.prev = 9;
29518
+ _context21.next = 12;
29455
29519
  return axios/* default */.Ay.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
29456
29520
  case 12:
29457
- response = _context19.sent;
29521
+ response = _context21.sent;
29458
29522
  meta = lib.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
29459
29523
  sequence = findCreatedAccountSequenceInTransactionMeta(meta);
29460
- return _context19.abrupt("return", new lib.Account(account, sequence));
29524
+ return _context21.abrupt("return", new lib.Account(account, sequence));
29461
29525
  case 18:
29462
- _context19.prev = 18;
29463
- _context19.t1 = _context19["catch"](9);
29464
- if (!(((_error$response = _context19.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
29465
- _context19.next = 23;
29526
+ _context21.prev = 18;
29527
+ _context21.t1 = _context21["catch"](9);
29528
+ if (!(((_error$response = _context21.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
29529
+ _context21.next = 23;
29466
29530
  break;
29467
29531
  }
29468
- if (!((_error$response$detai = _context19.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
29469
- _context19.next = 23;
29532
+ if (!((_error$response$detai = _context21.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
29533
+ _context21.next = 23;
29470
29534
  break;
29471
29535
  }
29472
- return _context19.abrupt("return", this.getAccount(account));
29536
+ return _context21.abrupt("return", this.getAccount(account));
29473
29537
  case 23:
29474
- throw _context19.t1;
29538
+ throw _context21.t1;
29475
29539
  case 24:
29476
29540
  case "end":
29477
- return _context19.stop();
29541
+ return _context21.stop();
29478
29542
  }
29479
- }, _callee19, this, [[9, 18]]);
29543
+ }, _callee21, this, [[9, 18]]);
29480
29544
  }));
29481
- function requestAirdrop(_x17, _x18) {
29545
+ function requestAirdrop(_x19, _x20) {
29482
29546
  return _requestAirdrop.apply(this, arguments);
29483
29547
  }
29484
29548
  return requestAirdrop;
@@ -29486,22 +29550,41 @@ var Server = function () {
29486
29550
  }, {
29487
29551
  key: "getFeeStats",
29488
29552
  value: (function () {
29489
- var _getFeeStats = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee20() {
29490
- return server_regeneratorRuntime().wrap(function _callee20$(_context20) {
29491
- while (1) switch (_context20.prev = _context20.next) {
29553
+ var _getFeeStats = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee22() {
29554
+ return server_regeneratorRuntime().wrap(function _callee22$(_context22) {
29555
+ while (1) switch (_context22.prev = _context22.next) {
29492
29556
  case 0:
29493
- return _context20.abrupt("return", postObject(this.serverURL.toString(), 'getFeeStats'));
29557
+ return _context22.abrupt("return", postObject(this.serverURL.toString(), 'getFeeStats'));
29494
29558
  case 1:
29495
29559
  case "end":
29496
- return _context20.stop();
29560
+ return _context22.stop();
29497
29561
  }
29498
- }, _callee20, this);
29562
+ }, _callee22, this);
29499
29563
  }));
29500
29564
  function getFeeStats() {
29501
29565
  return _getFeeStats.apply(this, arguments);
29502
29566
  }
29503
29567
  return getFeeStats;
29504
29568
  }())
29569
+ }, {
29570
+ key: "getVersionInfo",
29571
+ value: (function () {
29572
+ var _getVersionInfo = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee23() {
29573
+ return server_regeneratorRuntime().wrap(function _callee23$(_context23) {
29574
+ while (1) switch (_context23.prev = _context23.next) {
29575
+ case 0:
29576
+ return _context23.abrupt("return", postObject(this.serverURL.toString(), 'getVersionInfo'));
29577
+ case 1:
29578
+ case "end":
29579
+ return _context23.stop();
29580
+ }
29581
+ }, _callee23, this);
29582
+ }));
29583
+ function getVersionInfo() {
29584
+ return _getVersionInfo.apply(this, arguments);
29585
+ }
29586
+ return getVersionInfo;
29587
+ }())
29505
29588
  }]);
29506
29589
  }();
29507
29590
 
@@ -38639,6 +38722,7 @@ var defaults = {
38639
38722
  parameterLimit: 1000,
38640
38723
  parseArrays: true,
38641
38724
  plainObjects: false,
38725
+ strictDepth: false,
38642
38726
  strictNullHandling: false
38643
38727
  };
38644
38728
 
@@ -38816,9 +38900,12 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesPars
38816
38900
  keys.push(segment[1]);
38817
38901
  }
38818
38902
 
38819
- // If there's a remainder, just add whatever is left
38903
+ // If there's a remainder, check strictDepth option for throw, else just add whatever is left
38820
38904
 
38821
38905
  if (segment) {
38906
+ if (options.strictDepth === true) {
38907
+ throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
38908
+ }
38822
38909
  keys.push('[' + key.slice(segment.index) + ']');
38823
38910
  }
38824
38911
 
@@ -38875,6 +38962,7 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
38875
38962
  parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
38876
38963
  parseArrays: opts.parseArrays !== false,
38877
38964
  plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
38965
+ strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
38878
38966
  strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
38879
38967
  };
38880
38968
  };
@@ -55281,6 +55369,7 @@ __webpack_require__.d(common_utils_namespaceObject, {
55281
55369
  hasBrowserEnv: () => (hasBrowserEnv),
55282
55370
  hasStandardBrowserEnv: () => (hasStandardBrowserEnv),
55283
55371
  hasStandardBrowserWebWorkerEnv: () => (hasStandardBrowserWebWorkerEnv),
55372
+ navigator: () => (_navigator),
55284
55373
  origin: () => (origin)
55285
55374
  });
55286
55375
 
@@ -55965,6 +56054,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
55965
56054
  const isThenable = (thing) =>
55966
56055
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
55967
56056
 
56057
+ // original code
56058
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
56059
+
56060
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
56061
+ if (setImmediateSupported) {
56062
+ return setImmediate;
56063
+ }
56064
+
56065
+ return postMessageSupported ? ((token, callbacks) => {
56066
+ _global.addEventListener("message", ({source, data}) => {
56067
+ if (source === _global && data === token) {
56068
+ callbacks.length && callbacks.shift()();
56069
+ }
56070
+ }, false);
56071
+
56072
+ return (cb) => {
56073
+ callbacks.push(cb);
56074
+ _global.postMessage(token, "*");
56075
+ }
56076
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
56077
+ })(
56078
+ typeof setImmediate === 'function',
56079
+ isFunction(_global.postMessage)
56080
+ );
56081
+
56082
+ const asap = typeof queueMicrotask !== 'undefined' ?
56083
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
56084
+
56085
+ // *********************
56086
+
55968
56087
  /* harmony default export */ const utils = ({
55969
56088
  isArray,
55970
56089
  isArrayBuffer,
@@ -56020,7 +56139,9 @@ const isThenable = (thing) =>
56020
56139
  isSpecCompliantForm,
56021
56140
  toJSONObject,
56022
56141
  isAsyncFn,
56023
- isThenable
56142
+ isThenable,
56143
+ setImmediate: _setImmediate,
56144
+ asap
56024
56145
  });
56025
56146
 
56026
56147
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/core/AxiosError.js
@@ -56053,7 +56174,10 @@ function AxiosError(message, code, config, request, response) {
56053
56174
  code && (this.code = code);
56054
56175
  config && (this.config = config);
56055
56176
  request && (this.request = request);
56056
- response && (this.response = response);
56177
+ if (response) {
56178
+ this.response = response;
56179
+ this.status = response.status ? response.status : null;
56180
+ }
56057
56181
  }
56058
56182
 
56059
56183
  utils.inherits(AxiosError, Error, {
@@ -56073,7 +56197,7 @@ utils.inherits(AxiosError, Error, {
56073
56197
  // Axios
56074
56198
  config: utils.toJSONObject(this.config),
56075
56199
  code: this.code,
56076
- status: this.response && this.response.status ? this.response.status : null
56200
+ status: this.status
56077
56201
  };
56078
56202
  }
56079
56203
  });
@@ -56592,6 +56716,8 @@ class InterceptorManager {
56592
56716
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/platform/common/utils.js
56593
56717
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
56594
56718
 
56719
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
56720
+
56595
56721
  /**
56596
56722
  * Determine if we're running in a standard browser environment
56597
56723
  *
@@ -56609,10 +56735,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
56609
56735
  *
56610
56736
  * @returns {boolean}
56611
56737
  */
56612
- const hasStandardBrowserEnv = (
56613
- (product) => {
56614
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
56615
- })(typeof navigator !== 'undefined' && navigator.product);
56738
+ const hasStandardBrowserEnv = hasBrowserEnv &&
56739
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
56616
56740
 
56617
56741
  /**
56618
56742
  * Determine if we're running in a standard browser webWorker environment
@@ -57445,8 +57569,6 @@ function speedometer(samplesCount, min) {
57445
57569
  /* harmony default export */ const helpers_speedometer = (speedometer);
57446
57570
 
57447
57571
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/throttle.js
57448
-
57449
-
57450
57572
  /**
57451
57573
  * Throttle decorator
57452
57574
  * @param {Function} fn
@@ -57455,28 +57577,39 @@ function speedometer(samplesCount, min) {
57455
57577
  */
57456
57578
  function throttle(fn, freq) {
57457
57579
  let timestamp = 0;
57458
- const threshold = 1000 / freq;
57459
- let timer = null;
57460
- return function throttled() {
57461
- const force = this === true;
57580
+ let threshold = 1000 / freq;
57581
+ let lastArgs;
57582
+ let timer;
57583
+
57584
+ const invoke = (args, now = Date.now()) => {
57585
+ timestamp = now;
57586
+ lastArgs = null;
57587
+ if (timer) {
57588
+ clearTimeout(timer);
57589
+ timer = null;
57590
+ }
57591
+ fn.apply(null, args);
57592
+ }
57462
57593
 
57594
+ const throttled = (...args) => {
57463
57595
  const now = Date.now();
57464
- if (force || now - timestamp > threshold) {
57465
- if (timer) {
57466
- clearTimeout(timer);
57467
- timer = null;
57596
+ const passed = now - timestamp;
57597
+ if ( passed >= threshold) {
57598
+ invoke(args, now);
57599
+ } else {
57600
+ lastArgs = args;
57601
+ if (!timer) {
57602
+ timer = setTimeout(() => {
57603
+ timer = null;
57604
+ invoke(lastArgs)
57605
+ }, threshold - passed);
57468
57606
  }
57469
- timestamp = now;
57470
- return fn.apply(null, arguments);
57471
57607
  }
57472
- if (!timer) {
57473
- timer = setTimeout(() => {
57474
- timer = null;
57475
- timestamp = Date.now();
57476
- return fn.apply(null, arguments);
57477
- }, threshold - (now - timestamp));
57478
- }
57479
- };
57608
+ }
57609
+
57610
+ const flush = () => lastArgs && invoke(lastArgs);
57611
+
57612
+ return [throttled, flush];
57480
57613
  }
57481
57614
 
57482
57615
  /* harmony default export */ const helpers_throttle = (throttle);
@@ -57485,7 +57618,8 @@ function throttle(fn, freq) {
57485
57618
 
57486
57619
 
57487
57620
 
57488
- /* harmony default export */ const progressEventReducer = ((listener, isDownloadStream, freq = 3) => {
57621
+
57622
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
57489
57623
  let bytesNotified = 0;
57490
57624
  const _speedometer = helpers_speedometer(50, 250);
57491
57625
 
@@ -57506,14 +57640,25 @@ function throttle(fn, freq) {
57506
57640
  rate: rate ? rate : undefined,
57507
57641
  estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
57508
57642
  event: e,
57509
- lengthComputable: total != null
57643
+ lengthComputable: total != null,
57644
+ [isDownloadStream ? 'download' : 'upload']: true
57510
57645
  };
57511
57646
 
57512
- data[isDownloadStream ? 'download' : 'upload'] = true;
57513
-
57514
57647
  listener(data);
57515
57648
  }, freq);
57516
- });
57649
+ }
57650
+
57651
+ const progressEventDecorator = (total, throttled) => {
57652
+ const lengthComputable = total != null;
57653
+
57654
+ return [(loaded) => throttled[0]({
57655
+ lengthComputable,
57656
+ total,
57657
+ loaded
57658
+ }), throttled[1]];
57659
+ }
57660
+
57661
+ const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
57517
57662
 
57518
57663
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/isURLSameOrigin.js
57519
57664
 
@@ -57526,7 +57671,7 @@ function throttle(fn, freq) {
57526
57671
  // Standard browser envs have full support of the APIs needed to test
57527
57672
  // whether the request URL is of the same origin as current location.
57528
57673
  (function standardBrowserEnv() {
57529
- const msie = /(msie|trident)/i.test(navigator.userAgent);
57674
+ const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
57530
57675
  const urlParsingNode = document.createElement('a');
57531
57676
  let originURL;
57532
57677
 
@@ -57871,16 +58016,18 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57871
58016
  const _config = resolveConfig(config);
57872
58017
  let requestData = _config.data;
57873
58018
  const requestHeaders = core_AxiosHeaders.from(_config.headers).normalize();
57874
- let {responseType} = _config;
58019
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
57875
58020
  let onCanceled;
58021
+ let uploadThrottled, downloadThrottled;
58022
+ let flushUpload, flushDownload;
58023
+
57876
58024
  function done() {
57877
- if (_config.cancelToken) {
57878
- _config.cancelToken.unsubscribe(onCanceled);
57879
- }
58025
+ flushUpload && flushUpload(); // flush events
58026
+ flushDownload && flushDownload(); // flush events
57880
58027
 
57881
- if (_config.signal) {
57882
- _config.signal.removeEventListener('abort', onCanceled);
57883
- }
58028
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
58029
+
58030
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
57884
58031
  }
57885
58032
 
57886
58033
  let request = new XMLHttpRequest();
@@ -57950,7 +58097,7 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57950
58097
  return;
57951
58098
  }
57952
58099
 
57953
- reject(new core_AxiosError('Request aborted', core_AxiosError.ECONNABORTED, _config, request));
58100
+ reject(new core_AxiosError('Request aborted', core_AxiosError.ECONNABORTED, config, request));
57954
58101
 
57955
58102
  // Clean up request
57956
58103
  request = null;
@@ -57960,7 +58107,7 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57960
58107
  request.onerror = function handleError() {
57961
58108
  // Real errors are hidden from us by the browser
57962
58109
  // onerror should only fire if it's a network error
57963
- reject(new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, _config, request));
58110
+ reject(new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request));
57964
58111
 
57965
58112
  // Clean up request
57966
58113
  request = null;
@@ -57976,7 +58123,7 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57976
58123
  reject(new core_AxiosError(
57977
58124
  timeoutErrorMessage,
57978
58125
  transitional.clarifyTimeoutError ? core_AxiosError.ETIMEDOUT : core_AxiosError.ECONNABORTED,
57979
- _config,
58126
+ config,
57980
58127
  request));
57981
58128
 
57982
58129
  // Clean up request
@@ -58004,13 +58151,18 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
58004
58151
  }
58005
58152
 
58006
58153
  // Handle progress if needed
58007
- if (typeof _config.onDownloadProgress === 'function') {
58008
- request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));
58154
+ if (onDownloadProgress) {
58155
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
58156
+ request.addEventListener('progress', downloadThrottled);
58009
58157
  }
58010
58158
 
58011
58159
  // Not all browsers support upload events
58012
- if (typeof _config.onUploadProgress === 'function' && request.upload) {
58013
- request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));
58160
+ if (onUploadProgress && request.upload) {
58161
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
58162
+
58163
+ request.upload.addEventListener('progress', uploadThrottled);
58164
+
58165
+ request.upload.addEventListener('loadend', flushUpload);
58014
58166
  }
58015
58167
 
58016
58168
  if (_config.cancelToken || _config.signal) {
@@ -58048,53 +58200,54 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
58048
58200
 
58049
58201
 
58050
58202
 
58203
+
58051
58204
  const composeSignals = (signals, timeout) => {
58052
- let controller = new AbortController();
58205
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
58053
58206
 
58054
- let aborted;
58207
+ if (timeout || length) {
58208
+ let controller = new AbortController();
58055
58209
 
58056
- const onabort = function (cancel) {
58057
- if (!aborted) {
58058
- aborted = true;
58059
- unsubscribe();
58060
- const err = cancel instanceof Error ? cancel : this.reason;
58061
- controller.abort(err instanceof core_AxiosError ? err : new cancel_CanceledError(err instanceof Error ? err.message : err));
58062
- }
58063
- }
58210
+ let aborted;
58064
58211
 
58065
- let timer = timeout && setTimeout(() => {
58066
- onabort(new core_AxiosError(`timeout ${timeout} of ms exceeded`, core_AxiosError.ETIMEDOUT))
58067
- }, timeout)
58212
+ const onabort = function (reason) {
58213
+ if (!aborted) {
58214
+ aborted = true;
58215
+ unsubscribe();
58216
+ const err = reason instanceof Error ? reason : this.reason;
58217
+ controller.abort(err instanceof core_AxiosError ? err : new cancel_CanceledError(err instanceof Error ? err.message : err));
58218
+ }
58219
+ }
58068
58220
 
58069
- const unsubscribe = () => {
58070
- if (signals) {
58071
- timer && clearTimeout(timer);
58221
+ let timer = timeout && setTimeout(() => {
58072
58222
  timer = null;
58073
- signals.forEach(signal => {
58074
- signal &&
58075
- (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
58076
- });
58077
- signals = null;
58223
+ onabort(new core_AxiosError(`timeout ${timeout} of ms exceeded`, core_AxiosError.ETIMEDOUT))
58224
+ }, timeout)
58225
+
58226
+ const unsubscribe = () => {
58227
+ if (signals) {
58228
+ timer && clearTimeout(timer);
58229
+ timer = null;
58230
+ signals.forEach(signal => {
58231
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
58232
+ });
58233
+ signals = null;
58234
+ }
58078
58235
  }
58079
- }
58080
58236
 
58081
- signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
58237
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
58082
58238
 
58083
- const {signal} = controller;
58239
+ const {signal} = controller;
58084
58240
 
58085
- signal.unsubscribe = unsubscribe;
58241
+ signal.unsubscribe = () => utils.asap(unsubscribe);
58086
58242
 
58087
- return [signal, () => {
58088
- timer && clearTimeout(timer);
58089
- timer = null;
58090
- }];
58243
+ return signal;
58244
+ }
58091
58245
  }
58092
58246
 
58093
58247
  /* harmony default export */ const helpers_composeSignals = (composeSignals);
58094
58248
 
58095
58249
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/trackStream.js
58096
58250
 
58097
-
58098
58251
  const streamChunk = function* (chunk, chunkSize) {
58099
58252
  let len = chunk.byteLength;
58100
58253
 
@@ -58113,35 +58266,68 @@ const streamChunk = function* (chunk, chunkSize) {
58113
58266
  }
58114
58267
  }
58115
58268
 
58116
- const readBytes = async function* (iterable, chunkSize, encode) {
58117
- for await (const chunk of iterable) {
58118
- yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
58269
+ const readBytes = async function* (iterable, chunkSize) {
58270
+ for await (const chunk of readStream(iterable)) {
58271
+ yield* streamChunk(chunk, chunkSize);
58272
+ }
58273
+ }
58274
+
58275
+ const readStream = async function* (stream) {
58276
+ if (stream[Symbol.asyncIterator]) {
58277
+ yield* stream;
58278
+ return;
58279
+ }
58280
+
58281
+ const reader = stream.getReader();
58282
+ try {
58283
+ for (;;) {
58284
+ const {done, value} = await reader.read();
58285
+ if (done) {
58286
+ break;
58287
+ }
58288
+ yield value;
58289
+ }
58290
+ } finally {
58291
+ await reader.cancel();
58119
58292
  }
58120
58293
  }
58121
58294
 
58122
- const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
58123
- const iterator = readBytes(stream, chunkSize, encode);
58295
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
58296
+ const iterator = readBytes(stream, chunkSize);
58124
58297
 
58125
58298
  let bytes = 0;
58299
+ let done;
58300
+ let _onFinish = (e) => {
58301
+ if (!done) {
58302
+ done = true;
58303
+ onFinish && onFinish(e);
58304
+ }
58305
+ }
58126
58306
 
58127
58307
  return new ReadableStream({
58128
- type: 'bytes',
58129
-
58130
58308
  async pull(controller) {
58131
- const {done, value} = await iterator.next();
58309
+ try {
58310
+ const {done, value} = await iterator.next();
58132
58311
 
58133
- if (done) {
58134
- controller.close();
58135
- onFinish();
58136
- return;
58137
- }
58312
+ if (done) {
58313
+ _onFinish();
58314
+ controller.close();
58315
+ return;
58316
+ }
58138
58317
 
58139
- let len = value.byteLength;
58140
- onProgress && onProgress(bytes += len);
58141
- controller.enqueue(new Uint8Array(value));
58318
+ let len = value.byteLength;
58319
+ if (onProgress) {
58320
+ let loadedBytes = bytes += len;
58321
+ onProgress(loadedBytes);
58322
+ }
58323
+ controller.enqueue(new Uint8Array(value));
58324
+ } catch (err) {
58325
+ _onFinish(err);
58326
+ throw err;
58327
+ }
58142
58328
  },
58143
58329
  cancel(reason) {
58144
- onFinish(reason);
58330
+ _onFinish(reason);
58145
58331
  return iterator.return();
58146
58332
  }
58147
58333
  }, {
@@ -58160,15 +58346,6 @@ const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
58160
58346
 
58161
58347
 
58162
58348
 
58163
- const fetchProgressDecorator = (total, fn) => {
58164
- const lengthComputable = total != null;
58165
- return (loaded) => setTimeout(() => fn({
58166
- lengthComputable,
58167
- total,
58168
- loaded
58169
- }));
58170
- }
58171
-
58172
58349
  const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
58173
58350
  const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
58174
58351
 
@@ -58178,7 +58355,15 @@ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
58178
58355
  async (str) => new Uint8Array(await new Response(str).arrayBuffer())
58179
58356
  );
58180
58357
 
58181
- const supportsRequestStream = isReadableStreamSupported && (() => {
58358
+ const test = (fn, ...args) => {
58359
+ try {
58360
+ return !!fn(...args);
58361
+ } catch (e) {
58362
+ return false
58363
+ }
58364
+ }
58365
+
58366
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
58182
58367
  let duplexAccessed = false;
58183
58368
 
58184
58369
  const hasContentType = new Request(platform.origin, {
@@ -58191,17 +58376,13 @@ const supportsRequestStream = isReadableStreamSupported && (() => {
58191
58376
  }).headers.has('Content-Type');
58192
58377
 
58193
58378
  return duplexAccessed && !hasContentType;
58194
- })();
58379
+ });
58195
58380
 
58196
58381
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
58197
58382
 
58198
- const supportsResponseStream = isReadableStreamSupported && !!(()=> {
58199
- try {
58200
- return utils.isReadableStream(new Response('').body);
58201
- } catch(err) {
58202
- // return undefined
58203
- }
58204
- })();
58383
+ const supportsResponseStream = isReadableStreamSupported &&
58384
+ test(() => utils.isReadableStream(new Response('').body));
58385
+
58205
58386
 
58206
58387
  const resolvers = {
58207
58388
  stream: supportsResponseStream && ((res) => res.body)
@@ -58226,10 +58407,14 @@ const getBodyLength = async (body) => {
58226
58407
  }
58227
58408
 
58228
58409
  if(utils.isSpecCompliantForm(body)) {
58229
- return (await new Request(body).arrayBuffer()).byteLength;
58410
+ const _request = new Request(platform.origin, {
58411
+ method: 'POST',
58412
+ body,
58413
+ });
58414
+ return (await _request.arrayBuffer()).byteLength;
58230
58415
  }
58231
58416
 
58232
- if(utils.isArrayBufferView(body)) {
58417
+ if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {
58233
58418
  return body.byteLength;
58234
58419
  }
58235
58420
 
@@ -58266,18 +58451,13 @@ const resolveBodyLength = async (headers, body) => {
58266
58451
 
58267
58452
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
58268
58453
 
58269
- let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
58270
- helpers_composeSignals([signal, cancelToken], timeout) : [];
58454
+ let composedSignal = helpers_composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
58271
58455
 
58272
- let finished, request;
58456
+ let request;
58273
58457
 
58274
- const onFinish = () => {
58275
- !finished && setTimeout(() => {
58276
- composedSignal && composedSignal.unsubscribe();
58277
- });
58278
-
58279
- finished = true;
58280
- }
58458
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
58459
+ composedSignal.unsubscribe();
58460
+ });
58281
58461
 
58282
58462
  let requestContentLength;
58283
58463
 
@@ -58299,17 +58479,22 @@ const resolveBodyLength = async (headers, body) => {
58299
58479
  }
58300
58480
 
58301
58481
  if (_request.body) {
58302
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
58482
+ const [onProgress, flush] = progressEventDecorator(
58303
58483
  requestContentLength,
58304
- progressEventReducer(onUploadProgress)
58305
- ), null, encodeText);
58484
+ progressEventReducer(asyncDecorator(onUploadProgress))
58485
+ );
58486
+
58487
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
58306
58488
  }
58307
58489
  }
58308
58490
 
58309
58491
  if (!utils.isString(withCredentials)) {
58310
- withCredentials = withCredentials ? 'cors' : 'omit';
58492
+ withCredentials = withCredentials ? 'include' : 'omit';
58311
58493
  }
58312
58494
 
58495
+ // Cloudflare Workers throws when credentials are defined
58496
+ // see https://github.com/cloudflare/workerd/issues/902
58497
+ const isCredentialsSupported = "credentials" in Request.prototype;
58313
58498
  request = new Request(url, {
58314
58499
  ...fetchOptions,
58315
58500
  signal: composedSignal,
@@ -58317,14 +58502,14 @@ const resolveBodyLength = async (headers, body) => {
58317
58502
  headers: headers.normalize().toJSON(),
58318
58503
  body: data,
58319
58504
  duplex: "half",
58320
- withCredentials
58505
+ credentials: isCredentialsSupported ? withCredentials : undefined
58321
58506
  });
58322
58507
 
58323
58508
  let response = await fetch(request);
58324
58509
 
58325
58510
  const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
58326
58511
 
58327
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
58512
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
58328
58513
  const options = {};
58329
58514
 
58330
58515
  ['status', 'statusText', 'headers'].forEach(prop => {
@@ -58333,11 +58518,16 @@ const resolveBodyLength = async (headers, body) => {
58333
58518
 
58334
58519
  const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));
58335
58520
 
58521
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
58522
+ responseContentLength,
58523
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
58524
+ ) || [];
58525
+
58336
58526
  response = new Response(
58337
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
58338
- responseContentLength,
58339
- progressEventReducer(onDownloadProgress, true)
58340
- ), isStreamResponse && onFinish, encodeText),
58527
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
58528
+ flush && flush();
58529
+ unsubscribe && unsubscribe();
58530
+ }),
58341
58531
  options
58342
58532
  );
58343
58533
  }
@@ -58346,9 +58536,7 @@ const resolveBodyLength = async (headers, body) => {
58346
58536
 
58347
58537
  let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);
58348
58538
 
58349
- !isStreamResponse && onFinish();
58350
-
58351
- stopTimeout && stopTimeout();
58539
+ !isStreamResponse && unsubscribe && unsubscribe();
58352
58540
 
58353
58541
  return await new Promise((resolve, reject) => {
58354
58542
  settle(resolve, reject, {
@@ -58361,7 +58549,7 @@ const resolveBodyLength = async (headers, body) => {
58361
58549
  })
58362
58550
  })
58363
58551
  } catch (err) {
58364
- onFinish();
58552
+ unsubscribe && unsubscribe();
58365
58553
 
58366
58554
  if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
58367
58555
  throw Object.assign(
@@ -58543,7 +58731,7 @@ function dispatchRequest(config) {
58543
58731
  }
58544
58732
 
58545
58733
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/env/data.js
58546
- const VERSION = "1.7.2";
58734
+ const VERSION = "1.7.7";
58547
58735
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/validator.js
58548
58736
 
58549
58737
 
@@ -58972,6 +59160,20 @@ class CancelToken {
58972
59160
  }
58973
59161
  }
58974
59162
 
59163
+ toAbortSignal() {
59164
+ const controller = new AbortController();
59165
+
59166
+ const abort = (err) => {
59167
+ controller.abort(err);
59168
+ };
59169
+
59170
+ this.subscribe(abort);
59171
+
59172
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
59173
+
59174
+ return controller.signal;
59175
+ }
59176
+
58975
59177
  /**
58976
59178
  * Returns an object that contains a new `CancelToken` and a function that, when called,
58977
59179
  * cancels the `CancelToken`.
@@ -59207,7 +59409,7 @@ axios.default = axios;
59207
59409
  /***/ ((module) => {
59208
59410
 
59209
59411
  "use strict";
59210
- module.exports = {"rE":"12.2.0"};
59412
+ module.exports = {"rE":"12.3.0"};
59211
59413
 
59212
59414
  /***/ })
59213
59415