@stellar/stellar-sdk 12.0.1 → 12.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.
@@ -49,4 +49,5 @@ export declare class Client {
49
49
  */
50
50
  static from(options: ClientOptions): Promise<Client>;
51
51
  txFromJSON: <T>(json: string) => AssembledTransaction<T>;
52
+ txFromXDR: <T>(xdrBase64: string) => AssembledTransaction<T>;
52
53
  }
@@ -38,6 +38,9 @@ var Client = exports.Client = function () {
38
38
  }
39
39
  }), tx);
40
40
  });
41
+ _defineProperty(this, "txFromXDR", function (xdrBase64) {
42
+ return _assembled_transaction.AssembledTransaction.fromXDR(_this.options, xdrBase64, _this.spec);
43
+ });
41
44
  this.spec = spec;
42
45
  this.options = options;
43
46
  this.spec.funcs().forEach(function (xdrFn) {
@@ -5,3 +5,4 @@ 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,9 +3,19 @@
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
+ });
6
15
  var _assembled_transaction = require("./assembled_transaction");
7
16
  Object.keys(_assembled_transaction).forEach(function (key) {
8
17
  if (key === "default" || key === "__esModule") return;
18
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
19
  if (key in exports && exports[key] === _assembled_transaction[key]) return;
10
20
  Object.defineProperty(exports, key, {
11
21
  enumerable: true,
@@ -17,6 +27,7 @@ Object.keys(_assembled_transaction).forEach(function (key) {
17
27
  var _basic_node_signer = require("./basic_node_signer");
18
28
  Object.keys(_basic_node_signer).forEach(function (key) {
19
29
  if (key === "default" || key === "__esModule") return;
30
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
31
  if (key in exports && exports[key] === _basic_node_signer[key]) return;
21
32
  Object.defineProperty(exports, key, {
22
33
  enumerable: true,
@@ -28,6 +39,7 @@ Object.keys(_basic_node_signer).forEach(function (key) {
28
39
  var _client = require("./client");
29
40
  Object.keys(_client).forEach(function (key) {
30
41
  if (key === "default" || key === "__esModule") return;
42
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
31
43
  if (key in exports && exports[key] === _client[key]) return;
32
44
  Object.defineProperty(exports, key, {
33
45
  enumerable: true,
@@ -39,6 +51,7 @@ Object.keys(_client).forEach(function (key) {
39
51
  var _rust_result = require("./rust_result");
40
52
  Object.keys(_rust_result).forEach(function (key) {
41
53
  if (key === "default" || key === "__esModule") return;
54
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
55
  if (key in exports && exports[key] === _rust_result[key]) return;
43
56
  Object.defineProperty(exports, key, {
44
57
  enumerable: true,
@@ -50,6 +63,7 @@ Object.keys(_rust_result).forEach(function (key) {
50
63
  var _sent_transaction = require("./sent_transaction");
51
64
  Object.keys(_sent_transaction).forEach(function (key) {
52
65
  if (key === "default" || key === "__esModule") return;
66
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
53
67
  if (key in exports && exports[key] === _sent_transaction[key]) return;
54
68
  Object.defineProperty(exports, key, {
55
69
  enumerable: true,
@@ -61,6 +75,7 @@ Object.keys(_sent_transaction).forEach(function (key) {
61
75
  var _spec = require("./spec");
62
76
  Object.keys(_spec).forEach(function (key) {
63
77
  if (key === "default" || key === "__esModule") return;
78
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
64
79
  if (key in exports && exports[key] === _spec[key]) return;
65
80
  Object.defineProperty(exports, key, {
66
81
  enumerable: true,
@@ -72,6 +87,7 @@ Object.keys(_spec).forEach(function (key) {
72
87
  var _types = require("./types");
73
88
  Object.keys(_types).forEach(function (key) {
74
89
  if (key === "default" || key === "__esModule") return;
90
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
75
91
  if (key in exports && exports[key] === _types[key]) return;
76
92
  Object.defineProperty(exports, key, {
77
93
  enumerable: true,
@@ -79,4 +95,5 @@ Object.keys(_types).forEach(function (key) {
79
95
  return _types[key];
80
96
  }
81
97
  });
82
- });
98
+ });
99
+ var _utils = require("./utils");
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- import type { ClientOptions, Tx } from "./types";
3
2
  import { Server } from "../rpc/server";
4
3
  import { Api } from "../rpc/api";
5
4
  import type { AssembledTransaction } from "./assembled_transaction";
@@ -18,10 +17,8 @@ import type { AssembledTransaction } from "./assembled_transaction";
18
17
  * `getTransactionResponse`.
19
18
  */
20
19
  export declare class SentTransaction<T> {
21
- signTransaction: ClientOptions["signTransaction"];
22
20
  assembled: AssembledTransaction<T>;
23
21
  server: Server;
24
- signed?: Tx;
25
22
  /**
26
23
  * The result of calling `sendTransaction` to broadcast the transaction to the
27
24
  * network.
@@ -71,13 +68,13 @@ export declare class SentTransaction<T> {
71
68
  stackTraceLimit: number;
72
69
  };
73
70
  };
74
- constructor(signTransaction: ClientOptions["signTransaction"], assembled: AssembledTransaction<T>);
71
+ constructor(_: any, // deprecated: used to take sentTransaction, need to wait for major release for breaking change
72
+ assembled: AssembledTransaction<T>);
75
73
  /**
76
- * Initialize a `SentTransaction` from an existing `AssembledTransaction` and
77
- * a `signTransaction` function. This will also send the transaction to the
78
- * network.
74
+ * Initialize a `SentTransaction` from `options` and a `signed`
75
+ * AssembledTransaction. This will also send the transaction to the network.
79
76
  */
80
- static init: <U>(signTransaction: ClientOptions["signTransaction"], assembled: AssembledTransaction<U>) => Promise<SentTransaction<U>>;
77
+ static init: <U>(_: any, assembled: AssembledTransaction<U>) => Promise<SentTransaction<U>>;
81
78
  private send;
82
79
  get result(): T;
83
80
  }
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SentTransaction = void 0;
7
- var _stellarBase = require("@stellar/stellar-base");
8
7
  var _server = require("../rpc/server");
9
8
  var _api = require("../rpc/api");
10
9
  var _utils = require("./utils");
@@ -30,67 +29,51 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
30
29
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
31
30
  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); }
32
31
  var SentTransaction = exports.SentTransaction = function () {
33
- function SentTransaction(signTransaction, assembled) {
32
+ function SentTransaction(_, assembled) {
34
33
  var _this = this,
35
34
  _this$assembled$optio2;
36
35
  _classCallCheck(this, SentTransaction);
37
36
  _defineProperty(this, "send", _asyncToGenerator(_regeneratorRuntime().mark(function _callee() {
38
37
  var _this$assembled$optio;
39
- var timeoutInSeconds, signature, hash;
38
+ var hash, timeoutInSeconds;
40
39
  return _regeneratorRuntime().wrap(function _callee$(_context) {
41
40
  while (1) switch (_context.prev = _context.next) {
42
41
  case 0:
43
- timeoutInSeconds = (_this$assembled$optio = _this.assembled.options.timeoutInSeconds) !== null && _this$assembled$optio !== void 0 ? _this$assembled$optio : _utils.DEFAULT_TIMEOUT;
44
- _this.assembled.built = _stellarBase.TransactionBuilder.cloneFrom(_this.assembled.built, {
45
- fee: _this.assembled.built.fee,
46
- timebounds: undefined,
47
- sorobanData: new _stellarBase.SorobanDataBuilder(_this.assembled.simulationData.transactionData.toXDR()).build()
48
- }).setTimeout(timeoutInSeconds).build();
49
- _context.next = 4;
50
- return _this.signTransaction(_this.assembled.built.toXDR(), {
51
- networkPassphrase: _this.assembled.options.networkPassphrase
52
- });
53
- case 4:
54
- signature = _context.sent;
55
- _this.signed = _stellarBase.TransactionBuilder.fromXDR(signature, _this.assembled.options.networkPassphrase);
56
- _context.next = 8;
57
- return _this.server.sendTransaction(_this.signed);
58
- case 8:
42
+ _context.next = 2;
43
+ return _this.server.sendTransaction(_this.assembled.signed);
44
+ case 2:
59
45
  _this.sendTransactionResponse = _context.sent;
60
46
  if (!(_this.sendTransactionResponse.status !== "PENDING")) {
61
- _context.next = 11;
47
+ _context.next = 5;
62
48
  break;
63
49
  }
64
50
  throw new SentTransaction.Errors.SendFailed("Sending the transaction to the network failed!\n".concat(JSON.stringify(_this.sendTransactionResponse, null, 2)));
65
- case 11:
51
+ case 5:
66
52
  hash = _this.sendTransactionResponse.hash;
67
- _context.next = 14;
53
+ timeoutInSeconds = (_this$assembled$optio = _this.assembled.options.timeoutInSeconds) !== null && _this$assembled$optio !== void 0 ? _this$assembled$optio : _utils.DEFAULT_TIMEOUT;
54
+ _context.next = 9;
68
55
  return (0, _utils.withExponentialBackoff)(function () {
69
56
  return _this.server.getTransaction(hash);
70
57
  }, function (resp) {
71
58
  return resp.status === _api.Api.GetTransactionStatus.NOT_FOUND;
72
59
  }, timeoutInSeconds);
73
- case 14:
60
+ case 9:
74
61
  _this.getTransactionResponseAll = _context.sent;
75
62
  _this.getTransactionResponse = _this.getTransactionResponseAll[_this.getTransactionResponseAll.length - 1];
76
63
  if (!(_this.getTransactionResponse.status === _api.Api.GetTransactionStatus.NOT_FOUND)) {
77
- _context.next = 18;
64
+ _context.next = 13;
78
65
  break;
79
66
  }
80
67
  throw new SentTransaction.Errors.TransactionStillPending("Waited ".concat(timeoutInSeconds, " seconds for transaction to complete, but it did not. ") + "Returning anyway. Check the transaction status manually. " + "Sent transaction: ".concat(JSON.stringify(_this.sendTransactionResponse, null, 2), "\n") + "All attempts to get the result: ".concat(JSON.stringify(_this.getTransactionResponseAll, null, 2)));
81
- case 18:
68
+ case 13:
82
69
  return _context.abrupt("return", _this);
83
- case 19:
70
+ case 14:
84
71
  case "end":
85
72
  return _context.stop();
86
73
  }
87
74
  }, _callee);
88
75
  })));
89
- this.signTransaction = signTransaction;
90
76
  this.assembled = assembled;
91
- if (!signTransaction) {
92
- throw new Error("You must provide a `signTransaction` function to send a transaction");
93
- }
94
77
  this.server = new _server.Server(this.assembled.options.rpcUrl, {
95
78
  allowHttp: (_this$assembled$optio2 = this.assembled.options.allowHttp) !== null && _this$assembled$optio2 !== void 0 ? _this$assembled$optio2 : false
96
79
  });
@@ -112,7 +95,7 @@ var SentTransaction = exports.SentTransaction = function () {
112
95
  }
113
96
  throw new SentTransaction.Errors.SendResultOnly("Transaction was sent to the network, but not yet awaited. No result to show. Await transaction completion with `getTransaction(sendTransactionResponse.hash)`");
114
97
  }
115
- throw new Error("Sending transaction failed: ".concat(JSON.stringify(this.assembled)));
98
+ throw new Error("Sending transaction failed: ".concat(JSON.stringify(this.assembled.signed)));
116
99
  }
117
100
  }]);
118
101
  }();
@@ -144,12 +127,12 @@ _defineProperty(SentTransaction, "Errors", {
144
127
  }(_wrapNativeSuper(Error))
145
128
  });
146
129
  _defineProperty(SentTransaction, "init", function () {
147
- var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(signTransaction, assembled) {
130
+ var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(_, assembled) {
148
131
  var tx, sent;
149
132
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
150
133
  while (1) switch (_context2.prev = _context2.next) {
151
134
  case 0:
152
- tx = new _SentTransaction(signTransaction, assembled);
135
+ tx = new _SentTransaction(undefined, assembled);
153
136
  _context2.next = 3;
154
137
  return tx.send();
155
138
  case 3:
@@ -94,6 +94,11 @@ export type MethodOptions = {
94
94
  * AssembledTransaction. Default: true
95
95
  */
96
96
  simulate?: boolean;
97
+ /**
98
+ * If true, will automatically attempt to restore the transaction if there
99
+ * are archived entries that need renewal. @default false
100
+ */
101
+ restore?: boolean;
97
102
  };
98
103
  export type AssembledTransactionOptions<T = string> = MethodOptions & ClientOptions & {
99
104
  method: string;
@@ -1,5 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { xdr } from "@stellar/stellar-base";
2
+ import { xdr, Account } from "@stellar/stellar-base";
3
+ import { Server } from "../rpc/server";
4
+ import { AssembledTransactionOptions } from "./types";
3
5
  /**
4
6
  * The default timeout for waiting for a transaction to be included in a block.
5
7
  */
@@ -39,3 +41,4 @@ obj: unknown): obj is {
39
41
  * Reads a binary stream of ScSpecEntries into an array for processing by ContractSpec
40
42
  */
41
43
  export declare function processSpecEntryStream(buffer: Buffer): xdr.ScSpecEntry[];
44
+ export declare function getAccount<T>(options: AssembledTransactionOptions<T>, server: Server): Promise<Account>;
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.contractErrorPattern = exports.DEFAULT_TIMEOUT = void 0;
7
+ exports.getAccount = getAccount;
7
8
  exports.implementsToString = implementsToString;
8
9
  exports.processSpecEntryStream = processSpecEntryStream;
9
10
  exports.withExponentialBackoff = withExponentialBackoff;
10
11
  var _stellarBase = require("@stellar/stellar-base");
12
+ var _assembled_transaction = require("./assembled_transaction");
11
13
  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; }
12
14
  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); }
13
15
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
@@ -102,4 +104,34 @@ function processSpecEntryStream(buffer) {
102
104
  res.push(_stellarBase.xdr.ScSpecEntry.read(reader));
103
105
  }
104
106
  return res;
107
+ }
108
+ function getAccount(_x4, _x5) {
109
+ return _getAccount.apply(this, arguments);
110
+ }
111
+ function _getAccount() {
112
+ _getAccount = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(options, server) {
113
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
114
+ while (1) switch (_context2.prev = _context2.next) {
115
+ case 0:
116
+ if (!options.publicKey) {
117
+ _context2.next = 6;
118
+ break;
119
+ }
120
+ _context2.next = 3;
121
+ return server.getAccount(options.publicKey);
122
+ case 3:
123
+ _context2.t0 = _context2.sent;
124
+ _context2.next = 7;
125
+ break;
126
+ case 6:
127
+ _context2.t0 = new _stellarBase.Account(_assembled_transaction.NULL_ACCOUNT, "0");
128
+ case 7:
129
+ return _context2.abrupt("return", _context2.t0);
130
+ case 8:
131
+ case "end":
132
+ return _context2.stop();
133
+ }
134
+ }, _callee2);
135
+ }));
136
+ return _getAccount.apply(this, arguments);
105
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar/stellar-sdk",
3
- "version": "12.0.1",
3
+ "version": "12.1.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"
@@ -49,7 +49,7 @@
49
49
  "clean": "rm -rf lib/ dist/ coverage/ .nyc_output/ jsdoc/ test/e2e/.soroban",
50
50
  "docs": "yarn build:docs && jsdoc -c ./config/.jsdoc.json --verbose",
51
51
  "test": "yarn build:test && yarn test:node && yarn test:integration && yarn test:browser",
52
- "test:e2e": "./test/e2e/initialize.sh && ava",
52
+ "test:e2e": "./test/e2e/initialize.sh && yarn _nyc mocha --recursive 'test/e2e/src/test-*.js'",
53
53
  "test:node": "yarn _nyc mocha --recursive 'test/unit/**/*.js'",
54
54
  "test:integration": "yarn _nyc mocha --recursive 'test/integration/**/*.js'",
55
55
  "test:browser": "karma start config/karma.conf.js",
@@ -75,14 +75,15 @@
75
75
  "reporter": "spec",
76
76
  "require": [
77
77
  "@babel/register",
78
- "test/test-nodejs.js"
78
+ "test/test-nodejs.js",
79
+ "dotenv/config"
79
80
  ],
80
81
  "exclude": [
81
82
  "test/test-browser.js"
82
83
  ],
83
84
  "sort": true,
84
85
  "recursive": true,
85
- "timeout": 30000
86
+ "timeout": 120000
86
87
  },
87
88
  "nyc": {
88
89
  "instrument": false,
@@ -92,11 +93,11 @@
92
93
  ]
93
94
  },
94
95
  "devDependencies": {
95
- "@babel/cli": "^7.24.6",
96
- "@babel/core": "^7.24.6",
97
- "@babel/eslint-plugin": "^7.24.6",
98
- "@babel/preset-env": "^7.24.6",
99
- "@babel/preset-typescript": "^7.24.6",
96
+ "@babel/cli": "^7.24.7",
97
+ "@babel/core": "^7.24.7",
98
+ "@babel/eslint-plugin": "^7.24.7",
99
+ "@babel/preset-env": "^7.24.7",
100
+ "@babel/preset-typescript": "^7.24.7",
100
101
  "@babel/register": "^7.24.6",
101
102
  "@definitelytyped/dtslint": "^0.2.20",
102
103
  "@istanbuljs/nyc-config-babel": "3.0.0",
@@ -105,14 +106,13 @@
105
106
  "@types/detect-node": "^2.0.0",
106
107
  "@types/eventsource": "^1.1.12",
107
108
  "@types/json-schema": "^7.0.15",
108
- "@types/lodash": "^4.17.4",
109
+ "@types/lodash": "^4.17.5",
109
110
  "@types/mocha": "^10.0.2",
110
- "@types/node": "^20.12.13",
111
+ "@types/node": "^20.14.2",
111
112
  "@types/randombytes": "^2.0.1",
112
113
  "@types/sinon": "^17.0.2",
113
114
  "@types/urijs": "^1.19.20",
114
- "@typescript-eslint/parser": "^7.11.0",
115
- "ava": "^5.3.1",
115
+ "@typescript-eslint/parser": "^7.13.0",
116
116
  "axios-mock-adapter": "^1.22.0",
117
117
  "babel-loader": "^9.1.3",
118
118
  "babel-plugin-istanbul": "^6.1.1",
@@ -127,7 +127,7 @@
127
127
  "eslint-config-airbnb-typescript": "^18.0.0",
128
128
  "eslint-config-prettier": "^9.0.0",
129
129
  "eslint-plugin-import": "^2.29.1",
130
- "eslint-plugin-jsdoc": "^48.2.7",
130
+ "eslint-plugin-jsdoc": "^48.2.12",
131
131
  "eslint-plugin-node": "^11.1.0",
132
132
  "eslint-plugin-prefer-import": "^0.0.1",
133
133
  "eslint-plugin-prettier": "^5.1.2",
@@ -144,13 +144,13 @@
144
144
  "karma-mocha": "^2.0.0",
145
145
  "karma-sinon-chai": "^2.0.2",
146
146
  "karma-webpack": "^5.0.1",
147
- "lint-staged": "^15.2.5",
147
+ "lint-staged": "^15.2.7",
148
148
  "lodash": "^4.17.21",
149
149
  "minami": "^1.1.1",
150
150
  "mocha": "^10.3.0",
151
151
  "node-polyfill-webpack-plugin": "^3.0.0",
152
152
  "nyc": "^15.1.0",
153
- "prettier": "^3.2.5",
153
+ "prettier": "^3.3.2",
154
154
  "randombytes": "^2.1.0",
155
155
  "sinon": "^17.0.1",
156
156
  "sinon-chai": "^3.7.0",
@@ -158,25 +158,16 @@
158
158
  "terser-webpack-plugin": "^5.3.10",
159
159
  "ts-node": "^10.9.2",
160
160
  "typescript": "^5.4.3",
161
- "webpack": "^5.91.0",
161
+ "webpack": "^5.92.0",
162
162
  "webpack-cli": "^5.0.1"
163
163
  },
164
164
  "dependencies": {
165
- "@stellar/stellar-base": "^12.0.0",
165
+ "@stellar/stellar-base": "^12.0.1",
166
166
  "axios": "^1.7.2",
167
167
  "bignumber.js": "^9.1.2",
168
168
  "eventsource": "^2.0.2",
169
169
  "randombytes": "^2.1.0",
170
170
  "toml": "^3.0.0",
171
171
  "urijs": "^1.19.1"
172
- },
173
- "ava": {
174
- "files": [
175
- "./test/e2e/src/test-*"
176
- ],
177
- "require": [
178
- "dotenv/config"
179
- ],
180
- "timeout": "2m"
181
172
  }
182
173
  }