@stellar/stellar-sdk 11.3.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +292 -53
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/contract_client/assembled_transaction.d.ts +19 -19
  6. package/lib/contract_client/assembled_transaction.js +19 -8
  7. package/lib/contract_client/client.d.ts +3 -3
  8. package/lib/contract_client/client.js +21 -53
  9. package/lib/contract_client/sent_transaction.d.ts +4 -5
  10. package/lib/contract_client/sent_transaction.js +4 -3
  11. package/lib/contract_client/types.d.ts +1 -1
  12. package/lib/contract_client/types.js +3 -1
  13. package/lib/contract_spec.js +2 -2
  14. package/lib/horizon/account_call_builder.d.ts +0 -1
  15. package/lib/horizon/assets_call_builder.d.ts +0 -1
  16. package/lib/horizon/claimable_balances_call_builder.d.ts +0 -1
  17. package/lib/horizon/effect_call_builder.d.ts +0 -1
  18. package/lib/horizon/friendbot_builder.d.ts +0 -1
  19. package/lib/horizon/horizon_api.d.ts +0 -1
  20. package/lib/horizon/ledger_call_builder.d.ts +0 -1
  21. package/lib/horizon/liquidity_pool_call_builder.d.ts +0 -1
  22. package/lib/horizon/offer_call_builder.d.ts +0 -1
  23. package/lib/horizon/operation_call_builder.d.ts +0 -1
  24. package/lib/horizon/orderbook_call_builder.d.ts +0 -1
  25. package/lib/horizon/path_call_builder.d.ts +0 -1
  26. package/lib/horizon/payment_call_builder.d.ts +0 -1
  27. package/lib/horizon/strict_receive_path_call_builder.d.ts +0 -1
  28. package/lib/horizon/strict_send_path_call_builder.d.ts +0 -1
  29. package/lib/horizon/trade_aggregation_call_builder.d.ts +0 -1
  30. package/lib/horizon/trades_call_builder.d.ts +0 -1
  31. package/lib/horizon/transaction_call_builder.d.ts +0 -1
  32. package/lib/index.d.ts +0 -1
  33. package/lib/soroban/api.d.ts +1 -0
  34. package/lib/soroban/index.d.ts +0 -1
  35. package/package.json +4 -5
@@ -1,7 +1,7 @@
1
- /// <reference types="node" />
2
1
  import type { AssembledTransactionOptions, ContractClientOptions, Tx, XDR_BASE64 } from "./types";
3
2
  import { SorobanRpc, TransactionBuilder, xdr } from "..";
4
3
  import { SentTransaction } from "./sent_transaction";
4
+ export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
5
5
  /**
6
6
  * The main workhorse of {@link ContractClient}. This class is used to wrap a
7
7
  * transaction-under-construction and provide high-level interfaces to the most
@@ -256,72 +256,72 @@ export declare class AssembledTransaction<T> {
256
256
  */
