@stellar/stellar-sdk 13.0.0-rc.2 → 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +112 -7
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk-minimal.js +448 -77
  4. package/dist/stellar-sdk-minimal.min.js +1 -1
  5. package/dist/stellar-sdk-no-axios.js +1044 -234
  6. package/dist/stellar-sdk-no-axios.min.js +1 -1
  7. package/dist/stellar-sdk-no-eventsource.js +171 -148
  8. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  9. package/dist/stellar-sdk.js +767 -305
  10. package/dist/stellar-sdk.min.js +1 -1
  11. package/lib/friendbot/index.d.ts +1 -0
  12. package/lib/horizon/call_builder.d.ts +1 -1
  13. package/lib/horizon/horizon_api.d.ts +13 -0
  14. package/lib/horizon/horizon_axios_client.js +1 -1
  15. package/lib/horizon/server.d.ts +5 -0
  16. package/lib/horizon/server.js +80 -59
  17. package/lib/minimal/friendbot/index.d.ts +1 -0
  18. package/lib/minimal/horizon/call_builder.d.ts +1 -1
  19. package/lib/minimal/horizon/horizon_api.d.ts +13 -0
  20. package/lib/minimal/horizon/horizon_axios_client.js +1 -1
  21. package/lib/minimal/horizon/server.d.ts +5 -0
  22. package/lib/minimal/horizon/server.js +80 -59
  23. package/lib/minimal/rpc/api.d.ts +2 -1
  24. package/lib/minimal/rpc/axios.js +1 -1
  25. package/lib/minimal/rpc/parsers.js +1 -0
  26. package/lib/minimal/rpc/server.js +27 -8
  27. package/lib/no-axios/friendbot/index.d.ts +1 -0
  28. package/lib/no-axios/horizon/call_builder.d.ts +1 -1
  29. package/lib/no-axios/horizon/horizon_api.d.ts +13 -0
  30. package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
  31. package/lib/no-axios/horizon/server.d.ts +5 -0
  32. package/lib/no-axios/horizon/server.js +80 -59
  33. package/lib/no-axios/rpc/api.d.ts +2 -1
  34. package/lib/no-axios/rpc/axios.js +1 -1
  35. package/lib/no-axios/rpc/parsers.js +1 -0
  36. package/lib/no-axios/rpc/server.js +27 -8
  37. package/lib/no-eventsource/friendbot/index.d.ts +1 -0
  38. package/lib/no-eventsource/horizon/call_builder.d.ts +1 -1
  39. package/lib/no-eventsource/horizon/horizon_api.d.ts +13 -0
  40. package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
  41. package/lib/no-eventsource/horizon/server.d.ts +5 -0
  42. package/lib/no-eventsource/horizon/server.js +80 -59
  43. package/lib/no-eventsource/rpc/api.d.ts +2 -1
  44. package/lib/no-eventsource/rpc/axios.js +1 -1
  45. package/lib/no-eventsource/rpc/parsers.js +1 -0
  46. package/lib/no-eventsource/rpc/server.js +27 -8
  47. package/lib/rpc/api.d.ts +2 -1
  48. package/lib/rpc/axios.js +1 -1
  49. package/lib/rpc/parsers.js +1 -0
  50. package/lib/rpc/server.js +27 -8
  51. package/package.json +11 -11
@@ -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
 
@@ -27714,7 +27730,7 @@ var http_client = __webpack_require__(6371);
27714
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); }
27715
27731
 
27716
27732
 
27717
- var version = "13.0.0-rc.2";
27733
+ var version = "13.1.0";
27718
27734
  var SERVER_TIME_MAP = {};
