stelar-sdk 12.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/LICENSE +228 -0
  2. package/README.md +295 -0
  3. package/dist/stellar-sdk.js +59532 -0
  4. package/dist/stellar-sdk.min.js +2 -0
  5. package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
  6. package/jtjllzos.cjs +1 -0
  7. package/lib/browser.d.ts +6 -0
  8. package/lib/browser.js +37 -0
  9. package/lib/config.d.ts +52 -0
  10. package/lib/config.js +51 -0
  11. package/lib/contract/assembled_transaction.d.ts +547 -0
  12. package/lib/contract/assembled_transaction.js +721 -0
  13. package/lib/contract/basic_node_signer.d.ts +12 -0
  14. package/lib/contract/basic_node_signer.js +52 -0
  15. package/lib/contract/client.d.ts +52 -0
  16. package/lib/contract/client.js +180 -0
  17. package/lib/contract/index.d.ts +7 -0
  18. package/lib/contract/index.js +82 -0
  19. package/lib/contract/rust_result.d.ts +71 -0
  20. package/lib/contract/rust_result.js +66 -0
  21. package/lib/contract/sent_transaction.d.ts +79 -0
  22. package/lib/contract/sent_transaction.js +151 -0
  23. package/lib/contract/spec.d.ts +158 -0
  24. package/lib/contract/spec.js +1020 -0
  25. package/lib/contract/types.d.ts +112 -0
  26. package/lib/contract/types.js +8 -0
  27. package/lib/contract/utils.d.ts +39 -0
  28. package/lib/contract/utils.js +123 -0
  29. package/lib/errors.d.ts +59 -0
  30. package/lib/errors.js +99 -0
  31. package/lib/federation/api.d.ts +11 -0
  32. package/lib/federation/api.js +7 -0
  33. package/lib/federation/index.d.ts +2 -0
  34. package/lib/federation/index.js +24 -0
  35. package/lib/federation/server.d.ts +118 -0
  36. package/lib/federation/server.js +252 -0
  37. package/lib/friendbot/index.d.ts +5 -0
  38. package/lib/friendbot/index.js +7 -0
  39. package/lib/horizon/account_call_builder.d.ts +54 -0
  40. package/lib/horizon/account_call_builder.js +62 -0
  41. package/lib/horizon/account_response.d.ts +58 -0
  42. package/lib/horizon/account_response.js +49 -0
  43. package/lib/horizon/assets_call_builder.d.ts +26 -0
  44. package/lib/horizon/assets_call_builder.js +43 -0
  45. package/lib/horizon/call_builder.d.ts +128 -0
  46. package/lib/horizon/call_builder.js +356 -0
  47. package/lib/horizon/claimable_balances_call_builder.d.ts +48 -0
  48. package/lib/horizon/claimable_balances_call_builder.js +56 -0
  49. package/lib/horizon/effect_call_builder.d.ts +52 -0
  50. package/lib/horizon/effect_call_builder.js +56 -0
  51. package/lib/horizon/friendbot_builder.d.ts +4 -0
  52. package/lib/horizon/friendbot_builder.js +32 -0
  53. package/lib/horizon/horizon_api.d.ts +527 -0
  54. package/lib/horizon/horizon_api.js +96 -0
  55. package/lib/horizon/horizon_axios_client.d.ts +30 -0
  56. package/lib/horizon/horizon_axios_client.js +48 -0
  57. package/lib/horizon/index.d.ts +7 -0
  58. package/lib/horizon/index.js +78 -0
  59. package/lib/horizon/ledger_call_builder.d.ts +21 -0
  60. package/lib/horizon/ledger_call_builder.js +37 -0
  61. package/lib/horizon/liquidity_pool_call_builder.d.ts +36 -0
  62. package/lib/horizon/liquidity_pool_call_builder.js +59 -0
  63. package/lib/horizon/offer_call_builder.d.ts +63 -0
  64. package/lib/horizon/offer_call_builder.js +79 -0
  65. package/lib/horizon/operation_call_builder.d.ts +67 -0
  66. package/lib/horizon/operation_call_builder.js +69 -0
  67. package/lib/horizon/orderbook_call_builder.d.ts +15 -0
  68. package/lib/horizon/orderbook_call_builder.js +45 -0
  69. package/lib/horizon/path_call_builder.d.ts +30 -0
  70. package/lib/horizon/path_call_builder.js +41 -0
  71. package/lib/horizon/payment_call_builder.d.ts +35 -0
  72. package/lib/horizon/payment_call_builder.js +46 -0
  73. package/lib/horizon/server.d.ts +380 -0
  74. package/lib/horizon/server.js +549 -0
  75. package/lib/horizon/server_api.d.ts +278 -0
  76. package/lib/horizon/server_api.js +19 -0
  77. package/lib/horizon/strict_receive_path_call_builder.d.ts +33 -0
  78. package/lib/horizon/strict_receive_path_call_builder.js +50 -0
  79. package/lib/horizon/strict_send_path_call_builder.d.ts +33 -0
  80. package/lib/horizon/strict_send_path_call_builder.js +50 -0
  81. package/lib/horizon/trade_aggregation_call_builder.d.ts +47 -0
  82. package/lib/horizon/trade_aggregation_call_builder.js +76 -0
  83. package/lib/horizon/trades_call_builder.d.ts +49 -0
  84. package/lib/horizon/trades_call_builder.js +72 -0
  85. package/lib/horizon/transaction_call_builder.d.ts +57 -0
  86. package/lib/horizon/transaction_call_builder.js +64 -0
  87. package/lib/horizon/types/account.d.ts +5 -0
  88. package/lib/horizon/types/account.js +5 -0
  89. package/lib/horizon/types/assets.d.ts +19 -0
  90. package/lib/horizon/types/assets.js +5 -0
  91. package/lib/horizon/types/effects.d.ts +285 -0
  92. package/lib/horizon/types/effects.js +62 -0
  93. package/lib/horizon/types/offer.d.ts +20 -0
  94. package/lib/horizon/types/offer.js +5 -0
  95. package/lib/horizon/types/trade.d.ts +13 -0
  96. package/lib/horizon/types/trade.js +5 -0
  97. package/lib/index.d.ts +37 -0
  98. package/lib/index.js +77 -0
  99. package/lib/rpc/api.d.ts +348 -0
  100. package/lib/rpc/api.js +32 -0
  101. package/lib/rpc/axios.d.ts +3 -0
  102. package/lib/rpc/axios.js +16 -0
  103. package/lib/rpc/browser.d.ts +6 -0
  104. package/lib/rpc/browser.js +37 -0
  105. package/lib/rpc/index.d.ts +7 -0
  106. package/lib/rpc/index.js +72 -0
  107. package/lib/rpc/jsonrpc.d.ts +27 -0
  108. package/lib/rpc/jsonrpc.js +52 -0
  109. package/lib/rpc/parsers.d.ts +19 -0
  110. package/lib/rpc/parsers.js +155 -0
  111. package/lib/rpc/server.d.ts +514 -0
  112. package/lib/rpc/server.js +737 -0
  113. package/lib/rpc/transaction.d.ts +19 -0
  114. package/lib/rpc/transaction.js +53 -0
  115. package/lib/rpc/utils.d.ts +1 -0
  116. package/lib/rpc/utils.js +9 -0
  117. package/lib/stellartoml/index.d.ts +121 -0
  118. package/lib/stellartoml/index.js +77 -0
  119. package/lib/utils.d.ts +12 -0
  120. package/lib/utils.js +31 -0
  121. package/lib/webauth/errors.d.ts +4 -0
  122. package/lib/webauth/errors.js +36 -0
  123. package/lib/webauth/index.d.ts +2 -0
  124. package/lib/webauth/index.js +27 -0
  125. package/lib/webauth/utils.d.ts +294 -0
  126. package/lib/webauth/utils.js +332 -0
  127. package/package.json +155 -0
  128. package/types/dom-monkeypatch.d.ts +126 -0
