@stellar/stellar-sdk 14.3.3 → 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.
- package/CHANGELOG.md +16 -1
- package/dist/stellar-sdk-minimal.js +7220 -7111
- package/dist/stellar-sdk-minimal.min.js +1 -1
- package/dist/stellar-sdk-no-axios.js +3454 -3345
- package/dist/stellar-sdk-no-axios.min.js +1 -1
- package/dist/stellar-sdk-no-eventsource.js +7471 -7362
- package/dist/stellar-sdk-no-eventsource.min.js +1 -1
- package/dist/stellar-sdk.js +7972 -7863
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/config.d.ts +2 -6
- package/lib/contract/assembled_transaction.d.ts +16 -132
- package/lib/contract/assembled_transaction.js +14 -114
- package/lib/contract/errors.d.ts +26 -0
- package/lib/contract/errors.js +126 -0
- package/lib/contract/sent_transaction.d.ts +1 -1
- package/lib/contract/spec.d.ts +2 -2
- package/lib/contract/spec.js +31 -28
- package/lib/contract/types.d.ts +35 -9
- package/lib/contract/utils.d.ts +1 -1
- package/lib/contract/utils.js +18 -53
- package/lib/contract/wasm_spec_parser.d.ts +7 -0
- package/lib/contract/wasm_spec_parser.js +15 -0
- package/lib/errors/network.d.ts +1 -1
- package/lib/federation/server.d.ts +7 -7
- package/lib/horizon/horizon_axios_client.js +1 -1
- package/lib/horizon/server.d.ts +1 -1
- package/lib/horizon/server.js +2 -2
- package/lib/index.d.ts +0 -3
- package/lib/minimal/config.d.ts +2 -6
- package/lib/minimal/contract/assembled_transaction.d.ts +16 -132
- package/lib/minimal/contract/assembled_transaction.js +14 -114
- package/lib/minimal/contract/errors.d.ts +26 -0
- package/lib/minimal/contract/errors.js +126 -0
- package/lib/minimal/contract/sent_transaction.d.ts +1 -1
- package/lib/minimal/contract/spec.d.ts +2 -2
- package/lib/minimal/contract/spec.js +31 -28
- package/lib/minimal/contract/types.d.ts +35 -9
- package/lib/minimal/contract/utils.d.ts +1 -1
- package/lib/minimal/contract/utils.js +18 -53
- package/lib/minimal/contract/wasm_spec_parser.d.ts +7 -0
- package/lib/minimal/contract/wasm_spec_parser.js +15 -0
- package/lib/minimal/errors/network.d.ts +1 -1
- package/lib/minimal/federation/server.d.ts +7 -7
- package/lib/minimal/horizon/horizon_axios_client.js +1 -1
- package/lib/minimal/horizon/server.d.ts +1 -1
- package/lib/minimal/horizon/server.js +2 -2
- package/lib/minimal/index.d.ts +0 -3
- package/lib/minimal/rpc/api.d.ts +27 -3
- package/lib/minimal/rpc/axios.js +1 -1
- package/lib/minimal/rpc/jsonrpc.d.ts +2 -1
- package/lib/minimal/rpc/jsonrpc.js +1 -1
- package/lib/minimal/rpc/parsers.js +8 -5
- package/lib/minimal/rpc/server.d.ts +46 -7
- package/lib/minimal/rpc/server.js +290 -211
- package/lib/minimal/rpc/utils.js +1 -1
- package/lib/minimal/webauth/challenge_transaction.d.ts +235 -0
- package/lib/minimal/webauth/challenge_transaction.js +307 -0
- package/lib/minimal/webauth/index.d.ts +1 -0
- package/lib/minimal/webauth/index.js +13 -1
- package/lib/minimal/webauth/utils.d.ts +28 -273
- package/lib/minimal/webauth/utils.js +12 -288
- package/lib/no-axios/config.d.ts +2 -6
- package/lib/no-axios/contract/assembled_transaction.d.ts +16 -132
- package/lib/no-axios/contract/assembled_transaction.js +14 -114
- package/lib/no-axios/contract/errors.d.ts +26 -0
- package/lib/no-axios/contract/errors.js +126 -0
- package/lib/no-axios/contract/sent_transaction.d.ts +1 -1
- package/lib/no-axios/contract/spec.d.ts +2 -2
- package/lib/no-axios/contract/spec.js +31 -28
- package/lib/no-axios/contract/types.d.ts +35 -9
- package/lib/no-axios/contract/utils.d.ts +1 -1
- package/lib/no-axios/contract/utils.js +18 -53
- package/lib/no-axios/contract/wasm_spec_parser.d.ts +7 -0
- package/lib/no-axios/contract/wasm_spec_parser.js +15 -0
- package/lib/no-axios/errors/network.d.ts +1 -1
- package/lib/no-axios/federation/server.d.ts +7 -7
- package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
- package/lib/no-axios/horizon/server.d.ts +1 -1
- package/lib/no-axios/horizon/server.js +2 -2
- package/lib/no-axios/index.d.ts +0 -3
- package/lib/no-axios/rpc/api.d.ts +27 -3
- package/lib/no-axios/rpc/axios.js +1 -1
- package/lib/no-axios/rpc/jsonrpc.d.ts +2 -1
- package/lib/no-axios/rpc/jsonrpc.js +1 -1
- package/lib/no-axios/rpc/parsers.js +8 -5
- package/lib/no-axios/rpc/server.d.ts +46 -7
- package/lib/no-axios/rpc/server.js +290 -211
- package/lib/no-axios/rpc/utils.js +1 -1
- package/lib/no-axios/webauth/challenge_transaction.d.ts +235 -0
- package/lib/no-axios/webauth/challenge_transaction.js +307 -0
- package/lib/no-axios/webauth/index.d.ts +1 -0
- package/lib/no-axios/webauth/index.js +13 -1
- package/lib/no-axios/webauth/utils.d.ts +28 -273
- package/lib/no-axios/webauth/utils.js +12 -288
- package/lib/no-eventsource/config.d.ts +2 -6
- package/lib/no-eventsource/contract/assembled_transaction.d.ts +16 -132
- package/lib/no-eventsource/contract/assembled_transaction.js +14 -114
- package/lib/no-eventsource/contract/errors.d.ts +26 -0
- package/lib/no-eventsource/contract/errors.js +126 -0
- package/lib/no-eventsource/contract/sent_transaction.d.ts +1 -1
- package/lib/no-eventsource/contract/spec.d.ts +2 -2
- package/lib/no-eventsource/contract/spec.js +31 -28
- package/lib/no-eventsource/contract/types.d.ts +35 -9
- package/lib/no-eventsource/contract/utils.d.ts +1 -1
- package/lib/no-eventsource/contract/utils.js +18 -53
- package/lib/no-eventsource/contract/wasm_spec_parser.d.ts +7 -0
- package/lib/no-eventsource/contract/wasm_spec_parser.js +15 -0
- package/lib/no-eventsource/errors/network.d.ts +1 -1
- package/lib/no-eventsource/federation/server.d.ts +7 -7
- package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
- package/lib/no-eventsource/horizon/server.d.ts +1 -1
- package/lib/no-eventsource/horizon/server.js +2 -2
- package/lib/no-eventsource/index.d.ts +0 -3
- package/lib/no-eventsource/rpc/api.d.ts +27 -3
- package/lib/no-eventsource/rpc/axios.js +1 -1
- package/lib/no-eventsource/rpc/jsonrpc.d.ts +2 -1
- package/lib/no-eventsource/rpc/jsonrpc.js +1 -1
- package/lib/no-eventsource/rpc/parsers.js +8 -5
- package/lib/no-eventsource/rpc/server.d.ts +46 -7
- package/lib/no-eventsource/rpc/server.js +290 -211
- package/lib/no-eventsource/rpc/utils.js +1 -1
- package/lib/no-eventsource/webauth/challenge_transaction.d.ts +235 -0
- package/lib/no-eventsource/webauth/challenge_transaction.js +307 -0
- package/lib/no-eventsource/webauth/index.d.ts +1 -0
- package/lib/no-eventsource/webauth/index.js +13 -1
- package/lib/no-eventsource/webauth/utils.d.ts +28 -273
- package/lib/no-eventsource/webauth/utils.js +12 -288
- package/lib/rpc/api.d.ts +27 -3
- package/lib/rpc/axios.js +1 -1
- package/lib/rpc/jsonrpc.d.ts +2 -1
- package/lib/rpc/jsonrpc.js +1 -1
- package/lib/rpc/parsers.js +8 -5
- package/lib/rpc/server.d.ts +46 -7
- package/lib/rpc/server.js +290 -211
- package/lib/rpc/utils.js +1 -1
- package/lib/webauth/challenge_transaction.d.ts +235 -0
- package/lib/webauth/challenge_transaction.js +307 -0
- package/lib/webauth/index.d.ts +1 -0
- package/lib/webauth/index.js +13 -1
- package/lib/webauth/utils.d.ts +28 -273
- package/lib/webauth/utils.js +12 -288
- package/package.json +14 -14
- package/types/dom-monkeypatch.d.ts +1 -1
|
@@ -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
|
-
|
|
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:
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
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
|
|
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):
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
249
|
+
break;
|
|
233
250
|
}
|
|
234
251
|
case _stellarBase.xdr.ScSpecType.scSpecTypeDuration().value:
|
|
235
252
|
{
|
|
236
253
|
ref = "Duration";
|
|
237
|
-
|
|
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:
|
|
1047
|
-
var
|
|
1048
|
-
|
|
1049
|
-
|
|
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
|
}();
|
|
@@ -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
|
|
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
|
|
115
|
-
* override this for specific methods later
|
|
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
|
|
124
|
-
*
|
|
125
|
-
*
|
|
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
|
|
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
|
|
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(
|
|
158
|
+
function getAccount(_x4, _x5) {
|
|
194
159
|
return _getAccount.apply(this, arguments);
|
|
195
160
|
}
|
|
196
161
|
function _getAccount() {
|
|
197
|
-
_getAccount = _asyncToGenerator(_regenerator().m(function
|
|
198
|
-
return _regenerator().w(function (
|
|
199
|
-
while (1) switch (
|
|
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
|
|
166
|
+
return _context2.a(2, options.publicKey ? server.getAccount(options.publicKey) : new _stellarBase.Account(_types.NULL_ACCOUNT, "0"));
|
|
202
167
|
}
|
|
203
|
-
},
|
|
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;
|