@stellar/stellar-sdk 12.1.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +1336 -1101
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/browser.d.ts +1 -1
  6. package/lib/browser.js +4 -4
  7. package/lib/config.js +5 -2
  8. package/lib/contract/assembled_transaction.d.ts +26 -30
  9. package/lib/contract/assembled_transaction.js +28 -36
  10. package/lib/contract/client.d.ts +0 -1
  11. package/lib/contract/client.js +2 -2
  12. package/lib/contract/index.d.ts +0 -1
  13. package/lib/contract/index.js +1 -18
  14. package/lib/contract/sent_transaction.d.ts +9 -10
  15. package/lib/contract/sent_transaction.js +2 -1
  16. package/lib/contract/spec.d.ts +1 -1
  17. package/lib/contract/spec.js +921 -956
  18. package/lib/contract/types.d.ts +5 -0
  19. package/lib/contract/types.js +4 -1
  20. package/lib/contract/utils.d.ts +0 -5
  21. package/lib/contract/utils.js +4 -18
  22. package/lib/errors.d.ts +4 -4
  23. package/lib/federation/server.d.ts +1 -1
  24. package/lib/horizon/account_call_builder.d.ts +2 -3
  25. package/lib/horizon/account_response.d.ts +1 -1
  26. package/lib/horizon/assets_call_builder.d.ts +2 -3
  27. package/lib/horizon/call_builder.d.ts +8 -8
  28. package/lib/horizon/call_builder.js +10 -13
  29. package/lib/horizon/claimable_balances_call_builder.d.ts +3 -4
  30. package/lib/horizon/effect_call_builder.d.ts +2 -3
  31. package/lib/horizon/friendbot_builder.d.ts +0 -1
  32. package/lib/horizon/horizon_api.d.ts +5 -1
  33. package/lib/horizon/horizon_axios_client.js +6 -6
  34. package/lib/horizon/ledger_call_builder.d.ts +2 -3
  35. package/lib/horizon/liquidity_pool_call_builder.d.ts +2 -4
  36. package/lib/horizon/offer_call_builder.d.ts +2 -3
  37. package/lib/horizon/operation_call_builder.d.ts +3 -4
  38. package/lib/horizon/orderbook_call_builder.d.ts +0 -1
  39. package/lib/horizon/path_call_builder.d.ts +1 -2
  40. package/lib/horizon/payment_call_builder.d.ts +2 -3
  41. package/lib/horizon/server.d.ts +29 -10
  42. package/lib/horizon/server.js +98 -55
  43. package/lib/horizon/strict_receive_path_call_builder.d.ts +1 -2
  44. package/lib/horizon/strict_send_path_call_builder.d.ts +1 -2
  45. package/lib/horizon/trade_aggregation_call_builder.d.ts +9 -10
  46. package/lib/horizon/trade_aggregation_call_builder.js +3 -7
  47. package/lib/horizon/trades_call_builder.d.ts +2 -3
  48. package/lib/horizon/transaction_call_builder.d.ts +3 -4
  49. package/lib/horizon/types/assets.d.ts +1 -1
  50. package/lib/horizon/types/effects.d.ts +1 -1
  51. package/lib/horizon/types/offer.d.ts +1 -1
  52. package/lib/index.d.ts +0 -1
  53. package/lib/rpc/api.d.ts +89 -11
  54. package/lib/rpc/browser.d.ts +1 -1
  55. package/lib/rpc/browser.js +4 -4
  56. package/lib/rpc/index.d.ts +0 -1
  57. package/lib/rpc/jsonrpc.js +3 -3
  58. package/lib/rpc/parsers.d.ts +5 -3
  59. package/lib/rpc/parsers.js +52 -23
  60. package/lib/rpc/server.d.ts +51 -18
  61. package/lib/rpc/server.js +200 -153
  62. package/lib/rpc/transaction.d.ts +3 -4
  63. package/lib/rpc/transaction.js +23 -25
  64. package/lib/webauth/utils.js +3 -3
  65. package/package.json +24 -24
package/lib/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import axios from "axios";
1
2
  export * from "./index";
2
3
  export * as StellarBase from "@stellar/stellar-base";
3
- import axios from "axios";
4
4
  export { axios };
5
5
  declare const _default: any;
6
6
  export default _default;
package/lib/browser.js CHANGED
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  var _exportNames = {
8
- StellarBase: true,
9
- axios: true
8
+ axios: true,
9
+ StellarBase: true
10
10
  };
