@stellar/stellar-sdk 12.0.0 → 12.1.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 +116 -1
- package/README.md +1 -1
- package/dist/stellar-sdk.js +3089 -1219
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/browser.js +1 -1
- package/lib/config.js +3 -3
- package/lib/{contract_client → contract}/assembled_transaction.d.ts +154 -59
- package/lib/{contract_client → contract}/assembled_transaction.js +403 -187
- package/lib/{contract_client → contract}/basic_node_signer.d.ts +2 -2
- package/lib/{contract_client → contract}/basic_node_signer.js +5 -5
- package/lib/contract/client.d.ts +53 -0
- package/lib/contract/client.js +180 -0
- package/lib/contract/index.d.ts +8 -0
- package/lib/{contract_client → contract}/index.js +37 -9
- package/lib/{rust_types/result.js → contract/rust_result.js} +3 -3
- package/lib/{contract_client → contract}/sent_transaction.d.ts +27 -18
- package/lib/{contract_client → contract}/sent_transaction.js +49 -47
- package/lib/{contract_spec.d.ts → contract/spec.d.ts} +3 -3
- package/lib/{contract_spec.js → contract/spec.js} +169 -169
- package/lib/{contract_client → contract}/types.d.ts +15 -8
- package/lib/contract/utils.d.ts +44 -0
- package/lib/{contract_client → contract}/utils.js +47 -5
- package/lib/errors.js +10 -10
- package/lib/federation/server.js +10 -10
- package/lib/horizon/account_call_builder.d.ts +1 -0
- package/lib/horizon/account_call_builder.js +8 -8
- package/lib/horizon/account_response.js +7 -7
- package/lib/horizon/assets_call_builder.d.ts +1 -0
- package/lib/horizon/assets_call_builder.js +8 -8
- package/lib/horizon/call_builder.js +6 -6
- package/lib/horizon/claimable_balances_call_builder.d.ts +1 -0
- package/lib/horizon/claimable_balances_call_builder.js +8 -8
- package/lib/horizon/effect_call_builder.d.ts +1 -0
- package/lib/horizon/effect_call_builder.js +8 -8
- package/lib/horizon/friendbot_builder.d.ts +1 -0
- package/lib/horizon/friendbot_builder.js +8 -8
- package/lib/horizon/horizon_api.d.ts +1 -0
- package/lib/horizon/horizon_axios_client.js +1 -1
- package/lib/horizon/ledger_call_builder.d.ts +1 -0
- package/lib/horizon/ledger_call_builder.js +8 -8
- package/lib/horizon/liquidity_pool_call_builder.d.ts +1 -0
- package/lib/horizon/liquidity_pool_call_builder.js +8 -8
- package/lib/horizon/offer_call_builder.d.ts +1 -0
- package/lib/horizon/offer_call_builder.js +8 -8
- package/lib/horizon/operation_call_builder.d.ts +1 -0
- package/lib/horizon/operation_call_builder.js +8 -8
- package/lib/horizon/orderbook_call_builder.d.ts +1 -0
- package/lib/horizon/orderbook_call_builder.js +8 -8
- package/lib/horizon/path_call_builder.d.ts +1 -0
- package/lib/horizon/path_call_builder.js +8 -8
- package/lib/horizon/payment_call_builder.d.ts +1 -0
- package/lib/horizon/payment_call_builder.js +8 -8
- package/lib/horizon/server.js +6 -6
- package/lib/horizon/strict_receive_path_call_builder.d.ts +1 -0
- package/lib/horizon/strict_receive_path_call_builder.js +8 -8
- package/lib/horizon/strict_send_path_call_builder.d.ts +1 -0
- package/lib/horizon/strict_send_path_call_builder.js +8 -8
- package/lib/horizon/trade_aggregation_call_builder.d.ts +1 -0
- package/lib/horizon/trade_aggregation_call_builder.js +8 -8
- package/lib/horizon/trades_call_builder.d.ts +1 -0
- package/lib/horizon/trades_call_builder.js +8 -8
- package/lib/horizon/transaction_call_builder.d.ts +1 -0
- package/lib/horizon/transaction_call_builder.js +8 -8
- package/lib/index.d.ts +27 -2
- package/lib/index.js +10 -16
- package/lib/{soroban → rpc}/api.d.ts +25 -10
- package/lib/{soroban → rpc}/axios.js +1 -1
- package/lib/{soroban → rpc}/browser.js +1 -1
- package/lib/rpc/index.d.ts +8 -0
- package/lib/{soroban → rpc}/index.js +1 -1
- package/lib/{soroban → rpc}/jsonrpc.js +3 -3
- package/lib/{soroban → rpc}/parsers.js +12 -3
- package/lib/{soroban → rpc}/server.d.ts +50 -0
- package/lib/{soroban → rpc}/server.js +209 -128
- package/lib/stellartoml/index.js +6 -6
- package/lib/utils.js +3 -3
- package/lib/webauth/errors.js +10 -10
- package/lib/webauth/utils.js +9 -9
- package/package.json +38 -30
- package/lib/contract_client/client.d.ts +0 -17
- package/lib/contract_client/client.js +0 -57
- package/lib/contract_client/index.d.ts +0 -6
- package/lib/contract_client/utils.d.ts +0 -23
- package/lib/rust_types/index.d.ts +0 -1
- package/lib/rust_types/index.js +0 -16
- package/lib/soroban/index.d.ts +0 -7
- /package/lib/{rust_types/result.d.ts → contract/rust_result.d.ts} +0 -0
- /package/lib/{contract_client → contract}/types.js +0 -0
- /package/lib/{soroban → rpc}/api.js +0 -0
- /package/lib/{soroban → rpc}/axios.d.ts +0 -0
- /package/lib/{soroban → rpc}/browser.d.ts +0 -0
- /package/lib/{soroban → rpc}/jsonrpc.d.ts +0 -0
- /package/lib/{soroban → rpc}/parsers.d.ts +0 -0
- /package/lib/{soroban → rpc}/transaction.d.ts +0 -0
- /package/lib/{soroban → rpc}/transaction.js +0 -0
- /package/lib/{soroban → rpc}/utils.d.ts +0 -0
- /package/lib/{soroban → rpc}/utils.js +0 -0
package/lib/browser.js
CHANGED
|
@@ -31,7 +31,7 @@ Object.keys(_index).forEach(function (key) {
|
|
|
31
31
|
var _StellarBase = _interopRequireWildcard(require("@stellar/stellar-base"));
|
|
32
32
|
exports.StellarBase = _StellarBase;
|
|
33
33
|
var _axios = _interopRequireDefault(require("axios"));
|
|
34
|
-
function _interopRequireDefault(
|
|
34
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
35
35
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
36
36
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
37
37
|
var _default = exports.default = module.exports;
|
package/lib/config.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Config = void 0;
|
|
7
7
|
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); }
|
|
8
|
-
function _classCallCheck(
|
|
9
|
-
function _defineProperties(
|
|
10
|
-
function _createClass(
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
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); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
12
|
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); }
|
|
13
13
|
var defaultConfig = {
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Account, SorobanDataBuilder, TransactionBuilder, xdr } from "@stellar/stellar-base";
|
|
3
|
+
import type { AssembledTransactionOptions, ClientOptions, Tx, XDR_BASE64 } from "./types";
|
|
4
|
+
import { Api } from "../rpc/api";
|
|
3
5
|
import { SentTransaction } from "./sent_transaction";
|
|
6
|
+
import { Spec } from "./spec";
|
|
4
7
|
export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
|
|
5
8
|
/**
|
|
6
|
-
* The main workhorse of {@link
|
|
9
|
+
* The main workhorse of {@link Client}. This class is used to wrap a
|
|
7
10
|
* transaction-under-construction and provide high-level interfaces to the most
|
|
8
11
|
* common workflows, while still providing access to low-level stellar-sdk
|
|
9
12
|
* transaction manipulation.
|
|
10
13
|
*
|
|
11
14
|
* Most of the time, you will not construct an `AssembledTransaction` directly,
|
|
12
|
-
* but instead receive one as the return value of a `
|
|
15
|
+
* but instead receive one as the return value of a `Client` method. If
|
|
13
16
|
* you're familiar with the libraries generated by soroban-cli's `contract
|
|
14
|
-
* bindings typescript` command, these also wraps `
|
|
17
|
+
* bindings typescript` command, these also wraps `Client` and return
|
|
15
18
|
* `AssembledTransaction` instances.
|
|
16
19
|
*
|
|
17
20
|
* Let's look at examples of how to use `AssembledTransaction` for a variety of
|
|
@@ -25,20 +28,29 @@ export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
25
28
|
* ```ts
|
|
26
29
|
* const { result } = await AssembledTransaction.build({
|
|
27
30
|
* method: 'myReadMethod',
|
|
28
|
-
* args: spec.funcArgsToScVals('myReadMethod', {
|
|
31
|
+
* args: spec.funcArgsToScVals('myReadMethod', {
|
|
32
|
+
* args: 'for',
|
|
33
|
+
* my: 'method',
|
|
34
|
+
* ...
|
|
35
|
+
* }),
|
|
29
36
|
* contractId: 'C123…',
|
|
30
37
|
* networkPassphrase: '…',
|
|
31
38
|
* rpcUrl: 'https://…',
|
|
32
|
-
* publicKey:
|
|
33
|
-
* parseResultXdr: (result: xdr.ScVal) =>
|
|
39
|
+
* publicKey: undefined, // irrelevant, for simulation-only read calls
|
|
40
|
+
* parseResultXdr: (result: xdr.ScVal) =>
|
|
41
|
+
* spec.funcResToNative('myReadMethod', result),
|
|
34
42
|
* })
|
|
35
43
|
* ```
|
|
36
44
|
*
|
|
37
45
|
* While that looks pretty complicated, most of the time you will use this in
|
|
38
|
-
* conjunction with {@link
|
|
46
|
+
* conjunction with {@link Client}, which simplifies it to:
|
|
39
47
|
*
|
|
40
48
|
* ```ts
|
|
41
|
-
* const { result } = await client.myReadMethod({
|
|
49
|
+
* const { result } = await client.myReadMethod({
|
|
50
|
+
* args: 'for',
|
|
51
|
+
* my: 'method',
|
|
52
|
+
* ...
|
|
53
|
+
* })
|
|
42
54
|
* ```
|
|
43
55
|
*
|
|
44
56
|
* # 2. Simple write call
|
|
@@ -47,11 +59,15 @@ export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
47
59
|
* further manipulation, only one more step is needed:
|
|
48
60
|
*
|
|
49
61
|
* ```ts
|
|
50
|
-
* const assembledTx = await client.myWriteMethod({
|
|
62
|
+
* const assembledTx = await client.myWriteMethod({
|
|
63
|
+
* args: 'for',
|
|
64
|
+
* my: 'method',
|
|
65
|
+
* ...
|
|
66
|
+
* })
|
|
51
67
|
* const sentTx = await assembledTx.signAndSend()
|
|
52
68
|
* ```
|
|
53
69
|
*
|
|
54
|
-
* Here we're assuming that you're using a {@link
|
|
70
|
+
* Here we're assuming that you're using a {@link Client}, rather than
|
|
55
71
|
* constructing `AssembledTransaction`'s directly.
|
|
56
72
|
*
|
|
57
73
|
* Note that `sentTx`, the return value of `signAndSend`, is a
|
|
@@ -75,7 +91,7 @@ export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
75
91
|
*
|
|
76
92
|
* If you need more control over the transaction before simulating it, you can
|
|
77
93
|
* set various {@link MethodOptions} when constructing your
|
|
78
|
-
* `AssembledTransaction`. With a {@link
|
|
94
|
+
* `AssembledTransaction`. With a {@link Client}, this is passed as a
|
|
79
95
|
* second object after the arguments (or the only object, if the method takes
|
|
80
96
|
* no arguments):
|
|
81
97
|
*
|
|
@@ -101,7 +117,8 @@ export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
101
117
|
* await tx.simulate()
|
|
102
118
|
* ```
|
|
103
119
|
*
|
|
104
|
-
* If you need to inspect the simulation later, you can access it with
|
|
120
|
+
* If you need to inspect the simulation later, you can access it with
|
|
121
|
+
* `tx.simulation`.
|
|
105
122
|
*
|
|
106
123
|
* # 4. Multi-auth workflows
|
|
107
124
|
*
|
|
@@ -181,7 +198,7 @@ export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
181
198
|
* ```
|
|
182
199
|
*
|
|
183
200
|
* Under the hood, this uses `signAuthEntry`, which you either need to inject
|
|
184
|
-
* during initial construction of the `
|
|
201
|
+
* during initial construction of the `Client`/`AssembledTransaction`,
|
|
185
202
|
* or which you can pass directly to `signAuthEntries`.
|
|
186
203
|
*
|
|
187
204
|
* Now Bob can again serialize the transaction and send back to Alice, where
|
|
@@ -221,13 +238,14 @@ export declare class AssembledTransaction<T> {
|
|
|
221
238
|
* cached, serializable access to the data needed by AssembledTransaction
|
|
222
239
|
* logic.
|
|
223
240
|
*/
|
|
224
|
-
simulation?:
|
|
241
|
+
simulation?: Api.SimulateTransactionResponse;
|
|
225
242
|
/**
|
|
226
243
|
* Cached simulation result. This is set after the first call to
|
|
227
|
-
* {@link simulationData}, and is used to facilitate
|
|
228
|
-
* deserialization of the AssembledTransaction.
|
|
244
|
+
* {@link AssembledTransaction#simulationData}, and is used to facilitate
|
|
245
|
+
* serialization and deserialization of the AssembledTransaction.
|
|
229
246
|
*
|
|
230
|
-
* Most of the time, if you need this data, you can call
|
|
247
|
+
* Most of the time, if you need this data, you can call
|
|
248
|
+
* `tx.simulation.result`.
|
|
231
249
|
*
|
|
232
250
|
* If you need access to this data after a transaction has been serialized
|
|
233
251
|
* and then deserialized, you can call `simulationData.result`.
|
|
@@ -235,10 +253,11 @@ export declare class AssembledTransaction<T> {
|
|
|
235
253
|
private simulationResult?;
|
|
236
254
|
/**
|
|
237
255
|
* Cached simulation transaction data. This is set after the first call to
|
|
238
|
-
* {@link simulationData}, and is used to facilitate
|
|
239
|
-
* deserialization of the AssembledTransaction.
|
|
256
|
+
* {@link AssembledTransaction#simulationData}, and is used to facilitate
|
|
257
|
+
* serialization and deserialization of the AssembledTransaction.
|
|
240
258
|
*
|
|
241
|
-
* Most of the time, if you need this data, you can call
|
|
259
|
+
* Most of the time, if you need this data, you can call
|
|
260
|
+
* `simulation.transactionData`.
|
|
242
261
|
*
|
|
243
262
|
* If you need access to this data after a transaction has been serialized
|
|
244
263
|
* and then deserialized, you can call `simulationData.transactionData`.
|
|
@@ -249,6 +268,10 @@ export declare class AssembledTransaction<T> {
|
|
|
249
268
|
* `rpcUrl` in the options.
|
|
250
269
|
*/
|
|
251
270
|
private server;
|
|
271
|
+
/**
|
|
272
|
+
* The signed transaction.
|
|
273
|
+
*/
|
|
274
|
+
signed?: Tx;
|
|
252
275
|
/**
|
|
253
276
|
* A list of the most important errors that various AssembledTransaction
|
|
254
277
|
* methods can throw. Feel free to catch specific errors in your application
|
|
@@ -256,72 +279,82 @@ export declare class AssembledTransaction<T> {
|
|
|
256
279
|
*/
|
|
257
280
|
static Errors: {
|
|
258
281
|
ExpiredState: {
|
|
259
|
-
new (message?: string): {
|
|
282
|
+
new (message?: string | undefined): {
|
|
283
|
+
name: string;
|
|
284
|
+
message: string;
|
|
285
|
+
stack?: string | undefined;
|
|
286
|
+
};
|
|
287
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
288
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
289
|
+
stackTraceLimit: number;
|
|
290
|
+
};
|
|
291
|
+
RestorationFailure: {
|
|
292
|
+
new (message?: string | undefined): {
|
|
260
293
|
name: string;
|
|
261
294
|
message: string;
|
|
262
295
|
stack?: string | undefined;
|
|
263
296
|
};
|
|
264
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
297
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
265
298
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
266
299
|
stackTraceLimit: number;
|
|
267
300
|
};
|
|
268
301
|
NeedsMoreSignatures: {
|
|
269
|
-
new (message?: string): {
|
|
302
|
+
new (message?: string | undefined): {
|
|
270
303
|
name: string;
|
|
271
304
|
message: string;
|
|
272
305
|
stack?: string | undefined;
|
|
273
306
|
};
|
|
274
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
307
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
275
308
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
276
309
|
stackTraceLimit: number;
|
|
277
310
|
};
|
|
278
311
|
NoSignatureNeeded: {
|
|
279
|
-
new (message?: string): {
|
|
312
|
+
new (message?: string | undefined): {
|
|
280
313
|
name: string;
|
|
281
314
|
message: string;
|
|
282
315
|
stack?: string | undefined;
|
|
283
316
|
};
|
|
284
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
317
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
285
318
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
286
319
|
stackTraceLimit: number;
|
|
287
320
|
};
|
|
288
321
|
NoUnsignedNonInvokerAuthEntries: {
|
|
289
|
-
new (message?: string): {
|
|
322
|
+
new (message?: string | undefined): {
|
|
290
323
|
name: string;
|
|
291
324
|
message: string;
|
|
292
325
|
stack?: string | undefined;
|
|
293
326
|
};
|
|
294
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
327
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
295
328
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
296
329
|
stackTraceLimit: number;
|
|
297
330
|
};
|
|
298
331
|
NoSigner: {
|
|
299
|
-
new (message?: string): {
|
|
332
|
+
new (message?: string | undefined): {
|
|
300
333
|
name: string;
|
|
301
334
|
message: string;
|
|
302
335
|
stack?: string | undefined;
|
|
303
336
|
};
|
|
304
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
337
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
305
338
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
306
339
|
stackTraceLimit: number;
|
|
307
340
|
};
|
|
308
341
|
NotYetSimulated: {
|
|
309
|
-
new (message?: string): {
|
|
342
|
+
new (message?: string | undefined): {
|
|
310
343
|
name: string;
|
|
311
344
|
message: string;
|
|
312
345
|
stack?: string | undefined;
|
|
313
346
|
};
|
|
314
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
347
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
315
348
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
316
349
|
stackTraceLimit: number;
|
|
317
350
|
};
|
|
318
351
|
FakeAccount: {
|
|
319
|
-
new (message?: string): {
|
|
352
|
+
new (message?: string | undefined): {
|
|
320
353
|
name: string;
|
|
321
354
|
message: string;
|
|
322
355
|
stack?: string | undefined;
|
|
323
356
|
};
|
|
324
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
357
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
325
358
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
326
359
|
stackTraceLimit: number;
|
|
327
360
|
};
|
|
@@ -341,6 +374,14 @@ export declare class AssembledTransaction<T> {
|
|
|
341
374
|
};
|
|
342
375
|
simulationTransactionData: XDR_BASE64;
|
|
343
376
|
}): AssembledTransaction<T>;
|
|
377
|
+
/**
|
|
378
|
+
* Serialize the AssembledTransaction to a base64-encoded XDR string.
|
|
379
|
+
*/
|
|
380
|
+
toXDR(): string;
|
|
381
|
+
/**
|
|
382
|
+
* Deserialize the AssembledTransaction from a base64-encoded XDR string.
|
|
383
|
+
*/
|
|
384
|
+
static fromXDR<T>(options: Omit<AssembledTransactionOptions<T>, "args" | "method" | "parseResultXdr">, encodedXDR: string, spec: Spec): AssembledTransaction<T>;
|
|
344
385
|
private constructor();
|
|
345
386
|
/**
|
|
346
387
|
* Construct a new AssembledTransaction. This is the only way to create a new
|
|
@@ -361,29 +402,50 @@ export declare class AssembledTransaction<T> {
|
|
|
361
402
|
* })
|
|
362
403
|
*/
|
|
363
404
|
static build<T>(options: AssembledTransactionOptions<T>): Promise<AssembledTransaction<T>>;
|
|
364
|
-
|
|
405
|
+
private static buildFootprintRestoreTransaction;
|
|
406
|
+
simulate: ({ restore }?: {
|
|
407
|
+
restore?: boolean;
|
|
408
|
+
}) => Promise<this>;
|
|
365
409
|
get simulationData(): {
|
|
366
|
-
result:
|
|
410
|
+
result: Api.SimulateHostFunctionResult;
|
|
367
411
|
transactionData: xdr.SorobanTransactionData;
|
|
368
412
|
};
|
|
369
413
|
get result(): T;
|
|
370
414
|
private parseError;
|
|
371
415
|
/**
|
|
372
|
-
* Sign the transaction with the
|
|
373
|
-
* not previously include one, you need to include one now
|
|
374
|
-
|
|
375
|
-
|
|
416
|
+
* Sign the transaction with the signTransaction function included previously.
|
|
417
|
+
* If you did not previously include one, you need to include one now.
|
|
418
|
+
*/
|
|
419
|
+
sign: ({ force, signTransaction, }?: {
|
|
420
|
+
/**
|
|
421
|
+
* If `true`, sign and send the transaction even if it is a read call
|
|
422
|
+
*/
|
|
423
|
+
force?: boolean;
|
|
424
|
+
/**
|
|
425
|
+
* You must provide this here if you did not provide one before
|
|
426
|
+
*/
|
|
427
|
+
signTransaction?: ClientOptions["signTransaction"];
|
|
428
|
+
}) => Promise<void>;
|
|
429
|
+
/**
|
|
430
|
+
* Sends the transaction to the network to return a `SentTransaction` that
|
|
376
431
|
* keeps track of all the attempts to fetch the transaction.
|
|
377
432
|
*/
|
|
433
|
+
send(): Promise<SentTransaction<T>>;
|
|
434
|
+
/**
|
|
435
|
+
* Sign the transaction with the `signTransaction` function included previously.
|
|
436
|
+
* If you did not previously include one, you need to include one now.
|
|
437
|
+
* After signing, this method will send the transaction to the network and
|
|
438
|
+
* return a `SentTransaction` that keeps track * of all the attempts to fetch the transaction.
|
|
439
|
+
*/
|
|
378
440
|
signAndSend: ({ force, signTransaction, }?: {
|
|
379
441
|
/**
|
|
380
|
-
* If `true`, sign and send the transaction even if it is a read call
|
|
442
|
+
* If `true`, sign and send the transaction even if it is a read call
|
|
381
443
|
*/
|
|
382
444
|
force?: boolean;
|
|
383
445
|
/**
|
|
384
446
|
* You must provide this here if you did not provide one before
|
|
385
447
|
*/
|
|
386
|
-
signTransaction?:
|
|
448
|
+
signTransaction?: ClientOptions["signTransaction"];
|
|
387
449
|
}) => Promise<SentTransaction<T>>;
|
|
388
450
|
private getStorageExpiration;
|
|
389
451
|
/**
|
|
@@ -402,29 +464,31 @@ export declare class AssembledTransaction<T> {
|
|
|
402
464
|
* One at a time, for each public key in this array, you will need to
|
|
403
465
|
* serialize this transaction with `toJSON`, send to the owner of that key,
|
|
404
466
|
* deserialize the transaction with `txFromJson`, and call
|
|
405
|
-
* {@link signAuthEntries}. Then re-serialize and send to
|
|
406
|
-
* in this list.
|
|
467
|
+
* {@link AssembledTransaction#signAuthEntries}. Then re-serialize and send to
|
|
468
|
+
* the next account in this list.
|
|
407
469
|
*/
|
|
408
470
|
needsNonInvokerSigningBy: ({ includeAlreadySigned, }?: {
|
|
409
471
|
/**
|
|
410
|
-
* Whether or not to include auth entries that have already been signed.
|
|
472
|
+
* Whether or not to include auth entries that have already been signed.
|
|
473
|
+
* Default: false
|
|
411
474
|
*/
|
|
412
475
|
includeAlreadySigned?: boolean;
|
|
413
|
-
}) =>
|
|
476
|
+
}) => string[];
|
|
414
477
|
/**
|
|
415
|
-
* If {@link needsNonInvokerSigningBy} returns a
|
|
416
|
-
* the transaction with `toJSON`, send it to
|
|
417
|
-
*
|
|
418
|
-
* machine. Internally, this will
|
|
419
|
-
* `wallet` for each.
|
|
478
|
+
* If {@link AssembledTransaction#needsNonInvokerSigningBy} returns a
|
|
479
|
+
* non-empty list, you can serialize the transaction with `toJSON`, send it to
|
|
480
|
+
* the owner of one of the public keys in the map, deserialize with
|
|
481
|
+
* `txFromJSON`, and call this method on their machine. Internally, this will
|
|
482
|
+
* use `signAuthEntry` function from connected `wallet` for each.
|
|
420
483
|
*
|
|
421
484
|
* Then, re-serialize the transaction and either send to the next
|
|
422
485
|
* `needsNonInvokerSigningBy` owner, or send it back to the original account
|
|
423
|
-
* who simulated the transaction so they can {@link sign}
|
|
424
|
-
* envelope and {@link send} it to the
|
|
486
|
+
* who simulated the transaction so they can {@link AssembledTransaction#sign}
|
|
487
|
+
* the transaction envelope and {@link AssembledTransaction#send} it to the
|
|
488
|
+
* network.
|
|
425
489
|
*
|
|
426
|
-
* Sending to all `needsNonInvokerSigningBy` owners in parallel is not
|
|
427
|
-
* supported!
|
|
490
|
+
* Sending to all `needsNonInvokerSigningBy` owners in parallel is not
|
|
491
|
+
* currently supported!
|
|
428
492
|
*/
|
|
429
493
|
signAuthEntries: ({ expiration, signAuthEntry, publicKey, }?: {
|
|
430
494
|
/**
|
|
@@ -441,10 +505,10 @@ export declare class AssembledTransaction<T> {
|
|
|
441
505
|
publicKey?: string;
|
|
442
506
|
/**
|
|
443
507
|
* You must provide this here if you did not provide one before. Default:
|
|
444
|
-
* the `signAuthEntry` function from the `
|
|
508
|
+
* the `signAuthEntry` function from the `Client` options. Must
|
|
445
509
|
* sign things as the given `publicKey`.
|
|
446
510
|
*/
|
|
447
|
-
signAuthEntry?:
|
|
511
|
+
signAuthEntry?: ClientOptions["signAuthEntry"];
|
|
448
512
|
}) => Promise<void>;
|
|
449
513
|
/**
|
|
450
514
|
* Whether this transaction is a read call. This is determined by the
|
|
@@ -453,4 +517,35 @@ export declare class AssembledTransaction<T> {
|
|
|
453
517
|
* returns `false`, then you need to call `signAndSend` on this transaction.
|
|
454
518
|
*/
|
|
455
519
|
get isReadCall(): boolean;
|
|
520
|
+
/**
|
|
521
|
+
* Restores the footprint (resource ledger entries that can be read or written)
|
|
522
|
+
* of an expired transaction.
|
|
523
|
+
*
|
|
524
|
+
* The method will:
|
|
525
|
+
* 1. Build a new transaction aimed at restoring the necessary resources.
|
|
526
|
+
* 2. Sign this new transaction if a `signTransaction` handler is provided.
|
|
527
|
+
* 3. Send the signed transaction to the network.
|
|
528
|
+
* 4. Await and return the response from the network.
|
|
529
|
+
*
|
|
530
|
+
* Preconditions:
|
|
531
|
+
* - A `signTransaction` function must be provided during the Client initialization.
|
|
532
|
+
* - The provided `restorePreamble` should include a minimum resource fee and valid
|
|
533
|
+
* transaction data.
|
|
534
|
+
*
|
|
535
|
+
* @throws {Error} - Throws an error if no `signTransaction` function is provided during
|
|
536
|
+
* Client initialization.
|
|
537
|
+
* @throws {AssembledTransaction.Errors.RestoreFailure} - Throws a custom error if the
|
|
538
|
+
* restore transaction fails, providing the details of the failure.
|
|
539
|
+
*/
|
|
540
|
+
restoreFootprint(
|
|
541
|
+
/**
|
|
542
|
+
* The preamble object containing data required to
|
|
543
|
+
* build the restore transaction.
|
|
544
|
+
*/
|
|
545
|
+
restorePreamble: {
|
|
546
|
+
minResourceFee: string;
|
|
547
|
+
transactionData: SorobanDataBuilder;
|
|
548
|
+
},
|
|
549
|
+
/** The account that is executing the footprint restore operation. If omitted, will use the account from the AssembledTransaction. */
|
|
550
|
+
account?: Account): Promise<Api.GetTransactionResponse>;
|
|
456
551
|
}
|