|
1 | 1 | import xdr from '../xdr';
|
2 | 2 |
|
3 | 3 | /**
|
4 |
| - * Builds an operation to bump the time-to-live of a footprint (read and written |
5 |
| - * ledger keys). Its only parameter is the new, absolute ledger sequence number |
6 |
| - * at which the entry will expire. |
| 4 | + * Builds an operation to bump the time-to-live (TTL) of the ledger keys. The |
| 5 | + * keys for extension have to be provided in the read-only footprint of |
| 6 | + * the transaction. |
7 | 7 | *
|
8 |
| - * The footprint itself is derived from the transaction (see |
| 8 | + * The only parameter of the operation itself is the new minimum TTL for |
| 9 | + * all the provided entries. If an entry already has a higher TTL, then it |
| 10 | + * will just be skipped. |
| 11 | + * |
| 12 | + * TTL is the number of ledgers from the current ledger (exclusive) until |
| 13 | + * the last ledger the entry is still considered alive (inclusive). Thus |
| 14 | + * the exact ledger until the entries will live will only be determined |
| 15 | + * when transaction has been applied. |
| 16 | + * |
| 17 | + * The footprint has to be specified in the transaction. See |
9 | 18 | * {@link TransactionBuilder}'s `opts.sorobanData` parameter, which is a
|
10 | 19 | * {@link xdr.SorobanTransactionData} instance that contains fee data & resource
|
11 |
| - * usage as part of {@link xdr.SorobanResources}). |
| 20 | + * usage as part of {@link xdr.SorobanResources}. |
12 | 21 | *
|
13 | 22 | * @function
|
14 | 23 | * @alias Operation.extendFootprintTtl
|
15 | 24 | *
|
16 | 25 | * @param {object} opts - object holding operation parameters
|
17 |
| - * @param {number} opts.extendTo - the absolute ledger sequence number at which |
18 |
| - * the transaction's ledger keys will now expire |
| 26 | + * @param {number} opts.extendTo - the minimum TTL that all the entries in |
| 27 | + * the read-only footprint will have |
19 | 28 | * @param {string} [opts.source] - an optional source account
|
20 | 29 | *
|
21 | 30 | * @returns {xdr.Operation} an Extend Footprint TTL operation
|
22 | 31 | * (xdr.ExtendFootprintTTLOp)
|
23 | 32 | */
|
24 | 33 | export function extendFootprintTtl(opts) {
|
25 | 34 | if ((opts.extendTo ?? -1) <= 0) {
|
26 |
| - throw new RangeError("extendTo isn't a ledger quantity (uint32)"); |
| 35 | + throw new RangeError('extendTo has to be positive'); |
27 | 36 | }
|
28 | 37 |
|
29 | 38 | const extendFootprintOp = new xdr.ExtendFootprintTtlOp({
|
|
0 commit comments