11
11
  exports.StellarBase = void 0;
12
12
  Object.defineProperty(exports, "axios", {
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "axios", {
16
16
  }
17
17
  });
18
18
  exports.default = void 0;
19
+ var _axios = _interopRequireDefault(require("axios"));
19
20
  var _index = require("./index");
20
21
  Object.keys(_index).forEach(function (key) {
21
22
  if (key === "default" || key === "__esModule") return;
@@ -30,8 +31,7 @@ Object.keys(_index).forEach(function (key) {
30
31
  });
31
32
  var _StellarBase = _interopRequireWildcard(require("@stellar/stellar-base"));
32
33
  exports.StellarBase = _StellarBase;
33
- var _axios = _interopRequireDefault(require("axios"));
34
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
35
34
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
36
35
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
36
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
37
37
  var _default = exports.default = module.exports;
package/lib/config.js CHANGED
@@ -8,13 +8,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
8
8
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
9
9
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
10
10
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
11
+ 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; }
12
+ 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; }
13
+ 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; }
11
14
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
15
  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); }
13
16
  var defaultConfig = {
14
17
  allowHttp: false,
15
18
  timeout: 0
16
19
  };
17
- var config = Object.assign({}, defaultConfig);
20
+ var config = _objectSpread({}, defaultConfig);
18
21
  var Config = exports.Config = function () {
19
22
  function Config() {
20
23
  _classCallCheck(this, Config);
@@ -42,7 +45,7 @@ var Config = exports.Config = function () {
42
45
  }, {
43
46
  key: "setDefault",
44
47
  value: function setDefault() {
45
- config = Object.assign({}, defaultConfig);
48
+ config = _objectSpread({}, defaultConfig);
46
49
  }
47
50
  }]);
48
51
  }();
@@ -1,10 +1,8 @@
1
- /// <reference types="node" />
2
1
  import { Account, SorobanDataBuilder, TransactionBuilder, xdr } from "@stellar/stellar-base";
3
2
  import type { AssembledTransactionOptions, ClientOptions, Tx, XDR_BASE64 } from "./types";
4
3
  import { Api } from "../rpc/api";
5
4
  import { SentTransaction } from "./sent_transaction";
6
5
  import { Spec } from "./spec";
7
- export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
8
6
  /**
9
7
  * The main workhorse of {@link Client}. This class is used to wrap a
10
8
  * transaction-under-construction and provide high-level interfaces to the most
@@ -279,82 +277,82 @@ export declare class AssembledTransaction<T> {
279
277
  */