257
257
  static Errors: {
258
258
  ExpiredState: {
259
- new (message?: string | undefined): {
259
+ new (message?: string): {
260
260
  name: string;
261
261
  message: string;
262
262
  stack?: string | undefined;
263
263
  };
264
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
264
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
265
265
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
266
266
  stackTraceLimit: number;
267
267
  };
268
268
  NeedsMoreSignatures: {
269
- new (message?: string | undefined): {
269
+ new (message?: string): {
270
270
  name: string;
271
271
  message: string;
272
272
  stack?: string | undefined;
273
273
  };
274
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
274
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
275
275
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
276
276
  stackTraceLimit: number;
277
277
  };
278
278
  NoSignatureNeeded: {
279
- new (message?: string | undefined): {
279
+ new (message?: string): {
280
280
  name: string;
281
281
  message: string;
282
282
  stack?: string | undefined;
283
283
  };
284
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
284
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
285
285
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
286
286
  stackTraceLimit: number;
287
287
  };
288
288
  NoUnsignedNonInvokerAuthEntries: {
289
- new (message?: string | undefined): {
289
+ new (message?: string): {
290
290
  name: string;
291
291
  message: string;
292
292
  stack?: string | undefined;
293
293
  };
294
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
294
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
295
295
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
296
296
  stackTraceLimit: number;
297
297
  };
298
298
  NoSigner: {
299
- new (message?: string | undefined): {
299
+ new (message?: string): {
300
300
  name: string;
301
301
  message: string;
302
302
  stack?: string | undefined;
303
303
  };
304
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
304
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
305
305
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
306
306
  stackTraceLimit: number;
307
307
  };
308
308
  NotYetSimulated: {
309
- new (message?: string | undefined): {
309
+ new (message?: string): {
310
310
  name: string;
311
311
  message: string;
312
312
  stack?: string | undefined;
313
313
  };
314
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
314
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
315
315
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
316
316
  stackTraceLimit: number;
317
317
  };
318
318
  FakeAccount: {
319
- new (message?: string | undefined): {
319
+ new (message?: string): {
320
320
  name: string;
321
321
  message: string;
322
322
  stack?: string | undefined;
323
323
  };
324
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
324
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
325
325
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
326
326
  stackTraceLimit: number;
327
327
  };
@@ -379,7 +379,7 @@ export declare class AssembledTransaction<T> {
379
379
  /**
380
380
  * If `true`, sign and send the transaction even if it is a read call.
381
381
  */
382
- force?: boolean | undefined;
382
+ force?: boolean;
383
383
  /**
384
384
  * You must provide this here if you did not provide one before
385
385
  */
@@ -409,7 +409,7 @@ export declare class AssembledTransaction<T> {
409
409
  /**
410
410
  * Whether or not to include auth entries that have already been signed. Default: false
411
411
  */
412
- includeAlreadySigned?: boolean | undefined;
412
+ includeAlreadySigned?: boolean;
413
413
  }) => Promise<string[]>;
414
414
  /**
415
415
  * If {@link needsNonInvokerSigningBy} returns a non-empty list, you can serialize
@@ -433,12 +433,12 @@ export declare class AssembledTransaction<T> {
433
433
  * contract's current `persistent` storage expiration date/ledger
434
434
  * number/block.
435
435
  */
436
- expiration?: number | Promise<number> | undefined;
436
+ expiration?: number | Promise<number>;
437
437
  /**
438
438
  * Sign all auth entries for this account. Default: the account that
439
439
  * constructed the transaction
440
440
  */
441
- publicKey?: string | undefined;
441
+ publicKey?: string;
442
442
  /**
443
443
  * You must provide this here if you did not provide one before. Default:
444
444
  * the `signAuthEntry` function from the `ContractClient` options. Must
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.AssembledTransaction = void 0;
6
+ exports.NULL_ACCOUNT = exports.AssembledTransaction = void 0;
7
7
  var _ = require("..");
8
8
  var _rust_types = require("../rust_types");
9
9
  var _utils = require("./utils");
@@ -39,6 +39,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
39
39
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
40
40
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
41
41
  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); }
42
+ var NULL_ACCOUNT = exports.NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
42
43
  var AssembledTransaction = exports.AssembledTransaction = function () {
43
44
  function AssembledTransaction(options) {
44
45
  var _this = this,
@@ -413,23 +414,33 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
413
414
  case 0:
414
415
  tx = new AssembledTransaction(options);
415
416
  contract = new _.Contract(options.contractId);
416
- _context7.next = 4;
417
+ if (!options.publicKey) {
418
+ _context7.next = 8;
419
+ break;
420
+ }
421
+ _context7.next = 5;
417
422
  return tx.server.getAccount(options.publicKey);
418
- case 4:
419
- account = _context7.sent;
423
+ case 5:
424
+ _context7.t0 = _context7.sent;
425
+ _context7.next = 9;
426
+ break;
427
+ case 8:
428
+ _context7.t0 = new _.Account(NULL_ACCOUNT, "0");
429
+ case 9:
430
+ account = _context7.t0;
420
431
  tx.raw = new _.TransactionBuilder(account, {
421
432
  fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : _.BASE_FEE,
422
433
  networkPassphrase: options.networkPassphrase
423
434
  }).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);
424
435
  if (!options.simulate) {
425
- _context7.next = 9;
436
+ _context7.next = 14;
426
437
  break;
427
438
  }
428
- _context7.next = 9;
439
+ _context7.next = 14;
429
440
  return tx.simulate();
430
- case 9:
441
+ case 14:
431
442
  return _context7.abrupt("return", tx);
432
- case 10:
443
+ case 15:
433
444
  case "end":
434
445
  return _context7.stop();
435
446
  }
@@ -1,6 +1,6 @@
1
- import { ContractSpec } from '..';
2
- import { AssembledTransaction } from './assembled_transaction';
3
- import type { ContractClientOptions } from './types';
1
+ import { ContractSpec } from "..";
2
+ import { AssembledTransaction } from "./assembled_transaction";
3
+ import type { ContractClientOptions } from "./types";
4
4
  export declare class ContractClient {
5
5
  readonly spec: ContractSpec;
6
6
  readonly options: ContractClientOptions;
@@ -7,16 +7,10 @@ exports.ContractClient = void 0;
7
7
  var _assembled_transaction = require("./assembled_transaction");
8
8
  var _excluded = ["method"];
9
9
  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); }
10
- function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
11
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
14
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
16
10
  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
11
  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
12
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
13
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
20
14
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
21
15
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -39,51 +33,25 @@ var ContractClient = exports.ContractClient = _createClass(function ContractClie
39
33
  });
40
34
  this.spec = spec;
41
35
  this.options = options;
42
- var methods = this.spec.funcs();
43
- var _iterator = _createForOfIteratorHelper(methods),
44
- _step;
45
- try {
46
- var _loop = function _loop() {
47
- var method = _step.value;
48
- var name = method.name().toString();
49
- _this[name] = function () {
50
- var _ref = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(args, options) {
51
- return _regeneratorRuntime().wrap(function _callee$(_context) {
52
- while (1) switch (_context.prev = _context.next) {
53
- case 0:
54
- _context.next = 2;
55
- return _assembled_transaction.AssembledTransaction.build(_objectSpread(_objectSpread(_objectSpread({
56
- method: name,
57
- args: spec.funcArgsToScVals(name, args)
58
- }, options), _this.options), {}, {
59
- errorTypes: spec.errorCases().reduce(function (acc, curr) {
60
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, curr.value(), {
61
- message: curr.doc().toString()
62
- }));
63
- }, {}),
64
- parseResultXdr: function parseResultXdr(result) {
65
- return spec.funcResToNative(name, result);
66
- }
67
- }));
68
- case 2:
69
- return _context.abrupt("return", _context.sent);
70
- case 3:
71
- case "end":
72
- return _context.stop();
73
- }
74
- }, _callee);
75
- }));
76
- return function (_x, _x2) {
77
- return _ref.apply(this, arguments);
78
- };
79
- }();
36
+ this.spec.funcs().forEach(function (xdrFn) {
37
+ var method = xdrFn.name().toString();
38
+ var assembleTransaction = function assembleTransaction(args, methodOptions) {
39
+ return _assembled_transaction.AssembledTransaction.build(_objectSpread(_objectSpread(_objectSpread({
40
+ method: method,
41
+ args: args && spec.funcArgsToScVals(method, args)
42
+ }, options), methodOptions), {}, {
43
+ errorTypes: spec.errorCases().reduce(function (acc, curr) {
44
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, curr.value(), {
45
+ message: curr.doc().toString()
46
+ }));
47
+ }, {}),
48
+ parseResultXdr: function parseResultXdr(result) {
49
+ return spec.funcResToNative(method, result);
50
+ }
51
+ }));
80
52
  };
81
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
82
- _loop();
83
- }
84
- } catch (err) {
85
- _iterator.e(err);
86
- } finally {
87
- _iterator.f();
88
- }
53
+ _this[method] = spec.getFunc(method).inputs().length === 0 ? function (opts) {
54
+ return assembleTransaction(undefined, opts);
55
+ } : assembleTransaction;
56
+ });
89
57
  });
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ContractClientOptions, Tx } from "./types";
3
2
  import { SorobanRpc } from "..";
4
3
  import { AssembledTransaction } from "./assembled_transaction";
@@ -40,22 +39,22 @@ export declare class SentTransaction<T> {
40
39
  getTransactionResponse?: SorobanRpc.Api.GetTransactionResponse;
41
40
  static Errors: {
42
41
  SendFailed: {
43
- new (message?: string | undefined): {
42
+ new (message?: string): {
44
43
  name: string;
45
44
  message: string;
46
45
  stack?: string | undefined;
47
46
  };
48
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
47
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
49
48
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
50
49
  stackTraceLimit: number;
51
50
  };
52
51
  SendResultOnly: {
53
- new (message?: string | undefined): {
52
+ new (message?: string): {
54
53
  name: string;
55
54
  message: string;
56
55
  stack?: string | undefined;
57
56
  };
58
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
57
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
59
58
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
60
59
  stackTraceLimit: number;
61
60
  };
@@ -29,7 +29,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
29
29
  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); }
30
30
  var SentTransaction = exports.SentTransaction = function () {
31
31
  function SentTransaction(signTransaction, assembled) {
32
- var _this = this;
32
+ var _this = this,
33
+ _this$assembled$optio2;
33
34
  _classCallCheck(this, SentTransaction);
34
35
  _defineProperty(this, "send", _asyncToGenerator(_regeneratorRuntime().mark(function _callee() {
35
36
  var _this$assembled$optio;
@@ -53,7 +54,7 @@ var SentTransaction = exports.SentTransaction = function () {
53
54
  _context.next = 10;
54
55
  break;
55
56
  }
56
- throw new SentTransaction.Errors.SendFailed('Sending the transaction to the network failed!\n' + JSON.stringify(_this.sendTransactionResponse, null, 2));
57
+ throw new SentTransaction.Errors.SendFailed("Sending the transaction to the network failed!\n" + JSON.stringify(_this.sendTransactionResponse, null, 2));
57
58
  case 10:
58
59
  hash = _this.sendTransactionResponse.hash;
59
60
  _context.next = 13;
@@ -81,7 +82,7 @@ var SentTransaction = exports.SentTransaction = function () {
81
82
  throw new Error("You must provide a `signTransaction` function to send a transaction");
82
83
  }
83
84
  this.server = new _.SorobanRpc.Server(this.assembled.options.rpcUrl, {
84
- allowHttp: this.assembled.options.rpcUrl.startsWith("http://")
85
+ allowHttp: (_this$assembled$optio2 = this.assembled.options.allowHttp) !== null && _this$assembled$optio2 !== void 0 ? _this$assembled$optio2 : false
85
86
  });
86
87
  }
87
88
  return _createClass(SentTransaction, [{
@@ -22,7 +22,7 @@ export type ContractClientOptions = {
22
22
  * {@link AssembledTransaction#signAndSend} and
23
23
  * {@link AssembledTransaction#signAuthEntries}.
24
24
  */
25
- publicKey: string;
25
+ publicKey?: string;
26
26
  /**
27
27
  * A function to sign the transaction using the private key corresponding to
28
28
  * the given `publicKey`. You do not need to provide this, for read-only
@@ -1,3 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _ = require("..");
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -224,10 +224,10 @@ var ContractSpec = exports.ContractSpec = function () {
224
224
  var _res$value = _slicedToArray(res.value, 2),
225
225
  k = _res$value[0],
226
226
  v = _res$value[1];
227
- var _key = this.nativeToScVal(k, scMap.keyType());
227
+ var key = this.nativeToScVal(k, scMap.keyType());
228
228
  var _val = this.nativeToScVal(v, scMap.valueType());
229
229
  entries.push(new _2.xdr.ScMapEntry({
230
- key: _key,
230
+ key: key,
231
231
  val: _val
232
232
  }));
233
233
  res = values.next();
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { CallBuilder } from "./call_builder";
3
2
  import { ServerApi } from "./server_api";
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { CallBuilder } from "./call_builder";
3
2
  import { ServerApi } from "./server_api";
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { CallBuilder } from "./call_builder";
3
2
  export declare class FriendbotBuilder extends CallBuilder<any> {
4
3
  constructor(serverUrl: URI, address: string);
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { AssetType, MemoType } from "@stellar/stellar-base";
3
2
  export declare namespace HorizonApi {
4
3
  interface ResponseLink {
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { CallBuilder } from "./call_builder";
3
2
  import { ServerApi } from "./server_api";
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { CallBuilder } from "./call_builder";
3
2
  import { ServerApi } from "./server_api";
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { CallBuilder } from "./call_builder";
3
2
  import { ServerApi } from "./server_api";
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { HorizonApi } from "./horizon_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { Asset } from "@stellar/stellar-base";
3
2
  import { CallBuilder } from "./call_builder";
4
3
  import { ServerApi } from "./server_api";
@@ -1,4 +1,3 @@
1
- /// <reference types="urijs" />
2
1
  import { CallBuilder } from "./call_builder";
3
2
  import { ServerApi } from "./server_api";
4
3
  /**
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference path="../types/dom-monkeypatch.d.ts" />
2
1
  export * from './errors';
3
2
  export { Config } from './config';
4
3
  export { Utils } from './utils';
@@ -132,6 +132,7 @@ export declare namespace Api {
132
132
  ledgerClosedAt: string;
133
133
  pagingToken: string;
134
134
  inSuccessfulContractCall: boolean;
135
+ txHash: string;
135
136
  }
136
137
  export interface RawEventResponse extends BaseEventResponse {
137
138
  contractId: string;
@@ -1,4 +1,3 @@
1
- /// <reference path="../../types/dom-monkeypatch.d.ts" />
2
1
  export * from './api';
3
2
  export { Server, Durability } from './server';
4
3
  export { default as AxiosClient } from './axios';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar/stellar-sdk",
3
- "version": "11.3.0",
3
+ "version": "12.0.0",
4
4
  "description": "A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.",
5
5
  "keywords": [
6
6
  "stellar"
@@ -79,12 +79,11 @@
79
79
  "devDependencies": {
80
80
  "@babel/cli": "^7.24.1",
81
81
  "@babel/core": "^7.24.3",
82
- "@babel/eslint-parser": "^7.24.1",
83
82
  "@babel/eslint-plugin": "^7.22.10",
84
83
  "@babel/preset-env": "^7.24.3",
85
84
  "@babel/preset-typescript": "^7.24.1",
86
85
  "@babel/register": "^7.23.7",
87
- "@definitelytyped/dtslint": "^0.1.2",
86
+ "@definitelytyped/dtslint": "^0.2.20",
88
87
  "@istanbuljs/nyc-config-babel": "3.0.0",
89
88
  "@stellar/tsconfig": "^1.0.2",
90
89
  "@types/chai": "^4.3.14",
@@ -97,7 +96,7 @@
97
96
  "@types/randombytes": "^2.0.1",
98
97
  "@types/sinon": "^17.0.2",
99
98
  "@types/urijs": "^1.19.20",
100
- "@typescript-eslint/parser": "^6.20.0",
99
+ "@typescript-eslint/parser": "^7.7.1",
101
100
  "ava": "^5.3.1",
102
101
  "axios-mock-adapter": "^1.22.0",
103
102
  "babel-loader": "^9.1.3",
@@ -117,7 +116,7 @@
117
116
  "eslint-plugin-prettier": "^5.1.2",
118
117
  "eslint-webpack-plugin": "^4.1.0",
119
118
  "ghooks": "^2.0.4",
120
- "husky": "^8.0.3",
119
+ "husky": "^9.0.11",
121
120
  "jsdoc": "^4.0.2",
122
121
  "json-schema-faker": "^0.5.6",
123
122
  "karma": "^6.4.3",