@stellar/stellar-sdk 14.3.3 → 14.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/dist/stellar-sdk-minimal.js +7220 -7111
  3. package/dist/stellar-sdk-minimal.min.js +1 -1
  4. package/dist/stellar-sdk-no-axios.js +3454 -3345
  5. package/dist/stellar-sdk-no-axios.min.js +1 -1
  6. package/dist/stellar-sdk-no-eventsource.js +7471 -7362
  7. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  8. package/dist/stellar-sdk.js +7972 -7863
  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 +31 -28
  18. package/lib/contract/types.d.ts +47 -8
  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 +31 -28
  37. package/lib/minimal/contract/types.d.ts +47 -8
  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 +28 -4
  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 +31 -28
  70. package/lib/no-axios/contract/types.d.ts +47 -8
  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 +28 -4
  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 +31 -28
  103. package/lib/no-eventsource/contract/types.d.ts +47 -8
  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 +28 -4
  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 +28 -4
  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
package/lib/config.d.ts CHANGED
@@ -15,14 +15,11 @@ export interface Configuration {
15
15
  }
16
16
  /**
17
17
  * Global config class.
18
- *
19
18
  * @hideconstructor
20
- *
21
19
  * @example <caption>Usage in node</caption>
22
20
  * import { Config } from '@stellar/stellar-sdk';
23
21
  * Config.setAllowHttp(true);
24
22
  * Config.setTimeout(5000);
25
- *
26
23
  * @example <caption>Usage in the browser</caption>
27
24
  * StellarSdk.Config.setAllowHttp(true);
28
25
  * StellarSdk.Config.setTimeout(5000);
@@ -46,13 +43,12 @@ declare class Config {
46
43
  /**
47
44
  * Returns the configured `allowHttp` flag.
48
45
  * @static
49
- * @returns {boolean}
46
+ * @returns {boolean} The allowHttp value.
50
47
  */
51
48
  static isAllowHttp(): boolean;
52
49
  /**
53
50
  * Returns the configured `timeout` flag.
54
- * @static
55
- * @returns {number}
51
+ * @returns {number} The timeout value.
56
52
  */
57
53
  static getTimeout(): number;
58
54
  /**
@@ -3,6 +3,7 @@ import type { AssembledTransactionOptions, ClientOptions, Tx, XDR_BASE64 } from
3
3
  import { Api } from "../rpc/api";
4
4
  import { SentTransaction, Watcher } from "./sent_transaction";
5
5
  import { Spec } from "./spec";
6
+ import { ExpiredStateError, ExternalServiceError, FakeAccountError, InternalWalletError, InvalidClientRequestError, NeedsMoreSignaturesError, NoSignatureNeededError, NoSignerError, NotYetSimulatedError, NoUnsignedNonInvokerAuthEntriesError, RestoreFailureError, SimulationFailedError, UserRejectedError } from "./errors";
6
7
  /** @module contract */
7
8
  /**
8
9
  * The main workhorse of {@link Client}. This class is used to wrap a
@@ -279,136 +280,19 @@ export declare class AssembledTransaction<T> {
279
280
  * logic.
280
281
  */
281
282
  static Errors: {
282
- ExpiredState: {
283
- new (message?: string): {
284
- name: string;
285
- message: string;
286
- stack?: string;
287
- };
288
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
289
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
290
- stackTraceLimit: number;
291
- };
292
- RestorationFailure: {
293
- new (message?: string): {
294
- name: string;
295
- message: string;
296
- stack?: string;
297
- };
298
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
299
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
300
- stackTraceLimit: number;
301
- };
302
- NeedsMoreSignatures: {
303
- new (message?: string): {
304
- name: string;
305
- message: string;
306
- stack?: string;
307
- };
308
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
309
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
310
- stackTraceLimit: number;
311
- };
312
- NoSignatureNeeded: {
313
- new (message?: string): {
314
- name: string;
315
- message: string;
316
- stack?: string;
317
- };
318
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
319
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
320
- stackTraceLimit: number;
321
- };
322
- NoUnsignedNonInvokerAuthEntries: {
323
- new (message?: string): {
324
- name: string;
325
- message: string;
326
- stack?: string;
327
- };
328
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
329
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
330
- stackTraceLimit: number;
331
- };
332
- NoSigner: {
333
- new (message?: string): {
334
- name: string;
335
- message: string;
336
- stack?: string;
337
- };
338
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
339
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
340
- stackTraceLimit: number;
341
- };
342
- NotYetSimulated: {
343
- new (message?: string): {
344
- name: string;
345
- message: string;
346
- stack?: string;
347
- };
348
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
349
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
350
- stackTraceLimit: number;
351
- };
352
- FakeAccount: {
353
- new (message?: string): {
354
- name: string;
355
- message: string;
356
- stack?: string;
357
- };
358
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
359
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
360
- stackTraceLimit: number;
361
- };
362
- SimulationFailed: {
363
- new (message?: string): {
364
- name: string;
365
- message: string;
366
- stack?: string;
367
- };
368
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
369
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
370
- stackTraceLimit: number;
371
- };
372
- InternalWalletError: {
373
- new (message?: string): {
374
- name: string;
375
- message: string;
376
- stack?: string;
377
- };
378
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
379
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
380
- stackTraceLimit: number;
381
- };
382
- ExternalServiceError: {
383
- new (message?: string): {
384
- name: string;
385
- message: string;
386
- stack?: string;
387
- };
388
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
389
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
390
- stackTraceLimit: number;
391
- };
392
- InvalidClientRequest: {
393
- new (message?: string): {
394
- name: string;
395
- message: string;
396
- stack?: string;
397
- };
398
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
399
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
400
- stackTraceLimit: number;
401
- };
402
- UserRejected: {
403
- new (message?: string): {
404
- name: string;
405
- message: string;
406
- stack?: string;
407
- };
408
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
409
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
410
- stackTraceLimit: number;
411
- };
283
+ ExpiredState: typeof ExpiredStateError;
284
+ RestorationFailure: typeof RestoreFailureError;
285
+ NeedsMoreSignatures: typeof NeedsMoreSignaturesError;
286
+ NoSignatureNeeded: typeof NoSignatureNeededError;
287
+ NoUnsignedNonInvokerAuthEntries: typeof NoUnsignedNonInvokerAuthEntriesError;
288
+ NoSigner: typeof NoSignerError;
289
+ NotYetSimulated: typeof NotYetSimulatedError;
290
+ FakeAccount: typeof FakeAccountError;
291
+ SimulationFailed: typeof SimulationFailedError;
292
+ InternalWalletError: typeof InternalWalletError;
293
+ ExternalServiceError: typeof ExternalServiceError;
294
+ InvalidClientRequest: typeof InvalidClientRequestError;
295
+ UserRejected: typeof UserRejectedError;
412
296
  };
413
297
  /**
414
298
  * Serialize the AssembledTransaction to a JSON string. This is useful for
@@ -590,7 +474,7 @@ export declare class AssembledTransaction<T> {
590
474
  */
591
475
  signAuthEntry?: ClientOptions["signAuthEntry"];
592
476
  /**
593
- * If you have a pro use-case and need to override the default `authorizeEntry` function, rather than using the one in @stellar/stellar-base, you can do that! Your function needs to take at least the first argument, `entry: xdr.SorobanAuthorizationEntry`, and return a `Promise<xdr.SorobanAuthorizationEntry>`.
477
+ * If you have a pro use-case and need to override the default `authorizeEntry` function, rather than using the one in `@stellar/stellar-base`, you can do that! Your function needs to take at least the first argument, `entry: xdr.SorobanAuthorizationEntry`, and return a `Promise<xdr.SorobanAuthorizationEntry>`.
594
478
  *
595
479
  * Note that you if you pass this, then `signAuthEntry` will be ignored.
596
480
  */
@@ -620,7 +504,7 @@ export declare class AssembledTransaction<T> {
620
504
  *
621
505
  * @throws {Error} - Throws an error if no `signTransaction` function is provided during
622
506
  * Client initialization.
623
- * @throws {AssembledTransaction.Errors.RestoreFailure} - Throws a custom error if the
507
+ * @throws {RestoreFailureError} - Throws a custom error if the
624
508
  * restore transaction fails, providing the details of the failure.
625
509
  */
626
510
  restoreFootprint(
@@ -12,16 +12,7 @@ var _rust_result = require("./rust_result");
12
12
  var _utils = require("./utils");
13
13
  var _types = require("./types");
14
14
  var _sent_transaction = require("./sent_transaction");
15
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
16
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
17
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
18
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
19
- function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
20
- function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
21
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
- function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
23
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
24
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
15
+ var _errors = require("./errors");
25
16
  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); }
26
17
  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; }
27
18
  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; }
@@ -719,108 +710,17 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
719
710
  }]);
720
711
  }();
721
712
  _defineProperty(AssembledTransaction, "Errors", {
722
- ExpiredState: function (_Error) {
723
- function ExpiredStateError() {
724
- _classCallCheck(this, ExpiredStateError);
725
- return _callSuper(this, ExpiredStateError, arguments);
726
- }
727
- _inherits(ExpiredStateError, _Error);
728
- return _createClass(ExpiredStateError);
729
- }(_wrapNativeSuper(Error)),
730
- RestorationFailure: function (_Error2) {
731
- function RestoreFailureError() {
732
- _classCallCheck(this, RestoreFailureError);
733
- return _callSuper(this, RestoreFailureError, arguments);
734
- }
735
- _inherits(RestoreFailureError, _Error2);
736
- return _createClass(RestoreFailureError);
737
- }(_wrapNativeSuper(Error)),
738
- NeedsMoreSignatures: function (_Error3) {
739
- function NeedsMoreSignaturesError() {
740
- _classCallCheck(this, NeedsMoreSignaturesError);
741
- return _callSuper(this, NeedsMoreSignaturesError, arguments);
742
- }
743
- _inherits(NeedsMoreSignaturesError, _Error3);
744
- return _createClass(NeedsMoreSignaturesError);
745
- }(_wrapNativeSuper(Error)),
746
- NoSignatureNeeded: function (_Error4) {
747
- function NoSignatureNeededError() {
748
- _classCallCheck(this, NoSignatureNeededError);
749
- return _callSuper(this, NoSignatureNeededError, arguments);
750
- }
751
- _inherits(NoSignatureNeededError, _Error4);
752
- return _createClass(NoSignatureNeededError);
753
- }(_wrapNativeSuper(Error)),
754
- NoUnsignedNonInvokerAuthEntries: function (_Error5) {
755
- function NoUnsignedNonInvokerAuthEntriesError() {
756
- _classCallCheck(this, NoUnsignedNonInvokerAuthEntriesError);
757
- return _callSuper(this, NoUnsignedNonInvokerAuthEntriesError, arguments);
758
- }
759
- _inherits(NoUnsignedNonInvokerAuthEntriesError, _Error5);
760
- return _createClass(NoUnsignedNonInvokerAuthEntriesError);
761
- }(_wrapNativeSuper(Error)),
762
- NoSigner: function (_Error6) {
763
- function NoSignerError() {
764
- _classCallCheck(this, NoSignerError);
765
- return _callSuper(this, NoSignerError, arguments);
766
- }
767
- _inherits(NoSignerError, _Error6);
768
- return _createClass(NoSignerError);
769
- }(_wrapNativeSuper(Error)),
770
- NotYetSimulated: function (_Error7) {
771
- function NotYetSimulatedError() {
772
- _classCallCheck(this, NotYetSimulatedError);
773
- return _callSuper(this, NotYetSimulatedError, arguments);
774
- }
775
- _inherits(NotYetSimulatedError, _Error7);
776
- return _createClass(NotYetSimulatedError);
777
- }(_wrapNativeSuper(Error)),
778
- FakeAccount: function (_Error8) {
779
- function FakeAccountError() {
780
- _classCallCheck(this, FakeAccountError);
781
- return _callSuper(this, FakeAccountError, arguments);
782
- }
783
- _inherits(FakeAccountError, _Error8);
784
- return _createClass(FakeAccountError);
785
- }(_wrapNativeSuper(Error)),
786
- SimulationFailed: function (_Error9) {
787
- function SimulationFailedError() {
788
- _classCallCheck(this, SimulationFailedError);
789
- return _callSuper(this, SimulationFailedError, arguments);
790
- }
791
- _inherits(SimulationFailedError, _Error9);
792
- return _createClass(SimulationFailedError);
793
- }(_wrapNativeSuper(Error)),
794
- InternalWalletError: function (_Error0) {
795
- function InternalWalletError() {
796
- _classCallCheck(this, InternalWalletError);
797
- return _callSuper(this, InternalWalletError, arguments);
798
- }
799
- _inherits(InternalWalletError, _Error0);
800
- return _createClass(InternalWalletError);
801
- }(_wrapNativeSuper(Error)),
802
- ExternalServiceError: function (_Error1) {
803
- function ExternalServiceError() {
804
- _classCallCheck(this, ExternalServiceError);
805
- return _callSuper(this, ExternalServiceError, arguments);
806
- }
807
- _inherits(ExternalServiceError, _Error1);
808
- return _createClass(ExternalServiceError);
809
- }(_wrapNativeSuper(Error)),
810
- InvalidClientRequest: function (_Error10) {
811
- function InvalidClientRequestError() {
812
- _classCallCheck(this, InvalidClientRequestError);
813
- return _callSuper(this, InvalidClientRequestError, arguments);
814
- }
815
- _inherits(InvalidClientRequestError, _Error10);
816
- return _createClass(InvalidClientRequestError);
817
- }(_wrapNativeSuper(Error)),
818
- UserRejected: function (_Error11) {
819
- function UserRejectedError() {
820
- _classCallCheck(this, UserRejectedError);
821
- return _callSuper(this, UserRejectedError, arguments);
822
- }
823
- _inherits(UserRejectedError, _Error11);
824
- return _createClass(UserRejectedError);
825
- }(_wrapNativeSuper(Error))
713
+ ExpiredState: _errors.ExpiredStateError,
714
+ RestorationFailure: _errors.RestoreFailureError,
715
+ NeedsMoreSignatures: _errors.NeedsMoreSignaturesError,
716
+ NoSignatureNeeded: _errors.NoSignatureNeededError,
717
+ NoUnsignedNonInvokerAuthEntries: _errors.NoUnsignedNonInvokerAuthEntriesError,
718
+ NoSigner: _errors.NoSignerError,
719
+ NotYetSimulated: _errors.NotYetSimulatedError,
720
+ FakeAccount: _errors.FakeAccountError,
721
+ SimulationFailed: _errors.SimulationFailedError,
722
+ InternalWalletError: _errors.InternalWalletError,
723
+ ExternalServiceError: _errors.ExternalServiceError,
724
+ InvalidClientRequest: _errors.InvalidClientRequestError,
725
+ UserRejected: _errors.UserRejectedError
826
726
  });
@@ -0,0 +1,26 @@
1
+ export declare class ExpiredStateError extends Error {
2
+ }
3
+ export declare class RestoreFailureError extends Error {
4
+ }
5
+ export declare class NeedsMoreSignaturesError extends Error {
6
+ }
7
+ export declare class NoSignatureNeededError extends Error {
8
+ }
9
+ export declare class NoUnsignedNonInvokerAuthEntriesError extends Error {
10
+ }
11
+ export declare class NoSignerError extends Error {
12
+ }
13
+ export declare class NotYetSimulatedError extends Error {
14
+ }
15
+ export declare class FakeAccountError extends Error {
16
+ }
17
+ export declare class SimulationFailedError extends Error {
18
+ }
19
+ export declare class InternalWalletError extends Error {
20
+ }
21
+ export declare class ExternalServiceError extends Error {
22
+ }
23
+ export declare class InvalidClientRequestError extends Error {
24
+ }
25
+ export declare class UserRejectedError extends Error {
26
+ }
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ 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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.UserRejectedError = exports.SimulationFailedError = exports.RestoreFailureError = exports.NotYetSimulatedError = exports.NoUnsignedNonInvokerAuthEntriesError = exports.NoSignerError = exports.NoSignatureNeededError = exports.NeedsMoreSignaturesError = exports.InvalidClientRequestError = exports.InternalWalletError = exports.FakeAccountError = exports.ExternalServiceError = exports.ExpiredStateError = void 0;
8
+ 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); } }
9
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
11
+ 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); }
12
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
13
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
14
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
15
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
16
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
17
+ function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
18
+ function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
19
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
20
+ function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
21
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
22
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
23
+ var ExpiredStateError = exports.ExpiredStateError = function (_Error) {
24
+ function ExpiredStateError() {
25
+ _classCallCheck(this, ExpiredStateError);
26
+ return _callSuper(this, ExpiredStateError, arguments);
27
+ }
28
+ _inherits(ExpiredStateError, _Error);
29
+ return _createClass(ExpiredStateError);
30
+ }(_wrapNativeSuper(Error));
31
+ var RestoreFailureError = exports.RestoreFailureError = function (_Error2) {
32
+ function RestoreFailureError() {
33
+ _classCallCheck(this, RestoreFailureError);
34
+ return _callSuper(this, RestoreFailureError, arguments);
35
+ }
36
+ _inherits(RestoreFailureError, _Error2);
37
+ return _createClass(RestoreFailureError);
38
+ }(_wrapNativeSuper(Error));
39
+ var NeedsMoreSignaturesError = exports.NeedsMoreSignaturesError = function (_Error3) {
40
+ function NeedsMoreSignaturesError() {
41
+ _classCallCheck(this, NeedsMoreSignaturesError);
42
+ return _callSuper(this, NeedsMoreSignaturesError, arguments);
43
+ }
44
+ _inherits(NeedsMoreSignaturesError, _Error3);
45
+ return _createClass(NeedsMoreSignaturesError);
46
+ }(_wrapNativeSuper(Error));
47
+ var NoSignatureNeededError = exports.NoSignatureNeededError = function (_Error4) {
48
+ function NoSignatureNeededError() {
49
+ _classCallCheck(this, NoSignatureNeededError);
50
+ return _callSuper(this, NoSignatureNeededError, arguments);
51
+ }
52
+ _inherits(NoSignatureNeededError, _Error4);
53
+ return _createClass(NoSignatureNeededError);
54
+ }(_wrapNativeSuper(Error));
55
+ var NoUnsignedNonInvokerAuthEntriesError = exports.NoUnsignedNonInvokerAuthEntriesError = function (_Error5) {
56
+ function NoUnsignedNonInvokerAuthEntriesError() {
57
+ _classCallCheck(this, NoUnsignedNonInvokerAuthEntriesError);
58
+ return _callSuper(this, NoUnsignedNonInvokerAuthEntriesError, arguments);
59
+ }
60
+ _inherits(NoUnsignedNonInvokerAuthEntriesError, _Error5);
61
+ return _createClass(NoUnsignedNonInvokerAuthEntriesError);
62
+ }(_wrapNativeSuper(Error));
63
+ var NoSignerError = exports.NoSignerError = function (_Error6) {
64
+ function NoSignerError() {
65
+ _classCallCheck(this, NoSignerError);
66
+ return _callSuper(this, NoSignerError, arguments);
67
+ }
68
+ _inherits(NoSignerError, _Error6);
69
+ return _createClass(NoSignerError);
70
+ }(_wrapNativeSuper(Error));
71
+ var NotYetSimulatedError = exports.NotYetSimulatedError = function (_Error7) {
72
+ function NotYetSimulatedError() {
73
+ _classCallCheck(this, NotYetSimulatedError);
74
+ return _callSuper(this, NotYetSimulatedError, arguments);
75
+ }
76
+ _inherits(NotYetSimulatedError, _Error7);
77
+ return _createClass(NotYetSimulatedError);
78
+ }(_wrapNativeSuper(Error));
79
+ var FakeAccountError = exports.FakeAccountError = function (_Error8) {
80
+ function FakeAccountError() {
81
+ _classCallCheck(this, FakeAccountError);
82
+ return _callSuper(this, FakeAccountError, arguments);
83
+ }
84
+ _inherits(FakeAccountError, _Error8);
85
+ return _createClass(FakeAccountError);
86
+ }(_wrapNativeSuper(Error));
87
+ var SimulationFailedError = exports.SimulationFailedError = function (_Error9) {
88
+ function SimulationFailedError() {
89
+ _classCallCheck(this, SimulationFailedError);
90
+ return _callSuper(this, SimulationFailedError, arguments);
91
+ }
92
+ _inherits(SimulationFailedError, _Error9);
93
+ return _createClass(SimulationFailedError);
94
+ }(_wrapNativeSuper(Error));
95
+ var InternalWalletError = exports.InternalWalletError = function (_Error0) {
96
+ function InternalWalletError() {
97
+ _classCallCheck(this, InternalWalletError);
98
+ return _callSuper(this, InternalWalletError, arguments);
99
+ }
100
+ _inherits(InternalWalletError, _Error0);
101
+ return _createClass(InternalWalletError);
102
+ }(_wrapNativeSuper(Error));
103
+ var ExternalServiceError = exports.ExternalServiceError = function (_Error1) {
104
+ function ExternalServiceError() {
105
+ _classCallCheck(this, ExternalServiceError);
106
+ return _callSuper(this, ExternalServiceError, arguments);
107
+ }
108
+ _inherits(ExternalServiceError, _Error1);
109
+ return _createClass(ExternalServiceError);
110
+ }(_wrapNativeSuper(Error));
111
+ var InvalidClientRequestError = exports.InvalidClientRequestError = function (_Error10) {
112
+ function InvalidClientRequestError() {
113
+ _classCallCheck(this, InvalidClientRequestError);
114
+ return _callSuper(this, InvalidClientRequestError, arguments);
115
+ }
116
+ _inherits(InvalidClientRequestError, _Error10);
117
+ return _createClass(InvalidClientRequestError);
118
+ }(_wrapNativeSuper(Error));
119
+ var UserRejectedError = exports.UserRejectedError = function (_Error11) {
120
+ function UserRejectedError() {
121
+ _classCallCheck(this, UserRejectedError);
122
+ return _callSuper(this, UserRejectedError, arguments);
123
+ }
124
+ _inherits(UserRejectedError, _Error11);
125
+ return _createClass(UserRejectedError);
126
+ }(_wrapNativeSuper(Error));
@@ -19,7 +19,7 @@ import type { AssembledTransaction } from "./assembled_transaction";
19
19
  * @class
20
20
  *
21
21
  * @param {Function} signTransaction More info in {@link MethodOptions}
22
- * @param {module:contract.AssembledTransaction<T>} assembled {@link AssembledTransaction} from which this SentTransaction was initialized
22
+ * @param {module:contract.AssembledTransaction} assembled {@link AssembledTransaction} from which this SentTransaction was initialized
23
23
  */
24
24
  export declare class SentTransaction<T> {
25
25
  assembled: AssembledTransaction<T>;
@@ -45,7 +45,7 @@ export declare class Spec {
45
45
  * @returns {Promise<module:contract.Spec>} A Promise that resolves to a Spec instance.
46
46
  * @throws {Error} If the contract spec cannot be obtained from the provided wasm binary.
47
47
  */
48
- static fromWasm(wasm: Buffer): Promise<Spec>;
48
+ static fromWasm(wasm: Buffer): Spec;
49
49
  /**
50
50
  * Generates a Spec instance from contract specs in any of the following forms:
51
51
  * - An XDR encoded stream of xdr.ScSpecEntry entries, the format of the spec
@@ -153,7 +153,7 @@ export declare class Spec {
153
153
  /**
154
154
  * Gets the XDR error cases from the spec.
155
155
  *
156
- * @returns {xdr.ScSpecFunctionV0[]} all contract functions
156
+ * @returns all contract functions
157
157
  *
158
158
  */
159
159
  errorCases(): xdr.ScSpecUdtErrorEnumCaseV0[];
@@ -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); }
@@ -105,6 +102,14 @@ function stringToScVal(str, ty) {
105
102
  case _stellarBase.xdr.ScSpecType.scSpecTypeBytes().value:
106
103
  case _stellarBase.xdr.ScSpecType.scSpecTypeBytesN().value:
107
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
+ }
108
113
  default:
109
114
  throw new TypeError("invalid type ".concat(ty.name, " specified for string value"));
110
115
  }
@@ -126,6 +131,18 @@ var PRIMITIVE_DEFINITONS = {
126
131
  minLength: 1,
127
132
  maxLength: 20
128
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
+ },
129
146
  I64: {
130
147
  type: "string",
131
148
  pattern: "^(-?[1-9][0-9]*|0)$",
@@ -229,12 +246,12 @@ function typeRef(typeDef) {
229
246
  case _stellarBase.xdr.ScSpecType.scSpecTypeTimepoint().value:
230
247
  {
231
248
  ref = "Timepoint";
232
- throw new Error("Timepoint type not supported");
249
+ break;
233
250
  }
234
251
  case _stellarBase.xdr.ScSpecType.scSpecTypeDuration().value:
235
252
  {
236
253
  ref = "Duration";
237
- throw new Error("Duration not supported");
254
+ break;
238
255
  }
239
256
  case _stellarBase.xdr.ScSpecType.scSpecTypeU128().value:
240
257
  {
@@ -699,6 +716,8 @@ var Spec = exports.Spec = function () {
699
716
  case _stellarBase.xdr.ScSpecType.scSpecTypeI128().value:
700
717
  case _stellarBase.xdr.ScSpecType.scSpecTypeU256().value:
701
718
  case _stellarBase.xdr.ScSpecType.scSpecTypeI256().value:
719
+ case _stellarBase.xdr.ScSpecType.scSpecTypeTimepoint().value:
720
+ case _stellarBase.xdr.ScSpecType.scSpecTypeDuration().value:
702
721
  {
703
722
  var intType = t.name.substring(10).toLowerCase();
704
723
  return new _stellarBase.XdrLargeInt(intType, val).toScVal();
@@ -848,6 +867,8 @@ var Spec = exports.Spec = function () {
848
867
  return null;
849
868
  case _stellarBase.xdr.ScValType.scvU64().value:
850
869
  case _stellarBase.xdr.ScValType.scvI64().value:
870
+ case _stellarBase.xdr.ScValType.scvTimepoint().value:
871
+ case _stellarBase.xdr.ScValType.scvDuration().value:
851
872
  case _stellarBase.xdr.ScValType.scvU128().value:
852
873
  case _stellarBase.xdr.ScValType.scvI128().value:
853
874
  case _stellarBase.xdr.ScValType.scvU256().value:
@@ -903,9 +924,6 @@ var Spec = exports.Spec = function () {
903
924
  }
904
925
  return (_scv$value = scv.value()) === null || _scv$value === void 0 ? void 0 : _scv$value.toString();
905
926
  }
906
- case _stellarBase.xdr.ScValType.scvTimepoint().value:
907
- case _stellarBase.xdr.ScValType.scvDuration().value:
908
- return (0, _stellarBase.scValToBigInt)(_stellarBase.xdr.ScVal.scvU64(scv.u64()));
909
927
  default:
910
928
  throw new TypeError("failed to convert ".concat(JSON.stringify(scv, null, 2), " to native type from type ").concat(t.name));
911
929
  }
@@ -1043,24 +1061,9 @@ var Spec = exports.Spec = function () {
1043
1061
  }
1044
1062
  }], [{
1045
1063
  key: "fromWasm",
1046
- value: (function () {
1047
- var _fromWasm = _asyncToGenerator(_regenerator().m(function _callee(wasm) {
1048
- var spec;
1049
- return _regenerator().w(function (_context) {
1050
- while (1) switch (_context.n) {
1051
- case 0:
1052
- _context.n = 1;
1053
- return (0, _utils.specFromWasm)(wasm);
1054
- case 1:
1055
- spec = _context.v;
1056
- return _context.a(2, new Spec(spec));
1057
- }
1058
- }, _callee);
1059
- }));
1060
- function fromWasm(_x) {
1061
- return _fromWasm.apply(this, arguments);
1062
- }
1063
- return fromWasm;
1064
- }())
1064
+ value: function fromWasm(wasm) {
1065
+ var spec = (0, _wasm_spec_parser.specFromWasm)(wasm);
1066
+ return new Spec(spec);
1067
+ }
1065
1068
  }]);
1066
1069
  }();