@stellar/stellar-sdk 13.1.0 → 13.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 (58) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/stellar-sdk-minimal.js +43664 -43566
  3. package/dist/stellar-sdk-minimal.min.js +1 -1
  4. package/dist/stellar-sdk-no-axios.js +52647 -52298
  5. package/dist/stellar-sdk-no-axios.min.js +1 -1
  6. package/dist/stellar-sdk-no-eventsource.js +47143 -47057
  7. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  8. package/dist/stellar-sdk.js +55999 -55662
  9. package/dist/stellar-sdk.min.js +1 -1
  10. package/lib/contract/assembled_transaction.js +3 -5
  11. package/lib/contract/client.d.ts +2 -0
  12. package/lib/contract/client.js +72 -11
  13. package/lib/contract/sent_transaction.d.ts +3 -1
  14. package/lib/contract/spec.js +2 -5
  15. package/lib/horizon/horizon_api.d.ts +2 -0
  16. package/lib/horizon/horizon_axios_client.js +1 -1
  17. package/lib/horizon/payment_call_builder.d.ts +8 -0
  18. package/lib/horizon/payment_call_builder.js +6 -0
  19. package/lib/minimal/contract/assembled_transaction.js +3 -5
  20. package/lib/minimal/contract/client.d.ts +2 -0
  21. package/lib/minimal/contract/client.js +72 -11
  22. package/lib/minimal/contract/sent_transaction.d.ts +3 -1
  23. package/lib/minimal/contract/spec.js +2 -5
  24. package/lib/minimal/horizon/horizon_api.d.ts +2 -0
  25. package/lib/minimal/horizon/horizon_axios_client.js +1 -1
  26. package/lib/minimal/horizon/payment_call_builder.d.ts +8 -0
  27. package/lib/minimal/horizon/payment_call_builder.js +6 -0
  28. package/lib/minimal/rpc/api.d.ts +1 -1
  29. package/lib/minimal/rpc/axios.js +1 -1
  30. package/lib/minimal/rpc/server.js +1 -1
  31. package/lib/no-axios/contract/assembled_transaction.js +3 -5
  32. package/lib/no-axios/contract/client.d.ts +2 -0
  33. package/lib/no-axios/contract/client.js +72 -11
  34. package/lib/no-axios/contract/sent_transaction.d.ts +3 -1
  35. package/lib/no-axios/contract/spec.js +2 -5
  36. package/lib/no-axios/horizon/horizon_api.d.ts +2 -0
  37. package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
  38. package/lib/no-axios/horizon/payment_call_builder.d.ts +8 -0
  39. package/lib/no-axios/horizon/payment_call_builder.js +6 -0
  40. package/lib/no-axios/rpc/api.d.ts +1 -1
  41. package/lib/no-axios/rpc/axios.js +1 -1
  42. package/lib/no-axios/rpc/server.js +1 -1
  43. package/lib/no-eventsource/contract/assembled_transaction.js +3 -5
  44. package/lib/no-eventsource/contract/client.d.ts +2 -0
  45. package/lib/no-eventsource/contract/client.js +72 -11
  46. package/lib/no-eventsource/contract/sent_transaction.d.ts +3 -1
  47. package/lib/no-eventsource/contract/spec.js +2 -5
  48. package/lib/no-eventsource/horizon/horizon_api.d.ts +2 -0
  49. package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
  50. package/lib/no-eventsource/horizon/payment_call_builder.d.ts +8 -0
  51. package/lib/no-eventsource/horizon/payment_call_builder.js +6 -0
  52. package/lib/no-eventsource/rpc/api.d.ts +1 -1
  53. package/lib/no-eventsource/rpc/axios.js +1 -1
  54. package/lib/no-eventsource/rpc/server.js +1 -1
  55. package/lib/rpc/api.d.ts +1 -1
  56. package/lib/rpc/axios.js +1 -1
  57. package/lib/rpc/server.js +1 -1
  58. package/package.json +24 -20
@@ -52,7 +52,6 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
52
52
  _this$options$allowHt;
53
53
  _classCallCheck(this, AssembledTransaction);
