@stellar/stellar-sdk 13.0.0 → 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 +14 -4
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk-minimal.js +426 -71
  4. package/dist/stellar-sdk-minimal.min.js +1 -1
  5. package/dist/stellar-sdk-no-axios.js +1022 -228
  6. package/dist/stellar-sdk-no-axios.min.js +1 -1
  7. package/dist/stellar-sdk-no-eventsource.js +149 -142
  8. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  9. package/dist/stellar-sdk.js +745 -299
  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 +10 -10
@@ -27730,7 +27730,7 @@ var http_client = __webpack_require__(6371);
27730
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); }
27731
27731
 
27732
27732
 
27733
- var version = "13.0.0";
27733
+ var version = "13.1.0";
27734
27734
  var SERVER_TIME_MAP = {};
27735
27735
  var AxiosClient = (0,http_client/* create */.vt)({
27736
27736
  headers: {
@@ -29113,28 +29113,49 @@ var HorizonServer = function () {
29113
29113
  }
29114
29114
  return feeStats;
29115
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
+ }())
29116
29137
  }, {
29117
29138
  key: "submitTransaction",
29118
29139
  value: (function () {
29119
- var _submitTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee4(transaction) {
29140
+ var _submitTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee5(transaction) {
29120
29141
  var opts,
29121
29142
  tx,
29122
- _args4 = arguments;
29123
- return server_regeneratorRuntime().wrap(function _callee4$(_context4) {
29124
- 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) {
29125
29146
  case 0:
29126
- opts = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {
29147
+ opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {
29127
29148
  skipMemoRequiredCheck: false
29128
29149
  };
29129
29150
  if (opts.skipMemoRequiredCheck) {
29130
- _context4.next = 4;
29151
+ _context5.next = 4;
29131
29152
  break;
29132
29153
  }
29133
- _context4.next = 4;
29154
+ _context5.next = 4;
29134
29155
  return this.checkMemoRequired(transaction);
29135
29156
  case 4:
29136
29157
  tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
29137
- 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), {
29138
29159
  timeout: SUBMIT_TRANSACTION_TIMEOUT
29139
29160
  }).then(function (response) {
29140
29161
  if (!response.data.result_xdr) {
@@ -29245,9 +29266,9 @@ var HorizonServer = function () {
29245
29266
  }));
29246
29267
  case 6:
29247
29268
  case "end":
29248
- return _context4.stop();
29269
+ return _context5.stop();
29249
29270
  }
29250
- }, _callee4, this);
29271
+ }, _callee5, this);
29251
29272
  }));
29252
29273
  function submitTransaction(_x2) {
29253
29274
  return _submitTransaction.apply(this, arguments);
@@ -29257,25 +29278,25 @@ var HorizonServer = function () {
29257
29278
  }, {
29258
29279
  key: "submitAsyncTransaction",
29259
29280
  value: (function () {
29260
- var _submitAsyncTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee5(transaction) {
29281
+ var _submitAsyncTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6(transaction) {
29261
29282
  var opts,
29262
29283
  tx,
29263
- _args5 = arguments;
29264
- return server_regeneratorRuntime().wrap(function _callee5$(_context5) {
29265
- 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) {
29266
29287
  case 0:
29267
- opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {
29288
+ opts = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {
29268
29289
  skipMemoRequiredCheck: false
29269
29290
  };
29270
29291
  if (opts.skipMemoRequiredCheck) {
29271
- _context5.next = 4;
29292
+ _context6.next = 4;
29272
29293
  break;
29273
29294
  }
29274
- _context5.next = 4;
29295
+ _context6.next = 4;
29275
29296
  return this.checkMemoRequired(transaction);
29276
29297
  case 4:
29277
29298
  tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
29278
- 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) {
29279
29300
  return response.data;
29280
29301
  }).catch(function (response) {
29281
29302
  if (response instanceof Error) {
@@ -29285,9 +29306,9 @@ var HorizonServer = function () {
29285
29306
  }));
29286
29307
  case 6:
29287
29308
  case "end":
29288
- return _context5.stop();
29309
+ return _context6.stop();
29289
29310
  }
29290
- }, _callee5, this);
29311
+ }, _callee6, this);
29291
29312
  }));
