@stellar/stellar-sdk 14.3.2 → 14.4.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 (143) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/stellar-sdk-minimal.js +7222 -7108
  3. package/dist/stellar-sdk-minimal.min.js +1 -1
  4. package/dist/stellar-sdk-no-axios.js +3460 -3346
  5. package/dist/stellar-sdk-no-axios.min.js +1 -1
  6. package/dist/stellar-sdk-no-eventsource.js +7213 -7099
  7. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  8. package/dist/stellar-sdk.js +8051 -7937
  9. package/dist/stellar-sdk.min.js +1 -1
  10. package/lib/config.d.ts +2 -6
  11. package/lib/contract/assembled_transaction.d.ts +16 -132
  12. package/lib/contract/assembled_transaction.js +14 -114
  13. package/lib/contract/errors.d.ts +26 -0
  14. package/lib/contract/errors.js +126 -0
  15. package/lib/contract/sent_transaction.d.ts +1 -1
  16. package/lib/contract/spec.d.ts +2 -2
  17. package/lib/contract/spec.js +40 -28
  18. package/lib/contract/types.d.ts +35 -9
  19. package/lib/contract/utils.d.ts +1 -1
  20. package/lib/contract/utils.js +18 -53
  21. package/lib/contract/wasm_spec_parser.d.ts +7 -0
  22. package/lib/contract/wasm_spec_parser.js +15 -0
  23. package/lib/errors/network.d.ts +1 -1
  24. package/lib/federation/server.d.ts +7 -7
  25. package/lib/horizon/horizon_axios_client.js +1 -1
  26. package/lib/horizon/server.d.ts +1 -1
  27. package/lib/horizon/server.js +2 -2
  28. package/lib/index.d.ts +0 -3
  29. package/lib/minimal/config.d.ts +2 -6
  30. package/lib/minimal/contract/assembled_transaction.d.ts +16 -132
  31. package/lib/minimal/contract/assembled_transaction.js +14 -114
  32. package/lib/minimal/contract/errors.d.ts +26 -0
  33. package/lib/minimal/contract/errors.js +126 -0
  34. package/lib/minimal/contract/sent_transaction.d.ts +1 -1
  35. package/lib/minimal/contract/spec.d.ts +2 -2
  36. package/lib/minimal/contract/spec.js +40 -28
  37. package/lib/minimal/contract/types.d.ts +35 -9
  38. package/lib/minimal/contract/utils.d.ts +1 -1
  39. package/lib/minimal/contract/utils.js +18 -53
  40. package/lib/minimal/contract/wasm_spec_parser.d.ts +7 -0
  41. package/lib/minimal/contract/wasm_spec_parser.js +15 -0
  42. package/lib/minimal/errors/network.d.ts +1 -1
  43. package/lib/minimal/federation/server.d.ts +7 -7
  44. package/lib/minimal/horizon/horizon_axios_client.js +1 -1
  45. package/lib/minimal/horizon/server.d.ts +1 -1
  46. package/lib/minimal/horizon/server.js +2 -2
  47. package/lib/minimal/index.d.ts +0 -3
  48. package/lib/minimal/rpc/api.d.ts +27 -3
  49. package/lib/minimal/rpc/axios.js +1 -1
  50. package/lib/minimal/rpc/jsonrpc.d.ts +2 -1
  51. package/lib/minimal/rpc/jsonrpc.js +1 -1
  52. package/lib/minimal/rpc/parsers.js +8 -5
  53. package/lib/minimal/rpc/server.d.ts +46 -7
  54. package/lib/minimal/rpc/server.js +290 -211
  55. package/lib/minimal/rpc/utils.js +1 -1
  56. package/lib/minimal/webauth/challenge_transaction.d.ts +235 -0
  57. package/lib/minimal/webauth/challenge_transaction.js +307 -0
  58. package/lib/minimal/webauth/index.d.ts +1 -0
  59. package/lib/minimal/webauth/index.js +13 -1
  60. package/lib/minimal/webauth/utils.d.ts +28 -273
  61. package/lib/minimal/webauth/utils.js +12 -288
  62. package/lib/no-axios/config.d.ts +2 -6
  63. package/lib/no-axios/contract/assembled_transaction.d.ts +16 -132
  64. package/lib/no-axios/contract/assembled_transaction.js +14 -114
  65. package/lib/no-axios/contract/errors.d.ts +26 -0
  66. package/lib/no-axios/contract/errors.js +126 -0
  67. package/lib/no-axios/contract/sent_transaction.d.ts +1 -1
  68. package/lib/no-axios/contract/spec.d.ts +2 -2
  69. package/lib/no-axios/contract/spec.js +40 -28
  70. package/lib/no-axios/contract/types.d.ts +35 -9
  71. package/lib/no-axios/contract/utils.d.ts +1 -1
  72. package/lib/no-axios/contract/utils.js +18 -53
  73. package/lib/no-axios/contract/wasm_spec_parser.d.ts +7 -0
  74. package/lib/no-axios/contract/wasm_spec_parser.js +15 -0
  75. package/lib/no-axios/errors/network.d.ts +1 -1
  76. package/lib/no-axios/federation/server.d.ts +7 -7
  77. package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
  78. package/lib/no-axios/horizon/server.d.ts +1 -1
  79. package/lib/no-axios/horizon/server.js +2 -2
  80. package/lib/no-axios/index.d.ts +0 -3
  81. package/lib/no-axios/rpc/api.d.ts +27 -3
  82. package/lib/no-axios/rpc/axios.js +1 -1
  83. package/lib/no-axios/rpc/jsonrpc.d.ts +2 -1
  84. package/lib/no-axios/rpc/jsonrpc.js +1 -1
  85. package/lib/no-axios/rpc/parsers.js +8 -5
  86. package/lib/no-axios/rpc/server.d.ts +46 -7
  87. package/lib/no-axios/rpc/server.js +290 -211
  88. package/lib/no-axios/rpc/utils.js +1 -1
  89. package/lib/no-axios/webauth/challenge_transaction.d.ts +235 -0
  90. package/lib/no-axios/webauth/challenge_transaction.js +307 -0
  91. package/lib/no-axios/webauth/index.d.ts +1 -0
  92. package/lib/no-axios/webauth/index.js +13 -1
  93. package/lib/no-axios/webauth/utils.d.ts +28 -273
  94. package/lib/no-axios/webauth/utils.js +12 -288
  95. package/lib/no-eventsource/config.d.ts +2 -6
  96. package/lib/no-eventsource/contract/assembled_transaction.d.ts +16 -132
  97. package/lib/no-eventsource/contract/assembled_transaction.js +14 -114
  98. package/lib/no-eventsource/contract/errors.d.ts +26 -0
  99. package/lib/no-eventsource/contract/errors.js +126 -0
  100. package/lib/no-eventsource/contract/sent_transaction.d.ts +1 -1
  101. package/lib/no-eventsource/contract/spec.d.ts +2 -2
  102. package/lib/no-eventsource/contract/spec.js +40 -28
  103. package/lib/no-eventsource/contract/types.d.ts +35 -9
  104. package/lib/no-eventsource/contract/utils.d.ts +1 -1
  105. package/lib/no-eventsource/contract/utils.js +18 -53
  106. package/lib/no-eventsource/contract/wasm_spec_parser.d.ts +7 -0
  107. package/lib/no-eventsource/contract/wasm_spec_parser.js +15 -0
  108. package/lib/no-eventsource/errors/network.d.ts +1 -1
  109. package/lib/no-eventsource/federation/server.d.ts +7 -7
  110. package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
  111. package/lib/no-eventsource/horizon/server.d.ts +1 -1
  112. package/lib/no-eventsource/horizon/server.js +2 -2
  113. package/lib/no-eventsource/index.d.ts +0 -3
  114. package/lib/no-eventsource/rpc/api.d.ts +27 -3
  115. package/lib/no-eventsource/rpc/axios.js +1 -1
  116. package/lib/no-eventsource/rpc/jsonrpc.d.ts +2 -1
  117. package/lib/no-eventsource/rpc/jsonrpc.js +1 -1
  118. package/lib/no-eventsource/rpc/parsers.js +8 -5
  119. package/lib/no-eventsource/rpc/server.d.ts +46 -7
  120. package/lib/no-eventsource/rpc/server.js +290 -211
  121. package/lib/no-eventsource/rpc/utils.js +1 -1
  122. package/lib/no-eventsource/webauth/challenge_transaction.d.ts +235 -0
  123. package/lib/no-eventsource/webauth/challenge_transaction.js +307 -0
  124. package/lib/no-eventsource/webauth/index.d.ts +1 -0
  125. package/lib/no-eventsource/webauth/index.js +13 -1
  126. package/lib/no-eventsource/webauth/utils.d.ts +28 -273
  127. package/lib/no-eventsource/webauth/utils.js +12 -288
  128. package/lib/rpc/api.d.ts +27 -3
  129. package/lib/rpc/axios.js +1 -1
  130. package/lib/rpc/jsonrpc.d.ts +2 -1
  131. package/lib/rpc/jsonrpc.js +1 -1
  132. package/lib/rpc/parsers.js +8 -5
  133. package/lib/rpc/server.d.ts +46 -7
  134. package/lib/rpc/server.js +290 -211
  135. package/lib/rpc/utils.js +1 -1
  136. package/lib/webauth/challenge_transaction.d.ts +235 -0
  137. package/lib/webauth/challenge_transaction.js +307 -0
  138. package/lib/webauth/index.d.ts +1 -0
  139. package/lib/webauth/index.js +13 -1
  140. package/lib/webauth/utils.d.ts +28 -273
  141. package/lib/webauth/utils.js +12 -288
  142. package/package.json +14 -14
  143. package/types/dom-monkeypatch.d.ts +1 -1
@@ -7,10 +7,7 @@ exports.Spec = void 0;
7
7
  var _stellarBase = require("@stellar/stellar-base");
8
8
  var _rust_result = require("./rust_result");
9
9
  var _utils = require("./utils");
10
- function _regenerator() { var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
11
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
12
- 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); }
13
- 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); }); }; }
10
+ var _wasm_spec_parser = require("./wasm_spec_parser");
14
11
  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; }
15
12
  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; }
16
13
  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); }
@@ -88,6 +85,7 @@ function stringToScVal(str, ty) {
88
85
  case _stellarBase.xdr.ScSpecType.scSpecTypeSymbol().value:
89
86
  return _stellarBase.xdr.ScVal.scvSymbol(str);
90
87
  case _stellarBase.xdr.ScSpecType.scSpecTypeAddress().value:
88
+ case _stellarBase.xdr.ScSpecType.scSpecTypeMuxedAddress().value:
91
89
  return _stellarBase.Address.fromString(str).toScVal();
92
90
  case _stellarBase.xdr.ScSpecType.scSpecTypeU64().value:
93
91
  return new _stellarBase.XdrLargeInt("u64", str).toScVal();
@@ -104,6 +102,14 @@ function stringToScVal(str, ty) {
104
102
  case _stellarBase.xdr.ScSpecType.scSpecTypeBytes().value:
105
103
  case _stellarBase.xdr.ScSpecType.scSpecTypeBytesN().value:
106
104
  return _stellarBase.xdr.ScVal.scvBytes(Buffer.from(str, "base64"));
105
+ case _stellarBase.xdr.ScSpecType.scSpecTypeTimepoint().value:
106
+ {
107
+ return _stellarBase.xdr.ScVal.scvTimepoint(new _stellarBase.xdr.Uint64(str));
108
+ }
109
+ case _stellarBase.xdr.ScSpecType.scSpecTypeDuration().value:
110
+ {
111
+ return _stellarBase.xdr.ScVal.scvDuration(new _stellarBase.xdr.Uint64(str));
112
+ }
107
113
  default:
108
114
  throw new TypeError("invalid type ".concat(ty.name, " specified for string value"));
109
115
  }
@@ -125,6 +131,18 @@ var PRIMITIVE_DEFINITONS = {
125
131
  minLength: 1,
126
132
  maxLength: 20
127
133
  },
134
+ Timepoint: {
135
+ type: "string",
136
+ pattern: "^([1-9][0-9]*|0)$",
137
+ minLength: 1,
138
+ maxLength: 20
139
+ },
140
+ Duration: {
141
+ type: "string",
142
+ pattern: "^([1-9][0-9]*|0)$",
143
+ minLength: 1,
144
+ maxLength: 20
145
+ },
128
146
  I64: {
129
147
  type: "string",
130
148
  pattern: "^(-?[1-9][0-9]*|0)$",
@@ -160,6 +178,11 @@ var PRIMITIVE_DEFINITONS = {
160
178
  format: "address",
161
179
  description: "Address can be a public key or contract id"
162
180
  },
181
+ MuxedAddress: {
182
+ type: "string",
183
+ format: "address",
184
+ description: "Stellar public key with M prefix combining a G address and unique ID"
185
+ },
163
186
  ScString: {
164
187
  type: "string",
165
188
  description: "ScString is a string"
@@ -222,13 +245,11 @@ function typeRef(typeDef) {
222
245
  }
223
246
  case _stellarBase.xdr.ScSpecType.scSpecTypeTimepoint().value:
224
247
  {
225
- throw new Error("Timepoint type not supported");
226
248
  ref = "Timepoint";
227
249
  break;
228
250
  }
229
251
  case _stellarBase.xdr.ScSpecType.scSpecTypeDuration().value:
230
252
  {
231
- throw new Error("Duration not supported");
232
253
  ref = "Duration";
233
254
  break;
234
255
  }
@@ -272,6 +293,11 @@ function typeRef(typeDef) {
272
293
  ref = "Address";
273
294
  break;
274
295
  }
296
+ case _stellarBase.xdr.ScSpecType.scSpecTypeMuxedAddress().value:
297
+ {
298
+ ref = "MuxedAddress";
299
+ break;
300
+ }
275
301
  case _stellarBase.xdr.ScSpecType.scSpecTypeOption().value:
276
302
  {
277
303
  var opt = typeDef.option();
@@ -690,6 +716,8 @@ var Spec = exports.Spec = function () {
690
716
  case _stellarBase.xdr.ScSpecType.scSpecTypeI128().value:
691
717
  case _stellarBase.xdr.ScSpecType.scSpecTypeU256().value:
692
718
  case _stellarBase.xdr.ScSpecType.scSpecTypeI256().value:
719
+ case _stellarBase.xdr.ScSpecType.scSpecTypeTimepoint().value:
720
+ case _stellarBase.xdr.ScSpecType.scSpecTypeDuration().value:
693
721
  {
694
722
  var intType = t.name.substring(10).toLowerCase();
695
723
  return new _stellarBase.XdrLargeInt(intType, val).toScVal();
@@ -839,6 +867,8 @@ var Spec = exports.Spec = function () {
839
867
  return null;
840
868
  case _stellarBase.xdr.ScValType.scvU64().value:
841
869
  case _stellarBase.xdr.ScValType.scvI64().value:
870
+ case _stellarBase.xdr.ScValType.scvTimepoint().value:
871
+ case _stellarBase.xdr.ScValType.scvDuration().value:
842
872
  case _stellarBase.xdr.ScValType.scvU128().value:
843
873
  case _stellarBase.xdr.ScValType.scvI128().value:
844
874
  case _stellarBase.xdr.ScValType.scvU256().value:
@@ -894,9 +924,6 @@ var Spec = exports.Spec = function () {
894
924
  }
895
925
  return (_scv$value = scv.value()) === null || _scv$value === void 0 ? void 0 : _scv$value.toString();
896
926
  }
897
- case _stellarBase.xdr.ScValType.scvTimepoint().value:
898
- case _stellarBase.xdr.ScValType.scvDuration().value:
899
- return (0, _stellarBase.scValToBigInt)(_stellarBase.xdr.ScVal.scvU64(scv.u64()));
900
927
  default:
901
928
  throw new TypeError("failed to convert ".concat(JSON.stringify(scv, null, 2), " to native type from type ").concat(t.name));
902
929
  }
@@ -1034,24 +1061,9 @@ var Spec = exports.Spec = function () {
1034
1061
  }
1035
1062
  }], [{
1036
1063
  key: "fromWasm",
1037
- value: (function () {
1038
- var _fromWasm = _asyncToGenerator(_regenerator().m(function _callee(wasm) {
1039
- var spec;
1040
- return _regenerator().w(function (_context) {
1041
- while (1) switch (_context.n) {
1042
- case 0:
1043
- _context.n = 1;
1044
- return (0, _utils.specFromWasm)(wasm);
1045
- case 1:
1046
- spec = _context.v;
1047
- return _context.a(2, new Spec(spec));
1048
- }
1049
- }, _callee);
1050
- }));
1051
- function fromWasm(_x) {
1052
- return _fromWasm.apply(this, arguments);
1053
- }
1054
- return fromWasm;
1055
- }())
1064
+ value: function fromWasm(wasm) {
1065
+ var spec = (0, _wasm_spec_parser.specFromWasm)(wasm);
1066
+ return new Spec(spec);
1067
+ }
1056
1068
  }]);
1057
1069
  }();
@@ -42,7 +42,7 @@ export type u256 = bigint;
42
42
  */
43
43
  export type i256 = bigint;
44
44
  export type Option<T> = T | undefined;
45
- export type Typepoint = bigint;
45
+ export type Timepoint = bigint;
46
46
  export type Duration = bigint;
47
47
  /**
48
48
  * A "regular" transaction, as opposed to a FeeBumpTransaction.
@@ -111,18 +111,16 @@ export type SignAuthEntry = (authEntry: string, opts?: {
111
111
  */
112
112
  export type ClientOptions = {
113
113
  /**
114
- * The public key of the account that will send this transaction. You can
115
- * override this for specific methods later, like
116
- * [signAndSend]{@link module:contract.AssembledTransaction#signAndSend} and
117
- * [signAuthEntries]{@link module:contract.AssembledTransaction#signAuthEntries}.
114
+ * The public key of the source account for this transaction. You can
115
+ * override this for specific methods later; see {@link MethodOptions}.
118
116
  */
119
117
  publicKey?: string;
120
118
  /**
121
119
  * A function to sign the transaction using the private key corresponding to
122
120
  * the given `publicKey`. You do not need to provide this, for read-only
123
- * calls, which only need to be simulated. If you do not need to sign and
124
- * send, there is no need to provide this. If you do not provide it during
125
- * initialization, you can provide it later when you call
121
+ * calls, which only need to be simulated. If you do not provide it during
122
+ * initialization, you can provide it later, either when you initialize a
123
+ * method (see {@link MethodOptions}) or when you call
126
124
  * {@link module:contract.AssembledTransaction#signAndSend signAndSend}.
127
125
  *
128
126
  * Matches signature of `signTransaction` from Freighter.
@@ -133,7 +131,8 @@ export type ClientOptions = {
133
131
  * private key corresponding to the provided `publicKey`. This is only needed
134
132
  * for multi-auth transactions, in which one transaction is signed by
135
133
  * multiple parties. If you do not provide it during initialization, you can
136
- * provide it later when you call {@link module:contract.AssembledTransaction#signAuthEntries signAuthEntries}.
134
+ * provide it later either when you initialize a method (see {@link MethodOptions})
135
+ * or when you call {@link module:contract.AssembledTransaction#signAuthEntries signAuthEntries}.
137
136
  *
138
137
  * Matches signature of `signAuthEntry` from Freighter.
139
138
  */
@@ -212,6 +211,33 @@ export type MethodOptions = {
212
211
  * @default false
213
212
  */
214
213
  restore?: boolean;
214
+ /**
215
+ * The public key of the source account for this transaction.
216
+ *
217
+ * Default: the one provided to the {@link Client} in {@link ClientOptions}
218
+ */
219
+ publicKey?: string;
220
+ /**
221
+ * A function to sign the transaction using the private key corresponding to
222
+ * the given `publicKey`. You do not need to provide this, for read-only
223
+ * calls, which only need to be simulated.
224
+ *
225
+ * Matches signature of `signTransaction` from Freighter.
226
+ *
227
+ * Default: the one provided to the {@link Client} in {@link ClientOptions}
228
+ */
229
+ signTransaction?: SignTransaction;
230
+ /**
231
+ * A function to sign a specific auth entry for a transaction, using the
232
+ * private key corresponding to the provided `publicKey`. This is only needed
233
+ * for multi-auth transactions, in which one transaction is signed by
234
+ * multiple parties.
235
+ *
236
+ * Matches signature of `signAuthEntry` from Freighter.
237
+ *
238
+ * Default: the one provided to the {@link Client} in {@link ClientOptions}
239
+ */
240
+ signAuthEntry?: SignAuthEntry;
215
241
  };
216
242
  export type AssembledTransactionOptions<T = string> = MethodOptions & ClientOptions & {
217
243
  method: string;
@@ -38,7 +38,7 @@ export declare function implementsToString(
38
38
  obj: unknown): obj is {
39
39
  toString(): string;
40
40
  };
41
- export declare function specFromWasm(wasm: Buffer): Promise<Buffer>;
41
+ export declare function parseWasmCustomSections(buffer: Buffer): Map<string, Uint8Array[]>;
42
42
  /**
43
43
  * Reads a binary stream of ScSpecEntries into an array for processing by ContractSpec
44
44
  * @private
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.contractErrorPattern = void 0;
7
7
  exports.getAccount = getAccount;
8
8
  exports.implementsToString = implementsToString;
9
+ exports.parseWasmCustomSections = parseWasmCustomSections;
9
10
  exports.processSpecEntryStream = processSpecEntryStream;
10
- exports.specFromWasm = specFromWasm;
11
11
  exports.withExponentialBackoff = withExponentialBackoff;
12
12
  var _stellarBase = require("@stellar/stellar-base");
13
13
  var _types = require("./types");
@@ -101,41 +101,6 @@ var contractErrorPattern = exports.contractErrorPattern = /Error\(Contract, #(\d
101
101
  function implementsToString(obj) {
102
102
  return _typeof(obj) === "object" && obj !== null && "toString" in obj;
103
103
  }
104
- function specFromWasm(_x4) {
105
- return _specFromWasm.apply(this, arguments);
106
- }
107
- function _specFromWasm() {
108
- _specFromWasm = _asyncToGenerator(_regenerator().m(function _callee2(wasm) {
109
- var xdrSections, wasmModule, customData, _t3;
110
- return _regenerator().w(function (_context2) {
111
- while (1) switch (_context2.p = _context2.n) {
112
- case 0:
113
- _context2.p = 0;
114
- _context2.n = 1;
115
- return WebAssembly.compile(wasm);
116
- case 1:
117
- wasmModule = _context2.v;
118
- xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
119
- _context2.n = 3;
120
- break;
121
- case 2:
122
- _context2.p = 2;
123
- _t3 = _context2.v;
124
- customData = parseWasmCustomSections(wasm);
125
- xdrSections = customData.get("contractspecv0");
126
- case 3:
127
- if (!(!xdrSections || xdrSections.length === 0)) {
128
- _context2.n = 4;
129
- break;
130
- }
131
- throw new Error("Could not obtain contract spec from wasm");
132
- case 4:
133
- return _context2.a(2, Buffer.from(xdrSections[0]));
134
- }
135
- }, _callee2, null, [[0, 2]]);
136
- }));
137
- return _specFromWasm.apply(this, arguments);
138
- }
139
104
  function parseWasmCustomSections(buffer) {
140
105
  var sections = new Map();
141
106
  var arrayBuffer = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
@@ -146,6 +111,17 @@ function parseWasmCustomSections(buffer) {
146
111
  offset += length;
147
112
  return bytes;
148
113
  };
114
+ function readVarUint32() {
115
+ var value = 0;
116
+ var shift = 0;
117
+ while (true) {
118
+ var byte = read(1)[0];
119
+ value |= (byte & 0x7f) << shift;
120
+ if ((byte & 0x80) === 0) break;
121
+ if ((shift += 7) >= 32) throw new Error("Invalid WASM value");
122
+ }
123
+ return value >>> 0;
124
+ }
149
125
  if (_toConsumableArray(read(4)).join() !== "0,97,115,109") throw new Error("Invalid WASM magic");
150
126
  if (_toConsumableArray(read(4)).join() !== "1,0,0,0") throw new Error("Invalid WASM version");
151
127
  while (offset < buffer.byteLength) {
@@ -169,17 +145,6 @@ function parseWasmCustomSections(buffer) {
169
145
  offset += sectionLength;
170
146
  }
171
147
  }
172
- function readVarUint32() {
173
- var value = 0,
174
- shift = 0;
175
- while (true) {
176
- var byte = read(1)[0];
177
- value |= (byte & 0x7f) << shift;
178
- if ((byte & 0x80) === 0) break;
179
- if ((shift += 7) >= 32) throw new Error("Invalid WASM value");
180
- }
181
- return value >>> 0;
182
- }
183
148
  return sections;
184
149
  }
185
150
  function processSpecEntryStream(buffer) {
@@ -190,17 +155,17 @@ function processSpecEntryStream(buffer) {
190
155
  }
191
156
  return res;
192
157
  }
193
- function getAccount(_x5, _x6) {
158
+ function getAccount(_x4, _x5) {
194
159
  return _getAccount.apply(this, arguments);
195
160
  }
196
161
  function _getAccount() {
197
- _getAccount = _asyncToGenerator(_regenerator().m(function _callee3(options, server) {
198
- return _regenerator().w(function (_context3) {
199
- while (1) switch (_context3.n) {
162
+ _getAccount = _asyncToGenerator(_regenerator().m(function _callee2(options, server) {
163
+ return _regenerator().w(function (_context2) {
164
+ while (1) switch (_context2.n) {
200
165
  case 0:
201
- return _context3.a(2, options.publicKey ? server.getAccount(options.publicKey) : new _stellarBase.Account(_types.NULL_ACCOUNT, "0"));
166
+ return _context2.a(2, options.publicKey ? server.getAccount(options.publicKey) : new _stellarBase.Account(_types.NULL_ACCOUNT, "0"));
202
167
  }
203
- }, _callee3);
168
+ }, _callee2);
204
169
  }));
205
170
  return _getAccount.apply(this, arguments);
206
171
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Obtains the contract spec XDR from a contract's wasm binary.
3
+ * @param wasm The contract's wasm binary as a Buffer.
4
+ * @returns The XDR buffer representing the contract spec.
5
+ * @throws {Error} If the contract spec cannot be obtained from the provided wasm binary.
6
+ */
7
+ export declare function specFromWasm(wasm: Buffer): Buffer;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.specFromWasm = specFromWasm;
7
+ var _utils = require("./utils");
8
+ function specFromWasm(wasm) {
9
+ var customData = (0, _utils.parseWasmCustomSections)(wasm);
10
+ var xdrSections = customData.get("contractspecv0");
11
+ if (!xdrSections || xdrSections.length === 0) {
12
+ throw new Error("Could not obtain contract spec from wasm");
13
+ }
14
+ return Buffer.from(xdrSections[0]);
15
+ }
@@ -21,7 +21,7 @@ export declare class NetworkError extends Error {
21
21
  constructor(message: string, response: any);
22
22
  /**
23
23
  * Returns the error response sent by the Horizon server.
24
- * @returns {any}
24
+ * @returns {any} Response details, received from the Horizon server.
25
25
  */
26
26
  getResponse(): {
27
27
  data?: HorizonApi.ErrorResponseData;
@@ -56,7 +56,7 @@ export declare class FederationServer {
56
56
  * @param {string} value Stellar Address (ex. `bob*stellar.org`)
57
57
  * @param {object} [opts] Options object
58
58
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
59
- * @throws Will throw an error if the provided account ID is not a valid Ed25519 public key.
59
+ * @throws {Error} Will throw an error if the provided account ID is not a valid Ed25519 public key.
60
60
  */
61
61
  static resolve(value: string, opts?: Api.Options): Promise<Api.Record>;
62
62
  /**
@@ -80,7 +80,7 @@ export declare class FederationServer {
80
80
  * @param {string} domain Domain to get federation server for
81
81
  * @param {module:Federation.Api.Options} [opts] Options object
82
82
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
83
- * @throws Will throw an error if the domain's stellar.toml file does not contain a federation server field.
83
+ * @throws {Error} Will throw an error if the domain's stellar.toml file does not contain a federation server field.
84
84
  */
85
85
  static createForDomain(domain: string, opts?: Api.Options): Promise<FederationServer>;
86
86
  constructor(serverURL: string, domain: string, opts?: Api.Options);
@@ -89,7 +89,7 @@ export declare class FederationServer {
89
89
  * @see <a href="https://developers.stellar.org/docs/encyclopedia/federation" target="_blank">Federation doc</a>
90
90
  * @param {string} address Stellar address (ex. `bob*stellar.org`). If `FederationServer` was instantiated with `domain` param only username (ex. `bob`) can be passed.
91
91
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
92
- * @throws Will throw an error if the federated address does not contain a domain, or if the server object was not instantiated with a `domain` parameter
92
+ * @throws {Error} Will throw an error if the federated address does not contain a domain, or if the server object was not instantiated with a `domain` parameter
93
93
  */
94
94
  resolveAddress(address: string): Promise<Api.Record>;
95
95
  /**
@@ -97,8 +97,8 @@ export declare class FederationServer {
97
97
  * @see <a href="https://developers.stellar.org/docs/encyclopedia/federation" target="_blank">Federation doc</a>
98
98
  * @param {string} accountId Account ID (ex. `GBYNR2QJXLBCBTRN44MRORCMI4YO7FZPFBCNOKTOBCAAFC7KC3LNPRYS`)
99
99
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
100
- * @throws Will throw an error if the federation server returns an invalid memo value.
101
- * @throws Will throw an error if the federation server's response exceeds the allowed maximum size.
100
+ * @throws {Error} Will throw an error if the federation server returns an invalid memo value.
101
+ * @throws {Error} Will throw an error if the federation server's response exceeds the allowed maximum size.
102
102
  * @throws {BadResponseError} Will throw an error if the server query fails with an improper response.
103
103
  */
104
104
  resolveAccountId(accountId: string): Promise<Api.Record>;
@@ -107,8 +107,8 @@ export declare class FederationServer {
107
107
  * @see <a href="https://developers.stellar.org/docs/glossary/federation/" target="_blank">Federation doc</a>
108
108
  * @param {string} transactionId Transaction ID (ex. `3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889`)
109
109
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
110
- * @throws Will throw an error if the federation server returns an invalid memo value.
111
- * @throws Will throw an error if the federation server's response exceeds the allowed maximum size.
110
+ * @throws {Error} Will throw an error if the federation server returns an invalid memo value.
111
+ * @throws {Error} Will throw an error if the federation server's response exceeds the allowed maximum size.
112
112
  * @throws {BadResponseError} Will throw an error if the server query fails with an improper response.
113
113
  */
114
114
  resolveTransactionId(transactionId: string): Promise<Api.Record>;
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  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; }
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
18
  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); }
19
- var version = exports.version = "14.3.2";
19
+ var version = exports.version = "14.4.0";
20
20
  var SERVER_TIME_MAP = exports.SERVER_TIME_MAP = {};
21
21
  function toSeconds(ms) {
22
22
  return Math.floor(ms / 1000);
@@ -83,7 +83,7 @@ export declare class HorizonServer {
83
83
  * @param {number} seconds Number of seconds past the current time to wait.
84
84
  * @param {boolean} [_isRetry] True if this is a retry. Only set this internally!
85
85
  * This is to avoid a scenario where Horizon is horking up the wrong date.
86
- * @returns {Promise<Timebounds>} Promise that resolves a `timebounds` object
86
+ * @returns {Promise<module:HorizonServer.Timebounds>} Promise that resolves a `Timebounds` object
87
87
  * (with the shape `{ minTime: 0, maxTime: N }`) that you can set the `timebounds` option to.
88
88
  */
89
89
  fetchTimebounds(seconds: number, _isRetry?: boolean): Promise<HorizonServer.Timebounds>;
@@ -193,7 +193,7 @@ var HorizonServer = exports.HorizonServer = function () {
193
193
  return this.checkMemoRequired(transaction);
194
194
  case 1:
195
195
  tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
196
- return _context5.a(2, this.httpClient.post(this.serverURL.segment("transactions").toString(), "tx=".concat(tx), {
196
+ return _context5.a(2, this.httpClient.post(this.serverURL.clone().segment("transactions").toString(), "tx=".concat(tx), {
197
197
  timeout: SUBMIT_TRANSACTION_TIMEOUT,
198
198
  headers: {
199
199
  "Content-Type": "application/x-www-form-urlencoded"
@@ -334,7 +334,7 @@ var HorizonServer = exports.HorizonServer = function () {
334
334
  return this.checkMemoRequired(transaction);
335
335
  case 1:
336
336
  tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
337
- return _context6.a(2, this.httpClient.post(this.serverURL.segment("transactions_async").toString(), "tx=".concat(tx), {
337
+ return _context6.a(2, this.httpClient.post(this.serverURL.clone().segment("transactions_async").toString(), "tx=".concat(tx), {
338
338
  headers: {
339
339
  "Content-Type": "application/x-www-form-urlencoded"
340
340
  }
@@ -11,7 +11,6 @@ export * as Horizon from "./horizon";
11
11
  * `assembleTransaction`, and the `Api` types. You can import these from the
12
12
  * `/rpc` entrypoint, if your version of Node and your TypeScript configuration
13
13
  * allow it:
14
- *
15
14
  * @example
16
15
  * import { Server } from '@stellar/stellar-sdk/rpc';
17
16
  */
@@ -21,10 +20,8 @@ export * as rpc from "./rpc";
21
20
  * `AssembledTransaction`. You can import these from the `/contract`
22
21
  * entrypoint, if your version of Node and your TypeScript configuration allow
23
22
  * it:
24
- *
25
23
  * @example
26
24
  * import { Client } from '@stellar/stellar-sdk/contract';
27
- * @private
28
25
  */
29
26
  export * as contract from "./contract";
30
27
  export * from "@stellar/stellar-base";
@@ -1,6 +1,9 @@
1
1
  import { Contract, SorobanDataBuilder, xdr } from "@stellar/stellar-base";
2
2
  export declare namespace Api {
3
3
  export interface GetHealthResponse {
4
+ latestLedger: number;
5
+ ledgerRetentionWindow: number;
6
+ oldestLedger: number;
4
7
  status: "healthy";
5
8
  }
6
9
  export interface LedgerEntryResult {
@@ -253,7 +256,7 @@ export declare namespace Api {
253
256
  }
254
257
  export interface RawEventResponse extends BaseEventResponse {
255
258
  contractId: string;
256
- topic: string[];
259
+ topic?: string[];
257
260
  value: string;
258
261
  }
259
262
  interface RawLedgerEntryChange {
@@ -303,7 +306,7 @@ export declare namespace Api {
303
306
  }
304
307
  export type SimulationAuthMode = "enforce" | "record" | "record_allow_nonroot";
305
308
  /**
306
- * Simplifies {@link Api.RawSimulateTransactionResponse} into separate interfaces
309
+ * Simplifies {@link RawSimulateTransactionResponse} into separate interfaces
307
310
  * based on status:
308
311
  * - on success, this includes all fields, though `result` is only present
309
312
  * if an invocation was simulated (since otherwise there's nothing to
@@ -358,9 +361,29 @@ export declare namespace Api {
358
361
  transactionData: SorobanDataBuilder;
359
362
  };
360
363
  }
364
+ /**
365
+ * Checks if a simulation response indicates an error.
366
+ * @param sim The simulation response to check.
367
+ * @returns True if the response indicates an error, false otherwise.
368
+ */
361
369
  export function isSimulationError(sim: SimulateTransactionResponse): sim is SimulateTransactionErrorResponse;
370
+ /**
371
+ * Checks if a simulation response indicates success.
372
+ * @param sim The simulation response to check.
373
+ * @returns True if the response indicates success, false otherwise.
374
+ */
362
375
  export function isSimulationSuccess(sim: SimulateTransactionResponse): sim is SimulateTransactionSuccessResponse;
376
+ /**
377
+ * Checks if a simulation response indicates that a restoration is needed.
378
+ * @param sim The simulation response to check.
379
+ * @returns True if the response indicates a restoration is needed, false otherwise.
380
+ */
363
381
  export function isSimulationRestore(sim: SimulateTransactionResponse): sim is SimulateTransactionRestoreResponse;
382
+ /**
383
+ * Checks if a simulation response is in raw (unparsed) form.
384
+ * @param sim The simulation response to check.
385
+ * @returns True if the response is raw, false otherwise.
386
+ */
364
387
  export function isSimulationRaw(sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse): sim is Api.RawSimulateTransactionResponse;
365
388
  interface RawSimulateHostFunctionResult {
366
389
  auth?: string[];
@@ -427,10 +450,11 @@ export declare namespace Api {
427
450
  latestLedger: number;
428
451
  /** present only on success, otherwise request malformed or no balance */
429
452
  balanceEntry?: {
430
- /** a 64-bit integer */
453
+ /** a 64-bit integer for trustlines, 128-bit value for contracts */
431
454
  amount: string;
432
455
  authorized: boolean;
433
456
  clawback: boolean;
457
+ revocable?: boolean;
434
458
  lastModifiedLedgerSeq?: number;
435
459
  liveUntilLedgerSeq?: number;
436
460
  };
@@ -12,7 +12,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
12
12
  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; }
13
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
14
  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); }
15
- var version = exports.version = "14.3.2";
15
+ var version = exports.version = "14.4.0";
16
16
  function createHttpClient(headers) {
17
17
  return (0, _httpClient.create)({
18
18
  headers: _objectSpread(_objectSpread({}, headers), {}, {
@@ -27,10 +27,11 @@ export interface Error<E = any> {
27
27
  /**
28
28
  * Sends the jsonrpc 'params' as a single 'param' object (no array support).
29
29
  *
30
+ * @param {HttpClient} client HttpClient instance to use for the request
30
31
  * @param {string} url URL to the RPC instance
31
32
  * @param {string} method RPC method name that should be called
32
33
  * @param {(any | null)} [param=null] params that should be supplied to the method
33
- * @returns {Promise<T>}
34
+ * @returns {Promise} Promise that resolves to the result of type T
34
35
  * @private
35
36
  */
36
37
  export declare function postObject<T>(client: HttpClient, url: string, method: string, param?: any): Promise<T>;
@@ -9,7 +9,7 @@ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try {
9
9
  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); }
10
10
  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); }); }; }
11
11
  function hasOwnProperty(obj, prop) {
12
- return obj.hasOwnProperty(prop);
12
+ return Object.prototype.hasOwnProperty.call(obj, prop);
13
13
  }
14
14
  function postObject(_x, _x2, _x3) {
15
15
  return _postObject.apply(this, arguments);
@@ -59,10 +59,12 @@ function parseTransactionInfo(raw) {
59
59
  switch (meta.switch()) {
60
60
  case 3:
61
61
  case 4:
62
- var metaV = meta.value();
63
- if (metaV.sorobanMeta() !== null) {
64
- var _metaV$sorobanMeta$re, _metaV$sorobanMeta;
65
- info.returnValue = (_metaV$sorobanMeta$re = (_metaV$sorobanMeta = metaV.sorobanMeta()) === null || _metaV$sorobanMeta === void 0 ? void 0 : _metaV$sorobanMeta.returnValue()) !== null && _metaV$sorobanMeta$re !== void 0 ? _metaV$sorobanMeta$re : undefined;
62
+ {
63
+ var metaV = meta.value();
64
+ if (metaV.sorobanMeta() !== null) {
65
+ var _metaV$sorobanMeta$re, _metaV$sorobanMeta;
66
+ info.returnValue = (_metaV$sorobanMeta$re = (_metaV$sorobanMeta = metaV.sorobanMeta()) === null || _metaV$sorobanMeta === void 0 ? void 0 : _metaV$sorobanMeta.returnValue()) !== null && _metaV$sorobanMeta$re !== void 0 ? _metaV$sorobanMeta$re : undefined;
67
+ }
66
68
  }
67
69
  }
68
70
  if (raw.diagnosticEventsXdr) {
@@ -87,12 +89,13 @@ function parseRawEvents(raw) {
87
89
  oldestLedgerCloseTime: raw.oldestLedgerCloseTime,
88
90
  cursor: raw.cursor,
89
91
  events: ((_raw$events3 = raw.events) !== null && _raw$events3 !== void 0 ? _raw$events3 : []).map(function (evt) {
92
+ var _evt$topic;
90
93
  var clone = _objectSpread({}, evt);
91
94
  delete clone.contractId;
92
95
  return _objectSpread(_objectSpread(_objectSpread({}, clone), evt.contractId !== "" && {
93
96
  contractId: new _stellarBase.Contract(evt.contractId)
94
97
  }), {}, {
95
- topic: evt.topic.map(function (topic) {
98
+ topic: ((_evt$topic = evt.topic) !== null && _evt$topic !== void 0 ? _evt$topic : []).map(function (topic) {
96
99
  return _stellarBase.xdr.ScVal.fromXDR(topic, "base64");
97
100
  }),
98
101
  value: _stellarBase.xdr.ScVal.fromXDR(evt.value, "base64")