@stellar/stellar-base 12.0.0 → 12.0.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.
- package/CHANGELOG.md +16 -0
- package/dist/stellar-base.js +40 -25
- package/dist/stellar-base.min.js +1 -1
- package/lib/operations/extend_footprint_ttl.js +17 -8
- package/lib/operations/restore_footprint.js +7 -3
- package/lib/scval.js +16 -14
- package/package.json +10 -10
- package/types/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## [`v12.0.1`](https://github.com/stellar/js-stellar-base/compare/v12.0.0...v12.0.1)
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
* `scValToNative` would fail when the values contained error codes because the parsing routine hadn't been updated to the new error schemas. Errors are now converted to the following format:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
interface Error {
|
|
13
|
+
type: "contract" | "soroban";
|
|
14
|
+
code: number;
|
|
15
|
+
value?: string; // only present for type === 'soroban'
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
You can refer to the [XDR documentation](https://github.com/stellar/stellar-xdr/blob/70180d5e8d9caee9e8645ed8a38c36a8cf403cd9/Stellar-contract.x#L76-L115) for additional explanations for each error code.
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [`v12.0.0`](https://github.com/stellar/js-stellar-base/compare/v11.0.1...v12.0.0)
|
|
7
23
|
|
|
8
24
|
This is a re-tag of v12.0.0-rc.1 with only developer dependency updates in-between.
|
package/dist/stellar-base.js
CHANGED
|
@@ -17126,21 +17126,30 @@ function getSalty() {
|
|
|
17126
17126
|
|
|
17127
17127
|
|
|
17128
17128
|
/**
|
|
17129
|
-
* Builds an operation to bump the time-to-live of
|
|
17130
|
-
*
|
|
17131
|
-
*
|
|
17129
|
+
* Builds an operation to bump the time-to-live (TTL) of the ledger keys. The
|
|
17130
|
+
* keys for extension have to be provided in the read-only footprint of
|
|
17131
|
+
* the transaction.
|
|
17132
17132
|
*
|
|
17133
|
-
* The
|
|
17133
|
+
* The only parameter of the operation itself is the new minimum TTL for
|
|
17134
|
+
* all the provided entries. If an entry already has a higher TTL, then it
|
|
17135
|
+
* will just be skipped.
|
|
17136
|
+
*
|
|
17137
|
+
* TTL is the number of ledgers from the current ledger (exclusive) until
|
|
17138
|
+
* the last ledger the entry is still considered alive (inclusive). Thus
|
|
17139
|
+
* the exact ledger until the entries will live will only be determined
|
|
17140
|
+
* when transaction has been applied.
|
|
17141
|
+
*
|
|
17142
|
+
* The footprint has to be specified in the transaction. See
|
|
17134
17143
|
* {@link TransactionBuilder}'s `opts.sorobanData` parameter, which is a
|
|
17135
17144
|
* {@link xdr.SorobanTransactionData} instance that contains fee data & resource
|
|
17136
|
-
* usage as part of {@link xdr.SorobanResources}
|
|
17145
|
+
* usage as part of {@link xdr.SorobanResources}.
|
|
17137
17146
|
*
|
|
17138
17147
|
* @function
|
|
17139
17148
|
* @alias Operation.extendFootprintTtl
|
|
17140
17149
|
*
|
|
17141
17150
|
* @param {object} opts - object holding operation parameters
|
|
17142
|
-
* @param {number} opts.extendTo - the
|
|
17143
|
-
*
|
|
17151
|
+
* @param {number} opts.extendTo - the minimum TTL that all the entries in
|
|
17152
|
+
* the read-only footprint will have
|
|
17144
17153
|
* @param {string} [opts.source] - an optional source account
|
|
17145
17154
|
*
|
|
17146
17155
|
* @returns {xdr.Operation} an Extend Footprint TTL operation
|
|
@@ -17149,7 +17158,7 @@ function getSalty() {
|
|
|
17149
17158
|
function extendFootprintTtl(opts) {
|
|
17150
17159
|
var _opts$extendTo;
|
|
17151
17160
|
if (((_opts$extendTo = opts.extendTo) !== null && _opts$extendTo !== void 0 ? _opts$extendTo : -1) <= 0) {
|
|
17152
|
-
throw new RangeError(
|
|
17161
|
+
throw new RangeError('extendTo has to be positive');
|
|
17153
17162
|
}
|
|
17154
17163
|
var extendFootprintOp = new src_xdr.ExtendFootprintTtlOp({
|
|
17155
17164
|
ext: new src_xdr.ExtensionPoint(0),
|
|
@@ -17165,14 +17174,18 @@ function extendFootprintTtl(opts) {
|
|
|
17165
17174
|
|
|
17166
17175
|
|
|
17167
17176
|
/**
|
|
17168
|
-
* Builds
|
|
17177
|
+
* Builds an operation to restore the archived ledger entries specified
|
|
17178
|
+
* by the ledger keys.
|
|
17179
|
+
*
|
|
17180
|
+
* The ledger keys to restore are specified separately from the operation
|
|
17181
|
+
* in read-write footprint of the transaction.
|
|
17169
17182
|
*
|
|
17170
17183
|
* It takes no parameters because the relevant footprint is derived from the
|
|
17171
|
-
* transaction itself
|
|
17184
|
+
* transaction itself. See {@link TransactionBuilder}'s `opts.sorobanData`
|
|
17172
17185
|
* parameter (or {@link TransactionBuilder.setSorobanData} /
|
|
17173
17186
|
* {@link TransactionBuilder.setLedgerKeys}), which is a
|
|
17174
17187
|
* {@link xdr.SorobanTransactionData} instance that contains fee data & resource
|
|
17175
|
-
* usage as part of {@link xdr.SorobanTransactionData}
|
|
17188
|
+
* usage as part of {@link xdr.SorobanTransactionData}.
|
|
17176
17189
|
*
|
|
17177
17190
|
* @function
|
|
17178
17191
|
* @alias Operation.restoreFootprint
|
|
@@ -21137,21 +21150,23 @@ function scValToNative(scv) {
|
|
|
21137
21150
|
case src_xdr.ScValType.scvTimepoint().value:
|
|
21138
21151
|
case src_xdr.ScValType.scvDuration().value:
|
|
21139
21152
|
return new src_xdr.Uint64(scv.value()).toBigInt();
|
|
21140
|
-
case src_xdr.ScValType.
|
|
21141
|
-
|
|
21142
|
-
|
|
21143
|
-
case src_xdr.
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
case src_xdr.ScStatusType.sstHostStorageError().value:
|
|
21149
|
-
case src_xdr.ScStatusType.sstHostContextError().value:
|
|
21150
|
-
case src_xdr.ScStatusType.sstVmError().value:
|
|
21151
|
-
case src_xdr.ScStatusType.sstContractError().value:
|
|
21152
|
-
case src_xdr.ScStatusType.sstHostAuthError().value:
|
|
21153
|
+
case src_xdr.ScValType.scvError().value:
|
|
21154
|
+
switch (scv.error()["switch"]().value) {
|
|
21155
|
+
// Distinguish errors from the user contract.
|
|
21156
|
+
case src_xdr.ScErrorType.sceContract().value:
|
|
21157
|
+
return {
|
|
21158
|
+
type: 'contract',
|
|
21159
|
+
code: scv.error().contractCode()
|
|
21160
|
+
};
|
|
21153
21161
|
default:
|
|
21154
|
-
|
|
21162
|
+
{
|
|
21163
|
+
var err = scv.error();
|
|
21164
|
+
return {
|
|
21165
|
+
type: 'system',
|
|
21166
|
+
code: err.code().value,
|
|
21167
|
+
value: err.code().name
|
|
21168
|
+
};
|
|
21169
|
+
}
|
|
21155
21170
|
}
|
|
21156
21171
|
|
|
21157
21172
|
// in the fallthrough case, just return the underlying value directly
|