29292
29313
  function submitAsyncTransaction(_x3) {
29293
29314
  return _submitAsyncTransaction.apply(this, arguments);
@@ -29372,21 +29393,21 @@ var HorizonServer = function () {
29372
29393
  }, {
29373
29394
  key: "loadAccount",
29374
29395
  value: (function () {
29375
- var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6(accountId) {
29396
+ var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee7(accountId) {
29376
29397
  var res;
29377
- return server_regeneratorRuntime().wrap(function _callee6$(_context6) {
29378
- while (1) switch (_context6.prev = _context6.next) {
29398
+ return server_regeneratorRuntime().wrap(function _callee7$(_context7) {
29399
+ while (1) switch (_context7.prev = _context7.next) {
29379
29400
  case 0:
29380
- _context6.next = 2;
29401
+ _context7.next = 2;
29381
29402
  return this.accounts().accountId(accountId).call();
29382
29403
  case 2:
29383
- res = _context6.sent;
29384
- return _context6.abrupt("return", new AccountResponse(res));
29404
+ res = _context7.sent;
29405
+ return _context7.abrupt("return", new AccountResponse(res));
29385
29406
  case 4:
29386
29407
  case "end":
29387
- return _context6.stop();
29408
+ return _context7.stop();
29388
29409
  }
29389
- }, _callee6, this);
29410
+ }, _callee7, this);
29390
29411
  }));
29391
29412
  function loadAccount(_x4) {
29392
29413
  return _loadAccount.apply(this, arguments);
@@ -29401,88 +29422,88 @@ var HorizonServer = function () {
29401
29422
  }, {
29402
29423
  key: "checkMemoRequired",
29403
29424
  value: (function () {
29404
- var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee7(transaction) {
29425
+ var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee8(transaction) {
29405
29426
  var destinations, i, operation, destination, account;
29406
- return server_regeneratorRuntime().wrap(function _callee7$(_context7) {
29407
- while (1) switch (_context7.prev = _context7.next) {
29427
+ return server_regeneratorRuntime().wrap(function _callee8$(_context8) {
29428
+ while (1) switch (_context8.prev = _context8.next) {
29408
29429
  case 0:
29409
29430
  if (transaction instanceof lib.FeeBumpTransaction) {
29410
29431
  transaction = transaction.innerTransaction;
29411
29432
  }
29412
29433
  if (!(transaction.memo.type !== "none")) {
29413
- _context7.next = 3;
29434
+ _context8.next = 3;
29414
29435
  break;
29415
29436
  }
29416
- return _context7.abrupt("return");
29437
+ return _context8.abrupt("return");
29417
29438
  case 3:
29418
29439
  destinations = new Set();
29419
29440
  i = 0;
29420
29441
  case 5:
29421
29442
  if (!(i < transaction.operations.length)) {
29422
- _context7.next = 36;
29443
+ _context8.next = 36;
29423
29444
  break;
29424
29445
  }
29425
29446
  operation = transaction.operations[i];
29426
- _context7.t0 = operation.type;
29427
- _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;
29428
29449
  break;
29429
29450
  case 10:
29430
- return _context7.abrupt("break", 12);
29451
+ return _context8.abrupt("break", 12);
29431
29452
  case 11:
29432
- return _context7.abrupt("continue", 33);
29453
+ return _context8.abrupt("continue", 33);
29433
29454
  case 12:
29434
29455
  destination = operation.destination;
29435
29456
  if (!destinations.has(destination)) {
29436
- _context7.next = 15;
29457
+ _context8.next = 15;
29437
29458
  break;
29438
29459
  }
29439
- return _context7.abrupt("continue", 33);
29460
+ return _context8.abrupt("continue", 33);
29440
29461
  case 15:
29441
29462
  destinations.add(destination);
29442
29463
  if (!destination.startsWith("M")) {
29443
- _context7.next = 18;
29464
+ _context8.next = 18;
29444
29465
  break;
29445
29466
  }
29446
- return _context7.abrupt("continue", 33);
29467
+ return _context8.abrupt("continue", 33);
29447
29468
  case 18:
29448
- _context7.prev = 18;
29449
- _context7.next = 21;
29469
+ _context8.prev = 18;
29470
+ _context8.next = 21;
29450
29471
  return this.loadAccount(destination);
29451
29472
  case 21:
29452
- account = _context7.sent;
29473
+ account = _context8.sent;
29453
29474
  if (!(account.data_attr["config.memo_required"] === ACCOUNT_REQUIRES_MEMO)) {
29454
- _context7.next = 24;
29475
+ _context8.next = 24;
29455
29476
  break;
29456
29477
  }
29457
29478
  throw new errors/* AccountRequiresMemoError */.Cu("account requires memo", destination, i);
29458
29479
  case 24:
29459
- _context7.next = 33;
29480
+ _context8.next = 33;
29460
29481
  break;
29461
29482
  case 26:
29462
- _context7.prev = 26;
29463
- _context7.t1 = _context7["catch"](18);
29464
- if (!(_context7.t1 instanceof errors/* AccountRequiresMemoError */.Cu)) {
29465
- _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;
29466
29487
  break;
29467
29488
  }
29468
- throw _context7.t1;
29489
+ throw _context8.t1;
29469
29490
  case 30:
29470
- if (_context7.t1 instanceof errors/* NotFoundError */.m_) {
29471
- _context7.next = 32;
29491
+ if (_context8.t1 instanceof errors/* NotFoundError */.m_) {
29492
+ _context8.next = 32;
29472
29493
  break;
29473
29494
  }
29474
- throw _context7.t1;
29495
+ throw _context8.t1;
29475
29496
  case 32:
29476
- return _context7.abrupt("continue", 33);
29497
+ return _context8.abrupt("continue", 33);
29477
29498
  case 33:
29478
29499
  i += 1;
29479
- _context7.next = 5;
29500
+ _context8.next = 5;
29480
29501
  break;
29481
29502
  case 36:
29482
29503
  case "end":
29483
- return _context7.stop();
29504
+ return _context8.stop();
29484
29505
  }
29485
- }, _callee7, this, [[18, 26]]);
29506
+ }, _callee8, this, [[18, 26]]);
29486
29507
  }));
29487
29508
  function checkMemoRequired(_x5) {
29488
29509
  return _checkMemoRequired.apply(this, arguments);
@@ -29516,7 +29537,321 @@ __webpack_require__.d(__webpack_exports__, {
29516
29537
  });
29517
29538
 
29518
29539
  ;// ./node_modules/feaxios/dist/index.mjs
29519
- 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
+
29520
29855
  // EXTERNAL MODULE: ./src/http-client/types.ts
29521
29856
  var types = __webpack_require__(5798);
29522
29857
  ;// ./src/http-client/fetch-client.ts
@@ -29574,7 +29909,7 @@ function createFetchClient() {
29574
29909
  var defaults = _objectSpread(_objectSpread({}, fetchConfig), {}, {
29575
29910
  headers: fetchConfig.headers || {}
29576
29911
  });
29577
- var instance = h.create(defaults);
29912
+ var instance = src_default.create(defaults);
29578
29913
  var requestInterceptors = new InterceptorManager();
29579
29914
  var responseInterceptors = new InterceptorManager();
29580
29915
  var httpClient = {
@@ -29938,7 +30273,7 @@ var lib = __webpack_require__(356);
29938
30273
  var http_client = __webpack_require__(6371);
29939
30274
  ;// ./src/rpc/axios.ts
29940
30275
 
29941
- var version = "13.0.0";
30276
+ var version = "13.1.0";
29942
30277
  var AxiosClient = (0,http_client/* create */.vt)({
29943
30278
  headers: {
29944
30279
  'X-Client-Name': 'js-soroban-client',
@@ -30689,7 +31024,7 @@ var RpcServer = function () {
30689
31024
  key: "requestAirdrop",
30690
31025
  value: (function () {
30691
31026
  var _requestAirdrop = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee22(address, friendbotUrl) {
30692
- var account, response, meta, sequence, _error$response, _error$response$detai;
31027
+ var account, response, meta, txMeta, sequence, _error$response, _error$response$detai;
30693
31028
  return server_regeneratorRuntime().wrap(function _callee22$(_context22) {
30694
31029
  while (1) switch (_context22.prev = _context22.next) {
30695
31030
  case 0:
@@ -30716,28 +31051,47 @@ var RpcServer = function () {
30716
31051
  return axios.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
30717
31052
  case 12:
30718
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:
30719
31072
  meta = lib.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
31073
+ case 23:
30720
31074
  sequence = findCreatedAccountSequenceInTransactionMeta(meta);
30721
31075
  return _context22.abrupt("return", new lib.Account(account, sequence));
30722
- case 18:
30723
- _context22.prev = 18;
31076
+ case 27:
31077
+ _context22.prev = 27;
30724
31078
  _context22.t1 = _context22["catch"](9);
30725
31079
  if (!(((_error$response = _context22.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
30726
- _context22.next = 23;
31080
+ _context22.next = 32;
30727
31081
  break;
30728
31082
  }
30729
31083
  if (!((_error$response$detai = _context22.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
30730
- _context22.next = 23;
31084
+ _context22.next = 32;
30731
31085
  break;
30732
31086
  }
30733
31087
  return _context22.abrupt("return", this.getAccount(account));
30734
- case 23:
31088
+ case 32:
30735
31089
  throw _context22.t1;
30736
- case 24:
31090
+ case 33:
30737
31091
  case "end":
30738
31092
  return _context22.stop();
30739
31093
  }
30740
- }, _callee22, this, [[9, 18]]);
31094
+ }, _callee22, this, [[9, 27]]);
30741
31095
  }));
30742
31096
  function requestAirdrop(_x21, _x22) {
30743
31097
  return _requestAirdrop.apply(this, arguments);
@@ -30950,6 +31304,7 @@ function parseRawEvents(raw) {
30950
31304
  var _raw$events;
30951
31305
  return {
30952
31306
  latestLedger: raw.latestLedger,
31307
+ cursor: raw.cursor,
30953
31308
  events: ((_raw$events = raw.events) !== null && _raw$events !== void 0 ? _raw$events : []).map(function (evt) {
30954
31309
  var clone = _objectSpread({}, evt);
30955
31310
  delete clone.contractId;