54
54
  _defineProperty(this, "simulate", _asyncToGenerator(_regeneratorRuntime().mark(function _callee() {
55
- var _restore;
56
55
  var _ref2,
57
56
  restore,
58
57
  account,
@@ -78,7 +77,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
78
77
  case 4:
79
78
  _this.built = _this.raw.build();
80
79
  case 5:
81
- restore = (_restore = restore) !== null && _restore !== void 0 ? _restore : _this.options.restore;
80
+ restore = restore !== null && restore !== void 0 ? restore : _this.options.restore;
82
81
  delete _this.simulationResult;
83
82
  delete _this.simulationTransactionData;
84
83
  _context.next = 10;
@@ -564,7 +563,6 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
564
563
  key: "restoreFootprint",
565
564
  value: (function () {
566
565
  var _restoreFootprint = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(restorePreamble, account) {
567
- var _account;
568
566
  var restoreTx, sentTransaction;
569
567
  return _regeneratorRuntime().wrap(function _callee8$(_context9) {
570
568
  while (1) switch (_context9.prev = _context9.next) {
@@ -575,11 +573,11 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
575
573
  }
576
574
  throw new Error("For automatic restore to work you must provide a signTransaction function when initializing your Client");
577
575
  case 2:
578
- if (!((_account = account) !== null && _account !== void 0)) {
576
+ if (!(account !== null && account !== void 0)) {
579
577
  _context9.next = 6;
580
578
  break;
581
579
  }
582
- _context9.t0 = _account;
580
+ _context9.t0 = account;
583
581
  _context9.next = 9;
584
582
  break;
585
583
  case 6:
@@ -29,6 +29,8 @@ export declare class Client {
29
29
  salt?: Buffer | Uint8Array;
30
30
  /** The format used to decode `wasmHash`, if it's provided as a string. */
31
31
  format?: "hex" | "base64";
32
+ /** The address to use to deploy the custom contract */
33
+ address?: string;
32
34
  }): Promise<AssembledTransaction<T>>;
33
35
  constructor(spec: Spec, options: ClientOptions);
34
36
  /**
@@ -15,14 +15,20 @@ var _excluded = ["method"],
15
15
  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; }
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 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; }
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], -1 === t.indexOf(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 (-1 !== e.indexOf(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; }
23
23
  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; }
24
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
25
25
  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); }
26
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
27
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
28
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
29
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
30
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
31
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
26
32
  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); }
27
33
  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); }); }; }
28
34
  var CONSTRUCTOR_FUNC = "__constructor";
@@ -31,33 +37,88 @@ function specFromWasm(_x) {
31
37
  }
32
38
  function _specFromWasm() {
33
39
  _specFromWasm = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5(wasm) {
34
- var wasmModule, xdrSections, bufferSection, specEntryArray, spec;
40
+ var xdrSections, wasmModule, customData, bufferSection, specEntryArray, spec;
35
41
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
36
42
  while (1) switch (_context5.prev = _context5.next) {
37
43
  case 0:
38
- _context5.next = 2;
44
+ _context5.prev = 0;
45
+ _context5.next = 3;
39
46
  return WebAssembly.compile(wasm);
40
- case 2:
47
+ case 3:
41
48
  wasmModule = _context5.sent;
42
49
  xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
43
- if (!(xdrSections.length === 0)) {
44
- _context5.next = 6;
50
+ _context5.next = 11;
51
+ break;
52
+ case 7:
53
+ _context5.prev = 7;
54
+ _context5.t0 = _context5["catch"](0);
55
+ customData = parseWasmCustomSections(wasm);
56
+ xdrSections = customData.get('contractspecv0');
57
+ case 11:
58
+ if (!(!xdrSections || xdrSections.length === 0)) {
59
+ _context5.next = 13;
45
60
  break;
46
61
  }
47
62
  throw new Error("Could not obtain contract spec from wasm");
48
- case 6:
63
+ case 13:
49
64
  bufferSection = Buffer.from(xdrSections[0]);
50
65
  specEntryArray = (0, _utils.processSpecEntryStream)(bufferSection);
51
66
  spec = new _spec.Spec(specEntryArray);
52
67
  return _context5.abrupt("return", spec);
53
- case 10:
68
+ case 17:
54
69
  case "end":
55
70
  return _context5.stop();
56
71
  }
57
- }, _callee5);
72
+ }, _callee5, null, [[0, 7]]);
58
73
  }));
59
74
  return _specFromWasm.apply(this, arguments);
60
75
  }
76
+ function parseWasmCustomSections(buffer) {
77
+ var sections = new Map();
78
+ var arrayBuffer = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
79
+ var offset = 0;
80
+ var read = function read(length) {
81
+ if (offset + length > buffer.byteLength) throw new Error('Buffer overflow');
82
+ var bytes = new Uint8Array(arrayBuffer, offset, length);
83
+ offset += length;
84
+ return bytes;
85
+ };
86
+ if (_toConsumableArray(read(4)).join() !== '0,97,115,109') throw new Error('Invalid WASM magic');
87
+ if (_toConsumableArray(read(4)).join() !== '1,0,0,0') throw new Error('Invalid WASM version');
88
+ while (offset < buffer.byteLength) {
89
+ var sectionId = read(1)[0];
90
+ var sectionLength = readVarUint32();
91
+ var start = offset;
92
+ if (sectionId === 0) {
93
+ var nameLen = readVarUint32();
94
+ if (nameLen === 0 || offset + nameLen > start + sectionLength) continue;
95
+ var nameBytes = read(nameLen);
96
+ var payload = read(sectionLength - (offset - start));
97
+ try {
98
+ var name = new TextDecoder('utf-8', {
99
+ fatal: true
100
+ }).decode(nameBytes);
101
+ if (payload.length > 0) {
102
+ sections.set(name, (sections.get(name) || []).concat(payload));
103
+ }
104
+ } catch (_unused) {}
105
+ } else {
106
+ offset += sectionLength;
107
+ }
108
+ }
109
+ function readVarUint32() {
110
+ var value = 0,
111
+ shift = 0;
112
+ while (true) {
113
+ var byte = read(1)[0];
114
+ value |= (byte & 0x7F) << shift;
115
+ if ((byte & 0x80) === 0) break;
116
+ if ((shift += 7) >= 32) throw new Error('Invalid WASM value');
117
+ }
118
+ return value >>> 0;
119
+ }
120
+ return sections;
121
+ }
61
122
  function specFromWasmHash(_x2, _x3) {
62
123
  return _specFromWasmHash.apply(this, arguments);
63
124
  }
@@ -157,7 +218,7 @@ var Client = exports.Client = function () {
157
218
  case 3:
158
219
  spec = _context.sent;
159
220
  operation = _stellarBase.Operation.createCustomContract({
160
- address: new _stellarBase.Address(options.publicKey),
221
+ address: new _stellarBase.Address(options.address || options.publicKey),
161
222
  wasmHash: typeof wasmHash === "string" ? Buffer.from(wasmHash, format !== null && format !== void 0 ? format : "hex") : wasmHash,
162
223
  salt: salt,
163
224
  constructorArgs: args ? spec.funcArgsToScVals(CONSTRUCTOR_FUNC, args) : []
@@ -78,7 +78,9 @@ export declare class SentTransaction<T> {
78
78
  * Initialize a `SentTransaction` from `options` and a `signed`
79
79
  * AssembledTransaction. This will also send the transaction to the network.
80
80
  */
81
- static init: <U>(assembled: AssembledTransaction<U>) => Promise<SentTransaction<U>>;
81
+ static init: <U>(
82
+ /** {@link AssembledTransaction} from which this SentTransaction was initialized */
83
+ assembled: AssembledTransaction<U>) => Promise<SentTransaction<U>>;
82
84
  private send;
83
85
  get result(): T;
84
86
  }
@@ -83,10 +83,7 @@ function stringToScVal(str, ty) {
83
83
  case _stellarBase.xdr.ScSpecType.scSpecTypeSymbol().value:
84
84
  return _stellarBase.xdr.ScVal.scvSymbol(str);
85
85
  case _stellarBase.xdr.ScSpecType.scSpecTypeAddress().value:
86
- {
87
- var addr = _stellarBase.Address.fromString(str);
88
- return _stellarBase.xdr.ScVal.scvAddress(addr.toScAddress());
89
- }
86
+ return _stellarBase.Address.fromString(str).toScVal();
90
87
  case _stellarBase.xdr.ScSpecType.scSpecTypeU64().value:
91
88
  return new _stellarBase.XdrLargeInt("u64", str).toScVal();
92
89
  case _stellarBase.xdr.ScSpecType.scSpecTypeI64().value:
@@ -164,7 +161,7 @@ var PRIMITIVE_DEFINITONS = {
164
161
  },
165
162
  ScSymbol: {
166
163
  type: "string",
167
- description: "ScString is a string"
164
+ description: "ScSymbol is a string"
168
165
  },
169
166
  DataUrl: {
170
167
  type: "string",
@@ -236,6 +236,8 @@ export declare namespace HorizonApi {
236
236
  asset_code?: string;
237
237
  asset_issuer?: string;
238
238
  amount: string;
239
+ to_muxed?: string;
240
+ to_muxed_id?: string;
239
241
  }
240
242
  interface PathPaymentOperationResponse extends BaseOperationResponse<OperationResponseType.pathPayment, OperationResponseTypeI.pathPayment> {
241
243
  amount: string;
@@ -10,7 +10,7 @@ var _urijs = _interopRequireDefault(require("urijs"));
10
10
  var _httpClient = require("../http-client");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  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
- var version = exports.version = "13.1.0";
13
+ var version = exports.version = "13.3.0";
14
14
  var SERVER_TIME_MAP = exports.SERVER_TIME_MAP = {};
15
15
  var AxiosClient = exports.AxiosClient = (0, _httpClient.create)({
16
16
  headers: {
@@ -36,4 +36,12 @@ export declare class PaymentCallBuilder extends CallBuilder<ServerApi.Collection
36
36
  * @returns {PaymentCallBuilder} this PaymentCallBuilder instance
37
37
  */
38
38
  forTransaction(transactionId: string): this;
39
+ /**
40
+ * Adds a parameter defining whether to include failed transactions.
41
+ * By default, only operations of successful transactions are returned.
42
+ *
43
+ * @param {boolean} value Set to `true` to include operations of failed transactions.
44
+ * @returns {PaymentCallBuilder} this PaymentCallBuilder instance
45
+ */
46
+ includeFailed(value: boolean): this;
39
47
  }
@@ -42,5 +42,11 @@ var PaymentCallBuilder = exports.PaymentCallBuilder = function (_CallBuilder) {
42
42
  value: function forTransaction(transactionId) {
43
43
  return this.forEndpoint("transactions", transactionId);
44
44
  }
45
+ }, {
46
+ key: "includeFailed",
47
+ value: function includeFailed(value) {
48
+ this.url.setQuery("include_failed", value.toString());
49
+ return this;
50
+ }
45
51
  }]);
46
52
  }(_call_builder.CallBuilder);
@@ -52,7 +52,6 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
52
52
  _this$options$allowHt;
53
53
  _classCallCheck(this, AssembledTransaction);
54
54
  _defineProperty(this, "simulate", _asyncToGenerator(_regeneratorRuntime().mark(function _callee() {
55
- var _restore;
56
55
  var _ref2,
57
56
  restore,
58
57
  account,
@@ -78,7 +77,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
78
77
  case 4:
79
78
  _this.built = _this.raw.build();
80
79
  case 5:
81
- restore = (_restore = restore) !== null && _restore !== void 0 ? _restore : _this.options.restore;
80
+ restore = restore !== null && restore !== void 0 ? restore : _this.options.restore;
82
81
  delete _this.simulationResult;
83
82
  delete _this.simulationTransactionData;
84
83
  _context.next = 10;
@@ -564,7 +563,6 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
564
563
  key: "restoreFootprint",
565
564
  value: (function () {
566
565
  var _restoreFootprint = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(restorePreamble, account) {
567
- var _account;
568
566
  var restoreTx, sentTransaction;
569
567
  return _regeneratorRuntime().wrap(function _callee8$(_context9) {
570
568
  while (1) switch (_context9.prev = _context9.next) {
@@ -575,11 +573,11 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
575
573
  }
576
574
  throw new Error("For automatic restore to work you must provide a signTransaction function when initializing your Client");
577
575
  case 2:
578
- if (!((_account = account) !== null && _account !== void 0)) {
576
+ if (!(account !== null && account !== void 0)) {
579
577
  _context9.next = 6;
580
578
  break;
581
579
  }
582
- _context9.t0 = _account;
580
+ _context9.t0 = account;
583
581
  _context9.next = 9;
584
582
  break;
585
583
  case 6:
@@ -29,6 +29,8 @@ export declare class Client {
29
29
  salt?: Buffer | Uint8Array;
30
30
  /** The format used to decode `wasmHash`, if it's provided as a string. */
31
31
  format?: "hex" | "base64";
32
+ /** The address to use to deploy the custom contract */
33
+ address?: string;
32
34
  }): Promise<AssembledTransaction<T>>;
33
35
  constructor(spec: Spec, options: ClientOptions);
34
36
  /**
@@ -15,14 +15,20 @@ var _excluded = ["method"],
15
15
  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; }
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 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; }
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], -1 === t.indexOf(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 (-1 !== e.indexOf(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; }
23
23
  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; }
24
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
25
25
  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); }
26
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
27
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
28
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
29
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
30
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
31
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
26
32
  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); }
27
33
  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); }); }; }
28
34
  var CONSTRUCTOR_FUNC = "__constructor";
@@ -31,33 +37,88 @@ function specFromWasm(_x) {
31
37
  }
32
38
  function _specFromWasm() {
33
39
  _specFromWasm = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5(wasm) {
34
- var wasmModule, xdrSections, bufferSection, specEntryArray, spec;
40
+ var xdrSections, wasmModule, customData, bufferSection, specEntryArray, spec;
35
41
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
36
42
  while (1) switch (_context5.prev = _context5.next) {
37
43
  case 0:
38
- _context5.next = 2;
44
+ _context5.prev = 0;
45
+ _context5.next = 3;
39
46
  return WebAssembly.compile(wasm);
40
- case 2:
47
+ case 3:
41
48
  wasmModule = _context5.sent;
42
49
  xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
43
- if (!(xdrSections.length === 0)) {
44
- _context5.next = 6;
50
+ _context5.next = 11;
51
+ break;
52
+ case 7:
53
+ _context5.prev = 7;
54
+ _context5.t0 = _context5["catch"](0);
55
+ customData = parseWasmCustomSections(wasm);
56
+ xdrSections = customData.get('contractspecv0');
57
+ case 11:
58
+ if (!(!xdrSections || xdrSections.length === 0)) {
59
+ _context5.next = 13;
45
60
  break;
46
61
  }
47
62
  throw new Error("Could not obtain contract spec from wasm");
48
- case 6:
63
+ case 13:
49
64
  bufferSection = Buffer.from(xdrSections[0]);
50
65
  specEntryArray = (0, _utils.processSpecEntryStream)(bufferSection);
51
66
  spec = new _spec.Spec(specEntryArray);
52
67
  return _context5.abrupt("return", spec);
53
- case 10:
68
+ case 17:
54
69
  case "end":
55
70
  return _context5.stop();
56
71
  }
57
- }, _callee5);
72
+ }, _callee5, null, [[0, 7]]);
58
73
  }));
59
74
  return _specFromWasm.apply(this, arguments);
60
75
  }
76
+ function parseWasmCustomSections(buffer) {
77
+ var sections = new Map();
78
+ var arrayBuffer = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
79
+ var offset = 0;
80
+ var read = function read(length) {
81
+ if (offset + length > buffer.byteLength) throw new Error('Buffer overflow');
82
+ var bytes = new Uint8Array(arrayBuffer, offset, length);
83
+ offset += length;
84
+ return bytes;
85
+ };
86
+ if (_toConsumableArray(read(4)).join() !== '0,97,115,109') throw new Error('Invalid WASM magic');
87
+ if (_toConsumableArray(read(4)).join() !== '1,0,0,0') throw new Error('Invalid WASM version');
88
+ while (offset < buffer.byteLength) {
89
+ var sectionId = read(1)[0];
90
+ var sectionLength = readVarUint32();
91
+ var start = offset;
92
+ if (sectionId === 0) {
93
+ var nameLen = readVarUint32();
94
+ if (nameLen === 0 || offset + nameLen > start + sectionLength) continue;
95
+ var nameBytes = read(nameLen);
96
+ var payload = read(sectionLength - (offset - start));
97
+ try {
98
+ var name = new TextDecoder('utf-8', {
99
+ fatal: true
100
+ }).decode(nameBytes);
101
+ if (payload.length > 0) {
102
+ sections.set(name, (sections.get(name) || []).concat(payload));
103
+ }
104
+ } catch (_unused) {}
105
+ } else {
106
+ offset += sectionLength;
107
+ }
108
+ }
109
+ function readVarUint32() {
110
+ var value = 0,
111
+ shift = 0;
112
+ while (true) {
113
+ var byte = read(1)[0];
114
+ value |= (byte & 0x7F) << shift;
115
+ if ((byte & 0x80) === 0) break;
116
+ if ((shift += 7) >= 32) throw new Error('Invalid WASM value');
117
+ }
118
+ return value >>> 0;
119
+ }
120
+ return sections;
121
+ }
61
122
  function specFromWasmHash(_x2, _x3) {
62
123
  return _specFromWasmHash.apply(this, arguments);
63
124
  }
@@ -157,7 +218,7 @@ var Client = exports.Client = function () {
157
218
  case 3:
158
219
  spec = _context.sent;
159
220
  operation = _stellarBase.Operation.createCustomContract({
160
- address: new _stellarBase.Address(options.publicKey),
221
+ address: new _stellarBase.Address(options.address || options.publicKey),
161
222
  wasmHash: typeof wasmHash === "string" ? Buffer.from(wasmHash, format !== null && format !== void 0 ? format : "hex") : wasmHash,
162
223
  salt: salt,
163
224
  constructorArgs: args ? spec.funcArgsToScVals(CONSTRUCTOR_FUNC, args) : []
@@ -78,7 +78,9 @@ export declare class SentTransaction<T> {
78
78
  * Initialize a `SentTransaction` from `options` and a `signed`
79
79
  * AssembledTransaction. This will also send the transaction to the network.
80
80
  */
81
- static init: <U>(assembled: AssembledTransaction<U>) => Promise<SentTransaction<U>>;
81
+ static init: <U>(
82
+ /** {@link AssembledTransaction} from which this SentTransaction was initialized */
83
+ assembled: AssembledTransaction<U>) => Promise<SentTransaction<U>>;
82
84
  private send;
83
85
  get result(): T;
84
86
  }
@@ -83,10 +83,7 @@ function stringToScVal(str, ty) {
83
83
  case _stellarBase.xdr.ScSpecType.scSpecTypeSymbol().value:
84
84
  return _stellarBase.xdr.ScVal.scvSymbol(str);
85
85
  case _stellarBase.xdr.ScSpecType.scSpecTypeAddress().value:
86
- {
87
- var addr = _stellarBase.Address.fromString(str);
88
- return _stellarBase.xdr.ScVal.scvAddress(addr.toScAddress());
89
- }
86
+ return _stellarBase.Address.fromString(str).toScVal();
90
87
  case _stellarBase.xdr.ScSpecType.scSpecTypeU64().value:
91
88
  return new _stellarBase.XdrLargeInt("u64", str).toScVal();
92
89
  case _stellarBase.xdr.ScSpecType.scSpecTypeI64().value:
@@ -164,7 +161,7 @@ var PRIMITIVE_DEFINITONS = {
164
161
  },
165
162
  ScSymbol: {
166
163
  type: "string",
167
- description: "ScString is a string"
164
+ description: "ScSymbol is a string"
168
165
  },
169
166
  DataUrl: {
170
167
  type: "string",
@@ -236,6 +236,8 @@ export declare namespace HorizonApi {
236
236
  asset_code?: string;
237
237
  asset_issuer?: string;
238
238
  amount: string;
239
+ to_muxed?: string;
240
+ to_muxed_id?: string;
239
241
  }
240
242
  interface PathPaymentOperationResponse extends BaseOperationResponse<OperationResponseType.pathPayment, OperationResponseTypeI.pathPayment> {
241
243
  amount: string;
@@ -10,7 +10,7 @@ var _urijs = _interopRequireDefault(require("urijs"));
10
10
  var _httpClient = require("../http-client");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  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
- var version = exports.version = "13.1.0";
13
+ var version = exports.version = "13.3.0";
14
14
  var SERVER_TIME_MAP = exports.SERVER_TIME_MAP = {};
15
15
  var AxiosClient = exports.AxiosClient = (0, _httpClient.create)({
16
16
  headers: {
@@ -36,4 +36,12 @@ export declare class PaymentCallBuilder extends CallBuilder<ServerApi.Collection
36
36
  * @returns {PaymentCallBuilder} this PaymentCallBuilder instance
37
37
  */
38
38
  forTransaction(transactionId: string): this;
39
+ /**
40
+ * Adds a parameter defining whether to include failed transactions.
41
+ * By default, only operations of successful transactions are returned.
42
+ *
43
+ * @param {boolean} value Set to `true` to include operations of failed transactions.
44
+ * @returns {PaymentCallBuilder} this PaymentCallBuilder instance
45
+ */
46
+ includeFailed(value: boolean): this;
39
47
  }
@@ -42,5 +42,11 @@ var PaymentCallBuilder = exports.PaymentCallBuilder = function (_CallBuilder) {
42
42
  value: function forTransaction(transactionId) {
43
43
  return this.forEndpoint("transactions", transactionId);
44
44
  }
45
+ }, {
46
+ key: "includeFailed",
47
+ value: function includeFailed(value) {
48
+ this.url.setQuery("include_failed", value.toString());
49
+ return this;
50
+ }
45
51
  }]);
46
52
  }(_call_builder.CallBuilder);
@@ -139,7 +139,7 @@ export declare namespace Api {
139
139
  cursor: string;
140
140
  }
141
141
  export interface RawGetTransactionsResponse {
142
- transactions: RawTransactionInfo[];
142
+ transactions: RawTransactionInfo[] | null;
143
143
  latestLedger: number;
144
144
  latestLedgerCloseTimestamp: number;
145
145
  oldestLedger: number;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.default = exports.AxiosClient = void 0;
7
7
  var _httpClient = require("../http-client");
8
- var version = exports.version = "13.1.0";
8
+ var version = exports.version = "13.3.0";
9
9
  var AxiosClient = exports.AxiosClient = (0, _httpClient.create)({
10
10
  headers: {
11
11
  'X-Client-Name': 'js-soroban-client',
@@ -451,7 +451,7 @@ var RpcServer = exports.RpcServer = function () {
451
451
  case 0:
452
452
  return _context11.abrupt("return", this._getTransactions(request).then(function (raw) {
453
453
  var result = {
454
- transactions: raw.transactions.map(_parsers.parseRawTransactions),
454
+ transactions: (raw.transactions || []).map(_parsers.parseRawTransactions),
455
455
  latestLedger: raw.latestLedger,
456
456
  latestLedgerCloseTimestamp: raw.latestLedgerCloseTimestamp,
457
457
  oldestLedger: raw.oldestLedger,
@@ -52,7 +52,6 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
52
52
  _this$options$allowHt;
53
53
  _classCallCheck(this, AssembledTransaction);
54
54
  _defineProperty(this, "simulate", _asyncToGenerator(_regeneratorRuntime().mark(function _callee() {
55
- var _restore;
56
55
  var _ref2,
57
56
  restore,
58
57
  account,
@@ -78,7 +77,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
78
77
  case 4:
79
78
  _this.built = _this.raw.build();
80
79
  case 5:
81
- restore = (_restore = restore) !== null && _restore !== void 0 ? _restore : _this.options.restore;
80
+ restore = restore !== null && restore !== void 0 ? restore : _this.options.restore;
82
81
  delete _this.simulationResult;
83
82
  delete _this.simulationTransactionData;
84
83
  _context.next = 10;
@@ -564,7 +563,6 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
564
563
  key: "restoreFootprint",
565
564
  value: (function () {
566
565
  var _restoreFootprint = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(restorePreamble, account) {
567
- var _account;
568
566
  var restoreTx, sentTransaction;
569
567
  return _regeneratorRuntime().wrap(function _callee8$(_context9) {
570
568
  while (1) switch (_context9.prev = _context9.next) {
@@ -575,11 +573,11 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
575
573
  }
576
574
  throw new Error("For automatic restore to work you must provide a signTransaction function when initializing your Client");
577
575
  case 2:
578
- if (!((_account = account) !== null && _account !== void 0)) {
576
+ if (!(account !== null && account !== void 0)) {
579
577
  _context9.next = 6;
580
578
  break;
581
579
  }
582
- _context9.t0 = _account;
580
+ _context9.t0 = account;
583
581
  _context9.next = 9;
584
582
  break;
585
583
  case 6: