@stellar/stellar-sdk 12.0.0 → 12.0.1

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 (97) hide show
  1. package/CHANGELOG.md +98 -1
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +2796 -1194
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/browser.js +1 -1
  6. package/lib/config.js +3 -3
  7. package/lib/{contract_client → contract}/assembled_transaction.d.ts +74 -54
  8. package/lib/{contract_client → contract}/assembled_transaction.js +149 -167
  9. package/lib/{contract_client → contract}/basic_node_signer.d.ts +2 -2
  10. package/lib/{contract_client → contract}/basic_node_signer.js +5 -5
  11. package/lib/contract/client.d.ts +52 -0
  12. package/lib/contract/client.js +177 -0
  13. package/lib/contract/index.d.ts +7 -0
  14. package/lib/{contract_client → contract}/index.js +19 -8
  15. package/lib/{rust_types/result.js → contract/rust_result.js} +3 -3
  16. package/lib/{contract_client → contract}/sent_transaction.d.ts +26 -14
  17. package/lib/{contract_client → contract}/sent_transaction.js +51 -32
  18. package/lib/{contract_spec.d.ts → contract/spec.d.ts} +3 -3
  19. package/lib/{contract_spec.js → contract/spec.js} +169 -169
  20. package/lib/{contract_client → contract}/types.d.ts +10 -8
  21. package/lib/contract/utils.d.ts +41 -0
  22. package/lib/{contract_client → contract}/utils.js +15 -5
  23. package/lib/errors.js +10 -10
  24. package/lib/federation/server.js +10 -10
  25. package/lib/horizon/account_call_builder.d.ts +1 -0
  26. package/lib/horizon/account_call_builder.js +8 -8
  27. package/lib/horizon/account_response.js +7 -7
  28. package/lib/horizon/assets_call_builder.d.ts +1 -0
  29. package/lib/horizon/assets_call_builder.js +8 -8
  30. package/lib/horizon/call_builder.js +6 -6
  31. package/lib/horizon/claimable_balances_call_builder.d.ts +1 -0
  32. package/lib/horizon/claimable_balances_call_builder.js +8 -8
  33. package/lib/horizon/effect_call_builder.d.ts +1 -0
  34. package/lib/horizon/effect_call_builder.js +8 -8
  35. package/lib/horizon/friendbot_builder.d.ts +1 -0
  36. package/lib/horizon/friendbot_builder.js +8 -8
  37. package/lib/horizon/horizon_api.d.ts +1 -0
  38. package/lib/horizon/horizon_axios_client.js +1 -1
  39. package/lib/horizon/ledger_call_builder.d.ts +1 -0
  40. package/lib/horizon/ledger_call_builder.js +8 -8
  41. package/lib/horizon/liquidity_pool_call_builder.d.ts +1 -0
  42. package/lib/horizon/liquidity_pool_call_builder.js +8 -8
  43. package/lib/horizon/offer_call_builder.d.ts +1 -0
  44. package/lib/horizon/offer_call_builder.js +8 -8
  45. package/lib/horizon/operation_call_builder.d.ts +1 -0
  46. package/lib/horizon/operation_call_builder.js +8 -8
  47. package/lib/horizon/orderbook_call_builder.d.ts +1 -0
  48. package/lib/horizon/orderbook_call_builder.js +8 -8
  49. package/lib/horizon/path_call_builder.d.ts +1 -0
  50. package/lib/horizon/path_call_builder.js +8 -8
  51. package/lib/horizon/payment_call_builder.d.ts +1 -0
  52. package/lib/horizon/payment_call_builder.js +8 -8
  53. package/lib/horizon/server.js +6 -6
  54. package/lib/horizon/strict_receive_path_call_builder.d.ts +1 -0
  55. package/lib/horizon/strict_receive_path_call_builder.js +8 -8
  56. package/lib/horizon/strict_send_path_call_builder.d.ts +1 -0
  57. package/lib/horizon/strict_send_path_call_builder.js +8 -8
  58. package/lib/horizon/trade_aggregation_call_builder.d.ts +1 -0
  59. package/lib/horizon/trade_aggregation_call_builder.js +8 -8
  60. package/lib/horizon/trades_call_builder.d.ts +1 -0
  61. package/lib/horizon/trades_call_builder.js +8 -8
  62. package/lib/horizon/transaction_call_builder.d.ts +1 -0
  63. package/lib/horizon/transaction_call_builder.js +8 -8
  64. package/lib/index.d.ts +27 -2
  65. package/lib/index.js +10 -16
  66. package/lib/{soroban → rpc}/api.d.ts +25 -10
  67. package/lib/{soroban → rpc}/axios.js +1 -1
  68. package/lib/{soroban → rpc}/browser.js +1 -1
  69. package/lib/rpc/index.d.ts +8 -0
  70. package/lib/{soroban → rpc}/index.js +1 -1
  71. package/lib/{soroban → rpc}/jsonrpc.js +3 -3
  72. package/lib/{soroban → rpc}/parsers.js +12 -3
  73. package/lib/{soroban → rpc}/server.d.ts +50 -0
  74. package/lib/{soroban → rpc}/server.js +209 -128
  75. package/lib/stellartoml/index.js +6 -6
  76. package/lib/utils.js +3 -3
  77. package/lib/webauth/errors.js +10 -10
  78. package/lib/webauth/utils.js +9 -9
  79. package/package.json +32 -15
  80. package/lib/contract_client/client.d.ts +0 -17
  81. package/lib/contract_client/client.js +0 -57
  82. package/lib/contract_client/index.d.ts +0 -6
  83. package/lib/contract_client/utils.d.ts +0 -23
  84. package/lib/rust_types/index.d.ts +0 -1
  85. package/lib/rust_types/index.js +0 -16
  86. package/lib/soroban/index.d.ts +0 -7
  87. /package/lib/{rust_types/result.d.ts → contract/rust_result.d.ts} +0 -0
  88. /package/lib/{contract_client → contract}/types.js +0 -0
  89. /package/lib/{soroban → rpc}/api.js +0 -0
  90. /package/lib/{soroban → rpc}/axios.d.ts +0 -0
  91. /package/lib/{soroban → rpc}/browser.d.ts +0 -0
  92. /package/lib/{soroban → rpc}/jsonrpc.d.ts +0 -0
  93. /package/lib/{soroban → rpc}/parsers.d.ts +0 -0
  94. /package/lib/{soroban → rpc}/transaction.d.ts +0 -0
  95. /package/lib/{soroban → rpc}/transaction.js +0 -0
  96. /package/lib/{soroban → rpc}/utils.d.ts +0 -0
  97. /package/lib/{soroban → rpc}/utils.js +0 -0
@@ -4,39 +4,42 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.NULL_ACCOUNT = exports.AssembledTransaction = void 0;
7
- var _ = require("..");
8
- var _rust_types = require("../rust_types");
7
+ var _stellarBase = require("@stellar/stellar-base");
8
+ var _server = require("../rpc/server");
9
+ var _api = require("../rpc/api");
10
+ var _transaction = require("../rpc/transaction");
11
+ var _rust_result = require("./rust_result");
9
12
  var _utils = require("./utils");
10
13
  var _sent_transaction = require("./sent_transaction");
11
14
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
13
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
15
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
15
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
16
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
17
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
18
+ function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
16
19
  function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
17
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
- function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
19
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
20
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
+ function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
22
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
23
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
21
24
  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); }
22
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
23
26
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
27
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
25
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
- 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; } } }; }
27
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
28
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
29
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
30
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
28
31
  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."); }
29
- 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); }
30
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
31
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
32
- 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; }
32
+ 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; } }
33
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
34
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
35
+ 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; }
33
36
  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; }
34
- 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); } }
35
- 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); }); }; }
36
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
- 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); } }
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
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; }
37
+ 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); }
38
+ 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); }); }; }
39
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
40
+ 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); } }
41
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
42
+ 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; }
40
43
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
41
44
  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
45
  var NULL_ACCOUNT = exports.NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
@@ -54,15 +57,15 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
54
57
  _context.next = 2;
55
58
  break;
56
59
  }
57
- throw new Error('Transaction has not yet been assembled; ' + 'call `AssembledTransaction.build` first.');
60
+ throw new Error("Transaction has not yet been assembled; " + "call `AssembledTransaction.build` first.");
58
61
  case 2:
59
62
  _this.built = _this.raw.build();
60
63
  _context.next = 5;
61
64
  return _this.server.simulateTransaction(_this.built);
62
65
  case 5:
63
66
  _this.simulation = _context.sent;
64
- if (_.SorobanRpc.Api.isSimulationSuccess(_this.simulation)) {
65
- _this.built = _.SorobanRpc.assembleTransaction(_this.built, _this.simulation).build();
67
+ if (_api.Api.isSimulationSuccess(_this.simulation)) {
68
+ _this.built = (0, _transaction.assembleTransaction)(_this.built, _this.simulation).build();
66
69
  }
67
70
  return _context.abrupt("return", _this);
68
71
  case 8:
@@ -78,6 +81,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
78
81
  _ref3$signTransaction,
79
82
  signTransaction,
80
83
  typeChecked,
84
+ sent,
81
85
  _args2 = arguments;
82
86
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
83
87
  while (1) switch (_context2.prev = _context2.next) {
@@ -99,23 +103,21 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
99
103
  _context2.next = 7;
100
104
  break;
101
105
  }
102
- throw new AssembledTransaction.Errors.NoSigner("You must provide a signTransaction function, either when calling " + "`signAndSend` or when initializing your ContractClient");
106
+ throw new AssembledTransaction.Errors.NoSigner("You must provide a signTransaction function, either when calling " + "`signAndSend` or when initializing your Client");
103
107
  case 7:
104
- _context2.next = 9;
105
- return _this.needsNonInvokerSigningBy();
106
- case 9:
107
- if (!_context2.sent.length) {
108
- _context2.next = 11;
108
+ if (!_this.needsNonInvokerSigningBy().length) {
109
+ _context2.next = 9;
109
110
  break;
110
111
  }
111
112
  throw new AssembledTransaction.Errors.NeedsMoreSignatures("Transaction requires more signatures. " + "See `needsNonInvokerSigningBy` for details.");
112
- case 11:
113
+ case 9:
113
114
  typeChecked = _this;
114
- _context2.next = 14;
115
+ _context2.next = 12;
115
116
  return _sent_transaction.SentTransaction.init(signTransaction, typeChecked);
117
+ case 12:
118
+ sent = _context2.sent;
119
+ return _context2.abrupt("return", sent);
116
120
  case 14:
117
- return _context2.abrupt("return", _context2.sent);
118
- case 15:
119
121
  case "end":
120
122
  return _context2.stop();
121
123
  }
@@ -127,7 +129,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
127
129
  while (1) switch (_context3.prev = _context3.next) {
128
130
  case 0:
129
131
  _context3.next = 2;
130
- return _this.server.getLedgerEntries(new _.Contract(_this.options.contractId).getFootprint());
132
+ return _this.server.getLedgerEntries(new _stellarBase.Contract(_this.options.contractId).getFootprint());
131
133
  case 2:
132
134
  entryRes = _context3.sent;
133
135
  if (!(!entryRes.entries || !entryRes.entries.length || !entryRes.entries[0].liveUntilLedgerSeq)) {
@@ -143,49 +145,32 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
143
145
  }
144
146
  }, _callee3);
145
147
  })));
