@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.
Files changed (143) hide show
  1. package/CHANGELOG.md +16 -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 +35 -9
  19. package/lib/contract/utils.d.ts +1 -1
  20. package/lib/contract/utils.js +18 -53
  21. package/lib/contract/wasm_spec_parser.d.ts +7 -0
  22. package/lib/contract/wasm_spec_parser.js +15 -0
  23. package/lib/errors/network.d.ts +1 -1
  24. package/lib/federation/server.d.ts +7 -7
  25. package/lib/horizon/horizon_axios_client.js +1 -1
  26. package/lib/horizon/server.d.ts +1 -1
  27. package/lib/horizon/server.js +2 -2
  28. package/lib/index.d.ts +0 -3
  29. package/lib/minimal/config.d.ts +2 -6
  30. package/lib/minimal/contract/assembled_transaction.d.ts +16 -132
  31. package/lib/minimal/contract/assembled_transaction.js +14 -114
  32. package/lib/minimal/contract/errors.d.ts +26 -0
  33. package/lib/minimal/contract/errors.js +126 -0
  34. package/lib/minimal/contract/sent_transaction.d.ts +1 -1
  35. package/lib/minimal/contract/spec.d.ts +2 -2
  36. package/lib/minimal/contract/spec.js +31 -28
  37. package/lib/minimal/contract/types.d.ts +35 -9
  38. package/lib/minimal/contract/utils.d.ts +1 -1
  39. package/lib/minimal/contract/utils.js +18 -53
  40. package/lib/minimal/contract/wasm_spec_parser.d.ts +7 -0
  41. package/lib/minimal/contract/wasm_spec_parser.js +15 -0
  42. package/lib/minimal/errors/network.d.ts +1 -1
  43. package/lib/minimal/federation/server.d.ts +7 -7
  44. package/lib/minimal/horizon/horizon_axios_client.js +1 -1
  45. package/lib/minimal/horizon/server.d.ts +1 -1
  46. package/lib/minimal/horizon/server.js +2 -2
  47. package/lib/minimal/index.d.ts +0 -3
  48. package/lib/minimal/rpc/api.d.ts +27 -3
  49. package/lib/minimal/rpc/axios.js +1 -1
  50. package/lib/minimal/rpc/jsonrpc.d.ts +2 -1
  51. package/lib/minimal/rpc/jsonrpc.js +1 -1
  52. package/lib/minimal/rpc/parsers.js +8 -5
  53. package/lib/minimal/rpc/server.d.ts +46 -7
  54. package/lib/minimal/rpc/server.js +290 -211
  55. package/lib/minimal/rpc/utils.js +1 -1
  56. package/lib/minimal/webauth/challenge_transaction.d.ts +235 -0
  57. package/lib/minimal/webauth/challenge_transaction.js +307 -0
  58. package/lib/minimal/webauth/index.d.ts +1 -0
  59. package/lib/minimal/webauth/index.js +13 -1
  60. package/lib/minimal/webauth/utils.d.ts +28 -273
  61. package/lib/minimal/webauth/utils.js +12 -288
  62. package/lib/no-axios/config.d.ts +2 -6
  63. package/lib/no-axios/contract/assembled_transaction.d.ts +16 -132
  64. package/lib/no-axios/contract/assembled_transaction.js +14 -114
  65. package/lib/no-axios/contract/errors.d.ts +26 -0
  66. package/lib/no-axios/contract/errors.js +126 -0
  67. package/lib/no-axios/contract/sent_transaction.d.ts +1 -1
  68. package/lib/no-axios/contract/spec.d.ts +2 -2
  69. package/lib/no-axios/contract/spec.js +31 -28
  70. package/lib/no-axios/contract/types.d.ts +35 -9
  71. package/lib/no-axios/contract/utils.d.ts +1 -1
  72. package/lib/no-axios/contract/utils.js +18 -53
  73. package/lib/no-axios/contract/wasm_spec_parser.d.ts +7 -0
  74. package/lib/no-axios/contract/wasm_spec_parser.js +15 -0
  75. package/lib/no-axios/errors/network.d.ts +1 -1
  76. package/lib/no-axios/federation/server.d.ts +7 -7
  77. package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
  78. package/lib/no-axios/horizon/server.d.ts +1 -1
  79. package/lib/no-axios/horizon/server.js +2 -2
  80. package/lib/no-axios/index.d.ts +0 -3
  81. package/lib/no-axios/rpc/api.d.ts +27 -3
  82. package/lib/no-axios/rpc/axios.js +1 -1
  83. package/lib/no-axios/rpc/jsonrpc.d.ts +2 -1
  84. package/lib/no-axios/rpc/jsonrpc.js +1 -1
  85. package/lib/no-axios/rpc/parsers.js +8 -5
  86. package/lib/no-axios/rpc/server.d.ts +46 -7
  87. package/lib/no-axios/rpc/server.js +290 -211
  88. package/lib/no-axios/rpc/utils.js +1 -1
  89. package/lib/no-axios/webauth/challenge_transaction.d.ts +235 -0
  90. package/lib/no-axios/webauth/challenge_transaction.js +307 -0
  91. package/lib/no-axios/webauth/index.d.ts +1 -0
  92. package/lib/no-axios/webauth/index.js +13 -1
  93. package/lib/no-axios/webauth/utils.d.ts +28 -273
  94. package/lib/no-axios/webauth/utils.js +12 -288
  95. package/lib/no-eventsource/config.d.ts +2 -6
  96. package/lib/no-eventsource/contract/assembled_transaction.d.ts +16 -132
  97. package/lib/no-eventsource/contract/assembled_transaction.js +14 -114
  98. package/lib/no-eventsource/contract/errors.d.ts +26 -0
  99. package/lib/no-eventsource/contract/errors.js +126 -0
  100. package/lib/no-eventsource/contract/sent_transaction.d.ts +1 -1
  101. package/lib/no-eventsource/contract/spec.d.ts +2 -2
  102. package/lib/no-eventsource/contract/spec.js +31 -28
  103. package/lib/no-eventsource/contract/types.d.ts +35 -9
  104. package/lib/no-eventsource/contract/utils.d.ts +1 -1
  105. package/lib/no-eventsource/contract/utils.js +18 -53
  106. package/lib/no-eventsource/contract/wasm_spec_parser.d.ts +7 -0
  107. package/lib/no-eventsource/contract/wasm_spec_parser.js +15 -0
  108. package/lib/no-eventsource/errors/network.d.ts +1 -1
  109. package/lib/no-eventsource/federation/server.d.ts +7 -7
  110. package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
  111. package/lib/no-eventsource/horizon/server.d.ts +1 -1
  112. package/lib/no-eventsource/horizon/server.js +2 -2
  113. package/lib/no-eventsource/index.d.ts +0 -3
  114. package/lib/no-eventsource/rpc/api.d.ts +27 -3
  115. package/lib/no-eventsource/rpc/axios.js +1 -1
  116. package/lib/no-eventsource/rpc/jsonrpc.d.ts +2 -1
  117. package/lib/no-eventsource/rpc/jsonrpc.js +1 -1
  118. package/lib/no-eventsource/rpc/parsers.js +8 -5
  119. package/lib/no-eventsource/rpc/server.d.ts +46 -7
  120. package/lib/no-eventsource/rpc/server.js +290 -211
  121. package/lib/no-eventsource/rpc/utils.js +1 -1
  122. package/lib/no-eventsource/webauth/challenge_transaction.d.ts +235 -0
  123. package/lib/no-eventsource/webauth/challenge_transaction.js +307 -0
  124. package/lib/no-eventsource/webauth/index.d.ts +1 -0
  125. package/lib/no-eventsource/webauth/index.js +13 -1
  126. package/lib/no-eventsource/webauth/utils.d.ts +28 -273
  127. package/lib/no-eventsource/webauth/utils.js +12 -288
  128. package/lib/rpc/api.d.ts +27 -3
  129. package/lib/rpc/axios.js +1 -1
  130. package/lib/rpc/jsonrpc.d.ts +2 -1
  131. package/lib/rpc/jsonrpc.js +1 -1
  132. package/lib/rpc/parsers.js +8 -5
  133. package/lib/rpc/server.d.ts +46 -7
  134. package/lib/rpc/server.js +290 -211
  135. package/lib/rpc/utils.js +1 -1
  136. package/lib/webauth/challenge_transaction.d.ts +235 -0
  137. package/lib/webauth/challenge_transaction.js +307 -0
  138. package/lib/webauth/index.d.ts +1 -0
  139. package/lib/webauth/index.js +13 -1
  140. package/lib/webauth/utils.d.ts +28 -273
  141. package/lib/webauth/utils.js +12 -288
  142. package/package.json +14 -14
  143. package/types/dom-monkeypatch.d.ts +1 -1
