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