27719
27735
  var AxiosClient = (0,http_client/* create */.vt)({
27720
27736
  headers: {
@@ -29097,28 +29113,49 @@ var HorizonServer = function () {
29097
29113
  }
29098
29114
  return feeStats;
29099
29115
  }())
29116
+ }, {
29117
+ key: "root",
29118
+ value: (function () {
29119
+ var _root = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee4() {
29120
+ var cb;
29121
+ return server_regeneratorRuntime().wrap(function _callee4$(_context4) {
29122
+ while (1) switch (_context4.prev = _context4.next) {
29123
+ case 0:
29124
+ cb = new CallBuilder(URI_default()(this.serverURL));
29125
+ return _context4.abrupt("return", cb.call());
29126
+ case 2:
29127
+ case "end":
29128
+ return _context4.stop();
29129
+ }
29130
+ }, _callee4, this);
29131
+ }));
29132
+ function root() {
29133
+ return _root.apply(this, arguments);
29134
+ }
29135
+ return root;
29136
+ }())
29100
29137
  }, {
29101
29138
  key: "submitTransaction",
29102
29139
  value: (function () {
29103
- var _submitTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee4(transaction) {
29140
+ var _submitTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee5(transaction) {
29104
29141
  var opts,
29105
29142
  tx,
29106
- _args4 = arguments;
29107
- return server_regeneratorRuntime().wrap(function _callee4$(_context4) {
29108
- while (1) switch (_context4.prev = _context4.next) {
29143
+ _args5 = arguments;
29144
+ return server_regeneratorRuntime().wrap(function _callee5$(_context5) {
29145
+ while (1) switch (_context5.prev = _context5.next) {
29109
29146
  case 0:
29110
- opts = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {
29147
+ opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {
29111
29148
  skipMemoRequiredCheck: false
29112
29149
  };
29113
29150
  if (opts.skipMemoRequiredCheck) {
29114
- _context4.next = 4;
29151
+ _context5.next = 4;
29115
29152
  break;
29116
29153
  }
29117
- _context4.next = 4;
29154
+ _context5.next = 4;
29118
29155
  return this.checkMemoRequired(transaction);
29119
29156
  case 4:
29120
29157
  tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
29121
- return _context4.abrupt("return", horizon_axios_client.post(URI_default()(this.serverURL).segment("transactions").toString(), "tx=".concat(tx), {
29158
+ return _context5.abrupt("return", horizon_axios_client.post(URI_default()(this.serverURL).segment("transactions").toString(), "tx=".concat(tx), {
29122
29159
  timeout: SUBMIT_TRANSACTION_TIMEOUT
29123
29160
  }).then(function (response) {
29124
29161
  if (!response.data.result_xdr) {
@@ -29229,9 +29266,9 @@ var HorizonServer = function () {
29229
29266
  }));
29230
29267
  case 6:
29231
29268
  case "end":
29232
- return _context4.stop();
29269
+ return _context5.stop();
29233
29270
  }
29234
- }, _callee4, this);
29271
+ }, _callee5, this);
29235
29272
  }));
29236
29273
  function submitTransaction(_x2) {
29237
29274
  return _submitTransaction.apply(this, arguments);
@@ -29241,25 +29278,25 @@ var HorizonServer = function () {
29241
29278
  }, {
29242
29279
  key: "submitAsyncTransaction",
29243
29280
  value: (function () {
29244
- var _submitAsyncTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee5(transaction) {
29281
+ var _submitAsyncTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6(transaction) {
29245
29282
  var opts,
29246
29283
  tx,
29247
- _args5 = arguments;
29248
- return server_regeneratorRuntime().wrap(function _callee5$(_context5) {
29249
- while (1) switch (_context5.prev = _context5.next) {
29284
+ _args6 = arguments;
29285
+ return server_regeneratorRuntime().wrap(function _callee6$(_context6) {
29286
+ while (1) switch (_context6.prev = _context6.next) {
29250
29287
  case 0:
29251
- opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {
29288
+ opts = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {
29252
29289
  skipMemoRequiredCheck: false
29253
29290
  };
29254
29291
  if (opts.skipMemoRequiredCheck) {
29255
- _context5.next = 4;
29292
+ _context6.next = 4;
29256
29293
  break;
29257
29294
  }
29258
- _context5.next = 4;
29295
+ _context6.next = 4;
29259
29296
  return this.checkMemoRequired(transaction);
29260
29297
  case 4:
29261
29298
  tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
29262
- return _context5.abrupt("return", horizon_axios_client.post(URI_default()(this.serverURL).segment("transactions_async").toString(), "tx=".concat(tx)).then(function (response) {
29299
+ return _context6.abrupt("return", horizon_axios_client.post(URI_default()(this.serverURL).segment("transactions_async").toString(), "tx=".concat(tx)).then(function (response) {
29263
29300
  return response.data;
29264
29301
  }).catch(function (response) {
29265
29302
  if (response instanceof Error) {
@@ -29269,9 +29306,9 @@ var HorizonServer = function () {
29269
29306
  }));
29270
29307
  case 6:
29271
29308
  case "end":
29272
- return _context5.stop();
29309
+ return _context6.stop();
29273
29310
  }
29274
- }, _callee5, this);
29311
+ }, _callee6, this);
29275
29312
  }));
29276
29313
  function submitAsyncTransaction(_x3) {
29277
29314
  return _submitAsyncTransaction.apply(this, arguments);
@@ -29356,21 +29393,21 @@ var HorizonServer = function () {
29356
29393
  }, {
29357
29394
  key: "loadAccount",
29358
29395
  value: (function () {
29359
- var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6(accountId) {
29396
+ var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee7(accountId) {
29360
29397
  var res;
29361
- return server_regeneratorRuntime().wrap(function _callee6$(_context6) {
29362
- while (1) switch (_context6.prev = _context6.next) {
29398
+ return server_regeneratorRuntime().wrap(function _callee7$(_context7) {
29399
+ while (1) switch (_context7.prev = _context7.next) {
29363
29400
  case 0:
29364
- _context6.next = 2;
29401
+ _context7.next = 2;
29365
29402
  return this.accounts().accountId(accountId).call();
29366
29403
  case 2:
29367
- res = _context6.sent;
29368
- return _context6.abrupt("return", new AccountResponse(res));
29404
+ res = _context7.sent;
29405
+ return _context7.abrupt("return", new AccountResponse(res));
29369
29406
  case 4:
29370
29407
  case "end":
29371
- return _context6.stop();
29408
+ return _context7.stop();
29372
29409
  }
29373
- }, _callee6, this);
29410
+ }, _callee7, this);
29374
29411
  }));
29375
29412
  function loadAccount(_x4) {
29376
29413
  return _loadAccount.apply(this, arguments);
@@ -29385,88 +29422,88 @@ var HorizonServer = function () {
29385
29422
  }, {
29386
29423
  key: "checkMemoRequired",
29387
29424
  value: (function () {
29388
- var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee7(transaction) {
29425
+ var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee8(transaction) {
29389
29426
  var destinations, i, operation, destination, account;
29390
- return server_regeneratorRuntime().wrap(function _callee7$(_context7) {
29391
- while (1) switch (_context7.prev = _context7.next) {
29427
+ return server_regeneratorRuntime().wrap(function _callee8$(_context8) {
29428
+ while (1) switch (_context8.prev = _context8.next) {
29392
29429
  case 0:
29393
29430
  if (transaction instanceof lib.FeeBumpTransaction) {
29394
29431
  transaction = transaction.innerTransaction;
29395
29432
  }
29396
29433
  if (!(transaction.memo.type !== "none")) {
29397
- _context7.next = 3;
29434
+ _context8.next = 3;
29398
29435
  break;
29399
29436
  }
29400
- return _context7.abrupt("return");
29437
+ return _context8.abrupt("return");
29401
29438
  case 3:
29402
29439
  destinations = new Set();
29403
29440
  i = 0;
29404
29441
  case 5:
29405
29442
  if (!(i < transaction.operations.length)) {
29406
- _context7.next = 36;
29443
+ _context8.next = 36;
29407
29444
  break;
29408
29445
  }
29409
29446
  operation = transaction.operations[i];
29410
- _context7.t0 = operation.type;
29411
- _context7.next = _context7.t0 === "payment" ? 10 : _context7.t0 === "pathPaymentStrictReceive" ? 10 : _context7.t0 === "pathPaymentStrictSend" ? 10 : _context7.t0 === "accountMerge" ? 10 : 11;
29447
+ _context8.t0 = operation.type;
29448
+ _context8.next = _context8.t0 === "payment" ? 10 : _context8.t0 === "pathPaymentStrictReceive" ? 10 : _context8.t0 === "pathPaymentStrictSend" ? 10 : _context8.t0 === "accountMerge" ? 10 : 11;
29412
29449
  break;
29413
29450
  case 10:
29414
- return _context7.abrupt("break", 12);
29451
+ return _context8.abrupt("break", 12);
29415
29452
  case 11:
29416
- return _context7.abrupt("continue", 33);
29453
+ return _context8.abrupt("continue", 33);
29417
29454
  case 12:
29418
29455
  destination = operation.destination;
29419
29456
  if (!destinations.has(destination)) {
29420
- _context7.next = 15;
29457
+ _context8.next = 15;
29421
29458
  break;
29422
29459
  }
29423
- return _context7.abrupt("continue", 33);
29460
+ return _context8.abrupt("continue", 33);
29424
29461
  case 15:
29425
29462
  destinations.add(destination);
29426
29463
  if (!destination.startsWith("M")) {
29427
- _context7.next = 18;
29464
+ _context8.next = 18;
29428
29465
  break;
29429
29466
  }
29430
- return _context7.abrupt("continue", 33);
29467
+ return _context8.abrupt("continue", 33);
29431
29468
  case 18:
29432
- _context7.prev = 18;
29433
- _context7.next = 21;
29469
+ _context8.prev = 18;
29470
+ _context8.next = 21;
29434
29471
  return this.loadAccount(destination);
29435
29472
  case 21:
29436
- account = _context7.sent;
29473
+ account = _context8.sent;
29437
29474
  if (!(account.data_attr["config.memo_required"] === ACCOUNT_REQUIRES_MEMO)) {
29438
- _context7.next = 24;
29475
+ _context8.next = 24;
29439
29476
  break;
29440
29477
  }
29441
29478
  throw new errors/* AccountRequiresMemoError */.Cu("account requires memo", destination, i);
29442
29479
  case 24:
29443
- _context7.next = 33;
29480
+ _context8.next = 33;
29444
29481
  break;
29445
29482
  case 26:
29446
- _context7.prev = 26;
29447
- _context7.t1 = _context7["catch"](18);
29448
- if (!(_context7.t1 instanceof errors/* AccountRequiresMemoError */.Cu)) {
29449
- _context7.next = 30;
29483
+ _context8.prev = 26;
29484
+ _context8.t1 = _context8["catch"](18);
29485
+ if (!(_context8.t1 instanceof errors/* AccountRequiresMemoError */.Cu)) {
29486
+ _context8.next = 30;
29450
29487
  break;
29451
29488
  }
29452
- throw _context7.t1;
29489
+ throw _context8.t1;
29453
29490
  case 30:
29454
- if (_context7.t1 instanceof errors/* NotFoundError */.m_) {
29455
- _context7.next = 32;
29491
+ if (_context8.t1 instanceof errors/* NotFoundError */.m_) {
29492
+ _context8.next = 32;
29456
29493
  break;
29457
29494
  }
29458
- throw _context7.t1;
29495
+ throw _context8.t1;
29459
29496
  case 32:
29460
- return _context7.abrupt("continue", 33);
29497
+ return _context8.abrupt("continue", 33);
29461
29498
  case 33:
29462
29499
  i += 1;
29463
- _context7.next = 5;
29500
+ _context8.next = 5;
29464
29501
  break;
29465
29502
  case 36:
29466
29503
  case "end":
29467
- return _context7.stop();
29504
+ return _context8.stop();
29468
29505
  }
29469
- }, _callee7, this, [[18, 26]]);
29506
+ }, _callee8, this, [[18, 26]]);
29470
29507
  }));
29471
29508
  function checkMemoRequired(_x5) {
29472
29509
  return _checkMemoRequired.apply(this, arguments);
@@ -29500,7 +29537,321 @@ __webpack_require__.d(__webpack_exports__, {
29500
29537
  });
29501
29538
 
29502
29539
  ;// ./node_modules/feaxios/dist/index.mjs
29503
- async function e(e,t){const r={config:e};return r.status=t.status,r.statusText=t.statusText,r.headers=t.headers,"stream"===e.responseType?(r.data=t.body,r):t[e.responseType||"text"]().then((s=>{e.transformResponse?(Array.isArray(e.transformResponse)?e.transformResponse.map((r=>s=r.call(e,s,t?.headers,t?.status))):s=e.transformResponse(s,t?.headers,t?.status),r.data=s):(r.data=s,r.data=JSON.parse(s))})).catch(Object).then((()=>r))}function t(e){let t=e.url||"";return e.baseURL&&e.url&&(t=e.url.replace(/^(?!.*\/\/)\/?/,`${e.baseURL}/`)),e.params&&Object.keys(e.params).length>0&&e.url&&(t+=(~e.url.indexOf("?")?"&":"?")+(e.paramsSerializer?e.paramsSerializer(e.params):new URLSearchParams(e.params))),t}function r(e,t){const r={...t,...e};if(t?.params&&e?.params&&(r.params={...t?.params,...e?.params}),t?.headers&&e?.headers){r.headers=new Headers(t.headers||{});new Headers(e.headers||{}).forEach(((e,t)=>{r.headers.set(t,e)}))}return r}async function s(s,a,n,c,u,h){"string"==typeof s?(a=a||{}).url=s:a=s||{};const d=r(a,n||{});if(d.fetchOptions=d.fetchOptions||{},d.timeout=d.timeout||0,d.headers=new Headers(d.headers||{}),h=h||d.data,d.transformRequest&&(Array.isArray(d.transformRequest)?d.transformRequest.map((e=>h=e.call(d,h,d.headers))):d.transformRequest(h,d.headers)),h&&"application/x-www-form-urlencoded"!==d.headers.get("content-type")&&"object"==typeof h&&"function"!=typeof h.append&&"function"!=typeof h.text&&(h=JSON.stringify(h),d.headers.set("content-type","application/json")),h&&"application/x-www-form-urlencoded"===d.headers.get("content-type")&&(h=new URLSearchParams(h)),d.url=t(d),d.method=c||d.method||"get",u&&u.request.handlers.length>0){const e=u.request.handlers.filter((e=>!e?.runWhen||"function"==typeof e.runWhen&&e.runWhen(d))).flatMap((e=>[e.fulfilled,e.rejected]));let t=d;for(let r=0,s=e.length;r<s;r+=2){const s=e[r],a=e[r+1];try{s&&(t=s(t))}catch(e){a&&a?.(e);break}}}const l=function(e,t){const r={...t,...e};t?.headers&&e?.headers&&(r.headers=new Headers(t.headers||{}),new Headers(e.headers||{}).forEach(((e,t)=>{r.headers.set(t,e)})));return r}({method:d.method?.toUpperCase(),body:h,headers:d.headers,credentials:d.withCredentials?"include":void 0,signal:d.signal},d.fetchOptions);let p=async function(t,r){let s=null;if("any"in AbortSignal){const e=[];t.timeout&&e.push(AbortSignal.timeout(t.timeout)),t.signal&&e.push(t.signal),e.length>0&&(r.signal=AbortSignal.any(e))}else t.timeout&&(r.signal=AbortSignal.timeout(t.timeout));const a=new Request(t.url,r);try{return s=await fetch(a),(t.validateStatus?t.validateStatus(s.status):s.ok)?await e(t,s):Promise.reject(new o(`Request failed with status code ${s?.status}`,[o.ERR_BAD_REQUEST,o.ERR_BAD_RESPONSE][Math.floor(s?.status/100)-4],t,a,await e(t,s)))}catch(e){if("AbortError"===e.name||"TimeoutError"===e.name){const r="TimeoutError"===e.name;return Promise.reject(r?new o(t.timeoutErrorMessage||`timeout of ${t.timeout} ms exceeded`,o.ECONNABORTED,t,a):new i(null,t))}return Promise.reject(new o(e.message,void 0,t,a,void 0))}}(d,l);if(u&&u.response.handlers.length>0){const e=u.response.handlers.flatMap((e=>[e.fulfilled,e.rejected]));for(let t=0,r=e.length;t<r;t+=2)p=p.then(e[t],e[t+1])}return p}var a=class{handlers=[];constructor(){this.handlers=[]}use=(e,t,r)=>(this.handlers.push({fulfilled:e,rejected:t,runWhen:r?.runWhen}),this.handlers.length-1);eject=e=>{this.handlers[e]&&(this.handlers[e]=null)};clear=()=>{this.handlers=[]}};function n(e){e=e||{};const n={request:new a,response:new a},o=(t,r)=>s(t,r,e,void 0,n);return o.defaults=e,o.interceptors=n,o.getUri=s=>t(r(s||{},e)),o.request=t=>s(t,void 0,e,void 0,n),["get","delete","head","options"].forEach((t=>{o[t]=(r,a)=>s(r,a,e,t,n)})),["post","put","patch"].forEach((t=>{o[t]=(r,a,o)=>s(r,o,e,t,n,a)})),["postForm","putForm","patchForm"].forEach((t=>{o[t]=(r,a,o)=>((o=o||{}).headers=new Headers(o.headers||{}),o.headers.set("content-type","application/x-www-form-urlencoded"),s(r,o,e,t.replace("Form",""),n,a))})),o}var o=class extends Error{config;code;request;response;status;isAxiosError;constructor(e,t,r,s,a){super(e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.name="AxiosError",this.code=t,this.config=r,this.request=s,this.response=a,this.isAxiosError=!0}static ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";static ERR_BAD_OPTION="ERR_BAD_OPTION";static ERR_NETWORK="ERR_NETWORK";static ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";static ERR_BAD_REQUEST="ERR_BAD_REQUEST";static ERR_INVALID_URL="ERR_INVALID_URL";static ERR_CANCELED="ERR_CANCELED";static ECONNABORTED="ECONNABORTED";static ETIMEDOUT="ETIMEDOUT"},i=class extends o{constructor(e,t,r){super(e||"canceled",o.ERR_CANCELED,t,r),this.name="CanceledError"}};function c(e){return null!==e&&"object"==typeof e&&e.isAxiosError}var u=n();u.create=e=>n(e);var h=u;
29540
+ // src/client.ts
29541
+ async function prepareAxiosResponse(options, res) {
29542
+ const response = { config: options };
29543
+ response.status = res.status;
29544
+ response.statusText = res.statusText;
29545
+ response.headers = res.headers;
29546
+ if (options.responseType === "stream") {
29547
+ response.data = res.body;
29548
+ return response;
29549
+ }
29550
+ return res[options.responseType || "text"]().then((data) => {
29551
+ if (options.transformResponse) {
29552
+ Array.isArray(options.transformResponse) ? options.transformResponse.map(
29553
+ (fn) => data = fn.call(options, data, res?.headers, res?.status)
29554
+ ) : data = options.transformResponse(data, res?.headers, res?.status);
29555
+ response.data = data;
29556
+ } else {
29557
+ response.data = data;
29558
+ response.data = JSON.parse(data);
29559
+ }
29560
+ }).catch(Object).then(() => response);
29561
+ }
29562
+ async function handleFetch(options, fetchOptions) {
29563
+ let res = null;
29564
+ if ("any" in AbortSignal) {
29565
+ const signals = [];
29566
+ if (options.timeout) {
29567
+ signals.push(AbortSignal.timeout(options.timeout));
29568
+ }
29569
+ if (options.signal) {
29570
+ signals.push(options.signal);
29571
+ }
29572
+ if (signals.length > 0) {
29573
+ fetchOptions.signal = AbortSignal.any(signals);
29574
+ }
29575
+ } else {
29576
+ if (options.timeout) {
29577
+ fetchOptions.signal = AbortSignal.timeout(options.timeout);
29578
+ }
29579
+ }
29580
+ try {
29581
+ res = await fetch(options.url, fetchOptions);
29582
+ const ok = options.validateStatus ? options.validateStatus(res.status) : res.ok;
29583
+ if (!ok) {
29584
+ return Promise.reject(
29585
+ new AxiosError(
29586
+ `Request failed with status code ${res?.status}`,
29587
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(res?.status / 100) - 4],
29588
+ options,
29589
+ new Request(options.url, fetchOptions),
29590
+ await prepareAxiosResponse(options, res)
29591
+ )
29592
+ );
29593
+ }
29594
+ return await prepareAxiosResponse(options, res);
29595
+ } catch (error) {
29596
+ if (error.name === "AbortError" || error.name === "TimeoutError") {
29597
+ const isTimeoutError = error.name === "TimeoutError";
29598
+ return Promise.reject(
29599
+ isTimeoutError ? new AxiosError(
29600
+ options.timeoutErrorMessage || `timeout of ${options.timeout} ms exceeded`,
29601
+ AxiosError.ECONNABORTED,
29602
+ options,
29603
+ request
29604
+ ) : new CanceledError(null, options)
29605
+ );
29606
+ }
29607
+ return Promise.reject(
29608
+ new AxiosError(
29609
+ error.message,
29610
+ void 0,
29611
+ options,
29612
+ request,
29613
+ void 0
29614
+ )
29615
+ );
29616
+ }
29617
+ }
29618
+ function buildURL(options) {
29619
+ let url = options.url || "";
29620
+ if (options.baseURL && options.url) {
29621
+ url = options.url.replace(/^(?!.*\/\/)\/?/, `${options.baseURL}/`);
29622
+ }
29623
+ if (options.params && Object.keys(options.params).length > 0 && options.url) {
29624
+ url += (~options.url.indexOf("?") ? "&" : "?") + (options.paramsSerializer ? options.paramsSerializer(options.params) : new URLSearchParams(options.params));
29625
+ }
29626
+ return url;
29627
+ }
29628
+ function mergeAxiosOptions(input, defaults) {
29629
+ const merged = {
29630
+ ...defaults,
29631
+ ...input
29632
+ };
29633
+ if (defaults?.params && input?.params) {
29634
+ merged.params = {
29635
+ ...defaults?.params,
29636
+ ...input?.params
29637
+ };
29638
+ }
29639
+ if (defaults?.headers && input?.headers) {
29640
+ merged.headers = new Headers(defaults.headers || {});
29641
+ const headers = new Headers(input.headers || {});
29642
+ headers.forEach((value, key) => {
29643
+ merged.headers.set(key, value);
29644
+ });
29645
+ }
29646
+ return merged;
29647
+ }
29648
+ function mergeFetchOptions(input, defaults) {
29649
+ const merged = {
29650
+ ...defaults,
29651
+ ...input
29652
+ };
29653
+ if (defaults?.headers && input?.headers) {
29654
+ merged.headers = new Headers(defaults.headers || {});
29655
+ const headers = new Headers(input.headers || {});
29656
+ headers.forEach((value, key) => {
29657
+ merged.headers.set(key, value);
29658
+ });
29659
+ }
29660
+ return merged;
29661
+ }
29662
+ function defaultTransformer(data, headers) {
29663
+ const contentType = headers.get("content-type");
29664
+ if (!contentType) {
29665
+ if (typeof data === "string") {
29666
+ headers.set("content-type", "text/plain");
29667
+ } else if (data instanceof URLSearchParams) {
29668
+ headers.set("content-type", "application/x-www-form-urlencoded");
29669
+ } else if (data instanceof Blob || data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
29670
+ headers.set("content-type", "application/octet-stream");
29671
+ } else if (typeof data === "object" && typeof data.append !== "function" && typeof data.text !== "function") {
29672
+ data = JSON.stringify(data);
29673
+ headers.set("content-type", "application/json");
29674
+ }
29675
+ } else {
29676
+ if (contentType === "application/x-www-form-urlencoded" && !(data instanceof URLSearchParams)) {
29677
+ data = new URLSearchParams(data);
29678
+ } else if (contentType === "application/json" && typeof data === "object") {
29679
+ data = JSON.stringify(data);
29680
+ }
29681
+ }
29682
+ return data;
29683
+ }
29684
+ async function request(configOrUrl, config, defaults, method, interceptors, data) {
29685
+ if (typeof configOrUrl === "string") {
29686
+ config = config || {};
29687
+ config.url = configOrUrl;
29688
+ } else
29689
+ config = configOrUrl || {};
29690
+ const options = mergeAxiosOptions(config, defaults || {});
29691
+ options.fetchOptions = options.fetchOptions || {};
29692
+ options.timeout = options.timeout || 0;
29693
+ options.headers = new Headers(options.headers || {});
29694
+ options.transformRequest = options.transformRequest ?? defaultTransformer;
29695
+ data = data || options.data;
29696
+ if (options.transformRequest && data) {
29697
+ Array.isArray(options.transformRequest) ? options.transformRequest.map(
29698
+ (fn) => data = fn.call(options, data, options.headers)
29699
+ ) : data = options.transformRequest(data, options.headers);
29700
+ }
29701
+ options.url = buildURL(options);
29702
+ options.method = method || options.method || "get";
29703
+ if (interceptors && interceptors.request.handlers.length > 0) {
29704
+ const chain = interceptors.request.handlers.filter(
29705
+ (interceptor) => !interceptor?.runWhen || typeof interceptor.runWhen === "function" && interceptor.runWhen(options)
29706
+ ).flatMap((interceptor) => [interceptor.fulfilled, interceptor.rejected]);
29707
+ let result = options;
29708
+ for (let i = 0, len = chain.length; i < len; i += 2) {
29709
+ const onFulfilled = chain[i];
29710
+ const onRejected = chain[i + 1];
29711
+ try {
29712
+ if (onFulfilled)
29713
+ result = onFulfilled(result);
29714
+ } catch (error) {
29715
+ if (onRejected)
29716
+ onRejected?.(error);
29717
+ break;
29718
+ }
29719
+ }
29720
+ }
29721
+ const init = mergeFetchOptions(
29722
+ {
29723
+ method: options.method?.toUpperCase(),
29724
+ body: data,
29725
+ headers: options.headers,
29726
+ credentials: options.withCredentials ? "include" : void 0,
29727
+ signal: options.signal
29728
+ },
29729
+ options.fetchOptions
29730
+ );
29731
+ let resp = handleFetch(options, init);
29732
+ if (interceptors && interceptors.response.handlers.length > 0) {
29733
+ const chain = interceptors.response.handlers.flatMap((interceptor) => [
29734
+ interceptor.fulfilled,
29735
+ interceptor.rejected
29736
+ ]);
29737
+ for (let i = 0, len = chain.length; i < len; i += 2) {
29738
+ resp = resp.then(chain[i], chain[i + 1]);
29739
+ }
29740
+ }
29741
+ return resp;
29742
+ }
29743
+ var AxiosInterceptorManager = class {
29744
+ handlers = [];
29745
+ constructor() {
29746
+ this.handlers = [];
29747
+ }
29748
+ use = (onFulfilled, onRejected, options) => {
29749
+ this.handlers.push({
29750
+ fulfilled: onFulfilled,
29751
+ rejected: onRejected,
29752
+ runWhen: options?.runWhen
29753
+ });
29754
+ return this.handlers.length - 1;
29755
+ };
29756
+ eject = (id) => {
29757
+ if (this.handlers[id]) {
29758
+ this.handlers[id] = null;
29759
+ }
29760
+ };
29761
+ clear = () => {
29762
+ this.handlers = [];
29763
+ };
29764
+ };
29765
+ function createAxiosInstance(defaults) {
29766
+ defaults = defaults || {};
29767
+ const interceptors = {
29768
+ request: new AxiosInterceptorManager(),
29769
+ response: new AxiosInterceptorManager()
29770
+ };
29771
+ const axios2 = (url, config) => request(url, config, defaults, void 0, interceptors);
29772
+ axios2.defaults = defaults;
29773
+ axios2.interceptors = interceptors;
29774
+ axios2.getUri = (config) => {
29775
+ const merged = mergeAxiosOptions(config || {}, defaults);
29776
+ return buildURL(merged);
29777
+ };
29778
+ axios2.request = (config) => request(config, void 0, defaults, void 0, interceptors);
29779
+ ["get", "delete", "head", "options"].forEach((method) => {
29780
+ axios2[method] = (url, config) => request(url, config, defaults, method, interceptors);
29781
+ });
29782
+ ["post", "put", "patch"].forEach((method) => {
29783
+ axios2[method] = (url, data, config) => request(url, config, defaults, method, interceptors, data);
29784
+ });
29785
+ ["postForm", "putForm", "patchForm"].forEach((method) => {
29786
+ axios2[method] = (url, data, config) => {
29787
+ config = config || {};
29788
+ config.headers = new Headers(config.headers || {});
29789
+ config.headers.set("content-type", "application/x-www-form-urlencoded");
29790
+ return request(
29791
+ url,
29792
+ config,
29793
+ defaults,
29794
+ method.replace("Form", ""),
29795
+ interceptors,
29796
+ data
29797
+ );
29798
+ };
29799
+ });
29800
+ return axios2;
29801
+ }
29802
+ var AxiosError = class extends Error {
29803
+ config;
29804
+ code;
29805
+ request;
29806
+ response;
29807
+ status;
29808
+ isAxiosError;
29809
+ constructor(message, code, config, request2, response) {
29810
+ super(message);
29811
+ if (Error.captureStackTrace) {
29812
+ Error.captureStackTrace(this, this.constructor);
29813
+ } else {
29814
+ this.stack = new Error().stack;
29815
+ }
29816
+ this.name = "AxiosError";
29817
+ this.code = code;
29818
+ this.config = config;
29819
+ this.request = request2;
29820
+ this.response = response;
29821
+ this.isAxiosError = true;
29822
+ }
29823
+ static ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
29824
+ static ERR_BAD_OPTION = "ERR_BAD_OPTION";
29825
+ static ERR_NETWORK = "ERR_NETWORK";
29826
+ static ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
29827
+ static ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
29828
+ static ERR_INVALID_URL = "ERR_INVALID_URL";
29829
+ static ERR_CANCELED = "ERR_CANCELED";
29830
+ static ECONNABORTED = "ECONNABORTED";
29831
+ static ETIMEDOUT = "ETIMEDOUT";
29832
+ };
29833
+ var CanceledError = class extends AxiosError {
29834
+ constructor(message, config, request2) {
29835
+ super(
29836
+ !message ? "canceled" : message,
29837
+ AxiosError.ERR_CANCELED,
29838
+ config,
29839
+ request2
29840
+ );
29841
+ this.name = "CanceledError";
29842
+ }
29843
+ };
29844
+ function isAxiosError(payload) {
29845
+ return payload !== null && typeof payload === "object" && payload.isAxiosError;
29846
+ }
29847
+ var axios = createAxiosInstance();
29848
+ axios.create = (defaults) => createAxiosInstance(defaults);
29849
+
29850
+ // src/index.ts
29851
+ var src_default = axios;
29852
+
29853
+
29854
+
29504
29855
  // EXTERNAL MODULE: ./src/http-client/types.ts
29505
29856
  var types = __webpack_require__(5798);
29506
29857
  ;// ./src/http-client/fetch-client.ts
@@ -29558,7 +29909,7 @@ function createFetchClient() {
29558
29909
  var defaults = _objectSpread(_objectSpread({}, fetchConfig), {}, {
29559
29910
  headers: fetchConfig.headers || {}
29560
29911
  });
29561
- var instance = h.create(defaults);
29912
+ var instance = src_default.create(defaults);
29562
29913
  var requestInterceptors = new InterceptorManager();
29563
29914
  var responseInterceptors = new InterceptorManager();
29564
29915
  var httpClient = {
@@ -29922,7 +30273,7 @@ var lib = __webpack_require__(356);
29922
30273
  var http_client = __webpack_require__(6371);
29923
30274
  ;// ./src/rpc/axios.ts
29924
30275
 
29925
- var version = "13.0.0-rc.2";
30276
+ var version = "13.1.0";
29926
30277
  var AxiosClient = (0,http_client/* create */.vt)({
29927
30278
  headers: {
29928
30279
  'X-Client-Name': 'js-soroban-client',
@@ -30673,7 +31024,7 @@ var RpcServer = function () {
30673
31024
  key: "requestAirdrop",
30674
31025
  value: (function () {
30675
31026
  var _requestAirdrop = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee22(address, friendbotUrl) {
30676
- var account, response, meta, sequence, _error$response, _error$response$detai;
31027
+ var account, response, meta, txMeta, sequence, _error$response, _error$response$detai;
30677
31028
  return server_regeneratorRuntime().wrap(function _callee22$(_context22) {
30678
31029
  while (1) switch (_context22.prev = _context22.next) {
30679
31030
  case 0:
@@ -30700,28 +31051,47 @@ var RpcServer = function () {
30700
31051
  return axios.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
30701
31052
  case 12:
30702
31053
  response = _context22.sent;
31054
+ if (response.data.result_meta_xdr) {
31055
+ _context22.next = 22;
31056
+ break;
31057
+ }
31058
+ _context22.next = 16;
31059
+ return this.getTransaction(response.data.hash);
31060
+ case 16:
31061
+ txMeta = _context22.sent;
31062
+ if (!(txMeta.status !== api/* Api */.j.GetTransactionStatus.SUCCESS)) {
31063
+ _context22.next = 19;
31064
+ break;
31065
+ }
31066
+ throw new Error("Funding account ".concat(address, " failed"));
31067
+ case 19:
31068
+ meta = txMeta.resultMetaXdr;
31069
+ _context22.next = 23;
31070
+ break;
31071
+ case 22:
30703
31072
  meta = lib.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
31073
+ case 23:
30704
31074
  sequence = findCreatedAccountSequenceInTransactionMeta(meta);
30705
31075
  return _context22.abrupt("return", new lib.Account(account, sequence));
30706
- case 18:
30707
- _context22.prev = 18;
31076
+ case 27:
31077
+ _context22.prev = 27;
30708
31078
  _context22.t1 = _context22["catch"](9);
30709
31079
  if (!(((_error$response = _context22.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
30710
- _context22.next = 23;
31080
+ _context22.next = 32;
30711
31081
  break;
30712
31082
  }
30713
31083
  if (!((_error$response$detai = _context22.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
30714
- _context22.next = 23;
31084
+ _context22.next = 32;
30715
31085
  break;
30716
31086
  }
30717
31087
  return _context22.abrupt("return", this.getAccount(account));
30718
- case 23:
31088
+ case 32:
30719
31089
  throw _context22.t1;
30720
- case 24:
31090
+ case 33:
30721
31091
  case "end":
30722
31092
  return _context22.stop();
30723
31093
  }
30724
- }, _callee22, this, [[9, 18]]);
31094
+ }, _callee22, this, [[9, 27]]);
30725
31095
  }));
30726
31096
  function requestAirdrop(_x21, _x22) {
30727
31097
  return _requestAirdrop.apply(this, arguments);
@@ -30934,6 +31304,7 @@ function parseRawEvents(raw) {
30934
31304
  var _raw$events;
30935
31305
  return {
30936
31306
  latestLedger: raw.latestLedger,
31307
+ cursor: raw.cursor,
30937
31308
  events: ((_raw$events = raw.events) !== null && _raw$events !== void 0 ? _raw$events : []).map(function (evt) {
30938
31309
  var clone = _objectSpread({}, evt);
30939
31310
  delete clone.contractId;