@@ -42,7 +42,7 @@ export type u256 = bigint;
42
42
  */
43
43
  export type i256 = bigint;
44
44
  export type Option<T> = T | undefined;
45
- export type Typepoint = bigint;
45
+ export type Timepoint = bigint;
46
46
  export type Duration = bigint;
47
47
  /**
48
48
  * A "regular" transaction, as opposed to a FeeBumpTransaction.
@@ -111,18 +111,16 @@ export type SignAuthEntry = (authEntry: string, opts?: {
111
111
  */
112
112
  export type ClientOptions = {
113
113
  /**
114
- * The public key of the account that will send this transaction. You can
115
- * override this for specific methods later, like
116
- * [signAndSend]{@link module:contract.AssembledTransaction#signAndSend} and
117
- * [signAuthEntries]{@link module:contract.AssembledTransaction#signAuthEntries}.
114
+ * The public key of the source account for this transaction. You can
115
+ * override this for specific methods later; see {@link MethodOptions}.
118
116
  */
119
117
  publicKey?: string;
120
118
  /**
121
119
  * A function to sign the transaction using the private key corresponding to
122
120
  * the given `publicKey`. You do not need to provide this, for read-only
123
- * calls, which only need to be simulated. If you do not need to sign and
124
- * send, there is no need to provide this. If you do not provide it during
125
- * initialization, you can provide it later when you call
121
+ * calls, which only need to be simulated. If you do not provide it during
122
+ * initialization, you can provide it later, either when you initialize a
123
+ * method (see {@link MethodOptions}) or when you call
126
124
  * {@link module:contract.AssembledTransaction#signAndSend signAndSend}.
127
125
  *
128
126
  * Matches signature of `signTransaction` from Freighter.
@@ -133,7 +131,8 @@ export type ClientOptions = {
133
131
  * private key corresponding to the provided `publicKey`. This is only needed
134
132
  * for multi-auth transactions, in which one transaction is signed by
135
133
  * multiple parties. If you do not provide it during initialization, you can
136
- * provide it later when you call {@link module:contract.AssembledTransaction#signAuthEntries signAuthEntries}.
134
+ * provide it later either when you initialize a method (see {@link MethodOptions})
135
+ * or when you call {@link module:contract.AssembledTransaction#signAuthEntries signAuthEntries}.
137
136
  *
138
137
  * Matches signature of `signAuthEntry` from Freighter.
139
138
  */
@@ -212,6 +211,33 @@ export type MethodOptions = {
212
211
  * @default false
213
212
  */
214
213
  restore?: boolean;
214
+ /**
215
+ * The public key of the source account for this transaction.
216
+ *
217
+ * Default: the one provided to the {@link Client} in {@link ClientOptions}
218
+ */
219
+ publicKey?: string;
220
+ /**
221
+ * A function to sign the transaction using the private key corresponding to
222
+ * the given `publicKey`. You do not need to provide this, for read-only
223
+ * calls, which only need to be simulated.
224
+ *
225
+ * Matches signature of `signTransaction` from Freighter.
226
+ *
227
+ * Default: the one provided to the {@link Client} in {@link ClientOptions}
228
+ */
229
+ signTransaction?: SignTransaction;
230
+ /**
231
+ * A function to sign a specific auth entry for a transaction, using the
232
+ * private key corresponding to the provided `publicKey`. This is only needed
233
+ * for multi-auth transactions, in which one transaction is signed by
234
+ * multiple parties.
235
+ *
236
+ * Matches signature of `signAuthEntry` from Freighter.
237
+ *
238
+ * Default: the one provided to the {@link Client} in {@link ClientOptions}
239
+ */
240
+ signAuthEntry?: SignAuthEntry;
215
241
  };
216
242
  export type AssembledTransactionOptions<T = string> = MethodOptions & ClientOptions & {
217
243
  method: string;
@@ -38,7 +38,7 @@ export declare function implementsToString(
38
38
  obj: unknown): obj is {
39
39
  toString(): string;
40
40
  };
41
- export declare function specFromWasm(wasm: Buffer): Promise<Buffer>;
41
+ export declare function parseWasmCustomSections(buffer: Buffer): Map<string, Uint8Array[]>;
42
42
  /**
43
43
  * Reads a binary stream of ScSpecEntries into an array for processing by ContractSpec
44
44
  * @private
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.contractErrorPattern = void 0;
7
7
  exports.getAccount = getAccount;
8
8
  exports.implementsToString = implementsToString;
9
+ exports.parseWasmCustomSections = parseWasmCustomSections;
9
10
  exports.processSpecEntryStream = processSpecEntryStream;
10
- exports.specFromWasm = specFromWasm;
11
11
  exports.withExponentialBackoff = withExponentialBackoff;
12
12
  var _stellarBase = require("@stellar/stellar-base");
13
13
  var _types = require("./types");
@@ -101,41 +101,6 @@ var contractErrorPattern = exports.contractErrorPattern = /Error\(Contract, #(\d
101
101
  function implementsToString(obj) {
102
102
  return _typeof(obj) === "object" && obj !== null && "toString" in obj;
103
103
  }
104
- function specFromWasm(_x4) {
105
- return _specFromWasm.apply(this, arguments);
106
- }
107
- function _specFromWasm() {
108
- _specFromWasm = _asyncToGenerator(_regenerator().m(function _callee2(wasm) {
109
- var xdrSections, wasmModule, customData, _t3;
110
- return _regenerator().w(function (_context2) {
111
- while (1) switch (_context2.p = _context2.n) {
112
- case 0:
113
- _context2.p = 0;
114
- _context2.n = 1;
115
- return WebAssembly.compile(wasm);
116
- case 1:
117
- wasmModule = _context2.v;
118
- xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
119
- _context2.n = 3;
120
- break;
121
- case 2:
122
- _context2.p = 2;
123
- _t3 = _context2.v;
124
- customData = parseWasmCustomSections(wasm);
125
- xdrSections = customData.get("contractspecv0");
126
- case 3:
127
- if (!(!xdrSections || xdrSections.length === 0)) {
128
- _context2.n = 4;
129
- break;
130
- }
131
- throw new Error("Could not obtain contract spec from wasm");
132
- case 4:
133
- return _context2.a(2, Buffer.from(xdrSections[0]));
134
- }
135
- }, _callee2, null, [[0, 2]]);
136
- }));
137
- return _specFromWasm.apply(this, arguments);
138
- }
139
104
  function parseWasmCustomSections(buffer) {
140
105
  var sections = new Map();
141
106
  var arrayBuffer = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
@@ -146,6 +111,17 @@ function parseWasmCustomSections(buffer) {
146
111
  offset += length;
147
112
  return bytes;
148
113
  };
114
+ function readVarUint32() {
115
+ var value = 0;
116
+ var shift = 0;
117
+ while (true) {
118
+ var byte = read(1)[0];
119
+ value |= (byte & 0x7f) << shift;
120
+ if ((byte & 0x80) === 0) break;
121
+ if ((shift += 7) >= 32) throw new Error("Invalid WASM value");
122
+ }
123
+ return value >>> 0;
124
+ }
149
125
  if (_toConsumableArray(read(4)).join() !== "0,97,115,109") throw new Error("Invalid WASM magic");
150
126
  if (_toConsumableArray(read(4)).join() !== "1,0,0,0") throw new Error("Invalid WASM version");
151
127
  while (offset < buffer.byteLength) {
@@ -169,17 +145,6 @@ function parseWasmCustomSections(buffer) {
169
145
  offset += sectionLength;
170
146
  }
171
147
  }
172
- function readVarUint32() {
173
- var value = 0,
174
- shift = 0;
175
- while (true) {
176
- var byte = read(1)[0];
177
- value |= (byte & 0x7f) << shift;
178
- if ((byte & 0x80) === 0) break;
179
- if ((shift += 7) >= 32) throw new Error("Invalid WASM value");
180
- }
181
- return value >>> 0;
182
- }
183
148
  return sections;
184
149
  }
185
150
  function processSpecEntryStream(buffer) {
@@ -190,17 +155,17 @@ function processSpecEntryStream(buffer) {
190
155
  }
191
156
  return res;
192
157
  }
193
- function getAccount(_x5, _x6) {
158
+ function getAccount(_x4, _x5) {
194
159
  return _getAccount.apply(this, arguments);
195
160
  }
196
161
  function _getAccount() {
197
- _getAccount = _asyncToGenerator(_regenerator().m(function _callee3(options, server) {
198
- return _regenerator().w(function (_context3) {
199
- while (1) switch (_context3.n) {
162
+ _getAccount = _asyncToGenerator(_regenerator().m(function _callee2(options, server) {
163
+ return _regenerator().w(function (_context2) {
164
+ while (1) switch (_context2.n) {
200
165
  case 0:
201
- return _context3.a(2, options.publicKey ? server.getAccount(options.publicKey) : new _stellarBase.Account(_types.NULL_ACCOUNT, "0"));
166
+ return _context2.a(2, options.publicKey ? server.getAccount(options.publicKey) : new _stellarBase.Account(_types.NULL_ACCOUNT, "0"));
202
167
  }
203
- }, _callee3);
168
+ }, _callee2);
204
169
  }));
205
170
  return _getAccount.apply(this, arguments);
206
171
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Obtains the contract spec XDR from a contract's wasm binary.
3
+ * @param wasm The contract's wasm binary as a Buffer.
4
+ * @returns The XDR buffer representing the contract spec.
5
+ * @throws {Error} If the contract spec cannot be obtained from the provided wasm binary.
6
+ */
7
+ export declare function specFromWasm(wasm: Buffer): Buffer;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.specFromWasm = specFromWasm;
7
+ var _utils = require("./utils");
8
+ function specFromWasm(wasm) {
9
+ var customData = (0, _utils.parseWasmCustomSections)(wasm);
10
+ var xdrSections = customData.get("contractspecv0");
11
+ if (!xdrSections || xdrSections.length === 0) {
12
+ throw new Error("Could not obtain contract spec from wasm");
13
+ }
14
+ return Buffer.from(xdrSections[0]);
15
+ }
@@ -21,7 +21,7 @@ export declare class NetworkError extends Error {
21
21
  constructor(message: string, response: any);
22
22
  /**
23
23
  * Returns the error response sent by the Horizon server.
24
- * @returns {any}
24
+ * @returns {any} Response details, received from the Horizon server.
25
25
  */
26
26
  getResponse(): {
27
27
  data?: HorizonApi.ErrorResponseData;
@@ -56,7 +56,7 @@ export declare class FederationServer {
56
56
  * @param {string} value Stellar Address (ex. `bob*stellar.org`)
57
57
  * @param {object} [opts] Options object
58
58
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
59
- * @throws Will throw an error if the provided account ID is not a valid Ed25519 public key.
59
+ * @throws {Error} Will throw an error if the provided account ID is not a valid Ed25519 public key.
60
60
  */
61
61
  static resolve(value: string, opts?: Api.Options): Promise<Api.Record>;
62
62
  /**
@@ -80,7 +80,7 @@ export declare class FederationServer {
80
80
  * @param {string} domain Domain to get federation server for
81
81
  * @param {module:Federation.Api.Options} [opts] Options object
82
82
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
83
- * @throws Will throw an error if the domain's stellar.toml file does not contain a federation server field.
83
+ * @throws {Error} Will throw an error if the domain's stellar.toml file does not contain a federation server field.
84
84
  */
85
85
  static createForDomain(domain: string, opts?: Api.Options): Promise<FederationServer>;
86
86
  constructor(serverURL: string, domain: string, opts?: Api.Options);
@@ -89,7 +89,7 @@ export declare class FederationServer {
89
89
  * @see <a href="https://developers.stellar.org/docs/encyclopedia/federation" target="_blank">Federation doc</a>
90
90
  * @param {string} address Stellar address (ex. `bob*stellar.org`). If `FederationServer` was instantiated with `domain` param only username (ex. `bob`) can be passed.
91
91
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
92
- * @throws Will throw an error if the federated address does not contain a domain, or if the server object was not instantiated with a `domain` parameter
92
+ * @throws {Error} Will throw an error if the federated address does not contain a domain, or if the server object was not instantiated with a `domain` parameter
93
93
  */
94
94
  resolveAddress(address: string): Promise<Api.Record>;
95
95
  /**
@@ -97,8 +97,8 @@ export declare class FederationServer {
97
97
  * @see <a href="https://developers.stellar.org/docs/encyclopedia/federation" target="_blank">Federation doc</a>
98
98
  * @param {string} accountId Account ID (ex. `GBYNR2QJXLBCBTRN44MRORCMI4YO7FZPFBCNOKTOBCAAFC7KC3LNPRYS`)
99
99
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
100
- * @throws Will throw an error if the federation server returns an invalid memo value.
101
- * @throws Will throw an error if the federation server's response exceeds the allowed maximum size.
100
+ * @throws {Error} Will throw an error if the federation server returns an invalid memo value.
101
+ * @throws {Error} Will throw an error if the federation server's response exceeds the allowed maximum size.
102
102
  * @throws {BadResponseError} Will throw an error if the server query fails with an improper response.
103
103
  */
104
104
  resolveAccountId(accountId: string): Promise<Api.Record>;
@@ -107,8 +107,8 @@ export declare class FederationServer {
107
107
  * @see <a href="https://developers.stellar.org/docs/glossary/federation/" target="_blank">Federation doc</a>
108
108
  * @param {string} transactionId Transaction ID (ex. `3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889`)
109
109
  * @returns {Promise<module:Federation.Api.Record>} A promise that resolves to the federation record
110
- * @throws Will throw an error if the federation server returns an invalid memo value.
111
- * @throws Will throw an error if the federation server's response exceeds the allowed maximum size.
110
+ * @throws {Error} Will throw an error if the federation server returns an invalid memo value.
111
+ * @throws {Error} Will throw an error if the federation server's response exceeds the allowed maximum size.
112
112
  * @throws {BadResponseError} Will throw an error if the server query fails with an improper response.
113
113
  */
114
114
  resolveTransactionId(transactionId: string): Promise<Api.Record>;
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
18
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
- var version = exports.version = "14.3.3";
19
+ var version = exports.version = "14.4.0";
20
20
  var SERVER_TIME_MAP = exports.SERVER_TIME_MAP = {};
21
21
  function toSeconds(ms) {
22
22
  return Math.floor(ms / 1000);
@@ -83,7 +83,7 @@ export declare class HorizonServer {
83
83
  * @param {number} seconds Number of seconds past the current time to wait.
84
84
  * @param {boolean} [_isRetry] True if this is a retry. Only set this internally!
85
85
  * This is to avoid a scenario where Horizon is horking up the wrong date.
86
- * @returns {Promise<Timebounds>} Promise that resolves a `timebounds` object
86
+ * @returns {Promise<module:HorizonServer.Timebounds>} Promise that resolves a `Timebounds` object
87
87
  * (with the shape `{ minTime: 0, maxTime: N }`) that you can set the `timebounds` option to.
88
88
  */
89
89
  fetchTimebounds(seconds: number, _isRetry?: boolean): Promise<HorizonServer.Timebounds>;
@@ -193,7 +193,7 @@ var HorizonServer = exports.HorizonServer = function () {
193
193
  return this.checkMemoRequired(transaction);
194
194
  case 1:
195
195
  tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
196
- return _context5.a(2, this.httpClient.post(this.serverURL.segment("transactions").toString(), "tx=".concat(tx), {
196
+ return _context5.a(2, this.httpClient.post(this.serverURL.clone().segment("transactions").toString(), "tx=".concat(tx), {
197
197
  timeout: SUBMIT_TRANSACTION_TIMEOUT,
198
198
  headers: {
199
199
  "Content-Type": "application/x-www-form-urlencoded"
@@ -334,7 +334,7 @@ var HorizonServer = exports.HorizonServer = function () {
334
334
  return this.checkMemoRequired(transaction);
335
335
  case 1:
336
336
  tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
337
- return _context6.a(2, this.httpClient.post(this.serverURL.segment("transactions_async").toString(), "tx=".concat(tx), {
337
+ return _context6.a(2, this.httpClient.post(this.serverURL.clone().segment("transactions_async").toString(), "tx=".concat(tx), {
338
338
  headers: {
339
339
  "Content-Type": "application/x-www-form-urlencoded"
340
340
  }
package/lib/index.d.ts CHANGED
@@ -11,7 +11,6 @@ export * as Horizon from "./horizon";
11
11
  * `assembleTransaction`, and the `Api` types. You can import these from the
12
12
  * `/rpc` entrypoint, if your version of Node and your TypeScript configuration
13
13
  * allow it:
14
- *
15
14
  * @example
16
15
  * import { Server } from '@stellar/stellar-sdk/rpc';
17
16
  */
@@ -21,10 +20,8 @@ export * as rpc from "./rpc";
21
20
  * `AssembledTransaction`. You can import these from the `/contract`
22
21
  * entrypoint, if your version of Node and your TypeScript configuration allow
23
22
  * it:
24
- *
25
23
  * @example
26
24
  * import { Client } from '@stellar/stellar-sdk/contract';
27
- * @private
28
25
  */
29
26
  export * as contract from "./contract";
30
27
  export * from "@stellar/stellar-base";
@@ -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(