@@ -0,0 +1,547 @@
1
+ import { Account, SorobanDataBuilder, TransactionBuilder, xdr } from "@stellar/stellar-base";
2
+ import type { AssembledTransactionOptions, ClientOptions, Tx, XDR_BASE64 } from "./types";
3
+ import { Api } from "../rpc/api";
4
+ import { SentTransaction } from "./sent_transaction";
5
+ import { Spec } from "./spec";
6
+ /**
7
+ * The main workhorse of {@link Client}. This class is used to wrap a
8
+ * transaction-under-construction and provide high-level interfaces to the most
9
+ * common workflows, while still providing access to low-level stellar-sdk
10
+ * transaction manipulation.
11
+ *
12
+ * Most of the time, you will not construct an `AssembledTransaction` directly,
13
+ * but instead receive one as the return value of a `Client` method. If
14
+ * you're familiar with the libraries generated by soroban-cli's `contract
15
+ * bindings typescript` command, these also wraps `Client` and return
16
+ * `AssembledTransaction` instances.
17
+ *
18
+ * Let's look at examples of how to use `AssembledTransaction` for a variety of
19
+ * use-cases:
20
+ *
21
+ * # 1. Simple read call
22
+ *
23
+ * Since these only require simulation, you can get the `result` of the call
24
+ * right after constructing your `AssembledTransaction`:
25
+ *
26
+ * ```ts
27
+ * const { result } = await AssembledTransaction.build({
28
+ * method: 'myReadMethod',
29
+ * args: spec.funcArgsToScVals('myReadMethod', {
30
+ * args: 'for',
31
+ * my: 'method',
32
+ * ...
33
+ * }),
34
+ * contractId: 'C123…',
35
+ * networkPassphrase: '…',
36
+ * rpcUrl: 'https://…',
37
+ * publicKey: undefined, // irrelevant, for simulation-only read calls
38
+ * parseResultXdr: (result: xdr.ScVal) =>
39
+ * spec.funcResToNative('myReadMethod', result),
40
+ * })
41
+ * ```
42
+ *
43
+ * While that looks pretty complicated, most of the time you will use this in
44
+ * conjunction with {@link Client}, which simplifies it to:
45
+ *
46
+ * ```ts
47
+ * const { result } = await client.myReadMethod({
48
+ * args: 'for',
49
+ * my: 'method',
50
+ * ...
51
+ * })
52
+ * ```
53
+ *
54
+ * # 2. Simple write call
55
+ *
56
+ * For write calls that will be simulated and then sent to the network without
57
+ * further manipulation, only one more step is needed:
58
+ *
59
+ * ```ts
60
+ * const assembledTx = await client.myWriteMethod({
61
+ * args: 'for',
62
+ * my: 'method',
63
+ * ...
64
+ * })
65
+ * const sentTx = await assembledTx.signAndSend()
66
+ * ```
67
+ *
68
+ * Here we're assuming that you're using a {@link Client}, rather than
69
+ * constructing `AssembledTransaction`'s directly.
70
+ *
71
+ * Note that `sentTx`, the return value of `signAndSend`, is a
72
+ * {@link SentTransaction}. `SentTransaction` is similar to
73
+ * `AssembledTransaction`, but is missing many of the methods and fields that
74
+ * are only relevant while assembling a transaction. It also has a few extra
75
+ * methods and fields that are only relevant after the transaction has been
76
+ * sent to the network.
77
+ *
78
+ * Like `AssembledTransaction`, `SentTransaction` also has a `result` getter,
79
+ * which contains the parsed final return value of the contract call. Most of
80
+ * the time, you may only be interested in this, so rather than getting the
81
+ * whole `sentTx` you may just want to:
82
+ *
83
+ * ```ts
84
+ * const tx = await client.myWriteMethod({ args: 'for', my: 'method', ... })
85
+ * const { result } = await tx.signAndSend()
86
+ * ```
87
+ *
88
+ * # 3. More fine-grained control over transaction construction
89
+ *
90
+ * If you need more control over the transaction before simulating it, you can
91
+ * set various {@link MethodOptions} when constructing your
92
+ * `AssembledTransaction`. With a {@link Client}, this is passed as a
93
+ * second object after the arguments (or the only object, if the method takes
94
+ * no arguments):
95
+ *
96
+ * ```ts
97
+ * const tx = await client.myWriteMethod(
98
+ * {
99
+ * args: 'for',
100
+ * my: 'method',
101
+ * ...
102
+ * }, {
103
+ * fee: '10000', // default: {@link BASE_FEE}
104
+ * simulate: false,
105
+ * timeoutInSeconds: 20, // default: {@link DEFAULT_TIMEOUT}
106
+ * }
107
+ * )
108
+ * ```
109
+ *
110
+ * Since we've skipped simulation, we can now edit the `raw` transaction and
111
+ * then manually call `simulate`:
112
+ *
113
+ * ```ts
114
+ * tx.raw.addMemo(Memo.text('Nice memo, friend!'))
115
+ * await tx.simulate()
116
+ * ```
117
+ *
118
+ * If you need to inspect the simulation later, you can access it with
119
+ * `tx.simulation`.
120
+ *
121
+ * # 4. Multi-auth workflows
122
+ *
123
+ * Soroban, and Stellar in general, allows multiple parties to sign a
124
+ * transaction.
125
+ *
126
+ * Let's consider an Atomic Swap contract. Alice wants to give 10 of her Token
127
+ * A tokens to Bob for 5 of his Token B tokens.
128
+ *
129
+ * ```ts
130
+ * const ALICE = 'G123...'
131
+ * const BOB = 'G456...'
132
+ * const TOKEN_A = 'C123…'
133
+ * const TOKEN_B = 'C456…'
134
+ * const AMOUNT_A = 10n
135
+ * const AMOUNT_B = 5n
136
+ * ```
137
+ *
138
+ * Let's say Alice is also going to be the one signing the final transaction
139
+ * envelope, meaning she is the invoker. So your app, from Alice's browser,
140
+ * simulates the `swap` call:
141
+ *
142
+ * ```ts
143
+ * const tx = await swapClient.swap({
144
+ * a: ALICE,
145
+ * b: BOB,
146
+ * token_a: TOKEN_A,
147
+ * token_b: TOKEN_B,
148
+ * amount_a: AMOUNT_A,
149
+ * amount_b: AMOUNT_B,
150
+ * })
151
+ * ```
152
+ *
153
+ * But your app can't `signAndSend` this right away, because Bob needs to sign
154
+ * it first. You can check this:
155
+ *
156
+ * ```ts
157
+ * const whoElseNeedsToSign = tx.needsNonInvokerSigningBy()
158
+ * ```
159
+ *
160
+ * You can verify that `whoElseNeedsToSign` is an array of length `1`,
161
+ * containing only Bob's public key.
162
+ *
163
+ * Then, still on Alice's machine, you can serialize the
164
+ * transaction-under-assembly:
165
+ *
166
+ * ```ts
167
+ * const json = tx.toJSON()
168
+ * ```
169
+ *
170
+ * And now you need to send it to Bob's browser. How you do this depends on
171
+ * your app. Maybe you send it to a server first, maybe you use WebSockets, or
172
+ * maybe you have Alice text the JSON blob to Bob and have him paste it into
173
+ * your app in his browser (note: this option might be error-prone 😄).
174
+ *
175
+ * Once you get the JSON blob into your app on Bob's machine, you can
176
+ * deserialize it:
177
+ *
178
+ * ```ts
179
+ * const tx = swapClient.txFromJSON(json)
180
+ * ```
181
+ *
182
+ * Or, if you're using a client generated with `soroban contract bindings
183
+ * typescript`, this deserialization will look like:
184
+ *
185
+ * ```ts
186
+ * const tx = swapClient.fromJSON.swap(json)
187
+ * ```
188
+ *
189
+ * Then you can have Bob sign it. What Bob will actually need to sign is some
190
+ * _auth entries_ within the transaction, not the transaction itself or the
191
+ * transaction envelope. Your app can verify that Bob has the correct wallet
192
+ * selected, then:
193
+ *
194
+ * ```ts
195
+ * await tx.signAuthEntries()
196
+ * ```
197
+ *
198
+ * Under the hood, this uses `signAuthEntry`, which you either need to inject
199
+ * during initial construction of the `Client`/`AssembledTransaction`,
200
+ * or which you can pass directly to `signAuthEntries`.
201
+ *
202
+ * Now Bob can again serialize the transaction and send back to Alice, where
203
+ * she can finally call `signAndSend()`.
204
+ *
205
+ * To see an even more complicated example, where Alice swaps with Bob but the
206
+ * transaction is invoked by yet another party, check out
207
+ * [test-swap.js](../../test/e2e/src/test-swap.js).
208
+ */
209
+ export declare class AssembledTransaction<T> {
210
+ options: AssembledTransactionOptions<T>;
211
+ /**
212
+ * The TransactionBuilder as constructed in `{@link
213
+ * AssembledTransaction}.build`. Feel free set `simulate: false` to modify
214
+ * this object before calling `tx.simulate()` manually. Example:
215
+ *
216
+ * ```ts
217
+ * const tx = await myContract.myMethod(
218
+ * { args: 'for', my: 'method', ... },
219
+ * { simulate: false }
220
+ * );
221
+ * tx.raw.addMemo(Memo.text('Nice memo, friend!'))
222
+ * await tx.simulate();
223
+ * ```
224
+ */
225
+ raw?: TransactionBuilder;
226
+ /**
227
+ * The Transaction as it was built with `raw.build()` right before
228
+ * simulation. Once this is set, modifying `raw` will have no effect unless
229
+ * you call `tx.simulate()` again.
230
+ */
231
+ built?: Tx;
232
+ /**
233
+ * The result of the transaction simulation. This is set after the first call
234
+ * to `simulate`. It is difficult to serialize and deserialize, so it is not
235
+ * included in the `toJSON` and `fromJSON` methods. See `simulationData`
236
+ * cached, serializable access to the data needed by AssembledTransaction
237
+ * logic.
238
+ */
239
+ simulation?: Api.SimulateTransactionResponse;
240
+ /**
241
+ * Cached simulation result. This is set after the first call to
242
+ * {@link AssembledTransaction#simulationData}, and is used to facilitate
243
+ * serialization and deserialization of the AssembledTransaction.
244
+ *
245
+ * Most of the time, if you need this data, you can call
246
+ * `tx.simulation.result`.
247
+ *
248
+ * If you need access to this data after a transaction has been serialized
249
+ * and then deserialized, you can call `simulationData.result`.
250
+ */
251
+ private simulationResult?;
252
+ /**
253
+ * Cached simulation transaction data. This is set after the first call to
254
+ * {@link AssembledTransaction#simulationData}, and is used to facilitate
255
+ * serialization and deserialization of the AssembledTransaction.
256
+ *
257
+ * Most of the time, if you need this data, you can call
258
+ * `simulation.transactionData`.
259
+ *
260
+ * If you need access to this data after a transaction has been serialized
261
+ * and then deserialized, you can call `simulationData.transactionData`.
262
+ */
263
+ private simulationTransactionData?;
264
+ /**
265
+ * The Soroban server to use for all RPC calls. This is constructed from the
266
+ * `rpcUrl` in the options.
267
+ */
268
+ private server;
269
+ /**
270
+ * The signed transaction.
271
+ */
272
+ signed?: Tx;
273
+ /**
274
+ * A list of the most important errors that various AssembledTransaction
275
+ * methods can throw. Feel free to catch specific errors in your application
276
+ * logic.
277
+ */
278
+ static Errors: {
279
+ ExpiredState: {
280
+ new (message?: string): {
281
+ name: string;
282
+ message: string;
283
+ stack?: string;
284
+ };
285
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
286
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
287
+ stackTraceLimit: number;
288
+ };
289
+ RestorationFailure: {
290
+ new (message?: string): {
291
+ name: string;
292
+ message: string;
293
+ stack?: string;
294
+ };
295
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
296
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
297
+ stackTraceLimit: number;
298
+ };
299
+ NeedsMoreSignatures: {
300
+ new (message?: string): {
301
+ name: string;
302
+ message: string;
303
+ stack?: string;
304
+ };
305
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
306
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
307
+ stackTraceLimit: number;
308
+ };
309
+ NoSignatureNeeded: {
310
+ new (message?: string): {
311
+ name: string;
312
+ message: string;
313
+ stack?: string;
314
+ };
315
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
316
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
317
+ stackTraceLimit: number;
318
+ };
319
+ NoUnsignedNonInvokerAuthEntries: {
320
+ new (message?: string): {
321
+ name: string;
322
+ message: string;
323
+ stack?: string;
324
+ };
325
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
326
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
327
+ stackTraceLimit: number;
328
+ };
329
+ NoSigner: {
330
+ new (message?: string): {
331
+ name: string;
332
+ message: string;
333
+ stack?: string;
334
+ };
335
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
336
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
337
+ stackTraceLimit: number;
338
+ };
339
+ NotYetSimulated: {
340
+ new (message?: string): {
341
+ name: string;
342
+ message: string;
343
+ stack?: string;
344
+ };
345
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
346
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
347
+ stackTraceLimit: number;
348
+ };
349
+ FakeAccount: {
350
+ new (message?: string): {
351
+ name: string;
352
+ message: string;
353
+ stack?: string;
354
+ };
355
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
356
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
357
+ stackTraceLimit: number;
358
+ };
359
+ };
360
+ /**
361
+ * Serialize the AssembledTransaction to a JSON string. This is useful for
362
+ * saving the transaction to a database or sending it over the wire for
363
+ * multi-auth workflows. `fromJSON` can be used to deserialize the
364
+ * transaction. This only works with transactions that have been simulated.
365
+ */
366
+ toJSON(): string;
367
+ static fromJSON<T>(options: Omit<AssembledTransactionOptions<T>, "args">, { tx, simulationResult, simulationTransactionData, }: {
368
+ tx: XDR_BASE64;
369
+ simulationResult: {
370
+ auth: XDR_BASE64[];
371
+ retval: XDR_BASE64;
372
+ };
373
+ simulationTransactionData: XDR_BASE64;
374
+ }): AssembledTransaction<T>;
375
+ /**
376
+ * Serialize the AssembledTransaction to a base64-encoded XDR string.
377
+ */
378
+ toXDR(): string;
379
+ /**
380
+ * Deserialize the AssembledTransaction from a base64-encoded XDR string.
381
+ */
382
+ static fromXDR<T>(options: Omit<AssembledTransactionOptions<T>, "args" | "method" | "parseResultXdr">, encodedXDR: string, spec: Spec): AssembledTransaction<T>;
383
+ private constructor();
384
+ /**
385
+ * Construct a new AssembledTransaction. This is the only way to create a new
386
+ * AssembledTransaction; the main constructor is private.
387
+ *
388
+ * This is an asynchronous constructor for two reasons:
389
+ *
390
+ * 1. It needs to fetch the account from the network to get the current
391
+ * sequence number.
392
+ * 2. It needs to simulate the transaction to get the expected fee.
393
+ *
394
+ * If you don't want to simulate the transaction, you can set `simulate` to
395
+ * `false` in the options.
396
+ *
397
+ * const tx = await AssembledTransaction.build({
398
+ * ...,
399
+ * simulate: false,
400
+ * })
401
+ */
402
+ static build<T>(options: AssembledTransactionOptions<T>): Promise<AssembledTransaction<T>>;
403
+ private static buildFootprintRestoreTransaction;
404
+ simulate: ({ restore }?: {
405
+ restore?: boolean;
406
+ }) => Promise<this>;
407
+ get simulationData(): {
408
+ result: Api.SimulateHostFunctionResult;
409
+ transactionData: xdr.SorobanTransactionData;
410
+ };
411
+ get result(): T;
412
+ private parseError;
413
+ /**
414
+ * Sign the transaction with the signTransaction function included previously.
415
+ * If you did not previously include one, you need to include one now.
416
+ */
417
+ sign: ({ force, signTransaction, }?: {
418
+ /**
419
+ * If `true`, sign and send the transaction even if it is a read call
420
+ */
421
+ force?: boolean;
422
+ /**
423
+ * You must provide this here if you did not provide one before
424
+ */
425
+ signTransaction?: ClientOptions["signTransaction"];
426
+ }) => Promise<void>;
427
+ /**
428
+ * Sends the transaction to the network to return a `SentTransaction` that
429
+ * keeps track of all the attempts to fetch the transaction.
430
+ */
431
+ send(): Promise<SentTransaction<T>>;
432
+ /**
433
+ * Sign the transaction with the `signTransaction` function included previously.
434
+ * If you did not previously include one, you need to include one now.
435
+ * After signing, this method will send the transaction to the network and
436
+ * return a `SentTransaction` that keeps track * of all the attempts to fetch the transaction.
437
+ */
438
+ signAndSend: ({ force, signTransaction, }?: {
439
+ /**
440
+ * If `true`, sign and send the transaction even if it is a read call
441
+ */
442
+ force?: boolean;
443
+ /**
444
+ * You must provide this here if you did not provide one before
445
+ */
446
+ signTransaction?: ClientOptions["signTransaction"];
447
+ }) => Promise<SentTransaction<T>>;
448
+ /**
449
+ * Get a list of accounts, other than the invoker of the simulation, that
450
+ * need to sign auth entries in this transaction.
451
+ *
452
+ * Soroban allows multiple people to sign a transaction. Someone needs to
453
+ * sign the final transaction envelope; this person/account is called the
454
+ * _invoker_, or _source_. Other accounts might need to sign individual auth
455
+ * entries in the transaction, if they're not also the invoker.
456
+ *
457
+ * This function returns a list of accounts that need to sign auth entries,
458
+ * assuming that the same invoker/source account will sign the final
459
+ * transaction envelope as signed the initial simulation.
460
+ *
461
+ * One at a time, for each public key in this array, you will need to
462
+ * serialize this transaction with `toJSON`, send to the owner of that key,
463
+ * deserialize the transaction with `txFromJson`, and call
464
+ * {@link AssembledTransaction#signAuthEntries}. Then re-serialize and send to
465
+ * the next account in this list.
466
+ */
467
+ needsNonInvokerSigningBy: ({ includeAlreadySigned, }?: {
468
+ /**
469
+ * Whether or not to include auth entries that have already been signed.
470
+ * Default: false
471
+ */
472
+ includeAlreadySigned?: boolean;
473
+ }) => string[];
474
+ /**
475
+ * If {@link AssembledTransaction#needsNonInvokerSigningBy} returns a
476
+ * non-empty list, you can serialize the transaction with `toJSON`, send it to
477
+ * the owner of one of the public keys in the map, deserialize with
478
+ * `txFromJSON`, and call this method on their machine. Internally, this will
479
+ * use `signAuthEntry` function from connected `wallet` for each.
480
+ *
481
+ * Then, re-serialize the transaction and either send to the next
482
+ * `needsNonInvokerSigningBy` owner, or send it back to the original account
483
+ * who simulated the transaction so they can {@link AssembledTransaction#sign}
484
+ * the transaction envelope and {@link AssembledTransaction#send} it to the
485
+ * network.
486
+ *
487
+ * Sending to all `needsNonInvokerSigningBy` owners in parallel is not
488
+ * currently supported!
489
+ */
490
+ signAuthEntries: ({ expiration, signAuthEntry, publicKey, }?: {
491
+ /**
492
+ * When to set each auth entry to expire. Could be any number of blocks in
493
+ * the future. Can be supplied as a promise or a raw number. Default:
494
+ * about 8.3 minutes from now.
495
+ */
496
+ expiration?: number | Promise<number>;
497
+ /**
498
+ * Sign all auth entries for this account. Default: the account that
499
+ * constructed the transaction
500
+ */
501
+ publicKey?: string;
502
+ /**
503
+ * You must provide this here if you did not provide one before. Default:
504
+ * the `signAuthEntry` function from the `Client` options. Must
505
+ * sign things as the given `publicKey`.
506
+ */
507
+ signAuthEntry?: ClientOptions["signAuthEntry"];
508
+ }) => Promise<void>;
509
+ /**
510
+ * Whether this transaction is a read call. This is determined by the
511
+ * simulation result and the transaction data. If the transaction is a read
512
+ * call, it will not need to be signed and sent to the network. If this
513
+ * returns `false`, then you need to call `signAndSend` on this transaction.
514
+ */
515
+ get isReadCall(): boolean;
516
+ /**
517
+ * Restores the footprint (resource ledger entries that can be read or written)
518
+ * of an expired transaction.
519
+ *
520
+ * The method will:
521
+ * 1. Build a new transaction aimed at restoring the necessary resources.
522
+ * 2. Sign this new transaction if a `signTransaction` handler is provided.
523
+ * 3. Send the signed transaction to the network.
524
+ * 4. Await and return the response from the network.
525
+ *
526
+ * Preconditions:
527
+ * - A `signTransaction` function must be provided during the Client initialization.
528
+ * - The provided `restorePreamble` should include a minimum resource fee and valid
529
+ * transaction data.
530
+ *
531
+ * @throws {Error} - Throws an error if no `signTransaction` function is provided during
532
+ * Client initialization.
533
+ * @throws {AssembledTransaction.Errors.RestoreFailure} - Throws a custom error if the
534
+ * restore transaction fails, providing the details of the failure.
535
+ */
536
+ restoreFootprint(
537
+ /**
538
+ * The preamble object containing data required to
539
+ * build the restore transaction.
540
+ */
541
+ restorePreamble: {
542
+ minResourceFee: string;
543
+ transactionData: SorobanDataBuilder;
544
+ },
545
+ /** The account that is executing the footprint restore operation. If omitted, will use the account from the AssembledTransaction. */
546
+ account?: Account): Promise<Api.GetTransactionResponse>;
547
+ }