@stellar/stellar-sdk 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +116 -1
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +3089 -1219
  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 +154 -59
  8. package/lib/{contract_client → contract}/assembled_transaction.js +403 -187
  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 +53 -0
  12. package/lib/contract/client.js +180 -0
  13. package/lib/contract/index.d.ts +8 -0
  14. package/lib/{contract_client → contract}/index.js +37 -9
  15. package/lib/{rust_types/result.js → contract/rust_result.js} +3 -3
  16. package/lib/{contract_client → contract}/sent_transaction.d.ts +27 -18
  17. package/lib/{contract_client → contract}/sent_transaction.js +49 -47
  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 +15 -8
  21. package/lib/contract/utils.d.ts +44 -0
  22. package/lib/{contract_client → contract}/utils.js +47 -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 +38 -30
  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
@@ -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();
@@ -0,0 +1,53 @@
1
+ /// <reference types="node" />
2
+ import { Spec } from "./spec";
3
+ import { AssembledTransaction } from "./assembled_transaction";
4
+ import type { ClientOptions } from "./types";
5
+ export declare class Client {
6
+ /** {@link Spec} to construct a Client for */
7
+ readonly spec: Spec;
8
+ /** see {@link ClientOptions} */
9
+ readonly options: ClientOptions;
10
+ /**
11
+ * Generate a class from the contract spec that where each contract method
12
+ * gets included with an identical name.
13
+ *
14
+ * Each method returns an {@link AssembledTransaction} that can be used to
15
+ * modify, simulate, decode results, and possibly sign, & submit the
16
+ * transaction.
17
+ */
18
+ constructor(
19
+ /** {@link Spec} to construct a Client for */
20
+ spec: Spec,
21
+ /** see {@link ClientOptions} */
22
+ options: ClientOptions);
23
+ /**
24
+ * Generates a Client instance from the provided ClientOptions and the contract's wasm hash.
25
+ * The wasmHash can be provided in either hex or base64 format.
26
+ *
27
+ * @param wasmHash The hash of the contract's wasm binary, in either hex or base64 format.
28
+ * @param options The ClientOptions object containing the necessary configuration, including the rpcUrl.
29
+ * @param format The format of the provided wasmHash, either "hex" or "base64". Defaults to "hex".
30
+ * @returns A Promise that resolves to a Client instance.
31
+ * @throws {TypeError} If the provided options object does not contain an rpcUrl.
32
+ */
33
+ static fromWasmHash(wasmHash: Buffer | string, options: ClientOptions, format?: "hex" | "base64"): Promise<Client>;
34
+ /**
35
+ * Generates a Client instance from the provided ClientOptions and the contract's wasm binary.
36
+ *
37
+ * @param wasm The contract's wasm binary as a Buffer.
38
+ * @param options The ClientOptions object containing the necessary configuration.
39
+ * @returns A Promise that resolves to a Client instance.
40
+ * @throws {Error} If the contract spec cannot be obtained from the provided wasm binary.
41
+ */
42
+ static fromWasm(wasm: Buffer, options: ClientOptions): Promise<Client>;
43
+ /**
44
+ * Generates a Client instance from the provided ClientOptions, which must include the contractId and rpcUrl.
45
+ *
46
+ * @param options The ClientOptions object containing the necessary configuration, including the contractId and rpcUrl.
47
+ * @returns A Promise that resolves to a Client instance.
48
+ * @throws {TypeError} If the provided options object does not contain both rpcUrl and contractId.
49
+ */
50
+ static from(options: ClientOptions): Promise<Client>;
51
+ txFromJSON: <T>(json: string) => AssembledTransaction<T>;
52
+ txFromXDR: <T>(xdrBase64: string) => AssembledTransaction<T>;
53
+ }
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Client = void 0;
7
+ var _spec = require("./spec");
8
+ var _rpc = require("../rpc");
9
+ var _assembled_transaction = require("./assembled_transaction");
10
+ var _utils = require("./utils");
11
+ var _excluded = ["method"];
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
+ 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; }
14
+ 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); }
15
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
16
+ 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
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
19
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
20
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
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
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
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
+ var Client = exports.Client = function () {
27
+ function Client(spec, options) {
28
+ var _this = this;
29
+ _classCallCheck(this, Client);
30
+ _defineProperty(this, "txFromJSON", function (json) {
31
+ var _JSON$parse = JSON.parse(json),
32
+ method = _JSON$parse.method,
33
+ tx = _objectWithoutProperties(_JSON$parse, _excluded);
34
+ return _assembled_transaction.AssembledTransaction.fromJSON(_objectSpread(_objectSpread({}, _this.options), {}, {
35
+ method: method,
36
+ parseResultXdr: function parseResultXdr(result) {
37
+ return _this.spec.funcResToNative(method, result);
38
+ }
39
+ }), tx);
40
+ });
41
+ _defineProperty(this, "txFromXDR", function (xdrBase64) {
42
+ return _assembled_transaction.AssembledTransaction.fromXDR(_this.options, xdrBase64, _this.spec);
43
+ });
44
+ this.spec = spec;
45
+ this.options = options;
46
+ this.spec.funcs().forEach(function (xdrFn) {
47
+ var method = xdrFn.name().toString();
48
+ var assembleTransaction = function assembleTransaction(args, methodOptions) {
49
+ return _assembled_transaction.AssembledTransaction.build(_objectSpread(_objectSpread(_objectSpread({
50
+ method: method,
51
+ args: args && spec.funcArgsToScVals(method, args)
52
+ }, options), methodOptions), {}, {
53
+ errorTypes: spec.errorCases().reduce(function (acc, curr) {
54
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, curr.value(), {
55
+ message: curr.doc().toString()
56
+ }));
57
+ }, {}),
58
+ parseResultXdr: function parseResultXdr(result) {
59
+ return spec.funcResToNative(method, result);
60
+ }
61
+ }));
62
+ };
63
+ _this[method] = spec.getFunc(method).inputs().length === 0 ? function (opts) {
64
+ return assembleTransaction(undefined, opts);
65
+ } : assembleTransaction;
66
+ });
67
+ }
68
+ return _createClass(Client, null, [{
69
+ key: "fromWasmHash",
70
+ value: (function () {
71
+ var _fromWasmHash = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(wasmHash, options) {
72
+ var format,
73
+ rpcUrl,
74
+ allowHttp,
75
+ serverOpts,
76
+ server,
77
+ wasm,
78
+ _args = arguments;
79
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
80
+ while (1) switch (_context.prev = _context.next) {
81
+ case 0:
82
+ format = _args.length > 2 && _args[2] !== undefined ? _args[2] : "hex";
83
+ if (!(!options || !options.rpcUrl)) {
84
+ _context.next = 3;
85
+ break;
86
+ }
87
+ throw new TypeError('options must contain rpcUrl');
88
+ case 3:
89
+ rpcUrl = options.rpcUrl, allowHttp = options.allowHttp;
90
+ serverOpts = {
91
+ allowHttp: allowHttp
92
+ };
93
+ server = new _rpc.Server(rpcUrl, serverOpts);
94
+ _context.next = 8;
95
+ return server.getContractWasmByHash(wasmHash, format);
96
+ case 8:
97
+ wasm = _context.sent;
98
+ return _context.abrupt("return", Client.fromWasm(wasm, options));
99
+ case 10:
100
+ case "end":
101
+ return _context.stop();
102
+ }
103
+ }, _callee);
104
+ }));
105
+ function fromWasmHash(_x, _x2) {
106
+ return _fromWasmHash.apply(this, arguments);
107
+ }
108
+ return fromWasmHash;
109
+ }())
110
+ }, {
111
+ key: "fromWasm",
112
+ value: (function () {
113
+ var _fromWasm = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(wasm, options) {
114
+ var wasmModule, xdrSections, bufferSection, specEntryArray, spec;
115
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
116
+ while (1) switch (_context2.prev = _context2.next) {
117
+ case 0:
118
+ _context2.next = 2;
119
+ return WebAssembly.compile(wasm);
120
+ case 2:
121
+ wasmModule = _context2.sent;
122
+ xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
123
+ if (!(xdrSections.length === 0)) {
124
+ _context2.next = 6;
125
+ break;
126
+ }
127
+ throw new Error('Could not obtain contract spec from wasm');
128
+ case 6:
129
+ bufferSection = Buffer.from(xdrSections[0]);
130
+ specEntryArray = (0, _utils.processSpecEntryStream)(bufferSection);
131
+ spec = new _spec.Spec(specEntryArray);
132
+ return _context2.abrupt("return", new Client(spec, options));
133
+ case 10:
134
+ case "end":
135
+ return _context2.stop();
136
+ }
137
+ }, _callee2);
138
+ }));
139
+ function fromWasm(_x3, _x4) {
140
+ return _fromWasm.apply(this, arguments);
141
+ }
142
+ return fromWasm;
143
+ }())
144
+ }, {
145
+ key: "from",
146
+ value: (function () {
147
+ var _from = _asyncToGenerator(_regeneratorRuntime().mark(function _callee3(options) {
148
+ var rpcUrl, contractId, allowHttp, serverOpts, server, wasm;
149
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
150
+ while (1) switch (_context3.prev = _context3.next) {
151
+ case 0:
152
+ if (!(!options || !options.rpcUrl || !options.contractId)) {
153
+ _context3.next = 2;
154
+ break;
155
+ }
156
+ throw new TypeError('options must contain rpcUrl and contractId');
157
+ case 2:
158
+ rpcUrl = options.rpcUrl, contractId = options.contractId, allowHttp = options.allowHttp;
159
+ serverOpts = {
160
+ allowHttp: allowHttp
161
+ };
162
+ server = new _rpc.Server(rpcUrl, serverOpts);
163
+ _context3.next = 7;
164
+ return server.getContractWasmByContractId(contractId);
165
+ case 7:
166
+ wasm = _context3.sent;
167
+ return _context3.abrupt("return", Client.fromWasm(wasm, options));
168
+ case 9:
169
+ case "end":
170
+ return _context3.stop();
171
+ }
172
+ }, _callee3);
173
+ }));
174
+ function from(_x5) {
175
+ return _from.apply(this, arguments);
176
+ }
177
+ return from;
178
+ }())
179
+ }]);
180
+ }();
@@ -0,0 +1,8 @@
1
+ export * from "./assembled_transaction";
2
+ export * from "./basic_node_signer";
3
+ export * from "./client";
4
+ export * from "./rust_result";
5
+ export * from "./sent_transaction";
6
+ export * from "./spec";
7
+ export * from "./types";
8
+ export { DEFAULT_TIMEOUT } from "./utils";
@@ -3,9 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ DEFAULT_TIMEOUT: true
8
+ };
9
+ Object.defineProperty(exports, "DEFAULT_TIMEOUT", {
10
+ enumerable: true,
11
+ get: function get() {
12
+ return _utils.DEFAULT_TIMEOUT;
13
+ }
14
+ });
6
15
  var _assembled_transaction = require("./assembled_transaction");