146
- _defineProperty(this, "needsNonInvokerSigningBy", _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() {
148
+ _defineProperty(this, "needsNonInvokerSigningBy", function () {
147
149
  var _rawInvokeHostFunctio;
148
- var _ref6,
149
- _ref6$includeAlreadyS,
150
- includeAlreadySigned,
151
- rawInvokeHostFunctionOp,
152
- _args4 = arguments;
153
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
154
- while (1) switch (_context4.prev = _context4.next) {
155
- case 0:
156
- _ref6 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref6$includeAlreadyS = _ref6.includeAlreadySigned, includeAlreadySigned = _ref6$includeAlreadyS === void 0 ? false : _ref6$includeAlreadyS;
157
- if (_this.built) {
158
- _context4.next = 3;
159
- break;
160
- }
161
- throw new Error("Transaction has not yet been simulated");
162
- case 3:
163
- if ("operations" in _this.built) {
164
- _context4.next = 5;
165
- break;
166
- }
167
- throw new Error("Unexpected Transaction type; no operations: ".concat(JSON.stringify(_this.built)));
168
- case 5:
169
- rawInvokeHostFunctionOp = _this.built.operations[0];
170
- return _context4.abrupt("return", _toConsumableArray(new Set(((_rawInvokeHostFunctio = rawInvokeHostFunctionOp.auth) !== null && _rawInvokeHostFunctio !== void 0 ? _rawInvokeHostFunctio : []).filter(function (entry) {
171
- return entry.credentials().switch() === _.xdr.SorobanCredentialsType.sorobanCredentialsAddress() && (includeAlreadySigned || entry.credentials().address().signature().switch().name === "scvVoid");
172
- }).map(function (entry) {
173
- return _.StrKey.encodeEd25519PublicKey(entry.credentials().address().address().accountId().ed25519());
174
- }))));
175
- case 7:
176
- case "end":
177
- return _context4.stop();
178
- }
179
- }, _callee4);
180
- })));
181
- _defineProperty(this, "signAuthEntries", _asyncToGenerator(_regeneratorRuntime().mark(function _callee6() {
150
+ var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
151
+ _ref5$includeAlreadyS = _ref5.includeAlreadySigned,
152
+ includeAlreadySigned = _ref5$includeAlreadyS === void 0 ? false : _ref5$includeAlreadyS;
153
+ if (!_this.built) {
154
+ throw new Error("Transaction has not yet been simulated");
155
+ }
156
+ if (!("operations" in _this.built)) {
157
+ throw new Error("Unexpected Transaction type; no operations: ".concat(JSON.stringify(_this.built)));
158
+ }
159
+ var rawInvokeHostFunctionOp = _this.built.operations[0];
160
+ return _toConsumableArray(new Set(((_rawInvokeHostFunctio = rawInvokeHostFunctionOp.auth) !== null && _rawInvokeHostFunctio !== void 0 ? _rawInvokeHostFunctio : []).filter(function (entry) {
161
+ return entry.credentials().switch() === _stellarBase.xdr.SorobanCredentialsType.sorobanCredentialsAddress() && (includeAlreadySigned || entry.credentials().address().signature().switch().name === "scvVoid");
162
+ }).map(function (entry) {
163
+ return _stellarBase.StrKey.encodeEd25519PublicKey(entry.credentials().address().address().accountId().ed25519());
164
+ })));
165
+ });
166
+ _defineProperty(this, "signAuthEntries", _asyncToGenerator(_regeneratorRuntime().mark(function _callee5() {
182
167
  var _rawInvokeHostFunctio2;
183
- var _ref8,
184
- _ref8$expiration,
168
+ var _ref7,
169
+ _ref7$expiration,
185
170
  expiration,
186
- _ref8$signAuthEntry,
171
+ _ref7$signAuthEntry,
187
172
  signAuthEntry,
188
- _ref8$publicKey,
173
+ _ref7$publicKey,
189
174
  publicKey,
190
175
  needsNonInvokerSigningBy,
191
176
  rawInvokeHostFunctionOp,
@@ -196,118 +181,115 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
196
181
  i,
197
182
  entry,
198
183
  pk,
199
- _args6 = arguments;
200
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
201
- while (1) switch (_context6.prev = _context6.next) {
184
+ _args5 = arguments;
185
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
186
+ while (1) switch (_context5.prev = _context5.next) {
202
187
  case 0:
203
- _ref8 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref8$expiration = _ref8.expiration, expiration = _ref8$expiration === void 0 ? _this.getStorageExpiration() : _ref8$expiration, _ref8$signAuthEntry = _ref8.signAuthEntry, signAuthEntry = _ref8$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref8$signAuthEntry, _ref8$publicKey = _ref8.publicKey, publicKey = _ref8$publicKey === void 0 ? _this.options.publicKey : _ref8$publicKey;
188
+ _ref7 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, _ref7$expiration = _ref7.expiration, expiration = _ref7$expiration === void 0 ? _this.getStorageExpiration() : _ref7$expiration, _ref7$signAuthEntry = _ref7.signAuthEntry, signAuthEntry = _ref7$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref7$signAuthEntry, _ref7$publicKey = _ref7.publicKey, publicKey = _ref7$publicKey === void 0 ? _this.options.publicKey : _ref7$publicKey;
204
189
  if (_this.built) {
205
- _context6.next = 3;
190
+ _context5.next = 3;
206
191
  break;
207
192
  }
208
193
  throw new Error("Transaction has not yet been assembled or simulated");
209
194
  case 3:
210
- _context6.next = 5;
211
- return _this.needsNonInvokerSigningBy();
212
- case 5:
213
- needsNonInvokerSigningBy = _context6.sent;
195
+ needsNonInvokerSigningBy = _this.needsNonInvokerSigningBy();
214
196
  if (needsNonInvokerSigningBy) {
215
- _context6.next = 8;
197
+ _context5.next = 6;
216
198
  break;
217
199
  }
218
200
  throw new AssembledTransaction.Errors.NoUnsignedNonInvokerAuthEntries("No unsigned non-invoker auth entries; maybe you already signed?");
219
- case 8:
220
- if (!(needsNonInvokerSigningBy.indexOf(publicKey !== null && publicKey !== void 0 ? publicKey : '') === -1)) {
221
- _context6.next = 10;
201
+ case 6:
202
+ if (!(needsNonInvokerSigningBy.indexOf(publicKey !== null && publicKey !== void 0 ? publicKey : "") === -1)) {
203
+ _context5.next = 8;
222
204
  break;
223
205
  }
224
206
  throw new AssembledTransaction.Errors.NoSignatureNeeded("No auth entries for public key \"".concat(publicKey, "\""));
225
- case 10:
207
+ case 8:
226
208
  if (signAuthEntry) {
227
- _context6.next = 12;
209
+ _context5.next = 10;
228
210
  break;
229
211
  }
230
- throw new AssembledTransaction.Errors.NoSigner('You must provide `signAuthEntry` when calling `signAuthEntries`, ' + 'or when constructing the `ContractClient` or `AssembledTransaction`');
231
- case 12:
212
+ throw new AssembledTransaction.Errors.NoSigner("You must provide `signAuthEntry` when calling `signAuthEntries`, " + "or when constructing the `Client` or `AssembledTransaction`");
213
+ case 10:
232
214
  rawInvokeHostFunctionOp = _this.built.operations[0];
233
215
  authEntries = (_rawInvokeHostFunctio2 = rawInvokeHostFunctionOp.auth) !== null && _rawInvokeHostFunctio2 !== void 0 ? _rawInvokeHostFunctio2 : [];
234
216
  _iterator = _createForOfIteratorHelper(authEntries.entries());
235
- _context6.prev = 15;
217
+ _context5.prev = 13;
236
218
  _iterator.s();
237
- case 17:
219
+ case 15:
238
220
  if ((_step = _iterator.n()).done) {
239
- _context6.next = 36;
221
+ _context5.next = 34;
240
222
  break;
241
223
  }
242
224
  _step$value = _slicedToArray(_step.value, 2), i = _step$value[0], entry = _step$value[1];
243
- if (!(entry.credentials().switch() !== _.xdr.SorobanCredentialsType.sorobanCredentialsAddress())) {
244
- _context6.next = 21;
225
+ if (!(entry.credentials().switch() !== _stellarBase.xdr.SorobanCredentialsType.sorobanCredentialsAddress())) {
226
+ _context5.next = 19;
245
227
  break;
246
228
  }
247
- return _context6.abrupt("continue", 34);
248
- case 21:
249
- pk = _.StrKey.encodeEd25519PublicKey(entry.credentials().address().address().accountId().ed25519());
229
+ return _context5.abrupt("continue", 32);
230
+ case 19:
231
+ pk = _stellarBase.StrKey.encodeEd25519PublicKey(entry.credentials().address().address().accountId().ed25519());
250
232
  if (!(pk !== publicKey)) {
251
- _context6.next = 24;
233
+ _context5.next = 22;
252
234
  break;
253
235
  }
254
- return _context6.abrupt("continue", 34);
255
- case 24:
256
- _context6.t0 = _.authorizeEntry;
257
- _context6.t1 = entry;
258
- _context6.t2 = function () {
259
- var _ref9 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5(preimage) {
260
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
261
- while (1) switch (_context5.prev = _context5.next) {
236
+ return _context5.abrupt("continue", 32);
237
+ case 22:
238
+ _context5.t0 = _stellarBase.authorizeEntry;
239
+ _context5.t1 = entry;
240
+ _context5.t2 = function () {
241
+ var _ref8 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee4(preimage) {
242
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
243
+ while (1) switch (_context4.prev = _context4.next) {
262
244
  case 0:
263
- _context5.t0 = Buffer;
264
- _context5.next = 3;
245
+ _context4.t0 = Buffer;
246
+ _context4.next = 3;
265
247
  return signAuthEntry(preimage.toXDR("base64"));
266
248
  case 3:
267
- _context5.t1 = _context5.sent;
268
- return _context5.abrupt("return", _context5.t0.from.call(_context5.t0, _context5.t1, "base64"));
249
+ _context4.t1 = _context4.sent;
250
+ return _context4.abrupt("return", _context4.t0.from.call(_context4.t0, _context4.t1, "base64"));
269
251
  case 5:
270
252
  case "end":
271
- return _context5.stop();
253
+ return _context4.stop();
272
254
  }
273
- }, _callee5);
255
+ }, _callee4);
274
256
  }));
275
257
  return function (_x) {
276
- return _ref9.apply(this, arguments);
258
+ return _ref8.apply(this, arguments);
277
259
  };
278
260
  }();
279
- _context6.next = 29;
261
+ _context5.next = 27;
280
262
  return expiration;
281
- case 29:
282
- _context6.t3 = _context6.sent;
283
- _context6.t4 = _this.options.networkPassphrase;
284
- _context6.next = 33;
285
- return (0, _context6.t0)(_context6.t1, _context6.t2, _context6.t3, _context6.t4);
286
- case 33:
287
- authEntries[i] = _context6.sent;
263
+ case 27:
264
+ _context5.t3 = _context5.sent;
265
+ _context5.t4 = _this.options.networkPassphrase;
266
+ _context5.next = 31;
267
+ return (0, _context5.t0)(_context5.t1, _context5.t2, _context5.t3, _context5.t4);
268
+ case 31:
269
+ authEntries[i] = _context5.sent;
270
+ case 32:
271
+ _context5.next = 15;
272
+ break;
288
273
  case 34:
289
- _context6.next = 17;
274
+ _context5.next = 39;
290
275
  break;
291
276
  case 36:
292
- _context6.next = 41;
293
- break;
294
- case 38:
295
- _context6.prev = 38;
296
- _context6.t5 = _context6["catch"](15);
297
- _iterator.e(_context6.t5);
298
- case 41:
299
- _context6.prev = 41;
277
+ _context5.prev = 36;
278
+ _context5.t5 = _context5["catch"](13);
279
+ _iterator.e(_context5.t5);
280
+ case 39:
281
+ _context5.prev = 39;
300
282
  _iterator.f();
301
- return _context6.finish(41);
302
- case 44:
283
+ return _context5.finish(39);
284
+ case 42:
303
285
  case "end":
304
- return _context6.stop();
286
+ return _context5.stop();
305
287
  }
306
- }, _callee6, null, [[15, 38, 41, 44]]);
288
+ }, _callee5, null, [[13, 36, 39, 42]]);
307
289
  })));
