@stellar/stellar-sdk 14.2.0 → 14.3.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 +13 -0
- package/dist/stellar-sdk-minimal.js +85 -43
- package/dist/stellar-sdk-minimal.min.js +1 -1
- package/dist/stellar-sdk-no-axios.js +85 -43
- package/dist/stellar-sdk-no-axios.min.js +1 -1
- package/dist/stellar-sdk-no-eventsource.js +85 -43
- package/dist/stellar-sdk-no-eventsource.min.js +1 -1
- package/dist/stellar-sdk.js +85 -43
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/contract/spec.js +10 -2
- package/lib/errors/account_requires_memo.d.ts +0 -1
- package/lib/errors/account_requires_memo.js +0 -4
- package/lib/errors/bad_request.d.ts +0 -1
- package/lib/errors/bad_request.js +2 -8
- package/lib/errors/bad_response.d.ts +0 -1
- package/lib/errors/bad_response.js +2 -8
- package/lib/errors/network.d.ts +0 -1
- package/lib/errors/network.js +0 -3
- package/lib/errors/not_found.d.ts +0 -1
- package/lib/errors/not_found.js +2 -8
- package/lib/horizon/horizon_axios_client.js +1 -1
- package/lib/minimal/contract/spec.js +10 -2
- package/lib/minimal/errors/account_requires_memo.d.ts +0 -1
- package/lib/minimal/errors/account_requires_memo.js +0 -4
- package/lib/minimal/errors/bad_request.d.ts +0 -1
- package/lib/minimal/errors/bad_request.js +2 -8
- package/lib/minimal/errors/bad_response.d.ts +0 -1
- package/lib/minimal/errors/bad_response.js +2 -8
- package/lib/minimal/errors/network.d.ts +0 -1
- package/lib/minimal/errors/network.js +0 -3
- package/lib/minimal/errors/not_found.d.ts +0 -1
- package/lib/minimal/errors/not_found.js +2 -8
- package/lib/minimal/horizon/horizon_axios_client.js +1 -1
- package/lib/minimal/rpc/api.d.ts +132 -0
- package/lib/minimal/rpc/axios.js +1 -1
- package/lib/minimal/rpc/parsers.d.ts +1 -0
- package/lib/minimal/rpc/parsers.js +23 -0
- package/lib/minimal/rpc/server.d.ts +51 -20
- package/lib/minimal/rpc/server.js +42 -0
- package/lib/minimal/webauth/errors.d.ts +0 -2
- package/lib/minimal/webauth/errors.js +2 -8
- package/lib/no-axios/contract/spec.js +10 -2
- package/lib/no-axios/errors/account_requires_memo.d.ts +0 -1
- package/lib/no-axios/errors/account_requires_memo.js +0 -4
- package/lib/no-axios/errors/bad_request.d.ts +0 -1
- package/lib/no-axios/errors/bad_request.js +2 -8
- package/lib/no-axios/errors/bad_response.d.ts +0 -1
- package/lib/no-axios/errors/bad_response.js +2 -8
- package/lib/no-axios/errors/network.d.ts +0 -1
- package/lib/no-axios/errors/network.js +0 -3
- package/lib/no-axios/errors/not_found.d.ts +0 -1
- package/lib/no-axios/errors/not_found.js +2 -8
- package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
- package/lib/no-axios/rpc/api.d.ts +132 -0
- package/lib/no-axios/rpc/axios.js +1 -1
- package/lib/no-axios/rpc/parsers.d.ts +1 -0
- package/lib/no-axios/rpc/parsers.js +23 -0
- package/lib/no-axios/rpc/server.d.ts +51 -20
- package/lib/no-axios/rpc/server.js +42 -0
- package/lib/no-axios/webauth/errors.d.ts +0 -2
- package/lib/no-axios/webauth/errors.js +2 -8
- package/lib/no-eventsource/contract/spec.js +10 -2
- package/lib/no-eventsource/errors/account_requires_memo.d.ts +0 -1
- package/lib/no-eventsource/errors/account_requires_memo.js +0 -4
- package/lib/no-eventsource/errors/bad_request.d.ts +0 -1
- package/lib/no-eventsource/errors/bad_request.js +2 -8
- package/lib/no-eventsource/errors/bad_response.d.ts +0 -1
- package/lib/no-eventsource/errors/bad_response.js +2 -8
- package/lib/no-eventsource/errors/network.d.ts +0 -1
- package/lib/no-eventsource/errors/network.js +0 -3
- package/lib/no-eventsource/errors/not_found.d.ts +0 -1
- package/lib/no-eventsource/errors/not_found.js +2 -8
- package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
- package/lib/no-eventsource/rpc/api.d.ts +132 -0
- package/lib/no-eventsource/rpc/axios.js +1 -1
- package/lib/no-eventsource/rpc/parsers.d.ts +1 -0
- package/lib/no-eventsource/rpc/parsers.js +23 -0
- package/lib/no-eventsource/rpc/server.d.ts +51 -20
- package/lib/no-eventsource/rpc/server.js +42 -0
- package/lib/no-eventsource/webauth/errors.d.ts +0 -2
- package/lib/no-eventsource/webauth/errors.js +2 -8
- package/lib/rpc/api.d.ts +132 -0
- package/lib/rpc/axios.js +1 -1
- package/lib/rpc/parsers.d.ts +1 -0
- package/lib/rpc/parsers.js +23 -0
- package/lib/rpc/server.d.ts +51 -20
- package/lib/rpc/server.js +42 -0
- package/lib/webauth/errors.d.ts +0 -2
- package/lib/webauth/errors.js +2 -8
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ A breaking change will get clearly marked in this log.
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
## [v14.3.0](https://github.com/stellar/js-stellar-sdk/compare/v14.2.0...v14.3.0)
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
* `Spec.scValToNative` now supports parsing `Option`s ([#1228](https://github.com/stellar/js-stellar-sdk/pull/1228)).
|
|
14
|
+
* Added `getLedgers` method to `rpc.Server` for retreiving ledger data. ([#1231](https://github.com/stellar/js-stellar-sdk/pull/1231)).
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
* `Spec.scValToNative` returns `null` for `void`s or `Option`als instead of the ambiguous `undefined` ([#1228](https://github.com/stellar/js-stellar-sdk/pull/1228)).
|
|
18
|
+
* The `getEvents` API now requires either a start and end ledger or a cursor to be provided ([#1231](https://github.com/stellar/js-stellar-sdk/pull/1231)).
|
|
19
|
+
|
|
20
|
+
### Deprecated
|
|
21
|
+
* `GetEventsRequest` interface moved from `server.ts` to `api.ts` ([#1231](https://github.com/stellar/js-stellar-sdk/pull/1231)).
|
|
22
|
+
|
|
10
23
|
## [v14.2.0](https://github.com/stellar/js-stellar-sdk/compare/v14.1.1...v14.2.0)
|
|
11
24
|
|
|
12
25
|
### Added
|
|
@@ -7151,7 +7151,7 @@ var Spec = function () {
|
|
|
7151
7151
|
}
|
|
7152
7152
|
if (value === stellar_base_min.xdr.ScSpecType.scSpecTypeOption().value) {
|
|
7153
7153
|
var opt = ty.option();
|
|
7154
|
-
if (val === undefined) {
|
|
7154
|
+
if (val === null || val === undefined) {
|
|
7155
7155
|
return stellar_base_min.xdr.ScVal.scvVoid();
|
|
7156
7156
|
}
|
|
7157
7157
|
return this.nativeToScVal(val, opt.valueType());
|
|
@@ -7415,12 +7415,20 @@ var Spec = function () {
|
|
|
7415
7415
|
var _this5 = this;
|
|
7416
7416
|
var t = typeDef.switch();
|
|
7417
7417
|
var value = t.value;
|
|
7418
|
+
if (value === stellar_base_min.xdr.ScSpecType.scSpecTypeOption().value) {
|
|
7419
|
+
switch (scv.switch().value) {
|
|
7420
|
+
case stellar_base_min.xdr.ScValType.scvVoid().value:
|
|
7421
|
+
return null;
|
|
7422
|
+
default:
|
|
7423
|
+
return this.scValToNative(scv, typeDef.option().valueType());
|
|
7424
|
+
}
|
|
7425
|
+
}
|
|
7418
7426
|
if (value === stellar_base_min.xdr.ScSpecType.scSpecTypeUdt().value) {
|
|
7419
7427
|
return this.scValUdtToNative(scv, typeDef.udt());
|
|
7420
7428
|
}
|
|
7421
7429
|
switch (scv.switch().value) {
|
|
7422
7430
|
case stellar_base_min.xdr.ScValType.scvVoid().value:
|
|
7423
|
-
return
|
|
7431
|
+
return null;
|
|
7424
7432
|
case stellar_base_min.xdr.ScValType.scvU64().value:
|
|
7425
7433
|
case stellar_base_min.xdr.ScValType.scvI64().value:
|
|
7426
7434
|
case stellar_base_min.xdr.ScValType.scvU128().value:
|
|
@@ -8743,15 +8751,9 @@ function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).in
|
|
|
8743
8751
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
8744
8752
|
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
8745
8753
|
var InvalidChallengeError = function (_Error) {
|
|
8746
|
-
function InvalidChallengeError(
|
|
8747
|
-
var _this;
|
|
8754
|
+
function InvalidChallengeError() {
|
|
8748
8755
|
_classCallCheck(this, InvalidChallengeError);
|
|
8749
|
-
|
|
8750
|
-
_this = _callSuper(this, InvalidChallengeError, [message]);
|
|
8751
|
-
_this.__proto__ = trueProto;
|
|
8752
|
-
_this.constructor = InvalidChallengeError;
|
|
8753
|
-
_this.name = "InvalidChallengeError";
|
|
8754
|
-
return _this;
|
|
8756
|
+
return _callSuper(this, InvalidChallengeError, arguments);
|
|
8755
8757
|
}
|
|
8756
8758
|
_inherits(InvalidChallengeError, _Error);
|
|
8757
8759
|
return _createClass(InvalidChallengeError);
|
|
@@ -9116,7 +9118,7 @@ var stellar_base_min = __webpack_require__(950);
|
|
|
9116
9118
|
var http_client = __webpack_require__(371);
|
|
9117
9119
|
;// ./src/rpc/axios.ts
|
|
9118
9120
|
|
|
9119
|
-
var version = "14.
|
|
9121
|
+
var version = "14.3.0";
|
|
9120
9122
|
var AxiosClient = (0,http_client/* create */.vt)({
|
|
9121
9123
|
headers: {
|
|
9122
9124
|
"X-Client-Name": "js-soroban-client",
|
|
@@ -10107,6 +10109,48 @@ var RpcServer = function () {
|
|
|
10107
10109
|
}
|
|
10108
10110
|
return getSACBalance;
|
|
10109
10111
|
}())
|
|
10112
|
+
}, {
|
|
10113
|
+
key: "getLedgers",
|
|
10114
|
+
value: (function () {
|
|
10115
|
+
var _getLedgers2 = server_asyncToGenerator(server_regenerator().m(function _callee26(request) {
|
|
10116
|
+
return server_regenerator().w(function (_context26) {
|
|
10117
|
+
while (1) switch (_context26.n) {
|
|
10118
|
+
case 0:
|
|
10119
|
+
return _context26.a(2, this._getLedgers(request).then(function (raw) {
|
|
10120
|
+
var result = {
|
|
10121
|
+
ledgers: (raw.ledgers || []).map(parsers/* parseRawLedger */.$E),
|
|
10122
|
+
latestLedger: raw.latestLedger,
|
|
10123
|
+
latestLedgerCloseTime: raw.latestLedgerCloseTime,
|
|
10124
|
+
oldestLedger: raw.oldestLedger,
|
|
10125
|
+
oldestLedgerCloseTime: raw.oldestLedgerCloseTime,
|
|
10126
|
+
cursor: raw.cursor
|
|
10127
|
+
};
|
|
10128
|
+
return result;
|
|
10129
|
+
}));
|
|
10130
|
+
}
|
|
10131
|
+
}, _callee26, this);
|
|
10132
|
+
}));
|
|
10133
|
+
function getLedgers(_x31) {
|
|
10134
|
+
return _getLedgers2.apply(this, arguments);
|
|
10135
|
+
}
|
|
10136
|
+
return getLedgers;
|
|
10137
|
+
}())
|
|
10138
|
+
}, {
|
|
10139
|
+
key: "_getLedgers",
|
|
10140
|
+
value: function () {
|
|
10141
|
+
var _getLedgers3 = server_asyncToGenerator(server_regenerator().m(function _callee27(request) {
|
|
10142
|
+
return server_regenerator().w(function (_context27) {
|
|
10143
|
+
while (1) switch (_context27.n) {
|
|
10144
|
+
case 0:
|
|
10145
|
+
return _context27.a(2, postObject(this.serverURL.toString(), "getLedgers", request));
|
|
10146
|
+
}
|
|
10147
|
+
}, _callee27, this);
|
|
10148
|
+
}));
|
|
10149
|
+
function _getLedgers(_x32) {
|
|
10150
|
+
return _getLedgers3.apply(this, arguments);
|
|
10151
|
+
}
|
|
10152
|
+
return _getLedgers;
|
|
10153
|
+
}()
|
|
10110
10154
|
}]);
|
|
10111
10155
|
}();
|
|
10112
10156
|
;// ./src/rpc/index.ts
|
|
@@ -18115,7 +18159,7 @@ var http_client = __webpack_require__(371);
|
|
|
18115
18159
|
function horizon_axios_client_typeof(o) { "@babel/helpers - typeof"; return horizon_axios_client_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; }, horizon_axios_client_typeof(o); }
|
|
18116
18160
|
|
|
18117
18161
|
|
|
18118
|
-
var version = "14.
|
|
18162
|
+
var version = "14.3.0";
|
|
18119
18163
|
var SERVER_TIME_MAP = {};
|
|
18120
18164
|
var AxiosClient = (0,http_client/* create */.vt)({
|
|
18121
18165
|
headers: {
|
|
@@ -19893,6 +19937,7 @@ var HorizonServer = function () {
|
|
|
19893
19937
|
"use strict";
|
|
19894
19938
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
19895
19939
|
/* harmony export */ $D: () => (/* binding */ parseRawLedgerEntries),
|
|
19940
|
+
/* harmony export */ $E: () => (/* binding */ parseRawLedger),
|
|
19896
19941
|
/* harmony export */ Af: () => (/* binding */ parseRawSendTransaction),
|
|
19897
19942
|
/* harmony export */ WC: () => (/* binding */ parseTransactionInfo),
|
|
19898
19943
|
/* harmony export */ fG: () => (/* binding */ parseRawEvents),
|
|
@@ -20066,6 +20111,28 @@ function parseRawSimulation(sim) {
|
|
|
20066
20111
|
}
|
|
20067
20112
|
return parseSuccessful(sim, base);
|
|
20068
20113
|
}
|
|
20114
|
+
function parseRawLedger(raw) {
|
|
20115
|
+
if (!raw.metadataXdr || !raw.headerXdr) {
|
|
20116
|
+
var missingFields;
|
|
20117
|
+
if (!raw.metadataXdr && !raw.headerXdr) {
|
|
20118
|
+
missingFields = "metadataXdr and headerXdr";
|
|
20119
|
+
} else if (!raw.metadataXdr) {
|
|
20120
|
+
missingFields = "metadataXdr";
|
|
20121
|
+
} else {
|
|
20122
|
+
missingFields = "headerXdr";
|
|
20123
|
+
}
|
|
20124
|
+
throw new TypeError("invalid ledger missing fields: ".concat(missingFields));
|
|
20125
|
+
}
|
|
20126
|
+
var metadataXdr = _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.LedgerCloseMeta.fromXDR(raw.metadataXdr, "base64");
|
|
20127
|
+
var headerXdr = _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.LedgerHeaderHistoryEntry.fromXDR(raw.headerXdr, "base64");
|
|
20128
|
+
return {
|
|
20129
|
+
hash: raw.hash,
|
|
20130
|
+
sequence: raw.sequence,
|
|
20131
|
+
ledgerCloseTime: raw.ledgerCloseTime,
|
|
20132
|
+
metadataXdr: metadataXdr,
|
|
20133
|
+
headerXdr: headerXdr
|
|
20134
|
+
};
|
|
20135
|
+
}
|
|
20069
20136
|
|
|
20070
20137
|
/***/ }),
|
|
20071
20138
|
|
|
@@ -20894,10 +20961,7 @@ var NetworkError = function (_Error) {
|
|
|
20894
20961
|
function NetworkError(message, response) {
|
|
20895
20962
|
var _this;
|
|
20896
20963
|
_classCallCheck(this, NetworkError);
|
|
20897
|
-
var trueProto = (this instanceof NetworkError ? this.constructor : void 0).prototype;
|
|
20898
20964
|
_this = _callSuper(this, NetworkError, [message]);
|
|
20899
|
-
_this.__proto__ = trueProto;
|
|
20900
|
-
_this.constructor = NetworkError;
|
|
20901
20965
|
_this.response = response;
|
|
20902
20966
|
return _this;
|
|
20903
20967
|
}
|
|
@@ -20925,15 +20989,9 @@ function not_found_inherits(t, e) { if ("function" != typeof e && null !== e) th
|
|
|
20925
20989
|
function not_found_setPrototypeOf(t, e) { return not_found_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, not_found_setPrototypeOf(t, e); }
|
|
20926
20990
|
|
|
20927
20991
|
var NotFoundError = function (_NetworkError) {
|
|
20928
|
-
function NotFoundError(
|
|
20929
|
-
var _this;
|
|
20992
|
+
function NotFoundError() {
|
|
20930
20993
|
not_found_classCallCheck(this, NotFoundError);
|
|
20931
|
-
|
|
20932
|
-
_this = not_found_callSuper(this, NotFoundError, [message, response]);
|
|
20933
|
-
_this.__proto__ = trueProto;
|
|
20934
|
-
_this.constructor = NotFoundError;
|
|
20935
|
-
_this.name = "NotFoundError";
|
|
20936
|
-
return _this;
|
|
20994
|
+
return not_found_callSuper(this, NotFoundError, arguments);
|
|
20937
20995
|
}
|
|
20938
20996
|
not_found_inherits(NotFoundError, _NetworkError);
|
|
20939
20997
|
return not_found_createClass(NotFoundError);
|
|
@@ -20954,15 +21012,9 @@ function bad_request_inherits(t, e) { if ("function" != typeof e && null !== e)
|
|
|
20954
21012
|
function bad_request_setPrototypeOf(t, e) { return bad_request_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, bad_request_setPrototypeOf(t, e); }
|
|
20955
21013
|
|
|
20956
21014
|
var BadRequestError = function (_NetworkError) {
|
|
20957
|
-
function BadRequestError(
|
|
20958
|
-
var _this;
|
|
21015
|
+
function BadRequestError() {
|
|
20959
21016
|
bad_request_classCallCheck(this, BadRequestError);
|
|
20960
|
-
|
|
20961
|
-
_this = bad_request_callSuper(this, BadRequestError, [message, response]);
|
|
20962
|
-
_this.__proto__ = trueProto;
|
|
20963
|
-
_this.constructor = BadRequestError;
|
|
20964
|
-
_this.name = "BadRequestError";
|
|
20965
|
-
return _this;
|
|
21017
|
+
return bad_request_callSuper(this, BadRequestError, arguments);
|
|
20966
21018
|
}
|
|
20967
21019
|
bad_request_inherits(BadRequestError, _NetworkError);
|
|
20968
21020
|
return bad_request_createClass(BadRequestError);
|
|
@@ -20983,15 +21035,9 @@ function bad_response_inherits(t, e) { if ("function" != typeof e && null !== e)
|
|
|
20983
21035
|
function bad_response_setPrototypeOf(t, e) { return bad_response_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, bad_response_setPrototypeOf(t, e); }
|
|
20984
21036
|
|
|
20985
21037
|
var BadResponseError = function (_NetworkError) {
|
|
20986
|
-
function BadResponseError(
|
|
20987
|
-
var _this;
|
|
21038
|
+
function BadResponseError() {
|
|
20988
21039
|
bad_response_classCallCheck(this, BadResponseError);
|
|
20989
|
-
|
|
20990
|
-
_this = bad_response_callSuper(this, BadResponseError, [message, response]);
|
|
20991
|
-
_this.__proto__ = trueProto;
|
|
20992
|
-
_this.constructor = BadResponseError;
|
|
20993
|
-
_this.name = "BadResponseError";
|
|
20994
|
-
return _this;
|
|
21040
|
+
return bad_response_callSuper(this, BadResponseError, arguments);
|
|
20995
21041
|
}
|
|
20996
21042
|
bad_response_inherits(BadResponseError, _NetworkError);
|
|
20997
21043
|
return bad_response_createClass(BadResponseError);
|
|
@@ -21017,11 +21063,7 @@ var AccountRequiresMemoError = function (_Error) {
|
|
|
21017
21063
|
function AccountRequiresMemoError(message, accountId, operationIndex) {
|
|
21018
21064
|
var _this;
|
|
21019
21065
|
account_requires_memo_classCallCheck(this, AccountRequiresMemoError);
|
|
21020
|
-
var trueProto = (this instanceof AccountRequiresMemoError ? this.constructor : void 0).prototype;
|
|
21021
21066
|
_this = account_requires_memo_callSuper(this, AccountRequiresMemoError, [message]);
|
|
21022
|
-
_this.__proto__ = trueProto;
|
|
21023
|
-
_this.constructor = AccountRequiresMemoError;
|
|
21024
|
-
_this.name = "AccountRequiresMemoError";
|
|
21025
21067
|
_this.accountId = accountId;
|
|
21026
21068
|
_this.operationIndex = operationIndex;
|
|
21027
21069
|
return _this;
|