@stellar/stellar-sdk 12.0.1 → 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 +18 -0
- package/dist/stellar-sdk.js +454 -186
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/contract/assembled_transaction.d.ts +81 -6
- package/lib/contract/assembled_transaction.js +358 -124
- package/lib/contract/client.d.ts +1 -0
- package/lib/contract/client.js +3 -0
- package/lib/contract/index.d.ts +1 -0
- package/lib/contract/index.js +18 -1
- package/lib/contract/sent_transaction.d.ts +5 -8
- package/lib/contract/sent_transaction.js +16 -33
- package/lib/contract/types.d.ts +5 -0
- package/lib/contract/utils.d.ts +4 -1
- package/lib/contract/utils.js +32 -0
- package/package.json +18 -27
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { TransactionBuilder, xdr } from "@stellar/stellar-base";
|
|
2
|
+
import { Account, SorobanDataBuilder, TransactionBuilder, xdr } from "@stellar/stellar-base";
|
|
3
3
|
import type { AssembledTransactionOptions, ClientOptions, Tx, XDR_BASE64 } from "./types";
|
|
4
4
|
import { Api } from "../rpc/api";
|
|
5
5
|
import { SentTransaction } from "./sent_transaction";
|
|
6
|
+
import { Spec } from "./spec";
|
|
6
7
|
export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
|
|
7
8
|
/**
|
|
8
9
|
* The main workhorse of {@link Client}. This class is used to wrap a
|
|
@@ -267,6 +268,10 @@ export declare class AssembledTransaction<T> {
|
|
|
267
268
|
* `rpcUrl` in the options.
|
|
268
269
|
*/
|
|
269
270
|
private server;
|
|
271
|
+
/**
|
|
272
|
+
* The signed transaction.
|
|
273
|
+
*/
|
|
274
|
+
signed?: Tx;
|
|
270
275
|
/**
|
|
271
276
|
* A list of the most important errors that various AssembledTransaction
|
|
272
277
|
* methods can throw. Feel free to catch specific errors in your application
|
|
@@ -283,6 +288,16 @@ export declare class AssembledTransaction<T> {
|
|
|
283
288
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
284
289
|
stackTraceLimit: number;
|
|
285
290
|
};
|
|
291
|
+
RestorationFailure: {
|
|
292
|
+
new (message?: string | undefined): {
|
|
293
|
+
name: string;
|
|
294
|
+
message: string;
|
|
295
|
+
stack?: string | undefined;
|
|
296
|
+
};
|
|
297
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
298
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
299
|
+
stackTraceLimit: number;
|
|
300
|
+
};
|
|
286
301
|
NeedsMoreSignatures: {
|
|
287
302
|
new (message?: string | undefined): {
|
|
288
303
|
name: string;
|
|
@@ -359,6 +374,14 @@ export declare class AssembledTransaction<T> {
|
|
|
359
374
|
};
|
|
360
375
|
simulationTransactionData: XDR_BASE64;
|
|
361
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>;
|
|
362
385
|
private constructor();
|
|
363
386
|
/**
|
|
364
387
|
* Construct a new AssembledTransaction. This is the only way to create a new
|
|
@@ -379,7 +402,10 @@ export declare class AssembledTransaction<T> {
|
|
|
379
402
|
* })
|
|
380
403
|
*/
|
|
381
404
|
static build<T>(options: AssembledTransactionOptions<T>): Promise<AssembledTransaction<T>>;
|
|
382
|
-
|
|
405
|
+
private static buildFootprintRestoreTransaction;
|
|
406
|
+
simulate: ({ restore }?: {
|
|
407
|
+
restore?: boolean;
|
|
408
|
+
}) => Promise<this>;
|
|
383
409
|
get simulationData(): {
|
|
384
410
|
result: Api.SimulateHostFunctionResult;
|
|
385
411
|
transactionData: xdr.SorobanTransactionData;
|
|
@@ -387,12 +413,30 @@ export declare class AssembledTransaction<T> {
|
|
|
387
413
|
get result(): T;
|
|
388
414
|
private parseError;
|
|
389
415
|
/**
|
|
390
|
-
* Sign the transaction with the
|
|
391
|
-
* not previously include one, you need to include one now
|
|
392
|
-
|
|
393
|
-
|
|
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
|
|
394
431
|
* keeps track of all the attempts to fetch the transaction.
|
|
395
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
|
+
*/
|
|
396
440
|
signAndSend: ({ force, signTransaction, }?: {
|
|
397
441
|
/**
|
|
398
442
|
* If `true`, sign and send the transaction even if it is a read call
|
|
@@ -473,4 +517,35 @@ export declare class AssembledTransaction<T> {
|
|
|
473
517
|
* returns `false`, then you need to call `signAndSend` on this transaction.
|
|
474
518
|
*/
|
|
475
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>;
|
|
476
551
|
}
|