From 5766516320784f13f14c68f610582fdad012c13f Mon Sep 17 00:00:00 2001 From: George Date: Tue, 5 Dec 2023 09:29:13 -0800 Subject: [PATCH] Add support for stable Protocol 20 release (both XDR and RPC schemas) (#710) * Upgrade XDR to the final, stable testnet version. (#704, #715) XDR has been upgraded to the latest stable version. This is mostly renames, but it includes the following relevant breaking changes: - `Operation.bumpFootprintExpiration` is now `extendFootprintTtl` and its `ledgersToExpire` field is now named `extendTo`, but it serves the same purpose. - `xdr.ContractExecutable.contractExecutableToken` is now `contractExecutableStellarAsset` - `xdr.SorobanTransactionData.refundableFee` is now `resourceFee` - In turn, `SorobanDataBuilder.setRefundableFee` is now `setResourceFee` - This new fee encompasses the entirety of the Soroban-related resource fees. Note that this is distinct from the "network-inclusion" fee that you would set on your transaction (i.e. `TransactionBuilder(..., { fee: ... })`). - In TypeScript, the `Operation.BumpFootprintExpiration` is now `Operation.ExtendFootprintTtl` Commit: stellar/stellar-xdr @ bb54e50 * Add helpful abstractions for common invocation types. (#703) * Drop incorrect key entry for contract footprint (#709) * Republish package under @stellar/ scope (#714) --- .github/workflows/npm_publish.yml | 13 +- CHANGELOG.md | 11 + Makefile | 4 +- config/webpack.config.browser.js | 1 - package.json | 4 +- src/contract.js | 45 +-- src/generated/curr_generated.js | 346 ++++++++---------- src/generated/next_generated.js | 346 ++++++++---------- src/index.js | 2 +- src/invocation.js | 2 +- src/memo.js | 2 +- src/numbers/int128.js | 2 +- src/numbers/int256.js | 2 +- src/numbers/uint128.js | 2 +- src/numbers/uint256.js | 2 +- src/numbers/xdr_large_int.js | 10 +- src/operation.js | 21 +- src/operations/bump_sequence.js | 2 +- src/operations/change_trust.js | 2 +- ..._expiration.js => extend_footprint_ttl.js} | 18 +- src/operations/index.js | 10 +- src/operations/invoke_host_function.js | 194 +++++++++- src/operations/manage_buy_offer.js | 2 +- src/operations/manage_sell_offer.js | 2 +- src/soroban.js | 5 +- src/sorobandata_builder.js | 17 +- src/transaction.js | 16 +- src/transaction_builder.js | 2 +- test/unit/contract_test.js | 21 +- test/unit/i256_test.js | 2 +- test/unit/invocation_test.js | 3 +- .../classic_ops_test.js} | 69 ---- test/unit/operations/extend_restore_test.js | 32 ++ .../operations/invoke_host_function_test.js | 133 +++++++ test/unit/soroban_test.js | 4 +- test/unit/sorobandata_builder_test.js | 12 +- test/unit/transaction_builder_test.js | 2 +- test/unit/transaction_test.js | 2 +- types/curr.d.ts | 302 ++++++--------- types/index.d.ts | 69 +++- types/next.d.ts | 302 ++++++--------- xdr/curr/Stellar-contract-config-setting.x | 80 ++-- xdr/curr/Stellar-contract.x | 4 +- xdr/curr/Stellar-ledger-entries.x | 18 +- xdr/curr/Stellar-ledger.x | 28 +- xdr/curr/Stellar-transaction.x | 64 ++-- xdr/next/Stellar-contract-config-setting.x | 80 ++-- xdr/next/Stellar-contract.x | 4 +- xdr/next/Stellar-ledger-entries.x | 18 +- xdr/next/Stellar-ledger.x | 28 +- xdr/next/Stellar-transaction.x | 64 ++-- yarn.lock | 10 +- 52 files changed, 1241 insertions(+), 1195 deletions(-) rename src/operations/{bump_footprint_expiration.js => extend_footprint_ttl.js} (65%) rename test/unit/{operation_test.js => operations/classic_ops_test.js} (97%) create mode 100644 test/unit/operations/extend_restore_test.js create mode 100644 test/unit/operations/invoke_host_function_test.js diff --git a/.github/workflows/npm_publish.yml b/.github/workflows/npm_publish.yml index ca76fabd..54a4fad4 100644 --- a/.github/workflows/npm_publish.yml +++ b/.github/workflows/npm_publish.yml @@ -22,7 +22,16 @@ jobs: - name: Test & Build run: yarn preversion - - name: Publish release npm package - run: yarn publish --tag beta + - name: Publish npm package to both places + run: | + yarn publish --tag beta --access public + sed -i -e 's#"@stellar/stellar-base"#"stellar-base"#' package.json + yarn publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Deprecate the old package + run: | + npm deprecate stellar-base@latest "⚠️ This package has moved to @stellar/stellar-base! 🚚" env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 5863b829..9078c0ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,19 @@ ## Unreleased +### Breaking Changes +* XDR has been upgraded to the latest stable version ([stellar-xdr@`6a620d1`](https://github.com/stellar/stellar-xdr/tree/6a620d160aab22609c982d54578ff6a63bfcdc01)). This is mostly renames, but it includes the following relevant breaking changes ([#704](https://github.com/stellar/js-stellar-base/pull/704)): + - `Operation.bumpFootprintExpiration` is now `extendFootprintTtl` and its `ledgersToExpire` field is now named `extendTo`, but it serves the same purpose. + - In TypeScript, the `Operation.BumpFootprintExpiration` is now `Operation.ExtendFootprintTTL` + - `xdr.ContractExecutable.contractExecutableToken` is now `contractExecutableStellarAsset` + - `xdr.SorobanTransactionData.refundableFee` is now `resourceFee` + - In turn, `SorobanDataBuilder.setRefundableFee` is now `setResourceFee` + - This new fee encompasses the entirety of the Soroban-related resource fees. Note that this is distinct from the "network-inclusion" fee that you would set on your transaction (i.e. `TransactionBuilder(..., { fee: ... })`). +- `Contract.getFootprint()` now only returns a single result: the ledger key of the deployed instance for the given ID, because the key for the code entry was incorrect (it should not be the ID but rather the WASM hash, which is not calculatable w/o network access) ([#709](https://github.com/stellar/js-stellar-base/pull/709)). + ## [`v10.0.0-beta.4`](https://github.com/stellar/js-stellar-base/compare/v10.0.0-beta.3...v10.0.0-beta.4) + ### Fixed - You can now correctly clone transactions (`TransactionBuilder.cloneFrom`) with large sequence numbers ([#711](https://github.com/stellar/js-stellar-base/pull/711)). diff --git a/Makefile b/Makefile index c80c0a8a..58e700c6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/9ac02641139e6717924fdad716f6e958d0168491 +XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/bb54e505f814386a3f45172e0b7e95b7badbe969 XDR_BASE_LOCAL_CURR=xdr/curr XDR_FILES_CURR= \ Stellar-SCP.x \ @@ -14,7 +14,7 @@ XDR_FILES_CURR= \ Stellar-contract-config-setting.x XDR_FILES_LOCAL_CURR=$(addprefix xdr/curr/,$(XDR_FILES_CURR)) -XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/440dc9512b6e72cf84965641c5eb495d6043ed73 +XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/bb54e505f814386a3f45172e0b7e95b7badbe969 XDR_BASE_LOCAL_NEXT=xdr/next XDR_FILES_NEXT= \ Stellar-SCP.x \ diff --git a/config/webpack.config.browser.js b/config/webpack.config.browser.js index 1cd52e83..5cc2129c 100644 --- a/config/webpack.config.browser.js +++ b/config/webpack.config.browser.js @@ -22,7 +22,6 @@ const config = { output: { clean: true, library: 'StellarBase', - compareBeforeEmit: true, path: path.resolve(__dirname, '../dist') }, mode: process.env.NODE_ENV ?? 'development', diff --git a/package.json b/package.json index 83280199..8e7bdf6b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "stellar-base", + "name": "@stellar/stellar-base", "version": "10.0.0-beta.4", "description": "Low-level support library for the Stellar network.", "main": "./lib/index.js", @@ -123,7 +123,7 @@ "base32.js": "^0.1.0", "bignumber.js": "^9.1.2", "buffer": "^6.0.3", - "js-xdr": "^3.0.0", + "@stellar/js-xdr": "^3.0.1", "sha.js": "^2.3.6", "tweetnacl": "^1.0.3" }, diff --git a/src/contract.js b/src/contract.js index b0224e94..56892574 100644 --- a/src/contract.js +++ b/src/contract.js @@ -53,40 +53,35 @@ export class Contract { * * @returns {xdr.Operation} an InvokeHostFunctionOp operation to call the * contract with the given method and parameters + * + * @see Operation.invokeHostFunction + * @see Operation.invokeContractFunction + * @see Operation.createCustomContract + * @see Operation.createStellarAssetContract + * @see Operation.uploadContractWasm */ call(method, ...params) { - return Operation.invokeHostFunction({ - func: xdr.HostFunction.hostFunctionTypeInvokeContract( - new xdr.InvokeContractArgs({ - contractAddress: this.address().toScAddress(), - functionName: method, - args: params - }) - ), - auth: [] + return Operation.invokeContractFunction({ + contract: this.address().toString(), + function: method, + args: params }); } /** * Returns the read-only footprint entries necessary for any invocations to - * this contract, for convenience when adding it to your transaction's overall - * footprint or doing bump/restore operations. + * this contract, for convenience when manually adding it to your + * transaction's overall footprint or doing bump/restore operations. * - * @returns {xdr.LedgerKey[]} the ledger keys containing the contract's code - * (first) and its deployed contract instance (second) + * @returns {xdr.LedgerKey} the ledger key for the deployed contract instance */ getFootprint() { - return [ - xdr.LedgerKey.contractCode( - new xdr.LedgerKeyContractCode({ hash: this._id }) - ), - xdr.LedgerKey.contractData( - new xdr.LedgerKeyContractData({ - contract: this.address().toScAddress(), - key: xdr.ScVal.scvLedgerKeyContractInstance(), - durability: xdr.ContractDataDurability.persistent() - }) - ) - ]; + return xdr.LedgerKey.contractData( + new xdr.LedgerKeyContractData({ + contract: this.address().toScAddress(), + key: xdr.ScVal.scvLedgerKeyContractInstance(), + durability: xdr.ContractDataDurability.persistent() + }) + ); } } diff --git a/src/generated/curr_generated.js b/src/generated/curr_generated.js index 713a0935..ecfaf64d 100644 --- a/src/generated/curr_generated.js +++ b/src/generated/curr_generated.js @@ -4,7 +4,7 @@ /* jshint maxstatements:2147483647 */ /* jshint esnext:true */ -import * as XDR from "js-xdr"; +import * as XDR from "@stellar/js-xdr"; var types = XDR.config((xdr) => { // Workaround for https://github.com/stellar/xdrgen/issues/152 @@ -476,7 +476,7 @@ var types = XDR.config((xdr) => { // CONTRACT_DATA = 6, // CONTRACT_CODE = 7, // CONFIG_SETTING = 8, - // EXPIRATION = 9 + // TTL = 9 // }; // // =========================================================================== @@ -490,7 +490,7 @@ var types = XDR.config((xdr) => { contractData: 6, contractCode: 7, configSetting: 8, - expiration: 9, + ttl: 9, }); // === xdr source ============================================================ @@ -1522,16 +1522,16 @@ var types = XDR.config((xdr) => { // === xdr source ============================================================ // - // struct ExpirationEntry { - // // Hash of the LedgerKey that is associated with this ExpirationEntry + // struct TTLEntry { + // // Hash of the LedgerKey that is associated with this TTLEntry // Hash keyHash; - // uint32 expirationLedgerSeq; + // uint32 liveUntilLedgerSeq; // }; // // =========================================================================== - xdr.struct("ExpirationEntry", [ + xdr.struct("TtlEntry", [ ["keyHash", xdr.lookup("Hash")], - ["expirationLedgerSeq", xdr.lookup("Uint32")], + ["liveUntilLedgerSeq", xdr.lookup("Uint32")], ]); // === xdr source ============================================================ @@ -1592,8 +1592,8 @@ var types = XDR.config((xdr) => { // ContractCodeEntry contractCode; // case CONFIG_SETTING: // ConfigSettingEntry configSetting; - // case EXPIRATION: - // ExpirationEntry expiration; + // case TTL: + // TTLEntry ttl; // } // // =========================================================================== @@ -1610,7 +1610,7 @@ var types = XDR.config((xdr) => { ["contractData", "contractData"], ["contractCode", "contractCode"], ["configSetting", "configSetting"], - ["expiration", "expiration"], + ["ttl", "ttl"], ], arms: { account: xdr.lookup("AccountEntry"), @@ -1622,7 +1622,7 @@ var types = XDR.config((xdr) => { contractData: xdr.lookup("ContractDataEntry"), contractCode: xdr.lookup("ContractCodeEntry"), configSetting: xdr.lookup("ConfigSettingEntry"), - expiration: xdr.lookup("ExpirationEntry"), + ttl: xdr.lookup("TtlEntry"), }, }); @@ -1675,8 +1675,8 @@ var types = XDR.config((xdr) => { // ContractCodeEntry contractCode; // case CONFIG_SETTING: // ConfigSettingEntry configSetting; - // case EXPIRATION: - // ExpirationEntry expiration; + // case TTL: + // TTLEntry ttl; // } // data; // @@ -1816,12 +1816,12 @@ var types = XDR.config((xdr) => { // // struct // { - // // Hash of the LedgerKey that is associated with this ExpirationEntry + // // Hash of the LedgerKey that is associated with this TTLEntry // Hash keyHash; // } // // =========================================================================== - xdr.struct("LedgerKeyExpiration", [["keyHash", xdr.lookup("Hash")]]); + xdr.struct("LedgerKeyTtl", [["keyHash", xdr.lookup("Hash")]]); // === xdr source ============================================================ // @@ -1882,12 +1882,12 @@ var types = XDR.config((xdr) => { // { // ConfigSettingID configSettingID; // } configSetting; - // case EXPIRATION: + // case TTL: // struct // { - // // Hash of the LedgerKey that is associated with this ExpirationEntry + // // Hash of the LedgerKey that is associated with this TTLEntry // Hash keyHash; - // } expiration; + // } ttl; // }; // // =========================================================================== @@ -1904,7 +1904,7 @@ var types = XDR.config((xdr) => { ["contractData", "contractData"], ["contractCode", "contractCode"], ["configSetting", "configSetting"], - ["expiration", "expiration"], + ["ttl", "ttl"], ], arms: { account: xdr.lookup("LedgerKeyAccount"), @@ -1916,7 +1916,7 @@ var types = XDR.config((xdr) => { contractData: xdr.lookup("LedgerKeyContractData"), contractCode: xdr.lookup("LedgerKeyContractCode"), configSetting: xdr.lookup("LedgerKeyConfigSetting"), - expiration: xdr.lookup("LedgerKeyExpiration"), + ttl: xdr.lookup("LedgerKeyTtl"), }, }); @@ -3049,43 +3049,8 @@ var types = XDR.config((xdr) => { // // struct LedgerCloseMetaV1 // { - // LedgerHeaderHistoryEntry ledgerHeader; - // - // GeneralizedTransactionSet txSet; - // - // // NB: transactions are sorted in apply order here - // // fees for all transactions are processed first - // // followed by applying transactions - // TransactionResultMeta txProcessing<>; - // - // // upgrades are applied last - // UpgradeEntryMeta upgradesProcessing<>; - // - // // other misc information attached to the ledger close - // SCPHistoryEntry scpInfo<>; - // }; - // - // =========================================================================== - xdr.struct("LedgerCloseMetaV1", [ - ["ledgerHeader", xdr.lookup("LedgerHeaderHistoryEntry")], - ["txSet", xdr.lookup("GeneralizedTransactionSet")], - [ - "txProcessing", - xdr.varArray(xdr.lookup("TransactionResultMeta"), 2147483647), - ], - [ - "upgradesProcessing", - xdr.varArray(xdr.lookup("UpgradeEntryMeta"), 2147483647), - ], - ["scpInfo", xdr.varArray(xdr.lookup("ScpHistoryEntry"), 2147483647)], - ]); - - // === xdr source ============================================================ - // - // struct LedgerCloseMetaV2 - // { - // // We forgot to add an ExtensionPoint in v1 but at least - // // we can add one now in v2. + // // We forgot to add an ExtensionPoint in v0 but at least + // // we can add one now in v1. // ExtensionPoint ext; // // LedgerHeaderHistoryEntry ledgerHeader; @@ -3107,16 +3072,16 @@ var types = XDR.config((xdr) => { // // systems calculating storage fees correctly. // uint64 totalByteSizeOfBucketList; // - // // Expired temp keys that are being evicted at this ledger. + // // Temp keys that are being evicted at this ledger. // LedgerKey evictedTemporaryLedgerKeys<>; // - // // Expired restorable ledger entries that are being + // // Archived restorable ledger entries that are being // // evicted at this ledger. // LedgerEntry evictedPersistentLedgerEntries<>; // }; // // =========================================================================== - xdr.struct("LedgerCloseMetaV2", [ + xdr.struct("LedgerCloseMetaV1", [ ["ext", xdr.lookup("ExtensionPoint")], ["ledgerHeader", xdr.lookup("LedgerHeaderHistoryEntry")], ["txSet", xdr.lookup("GeneralizedTransactionSet")], @@ -3148,8 +3113,6 @@ var types = XDR.config((xdr) => { // LedgerCloseMetaV0 v0; // case 1: // LedgerCloseMetaV1 v1; - // case 2: - // LedgerCloseMetaV2 v2; // }; // // =========================================================================== @@ -3159,12 +3122,10 @@ var types = XDR.config((xdr) => { switches: [ [0, "v0"], [1, "v1"], - [2, "v2"], ], arms: { v0: xdr.lookup("LedgerCloseMetaV0"), v1: xdr.lookup("LedgerCloseMetaV1"), - v2: xdr.lookup("LedgerCloseMetaV2"), }, }); @@ -3944,7 +3905,7 @@ var types = XDR.config((xdr) => { // LIQUIDITY_POOL_DEPOSIT = 22, // LIQUIDITY_POOL_WITHDRAW = 23, // INVOKE_HOST_FUNCTION = 24, - // BUMP_FOOTPRINT_EXPIRATION = 25, + // EXTEND_FOOTPRINT_TTL = 25, // RESTORE_FOOTPRINT = 26 // }; // @@ -3975,7 +3936,7 @@ var types = XDR.config((xdr) => { liquidityPoolDeposit: 22, liquidityPoolWithdraw: 23, invokeHostFunction: 24, - bumpFootprintExpiration: 25, + extendFootprintTtl: 25, restoreFootprint: 26, }); @@ -4715,16 +4676,16 @@ var types = XDR.config((xdr) => { // === xdr source ============================================================ // - // struct BumpFootprintExpirationOp + // struct ExtendFootprintTTLOp // { // ExtensionPoint ext; - // uint32 ledgersToExpire; + // uint32 extendTo; // }; // // =========================================================================== - xdr.struct("BumpFootprintExpirationOp", [ + xdr.struct("ExtendFootprintTtlOp", [ ["ext", xdr.lookup("ExtensionPoint")], - ["ledgersToExpire", xdr.lookup("Uint32")], + ["extendTo", xdr.lookup("Uint32")], ]); // === xdr source ============================================================ @@ -4791,8 +4752,8 @@ var types = XDR.config((xdr) => { // LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionOp invokeHostFunctionOp; - // case BUMP_FOOTPRINT_EXPIRATION: - // BumpFootprintExpirationOp bumpFootprintExpirationOp; + // case EXTEND_FOOTPRINT_TTL: + // ExtendFootprintTTLOp extendFootprintTTLOp; // case RESTORE_FOOTPRINT: // RestoreFootprintOp restoreFootprintOp; // } @@ -4827,7 +4788,7 @@ var types = XDR.config((xdr) => { ["liquidityPoolDeposit", "liquidityPoolDepositOp"], ["liquidityPoolWithdraw", "liquidityPoolWithdrawOp"], ["invokeHostFunction", "invokeHostFunctionOp"], - ["bumpFootprintExpiration", "bumpFootprintExpirationOp"], + ["extendFootprintTtl", "extendFootprintTtlOp"], ["restoreFootprint", "restoreFootprintOp"], ], arms: { @@ -4856,7 +4817,7 @@ var types = XDR.config((xdr) => { liquidityPoolDepositOp: xdr.lookup("LiquidityPoolDepositOp"), liquidityPoolWithdrawOp: xdr.lookup("LiquidityPoolWithdrawOp"), invokeHostFunctionOp: xdr.lookup("InvokeHostFunctionOp"), - bumpFootprintExpirationOp: xdr.lookup("BumpFootprintExpirationOp"), + extendFootprintTtlOp: xdr.lookup("ExtendFootprintTtlOp"), restoreFootprintOp: xdr.lookup("RestoreFootprintOp"), }, }); @@ -4922,8 +4883,8 @@ var types = XDR.config((xdr) => { // LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionOp invokeHostFunctionOp; - // case BUMP_FOOTPRINT_EXPIRATION: - // BumpFootprintExpirationOp bumpFootprintExpirationOp; + // case EXTEND_FOOTPRINT_TTL: + // ExtendFootprintTTLOp extendFootprintTTLOp; // case RESTORE_FOOTPRINT: // RestoreFootprintOp restoreFootprintOp; // } @@ -5272,15 +5233,23 @@ var types = XDR.config((xdr) => { // { // ExtensionPoint ext; // SorobanResources resources; - // // Portion of transaction `fee` allocated to refundable fees. - // int64 refundableFee; + // // Amount of the transaction `fee` allocated to the Soroban resource fees. + // // The fraction of `resourceFee` corresponding to `resources` specified + // // above is *not* refundable (i.e. fees for instructions, ledger I/O), as + // // well as fees for the transaction size. + // // The remaining part of the fee is refundable and the charged value is + // // based on the actual consumption of refundable resources (events, ledger + // // rent bumps). + // // The `inclusionFee` used for prioritization of the transaction is defined + // // as `tx.fee - resourceFee`. + // int64 resourceFee; // }; // // =========================================================================== xdr.struct("SorobanTransactionData", [ ["ext", xdr.lookup("ExtensionPoint")], ["resources", xdr.lookup("SorobanResources")], - ["refundableFee", xdr.lookup("Int64")], + ["resourceFee", xdr.lookup("Int64")], ]); // === xdr source ============================================================ @@ -7256,7 +7225,7 @@ var types = XDR.config((xdr) => { // INVOKE_HOST_FUNCTION_MALFORMED = -1, // INVOKE_HOST_FUNCTION_TRAPPED = -2, // INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, - // INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4, + // INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, // INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 // }; // @@ -7266,7 +7235,7 @@ var types = XDR.config((xdr) => { invokeHostFunctionMalformed: -1, invokeHostFunctionTrapped: -2, invokeHostFunctionResourceLimitExceeded: -3, - invokeHostFunctionEntryExpired: -4, + invokeHostFunctionEntryArchived: -4, invokeHostFunctionInsufficientRefundableFee: -5, }); @@ -7279,7 +7248,7 @@ var types = XDR.config((xdr) => { // case INVOKE_HOST_FUNCTION_MALFORMED: // case INVOKE_HOST_FUNCTION_TRAPPED: // case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: - // case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED: + // case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: // case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: // void; // }; @@ -7293,7 +7262,7 @@ var types = XDR.config((xdr) => { ["invokeHostFunctionMalformed", xdr.void()], ["invokeHostFunctionTrapped", xdr.void()], ["invokeHostFunctionResourceLimitExceeded", xdr.void()], - ["invokeHostFunctionEntryExpired", xdr.void()], + ["invokeHostFunctionEntryArchived", xdr.void()], ["invokeHostFunctionInsufficientRefundableFee", xdr.void()], ], arms: { @@ -7303,46 +7272,46 @@ var types = XDR.config((xdr) => { // === xdr source ============================================================ // - // enum BumpFootprintExpirationResultCode + // enum ExtendFootprintTTLResultCode // { // // codes considered as "success" for the operation - // BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0, + // EXTEND_FOOTPRINT_TTL_SUCCESS = 0, // // // codes considered as "failure" for the operation - // BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1, - // BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2, - // BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3 + // EXTEND_FOOTPRINT_TTL_MALFORMED = -1, + // EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, + // EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 // }; // // =========================================================================== - xdr.enum("BumpFootprintExpirationResultCode", { - bumpFootprintExpirationSuccess: 0, - bumpFootprintExpirationMalformed: -1, - bumpFootprintExpirationResourceLimitExceeded: -2, - bumpFootprintExpirationInsufficientRefundableFee: -3, + xdr.enum("ExtendFootprintTtlResultCode", { + extendFootprintTtlSuccess: 0, + extendFootprintTtlMalformed: -1, + extendFootprintTtlResourceLimitExceeded: -2, + extendFootprintTtlInsufficientRefundableFee: -3, }); // === xdr source ============================================================ // - // union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code) + // union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code) // { - // case BUMP_FOOTPRINT_EXPIRATION_SUCCESS: + // case EXTEND_FOOTPRINT_TTL_SUCCESS: // void; - // case BUMP_FOOTPRINT_EXPIRATION_MALFORMED: - // case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED: - // case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE: + // case EXTEND_FOOTPRINT_TTL_MALFORMED: + // case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: + // case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: // void; // }; // // =========================================================================== - xdr.union("BumpFootprintExpirationResult", { - switchOn: xdr.lookup("BumpFootprintExpirationResultCode"), + xdr.union("ExtendFootprintTtlResult", { + switchOn: xdr.lookup("ExtendFootprintTtlResultCode"), switchName: "code", switches: [ - ["bumpFootprintExpirationSuccess", xdr.void()], - ["bumpFootprintExpirationMalformed", xdr.void()], - ["bumpFootprintExpirationResourceLimitExceeded", xdr.void()], - ["bumpFootprintExpirationInsufficientRefundableFee", xdr.void()], + ["extendFootprintTtlSuccess", xdr.void()], + ["extendFootprintTtlMalformed", xdr.void()], + ["extendFootprintTtlResourceLimitExceeded", xdr.void()], + ["extendFootprintTtlInsufficientRefundableFee", xdr.void()], ], arms: {}, }); @@ -7472,8 +7441,8 @@ var types = XDR.config((xdr) => { // LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionResult invokeHostFunctionResult; - // case BUMP_FOOTPRINT_EXPIRATION: - // BumpFootprintExpirationResult bumpFootprintExpirationResult; + // case EXTEND_FOOTPRINT_TTL: + // ExtendFootprintTTLResult extendFootprintTTLResult; // case RESTORE_FOOTPRINT: // RestoreFootprintResult restoreFootprintResult; // } @@ -7508,7 +7477,7 @@ var types = XDR.config((xdr) => { ["liquidityPoolDeposit", "liquidityPoolDepositResult"], ["liquidityPoolWithdraw", "liquidityPoolWithdrawResult"], ["invokeHostFunction", "invokeHostFunctionResult"], - ["bumpFootprintExpiration", "bumpFootprintExpirationResult"], + ["extendFootprintTtl", "extendFootprintTtlResult"], ["restoreFootprint", "restoreFootprintResult"], ], arms: { @@ -7545,9 +7514,7 @@ var types = XDR.config((xdr) => { liquidityPoolDepositResult: xdr.lookup("LiquidityPoolDepositResult"), liquidityPoolWithdrawResult: xdr.lookup("LiquidityPoolWithdrawResult"), invokeHostFunctionResult: xdr.lookup("InvokeHostFunctionResult"), - bumpFootprintExpirationResult: xdr.lookup( - "BumpFootprintExpirationResult" - ), + extendFootprintTtlResult: xdr.lookup("ExtendFootprintTtlResult"), restoreFootprintResult: xdr.lookup("RestoreFootprintResult"), }, }); @@ -7609,8 +7576,8 @@ var types = XDR.config((xdr) => { // LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionResult invokeHostFunctionResult; - // case BUMP_FOOTPRINT_EXPIRATION: - // BumpFootprintExpirationResult bumpFootprintExpirationResult; + // case EXTEND_FOOTPRINT_TTL: + // ExtendFootprintTTLResult extendFootprintTTLResult; // case RESTORE_FOOTPRINT: // RestoreFootprintResult restoreFootprintResult; // } @@ -8468,13 +8435,13 @@ var types = XDR.config((xdr) => { // enum ContractExecutableType // { // CONTRACT_EXECUTABLE_WASM = 0, - // CONTRACT_EXECUTABLE_TOKEN = 1 + // CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 // }; // // =========================================================================== xdr.enum("ContractExecutableType", { contractExecutableWasm: 0, - contractExecutableToken: 1, + contractExecutableStellarAsset: 1, }); // === xdr source ============================================================ @@ -8483,7 +8450,7 @@ var types = XDR.config((xdr) => { // { // case CONTRACT_EXECUTABLE_WASM: // Hash wasm_hash; - // case CONTRACT_EXECUTABLE_TOKEN: + // case CONTRACT_EXECUTABLE_STELLAR_ASSET: // void; // }; // @@ -8493,7 +8460,7 @@ var types = XDR.config((xdr) => { switchName: "type", switches: [ ["contractExecutableWasm", "wasmHash"], - ["contractExecutableToken", xdr.void()], + ["contractExecutableStellarAsset", xdr.void()], ], arms: { wasmHash: xdr.lookup("Hash"), @@ -9465,96 +9432,81 @@ var types = XDR.config((xdr) => { // enum ContractCostType { // // Cost of running 1 wasm instruction // WasmInsnExec = 0, - // // Cost of growing wasm linear memory by 1 page - // WasmMemAlloc = 1, - // // Cost of allocating a chuck of host memory (in bytes) - // HostMemAlloc = 2, - // // Cost of copying a chuck of bytes into a pre-allocated host memory - // HostMemCpy = 3, - // // Cost of comparing two slices of host memory - // HostMemCmp = 4, + // // Cost of allocating a slice of memory (in bytes) + // MemAlloc = 1, + // // Cost of copying a slice of bytes into a pre-allocated memory + // MemCpy = 2, + // // Cost of comparing two slices of memory + // MemCmp = 3, // // Cost of a host function dispatch, not including the actual work done by // // the function nor the cost of VM invocation machinary - // DispatchHostFunction = 5, + // DispatchHostFunction = 4, // // Cost of visiting a host object from the host object storage. Exists to // // make sure some baseline cost coverage, i.e. repeatly visiting objects // // by the guest will always incur some charges. - // VisitObject = 6, + // VisitObject = 5, // // Cost of serializing an xdr object to bytes - // ValSer = 7, + // ValSer = 6, // // Cost of deserializing an xdr object from bytes - // ValDeser = 8, + // ValDeser = 7, // // Cost of computing the sha256 hash from bytes - // ComputeSha256Hash = 9, + // ComputeSha256Hash = 8, // // Cost of computing the ed25519 pubkey from bytes - // ComputeEd25519PubKey = 10, - // // Cost of accessing an entry in a Map. - // MapEntry = 11, - // // Cost of accessing an entry in a Vec - // VecEntry = 12, + // ComputeEd25519PubKey = 9, // // Cost of verifying ed25519 signature of a payload. - // VerifyEd25519Sig = 13, - // // Cost of reading a slice of vm linear memory - // VmMemRead = 14, - // // Cost of writing to a slice of vm linear memory - // VmMemWrite = 15, + // VerifyEd25519Sig = 10, // // Cost of instantiation a VM from wasm bytes code. - // VmInstantiation = 16, + // VmInstantiation = 11, // // Cost of instantiation a VM from a cached state. - // VmCachedInstantiation = 17, + // VmCachedInstantiation = 12, // // Cost of invoking a function on the VM. If the function is a host function, // // additional cost will be covered by `DispatchHostFunction`. - // InvokeVmFunction = 18, + // InvokeVmFunction = 13, // // Cost of computing a keccak256 hash from bytes. - // ComputeKeccak256Hash = 19, - // // Cost of computing an ECDSA secp256k1 pubkey from bytes. - // ComputeEcdsaSecp256k1Key = 20, + // ComputeKeccak256Hash = 14, // // Cost of computing an ECDSA secp256k1 signature from bytes. - // ComputeEcdsaSecp256k1Sig = 21, + // ComputeEcdsaSecp256k1Sig = 15, // // Cost of recovering an ECDSA secp256k1 key from a signature. - // RecoverEcdsaSecp256k1Key = 22, + // RecoverEcdsaSecp256k1Key = 16, // // Cost of int256 addition (`+`) and subtraction (`-`) operations - // Int256AddSub = 23, + // Int256AddSub = 17, // // Cost of int256 multiplication (`*`) operation - // Int256Mul = 24, + // Int256Mul = 18, // // Cost of int256 division (`/`) operation - // Int256Div = 25, + // Int256Div = 19, // // Cost of int256 power (`exp`) operation - // Int256Pow = 26, + // Int256Pow = 20, // // Cost of int256 shift (`shl`, `shr`) operation - // Int256Shift = 27 + // Int256Shift = 21, + // // Cost of drawing random bytes using a ChaCha20 PRNG + // ChaCha20DrawBytes = 22 // }; // // =========================================================================== xdr.enum("ContractCostType", { wasmInsnExec: 0, - wasmMemAlloc: 1, - hostMemAlloc: 2, - hostMemCpy: 3, - hostMemCmp: 4, - dispatchHostFunction: 5, - visitObject: 6, - valSer: 7, - valDeser: 8, - computeSha256Hash: 9, - computeEd25519PubKey: 10, - mapEntry: 11, - vecEntry: 12, - verifyEd25519Sig: 13, - vmMemRead: 14, - vmMemWrite: 15, - vmInstantiation: 16, - vmCachedInstantiation: 17, - invokeVmFunction: 18, - computeKeccak256Hash: 19, - computeEcdsaSecp256k1Key: 20, - computeEcdsaSecp256k1Sig: 21, - recoverEcdsaSecp256k1Key: 22, - int256AddSub: 23, - int256Mul: 24, - int256Div: 25, - int256Pow: 26, - int256Shift: 27, + memAlloc: 1, + memCpy: 2, + memCmp: 3, + dispatchHostFunction: 4, + visitObject: 5, + valSer: 6, + valDeser: 7, + computeSha256Hash: 8, + computeEd25519PubKey: 9, + verifyEd25519Sig: 10, + vmInstantiation: 11, + vmCachedInstantiation: 12, + invokeVmFunction: 13, + computeKeccak256Hash: 14, + computeEcdsaSecp256k1Sig: 15, + recoverEcdsaSecp256k1Key: 16, + int256AddSub: 17, + int256Mul: 18, + int256Div: 19, + int256Pow: 20, + int256Shift: 21, + chaCha20DrawBytes: 22, }); // === xdr source ============================================================ @@ -9576,17 +9528,17 @@ var types = XDR.config((xdr) => { // === xdr source ============================================================ // - // struct StateExpirationSettings { - // uint32 maxEntryExpiration; - // uint32 minTempEntryExpiration; - // uint32 minPersistentEntryExpiration; + // struct StateArchivalSettings { + // uint32 maxEntryTTL; + // uint32 minTemporaryTTL; + // uint32 minPersistentTTL; // // // rent_fee = wfee_rate_average / rent_rate_denominator_for_type // int64 persistentRentRateDenominator; // int64 tempRentRateDenominator; // - // // max number of entries that emit expiration meta in a single ledger - // uint32 maxEntriesToExpire; + // // max number of entries that emit archival meta in a single ledger + // uint32 maxEntriesToArchive; // // // Number of snapshots to use when calculating average BucketList size // uint32 bucketListSizeWindowSampleSize; @@ -9599,13 +9551,13 @@ var types = XDR.config((xdr) => { // }; // // =========================================================================== - xdr.struct("StateExpirationSettings", [ - ["maxEntryExpiration", xdr.lookup("Uint32")], - ["minTempEntryExpiration", xdr.lookup("Uint32")], - ["minPersistentEntryExpiration", xdr.lookup("Uint32")], + xdr.struct("StateArchivalSettings", [ + ["maxEntryTtl", xdr.lookup("Uint32")], + ["minTemporaryTtl", xdr.lookup("Uint32")], + ["minPersistentTtl", xdr.lookup("Uint32")], ["persistentRentRateDenominator", xdr.lookup("Int64")], ["tempRentRateDenominator", xdr.lookup("Int64")], - ["maxEntriesToExpire", xdr.lookup("Uint32")], + ["maxEntriesToArchive", xdr.lookup("Uint32")], ["bucketListSizeWindowSampleSize", xdr.lookup("Uint32")], ["evictionScanSize", xdr.lookup("Uint64")], ["startingEvictionScanLevel", xdr.lookup("Uint32")], @@ -9660,7 +9612,7 @@ var types = XDR.config((xdr) => { // CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, // CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, // CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, - // CONFIG_SETTING_STATE_EXPIRATION = 10, + // CONFIG_SETTING_STATE_ARCHIVAL = 10, // CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, // CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, // CONFIG_SETTING_EVICTION_ITERATOR = 13 @@ -9678,7 +9630,7 @@ var types = XDR.config((xdr) => { configSettingContractCostParamsMemoryBytes: 7, configSettingContractDataKeySizeBytes: 8, configSettingContractDataEntrySizeBytes: 9, - configSettingStateExpiration: 10, + configSettingStateArchival: 10, configSettingContractExecutionLanes: 11, configSettingBucketlistSizeWindow: 12, configSettingEvictionIterator: 13, @@ -9708,8 +9660,8 @@ var types = XDR.config((xdr) => { // uint32 contractDataKeySizeBytes; // case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: // uint32 contractDataEntrySizeBytes; - // case CONFIG_SETTING_STATE_EXPIRATION: - // StateExpirationSettings stateExpirationSettings; + // case CONFIG_SETTING_STATE_ARCHIVAL: + // StateArchivalSettings stateArchivalSettings; // case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: // ConfigSettingContractExecutionLanesV0 contractExecutionLanes; // case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: @@ -9739,7 +9691,7 @@ var types = XDR.config((xdr) => { ], ["configSettingContractDataKeySizeBytes", "contractDataKeySizeBytes"], ["configSettingContractDataEntrySizeBytes", "contractDataEntrySizeBytes"], - ["configSettingStateExpiration", "stateExpirationSettings"], + ["configSettingStateArchival", "stateArchivalSettings"], ["configSettingContractExecutionLanes", "contractExecutionLanes"], ["configSettingBucketlistSizeWindow", "bucketListSizeWindow"], ["configSettingEvictionIterator", "evictionIterator"], @@ -9757,7 +9709,7 @@ var types = XDR.config((xdr) => { contractCostParamsMemBytes: xdr.lookup("ContractCostParams"), contractDataKeySizeBytes: xdr.lookup("Uint32"), contractDataEntrySizeBytes: xdr.lookup("Uint32"), - stateExpirationSettings: xdr.lookup("StateExpirationSettings"), + stateArchivalSettings: xdr.lookup("StateArchivalSettings"), contractExecutionLanes: xdr.lookup( "ConfigSettingContractExecutionLanesV0" ), diff --git a/src/generated/next_generated.js b/src/generated/next_generated.js index 713a0935..ecfaf64d 100644 --- a/src/generated/next_generated.js +++ b/src/generated/next_generated.js @@ -4,7 +4,7 @@ /* jshint maxstatements:2147483647 */ /* jshint esnext:true */ -import * as XDR from "js-xdr"; +import * as XDR from "@stellar/js-xdr"; var types = XDR.config((xdr) => { // Workaround for https://github.com/stellar/xdrgen/issues/152 @@ -476,7 +476,7 @@ var types = XDR.config((xdr) => { // CONTRACT_DATA = 6, // CONTRACT_CODE = 7, // CONFIG_SETTING = 8, - // EXPIRATION = 9 + // TTL = 9 // }; // // =========================================================================== @@ -490,7 +490,7 @@ var types = XDR.config((xdr) => { contractData: 6, contractCode: 7, configSetting: 8, - expiration: 9, + ttl: 9, }); // === xdr source ============================================================ @@ -1522,16 +1522,16 @@ var types = XDR.config((xdr) => { // === xdr source ============================================================ // - // struct ExpirationEntry { - // // Hash of the LedgerKey that is associated with this ExpirationEntry + // struct TTLEntry { + // // Hash of the LedgerKey that is associated with this TTLEntry // Hash keyHash; - // uint32 expirationLedgerSeq; + // uint32 liveUntilLedgerSeq; // }; // // =========================================================================== - xdr.struct("ExpirationEntry", [ + xdr.struct("TtlEntry", [ ["keyHash", xdr.lookup("Hash")], - ["expirationLedgerSeq", xdr.lookup("Uint32")], + ["liveUntilLedgerSeq", xdr.lookup("Uint32")], ]); // === xdr source ============================================================ @@ -1592,8 +1592,8 @@ var types = XDR.config((xdr) => { // ContractCodeEntry contractCode; // case CONFIG_SETTING: // ConfigSettingEntry configSetting; - // case EXPIRATION: - // ExpirationEntry expiration; + // case TTL: + // TTLEntry ttl; // } // // =========================================================================== @@ -1610,7 +1610,7 @@ var types = XDR.config((xdr) => { ["contractData", "contractData"], ["contractCode", "contractCode"], ["configSetting", "configSetting"], - ["expiration", "expiration"], + ["ttl", "ttl"], ], arms: { account: xdr.lookup("AccountEntry"), @@ -1622,7 +1622,7 @@ var types = XDR.config((xdr) => { contractData: xdr.lookup("ContractDataEntry"), contractCode: xdr.lookup("ContractCodeEntry"), configSetting: xdr.lookup("ConfigSettingEntry"), - expiration: xdr.lookup("ExpirationEntry"), + ttl: xdr.lookup("TtlEntry"), }, }); @@ -1675,8 +1675,8 @@ var types = XDR.config((xdr) => { // ContractCodeEntry contractCode; // case CONFIG_SETTING: // ConfigSettingEntry configSetting; - // case EXPIRATION: - // ExpirationEntry expiration; + // case TTL: + // TTLEntry ttl; // } // data; // @@ -1816,12 +1816,12 @@ var types = XDR.config((xdr) => { // // struct // { - // // Hash of the LedgerKey that is associated with this ExpirationEntry + // // Hash of the LedgerKey that is associated with this TTLEntry // Hash keyHash; // } // // =========================================================================== - xdr.struct("LedgerKeyExpiration", [["keyHash", xdr.lookup("Hash")]]); + xdr.struct("LedgerKeyTtl", [["keyHash", xdr.lookup("Hash")]]); // === xdr source ============================================================ // @@ -1882,12 +1882,12 @@ var types = XDR.config((xdr) => { // { // ConfigSettingID configSettingID; // } configSetting; - // case EXPIRATION: + // case TTL: // struct // { - // // Hash of the LedgerKey that is associated with this ExpirationEntry + // // Hash of the LedgerKey that is associated with this TTLEntry // Hash keyHash; - // } expiration; + // } ttl; // }; // // =========================================================================== @@ -1904,7 +1904,7 @@ var types = XDR.config((xdr) => { ["contractData", "contractData"], ["contractCode", "contractCode"], ["configSetting", "configSetting"], - ["expiration", "expiration"], + ["ttl", "ttl"], ], arms: { account: xdr.lookup("LedgerKeyAccount"), @@ -1916,7 +1916,7 @@ var types = XDR.config((xdr) => { contractData: xdr.lookup("LedgerKeyContractData"), contractCode: xdr.lookup("LedgerKeyContractCode"), configSetting: xdr.lookup("LedgerKeyConfigSetting"), - expiration: xdr.lookup("LedgerKeyExpiration"), + ttl: xdr.lookup("LedgerKeyTtl"), }, }); @@ -3049,43 +3049,8 @@ var types = XDR.config((xdr) => { // // struct LedgerCloseMetaV1 // { - // LedgerHeaderHistoryEntry ledgerHeader; - // - // GeneralizedTransactionSet txSet; - // - // // NB: transactions are sorted in apply order here - // // fees for all transactions are processed first - // // followed by applying transactions - // TransactionResultMeta txProcessing<>; - // - // // upgrades are applied last - // UpgradeEntryMeta upgradesProcessing<>; - // - // // other misc information attached to the ledger close - // SCPHistoryEntry scpInfo<>; - // }; - // - // =========================================================================== - xdr.struct("LedgerCloseMetaV1", [ - ["ledgerHeader", xdr.lookup("LedgerHeaderHistoryEntry")], - ["txSet", xdr.lookup("GeneralizedTransactionSet")], - [ - "txProcessing", - xdr.varArray(xdr.lookup("TransactionResultMeta"), 2147483647), - ], - [ - "upgradesProcessing", - xdr.varArray(xdr.lookup("UpgradeEntryMeta"), 2147483647), - ], - ["scpInfo", xdr.varArray(xdr.lookup("ScpHistoryEntry"), 2147483647)], - ]); - - // === xdr source ============================================================ - // - // struct LedgerCloseMetaV2 - // { - // // We forgot to add an ExtensionPoint in v1 but at least - // // we can add one now in v2. + // // We forgot to add an ExtensionPoint in v0 but at least + // // we can add one now in v1. // ExtensionPoint ext; // // LedgerHeaderHistoryEntry ledgerHeader; @@ -3107,16 +3072,16 @@ var types = XDR.config((xdr) => { // // systems calculating storage fees correctly. // uint64 totalByteSizeOfBucketList; // - // // Expired temp keys that are being evicted at this ledger. + // // Temp keys that are being evicted at this ledger. // LedgerKey evictedTemporaryLedgerKeys<>; // - // // Expired restorable ledger entries that are being + // // Archived restorable ledger entries that are being // // evicted at this ledger. // LedgerEntry evictedPersistentLedgerEntries<>; // }; // // =========================================================================== - xdr.struct("LedgerCloseMetaV2", [ + xdr.struct("LedgerCloseMetaV1", [ ["ext", xdr.lookup("ExtensionPoint")], ["ledgerHeader", xdr.lookup("LedgerHeaderHistoryEntry")], ["txSet", xdr.lookup("GeneralizedTransactionSet")], @@ -3148,8 +3113,6 @@ var types = XDR.config((xdr) => { // LedgerCloseMetaV0 v0; // case 1: // LedgerCloseMetaV1 v1; - // case 2: - // LedgerCloseMetaV2 v2; // }; // // =========================================================================== @@ -3159,12 +3122,10 @@ var types = XDR.config((xdr) => { switches: [ [0, "v0"], [1, "v1"], - [2, "v2"], ], arms: { v0: xdr.lookup("LedgerCloseMetaV0"), v1: xdr.lookup("LedgerCloseMetaV1"), - v2: xdr.lookup("LedgerCloseMetaV2"), }, }); @@ -3944,7 +3905,7 @@ var types = XDR.config((xdr) => { // LIQUIDITY_POOL_DEPOSIT = 22, // LIQUIDITY_POOL_WITHDRAW = 23, // INVOKE_HOST_FUNCTION = 24, - // BUMP_FOOTPRINT_EXPIRATION = 25, + // EXTEND_FOOTPRINT_TTL = 25, // RESTORE_FOOTPRINT = 26 // }; // @@ -3975,7 +3936,7 @@ var types = XDR.config((xdr) => { liquidityPoolDeposit: 22, liquidityPoolWithdraw: 23, invokeHostFunction: 24, - bumpFootprintExpiration: 25, + extendFootprintTtl: 25, restoreFootprint: 26, }); @@ -4715,16 +4676,16 @@ var types = XDR.config((xdr) => { // === xdr source ============================================================ // - // struct BumpFootprintExpirationOp + // struct ExtendFootprintTTLOp // { // ExtensionPoint ext; - // uint32 ledgersToExpire; + // uint32 extendTo; // }; // // =========================================================================== - xdr.struct("BumpFootprintExpirationOp", [ + xdr.struct("ExtendFootprintTtlOp", [ ["ext", xdr.lookup("ExtensionPoint")], - ["ledgersToExpire", xdr.lookup("Uint32")], + ["extendTo", xdr.lookup("Uint32")], ]); // === xdr source ============================================================ @@ -4791,8 +4752,8 @@ var types = XDR.config((xdr) => { // LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionOp invokeHostFunctionOp; - // case BUMP_FOOTPRINT_EXPIRATION: - // BumpFootprintExpirationOp bumpFootprintExpirationOp; + // case EXTEND_FOOTPRINT_TTL: + // ExtendFootprintTTLOp extendFootprintTTLOp; // case RESTORE_FOOTPRINT: // RestoreFootprintOp restoreFootprintOp; // } @@ -4827,7 +4788,7 @@ var types = XDR.config((xdr) => { ["liquidityPoolDeposit", "liquidityPoolDepositOp"], ["liquidityPoolWithdraw", "liquidityPoolWithdrawOp"], ["invokeHostFunction", "invokeHostFunctionOp"], - ["bumpFootprintExpiration", "bumpFootprintExpirationOp"], + ["extendFootprintTtl", "extendFootprintTtlOp"], ["restoreFootprint", "restoreFootprintOp"], ], arms: { @@ -4856,7 +4817,7 @@ var types = XDR.config((xdr) => { liquidityPoolDepositOp: xdr.lookup("LiquidityPoolDepositOp"), liquidityPoolWithdrawOp: xdr.lookup("LiquidityPoolWithdrawOp"), invokeHostFunctionOp: xdr.lookup("InvokeHostFunctionOp"), - bumpFootprintExpirationOp: xdr.lookup("BumpFootprintExpirationOp"), + extendFootprintTtlOp: xdr.lookup("ExtendFootprintTtlOp"), restoreFootprintOp: xdr.lookup("RestoreFootprintOp"), }, }); @@ -4922,8 +4883,8 @@ var types = XDR.config((xdr) => { // LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionOp invokeHostFunctionOp; - // case BUMP_FOOTPRINT_EXPIRATION: - // BumpFootprintExpirationOp bumpFootprintExpirationOp; + // case EXTEND_FOOTPRINT_TTL: + // ExtendFootprintTTLOp extendFootprintTTLOp; // case RESTORE_FOOTPRINT: // RestoreFootprintOp restoreFootprintOp; // } @@ -5272,15 +5233,23 @@ var types = XDR.config((xdr) => { // { // ExtensionPoint ext; // SorobanResources resources; - // // Portion of transaction `fee` allocated to refundable fees. - // int64 refundableFee; + // // Amount of the transaction `fee` allocated to the Soroban resource fees. + // // The fraction of `resourceFee` corresponding to `resources` specified + // // above is *not* refundable (i.e. fees for instructions, ledger I/O), as + // // well as fees for the transaction size. + // // The remaining part of the fee is refundable and the charged value is + // // based on the actual consumption of refundable resources (events, ledger + // // rent bumps). + // // The `inclusionFee` used for prioritization of the transaction is defined + // // as `tx.fee - resourceFee`. + // int64 resourceFee; // }; // // =========================================================================== xdr.struct("SorobanTransactionData", [ ["ext", xdr.lookup("ExtensionPoint")], ["resources", xdr.lookup("SorobanResources")], - ["refundableFee", xdr.lookup("Int64")], + ["resourceFee", xdr.lookup("Int64")], ]); // === xdr source ============================================================ @@ -7256,7 +7225,7 @@ var types = XDR.config((xdr) => { // INVOKE_HOST_FUNCTION_MALFORMED = -1, // INVOKE_HOST_FUNCTION_TRAPPED = -2, // INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, - // INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4, + // INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, // INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 // }; // @@ -7266,7 +7235,7 @@ var types = XDR.config((xdr) => { invokeHostFunctionMalformed: -1, invokeHostFunctionTrapped: -2, invokeHostFunctionResourceLimitExceeded: -3, - invokeHostFunctionEntryExpired: -4, + invokeHostFunctionEntryArchived: -4, invokeHostFunctionInsufficientRefundableFee: -5, }); @@ -7279,7 +7248,7 @@ var types = XDR.config((xdr) => { // case INVOKE_HOST_FUNCTION_MALFORMED: // case INVOKE_HOST_FUNCTION_TRAPPED: // case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: - // case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED: + // case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: // case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: // void; // }; @@ -7293,7 +7262,7 @@ var types = XDR.config((xdr) => { ["invokeHostFunctionMalformed", xdr.void()], ["invokeHostFunctionTrapped", xdr.void()], ["invokeHostFunctionResourceLimitExceeded", xdr.void()], - ["invokeHostFunctionEntryExpired", xdr.void()], + ["invokeHostFunctionEntryArchived", xdr.void()], ["invokeHostFunctionInsufficientRefundableFee", xdr.void()], ], arms: { @@ -7303,46 +7272,46 @@ var types = XDR.config((xdr) => { // === xdr source ============================================================ // - // enum BumpFootprintExpirationResultCode + // enum ExtendFootprintTTLResultCode // { // // codes considered as "success" for the operation - // BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0, + // EXTEND_FOOTPRINT_TTL_SUCCESS = 0, // // // codes considered as "failure" for the operation - // BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1, - // BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2, - // BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3 + // EXTEND_FOOTPRINT_TTL_MALFORMED = -1, + // EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, + // EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 // }; // // =========================================================================== - xdr.enum("BumpFootprintExpirationResultCode", { - bumpFootprintExpirationSuccess: 0, - bumpFootprintExpirationMalformed: -1, - bumpFootprintExpirationResourceLimitExceeded: -2, - bumpFootprintExpirationInsufficientRefundableFee: -3, + xdr.enum("ExtendFootprintTtlResultCode", { + extendFootprintTtlSuccess: 0, + extendFootprintTtlMalformed: -1, + extendFootprintTtlResourceLimitExceeded: -2, + extendFootprintTtlInsufficientRefundableFee: -3, }); // === xdr source ============================================================ // - // union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code) + // union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code) // { - // case BUMP_FOOTPRINT_EXPIRATION_SUCCESS: + // case EXTEND_FOOTPRINT_TTL_SUCCESS: // void; - // case BUMP_FOOTPRINT_EXPIRATION_MALFORMED: - // case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED: - // case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE: + // case EXTEND_FOOTPRINT_TTL_MALFORMED: + // case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: + // case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: // void; // }; // // =========================================================================== - xdr.union("BumpFootprintExpirationResult", { - switchOn: xdr.lookup("BumpFootprintExpirationResultCode"), + xdr.union("ExtendFootprintTtlResult", { + switchOn: xdr.lookup("ExtendFootprintTtlResultCode"), switchName: "code", switches: [ - ["bumpFootprintExpirationSuccess", xdr.void()], - ["bumpFootprintExpirationMalformed", xdr.void()], - ["bumpFootprintExpirationResourceLimitExceeded", xdr.void()], - ["bumpFootprintExpirationInsufficientRefundableFee", xdr.void()], + ["extendFootprintTtlSuccess", xdr.void()], + ["extendFootprintTtlMalformed", xdr.void()], + ["extendFootprintTtlResourceLimitExceeded", xdr.void()], + ["extendFootprintTtlInsufficientRefundableFee", xdr.void()], ], arms: {}, }); @@ -7472,8 +7441,8 @@ var types = XDR.config((xdr) => { // LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionResult invokeHostFunctionResult; - // case BUMP_FOOTPRINT_EXPIRATION: - // BumpFootprintExpirationResult bumpFootprintExpirationResult; + // case EXTEND_FOOTPRINT_TTL: + // ExtendFootprintTTLResult extendFootprintTTLResult; // case RESTORE_FOOTPRINT: // RestoreFootprintResult restoreFootprintResult; // } @@ -7508,7 +7477,7 @@ var types = XDR.config((xdr) => { ["liquidityPoolDeposit", "liquidityPoolDepositResult"], ["liquidityPoolWithdraw", "liquidityPoolWithdrawResult"], ["invokeHostFunction", "invokeHostFunctionResult"], - ["bumpFootprintExpiration", "bumpFootprintExpirationResult"], + ["extendFootprintTtl", "extendFootprintTtlResult"], ["restoreFootprint", "restoreFootprintResult"], ], arms: { @@ -7545,9 +7514,7 @@ var types = XDR.config((xdr) => { liquidityPoolDepositResult: xdr.lookup("LiquidityPoolDepositResult"), liquidityPoolWithdrawResult: xdr.lookup("LiquidityPoolWithdrawResult"), invokeHostFunctionResult: xdr.lookup("InvokeHostFunctionResult"), - bumpFootprintExpirationResult: xdr.lookup( - "BumpFootprintExpirationResult" - ), + extendFootprintTtlResult: xdr.lookup("ExtendFootprintTtlResult"), restoreFootprintResult: xdr.lookup("RestoreFootprintResult"), }, }); @@ -7609,8 +7576,8 @@ var types = XDR.config((xdr) => { // LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionResult invokeHostFunctionResult; - // case BUMP_FOOTPRINT_EXPIRATION: - // BumpFootprintExpirationResult bumpFootprintExpirationResult; + // case EXTEND_FOOTPRINT_TTL: + // ExtendFootprintTTLResult extendFootprintTTLResult; // case RESTORE_FOOTPRINT: // RestoreFootprintResult restoreFootprintResult; // } @@ -8468,13 +8435,13 @@ var types = XDR.config((xdr) => { // enum ContractExecutableType // { // CONTRACT_EXECUTABLE_WASM = 0, - // CONTRACT_EXECUTABLE_TOKEN = 1 + // CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 // }; // // =========================================================================== xdr.enum("ContractExecutableType", { contractExecutableWasm: 0, - contractExecutableToken: 1, + contractExecutableStellarAsset: 1, }); // === xdr source ============================================================ @@ -8483,7 +8450,7 @@ var types = XDR.config((xdr) => { // { // case CONTRACT_EXECUTABLE_WASM: // Hash wasm_hash; - // case CONTRACT_EXECUTABLE_TOKEN: + // case CONTRACT_EXECUTABLE_STELLAR_ASSET: // void; // }; // @@ -8493,7 +8460,7 @@ var types = XDR.config((xdr) => { switchName: "type", switches: [ ["contractExecutableWasm", "wasmHash"], - ["contractExecutableToken", xdr.void()], + ["contractExecutableStellarAsset", xdr.void()], ], arms: { wasmHash: xdr.lookup("Hash"), @@ -9465,96 +9432,81 @@ var types = XDR.config((xdr) => { // enum ContractCostType { // // Cost of running 1 wasm instruction // WasmInsnExec = 0, - // // Cost of growing wasm linear memory by 1 page - // WasmMemAlloc = 1, - // // Cost of allocating a chuck of host memory (in bytes) - // HostMemAlloc = 2, - // // Cost of copying a chuck of bytes into a pre-allocated host memory - // HostMemCpy = 3, - // // Cost of comparing two slices of host memory - // HostMemCmp = 4, + // // Cost of allocating a slice of memory (in bytes) + // MemAlloc = 1, + // // Cost of copying a slice of bytes into a pre-allocated memory + // MemCpy = 2, + // // Cost of comparing two slices of memory + // MemCmp = 3, // // Cost of a host function dispatch, not including the actual work done by // // the function nor the cost of VM invocation machinary - // DispatchHostFunction = 5, + // DispatchHostFunction = 4, // // Cost of visiting a host object from the host object storage. Exists to // // make sure some baseline cost coverage, i.e. repeatly visiting objects // // by the guest will always incur some charges. - // VisitObject = 6, + // VisitObject = 5, // // Cost of serializing an xdr object to bytes - // ValSer = 7, + // ValSer = 6, // // Cost of deserializing an xdr object from bytes - // ValDeser = 8, + // ValDeser = 7, // // Cost of computing the sha256 hash from bytes - // ComputeSha256Hash = 9, + // ComputeSha256Hash = 8, // // Cost of computing the ed25519 pubkey from bytes - // ComputeEd25519PubKey = 10, - // // Cost of accessing an entry in a Map. - // MapEntry = 11, - // // Cost of accessing an entry in a Vec - // VecEntry = 12, + // ComputeEd25519PubKey = 9, // // Cost of verifying ed25519 signature of a payload. - // VerifyEd25519Sig = 13, - // // Cost of reading a slice of vm linear memory - // VmMemRead = 14, - // // Cost of writing to a slice of vm linear memory - // VmMemWrite = 15, + // VerifyEd25519Sig = 10, // // Cost of instantiation a VM from wasm bytes code. - // VmInstantiation = 16, + // VmInstantiation = 11, // // Cost of instantiation a VM from a cached state. - // VmCachedInstantiation = 17, + // VmCachedInstantiation = 12, // // Cost of invoking a function on the VM. If the function is a host function, // // additional cost will be covered by `DispatchHostFunction`. - // InvokeVmFunction = 18, + // InvokeVmFunction = 13, // // Cost of computing a keccak256 hash from bytes. - // ComputeKeccak256Hash = 19, - // // Cost of computing an ECDSA secp256k1 pubkey from bytes. - // ComputeEcdsaSecp256k1Key = 20, + // ComputeKeccak256Hash = 14, // // Cost of computing an ECDSA secp256k1 signature from bytes. - // ComputeEcdsaSecp256k1Sig = 21, + // ComputeEcdsaSecp256k1Sig = 15, // // Cost of recovering an ECDSA secp256k1 key from a signature. - // RecoverEcdsaSecp256k1Key = 22, + // RecoverEcdsaSecp256k1Key = 16, // // Cost of int256 addition (`+`) and subtraction (`-`) operations - // Int256AddSub = 23, + // Int256AddSub = 17, // // Cost of int256 multiplication (`*`) operation - // Int256Mul = 24, + // Int256Mul = 18, // // Cost of int256 division (`/`) operation - // Int256Div = 25, + // Int256Div = 19, // // Cost of int256 power (`exp`) operation - // Int256Pow = 26, + // Int256Pow = 20, // // Cost of int256 shift (`shl`, `shr`) operation - // Int256Shift = 27 + // Int256Shift = 21, + // // Cost of drawing random bytes using a ChaCha20 PRNG + // ChaCha20DrawBytes = 22 // }; // // =========================================================================== xdr.enum("ContractCostType", { wasmInsnExec: 0, - wasmMemAlloc: 1, - hostMemAlloc: 2, - hostMemCpy: 3, - hostMemCmp: 4, - dispatchHostFunction: 5, - visitObject: 6, - valSer: 7, - valDeser: 8, - computeSha256Hash: 9, - computeEd25519PubKey: 10, - mapEntry: 11, - vecEntry: 12, - verifyEd25519Sig: 13, - vmMemRead: 14, - vmMemWrite: 15, - vmInstantiation: 16, - vmCachedInstantiation: 17, - invokeVmFunction: 18, - computeKeccak256Hash: 19, - computeEcdsaSecp256k1Key: 20, - computeEcdsaSecp256k1Sig: 21, - recoverEcdsaSecp256k1Key: 22, - int256AddSub: 23, - int256Mul: 24, - int256Div: 25, - int256Pow: 26, - int256Shift: 27, + memAlloc: 1, + memCpy: 2, + memCmp: 3, + dispatchHostFunction: 4, + visitObject: 5, + valSer: 6, + valDeser: 7, + computeSha256Hash: 8, + computeEd25519PubKey: 9, + verifyEd25519Sig: 10, + vmInstantiation: 11, + vmCachedInstantiation: 12, + invokeVmFunction: 13, + computeKeccak256Hash: 14, + computeEcdsaSecp256k1Sig: 15, + recoverEcdsaSecp256k1Key: 16, + int256AddSub: 17, + int256Mul: 18, + int256Div: 19, + int256Pow: 20, + int256Shift: 21, + chaCha20DrawBytes: 22, }); // === xdr source ============================================================ @@ -9576,17 +9528,17 @@ var types = XDR.config((xdr) => { // === xdr source ============================================================ // - // struct StateExpirationSettings { - // uint32 maxEntryExpiration; - // uint32 minTempEntryExpiration; - // uint32 minPersistentEntryExpiration; + // struct StateArchivalSettings { + // uint32 maxEntryTTL; + // uint32 minTemporaryTTL; + // uint32 minPersistentTTL; // // // rent_fee = wfee_rate_average / rent_rate_denominator_for_type // int64 persistentRentRateDenominator; // int64 tempRentRateDenominator; // - // // max number of entries that emit expiration meta in a single ledger - // uint32 maxEntriesToExpire; + // // max number of entries that emit archival meta in a single ledger + // uint32 maxEntriesToArchive; // // // Number of snapshots to use when calculating average BucketList size // uint32 bucketListSizeWindowSampleSize; @@ -9599,13 +9551,13 @@ var types = XDR.config((xdr) => { // }; // // =========================================================================== - xdr.struct("StateExpirationSettings", [ - ["maxEntryExpiration", xdr.lookup("Uint32")], - ["minTempEntryExpiration", xdr.lookup("Uint32")], - ["minPersistentEntryExpiration", xdr.lookup("Uint32")], + xdr.struct("StateArchivalSettings", [ + ["maxEntryTtl", xdr.lookup("Uint32")], + ["minTemporaryTtl", xdr.lookup("Uint32")], + ["minPersistentTtl", xdr.lookup("Uint32")], ["persistentRentRateDenominator", xdr.lookup("Int64")], ["tempRentRateDenominator", xdr.lookup("Int64")], - ["maxEntriesToExpire", xdr.lookup("Uint32")], + ["maxEntriesToArchive", xdr.lookup("Uint32")], ["bucketListSizeWindowSampleSize", xdr.lookup("Uint32")], ["evictionScanSize", xdr.lookup("Uint64")], ["startingEvictionScanLevel", xdr.lookup("Uint32")], @@ -9660,7 +9612,7 @@ var types = XDR.config((xdr) => { // CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, // CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, // CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, - // CONFIG_SETTING_STATE_EXPIRATION = 10, + // CONFIG_SETTING_STATE_ARCHIVAL = 10, // CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, // CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, // CONFIG_SETTING_EVICTION_ITERATOR = 13 @@ -9678,7 +9630,7 @@ var types = XDR.config((xdr) => { configSettingContractCostParamsMemoryBytes: 7, configSettingContractDataKeySizeBytes: 8, configSettingContractDataEntrySizeBytes: 9, - configSettingStateExpiration: 10, + configSettingStateArchival: 10, configSettingContractExecutionLanes: 11, configSettingBucketlistSizeWindow: 12, configSettingEvictionIterator: 13, @@ -9708,8 +9660,8 @@ var types = XDR.config((xdr) => { // uint32 contractDataKeySizeBytes; // case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: // uint32 contractDataEntrySizeBytes; - // case CONFIG_SETTING_STATE_EXPIRATION: - // StateExpirationSettings stateExpirationSettings; + // case CONFIG_SETTING_STATE_ARCHIVAL: + // StateArchivalSettings stateArchivalSettings; // case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: // ConfigSettingContractExecutionLanesV0 contractExecutionLanes; // case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: @@ -9739,7 +9691,7 @@ var types = XDR.config((xdr) => { ], ["configSettingContractDataKeySizeBytes", "contractDataKeySizeBytes"], ["configSettingContractDataEntrySizeBytes", "contractDataEntrySizeBytes"], - ["configSettingStateExpiration", "stateExpirationSettings"], + ["configSettingStateArchival", "stateArchivalSettings"], ["configSettingContractExecutionLanes", "contractExecutionLanes"], ["configSettingBucketlistSizeWindow", "bucketListSizeWindow"], ["configSettingEvictionIterator", "evictionIterator"], @@ -9757,7 +9709,7 @@ var types = XDR.config((xdr) => { contractCostParamsMemBytes: xdr.lookup("ContractCostParams"), contractDataKeySizeBytes: xdr.lookup("Uint32"), contractDataEntrySizeBytes: xdr.lookup("Uint32"), - stateExpirationSettings: xdr.lookup("StateExpirationSettings"), + stateArchivalSettings: xdr.lookup("StateArchivalSettings"), contractExecutionLanes: xdr.lookup( "ConfigSettingContractExecutionLanesV0" ), diff --git a/src/index.js b/src/index.js index 8b77fff6..fcfbb712 100644 --- a/src/index.js +++ b/src/index.js @@ -12,7 +12,7 @@ export { LiquidityPoolFeeV18 } from './get_liquidity_pool_id'; export { Keypair } from './keypair'; -export { UnsignedHyper, Hyper } from 'js-xdr'; +export { UnsignedHyper, Hyper } from '@stellar/js-xdr'; export { TransactionBase } from './transaction_base'; export { Transaction } from './transaction'; export { FeeBumpTransaction } from './fee_bump_transaction'; diff --git a/src/invocation.js b/src/invocation.js index 4ad48e20..4369785b 100644 --- a/src/invocation.js +++ b/src/invocation.js @@ -135,7 +135,7 @@ export function buildInvocationTree(root) { break; } - // contractExecutableToken + // contractExecutableStellarAsset case 1: output.args.type = 'sac'; output.args.asset = Asset.fromOperation( diff --git a/src/memo.js b/src/memo.js index c2781d12..4636e494 100644 --- a/src/memo.js +++ b/src/memo.js @@ -1,4 +1,4 @@ -import { UnsignedHyper } from 'js-xdr'; +import { UnsignedHyper } from '@stellar/js-xdr'; import BigNumber from 'bignumber.js'; import xdr from './xdr'; diff --git a/src/numbers/int128.js b/src/numbers/int128.js index a543342a..4b114995 100644 --- a/src/numbers/int128.js +++ b/src/numbers/int128.js @@ -1,4 +1,4 @@ -import { LargeInt } from 'js-xdr'; +import { LargeInt } from '@stellar/js-xdr'; export class Int128 extends LargeInt { /** diff --git a/src/numbers/int256.js b/src/numbers/int256.js index 76e155c3..b8e1b46c 100644 --- a/src/numbers/int256.js +++ b/src/numbers/int256.js @@ -1,4 +1,4 @@ -import { LargeInt } from 'js-xdr'; +import { LargeInt } from '@stellar/js-xdr'; export class Int256 extends LargeInt { /** diff --git a/src/numbers/uint128.js b/src/numbers/uint128.js index 1f064232..b9322275 100644 --- a/src/numbers/uint128.js +++ b/src/numbers/uint128.js @@ -1,4 +1,4 @@ -import { LargeInt } from 'js-xdr'; +import { LargeInt } from '@stellar/js-xdr'; export class Uint128 extends LargeInt { /** diff --git a/src/numbers/uint256.js b/src/numbers/uint256.js index c7ac461f..eb52ea47 100644 --- a/src/numbers/uint256.js +++ b/src/numbers/uint256.js @@ -1,4 +1,4 @@ -import { LargeInt } from 'js-xdr'; +import { LargeInt } from '@stellar/js-xdr'; export class Uint256 extends LargeInt { /** diff --git a/src/numbers/xdr_large_int.js b/src/numbers/xdr_large_int.js index c8869ca5..7208d503 100644 --- a/src/numbers/xdr_large_int.js +++ b/src/numbers/xdr_large_int.js @@ -1,5 +1,5 @@ /* eslint no-bitwise: ["error", {"allow": [">>"]}] */ -import { Hyper, UnsignedHyper } from 'js-xdr'; +import { Hyper, UnsignedHyper } from '@stellar/js-xdr'; import { Uint128 } from './uint128'; import { Uint256 } from './uint256'; @@ -22,14 +22,10 @@ import xdr from '../xdr'; * integer-like values interpreted in big-endian order */ export class XdrLargeInt { - /** - * @type {xdr.LargeInt} - */ + /** @type {xdr.LargeInt} */ int; // child class of a jsXdr.LargeInt - /** - * @type {string} - one of i64, u64, i128, u128, i256, or u256 - */ + /** @type {string} */ type; constructor(type, values) { diff --git a/src/operation.js b/src/operation.js index 0712f66f..561ac96d 100644 --- a/src/operation.js +++ b/src/operation.js @@ -1,6 +1,6 @@ /* eslint-disable no-bitwise */ -import { Hyper } from 'js-xdr'; +import { Hyper } from '@stellar/js-xdr'; import BigNumber from 'bignumber.js'; import { trimEnd } from './util/util'; import { best_r } from './util/continued_fraction'; @@ -10,7 +10,7 @@ import { Claimant } from './claimant'; import { StrKey } from './strkey'; import { LiquidityPoolId } from './liquidity_pool_id'; import xdr from './xdr'; -import * as ops from './operations/index'; +import * as ops from './operations'; import { decodeAddressToMuxedAccount, encodeMuxedAccountToAddress @@ -92,7 +92,7 @@ export const AuthClawbackEnabledFlag = 1 << 3; * * `{@link Operation.liquidityPoolDeposit}` * * `{@link Operation.liquidityPoolWithdraw}` * * `{@link Operation.invokeHostFunction}` - * * `{@link Operation.bumpFootprintExpiration}` + * * `{@link Operation.extendFootprintTtlOp}` * * `{@link Operation.restoreFootprint}` * * @class Operation @@ -381,9 +381,9 @@ export class Operation { result.auth = attrs.auth() ?? []; break; } - case 'bumpFootprintExpiration': { - result.type = 'bumpFootprintExpiration'; - result.ledgersToExpire = attrs.ledgersToExpire(); + case 'extendFootprintTtl': { + result.type = 'extendFootprintTtl'; + result.extendTo = attrs.extendTo(); break; } case 'restoreFootprint': { @@ -672,5 +672,12 @@ Operation.setTrustLineFlags = ops.setTrustLineFlags; Operation.liquidityPoolDeposit = ops.liquidityPoolDeposit; Operation.liquidityPoolWithdraw = ops.liquidityPoolWithdraw; Operation.invokeHostFunction = ops.invokeHostFunction; -Operation.bumpFootprintExpiration = ops.bumpFootprintExpiration; +Operation.extendFootprintTtl = ops.extendFootprintTtl; Operation.restoreFootprint = ops.restoreFootprint; + +// these are not `xdr.Operation`s directly, but are proxies for complex but +// common versions of `Operation.invokeHostFunction` +Operation.createStellarAssetContract = ops.createStellarAssetContract; +Operation.invokeContractFunction = ops.invokeContractFunction; +Operation.createCustomContract = ops.createCustomContract; +Operation.uploadContractWasm = ops.uploadContractWasm; diff --git a/src/operations/bump_sequence.js b/src/operations/bump_sequence.js index a1488436..30ff6157 100644 --- a/src/operations/bump_sequence.js +++ b/src/operations/bump_sequence.js @@ -1,4 +1,4 @@ -import { Hyper } from 'js-xdr'; +import { Hyper } from '@stellar/js-xdr'; import BigNumber from 'bignumber.js'; import xdr from '../xdr'; diff --git a/src/operations/change_trust.js b/src/operations/change_trust.js index 65641850..95d2dbfd 100644 --- a/src/operations/change_trust.js +++ b/src/operations/change_trust.js @@ -1,4 +1,4 @@ -import { Hyper } from 'js-xdr'; +import { Hyper } from '@stellar/js-xdr'; import BigNumber from 'bignumber.js'; import xdr from '../xdr'; import { Asset } from '../asset'; diff --git a/src/operations/bump_footprint_expiration.js b/src/operations/extend_footprint_ttl.js similarity index 65% rename from src/operations/bump_footprint_expiration.js rename to src/operations/extend_footprint_ttl.js index 7d2fbe9c..d1e763fa 100644 --- a/src/operations/bump_footprint_expiration.js +++ b/src/operations/extend_footprint_ttl.js @@ -11,29 +11,29 @@ import xdr from '../xdr'; * usage as part of {@link xdr.SorobanResources}). * * @function - * @alias Operation.bumpFootprintExpiration + * @alias Operation.extendFootprintTtl * * @param {object} opts - object holding operation parameters - * @param {number} opts.ledgersToExpire - the number of ledgers past the LCL + * @param {number} opts.extendTo - the number of ledgers past the LCL * (last closed ledger) by which to extend the validity of the ledger keys in * this transaction * @param {string} [opts.source] - an optional source account * * @returns {xdr.Operation} a Bump Footprint Expiration operation - * (xdr.BumpFootprintExpirationOp) + * (xdr.ExtendFootprintTTLOp) */ -export function bumpFootprintExpiration(opts) { - if ((opts.ledgersToExpire ?? -1) <= 0) { - throw new RangeError("ledgersToExpire isn't a ledger quantity (uint32)"); +export function extendFootprintTtl(opts) { + if ((opts.extendTo ?? -1) <= 0) { + throw new RangeError("extendTo isn't a ledger quantity (uint32)"); } - const bumpFootprintOp = new xdr.BumpFootprintExpirationOp({ + const extendFootprintOp = new xdr.ExtendFootprintTtlOp({ ext: new xdr.ExtensionPoint(0), - ledgersToExpire: opts.ledgersToExpire + extendTo: opts.extendTo }); const opAttributes = { - body: xdr.OperationBody.bumpFootprintExpiration(bumpFootprintOp) + body: xdr.OperationBody.extendFootprintTtl(extendFootprintOp) }; this.setSourceAccount(opAttributes, opts); diff --git a/src/operations/index.js b/src/operations/index.js index 82d32de9..8a98bd0f 100644 --- a/src/operations/index.js +++ b/src/operations/index.js @@ -30,6 +30,12 @@ export { clawback } from './clawback'; export { setTrustLineFlags } from './set_trustline_flags'; export { liquidityPoolDeposit } from './liquidity_pool_deposit'; export { liquidityPoolWithdraw } from './liquidity_pool_withdraw'; -export { invokeHostFunction } from './invoke_host_function'; -export { bumpFootprintExpiration } from './bump_footprint_expiration'; +export { + invokeHostFunction, + invokeContractFunction, + createStellarAssetContract, + createCustomContract, + uploadContractWasm +} from './invoke_host_function'; +export { extendFootprintTtl } from './extend_footprint_ttl'; export { restoreFootprint } from './restore_footprint'; diff --git a/src/operations/invoke_host_function.js b/src/operations/invoke_host_function.js index b46aa287..8fb264a7 100644 --- a/src/operations/invoke_host_function.js +++ b/src/operations/invoke_host_function.js @@ -1,7 +1,11 @@ import xdr from '../xdr'; +import { Keypair } from '../keypair'; +import { Address } from '../address'; +import { Asset } from '../asset'; + /** - * Invokes a single smart contract function. + * Invokes a single smart contract host function. * * @function * @alias Operation.invokeHostFunction @@ -15,6 +19,13 @@ import xdr from '../xdr'; * * @returns {xdr.Operation} an Invoke Host Function operation * (xdr.InvokeHostFunctionOp) + * + * @see https://soroban.stellar.org/docs/fundamentals-and-concepts/invoking-contracts-with-transactions#function + * @see Operation.invokeContractFunction + * @see Operation.createCustomContract + * @see Operation.createStellarAssetContract + * @see Operation.uploadContractWasm + * @see Contract.call */ export function invokeHostFunction(opts) { if (!opts.func) { @@ -35,3 +46,184 @@ export function invokeHostFunction(opts) { return new xdr.Operation(opAttributes); } + +/** + * Returns an operation that invokes a contract function. + * + * @function + * @alias Operation.invokeContractFunction + * + * @param {any} opts - the set of parameters + * @param {string} opts.contract - a strkey-fied contract address (`C...`) + * @param {string} opts.function - the name of the contract fn to invoke + * @param {xdr.ScVal[]} opts.args - parameters to pass to the function + * invocation (try {@link nativeToScVal} or {@link ScInt} to make building + * these easier) + * @param {xdr.SorobanAuthorizationEntry[]} [opts.auth] - an optional list + * outlining the tree of authorizations required for the call + * @param {string} [opts.source] - an optional source account + * + * @returns {xdr.Operation} an Invoke Host Function operation + * (xdr.InvokeHostFunctionOp) + * + * @see Operation.invokeHostFunction + * @see Contract.call + * @see Address + */ +export function invokeContractFunction(opts) { + const c = new Address(opts.contract); + if (c._type !== 'contract') { + throw new TypeError(`expected contract strkey instance, got ${c}`); + } + + return this.invokeHostFunction({ + source: opts.source, + auth: opts.auth, + func: xdr.HostFunction.hostFunctionTypeInvokeContract( + new xdr.InvokeContractArgs({ + contractAddress: c.toScAddress(), + functionName: opts.function, + args: opts.args + }) + ) + }); +} + +/** + * Returns an operation that creates a custom WASM contract. + * + * @function + * @alias Operation.createCustomContract + * + * @param {any} opts - the set of parameters + * @param {Address} opts.address - the contract uploader address + * @param {Uint8Array|Buffer} opts.wasmHash - the SHA-256 hash of the contract + * WASM you're uploading (see {@link hash} and + * {@link Operation.uploadContractWasm}) + * @param {Uint8Array|Buffer} [opts.salt] - an optional, 32-byte salt to + * distinguish deployment instances of the same wasm from the same user (if + * omitted, one will be generated for you) + * @param {xdr.SorobanAuthorizationEntry[]} [opts.auth] - an optional list + * outlining the tree of authorizations required for the call + * @param {string} [opts.source] - an optional source account + * + * @returns {xdr.Operation} an Invoke Host Function operation + * (xdr.InvokeHostFunctionOp) + * + * @see + * https://soroban.stellar.org/docs/fundamentals-and-concepts/invoking-contracts-with-transactions#function + */ +export function createCustomContract(opts) { + const salt = Buffer.from(opts.salt || getSalty()); + + if (!opts.wasmHash || opts.wasmHash.length !== 32) { + throw new TypeError( + `expected hash(contract WASM) in 'opts.wasmHash', got ${opts.wasmHash}` + ); + } + if (salt.length !== 32) { + throw new TypeError( + `expected 32-byte salt in 'opts.salt', got ${opts.wasmHash}` + ); + } + + return this.invokeHostFunction({ + source: opts.source, + auth: opts.auth, + func: xdr.HostFunction.hostFunctionTypeCreateContract( + new xdr.CreateContractArgs({ + executable: xdr.ContractExecutable.contractExecutableWasm( + Buffer.from(opts.wasmHash) + ), + contractIdPreimage: + xdr.ContractIdPreimage.contractIdPreimageFromAddress( + new xdr.ContractIdPreimageFromAddress({ + address: opts.address.toScAddress(), + salt + }) + ) + }) + ) + }); +} + +/** + * Returns an operation that wraps a Stellar asset into a token contract. + * + * @function + * @alias Operation.createStellarAssetContract + * + * @param {any} opts - the set of parameters + * @param {Asset|string} opts.asset - the Stellar asset to wrap, either as an + * {@link Asset} object or in canonical form (SEP-11, `code:issuer`) + * @param {xdr.SorobanAuthorizationEntry[]} [opts.auth] - an optional list + * outlining the tree of authorizations required for the call + * @param {string} [opts.source] - an optional source account + * + * @returns {xdr.Operation} an Invoke Host Function operation + * (xdr.InvokeHostFunctionOp) + * + * @see https://stellar.org/protocol/sep-11#alphanum4-alphanum12 + * @see + * https://soroban.stellar.org/docs/fundamentals-and-concepts/invoking-contracts-with-transactions + * @see + * https://soroban.stellar.org/docs/advanced-tutorials/stellar-asset-contract + * @see Operation.invokeHostFunction + */ +export function createStellarAssetContract(opts) { + let asset = opts.asset; + if (typeof asset === 'string') { + const [code, issuer] = asset.split(':'); + asset = new Asset(code, issuer); // handles 'xlm' by default + } + + if (!(asset instanceof Asset)) { + throw new TypeError(`expected Asset in 'opts.asset', got ${asset}`); + } + + return this.invokeHostFunction({ + source: opts.source, + auth: opts.auth, + func: xdr.HostFunction.hostFunctionTypeCreateContract( + new xdr.CreateContractArgs({ + executable: xdr.ContractExecutable.contractExecutableStellarAsset(), + contractIdPreimage: xdr.ContractIdPreimage.contractIdPreimageFromAsset( + asset.toXDRObject() + ) + }) + ) + }); +} + +/** + * Returns an operation that uploads WASM for a contract. + * + * @function + * @alias Operation.uploadContractWasm + * + * @param {any} opts - the set of parameters + * @param {Uint8Array|Buffer} opts.wasm - a WASM blob to upload to the ledger + * @param {xdr.SorobanAuthorizationEntry[]} [opts.auth] - an optional list + * outlining the tree of authorizations required for the call + * @param {string} [opts.source] - an optional source account + * + * @returns {xdr.Operation} an Invoke Host Function operation + * (xdr.InvokeHostFunctionOp) + * + * @see + * https://soroban.stellar.org/docs/fundamentals-and-concepts/invoking-contracts-with-transactions#function + */ +export function uploadContractWasm(opts) { + return this.invokeHostFunction({ + source: opts.source, + auth: opts.auth, + func: xdr.HostFunction.hostFunctionTypeUploadContractWasm( + Buffer.from(opts.wasm) // coalesce so we can drop `Buffer` someday + ) + }); +} + +/** @returns {Buffer} a random 256-bit "salt" value. */ +function getSalty() { + return Keypair.random().xdrPublicKey().value(); // ed25519 is 256 bits, too +} diff --git a/src/operations/manage_buy_offer.js b/src/operations/manage_buy_offer.js index 83d5ac96..6b56b564 100644 --- a/src/operations/manage_buy_offer.js +++ b/src/operations/manage_buy_offer.js @@ -1,4 +1,4 @@ -import { Hyper } from 'js-xdr'; +import { Hyper } from '@stellar/js-xdr'; import xdr from '../xdr'; /** * Returns a XDR ManageBuyOfferOp. A "manage buy offer" operation creates, updates, or diff --git a/src/operations/manage_sell_offer.js b/src/operations/manage_sell_offer.js index f22cce7e..d3d6ef6d 100644 --- a/src/operations/manage_sell_offer.js +++ b/src/operations/manage_sell_offer.js @@ -1,4 +1,4 @@ -import { Hyper } from 'js-xdr'; +import { Hyper } from '@stellar/js-xdr'; import xdr from '../xdr'; /** * Returns a XDR ManageSellOfferOp. A "manage sell offer" operation creates, updates, or diff --git a/src/soroban.js b/src/soroban.js index 1c4f0b5a..619e4e39 100644 --- a/src/soroban.js +++ b/src/soroban.js @@ -1,7 +1,4 @@ -/** - * @class Soroban - * Soroban helper class to assist with formatting and parsing token amounts. - */ +/* Helper class to assist with formatting and parsing token amounts. */ export class Soroban { /** * Given a whole number smart contract amount of a token and an amount of diff --git a/src/sorobandata_builder.js b/src/sorobandata_builder.js index 4d74ccd2..14828d39 100644 --- a/src/sorobandata_builder.js +++ b/src/sorobandata_builder.js @@ -5,10 +5,9 @@ import xdr from './xdr'; * items set to specific values. * * This is recommended for when you are building - * {@link Operation.bumpFootprintExpiration} / - * {@link Operation.restoreFootprint} operations and need to - * {@link TransactionBuilder.setSorobanData} to avoid (re)building the entire - * data structure from scratch. + * {@link Operation.extendFootprintTtl} / {@link Operation.restoreFootprint} + * operations and need to {@link TransactionBuilder.setSorobanData} to avoid + * (re)building the entire data structure from scratch. * * @constructor * @@ -46,7 +45,7 @@ export class SorobanDataBuilder { writeBytes: 0 }), ext: new xdr.ExtensionPoint(0), - refundableFee: new xdr.Int64(0) + resourceFee: new xdr.Int64(0) }); } else if ( typeof sorobanData === 'string' || @@ -73,12 +72,12 @@ export class SorobanDataBuilder { } /** - * Sets the "refundable" fee portion of the Soroban data. - * @param {number | bigint | string} fee the refundable fee to set (int64) + * Sets the resource fee portion of the Soroban data. + * @param {number | bigint | string} fee the resource fee to set (int64) * @returns {SorobanDataBuilder} */ - setRefundableFee(fee) { - this._data.refundableFee(new xdr.Int64(fee)); + setResourceFee(fee) { + this._data.resourceFee(new xdr.Int64(fee)); return this; } diff --git a/src/transaction.js b/src/transaction.js index 9d1fb8a4..5a0ecab9 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -154,8 +154,9 @@ export class Transaction extends TransactionBase { } /** - * @type {string} 64 bit account sequence + * 64 bit account sequence * @readonly + * @type {string} */ get minAccountSequence() { return this._minAccountSequence; @@ -165,7 +166,8 @@ export class Transaction extends TransactionBase { } /** - * @type {number} 64 bit number of seconds + * 64 bit number of seconds + * @type {number} * @readonly */ get minAccountSequenceAge() { @@ -176,7 +178,8 @@ export class Transaction extends TransactionBase { } /** - * @type {number} 32 bit number of ledgers + * 32 bit number of ledgers + * @type {number} * @readonly */ get minAccountSequenceLedgerGap() { @@ -187,7 +190,8 @@ export class Transaction extends TransactionBase { } /** - * @type {string[]} array of extra signers (@{link StrKey}s) + * array of extra signers ({@link StrKey}s) + * @type {string[]} * @readonly */ get extraSigners() { @@ -204,7 +208,6 @@ export class Transaction extends TransactionBase { get sequence() { return this._sequence; } - set sequence(value) { throw new Error('Transaction is immutable'); } @@ -216,7 +219,6 @@ export class Transaction extends TransactionBase { get source() { return this._source; } - set source(value) { throw new Error('Transaction is immutable'); } @@ -228,7 +230,6 @@ export class Transaction extends TransactionBase { get operations() { return this._operations; } - set operations(value) { throw new Error('Transaction is immutable'); } @@ -240,7 +241,6 @@ export class Transaction extends TransactionBase { get memo() { return Memo.fromXDRObject(this._memo); } - set memo(value) { throw new Error('Transaction is immutable'); } diff --git a/src/transaction_builder.js b/src/transaction_builder.js index 15e3ba85..2ca99c78 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -1,4 +1,4 @@ -import { UnsignedHyper } from 'js-xdr'; +import { UnsignedHyper } from '@stellar/js-xdr'; import BigNumber from 'bignumber.js'; import xdr from './xdr'; diff --git a/test/unit/contract_test.js b/test/unit/contract_test.js index 4038e018..bef4ecbc 100644 --- a/test/unit/contract_test.js +++ b/test/unit/contract_test.js @@ -35,20 +35,13 @@ describe('Contract', function () { expect(contract.contractId()).to.equal(NULL_ADDRESS); const actual = contract.getFootprint(); - const expected = [ - new xdr.LedgerKey.contractCode( - new xdr.LedgerKeyContractCode({ - hash: StellarBase.StrKey.decodeContract(contract.contractId()) - }) - ), - new xdr.LedgerKey.contractData( - new xdr.LedgerKeyContractData({ - contract: contract.address().toScAddress(), - key: xdr.ScVal.scvLedgerKeyContractInstance(), - durability: xdr.ContractDataDurability.persistent() - }) - ) - ]; + const expected = new xdr.LedgerKey.contractData( + new xdr.LedgerKeyContractData({ + contract: contract.address().toScAddress(), + key: xdr.ScVal.scvLedgerKeyContractInstance(), + durability: xdr.ContractDataDurability.persistent() + }) + ); expect(actual).to.eql(expected); }); diff --git a/test/unit/i256_test.js b/test/unit/i256_test.js index 6aa3f8c8..baa2084b 100644 --- a/test/unit/i256_test.js +++ b/test/unit/i256_test.js @@ -1,4 +1,4 @@ -// import { XdrWriter, XdrReader } from 'js-xdr'; +// import { XdrWriter, XdrReader } from '@stellar/js-xdr'; const I256 = StellarBase.Int256; // shorthand describe('I256.isValid', function () { diff --git a/test/unit/invocation_test.js b/test/unit/invocation_test.js index be7b1d09..d67c0c3e 100644 --- a/test/unit/invocation_test.js +++ b/test/unit/invocation_test.js @@ -69,7 +69,8 @@ describe('parsing invocation trees', function () { xdr.ContractIdPreimage.contractIdPreimageFromAsset( new Asset('TEST', nftId).toXDRObject() ), - executable: xdr.ContractExecutable.contractExecutableToken() + executable: + xdr.ContractExecutable.contractExecutableStellarAsset() }) ), subInvocations: [] diff --git a/test/unit/operation_test.js b/test/unit/operations/classic_ops_test.js similarity index 97% rename from test/unit/operation_test.js rename to test/unit/operations/classic_ops_test.js index b16ab293..bfdf121e 100644 --- a/test/unit/operation_test.js +++ b/test/unit/operations/classic_ops_test.js @@ -2013,75 +2013,6 @@ describe('Operation', function () { }); }); - describe('invokeHostFunction()', function () { - it('creates operation', function () { - const contractId = - 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; - const c = new StellarBase.Contract(contractId); - const op = StellarBase.Operation.invokeHostFunction({ - func: StellarBase.xdr.HostFunction.hostFunctionTypeInvokeContract( - new StellarBase.xdr.InvokeContractArgs({ - contractAddress: c.address().toScAddress(), - functionName: 'hello', - args: [StellarBase.nativeToScVal('world')] - }) - ), - auth: [] - }); - var xdr = op.toXDR('hex'); - var operation = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); - - expect(operation.body().switch().name).to.equal('invokeHostFunction'); - var obj = StellarBase.Operation.fromXDRObject(operation); - expect(obj.type).to.be.equal('invokeHostFunction'); - expect(obj.func.switch().name).to.equal('hostFunctionTypeInvokeContract'); - expect(obj.auth).to.deep.equal([]); - }); - - it('throws when no func passed', function () { - expect(() => - StellarBase.Operation.invokeHostFunction({ - auth: [] - }) - ).to.throw(/\('func'\) required/); - }); - }); - - describe('bumpFootprintExpiration()', function () { - it('creates operation', function () { - const op = StellarBase.Operation.bumpFootprintExpiration({ - ledgersToExpire: 1234 - }); - const xdr = op.toXDR('hex'); - const operation = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); - - expect(operation.body().switch().name).to.equal( - 'bumpFootprintExpiration' - ); - const obj = StellarBase.Operation.fromXDRObject(operation); - expect(obj.type).to.be.equal('bumpFootprintExpiration'); - expect(obj.ledgersToExpire).to.equal(1234); - - expect(() => { - StellarBase.Operation.bumpFootprintExpiration({ - ledgersToExpire: 0 - }); - }).to.throw(/ledger quantity/i); - }); - }); - - describe('restoreFootprint()', function () { - it('creates operation', function () { - const op = StellarBase.Operation.restoreFootprint(); - const xdr = op.toXDR('hex'); - const operation = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); - - expect(operation.body().switch().name).to.equal('restoreFootprint'); - const obj = StellarBase.Operation.fromXDRObject(operation); - expect(obj.type).to.be.equal('restoreFootprint'); - }); - }); - describe('revokeTrustlineSponsorship()', function () { it('creates a revokeTrustlineSponsorship', function () { const account = diff --git a/test/unit/operations/extend_restore_test.js b/test/unit/operations/extend_restore_test.js new file mode 100644 index 00000000..4e96b9b0 --- /dev/null +++ b/test/unit/operations/extend_restore_test.js @@ -0,0 +1,32 @@ +const { Operation } = StellarBase; + +describe('Operation', function () { + describe('.extendFootprintTtl()', function () { + it('creates operation', function () { + const op = StellarBase.Operation.extendFootprintTtl({ extendTo: 1234 }); + const xdr = op.toXDR('hex'); + const operation = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); + + expect(operation.body().switch().name).to.equal('extendFootprintTtl'); + const obj = StellarBase.Operation.fromXDRObject(operation); + expect(obj.type).to.be.equal('extendFootprintTtl'); + expect(obj.extendTo).to.equal(1234); + + expect(() => { + StellarBase.Operation.extendFootprintTtl({ extendTo: 0 }); + }).to.throw(/ledger quantity/i); + }); + }); + + describe('.restoreFootprint()', function () { + it('creates operation', function () { + const op = Operation.restoreFootprint(); + const xdr = op.toXDR('hex'); + const operation = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); + + expect(operation.body().switch().name).to.equal('restoreFootprint'); + const obj = Operation.fromXDRObject(operation); + expect(obj.type).to.be.equal('restoreFootprint'); + }); + }); +}); diff --git a/test/unit/operations/invoke_host_function_test.js b/test/unit/operations/invoke_host_function_test.js new file mode 100644 index 00000000..492db309 --- /dev/null +++ b/test/unit/operations/invoke_host_function_test.js @@ -0,0 +1,133 @@ +const { Asset, Contract, Operation, hash } = StellarBase; + +describe('Operation', function () { + describe('.invokeHostFunction()', function () { + beforeEach(function () { + this.contractId = + 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; + this.c = new Contract(this.contractId); + }); + + it('creates operation', function () { + const op = Operation.invokeHostFunction({ + auth: [], + func: StellarBase.xdr.HostFunction.hostFunctionTypeInvokeContract( + new StellarBase.xdr.InvokeContractArgs({ + contractAddress: this.c.address().toScAddress(), + functionName: 'hello', + args: [StellarBase.nativeToScVal('world')] + }) + ) + }); + var xdr = op.toXDR('hex'); + var operation = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); + + expect(operation.body().switch().name).to.equal('invokeHostFunction'); + var obj = Operation.fromXDRObject(operation); + expect(obj.type).to.be.equal('invokeHostFunction'); + expect(obj.func.switch().name).to.equal('hostFunctionTypeInvokeContract'); + expect(obj.auth).to.deep.equal([]); + + expect( + Operation.invokeContractFunction({ + contract: this.contractId, + function: 'hello', + args: [StellarBase.nativeToScVal('world')] + }).toXDR('hex') + ).to.eql(xdr); + }); + + it('throws when no func passed', function () { + expect(() => Operation.invokeHostFunction({ auth: [] })).to.throw( + /\('func'\) required/ + ); + }); + + describe('abstractions', function () { + it('lets you create custom contracts', function () { + let op; + const h = hash(Buffer.from('random stuff')); + + op = Operation.createCustomContract({ + address: this.c.address(), + wasmHash: h, + salt: h + }); + expect(op.body().switch().name).to.equal('invokeHostFunction'); + + // round trip back + + const xdr = op.toXDR('hex'); + const xdrOp = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); + const decodedOp = Operation.fromXDRObject(xdrOp, 'hex'); + + expect(decodedOp.type).to.equal('invokeHostFunction'); + expect(decodedOp.func.switch().name).to.equal( + 'hostFunctionTypeCreateContract' + ); + expect( + // check deep inner field to ensure RT + decodedOp.func + .createContract() + .contractIdPreimage() + .fromAddress() + .salt() + ).to.eql(h); + expect(decodedOp.auth).to.be.empty; + }); + + describe('lets you wrap tokens', function () { + [ + 'USD:GCP2QKBFLLEEWYVKAIXIJIJNCZ6XEBIE4PCDB6BF3GUB6FGE2RQ3HDVP', + Asset.native(), + new Asset( + 'USD', + 'GCP2QKBFLLEEWYVKAIXIJIJNCZ6XEBIE4PCDB6BF3GUB6FGE2RQ3HDVP' + ) + ].forEach((asset) => { + it(`with asset ${asset.toString()}`, function () { + const op = Operation.createStellarAssetContract({ asset }); + expect(op.body().switch().name).to.equal('invokeHostFunction'); + + // round trip back + + const xdr = op.toXDR('hex'); + const xdrOp = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); + const decodedOp = Operation.fromXDRObject(xdrOp, 'hex'); + + expect(decodedOp.type).to.equal('invokeHostFunction'); + expect(decodedOp.func.switch().name).to.equal( + 'hostFunctionTypeCreateContract' + ); + expect( + // check deep inner field to ensure RT + Asset.fromOperation( + decodedOp.func.createContract().contractIdPreimage().fromAsset() + ).toString() + ).to.equal(asset.toString()); + expect(decodedOp.auth).to.be.empty; + }); + }); + }); + + it('lets you upload wasm', function () { + const wasm = Buffer.alloc(512); + const op = Operation.uploadContractWasm({ wasm }); + expect(op.body().switch().name).to.equal('invokeHostFunction'); + + // round trip back + + const xdr = op.toXDR('hex'); + const xdrOp = StellarBase.xdr.Operation.fromXDR(xdr, 'hex'); + const decodedOp = Operation.fromXDRObject(xdrOp, 'hex'); + + expect(decodedOp.type).to.equal('invokeHostFunction'); + expect(decodedOp.func.switch().name).to.equal( + 'hostFunctionTypeUploadContractWasm' + ); + expect(decodedOp.func.wasm()).to.eql(wasm); + expect(decodedOp.auth).to.be.empty; + }); + }); + }); +}); diff --git a/test/unit/soroban_test.js b/test/unit/soroban_test.js index c2726fc7..cf738fcb 100644 --- a/test/unit/soroban_test.js +++ b/test/unit/soroban_test.js @@ -13,12 +13,12 @@ describe('Soroban', function () { { amount: '1000000001.1', decimals: 7, - expected: /No decimal is allowed/ + expected: /No decimals are allowed/ }, { amount: '10000.00001.1', decimals: 4, - expected: /No decimal is allowed/ + expected: /No decimals are allowed/ } ]; diff --git a/test/unit/sorobandata_builder_test.js b/test/unit/sorobandata_builder_test.js index 96cb7ea3..aff86f6a 100644 --- a/test/unit/sorobandata_builder_test.js +++ b/test/unit/sorobandata_builder_test.js @@ -6,17 +6,17 @@ describe('SorobanTransactionData can be built', function () { const c = new StellarBase.Contract(contractId); const sentinel = new xdr.SorobanTransactionData({ + ext: new xdr.ExtensionPoint(0), resources: new xdr.SorobanResources({ footprint: new xdr.LedgerFootprint({ readOnly: [], readWrite: [] }), instructions: 1, readBytes: 2, writeBytes: 3 }), - ext: new xdr.ExtensionPoint(0), - refundableFee: new xdr.Int64(5) + resourceFee: new xdr.Int64(5) }); - const key = c.getFootprint()[0]; + const key = c.getFootprint(); // arbitrary key for testing it('constructs from xdr, base64, and nothing', function () { new dataBuilder(); @@ -35,7 +35,7 @@ describe('SorobanTransactionData can be built', function () { it('sets properties as expected', function () { expect( - new dataBuilder().setResources(1, 2, 3).setRefundableFee(5).build() + new dataBuilder().setResources(1, 2, 3).setResourceFee(5).build() ).to.eql(sentinel); // this isn't a valid param but we're just checking that setters work @@ -73,8 +73,8 @@ describe('SorobanTransactionData can be built', function () { it('makes copies on build()', function () { const builder = new dataBuilder(); const first = builder.build(); - const second = builder.setRefundableFee(100).build(); + const second = builder.setResourceFee(100).build(); - expect(first.refundableFee()).to.not.eql(second.refundableFee()); + expect(first.resourceFee()).to.not.eql(second.resourceFee()); }); }); diff --git a/test/unit/transaction_builder_test.js b/test/unit/transaction_builder_test.js index e069f49a..3c790c7a 100644 --- a/test/unit/transaction_builder_test.js +++ b/test/unit/transaction_builder_test.js @@ -73,7 +73,7 @@ describe('TransactionBuilder', function () { ); sorobanTransactionData = new StellarBase.SorobanDataBuilder() .setResources(0, 5, 0) - .setRefundableFee(1) + .setResourceFee(1) .build(); }); diff --git a/test/unit/transaction_test.js b/test/unit/transaction_test.js index 7f3c628b..5f1c351f 100644 --- a/test/unit/transaction_test.js +++ b/test/unit/transaction_test.js @@ -1,4 +1,4 @@ -import { UnsignedHyper } from 'js-xdr'; +import { UnsignedHyper } from '@stellar/js-xdr'; import randomBytes from 'randombytes'; describe('Transaction', function () { diff --git a/types/curr.d.ts b/types/curr.d.ts index 9941c15e..9aefb65d 100644 --- a/types/curr.d.ts +++ b/types/curr.d.ts @@ -1,4 +1,4 @@ -// Automatically generated on 2023-09-11T12:23:00-08:00 +// Automatically generated on 2023-10-16T10:48:00-08:00 import { Operation } from './index'; export {}; @@ -319,7 +319,7 @@ export namespace xdr { | 'contractData' | 'contractCode' | 'configSetting' - | 'expiration'; + | 'ttl'; readonly value: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; @@ -341,7 +341,7 @@ export namespace xdr { static configSetting(): LedgerEntryType; - static expiration(): LedgerEntryType; + static ttl(): LedgerEntryType; } class AccountFlags { @@ -748,7 +748,7 @@ export namespace xdr { | 'liquidityPoolDeposit' | 'liquidityPoolWithdraw' | 'invokeHostFunction' - | 'bumpFootprintExpiration' + | 'extendFootprintTtl' | 'restoreFootprint'; readonly value: @@ -830,7 +830,7 @@ export namespace xdr { static invokeHostFunction(): OperationType; - static bumpFootprintExpiration(): OperationType; + static extendFootprintTtl(): OperationType; static restoreFootprint(): OperationType; } @@ -1643,7 +1643,7 @@ export namespace xdr { | 'invokeHostFunctionMalformed' | 'invokeHostFunctionTrapped' | 'invokeHostFunctionResourceLimitExceeded' - | 'invokeHostFunctionEntryExpired' + | 'invokeHostFunctionEntryArchived' | 'invokeHostFunctionInsufficientRefundableFee'; readonly value: 0 | -1 | -2 | -3 | -4 | -5; @@ -1656,27 +1656,27 @@ export namespace xdr { static invokeHostFunctionResourceLimitExceeded(): InvokeHostFunctionResultCode; - static invokeHostFunctionEntryExpired(): InvokeHostFunctionResultCode; + static invokeHostFunctionEntryArchived(): InvokeHostFunctionResultCode; static invokeHostFunctionInsufficientRefundableFee(): InvokeHostFunctionResultCode; } - class BumpFootprintExpirationResultCode { + class ExtendFootprintTtlResultCode { readonly name: - | 'bumpFootprintExpirationSuccess' - | 'bumpFootprintExpirationMalformed' - | 'bumpFootprintExpirationResourceLimitExceeded' - | 'bumpFootprintExpirationInsufficientRefundableFee'; + | 'extendFootprintTtlSuccess' + | 'extendFootprintTtlMalformed' + | 'extendFootprintTtlResourceLimitExceeded' + | 'extendFootprintTtlInsufficientRefundableFee'; readonly value: 0 | -1 | -2 | -3; - static bumpFootprintExpirationSuccess(): BumpFootprintExpirationResultCode; + static extendFootprintTtlSuccess(): ExtendFootprintTtlResultCode; - static bumpFootprintExpirationMalformed(): BumpFootprintExpirationResultCode; + static extendFootprintTtlMalformed(): ExtendFootprintTtlResultCode; - static bumpFootprintExpirationResourceLimitExceeded(): BumpFootprintExpirationResultCode; + static extendFootprintTtlResourceLimitExceeded(): ExtendFootprintTtlResultCode; - static bumpFootprintExpirationInsufficientRefundableFee(): BumpFootprintExpirationResultCode; + static extendFootprintTtlInsufficientRefundableFee(): ExtendFootprintTtlResultCode; } class RestoreFootprintResultCode { @@ -2020,13 +2020,13 @@ export namespace xdr { } class ContractExecutableType { - readonly name: 'contractExecutableWasm' | 'contractExecutableToken'; + readonly name: 'contractExecutableWasm' | 'contractExecutableStellarAsset'; readonly value: 0 | 1; static contractExecutableWasm(): ContractExecutableType; - static contractExecutableToken(): ContractExecutableType; + static contractExecutableStellarAsset(): ContractExecutableType; } class ScAddressType { @@ -2195,33 +2195,28 @@ export namespace xdr { class ContractCostType { readonly name: | 'wasmInsnExec' - | 'wasmMemAlloc' - | 'hostMemAlloc' - | 'hostMemCpy' - | 'hostMemCmp' + | 'memAlloc' + | 'memCpy' + | 'memCmp' | 'dispatchHostFunction' | 'visitObject' | 'valSer' | 'valDeser' | 'computeSha256Hash' | 'computeEd25519PubKey' - | 'mapEntry' - | 'vecEntry' | 'verifyEd25519Sig' - | 'vmMemRead' - | 'vmMemWrite' | 'vmInstantiation' | 'vmCachedInstantiation' | 'invokeVmFunction' | 'computeKeccak256Hash' - | 'computeEcdsaSecp256k1Key' | 'computeEcdsaSecp256k1Sig' | 'recoverEcdsaSecp256k1Key' | 'int256AddSub' | 'int256Mul' | 'int256Div' | 'int256Pow' - | 'int256Shift'; + | 'int256Shift' + | 'chaCha20DrawBytes'; readonly value: | 0 @@ -2246,22 +2241,15 @@ export namespace xdr { | 19 | 20 | 21 - | 22 - | 23 - | 24 - | 25 - | 26 - | 27; + | 22; static wasmInsnExec(): ContractCostType; - static wasmMemAlloc(): ContractCostType; - - static hostMemAlloc(): ContractCostType; + static memAlloc(): ContractCostType; - static hostMemCpy(): ContractCostType; + static memCpy(): ContractCostType; - static hostMemCmp(): ContractCostType; + static memCmp(): ContractCostType; static dispatchHostFunction(): ContractCostType; @@ -2275,16 +2263,8 @@ export namespace xdr { static computeEd25519PubKey(): ContractCostType; - static mapEntry(): ContractCostType; - - static vecEntry(): ContractCostType; - static verifyEd25519Sig(): ContractCostType; - static vmMemRead(): ContractCostType; - - static vmMemWrite(): ContractCostType; - static vmInstantiation(): ContractCostType; static vmCachedInstantiation(): ContractCostType; @@ -2293,8 +2273,6 @@ export namespace xdr { static computeKeccak256Hash(): ContractCostType; - static computeEcdsaSecp256k1Key(): ContractCostType; - static computeEcdsaSecp256k1Sig(): ContractCostType; static recoverEcdsaSecp256k1Key(): ContractCostType; @@ -2308,6 +2286,8 @@ export namespace xdr { static int256Pow(): ContractCostType; static int256Shift(): ContractCostType; + + static chaCha20DrawBytes(): ContractCostType; } class ConfigSettingId { @@ -2322,7 +2302,7 @@ export namespace xdr { | 'configSettingContractCostParamsMemoryBytes' | 'configSettingContractDataKeySizeBytes' | 'configSettingContractDataEntrySizeBytes' - | 'configSettingStateExpiration' + | 'configSettingStateArchival' | 'configSettingContractExecutionLanes' | 'configSettingBucketlistSizeWindow' | 'configSettingEvictionIterator'; @@ -2349,7 +2329,7 @@ export namespace xdr { static configSettingContractDataEntrySizeBytes(): ConfigSettingId; - static configSettingStateExpiration(): ConfigSettingId; + static configSettingStateArchival(): ConfigSettingId; static configSettingContractExecutionLanes(): ConfigSettingId; @@ -3517,28 +3497,28 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class ExpirationEntry { - constructor(attributes: { keyHash: Buffer; expirationLedgerSeq: number }); + class TtlEntry { + constructor(attributes: { keyHash: Buffer; liveUntilLedgerSeq: number }); keyHash(value?: Buffer): Buffer; - expirationLedgerSeq(value?: number): number; + liveUntilLedgerSeq(value?: number): number; toXDR(format?: 'raw'): Buffer; toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): ExpirationEntry; + static read(io: Buffer): TtlEntry; - static write(value: ExpirationEntry, io: Buffer): void; + static write(value: TtlEntry, io: Buffer): void; - static isValid(value: ExpirationEntry): boolean; + static isValid(value: TtlEntry): boolean; - static toXDR(value: ExpirationEntry): Buffer; + static toXDR(value: TtlEntry): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): ExpirationEntry; + static fromXDR(input: Buffer, format?: 'raw'): TtlEntry; - static fromXDR(input: string, format: 'hex' | 'base64'): ExpirationEntry; + static fromXDR(input: string, format: 'hex' | 'base64'): TtlEntry; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -3879,7 +3859,7 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class LedgerKeyExpiration { + class LedgerKeyTtl { constructor(attributes: { keyHash: Buffer }); keyHash(value?: Buffer): Buffer; @@ -3888,20 +3868,17 @@ export namespace xdr { toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): LedgerKeyExpiration; + static read(io: Buffer): LedgerKeyTtl; - static write(value: LedgerKeyExpiration, io: Buffer): void; + static write(value: LedgerKeyTtl, io: Buffer): void; - static isValid(value: LedgerKeyExpiration): boolean; + static isValid(value: LedgerKeyTtl): boolean; - static toXDR(value: LedgerKeyExpiration): Buffer; + static toXDR(value: LedgerKeyTtl): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): LedgerKeyExpiration; + static fromXDR(input: Buffer, format?: 'raw'): LedgerKeyTtl; - static fromXDR( - input: string, - format: 'hex' | 'base64', - ): LedgerKeyExpiration; + static fromXDR(input: string, format: 'hex' | 'base64'): LedgerKeyTtl; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -4911,46 +4888,6 @@ export namespace xdr { } class LedgerCloseMetaV1 { - constructor(attributes: { - ledgerHeader: LedgerHeaderHistoryEntry; - txSet: GeneralizedTransactionSet; - txProcessing: TransactionResultMeta[]; - upgradesProcessing: UpgradeEntryMeta[]; - scpInfo: ScpHistoryEntry[]; - }); - - ledgerHeader(value?: LedgerHeaderHistoryEntry): LedgerHeaderHistoryEntry; - - txSet(value?: GeneralizedTransactionSet): GeneralizedTransactionSet; - - txProcessing(value?: TransactionResultMeta[]): TransactionResultMeta[]; - - upgradesProcessing(value?: UpgradeEntryMeta[]): UpgradeEntryMeta[]; - - scpInfo(value?: ScpHistoryEntry[]): ScpHistoryEntry[]; - - toXDR(format?: 'raw'): Buffer; - - toXDR(format: 'hex' | 'base64'): string; - - static read(io: Buffer): LedgerCloseMetaV1; - - static write(value: LedgerCloseMetaV1, io: Buffer): void; - - static isValid(value: LedgerCloseMetaV1): boolean; - - static toXDR(value: LedgerCloseMetaV1): Buffer; - - static fromXDR(input: Buffer, format?: 'raw'): LedgerCloseMetaV1; - - static fromXDR(input: string, format: 'hex' | 'base64'): LedgerCloseMetaV1; - - static validateXDR(input: Buffer, format?: 'raw'): boolean; - - static validateXDR(input: string, format: 'hex' | 'base64'): boolean; - } - - class LedgerCloseMetaV2 { constructor(attributes: { ext: ExtensionPoint; ledgerHeader: LedgerHeaderHistoryEntry; @@ -4985,17 +4922,17 @@ export namespace xdr { toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): LedgerCloseMetaV2; + static read(io: Buffer): LedgerCloseMetaV1; - static write(value: LedgerCloseMetaV2, io: Buffer): void; + static write(value: LedgerCloseMetaV1, io: Buffer): void; - static isValid(value: LedgerCloseMetaV2): boolean; + static isValid(value: LedgerCloseMetaV1): boolean; - static toXDR(value: LedgerCloseMetaV2): Buffer; + static toXDR(value: LedgerCloseMetaV1): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): LedgerCloseMetaV2; + static fromXDR(input: Buffer, format?: 'raw'): LedgerCloseMetaV1; - static fromXDR(input: string, format: 'hex' | 'base64'): LedgerCloseMetaV2; + static fromXDR(input: string, format: 'hex' | 'base64'): LedgerCloseMetaV1; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -6721,31 +6658,31 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class BumpFootprintExpirationOp { - constructor(attributes: { ext: ExtensionPoint; ledgersToExpire: number }); + class ExtendFootprintTtlOp { + constructor(attributes: { ext: ExtensionPoint; extendTo: number }); ext(value?: ExtensionPoint): ExtensionPoint; - ledgersToExpire(value?: number): number; + extendTo(value?: number): number; toXDR(format?: 'raw'): Buffer; toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): BumpFootprintExpirationOp; + static read(io: Buffer): ExtendFootprintTtlOp; - static write(value: BumpFootprintExpirationOp, io: Buffer): void; + static write(value: ExtendFootprintTtlOp, io: Buffer): void; - static isValid(value: BumpFootprintExpirationOp): boolean; + static isValid(value: ExtendFootprintTtlOp): boolean; - static toXDR(value: BumpFootprintExpirationOp): Buffer; + static toXDR(value: ExtendFootprintTtlOp): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): BumpFootprintExpirationOp; + static fromXDR(input: Buffer, format?: 'raw'): ExtendFootprintTtlOp; static fromXDR( input: string, format: 'hex' | 'base64', - ): BumpFootprintExpirationOp; + ): ExtendFootprintTtlOp; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -7105,14 +7042,14 @@ export namespace xdr { constructor(attributes: { ext: ExtensionPoint; resources: SorobanResources; - refundableFee: Int64; + resourceFee: Int64; }); ext(value?: ExtensionPoint): ExtensionPoint; resources(value?: SorobanResources): SorobanResources; - refundableFee(value?: Int64): Int64; + resourceFee(value?: Int64): Int64; toXDR(format?: 'raw'): Buffer; @@ -9086,30 +9023,30 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class StateExpirationSettings { + class StateArchivalSettings { constructor(attributes: { - maxEntryExpiration: number; - minTempEntryExpiration: number; - minPersistentEntryExpiration: number; + maxEntryTtl: number; + minTemporaryTtl: number; + minPersistentTtl: number; persistentRentRateDenominator: Int64; tempRentRateDenominator: Int64; - maxEntriesToExpire: number; + maxEntriesToArchive: number; bucketListSizeWindowSampleSize: number; evictionScanSize: Uint64; startingEvictionScanLevel: number; }); - maxEntryExpiration(value?: number): number; + maxEntryTtl(value?: number): number; - minTempEntryExpiration(value?: number): number; + minTemporaryTtl(value?: number): number; - minPersistentEntryExpiration(value?: number): number; + minPersistentTtl(value?: number): number; persistentRentRateDenominator(value?: Int64): Int64; tempRentRateDenominator(value?: Int64): Int64; - maxEntriesToExpire(value?: number): number; + maxEntriesToArchive(value?: number): number; bucketListSizeWindowSampleSize(value?: number): number; @@ -9121,20 +9058,20 @@ export namespace xdr { toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): StateExpirationSettings; + static read(io: Buffer): StateArchivalSettings; - static write(value: StateExpirationSettings, io: Buffer): void; + static write(value: StateArchivalSettings, io: Buffer): void; - static isValid(value: StateExpirationSettings): boolean; + static isValid(value: StateArchivalSettings): boolean; - static toXDR(value: StateExpirationSettings): Buffer; + static toXDR(value: StateArchivalSettings): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): StateExpirationSettings; + static fromXDR(input: Buffer, format?: 'raw'): StateArchivalSettings; static fromXDR( input: string, format: 'hex' | 'base64', - ): StateExpirationSettings; + ): StateArchivalSettings; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -9867,7 +9804,7 @@ export namespace xdr { configSetting(value?: ConfigSettingEntry): ConfigSettingEntry; - expiration(value?: ExpirationEntry): ExpirationEntry; + ttl(value?: TtlEntry): TtlEntry; static account(value: AccountEntry): LedgerEntryData; @@ -9887,7 +9824,7 @@ export namespace xdr { static configSetting(value: ConfigSettingEntry): LedgerEntryData; - static expiration(value: ExpirationEntry): LedgerEntryData; + static ttl(value: TtlEntry): LedgerEntryData; value(): | AccountEntry @@ -9899,7 +9836,7 @@ export namespace xdr { | ContractDataEntry | ContractCodeEntry | ConfigSettingEntry - | ExpirationEntry; + | TtlEntry; toXDR(format?: 'raw'): Buffer; @@ -9977,7 +9914,7 @@ export namespace xdr { configSetting(value?: LedgerKeyConfigSetting): LedgerKeyConfigSetting; - expiration(value?: LedgerKeyExpiration): LedgerKeyExpiration; + ttl(value?: LedgerKeyTtl): LedgerKeyTtl; static account(value: LedgerKeyAccount): LedgerKey; @@ -9997,7 +9934,7 @@ export namespace xdr { static configSetting(value: LedgerKeyConfigSetting): LedgerKey; - static expiration(value: LedgerKeyExpiration): LedgerKey; + static ttl(value: LedgerKeyTtl): LedgerKey; value(): | LedgerKeyAccount @@ -10009,7 +9946,7 @@ export namespace xdr { | LedgerKeyContractData | LedgerKeyContractCode | LedgerKeyConfigSetting - | LedgerKeyExpiration; + | LedgerKeyTtl; toXDR(format?: 'raw'): Buffer; @@ -10614,15 +10551,11 @@ export namespace xdr { v1(value?: LedgerCloseMetaV1): LedgerCloseMetaV1; - v2(value?: LedgerCloseMetaV2): LedgerCloseMetaV2; - static 0(value: LedgerCloseMetaV0): LedgerCloseMeta; static 1(value: LedgerCloseMetaV1): LedgerCloseMeta; - static 2(value: LedgerCloseMetaV2): LedgerCloseMeta; - - value(): LedgerCloseMetaV0 | LedgerCloseMetaV1 | LedgerCloseMetaV2; + value(): LedgerCloseMetaV0 | LedgerCloseMetaV1; toXDR(format?: 'raw'): Buffer; @@ -11256,9 +11189,7 @@ export namespace xdr { invokeHostFunctionOp(value?: InvokeHostFunctionOp): InvokeHostFunctionOp; - bumpFootprintExpirationOp( - value?: BumpFootprintExpirationOp, - ): BumpFootprintExpirationOp; + extendFootprintTtlOp(value?: ExtendFootprintTtlOp): ExtendFootprintTtlOp; restoreFootprintOp(value?: RestoreFootprintOp): RestoreFootprintOp; @@ -11322,9 +11253,7 @@ export namespace xdr { static invokeHostFunction(value: InvokeHostFunctionOp): OperationBody; - static bumpFootprintExpiration( - value: BumpFootprintExpirationOp, - ): OperationBody; + static extendFootprintTtl(value: ExtendFootprintTtlOp): OperationBody; static restoreFootprint(value: RestoreFootprintOp): OperationBody; @@ -11352,7 +11281,7 @@ export namespace xdr { | LiquidityPoolDepositOp | LiquidityPoolWithdrawOp | InvokeHostFunctionOp - | BumpFootprintExpirationOp + | ExtendFootprintTtlOp | RestoreFootprintOp | void; @@ -12839,7 +12768,7 @@ export namespace xdr { static invokeHostFunctionResourceLimitExceeded(): InvokeHostFunctionResult; - static invokeHostFunctionEntryExpired(): InvokeHostFunctionResult; + static invokeHostFunctionEntryArchived(): InvokeHostFunctionResult; static invokeHostFunctionInsufficientRefundableFee(): InvokeHostFunctionResult; @@ -12869,16 +12798,16 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class BumpFootprintExpirationResult { - switch(): BumpFootprintExpirationResultCode; + class ExtendFootprintTtlResult { + switch(): ExtendFootprintTtlResultCode; - static bumpFootprintExpirationSuccess(): BumpFootprintExpirationResult; + static extendFootprintTtlSuccess(): ExtendFootprintTtlResult; - static bumpFootprintExpirationMalformed(): BumpFootprintExpirationResult; + static extendFootprintTtlMalformed(): ExtendFootprintTtlResult; - static bumpFootprintExpirationResourceLimitExceeded(): BumpFootprintExpirationResult; + static extendFootprintTtlResourceLimitExceeded(): ExtendFootprintTtlResult; - static bumpFootprintExpirationInsufficientRefundableFee(): BumpFootprintExpirationResult; + static extendFootprintTtlInsufficientRefundableFee(): ExtendFootprintTtlResult; value(): void; @@ -12886,23 +12815,20 @@ export namespace xdr { toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): BumpFootprintExpirationResult; + static read(io: Buffer): ExtendFootprintTtlResult; - static write(value: BumpFootprintExpirationResult, io: Buffer): void; + static write(value: ExtendFootprintTtlResult, io: Buffer): void; - static isValid(value: BumpFootprintExpirationResult): boolean; + static isValid(value: ExtendFootprintTtlResult): boolean; - static toXDR(value: BumpFootprintExpirationResult): Buffer; + static toXDR(value: ExtendFootprintTtlResult): Buffer; - static fromXDR( - input: Buffer, - format?: 'raw', - ): BumpFootprintExpirationResult; + static fromXDR(input: Buffer, format?: 'raw'): ExtendFootprintTtlResult; static fromXDR( input: string, format: 'hex' | 'base64', - ): BumpFootprintExpirationResult; + ): ExtendFootprintTtlResult; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -13025,9 +12951,9 @@ export namespace xdr { value?: InvokeHostFunctionResult, ): InvokeHostFunctionResult; - bumpFootprintExpirationResult( - value?: BumpFootprintExpirationResult, - ): BumpFootprintExpirationResult; + extendFootprintTtlResult( + value?: ExtendFootprintTtlResult, + ): ExtendFootprintTtlResult; restoreFootprintResult( value?: RestoreFootprintResult, @@ -13105,8 +13031,8 @@ export namespace xdr { value: InvokeHostFunctionResult, ): OperationResultTr; - static bumpFootprintExpiration( - value: BumpFootprintExpirationResult, + static extendFootprintTtl( + value: ExtendFootprintTtlResult, ): OperationResultTr; static restoreFootprint(value: RestoreFootprintResult): OperationResultTr; @@ -13137,7 +13063,7 @@ export namespace xdr { | LiquidityPoolDepositResult | LiquidityPoolWithdrawResult | InvokeHostFunctionResult - | BumpFootprintExpirationResult + | ExtendFootprintTtlResult | RestoreFootprintResult; toXDR(format?: 'raw'): Buffer; @@ -13568,7 +13494,7 @@ export namespace xdr { static contractExecutableWasm(value: Buffer): ContractExecutable; - static contractExecutableToken(): ContractExecutable; + static contractExecutableStellarAsset(): ContractExecutable; value(): Buffer | void; @@ -14049,9 +13975,7 @@ export namespace xdr { contractDataEntrySizeBytes(value?: number): number; - stateExpirationSettings( - value?: StateExpirationSettings, - ): StateExpirationSettings; + stateArchivalSettings(value?: StateArchivalSettings): StateArchivalSettings; contractExecutionLanes( value?: ConfigSettingContractExecutionLanesV0, @@ -14099,8 +14023,8 @@ export namespace xdr { value: number, ): ConfigSettingEntry; - static configSettingStateExpiration( - value: StateExpirationSettings, + static configSettingStateArchival( + value: StateArchivalSettings, ): ConfigSettingEntry; static configSettingContractExecutionLanes( @@ -14126,7 +14050,7 @@ export namespace xdr { | ContractCostParamEntry[] | number | number - | StateExpirationSettings + | StateArchivalSettings | ConfigSettingContractExecutionLanesV0 | Uint64[] | EvictionIterator; diff --git a/types/index.d.ts b/types/index.d.ts index d9d858c9..41d383d5 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -30,7 +30,7 @@ export class Contract { call(method: string, ...params: xdr.ScVal[]): xdr.Operation; contractId(): string; address(): Address; - getFootprint(): xdr.LedgerKey[]; + getFootprint(): xdr.LedgerKey; toString(): string; } @@ -369,7 +369,7 @@ export namespace OperationType { type LiquidityPoolDeposit = 'liquidityPoolDeposit'; type LiquidityPoolWithdraw = 'liquidityPoolWithdraw'; type InvokeHostFunction = 'invokeHostFunction'; - type BumpFootprintExpiration = 'bumpFootprintExpiration'; + type ExtendFootprintTTL = 'extendFootprintTtl'; type RestoreFootprint = 'restoreFootprint'; } export type OperationType = @@ -398,7 +398,7 @@ export type OperationType = | OperationType.LiquidityPoolDeposit | OperationType.LiquidityPoolWithdraw | OperationType.InvokeHostFunction - | OperationType.BumpFootprintExpiration + | OperationType.ExtendFootprintTTL | OperationType.RestoreFootprint; export namespace OperationOptions { @@ -546,12 +546,32 @@ export namespace OperationOptions { minAmountA: string; minAmountB: string; } - interface InvokeHostFunction extends BaseOptions { + + interface BaseInvocationOptions extends BaseOptions { + auth?: xdr.SorobanAuthorizationEntry[]; + } + interface InvokeHostFunction extends BaseInvocationOptions { func: xdr.HostFunction; - auth: xdr.SorobanAuthorizationEntry[]; } - interface BumpFootprintExpiration extends BaseOptions { - ledgersToExpire: number; + interface InvokeContractFunction extends BaseInvocationOptions { + contract: string; + function: string; + args: xdr.ScVal[]; + } + interface CreateCustomContract extends BaseInvocationOptions { + address: Address; + wasmHash: Buffer | Uint8Array; + salt?: Buffer | Uint8Array; + } + interface CreateStellarAssetContract extends BaseOptions { + asset: Asset | string; + } + interface UploadContractWasm extends BaseOptions { + wasm: Buffer | Uint8Array; + } + + interface ExtendFootprintTTL extends BaseOptions { + extendTo: number; } type RestoreFootprint = BaseOptions; } @@ -586,8 +606,12 @@ export type OperationOptions = | OperationOptions.LiquidityPoolDeposit | OperationOptions.LiquidityPoolWithdraw | OperationOptions.InvokeHostFunction - | OperationOptions.BumpFootprintExpiration - | OperationOptions.RestoreFootprint; + | OperationOptions.ExtendFootprintTTL + | OperationOptions.RestoreFootprint + | OperationOptions.CreateCustomContract + | OperationOptions.CreateStellarAssetContract + | OperationOptions.InvokeContractFunction + | OperationOptions.UploadContractWasm; export namespace Operation { interface BaseOperation { @@ -876,17 +900,30 @@ export namespace Operation { options: OperationOptions.InvokeHostFunction ): xdr.Operation; - function bumpFootprintExpiration( - options: OperationOptions.BumpFootprintExpiration - ): xdr.Operation; - interface BumpFootprintExpiration extends BaseOperation { - ledgersToExpire: number; + function extendFootprintTtl( + options: OperationOptions.ExtendFootprintTTL + ): xdr.Operation; + interface ExtendFootprintTTL extends BaseOperation { + extendTo: number; } function restoreFootprint(options: OperationOptions.RestoreFootprint): xdr.Operation; interface RestoreFootprint extends BaseOperation {} + function createCustomContract( + opts: OperationOptions.CreateCustomContract + ): xdr.Operation; + function createStellarAssetContract( + opts: OperationOptions.CreateStellarAssetContract + ): xdr.Operation; + function invokeContractFunction( + opts: OperationOptions.InvokeContractFunction + ): xdr.Operation; + function uploadContractWasm( + opts: OperationOptions.UploadContractWasm + ): xdr.Operation; + function fromXDRObject( xdrOperation: xdr.Operation ): T; @@ -923,7 +960,7 @@ export type Operation = | Operation.LiquidityPoolDeposit | Operation.LiquidityPoolWithdraw | Operation.InvokeHostFunction - | Operation.BumpFootprintExpiration + | Operation.ExtendFootprintTTL | Operation.RestoreFootprint; export namespace StrKey { @@ -1145,7 +1182,7 @@ export class SorobanDataBuilder { constructor(data?: string | Uint8Array | Buffer | xdr.SorobanTransactionData); static fromXDR(data: Uint8Array | Buffer | string): SorobanDataBuilder; - setRefundableFee(fee: IntLike): SorobanDataBuilder; + setResourceFee(fee: IntLike): SorobanDataBuilder; setResources( cpuInstrs: number, readBytes: number, diff --git a/types/next.d.ts b/types/next.d.ts index 9941c15e..9aefb65d 100644 --- a/types/next.d.ts +++ b/types/next.d.ts @@ -1,4 +1,4 @@ -// Automatically generated on 2023-09-11T12:23:00-08:00 +// Automatically generated on 2023-10-16T10:48:00-08:00 import { Operation } from './index'; export {}; @@ -319,7 +319,7 @@ export namespace xdr { | 'contractData' | 'contractCode' | 'configSetting' - | 'expiration'; + | 'ttl'; readonly value: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; @@ -341,7 +341,7 @@ export namespace xdr { static configSetting(): LedgerEntryType; - static expiration(): LedgerEntryType; + static ttl(): LedgerEntryType; } class AccountFlags { @@ -748,7 +748,7 @@ export namespace xdr { | 'liquidityPoolDeposit' | 'liquidityPoolWithdraw' | 'invokeHostFunction' - | 'bumpFootprintExpiration' + | 'extendFootprintTtl' | 'restoreFootprint'; readonly value: @@ -830,7 +830,7 @@ export namespace xdr { static invokeHostFunction(): OperationType; - static bumpFootprintExpiration(): OperationType; + static extendFootprintTtl(): OperationType; static restoreFootprint(): OperationType; } @@ -1643,7 +1643,7 @@ export namespace xdr { | 'invokeHostFunctionMalformed' | 'invokeHostFunctionTrapped' | 'invokeHostFunctionResourceLimitExceeded' - | 'invokeHostFunctionEntryExpired' + | 'invokeHostFunctionEntryArchived' | 'invokeHostFunctionInsufficientRefundableFee'; readonly value: 0 | -1 | -2 | -3 | -4 | -5; @@ -1656,27 +1656,27 @@ export namespace xdr { static invokeHostFunctionResourceLimitExceeded(): InvokeHostFunctionResultCode; - static invokeHostFunctionEntryExpired(): InvokeHostFunctionResultCode; + static invokeHostFunctionEntryArchived(): InvokeHostFunctionResultCode; static invokeHostFunctionInsufficientRefundableFee(): InvokeHostFunctionResultCode; } - class BumpFootprintExpirationResultCode { + class ExtendFootprintTtlResultCode { readonly name: - | 'bumpFootprintExpirationSuccess' - | 'bumpFootprintExpirationMalformed' - | 'bumpFootprintExpirationResourceLimitExceeded' - | 'bumpFootprintExpirationInsufficientRefundableFee'; + | 'extendFootprintTtlSuccess' + | 'extendFootprintTtlMalformed' + | 'extendFootprintTtlResourceLimitExceeded' + | 'extendFootprintTtlInsufficientRefundableFee'; readonly value: 0 | -1 | -2 | -3; - static bumpFootprintExpirationSuccess(): BumpFootprintExpirationResultCode; + static extendFootprintTtlSuccess(): ExtendFootprintTtlResultCode; - static bumpFootprintExpirationMalformed(): BumpFootprintExpirationResultCode; + static extendFootprintTtlMalformed(): ExtendFootprintTtlResultCode; - static bumpFootprintExpirationResourceLimitExceeded(): BumpFootprintExpirationResultCode; + static extendFootprintTtlResourceLimitExceeded(): ExtendFootprintTtlResultCode; - static bumpFootprintExpirationInsufficientRefundableFee(): BumpFootprintExpirationResultCode; + static extendFootprintTtlInsufficientRefundableFee(): ExtendFootprintTtlResultCode; } class RestoreFootprintResultCode { @@ -2020,13 +2020,13 @@ export namespace xdr { } class ContractExecutableType { - readonly name: 'contractExecutableWasm' | 'contractExecutableToken'; + readonly name: 'contractExecutableWasm' | 'contractExecutableStellarAsset'; readonly value: 0 | 1; static contractExecutableWasm(): ContractExecutableType; - static contractExecutableToken(): ContractExecutableType; + static contractExecutableStellarAsset(): ContractExecutableType; } class ScAddressType { @@ -2195,33 +2195,28 @@ export namespace xdr { class ContractCostType { readonly name: | 'wasmInsnExec' - | 'wasmMemAlloc' - | 'hostMemAlloc' - | 'hostMemCpy' - | 'hostMemCmp' + | 'memAlloc' + | 'memCpy' + | 'memCmp' | 'dispatchHostFunction' | 'visitObject' | 'valSer' | 'valDeser' | 'computeSha256Hash' | 'computeEd25519PubKey' - | 'mapEntry' - | 'vecEntry' | 'verifyEd25519Sig' - | 'vmMemRead' - | 'vmMemWrite' | 'vmInstantiation' | 'vmCachedInstantiation' | 'invokeVmFunction' | 'computeKeccak256Hash' - | 'computeEcdsaSecp256k1Key' | 'computeEcdsaSecp256k1Sig' | 'recoverEcdsaSecp256k1Key' | 'int256AddSub' | 'int256Mul' | 'int256Div' | 'int256Pow' - | 'int256Shift'; + | 'int256Shift' + | 'chaCha20DrawBytes'; readonly value: | 0 @@ -2246,22 +2241,15 @@ export namespace xdr { | 19 | 20 | 21 - | 22 - | 23 - | 24 - | 25 - | 26 - | 27; + | 22; static wasmInsnExec(): ContractCostType; - static wasmMemAlloc(): ContractCostType; - - static hostMemAlloc(): ContractCostType; + static memAlloc(): ContractCostType; - static hostMemCpy(): ContractCostType; + static memCpy(): ContractCostType; - static hostMemCmp(): ContractCostType; + static memCmp(): ContractCostType; static dispatchHostFunction(): ContractCostType; @@ -2275,16 +2263,8 @@ export namespace xdr { static computeEd25519PubKey(): ContractCostType; - static mapEntry(): ContractCostType; - - static vecEntry(): ContractCostType; - static verifyEd25519Sig(): ContractCostType; - static vmMemRead(): ContractCostType; - - static vmMemWrite(): ContractCostType; - static vmInstantiation(): ContractCostType; static vmCachedInstantiation(): ContractCostType; @@ -2293,8 +2273,6 @@ export namespace xdr { static computeKeccak256Hash(): ContractCostType; - static computeEcdsaSecp256k1Key(): ContractCostType; - static computeEcdsaSecp256k1Sig(): ContractCostType; static recoverEcdsaSecp256k1Key(): ContractCostType; @@ -2308,6 +2286,8 @@ export namespace xdr { static int256Pow(): ContractCostType; static int256Shift(): ContractCostType; + + static chaCha20DrawBytes(): ContractCostType; } class ConfigSettingId { @@ -2322,7 +2302,7 @@ export namespace xdr { | 'configSettingContractCostParamsMemoryBytes' | 'configSettingContractDataKeySizeBytes' | 'configSettingContractDataEntrySizeBytes' - | 'configSettingStateExpiration' + | 'configSettingStateArchival' | 'configSettingContractExecutionLanes' | 'configSettingBucketlistSizeWindow' | 'configSettingEvictionIterator'; @@ -2349,7 +2329,7 @@ export namespace xdr { static configSettingContractDataEntrySizeBytes(): ConfigSettingId; - static configSettingStateExpiration(): ConfigSettingId; + static configSettingStateArchival(): ConfigSettingId; static configSettingContractExecutionLanes(): ConfigSettingId; @@ -3517,28 +3497,28 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class ExpirationEntry { - constructor(attributes: { keyHash: Buffer; expirationLedgerSeq: number }); + class TtlEntry { + constructor(attributes: { keyHash: Buffer; liveUntilLedgerSeq: number }); keyHash(value?: Buffer): Buffer; - expirationLedgerSeq(value?: number): number; + liveUntilLedgerSeq(value?: number): number; toXDR(format?: 'raw'): Buffer; toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): ExpirationEntry; + static read(io: Buffer): TtlEntry; - static write(value: ExpirationEntry, io: Buffer): void; + static write(value: TtlEntry, io: Buffer): void; - static isValid(value: ExpirationEntry): boolean; + static isValid(value: TtlEntry): boolean; - static toXDR(value: ExpirationEntry): Buffer; + static toXDR(value: TtlEntry): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): ExpirationEntry; + static fromXDR(input: Buffer, format?: 'raw'): TtlEntry; - static fromXDR(input: string, format: 'hex' | 'base64'): ExpirationEntry; + static fromXDR(input: string, format: 'hex' | 'base64'): TtlEntry; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -3879,7 +3859,7 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class LedgerKeyExpiration { + class LedgerKeyTtl { constructor(attributes: { keyHash: Buffer }); keyHash(value?: Buffer): Buffer; @@ -3888,20 +3868,17 @@ export namespace xdr { toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): LedgerKeyExpiration; + static read(io: Buffer): LedgerKeyTtl; - static write(value: LedgerKeyExpiration, io: Buffer): void; + static write(value: LedgerKeyTtl, io: Buffer): void; - static isValid(value: LedgerKeyExpiration): boolean; + static isValid(value: LedgerKeyTtl): boolean; - static toXDR(value: LedgerKeyExpiration): Buffer; + static toXDR(value: LedgerKeyTtl): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): LedgerKeyExpiration; + static fromXDR(input: Buffer, format?: 'raw'): LedgerKeyTtl; - static fromXDR( - input: string, - format: 'hex' | 'base64', - ): LedgerKeyExpiration; + static fromXDR(input: string, format: 'hex' | 'base64'): LedgerKeyTtl; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -4911,46 +4888,6 @@ export namespace xdr { } class LedgerCloseMetaV1 { - constructor(attributes: { - ledgerHeader: LedgerHeaderHistoryEntry; - txSet: GeneralizedTransactionSet; - txProcessing: TransactionResultMeta[]; - upgradesProcessing: UpgradeEntryMeta[]; - scpInfo: ScpHistoryEntry[]; - }); - - ledgerHeader(value?: LedgerHeaderHistoryEntry): LedgerHeaderHistoryEntry; - - txSet(value?: GeneralizedTransactionSet): GeneralizedTransactionSet; - - txProcessing(value?: TransactionResultMeta[]): TransactionResultMeta[]; - - upgradesProcessing(value?: UpgradeEntryMeta[]): UpgradeEntryMeta[]; - - scpInfo(value?: ScpHistoryEntry[]): ScpHistoryEntry[]; - - toXDR(format?: 'raw'): Buffer; - - toXDR(format: 'hex' | 'base64'): string; - - static read(io: Buffer): LedgerCloseMetaV1; - - static write(value: LedgerCloseMetaV1, io: Buffer): void; - - static isValid(value: LedgerCloseMetaV1): boolean; - - static toXDR(value: LedgerCloseMetaV1): Buffer; - - static fromXDR(input: Buffer, format?: 'raw'): LedgerCloseMetaV1; - - static fromXDR(input: string, format: 'hex' | 'base64'): LedgerCloseMetaV1; - - static validateXDR(input: Buffer, format?: 'raw'): boolean; - - static validateXDR(input: string, format: 'hex' | 'base64'): boolean; - } - - class LedgerCloseMetaV2 { constructor(attributes: { ext: ExtensionPoint; ledgerHeader: LedgerHeaderHistoryEntry; @@ -4985,17 +4922,17 @@ export namespace xdr { toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): LedgerCloseMetaV2; + static read(io: Buffer): LedgerCloseMetaV1; - static write(value: LedgerCloseMetaV2, io: Buffer): void; + static write(value: LedgerCloseMetaV1, io: Buffer): void; - static isValid(value: LedgerCloseMetaV2): boolean; + static isValid(value: LedgerCloseMetaV1): boolean; - static toXDR(value: LedgerCloseMetaV2): Buffer; + static toXDR(value: LedgerCloseMetaV1): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): LedgerCloseMetaV2; + static fromXDR(input: Buffer, format?: 'raw'): LedgerCloseMetaV1; - static fromXDR(input: string, format: 'hex' | 'base64'): LedgerCloseMetaV2; + static fromXDR(input: string, format: 'hex' | 'base64'): LedgerCloseMetaV1; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -6721,31 +6658,31 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class BumpFootprintExpirationOp { - constructor(attributes: { ext: ExtensionPoint; ledgersToExpire: number }); + class ExtendFootprintTtlOp { + constructor(attributes: { ext: ExtensionPoint; extendTo: number }); ext(value?: ExtensionPoint): ExtensionPoint; - ledgersToExpire(value?: number): number; + extendTo(value?: number): number; toXDR(format?: 'raw'): Buffer; toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): BumpFootprintExpirationOp; + static read(io: Buffer): ExtendFootprintTtlOp; - static write(value: BumpFootprintExpirationOp, io: Buffer): void; + static write(value: ExtendFootprintTtlOp, io: Buffer): void; - static isValid(value: BumpFootprintExpirationOp): boolean; + static isValid(value: ExtendFootprintTtlOp): boolean; - static toXDR(value: BumpFootprintExpirationOp): Buffer; + static toXDR(value: ExtendFootprintTtlOp): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): BumpFootprintExpirationOp; + static fromXDR(input: Buffer, format?: 'raw'): ExtendFootprintTtlOp; static fromXDR( input: string, format: 'hex' | 'base64', - ): BumpFootprintExpirationOp; + ): ExtendFootprintTtlOp; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -7105,14 +7042,14 @@ export namespace xdr { constructor(attributes: { ext: ExtensionPoint; resources: SorobanResources; - refundableFee: Int64; + resourceFee: Int64; }); ext(value?: ExtensionPoint): ExtensionPoint; resources(value?: SorobanResources): SorobanResources; - refundableFee(value?: Int64): Int64; + resourceFee(value?: Int64): Int64; toXDR(format?: 'raw'): Buffer; @@ -9086,30 +9023,30 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class StateExpirationSettings { + class StateArchivalSettings { constructor(attributes: { - maxEntryExpiration: number; - minTempEntryExpiration: number; - minPersistentEntryExpiration: number; + maxEntryTtl: number; + minTemporaryTtl: number; + minPersistentTtl: number; persistentRentRateDenominator: Int64; tempRentRateDenominator: Int64; - maxEntriesToExpire: number; + maxEntriesToArchive: number; bucketListSizeWindowSampleSize: number; evictionScanSize: Uint64; startingEvictionScanLevel: number; }); - maxEntryExpiration(value?: number): number; + maxEntryTtl(value?: number): number; - minTempEntryExpiration(value?: number): number; + minTemporaryTtl(value?: number): number; - minPersistentEntryExpiration(value?: number): number; + minPersistentTtl(value?: number): number; persistentRentRateDenominator(value?: Int64): Int64; tempRentRateDenominator(value?: Int64): Int64; - maxEntriesToExpire(value?: number): number; + maxEntriesToArchive(value?: number): number; bucketListSizeWindowSampleSize(value?: number): number; @@ -9121,20 +9058,20 @@ export namespace xdr { toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): StateExpirationSettings; + static read(io: Buffer): StateArchivalSettings; - static write(value: StateExpirationSettings, io: Buffer): void; + static write(value: StateArchivalSettings, io: Buffer): void; - static isValid(value: StateExpirationSettings): boolean; + static isValid(value: StateArchivalSettings): boolean; - static toXDR(value: StateExpirationSettings): Buffer; + static toXDR(value: StateArchivalSettings): Buffer; - static fromXDR(input: Buffer, format?: 'raw'): StateExpirationSettings; + static fromXDR(input: Buffer, format?: 'raw'): StateArchivalSettings; static fromXDR( input: string, format: 'hex' | 'base64', - ): StateExpirationSettings; + ): StateArchivalSettings; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -9867,7 +9804,7 @@ export namespace xdr { configSetting(value?: ConfigSettingEntry): ConfigSettingEntry; - expiration(value?: ExpirationEntry): ExpirationEntry; + ttl(value?: TtlEntry): TtlEntry; static account(value: AccountEntry): LedgerEntryData; @@ -9887,7 +9824,7 @@ export namespace xdr { static configSetting(value: ConfigSettingEntry): LedgerEntryData; - static expiration(value: ExpirationEntry): LedgerEntryData; + static ttl(value: TtlEntry): LedgerEntryData; value(): | AccountEntry @@ -9899,7 +9836,7 @@ export namespace xdr { | ContractDataEntry | ContractCodeEntry | ConfigSettingEntry - | ExpirationEntry; + | TtlEntry; toXDR(format?: 'raw'): Buffer; @@ -9977,7 +9914,7 @@ export namespace xdr { configSetting(value?: LedgerKeyConfigSetting): LedgerKeyConfigSetting; - expiration(value?: LedgerKeyExpiration): LedgerKeyExpiration; + ttl(value?: LedgerKeyTtl): LedgerKeyTtl; static account(value: LedgerKeyAccount): LedgerKey; @@ -9997,7 +9934,7 @@ export namespace xdr { static configSetting(value: LedgerKeyConfigSetting): LedgerKey; - static expiration(value: LedgerKeyExpiration): LedgerKey; + static ttl(value: LedgerKeyTtl): LedgerKey; value(): | LedgerKeyAccount @@ -10009,7 +9946,7 @@ export namespace xdr { | LedgerKeyContractData | LedgerKeyContractCode | LedgerKeyConfigSetting - | LedgerKeyExpiration; + | LedgerKeyTtl; toXDR(format?: 'raw'): Buffer; @@ -10614,15 +10551,11 @@ export namespace xdr { v1(value?: LedgerCloseMetaV1): LedgerCloseMetaV1; - v2(value?: LedgerCloseMetaV2): LedgerCloseMetaV2; - static 0(value: LedgerCloseMetaV0): LedgerCloseMeta; static 1(value: LedgerCloseMetaV1): LedgerCloseMeta; - static 2(value: LedgerCloseMetaV2): LedgerCloseMeta; - - value(): LedgerCloseMetaV0 | LedgerCloseMetaV1 | LedgerCloseMetaV2; + value(): LedgerCloseMetaV0 | LedgerCloseMetaV1; toXDR(format?: 'raw'): Buffer; @@ -11256,9 +11189,7 @@ export namespace xdr { invokeHostFunctionOp(value?: InvokeHostFunctionOp): InvokeHostFunctionOp; - bumpFootprintExpirationOp( - value?: BumpFootprintExpirationOp, - ): BumpFootprintExpirationOp; + extendFootprintTtlOp(value?: ExtendFootprintTtlOp): ExtendFootprintTtlOp; restoreFootprintOp(value?: RestoreFootprintOp): RestoreFootprintOp; @@ -11322,9 +11253,7 @@ export namespace xdr { static invokeHostFunction(value: InvokeHostFunctionOp): OperationBody; - static bumpFootprintExpiration( - value: BumpFootprintExpirationOp, - ): OperationBody; + static extendFootprintTtl(value: ExtendFootprintTtlOp): OperationBody; static restoreFootprint(value: RestoreFootprintOp): OperationBody; @@ -11352,7 +11281,7 @@ export namespace xdr { | LiquidityPoolDepositOp | LiquidityPoolWithdrawOp | InvokeHostFunctionOp - | BumpFootprintExpirationOp + | ExtendFootprintTtlOp | RestoreFootprintOp | void; @@ -12839,7 +12768,7 @@ export namespace xdr { static invokeHostFunctionResourceLimitExceeded(): InvokeHostFunctionResult; - static invokeHostFunctionEntryExpired(): InvokeHostFunctionResult; + static invokeHostFunctionEntryArchived(): InvokeHostFunctionResult; static invokeHostFunctionInsufficientRefundableFee(): InvokeHostFunctionResult; @@ -12869,16 +12798,16 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } - class BumpFootprintExpirationResult { - switch(): BumpFootprintExpirationResultCode; + class ExtendFootprintTtlResult { + switch(): ExtendFootprintTtlResultCode; - static bumpFootprintExpirationSuccess(): BumpFootprintExpirationResult; + static extendFootprintTtlSuccess(): ExtendFootprintTtlResult; - static bumpFootprintExpirationMalformed(): BumpFootprintExpirationResult; + static extendFootprintTtlMalformed(): ExtendFootprintTtlResult; - static bumpFootprintExpirationResourceLimitExceeded(): BumpFootprintExpirationResult; + static extendFootprintTtlResourceLimitExceeded(): ExtendFootprintTtlResult; - static bumpFootprintExpirationInsufficientRefundableFee(): BumpFootprintExpirationResult; + static extendFootprintTtlInsufficientRefundableFee(): ExtendFootprintTtlResult; value(): void; @@ -12886,23 +12815,20 @@ export namespace xdr { toXDR(format: 'hex' | 'base64'): string; - static read(io: Buffer): BumpFootprintExpirationResult; + static read(io: Buffer): ExtendFootprintTtlResult; - static write(value: BumpFootprintExpirationResult, io: Buffer): void; + static write(value: ExtendFootprintTtlResult, io: Buffer): void; - static isValid(value: BumpFootprintExpirationResult): boolean; + static isValid(value: ExtendFootprintTtlResult): boolean; - static toXDR(value: BumpFootprintExpirationResult): Buffer; + static toXDR(value: ExtendFootprintTtlResult): Buffer; - static fromXDR( - input: Buffer, - format?: 'raw', - ): BumpFootprintExpirationResult; + static fromXDR(input: Buffer, format?: 'raw'): ExtendFootprintTtlResult; static fromXDR( input: string, format: 'hex' | 'base64', - ): BumpFootprintExpirationResult; + ): ExtendFootprintTtlResult; static validateXDR(input: Buffer, format?: 'raw'): boolean; @@ -13025,9 +12951,9 @@ export namespace xdr { value?: InvokeHostFunctionResult, ): InvokeHostFunctionResult; - bumpFootprintExpirationResult( - value?: BumpFootprintExpirationResult, - ): BumpFootprintExpirationResult; + extendFootprintTtlResult( + value?: ExtendFootprintTtlResult, + ): ExtendFootprintTtlResult; restoreFootprintResult( value?: RestoreFootprintResult, @@ -13105,8 +13031,8 @@ export namespace xdr { value: InvokeHostFunctionResult, ): OperationResultTr; - static bumpFootprintExpiration( - value: BumpFootprintExpirationResult, + static extendFootprintTtl( + value: ExtendFootprintTtlResult, ): OperationResultTr; static restoreFootprint(value: RestoreFootprintResult): OperationResultTr; @@ -13137,7 +13063,7 @@ export namespace xdr { | LiquidityPoolDepositResult | LiquidityPoolWithdrawResult | InvokeHostFunctionResult - | BumpFootprintExpirationResult + | ExtendFootprintTtlResult | RestoreFootprintResult; toXDR(format?: 'raw'): Buffer; @@ -13568,7 +13494,7 @@ export namespace xdr { static contractExecutableWasm(value: Buffer): ContractExecutable; - static contractExecutableToken(): ContractExecutable; + static contractExecutableStellarAsset(): ContractExecutable; value(): Buffer | void; @@ -14049,9 +13975,7 @@ export namespace xdr { contractDataEntrySizeBytes(value?: number): number; - stateExpirationSettings( - value?: StateExpirationSettings, - ): StateExpirationSettings; + stateArchivalSettings(value?: StateArchivalSettings): StateArchivalSettings; contractExecutionLanes( value?: ConfigSettingContractExecutionLanesV0, @@ -14099,8 +14023,8 @@ export namespace xdr { value: number, ): ConfigSettingEntry; - static configSettingStateExpiration( - value: StateExpirationSettings, + static configSettingStateArchival( + value: StateArchivalSettings, ): ConfigSettingEntry; static configSettingContractExecutionLanes( @@ -14126,7 +14050,7 @@ export namespace xdr { | ContractCostParamEntry[] | number | number - | StateExpirationSettings + | StateArchivalSettings | ConfigSettingContractExecutionLanesV0 | Uint64[] | EvictionIterator; diff --git a/xdr/curr/Stellar-contract-config-setting.x b/xdr/curr/Stellar-contract-config-setting.x index 9512f0c4..b187a18c 100644 --- a/xdr/curr/Stellar-contract-config-setting.x +++ b/xdr/curr/Stellar-contract-config-setting.x @@ -92,64 +92,54 @@ struct ConfigSettingContractBandwidthV0 enum ContractCostType { // Cost of running 1 wasm instruction WasmInsnExec = 0, - // Cost of growing wasm linear memory by 1 page - WasmMemAlloc = 1, - // Cost of allocating a chuck of host memory (in bytes) - HostMemAlloc = 2, - // Cost of copying a chuck of bytes into a pre-allocated host memory - HostMemCpy = 3, - // Cost of comparing two slices of host memory - HostMemCmp = 4, + // Cost of allocating a slice of memory (in bytes) + MemAlloc = 1, + // Cost of copying a slice of bytes into a pre-allocated memory + MemCpy = 2, + // Cost of comparing two slices of memory + MemCmp = 3, // Cost of a host function dispatch, not including the actual work done by // the function nor the cost of VM invocation machinary - DispatchHostFunction = 5, + DispatchHostFunction = 4, // Cost of visiting a host object from the host object storage. Exists to // make sure some baseline cost coverage, i.e. repeatly visiting objects // by the guest will always incur some charges. - VisitObject = 6, + VisitObject = 5, // Cost of serializing an xdr object to bytes - ValSer = 7, + ValSer = 6, // Cost of deserializing an xdr object from bytes - ValDeser = 8, + ValDeser = 7, // Cost of computing the sha256 hash from bytes - ComputeSha256Hash = 9, + ComputeSha256Hash = 8, // Cost of computing the ed25519 pubkey from bytes - ComputeEd25519PubKey = 10, - // Cost of accessing an entry in a Map. - MapEntry = 11, - // Cost of accessing an entry in a Vec - VecEntry = 12, + ComputeEd25519PubKey = 9, // Cost of verifying ed25519 signature of a payload. - VerifyEd25519Sig = 13, - // Cost of reading a slice of vm linear memory - VmMemRead = 14, - // Cost of writing to a slice of vm linear memory - VmMemWrite = 15, + VerifyEd25519Sig = 10, // Cost of instantiation a VM from wasm bytes code. - VmInstantiation = 16, + VmInstantiation = 11, // Cost of instantiation a VM from a cached state. - VmCachedInstantiation = 17, + VmCachedInstantiation = 12, // Cost of invoking a function on the VM. If the function is a host function, // additional cost will be covered by `DispatchHostFunction`. - InvokeVmFunction = 18, + InvokeVmFunction = 13, // Cost of computing a keccak256 hash from bytes. - ComputeKeccak256Hash = 19, - // Cost of computing an ECDSA secp256k1 pubkey from bytes. - ComputeEcdsaSecp256k1Key = 20, + ComputeKeccak256Hash = 14, // Cost of computing an ECDSA secp256k1 signature from bytes. - ComputeEcdsaSecp256k1Sig = 21, + ComputeEcdsaSecp256k1Sig = 15, // Cost of recovering an ECDSA secp256k1 key from a signature. - RecoverEcdsaSecp256k1Key = 22, + RecoverEcdsaSecp256k1Key = 16, // Cost of int256 addition (`+`) and subtraction (`-`) operations - Int256AddSub = 23, + Int256AddSub = 17, // Cost of int256 multiplication (`*`) operation - Int256Mul = 24, + Int256Mul = 18, // Cost of int256 division (`/`) operation - Int256Div = 25, + Int256Div = 19, // Cost of int256 power (`exp`) operation - Int256Pow = 26, + Int256Pow = 20, // Cost of int256 shift (`shl`, `shr`) operation - Int256Shift = 27 + Int256Shift = 21, + // Cost of drawing random bytes using a ChaCha20 PRNG + ChaCha20DrawBytes = 22 }; struct ContractCostParamEntry { @@ -160,17 +150,17 @@ struct ContractCostParamEntry { int64 linearTerm; }; -struct StateExpirationSettings { - uint32 maxEntryExpiration; - uint32 minTempEntryExpiration; - uint32 minPersistentEntryExpiration; +struct StateArchivalSettings { + uint32 maxEntryTTL; + uint32 minTemporaryTTL; + uint32 minPersistentTTL; // rent_fee = wfee_rate_average / rent_rate_denominator_for_type int64 persistentRentRateDenominator; int64 tempRentRateDenominator; - // max number of entries that emit expiration meta in a single ledger - uint32 maxEntriesToExpire; + // max number of entries that emit archival meta in a single ledger + uint32 maxEntriesToArchive; // Number of snapshots to use when calculating average BucketList size uint32 bucketListSizeWindowSampleSize; @@ -206,7 +196,7 @@ enum ConfigSettingID CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, - CONFIG_SETTING_STATE_EXPIRATION = 10, + CONFIG_SETTING_STATE_ARCHIVAL = 10, CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, CONFIG_SETTING_EVICTION_ITERATOR = 13 @@ -234,8 +224,8 @@ case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: uint32 contractDataKeySizeBytes; case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: uint32 contractDataEntrySizeBytes; -case CONFIG_SETTING_STATE_EXPIRATION: - StateExpirationSettings stateExpirationSettings; +case CONFIG_SETTING_STATE_ARCHIVAL: + StateArchivalSettings stateArchivalSettings; case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: ConfigSettingContractExecutionLanesV0 contractExecutionLanes; case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: diff --git a/xdr/curr/Stellar-contract.x b/xdr/curr/Stellar-contract.x index 7c7469c7..51130056 100644 --- a/xdr/curr/Stellar-contract.x +++ b/xdr/curr/Stellar-contract.x @@ -165,14 +165,14 @@ struct Int256Parts { enum ContractExecutableType { CONTRACT_EXECUTABLE_WASM = 0, - CONTRACT_EXECUTABLE_TOKEN = 1 + CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 }; union ContractExecutable switch (ContractExecutableType type) { case CONTRACT_EXECUTABLE_WASM: Hash wasm_hash; -case CONTRACT_EXECUTABLE_TOKEN: +case CONTRACT_EXECUTABLE_STELLAR_ASSET: void; }; diff --git a/xdr/curr/Stellar-ledger-entries.x b/xdr/curr/Stellar-ledger-entries.x index f0664840..8a8784e2 100644 --- a/xdr/curr/Stellar-ledger-entries.x +++ b/xdr/curr/Stellar-ledger-entries.x @@ -101,7 +101,7 @@ enum LedgerEntryType CONTRACT_DATA = 6, CONTRACT_CODE = 7, CONFIG_SETTING = 8, - EXPIRATION = 9 + TTL = 9 }; struct Signer @@ -515,10 +515,10 @@ struct ContractCodeEntry { opaque code<>; }; -struct ExpirationEntry { - // Hash of the LedgerKey that is associated with this ExpirationEntry +struct TTLEntry { + // Hash of the LedgerKey that is associated with this TTLEntry Hash keyHash; - uint32 expirationLedgerSeq; + uint32 liveUntilLedgerSeq; }; struct LedgerEntryExtensionV1 @@ -557,8 +557,8 @@ struct LedgerEntry ContractCodeEntry contractCode; case CONFIG_SETTING: ConfigSettingEntry configSetting; - case EXPIRATION: - ExpirationEntry expiration; + case TTL: + TTLEntry ttl; } data; @@ -630,12 +630,12 @@ case CONFIG_SETTING: { ConfigSettingID configSettingID; } configSetting; -case EXPIRATION: +case TTL: struct { - // Hash of the LedgerKey that is associated with this ExpirationEntry + // Hash of the LedgerKey that is associated with this TTLEntry Hash keyHash; - } expiration; + } ttl; }; // list of all envelope types used in the application diff --git a/xdr/curr/Stellar-ledger.x b/xdr/curr/Stellar-ledger.x index a1bbac4b..b18a3a0d 100644 --- a/xdr/curr/Stellar-ledger.x +++ b/xdr/curr/Stellar-ledger.x @@ -486,26 +486,8 @@ struct LedgerCloseMetaV0 struct LedgerCloseMetaV1 { - LedgerHeaderHistoryEntry ledgerHeader; - - GeneralizedTransactionSet txSet; - - // NB: transactions are sorted in apply order here - // fees for all transactions are processed first - // followed by applying transactions - TransactionResultMeta txProcessing<>; - - // upgrades are applied last - UpgradeEntryMeta upgradesProcessing<>; - - // other misc information attached to the ledger close - SCPHistoryEntry scpInfo<>; -}; - -struct LedgerCloseMetaV2 -{ - // We forgot to add an ExtensionPoint in v1 but at least - // we can add one now in v2. + // We forgot to add an ExtensionPoint in v0 but at least + // we can add one now in v1. ExtensionPoint ext; LedgerHeaderHistoryEntry ledgerHeader; @@ -527,10 +509,10 @@ struct LedgerCloseMetaV2 // systems calculating storage fees correctly. uint64 totalByteSizeOfBucketList; - // Expired temp keys that are being evicted at this ledger. + // Temp keys that are being evicted at this ledger. LedgerKey evictedTemporaryLedgerKeys<>; - // Expired restorable ledger entries that are being + // Archived restorable ledger entries that are being // evicted at this ledger. LedgerEntry evictedPersistentLedgerEntries<>; }; @@ -541,7 +523,5 @@ case 0: LedgerCloseMetaV0 v0; case 1: LedgerCloseMetaV1 v1; -case 2: - LedgerCloseMetaV2 v2; }; } diff --git a/xdr/curr/Stellar-transaction.x b/xdr/curr/Stellar-transaction.x index 2e3c22b3..87dd32d3 100644 --- a/xdr/curr/Stellar-transaction.x +++ b/xdr/curr/Stellar-transaction.x @@ -63,7 +63,7 @@ enum OperationType LIQUIDITY_POOL_DEPOSIT = 22, LIQUIDITY_POOL_WITHDRAW = 23, INVOKE_HOST_FUNCTION = 24, - BUMP_FOOTPRINT_EXPIRATION = 25, + EXTEND_FOOTPRINT_TTL = 25, RESTORE_FOOTPRINT = 26 }; @@ -572,7 +572,7 @@ struct SorobanAuthorizationEntry SorobanAuthorizedInvocation rootInvocation; }; -/* Upload WASM, create, and invoke contracts in Soroban. +/* Upload Wasm, create, and invoke contracts in Soroban. Threshold: med Result: InvokeHostFunctionResult @@ -585,21 +585,21 @@ struct InvokeHostFunctionOp SorobanAuthorizationEntry auth<>; }; -/* Bump the expiration ledger of the entries specified in the readOnly footprint - so they'll expire at least ledgersToExpire ledgers from lcl. +/* Extend the TTL of the entries specified in the readOnly footprint + so they will live at least extendTo ledgers from lcl. - Threshold: med - Result: BumpFootprintExpirationResult + Threshold: low + Result: ExtendFootprintTTLResult */ -struct BumpFootprintExpirationOp +struct ExtendFootprintTTLOp { ExtensionPoint ext; - uint32 ledgersToExpire; + uint32 extendTo; }; -/* Restore the expired or evicted entries specified in the readWrite footprint. +/* Restore the archived entries specified in the readWrite footprint. - Threshold: med + Threshold: low Result: RestoreFootprintOp */ struct RestoreFootprintOp @@ -667,8 +667,8 @@ struct Operation LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; case INVOKE_HOST_FUNCTION: InvokeHostFunctionOp invokeHostFunctionOp; - case BUMP_FOOTPRINT_EXPIRATION: - BumpFootprintExpirationOp bumpFootprintExpirationOp; + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLOp extendFootprintTTLOp; case RESTORE_FOOTPRINT: RestoreFootprintOp restoreFootprintOp; } @@ -821,8 +821,16 @@ struct SorobanTransactionData { ExtensionPoint ext; SorobanResources resources; - // Portion of transaction `fee` allocated to refundable fees. - int64 refundableFee; + // Amount of the transaction `fee` allocated to the Soroban resource fees. + // The fraction of `resourceFee` corresponding to `resources` specified + // above is *not* refundable (i.e. fees for instructions, ledger I/O), as + // well as fees for the transaction size. + // The remaining part of the fee is refundable and the charged value is + // based on the actual consumption of refundable resources (events, ledger + // rent bumps). + // The `inclusionFee` used for prioritization of the transaction is defined + // as `tx.fee - resourceFee`. + int64 resourceFee; }; // TransactionV0 is a transaction with the AccountID discriminant stripped off, @@ -1789,7 +1797,7 @@ enum InvokeHostFunctionResultCode INVOKE_HOST_FUNCTION_MALFORMED = -1, INVOKE_HOST_FUNCTION_TRAPPED = -2, INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, - INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4, + INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 }; @@ -1800,29 +1808,29 @@ case INVOKE_HOST_FUNCTION_SUCCESS: case INVOKE_HOST_FUNCTION_MALFORMED: case INVOKE_HOST_FUNCTION_TRAPPED: case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: -case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED: +case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: void; }; -enum BumpFootprintExpirationResultCode +enum ExtendFootprintTTLResultCode { // codes considered as "success" for the operation - BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0, + EXTEND_FOOTPRINT_TTL_SUCCESS = 0, // codes considered as "failure" for the operation - BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1, - BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2, - BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3 + EXTEND_FOOTPRINT_TTL_MALFORMED = -1, + EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, + EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 }; -union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code) +union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code) { -case BUMP_FOOTPRINT_EXPIRATION_SUCCESS: +case EXTEND_FOOTPRINT_TTL_SUCCESS: void; -case BUMP_FOOTPRINT_EXPIRATION_MALFORMED: -case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED: -case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE: +case EXTEND_FOOTPRINT_TTL_MALFORMED: +case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: +case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: void; }; @@ -1915,8 +1923,8 @@ case opINNER: LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; case INVOKE_HOST_FUNCTION: InvokeHostFunctionResult invokeHostFunctionResult; - case BUMP_FOOTPRINT_EXPIRATION: - BumpFootprintExpirationResult bumpFootprintExpirationResult; + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLResult extendFootprintTTLResult; case RESTORE_FOOTPRINT: RestoreFootprintResult restoreFootprintResult; } diff --git a/xdr/next/Stellar-contract-config-setting.x b/xdr/next/Stellar-contract-config-setting.x index 9512f0c4..b187a18c 100644 --- a/xdr/next/Stellar-contract-config-setting.x +++ b/xdr/next/Stellar-contract-config-setting.x @@ -92,64 +92,54 @@ struct ConfigSettingContractBandwidthV0 enum ContractCostType { // Cost of running 1 wasm instruction WasmInsnExec = 0, - // Cost of growing wasm linear memory by 1 page - WasmMemAlloc = 1, - // Cost of allocating a chuck of host memory (in bytes) - HostMemAlloc = 2, - // Cost of copying a chuck of bytes into a pre-allocated host memory - HostMemCpy = 3, - // Cost of comparing two slices of host memory - HostMemCmp = 4, + // Cost of allocating a slice of memory (in bytes) + MemAlloc = 1, + // Cost of copying a slice of bytes into a pre-allocated memory + MemCpy = 2, + // Cost of comparing two slices of memory + MemCmp = 3, // Cost of a host function dispatch, not including the actual work done by // the function nor the cost of VM invocation machinary - DispatchHostFunction = 5, + DispatchHostFunction = 4, // Cost of visiting a host object from the host object storage. Exists to // make sure some baseline cost coverage, i.e. repeatly visiting objects // by the guest will always incur some charges. - VisitObject = 6, + VisitObject = 5, // Cost of serializing an xdr object to bytes - ValSer = 7, + ValSer = 6, // Cost of deserializing an xdr object from bytes - ValDeser = 8, + ValDeser = 7, // Cost of computing the sha256 hash from bytes - ComputeSha256Hash = 9, + ComputeSha256Hash = 8, // Cost of computing the ed25519 pubkey from bytes - ComputeEd25519PubKey = 10, - // Cost of accessing an entry in a Map. - MapEntry = 11, - // Cost of accessing an entry in a Vec - VecEntry = 12, + ComputeEd25519PubKey = 9, // Cost of verifying ed25519 signature of a payload. - VerifyEd25519Sig = 13, - // Cost of reading a slice of vm linear memory - VmMemRead = 14, - // Cost of writing to a slice of vm linear memory - VmMemWrite = 15, + VerifyEd25519Sig = 10, // Cost of instantiation a VM from wasm bytes code. - VmInstantiation = 16, + VmInstantiation = 11, // Cost of instantiation a VM from a cached state. - VmCachedInstantiation = 17, + VmCachedInstantiation = 12, // Cost of invoking a function on the VM. If the function is a host function, // additional cost will be covered by `DispatchHostFunction`. - InvokeVmFunction = 18, + InvokeVmFunction = 13, // Cost of computing a keccak256 hash from bytes. - ComputeKeccak256Hash = 19, - // Cost of computing an ECDSA secp256k1 pubkey from bytes. - ComputeEcdsaSecp256k1Key = 20, + ComputeKeccak256Hash = 14, // Cost of computing an ECDSA secp256k1 signature from bytes. - ComputeEcdsaSecp256k1Sig = 21, + ComputeEcdsaSecp256k1Sig = 15, // Cost of recovering an ECDSA secp256k1 key from a signature. - RecoverEcdsaSecp256k1Key = 22, + RecoverEcdsaSecp256k1Key = 16, // Cost of int256 addition (`+`) and subtraction (`-`) operations - Int256AddSub = 23, + Int256AddSub = 17, // Cost of int256 multiplication (`*`) operation - Int256Mul = 24, + Int256Mul = 18, // Cost of int256 division (`/`) operation - Int256Div = 25, + Int256Div = 19, // Cost of int256 power (`exp`) operation - Int256Pow = 26, + Int256Pow = 20, // Cost of int256 shift (`shl`, `shr`) operation - Int256Shift = 27 + Int256Shift = 21, + // Cost of drawing random bytes using a ChaCha20 PRNG + ChaCha20DrawBytes = 22 }; struct ContractCostParamEntry { @@ -160,17 +150,17 @@ struct ContractCostParamEntry { int64 linearTerm; }; -struct StateExpirationSettings { - uint32 maxEntryExpiration; - uint32 minTempEntryExpiration; - uint32 minPersistentEntryExpiration; +struct StateArchivalSettings { + uint32 maxEntryTTL; + uint32 minTemporaryTTL; + uint32 minPersistentTTL; // rent_fee = wfee_rate_average / rent_rate_denominator_for_type int64 persistentRentRateDenominator; int64 tempRentRateDenominator; - // max number of entries that emit expiration meta in a single ledger - uint32 maxEntriesToExpire; + // max number of entries that emit archival meta in a single ledger + uint32 maxEntriesToArchive; // Number of snapshots to use when calculating average BucketList size uint32 bucketListSizeWindowSampleSize; @@ -206,7 +196,7 @@ enum ConfigSettingID CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, - CONFIG_SETTING_STATE_EXPIRATION = 10, + CONFIG_SETTING_STATE_ARCHIVAL = 10, CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, CONFIG_SETTING_EVICTION_ITERATOR = 13 @@ -234,8 +224,8 @@ case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: uint32 contractDataKeySizeBytes; case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: uint32 contractDataEntrySizeBytes; -case CONFIG_SETTING_STATE_EXPIRATION: - StateExpirationSettings stateExpirationSettings; +case CONFIG_SETTING_STATE_ARCHIVAL: + StateArchivalSettings stateArchivalSettings; case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: ConfigSettingContractExecutionLanesV0 contractExecutionLanes; case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: diff --git a/xdr/next/Stellar-contract.x b/xdr/next/Stellar-contract.x index 7c7469c7..51130056 100644 --- a/xdr/next/Stellar-contract.x +++ b/xdr/next/Stellar-contract.x @@ -165,14 +165,14 @@ struct Int256Parts { enum ContractExecutableType { CONTRACT_EXECUTABLE_WASM = 0, - CONTRACT_EXECUTABLE_TOKEN = 1 + CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 }; union ContractExecutable switch (ContractExecutableType type) { case CONTRACT_EXECUTABLE_WASM: Hash wasm_hash; -case CONTRACT_EXECUTABLE_TOKEN: +case CONTRACT_EXECUTABLE_STELLAR_ASSET: void; }; diff --git a/xdr/next/Stellar-ledger-entries.x b/xdr/next/Stellar-ledger-entries.x index f0664840..8a8784e2 100644 --- a/xdr/next/Stellar-ledger-entries.x +++ b/xdr/next/Stellar-ledger-entries.x @@ -101,7 +101,7 @@ enum LedgerEntryType CONTRACT_DATA = 6, CONTRACT_CODE = 7, CONFIG_SETTING = 8, - EXPIRATION = 9 + TTL = 9 }; struct Signer @@ -515,10 +515,10 @@ struct ContractCodeEntry { opaque code<>; }; -struct ExpirationEntry { - // Hash of the LedgerKey that is associated with this ExpirationEntry +struct TTLEntry { + // Hash of the LedgerKey that is associated with this TTLEntry Hash keyHash; - uint32 expirationLedgerSeq; + uint32 liveUntilLedgerSeq; }; struct LedgerEntryExtensionV1 @@ -557,8 +557,8 @@ struct LedgerEntry ContractCodeEntry contractCode; case CONFIG_SETTING: ConfigSettingEntry configSetting; - case EXPIRATION: - ExpirationEntry expiration; + case TTL: + TTLEntry ttl; } data; @@ -630,12 +630,12 @@ case CONFIG_SETTING: { ConfigSettingID configSettingID; } configSetting; -case EXPIRATION: +case TTL: struct { - // Hash of the LedgerKey that is associated with this ExpirationEntry + // Hash of the LedgerKey that is associated with this TTLEntry Hash keyHash; - } expiration; + } ttl; }; // list of all envelope types used in the application diff --git a/xdr/next/Stellar-ledger.x b/xdr/next/Stellar-ledger.x index a1bbac4b..b18a3a0d 100644 --- a/xdr/next/Stellar-ledger.x +++ b/xdr/next/Stellar-ledger.x @@ -486,26 +486,8 @@ struct LedgerCloseMetaV0 struct LedgerCloseMetaV1 { - LedgerHeaderHistoryEntry ledgerHeader; - - GeneralizedTransactionSet txSet; - - // NB: transactions are sorted in apply order here - // fees for all transactions are processed first - // followed by applying transactions - TransactionResultMeta txProcessing<>; - - // upgrades are applied last - UpgradeEntryMeta upgradesProcessing<>; - - // other misc information attached to the ledger close - SCPHistoryEntry scpInfo<>; -}; - -struct LedgerCloseMetaV2 -{ - // We forgot to add an ExtensionPoint in v1 but at least - // we can add one now in v2. + // We forgot to add an ExtensionPoint in v0 but at least + // we can add one now in v1. ExtensionPoint ext; LedgerHeaderHistoryEntry ledgerHeader; @@ -527,10 +509,10 @@ struct LedgerCloseMetaV2 // systems calculating storage fees correctly. uint64 totalByteSizeOfBucketList; - // Expired temp keys that are being evicted at this ledger. + // Temp keys that are being evicted at this ledger. LedgerKey evictedTemporaryLedgerKeys<>; - // Expired restorable ledger entries that are being + // Archived restorable ledger entries that are being // evicted at this ledger. LedgerEntry evictedPersistentLedgerEntries<>; }; @@ -541,7 +523,5 @@ case 0: LedgerCloseMetaV0 v0; case 1: LedgerCloseMetaV1 v1; -case 2: - LedgerCloseMetaV2 v2; }; } diff --git a/xdr/next/Stellar-transaction.x b/xdr/next/Stellar-transaction.x index 2e3c22b3..87dd32d3 100644 --- a/xdr/next/Stellar-transaction.x +++ b/xdr/next/Stellar-transaction.x @@ -63,7 +63,7 @@ enum OperationType LIQUIDITY_POOL_DEPOSIT = 22, LIQUIDITY_POOL_WITHDRAW = 23, INVOKE_HOST_FUNCTION = 24, - BUMP_FOOTPRINT_EXPIRATION = 25, + EXTEND_FOOTPRINT_TTL = 25, RESTORE_FOOTPRINT = 26 }; @@ -572,7 +572,7 @@ struct SorobanAuthorizationEntry SorobanAuthorizedInvocation rootInvocation; }; -/* Upload WASM, create, and invoke contracts in Soroban. +/* Upload Wasm, create, and invoke contracts in Soroban. Threshold: med Result: InvokeHostFunctionResult @@ -585,21 +585,21 @@ struct InvokeHostFunctionOp SorobanAuthorizationEntry auth<>; }; -/* Bump the expiration ledger of the entries specified in the readOnly footprint - so they'll expire at least ledgersToExpire ledgers from lcl. +/* Extend the TTL of the entries specified in the readOnly footprint + so they will live at least extendTo ledgers from lcl. - Threshold: med - Result: BumpFootprintExpirationResult + Threshold: low + Result: ExtendFootprintTTLResult */ -struct BumpFootprintExpirationOp +struct ExtendFootprintTTLOp { ExtensionPoint ext; - uint32 ledgersToExpire; + uint32 extendTo; }; -/* Restore the expired or evicted entries specified in the readWrite footprint. +/* Restore the archived entries specified in the readWrite footprint. - Threshold: med + Threshold: low Result: RestoreFootprintOp */ struct RestoreFootprintOp @@ -667,8 +667,8 @@ struct Operation LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; case INVOKE_HOST_FUNCTION: InvokeHostFunctionOp invokeHostFunctionOp; - case BUMP_FOOTPRINT_EXPIRATION: - BumpFootprintExpirationOp bumpFootprintExpirationOp; + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLOp extendFootprintTTLOp; case RESTORE_FOOTPRINT: RestoreFootprintOp restoreFootprintOp; } @@ -821,8 +821,16 @@ struct SorobanTransactionData { ExtensionPoint ext; SorobanResources resources; - // Portion of transaction `fee` allocated to refundable fees. - int64 refundableFee; + // Amount of the transaction `fee` allocated to the Soroban resource fees. + // The fraction of `resourceFee` corresponding to `resources` specified + // above is *not* refundable (i.e. fees for instructions, ledger I/O), as + // well as fees for the transaction size. + // The remaining part of the fee is refundable and the charged value is + // based on the actual consumption of refundable resources (events, ledger + // rent bumps). + // The `inclusionFee` used for prioritization of the transaction is defined + // as `tx.fee - resourceFee`. + int64 resourceFee; }; // TransactionV0 is a transaction with the AccountID discriminant stripped off, @@ -1789,7 +1797,7 @@ enum InvokeHostFunctionResultCode INVOKE_HOST_FUNCTION_MALFORMED = -1, INVOKE_HOST_FUNCTION_TRAPPED = -2, INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, - INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4, + INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 }; @@ -1800,29 +1808,29 @@ case INVOKE_HOST_FUNCTION_SUCCESS: case INVOKE_HOST_FUNCTION_MALFORMED: case INVOKE_HOST_FUNCTION_TRAPPED: case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: -case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED: +case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: void; }; -enum BumpFootprintExpirationResultCode +enum ExtendFootprintTTLResultCode { // codes considered as "success" for the operation - BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0, + EXTEND_FOOTPRINT_TTL_SUCCESS = 0, // codes considered as "failure" for the operation - BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1, - BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2, - BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3 + EXTEND_FOOTPRINT_TTL_MALFORMED = -1, + EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, + EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 }; -union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code) +union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code) { -case BUMP_FOOTPRINT_EXPIRATION_SUCCESS: +case EXTEND_FOOTPRINT_TTL_SUCCESS: void; -case BUMP_FOOTPRINT_EXPIRATION_MALFORMED: -case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED: -case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE: +case EXTEND_FOOTPRINT_TTL_MALFORMED: +case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: +case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: void; }; @@ -1915,8 +1923,8 @@ case opINNER: LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; case INVOKE_HOST_FUNCTION: InvokeHostFunctionResult invokeHostFunctionResult; - case BUMP_FOOTPRINT_EXPIRATION: - BumpFootprintExpirationResult bumpFootprintExpirationResult; + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLResult extendFootprintTTLResult; case RESTORE_FOOTPRINT: RestoreFootprintResult restoreFootprintResult; } diff --git a/yarn.lock b/yarn.lock index 5d57df6e..63461029 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1315,6 +1315,11 @@ resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553" integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg== +"@stellar/js-xdr@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@stellar/js-xdr/-/js-xdr-3.0.1.tgz#d500f1e1332210cd56e0ef95e44c54506d9f48f3" + integrity sha512-dp5Eh7Nr1YjiIeqpdkj2cQYxfoPudDAH3ck8MWggp48Htw66Z/hUssNYUQG/OftLjEmHT90Z/dtey2Y77DOxIw== + "@tsconfig/node10@^1.0.7": version "1.0.9" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" @@ -4558,11 +4563,6 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-xdr@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/js-xdr/-/js-xdr-3.0.0.tgz#fb74275de0ed3cec61269721140a576edf6fca7e" - integrity sha512-tSt6UKJ2L7t+yaQURGkHo9kop9qnVbChTlCu62zNiDbDZQoZb/YjUj2iFJ3lgelhfg9p5bhO2o/QX+g36TPsSQ== - js-yaml@4.1.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"