7
16
  Object.keys(_assembled_transaction).forEach(function (key) {
8
17
  if (key === "default" || key === "__esModule") return;
18
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
19
  if (key in exports && exports[key] === _assembled_transaction[key]) return;
10
20
  Object.defineProperty(exports, key, {
11
21
  enumerable: true,
@@ -17,6 +27,7 @@ Object.keys(_assembled_transaction).forEach(function (key) {
17
27
  var _basic_node_signer = require("./basic_node_signer");
18
28
  Object.keys(_basic_node_signer).forEach(function (key) {
19
29
  if (key === "default" || key === "__esModule") return;
30
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
31
  if (key in exports && exports[key] === _basic_node_signer[key]) return;
21
32
  Object.defineProperty(exports, key, {
22
33
  enumerable: true,
@@ -28,6 +39,7 @@ Object.keys(_basic_node_signer).forEach(function (key) {
28
39
  var _client = require("./client");
29
40
  Object.keys(_client).forEach(function (key) {
30
41
  if (key === "default" || key === "__esModule") return;
42
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
31
43
  if (key in exports && exports[key] === _client[key]) return;
32
44
  Object.defineProperty(exports, key, {
33
45
  enumerable: true,
@@ -36,9 +48,22 @@ Object.keys(_client).forEach(function (key) {
36
48
  }
37
49
  });
38
50
  });
51
+ var _rust_result = require("./rust_result");
52
+ Object.keys(_rust_result).forEach(function (key) {
53
+ if (key === "default" || key === "__esModule") return;
54
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
55
+ if (key in exports && exports[key] === _rust_result[key]) return;
56
+ Object.defineProperty(exports, key, {
57
+ enumerable: true,
58
+ get: function get() {
59
+ return _rust_result[key];
60
+ }
61
+ });
62
+ });
39
63
  var _sent_transaction = require("./sent_transaction");
40
64
  Object.keys(_sent_transaction).forEach(function (key) {
41
65
  if (key === "default" || key === "__esModule") return;
66
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
67
  if (key in exports && exports[key] === _sent_transaction[key]) return;
43
68
  Object.defineProperty(exports, key, {
44
69
  enumerable: true,
@@ -47,25 +72,28 @@ Object.keys(_sent_transaction).forEach(function (key) {
47
72
  }
48
73
  });
49
74
  });
50
- var _types = require("./types");
51
- Object.keys(_types).forEach(function (key) {
75
+ var _spec = require("./spec");
76
+ Object.keys(_spec).forEach(function (key) {
52
77
  if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _types[key]) return;
78
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
79
+ if (key in exports && exports[key] === _spec[key]) return;
54
80
  Object.defineProperty(exports, key, {
55
81
  enumerable: true,
56
82
  get: function get() {
57
- return _types[key];
83
+ return _spec[key];
58
84
  }
59
85
  });
60
86
  });
61
- var _utils = require("./utils");
62
- Object.keys(_utils).forEach(function (key) {
87
+ var _types = require("./types");
88
+ Object.keys(_types).forEach(function (key) {
63
89
  if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _utils[key]) return;
90
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
91
+ if (key in exports && exports[key] === _types[key]) return;
65
92
  Object.defineProperty(exports, key, {
66
93
  enumerable: true,
67
94
  get: function get() {
68
- return _utils[key];
95
+ return _types[key];
69
96
  }
70
97
  });
71
- });
98
+ });
99
+ var _utils = require("./utils");
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Ok = exports.Err = void 0;
7
7
  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); }
8
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
- 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); } }
10
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
9
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
10
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
12
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
13
  var Ok = exports.Ok = function () {
@@ -1,6 +1,7 @@
1
- import type { ContractClientOptions, Tx } from "./types";
2
- import { SorobanRpc } from "..";
3
- import { AssembledTransaction } from "./assembled_transaction";
1
+ /// <reference types="node" />
2
+ import { Server } from "../rpc/server";
3
+ import { Api } from "../rpc/api";
4
+ import type { AssembledTransaction } from "./assembled_transaction";
4
5
  /**
5
6
  * A transaction that has been sent to the Soroban network. This happens in two steps:
6
7
  *
@@ -16,56 +17,64 @@ import { AssembledTransaction } from "./assembled_transaction";
16
17
  * `getTransactionResponse`.
17
18
  */
18
19
  export declare class SentTransaction<T> {
19
- signTransaction: ContractClientOptions["signTransaction"];
20
20
  assembled: AssembledTransaction<T>;
21
- server: SorobanRpc.Server;
22
- signed?: Tx;
21
+ server: Server;
23
22
  /**
24
23
  * The result of calling `sendTransaction` to broadcast the transaction to the
25
24
  * network.
26
25
  */
27
- sendTransactionResponse?: SorobanRpc.Api.SendTransactionResponse;
26
+ sendTransactionResponse?: Api.SendTransactionResponse;
28
27
  /**
29
28
  * If `sendTransaction` completes successfully (which means it has `status: 'PENDING'`),
30
29
  * then `getTransaction` will be called in a loop for
31
30
  * {@link MethodOptions.timeoutInSeconds} seconds. This array contains all
32
31
  * the results of those calls.
33
32
  */
34
- getTransactionResponseAll?: SorobanRpc.Api.GetTransactionResponse[];
33
+ getTransactionResponseAll?: Api.GetTransactionResponse[];
35
34
  /**
36
35
  * The most recent result of calling `getTransaction`, from the
37
36
  * `getTransactionResponseAll` array.
38
37
  */
39
- getTransactionResponse?: SorobanRpc.Api.GetTransactionResponse;
38
+ getTransactionResponse?: Api.GetTransactionResponse;
40
39
  static Errors: {
41
40
  SendFailed: {
42
- new (message?: string): {
41
+ new (message?: string | undefined): {
43
42
  name: string;
44
43
  message: string;
45
44
  stack?: string | undefined;
46
45
  };
47
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
46
+ captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
48
47
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
49
48
  stackTraceLimit: number;
50
49
  };
51
50
  SendResultOnly: {
52
- new (message?: string): {
51
+ new (message?: string | undefined): {
53
52
  name: string;
54
53
  message: string;
55
54
  stack?: string | undefined;
56
55
  };
57
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
56
+ captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
57
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
58
+ stackTraceLimit: number;
59
+ };
60
+ TransactionStillPending: {
61
+ new (message?: string | undefined): {
62
+ name: string;
63
+ message: string;
64
+ stack?: string | undefined;
65
+ };
66
+ captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
58
67
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
59
68
  stackTraceLimit: number;
60
69
  };
61
70
  };
62
- constructor(signTransaction: ContractClientOptions["signTransaction"], assembled: AssembledTransaction<T>);
71
+ constructor(_: any, // deprecated: used to take sentTransaction, need to wait for major release for breaking change
72
+ assembled: AssembledTransaction<T>);
63
73
  /**
64
- * Initialize a `SentTransaction` from an existing `AssembledTransaction` and
65
- * a `signTransaction` function. This will also send the transaction to the
66
- * network.
74
+ * Initialize a `SentTransaction` from `options` and a `signed`
75
+ * AssembledTransaction. This will also send the transaction to the network.
67
76
  */
68
- static init: <T_1>(signTransaction: ContractClientOptions["signTransaction"], assembled: AssembledTransaction<T_1>) => Promise<SentTransaction<T_1>>;
77
+ static init: <U>(_: any, assembled: AssembledTransaction<U>) => Promise<SentTransaction<U>>;
69
78
  private send;
70
79
  get result(): T;
71
80
  }