@stellar/stellar-sdk 14.3.3 → 14.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -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 +47 -8
- 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 +47 -8
- 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 +28 -4
- 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 +47 -8
- 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 +28 -4
- 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 +47 -8
- 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 +28 -4
- 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 +28 -4
- 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
package/lib/contract/types.d.ts
CHANGED
|
@@ -42,7 +42,20 @@ export type u256 = bigint;
|
|
|
42
42
|
*/
|
|
43
43
|
export type i256 = bigint;
|
|
44
44
|
export type Option<T> = T | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use {@link Timepoint} instead.
|
|
47
|
+
* @memberof module:contract
|
|
48
|
+
*/
|
|
45
49
|
export type Typepoint = bigint;
|
|
50
|
+
/**
|
|
51
|
+
* An unsigned 64-bit integer.
|
|
52
|
+
* @memberof module:contract
|
|
53
|
+
*/
|
|
54
|
+
export type Timepoint = bigint;
|
|
55
|
+
/**
|
|
56
|
+
* An unsigned 64-bit integer.
|
|
57
|
+
* @memberof module:contract
|
|
58
|
+
*/
|
|
46
59
|
export type Duration = bigint;
|
|
47
60
|
/**
|
|
48
61
|
* A "regular" transaction, as opposed to a FeeBumpTransaction.
|
|
@@ -111,18 +124,16 @@ export type SignAuthEntry = (authEntry: string, opts?: {
|
|
|
111
124
|
*/
|
|
112
125
|
export type ClientOptions = {
|
|
113
126
|
/**
|
|
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}.
|
|
127
|
+
* The public key of the source account for this transaction. You can
|
|
128
|
+
* override this for specific methods later; see {@link MethodOptions}.
|
|
118
129
|
*/
|
|
119
130
|
publicKey?: string;
|
|
120
131
|
/**
|
|
121
132
|
* A function to sign the transaction using the private key corresponding to
|
|
122
133
|
* 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
|
-
*
|
|
134
|
+
* calls, which only need to be simulated. If you do not provide it during
|
|
135
|
+
* initialization, you can provide it later, either when you initialize a
|
|
136
|
+
* method (see {@link MethodOptions}) or when you call
|
|
126
137
|
* {@link module:contract.AssembledTransaction#signAndSend signAndSend}.
|
|
127
138
|
*
|
|
128
139
|
* Matches signature of `signTransaction` from Freighter.
|
|
@@ -133,7 +144,8 @@ export type ClientOptions = {
|
|
|
133
144
|
* private key corresponding to the provided `publicKey`. This is only needed
|
|
134
145
|
* for multi-auth transactions, in which one transaction is signed by
|
|
135
146
|
* multiple parties. If you do not provide it during initialization, you can
|
|
136
|
-
* provide it later when you
|
|
147
|
+
* provide it later either when you initialize a method (see {@link MethodOptions})
|
|
148
|
+
* or when you call {@link module:contract.AssembledTransaction#signAuthEntries signAuthEntries}.
|
|
137
149
|
*
|
|
138
150
|
* Matches signature of `signAuthEntry` from Freighter.
|
|
139
151
|
*/
|
|
@@ -212,6 +224,33 @@ export type MethodOptions = {
|
|
|
212
224
|
* @default false
|
|
213
225
|
*/
|
|
214
226
|
restore?: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* The public key of the source account for this transaction.
|
|
229
|
+
*
|
|
230
|
+
* Default: the one provided to the {@link Client} in {@link ClientOptions}
|
|
231
|
+
*/
|
|
232
|
+
publicKey?: string;
|
|
233
|
+
/**
|
|
234
|
+
* A function to sign the transaction using the private key corresponding to
|
|
235
|
+
* the given `publicKey`. You do not need to provide this, for read-only
|
|
236
|
+
* calls, which only need to be simulated.
|
|
237
|
+
*
|
|
238
|
+
* Matches signature of `signTransaction` from Freighter.
|
|
239
|
+
*
|
|
240
|
+
* Default: the one provided to the {@link Client} in {@link ClientOptions}
|
|
241
|
+
*/
|
|
242
|
+
signTransaction?: SignTransaction;
|
|
243
|
+
/**
|
|
244
|
+
* A function to sign a specific auth entry for a transaction, using the
|
|
245
|
+
* private key corresponding to the provided `publicKey`. This is only needed
|
|
246
|
+
* for multi-auth transactions, in which one transaction is signed by
|
|
247
|
+
* multiple parties.
|
|
248
|
+
*
|
|
249
|
+
* Matches signature of `signAuthEntry` from Freighter.
|
|
250
|
+
*
|
|
251
|
+
* Default: the one provided to the {@link Client} in {@link ClientOptions}
|
|
252
|
+
*/
|
|
253
|
+
signAuthEntry?: SignAuthEntry;
|
|
215
254
|
};
|
|
216
255
|
export type AssembledTransactionOptions<T = string> = MethodOptions & ClientOptions & {
|
|
217
256
|
method: string;
|
package/lib/contract/utils.d.ts
CHANGED
|
@@ -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
|
package/lib/contract/utils.js
CHANGED
|
@@ -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;
|
|
@@ -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
|
+
}
|
package/lib/errors/network.d.ts
CHANGED
|
@@ -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.
|
|
19
|
+
var version = exports.version = "14.4.1";
|
|
20
20
|
var SERVER_TIME_MAP = exports.SERVER_TIME_MAP = {};
|
|
21
21
|
function toSeconds(ms) {
|
|
22
22
|
return Math.floor(ms / 1000);
|
package/lib/horizon/server.d.ts
CHANGED
|
@@ -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 `
|
|
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>;
|
package/lib/horizon/server.js
CHANGED
|
@@ -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";
|
package/lib/minimal/config.d.ts
CHANGED
|
@@ -15,14 +15,11 @@ export interface Configuration {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Global config class.
|
|
18
|
-
*
|
|
19
18
|
* @hideconstructor
|
|
20
|
-
*
|
|
21
19
|
* @example <caption>Usage in node</caption>
|
|
22
20
|
* import { Config } from '@stellar/stellar-sdk';
|
|
23
21
|
* Config.setAllowHttp(true);
|
|
24
22
|
* Config.setTimeout(5000);
|
|
25
|
-
*
|
|
26
23
|
* @example <caption>Usage in the browser</caption>
|
|
27
24
|
* StellarSdk.Config.setAllowHttp(true);
|
|
28
25
|
* StellarSdk.Config.setTimeout(5000);
|
|
@@ -46,13 +43,12 @@ declare class Config {
|
|
|
46
43
|
/**
|
|
47
44
|
* Returns the configured `allowHttp` flag.
|
|
48
45
|
* @static
|
|
49
|
-
* @returns {boolean}
|
|
46
|
+
* @returns {boolean} The allowHttp value.
|
|
50
47
|
*/
|
|
51
48
|
static isAllowHttp(): boolean;
|
|
52
49
|
/**
|
|
53
50
|
* Returns the configured `timeout` flag.
|
|
54
|
-
* @
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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
|
|
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 {
|
|
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(
|