308
290
  this.options = options;
309
291
  this.options.simulate = (_this$options$simulat = this.options.simulate) !== null && _this$options$simulat !== void 0 ? _this$options$simulat : true;
310
- this.server = new _.SorobanRpc.Server(this.options.rpcUrl, {
292
+ this.server = new _server.Server(this.options.rpcUrl, {
311
293
  allowHttp: (_this$options$allowHt = this.options.allowHttp) !== null && _this$options$allowHt !== void 0 ? _this$options$allowHt : false
312
294
  });
313
295
  }
@@ -340,10 +322,10 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
340
322
  if (!simulation) {
341
323
  throw new AssembledTransaction.Errors.NotYetSimulated("Transaction has not yet been simulated");
342
324
  }
343
- if (_.SorobanRpc.Api.isSimulationError(simulation)) {
325
+ if (_api.Api.isSimulationError(simulation)) {
344
326
  throw new Error("Transaction simulation failed: \"".concat(simulation.error, "\""));
345
327
  }
346
- if (_.SorobanRpc.Api.isSimulationRestore(simulation)) {
328
+ if (_api.Api.isSimulationRestore(simulation)) {
347
329
  throw new AssembledTransaction.Errors.ExpiredState("You need to restore some contract state before you can invoke this method. ".concat(JSON.stringify(simulation, null, 2)));
348
330
  }
349
331
  if (!simulation.result) {
@@ -377,7 +359,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
377
359
  var i = parseInt(match[1], 10);
378
360
  var err = this.options.errorTypes[i];
379
361
  if (!err) return undefined;
380
- return new _rust_types.Err(err);
362
+ return new _rust_result.Err(err);
381
363
  }
382
364
  }, {
383
365
  key: "isReadCall",
@@ -388,63 +370,63 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
388
370
  }
389
371
  }], [{
390
372
  key: "fromJSON",
391
- value: function fromJSON(options, _ref10) {
392
- var tx = _ref10.tx,
393
- simulationResult = _ref10.simulationResult,
394
- simulationTransactionData = _ref10.simulationTransactionData;
373
+ value: function fromJSON(options, _ref9) {
374
+ var tx = _ref9.tx,
375
+ simulationResult = _ref9.simulationResult,
376
+ simulationTransactionData = _ref9.simulationTransactionData;
395
377
  var txn = new AssembledTransaction(options);
396
- txn.built = _.TransactionBuilder.fromXDR(tx, options.networkPassphrase);
378
+ txn.built = _stellarBase.TransactionBuilder.fromXDR(tx, options.networkPassphrase);
397
379
  txn.simulationResult = {
398
380
  auth: simulationResult.auth.map(function (a) {
399
- return _.xdr.SorobanAuthorizationEntry.fromXDR(a, "base64");
381
+ return _stellarBase.xdr.SorobanAuthorizationEntry.fromXDR(a, "base64");
400
382
  }),
401
- retval: _.xdr.ScVal.fromXDR(simulationResult.retval, "base64")
383
+ retval: _stellarBase.xdr.ScVal.fromXDR(simulationResult.retval, "base64")
402
384
  };
403
- txn.simulationTransactionData = _.xdr.SorobanTransactionData.fromXDR(simulationTransactionData, "base64");
385
+ txn.simulationTransactionData = _stellarBase.xdr.SorobanTransactionData.fromXDR(simulationTransactionData, "base64");
404
386
  return txn;
405
387
  }
406
388
  }, {
407
389
  key: "build",
408
390
  value: (function () {
409
- var _build = _asyncToGenerator(_regeneratorRuntime().mark(function _callee7(options) {
391
+ var _build = _asyncToGenerator(_regeneratorRuntime().mark(function _callee6(options) {
410
392
  var _options$fee, _options$args, _options$timeoutInSec;
411
393
  var tx, contract, account;
412
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
413
- while (1) switch (_context7.prev = _context7.next) {
394
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
395
+ while (1) switch (_context6.prev = _context6.next) {
414
396
  case 0:
415
397
  tx = new AssembledTransaction(options);
416
- contract = new _.Contract(options.contractId);
398
+ contract = new _stellarBase.Contract(options.contractId);
417
399
  if (!options.publicKey) {
418
- _context7.next = 8;
400
+ _context6.next = 8;
419
401
  break;
420
402
  }
421
- _context7.next = 5;
403
+ _context6.next = 5;
422
404
  return tx.server.getAccount(options.publicKey);
423
405
  case 5:
424
- _context7.t0 = _context7.sent;
425
- _context7.next = 9;
406
+ _context6.t0 = _context6.sent;
407
+ _context6.next = 9;
426
408
  break;
427
409
  case 8:
428
- _context7.t0 = new _.Account(NULL_ACCOUNT, "0");
410
+ _context6.t0 = new _stellarBase.Account(NULL_ACCOUNT, "0");
429
411
  case 9:
430
- account = _context7.t0;
431
- tx.raw = new _.TransactionBuilder(account, {
432
- fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : _.BASE_FEE,
412
+ account = _context6.t0;
413
+ tx.raw = new _stellarBase.TransactionBuilder(account, {
414
+ fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : _stellarBase.BASE_FEE,
433
415
  networkPassphrase: options.networkPassphrase
434
416
  }).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);
435
417
  if (!options.simulate) {
436
- _context7.next = 14;
418
+ _context6.next = 14;
437
419
  break;
438
420
  }
439
- _context7.next = 14;
421
+ _context6.next = 14;
440
422
  return tx.simulate();
441
423
  case 14:
442
- return _context7.abrupt("return", tx);
424
+ return _context6.abrupt("return", tx);
443
425
  case 15:
444
426
  case "end":
445
- return _context7.stop();
427
+ return _context6.stop();
446
428
  }
447
- }, _callee7);
429
+ }, _callee6);
448
430
  }));
449
431
  function build(_x2) {
450
432
  return _build.apply(this, arguments);
@@ -1,6 +1,6 @@
1
- import { Keypair } from '..';
1
+ import { Keypair } from "@stellar/stellar-base";
2
2
  /**
3
- * For use with {@link ContractClient} and {@link AssembledTransaction}.
3
+ * For use with {@link Client} and {@link AssembledTransaction}.
4
4
  * Implements `signTransaction` and `signAuthEntry` with signatures expected by
5
5
  * those classes. This is useful for testing and maybe some simple Node
6
6
  * applications. Feel free to use this as a starting point for your own
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.basicNodeSigner = void 0;
8
- var _ = require("..");
8
+ var _stellarBase = require("@stellar/stellar-base");
9
9
  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; }
10
- 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); } }
11
- 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); }); }; }
10
+ 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); }
11
+ 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); }); }; }
12
12
  var basicNodeSigner = exports.basicNodeSigner = function basicNodeSigner(keypair, networkPassphrase) {
13
13
  return {
14
14
  signTransaction: function () {
@@ -17,7 +17,7 @@ var basicNodeSigner = exports.basicNodeSigner = function basicNodeSigner(keypair
17
17
  return _regeneratorRuntime().wrap(function _callee$(_context) {
18
18
  while (1) switch (_context.prev = _context.next) {
19
19
  case 0:
20
- t = _.TransactionBuilder.fromXDR(tx, networkPassphrase);
20
+ t = _stellarBase.TransactionBuilder.fromXDR(tx, networkPassphrase);
21
21
  t.sign(keypair);
22
22
  return _context.abrupt("return", t.toXDR());
23
23
  case 3:
@@ -36,7 +36,7 @@ var basicNodeSigner = exports.basicNodeSigner = function basicNodeSigner(keypair
36
36
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
37
37
  while (1) switch (_context2.prev = _context2.next) {
38
38
  case 0:
39
- return _context2.abrupt("return", keypair.sign((0, _.hash)(Buffer.from(entryXdr, "base64"))).toString('base64'));
39
+ return _context2.abrupt("return", keypair.sign((0, _stellarBase.hash)(Buffer.from(entryXdr, "base64"))).toString("base64"));
40
40
  case 1:
41
41
  case "end":
42
42
  return _context2.stop();