280
278
  static Errors: {
281
279
  ExpiredState: {
282
- new (message?: string | undefined): {
280
+ new (message?: string): {
283
281
  name: string;
284
282
  message: string;
285
- stack?: string | undefined;
283
+ stack?: string;
286
284
  };
287
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
285
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
288
286
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
289
287
  stackTraceLimit: number;
290
288
  };
291
289
  RestorationFailure: {
292
- new (message?: string | undefined): {
290
+ new (message?: string): {
293
291
  name: string;
294
292
  message: string;
295
- stack?: string | undefined;
293
+ stack?: string;
296
294
  };
297
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
295
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
298
296
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
299
297
  stackTraceLimit: number;
300
298
  };
301
299
  NeedsMoreSignatures: {
302
- new (message?: string | undefined): {
300
+ new (message?: string): {
303
301
  name: string;
304
302
  message: string;
305
- stack?: string | undefined;
303
+ stack?: string;
306
304
  };
307
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
305
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
308
306
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
309
307
  stackTraceLimit: number;
310
308
  };
311
309
  NoSignatureNeeded: {
312
- new (message?: string | undefined): {
310
+ new (message?: string): {
313
311
  name: string;
314
312
  message: string;
315
- stack?: string | undefined;
313
+ stack?: string;
316
314
  };
317
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
315
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
318
316
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
319
317
  stackTraceLimit: number;
320
318
  };
321
319
  NoUnsignedNonInvokerAuthEntries: {
322
- new (message?: string | undefined): {
320
+ new (message?: string): {
323
321
  name: string;
324
322
  message: string;
325
- stack?: string | undefined;
323
+ stack?: string;
326
324
  };
327
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
325
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
328
326
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
329
327
  stackTraceLimit: number;
330
328
  };
331
329
  NoSigner: {
332
- new (message?: string | undefined): {
330
+ new (message?: string): {
333
331
  name: string;
334
332
  message: string;
335
- stack?: string | undefined;
333
+ stack?: string;
336
334
  };
337
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
335
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
338
336
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
339
337
  stackTraceLimit: number;
340
338
  };
341
339
  NotYetSimulated: {
342
- new (message?: string | undefined): {
340
+ new (message?: string): {
343
341
  name: string;
344
342
  message: string;
345
- stack?: string | undefined;
343
+ stack?: string;
346
344
  };
347
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
345
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
348
346
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
349
347
  stackTraceLimit: number;
350
348
  };
351
349
  FakeAccount: {
352
- new (message?: string | undefined): {
350
+ new (message?: string): {
353
351
  name: string;
354
352
  message: string;
355
- stack?: string | undefined;
353
+ stack?: string;
356
354
  };
357
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
355
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
358
356
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
359
357
  stackTraceLimit: number;
360
358
  };
@@ -447,7 +445,6 @@ export declare class AssembledTransaction<T> {
447
445
  */
448
446
  signTransaction?: ClientOptions["signTransaction"];
449
447
  }) => Promise<SentTransaction<T>>;
450
- private getStorageExpiration;
451
448
  /**
452
449
  * Get a list of accounts, other than the invoker of the simulation, that
453
450
  * need to sign auth entries in this transaction.
@@ -494,8 +491,7 @@ export declare class AssembledTransaction<T> {
494
491
  /**
495
492
  * When to set each auth entry to expire. Could be any number of blocks in
496
493
  * the future. Can be supplied as a promise or a raw number. Default:
497
- * contract's current `persistent` storage expiration date/ledger
498
- * number/block.
494
+ * about 8.3 minutes from now.
499
495
  */
500
496
  expiration?: number | Promise<number>;
501
497
  /**
@@ -536,7 +532,7 @@ export declare class AssembledTransaction<T> {
536
532
  * Client initialization.
537
533
  * @throws {AssembledTransaction.Errors.RestoreFailure} - Throws a custom error if the
538
534
  * restore transaction fails, providing the details of the failure.
539
- */
535
+ */
540
536
  restoreFootprint(
541
537
  /**
542
538
  * The preamble object containing data required to
@@ -3,13 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.NULL_ACCOUNT = exports.AssembledTransaction = void 0;
6
+ exports.AssembledTransaction = void 0;
7
7
  var _stellarBase = require("@stellar/stellar-base");
8
8
  var _server = require("../rpc/server");
9
9
  var _api = require("../rpc/api");
10
10
  var _transaction = require("../rpc/transaction");
11
11
  var _rust_result = require("./rust_result");
12
12
  var _utils = require("./utils");
13
+ var _types = require("./types");
13
14
  var _sent_transaction = require("./sent_transaction");
14
15
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
16
  function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
@@ -44,7 +45,6 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
44
45
  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; }
45
46
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
46
47
  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); }
47
- var NULL_ACCOUNT = exports.NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
48
48
  var AssembledTransaction = exports.AssembledTransaction = function () {
49
49
  function AssembledTransaction(options) {
50
50
  var _this = this,
@@ -105,7 +105,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
105
105
  _this.raw = new _stellarBase.TransactionBuilder(account, {
106
106
  fee: (_this$options$fee = _this.options.fee) !== null && _this$options$fee !== void 0 ? _this$options$fee : _stellarBase.BASE_FEE,
107
107
  networkPassphrase: _this.options.networkPassphrase
108
- }).addOperation(contract.call.apply(contract, [_this.options.method].concat(_toConsumableArray((_this$options$args = _this.options.args) !== null && _this$options$args !== void 0 ? _this$options$args : [])))).setTimeout((_this$options$timeout = _this.options.timeoutInSeconds) !== null && _this$options$timeout !== void 0 ? _this$options$timeout : _utils.DEFAULT_TIMEOUT);
108
+ }).addOperation(contract.call.apply(contract, [_this.options.method].concat(_toConsumableArray((_this$options$args = _this.options.args) !== null && _this$options$args !== void 0 ? _this$options$args : [])))).setTimeout((_this$options$timeout = _this.options.timeoutInSeconds) !== null && _this$options$timeout !== void 0 ? _this$options$timeout : _types.DEFAULT_TIMEOUT);
109
109
  _context.next = 23;
110
110
  return _this.simulate();
111
111
  case 23:
@@ -161,7 +161,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
161
161
  }
162
162
  throw new AssembledTransaction.Errors.NeedsMoreSignatures("Transaction requires more signatures. " + "See `needsNonInvokerSigningBy` for details.");
163
163
  case 9:
164
- timeoutInSeconds = (_this$options$timeout2 = _this.options.timeoutInSeconds) !== null && _this$options$timeout2 !== void 0 ? _this$options$timeout2 : _utils.DEFAULT_TIMEOUT;
164
+ timeoutInSeconds = (_this$options$timeout2 = _this.options.timeoutInSeconds) !== null && _this$options$timeout2 !== void 0 ? _this$options$timeout2 : _types.DEFAULT_TIMEOUT;
165
165
  _this.built = _stellarBase.TransactionBuilder.cloneFrom(_this.built, {
166
166
  fee: _this.built.fee,
167
167
  timebounds: undefined,
@@ -208,33 +208,11 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
208
208
  }
209
209
  }, _callee3);
210
210
  })));
211
- _defineProperty(this, "getStorageExpiration", _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() {
212
- var entryRes;
213
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
214
- while (1) switch (_context4.prev = _context4.next) {
215
- case 0:
216
- _context4.next = 2;
217
- return _this.server.getLedgerEntries(new _stellarBase.Contract(_this.options.contractId).getFootprint());
218
- case 2:
219
- entryRes = _context4.sent;
220
- if (!(!entryRes.entries || !entryRes.entries.length || !entryRes.entries[0].liveUntilLedgerSeq)) {
221
- _context4.next = 5;
222
- break;
223
- }
224
- throw new Error("failed to get ledger entry");
225
- case 5:
226
- return _context4.abrupt("return", entryRes.entries[0].liveUntilLedgerSeq);
227
- case 6:
228
- case "end":
229
- return _context4.stop();
230
- }
231
- }, _callee4);
232
- })));
233
211
  _defineProperty(this, "needsNonInvokerSigningBy", function () {
234
212
  var _rawInvokeHostFunctio;
235
- var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
236
- _ref8$includeAlreadyS = _ref8.includeAlreadySigned,
237
- includeAlreadySigned = _ref8$includeAlreadyS === void 0 ? false : _ref8$includeAlreadyS;
213
+ var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
214
+ _ref7$includeAlreadyS = _ref7.includeAlreadySigned,
215
+ includeAlreadySigned = _ref7$includeAlreadyS === void 0 ? false : _ref7$includeAlreadyS;
238
216
  if (!_this.built) {
239
217
  throw new Error("Transaction has not yet been simulated");
240
218
  }
@@ -250,12 +228,12 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
250
228
  });
251
229
  _defineProperty(this, "signAuthEntries", _asyncToGenerator(_regeneratorRuntime().mark(function _callee6() {
252
230
  var _rawInvokeHostFunctio2;
253
- var _ref10,
254
- _ref10$expiration,
231
+ var _ref9,
232
+ _ref9$expiration,
255
233
  expiration,
256
- _ref10$signAuthEntry,
234
+ _ref9$signAuthEntry,
257
235
  signAuthEntry,
258
- _ref10$publicKey,
236
+ _ref9$publicKey,
259
237
  publicKey,
260
238
  needsNonInvokerSigningBy,
261
239
  rawInvokeHostFunctionOp,
@@ -270,7 +248,21 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
270
248
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
271
249
  while (1) switch (_context6.prev = _context6.next) {
272
250
  case 0:
273
- _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;
251
+ _ref9 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref9$expiration = _ref9.expiration, expiration = _ref9$expiration === void 0 ? _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() {
252
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
253
+ while (1) switch (_context4.prev = _context4.next) {
254
+ case 0:
255
+ _context4.next = 2;
256
+ return _this.server.getLatestLedger();
257
+ case 2:
258
+ _context4.t0 = _context4.sent.sequence;
259
+ return _context4.abrupt("return", _context4.t0 + 100);
260
+ case 4:
261
+ case "end":
262
+ return _context4.stop();
263
+ }
264
+ }, _callee4);
265
+ }))() : _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;
274
266
  if (_this.built) {
275
267
  _context6.next = 3;
276
268
  break;
@@ -608,7 +600,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
608
600
  tx.raw = new _stellarBase.TransactionBuilder(account, {
609
601
  fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : _stellarBase.BASE_FEE,
610
602
  networkPassphrase: options.networkPassphrase
611
- }).addOperation(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : [])))).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : _utils.DEFAULT_TIMEOUT);
603
+ }).addOperation(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : [])))).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : _types.DEFAULT_TIMEOUT);
612
604
  if (!options.simulate) {
613
605
  _context9.next = 9;
614
606
  break;
@@ -641,7 +633,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
641
633
  tx.raw = new _stellarBase.TransactionBuilder(account, {
642
634
  fee: fee,
643
635
  networkPassphrase: options.networkPassphrase
644
- }).setSorobanData(sorobanData instanceof _stellarBase.SorobanDataBuilder ? sorobanData.build() : sorobanData).addOperation(_stellarBase.Operation.restoreFootprint({})).setTimeout((_options$timeoutInSec2 = options.timeoutInSeconds) !== null && _options$timeoutInSec2 !== void 0 ? _options$timeoutInSec2 : _utils.DEFAULT_TIMEOUT);
636
+ }).setSorobanData(sorobanData instanceof _stellarBase.SorobanDataBuilder ? sorobanData.build() : sorobanData).addOperation(_stellarBase.Operation.restoreFootprint({})).setTimeout((_options$timeoutInSec2 = options.timeoutInSeconds) !== null && _options$timeoutInSec2 !== void 0 ? _options$timeoutInSec2 : _types.DEFAULT_TIMEOUT);
645
637
  _context10.next = 4;
646
638
  return tx.simulate({
647
639
  restore: false
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Spec } from "./spec";
3
2
  import { AssembledTransaction } from "./assembled_transaction";
4
3
  import type { ClientOptions } from "./types";
@@ -15,8 +15,8 @@ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.
15
15
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
16
16
  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; }
17
17
  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; }
18
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
19
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
18
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
19
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
20
20
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
21
21
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
22
22
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -5,4 +5,3 @@ export * from "./rust_result";
5
5
  export * from "./sent_transaction";
6
6
  export * from "./spec";
7
7
  export * from "./types";
8
- export { DEFAULT_TIMEOUT } from "./utils";
@@ -3,19 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {
7
- DEFAULT_TIMEOUT: true
8
- };
9
- Object.defineProperty(exports, "DEFAULT_TIMEOUT", {
10
- enumerable: true,
11
- get: function get() {
12
- return _utils.DEFAULT_TIMEOUT;
13
- }
14
- });
15
6
  var _assembled_transaction = require("./assembled_transaction");
16
7
  Object.keys(_assembled_transaction).forEach(function (key) {
17
8
  if (key === "default" || key === "__esModule") return;
18
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
19
9
  if (key in exports && exports[key] === _assembled_transaction[key]) return;
20
10
  Object.defineProperty(exports, key, {
21
11
  enumerable: true,
@@ -27,7 +17,6 @@ Object.keys(_assembled_transaction).forEach(function (key) {
27
17
  var _basic_node_signer = require("./basic_node_signer");
28
18
  Object.keys(_basic_node_signer).forEach(function (key) {
29
19
  if (key === "default" || key === "__esModule") return;
30
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
31
20
  if (key in exports && exports[key] === _basic_node_signer[key]) return;
32
21
  Object.defineProperty(exports, key, {
33
22
  enumerable: true,
@@ -39,7 +28,6 @@ Object.keys(_basic_node_signer).forEach(function (key) {
39
28
  var _client = require("./client");
40
29
  Object.keys(_client).forEach(function (key) {
41
30
  if (key === "default" || key === "__esModule") return;
42
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
43
31
  if (key in exports && exports[key] === _client[key]) return;
44
32
  Object.defineProperty(exports, key, {
45
33
  enumerable: true,
@@ -51,7 +39,6 @@ Object.keys(_client).forEach(function (key) {
51
39
  var _rust_result = require("./rust_result");
52
40
  Object.keys(_rust_result).forEach(function (key) {
53
41
  if (key === "default" || key === "__esModule") return;
54
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
55
42
  if (key in exports && exports[key] === _rust_result[key]) return;
56
43
  Object.defineProperty(exports, key, {
57
44
  enumerable: true,
@@ -63,7 +50,6 @@ Object.keys(_rust_result).forEach(function (key) {
63
50
  var _sent_transaction = require("./sent_transaction");
64
51
  Object.keys(_sent_transaction).forEach(function (key) {
65
52
  if (key === "default" || key === "__esModule") return;
66
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
67
53
  if (key in exports && exports[key] === _sent_transaction[key]) return;
68
54
  Object.defineProperty(exports, key, {
69
55
  enumerable: true,
@@ -75,7 +61,6 @@ Object.keys(_sent_transaction).forEach(function (key) {
75
61
  var _spec = require("./spec");
76
62
  Object.keys(_spec).forEach(function (key) {
77
63
  if (key === "default" || key === "__esModule") return;
78
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
79
64
  if (key in exports && exports[key] === _spec[key]) return;
80
65
  Object.defineProperty(exports, key, {
81
66
  enumerable: true,
@@ -87,7 +72,6 @@ Object.keys(_spec).forEach(function (key) {
87
72
  var _types = require("./types");
88
73
  Object.keys(_types).forEach(function (key) {
89
74
  if (key === "default" || key === "__esModule") return;
90
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
91
75
  if (key in exports && exports[key] === _types[key]) return;
92
76
  Object.defineProperty(exports, key, {
93
77
  enumerable: true,
@@ -95,5 +79,4 @@ Object.keys(_types).forEach(function (key) {
95
79
  return _types[key];
96
80
  }
97
81
  });
98
- });
99
- var _utils = require("./utils");
82
+ });
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Server } from "../rpc/server";
3
2
  import { Api } from "../rpc/api";
4
3
  import type { AssembledTransaction } from "./assembled_transaction";
@@ -38,32 +37,32 @@ export declare class SentTransaction<T> {
38
37
  getTransactionResponse?: Api.GetTransactionResponse;
39
38
  static Errors: {
40
39
  SendFailed: {
41
- new (message?: string | undefined): {
40
+ new (message?: string): {
42
41
  name: string;
43
42
  message: string;
44
- stack?: string | undefined;
43
+ stack?: string;
45
44
  };
46
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
45
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
47
46
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
48
47
  stackTraceLimit: number;
49
48
  };
50
49
  SendResultOnly: {
51
- new (message?: string | undefined): {
50
+ new (message?: string): {
52
51
  name: string;
53
52
  message: string;
54
- stack?: string | undefined;
53
+ stack?: string;
55
54
  };
56
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
55
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
57
56
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
58
57
  stackTraceLimit: number;
59
58
  };
60
59
  TransactionStillPending: {
61
- new (message?: string | undefined): {
60
+ new (message?: string): {
62
61
  name: string;
63
62
  message: string;
64
- stack?: string | undefined;
63
+ stack?: string;
65
64
  };
66
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
65
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
67
66
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
68
67
  stackTraceLimit: number;
69
68
  };
@@ -7,6 +7,7 @@ exports.SentTransaction = void 0;
7
7
  var _server = require("../rpc/server");
8
8
  var _api = require("../rpc/api");
9
9
  var _utils = require("./utils");
10
+ var _types = require("./types");
10
11
  var _SentTransaction;
11
12
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
13
  function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
@@ -50,7 +51,7 @@ var SentTransaction = exports.SentTransaction = function () {
50
51
  throw new SentTransaction.Errors.SendFailed("Sending the transaction to the network failed!\n".concat(JSON.stringify(_this.sendTransactionResponse, null, 2)));
51
52
  case 5:
52
53
  hash = _this.sendTransactionResponse.hash;
53
- timeoutInSeconds = (_this$assembled$optio = _this.assembled.options.timeoutInSeconds) !== null && _this$assembled$optio !== void 0 ? _this$assembled$optio : _utils.DEFAULT_TIMEOUT;
54
+ timeoutInSeconds = (_this$assembled$optio = _this.assembled.options.timeoutInSeconds) !== null && _this$assembled$optio !== void 0 ? _this$assembled$optio : _types.DEFAULT_TIMEOUT;
54
55
  _context.next = 9;
55
56
  return (0, _utils.withExponentialBackoff)(function () {
56
57
  return _this.server.getTransaction(hash);
@@ -59,7 +59,7 @@ export declare class Spec {
59
59
  * Converts native JS arguments to ScVals for calling a contract function.
60
60
  *
61
61
  * @param {string} name the name of the function
62
- * @param {Object} args the arguments object
62
+ * @param {object} args the arguments object
63
63
  * @returns {xdr.ScVal[]} the converted arguments
64
64
  *
65
65
  * @throws {Error} if argument is missing or incorrect type