diff --git a/.gitignore b/.gitignore index c7abc665..b1b70a07 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ .vscode/ .copilot/ tsconfig.tsbuildinfo +*.tgz diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c03fed5..606b64c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +### Added +* XDR definitions updated for Protocol 28 / CAP-0085 (externally managed contract executables): new `SCV_EXECUTABLE_TAG` arm on `ScValType`, `CONTRACT_EXECUTABLE_EXTERNAL_REF` arm + `ContractExecutableExternalRef` struct on `ContractExecutable`, gated behind the `CAP_0085_EXECUTABLE_REF` feature in the regen (next channel only). `scValToNative` decodes the `SCV_EXECUTABLE_TAG` string payload, and `buildInvocationTree` handles the external-ref executable arm gracefully (external-ref preimage validation deferred pending the CAP spec). + ## [`v15.0.0`](https://github.com/stellar/js-stellar-base/compare/v14.1.0...v15.0.0): Protocol 26 **[Migration Guide](docs/migration-guide/v15.md)** — step-by-step upgrade instructions with code examples and severity ratings. diff --git a/Makefile b/Makefile index 2a1becea..4c5948bc 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,14 @@ -XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/cff714a5ebaaaf2dac343b3546c2df73f0b7a36e +# CAP-85 pre-release: pin to the protocol-28 .x and resolve feature gates +# via `stellar-xdr xfile preprocess` (rs-stellar-xdr #503) before xdrgen, +# since the Ruby xdrgen used here does not understand #ifdef. +# CAP_0085_EXECUTABLE_REF is gated to the `next` channel only: the +# externally managed contract executable arms are not enabled on `curr` +# until protocol 28 ships. This stack is independent of the CAP-0083 / +# CAP-0084 stacks and enables no other CAP features. +XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/76218a994f8c5ba752cba368080fb2f89843ad3c XDR_BASE_LOCAL_CURR=xdr/curr +XDR_FEATURES_CURR= +XDR_FEATURES_NEXT=CAP_0085_EXECUTABLE_REF XDR_FILES_CURR= \ Stellar-SCP.x \ Stellar-ledger-entries.x \ @@ -15,7 +24,7 @@ XDR_FILES_CURR= \ Stellar-exporter.x XDR_FILES_LOCAL_CURR=$(addprefix xdr/curr/,$(XDR_FILES_CURR)) -XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/cff714a5ebaaaf2dac343b3546c2df73f0b7a36e +XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/76218a994f8c5ba752cba368080fb2f89843ad3c XDR_BASE_LOCAL_NEXT=xdr/next XDR_FILES_NEXT= \ Stellar-SCP.x \ @@ -42,24 +51,26 @@ generate: src/generated/curr_generated.js types/curr.d.ts src/generated/next_gen src/generated/curr_generated.js: $(XDR_FILES_LOCAL_CURR) mkdir -p $(dir $@) > $@ - docker run -it --rm -v $$PWD:/wd -w /wd ruby:3.1 /bin/bash -c '\ + docker run --rm -v $$PWD:/wd -w /wd ruby:3.1 /bin/bash -c '\ gem install specific_install -v 0.3.8 && \ gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_COMMIT) && \ xdrgen --language javascript --namespace curr --output src/generated $^ \ ' + python3 scripts/post-process-generated.py $@ src/generated/next_generated.js: $(XDR_FILES_LOCAL_NEXT) mkdir -p $(dir $@) > $@ - docker run -it --rm -v $$PWD:/wd -w /wd ruby:3.1 /bin/bash -c '\ + docker run --rm -v $$PWD:/wd -w /wd ruby:3.1 /bin/bash -c '\ gem install specific_install -v 0.3.8 && \ gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_COMMIT) && \ xdrgen --language javascript --namespace next --output src/generated $^ \ ' + python3 scripts/post-process-generated.py $@ types/curr.d.ts: src/generated/curr_generated.js - docker run -it --rm -v $$PWD:/wd -w / --entrypoint /bin/sh node:alpine -c '\ - apk add --update git && \ + docker run --rm -v $$PWD:/wd -w / --entrypoint /bin/sh node:lts-alpine -c '\ + apk add --update git && apk add --update yarn && \ git clone --depth 1 https://github.com/stellar/dts-xdr -b $(DTSXDR_COMMIT) --single-branch && \ cd /dts-xdr && \ yarn install --network-concurrency 1 && \ @@ -69,8 +80,8 @@ types/curr.d.ts: src/generated/curr_generated.js ' types/next.d.ts: src/generated/next_generated.js - docker run -it --rm -v $$PWD:/wd -w / --entrypoint /bin/sh node:alpine -c '\ - apk add --update git && \ + docker run --rm -v $$PWD:/wd -w / --entrypoint /bin/sh node:lts-alpine -c '\ + apk add --update git && apk add --update yarn && \ git clone --depth 1 https://github.com/stellar/dts-xdr -b $(DTSXDR_COMMIT) --single-branch && \ cd /dts-xdr && \ yarn install --network-concurrency 1 && \ @@ -85,10 +96,12 @@ clean: $(XDR_FILES_LOCAL_CURR): mkdir -p $(dir $@) curl -L -o $@ $(XDR_BASE_URL_CURR)/$(notdir $@) + stellar-xdr xfile preprocess --features "$(XDR_FEATURES_CURR)" $@ > $@.pp && mv -f $@.pp $@ $(XDR_FILES_LOCAL_NEXT): mkdir -p $(dir $@) curl -L -o $@ $(XDR_BASE_URL_NEXT)/$(notdir $@) + stellar-xdr xfile preprocess --features "$(XDR_FEATURES_NEXT)" $@ > $@.pp && mv -f $@.pp $@ reset-xdr: rm -f xdr/*/*.x diff --git a/scripts/post-process-generated.py b/scripts/post-process-generated.py new file mode 100644 index 00000000..71a16d61 --- /dev/null +++ b/scripts/post-process-generated.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +"""Post-process xdrgen JS output to inline xdr.const values at usage sites. + +xdrgen master emits `xdr.const("NAME", N);` to register a constant in the +xdr namespace, then uses the bare identifier later (`xdr.string(NAME)`). +But `@stellar/js-xdr`'s TypeBuilder.const() does not put NAME into JS scope, +so the bare identifier ReferenceErrors at runtime. + +Injecting `var NAME = N;` at the IIFE top fixes runtime but gets DCE'd by +terser in the production browser dist. The robust fix is to inline the +literal at each usage site so there's no identifier for terser to drop. + +The `xdr.const("NAME", N);` declaration itself is left untouched: the NAME +there is a string literal (preceded by a quote), so the negative lookbehind +below skips it. Constants only referenced via `xdr.lookup("NAME")` string +lookups are likewise untouched. +""" +import re +import pathlib +import sys + + +def inline_consts(path: pathlib.Path) -> int: + s = path.read_text() + consts = dict(re.findall( + r'xdr\.const\("([A-Z][A-Z0-9_]+)",\s*(0x[0-9a-fA-F]+|\d+)\);', s + )) + n_replaced = 0 + for name, value in consts.items(): + # Replace bare identifier (not preceded by quote or word char, + # not followed by quote or word char). This skips string literals + # like "NAME" and xdr.lookup("NAME"), so the xdr.const(...) + # declaration's string name is preserved. + new_s, count = re.subn( + rf'(? 0: + s = new_s + n_replaced += count + path.write_text(s) + return n_replaced + + +if __name__ == "__main__": + files = sys.argv[1:] or [ + "src/generated/curr_generated.js", + "src/generated/next_generated.js", + ] + for f in files: + p = pathlib.Path(f) + n = inline_consts(p) + print(f"{f}: inlined {n} bare-identifier const reference(s)") diff --git a/src/generated/curr_generated.js b/src/generated/curr_generated.js index d4e763ce..9df94fe7 100644 --- a/src/generated/curr_generated.js +++ b/src/generated/curr_generated.js @@ -9,13 +9,6 @@ import * as XDR from '@stellar/js-xdr'; var types = XDR.config(xdr => { -// Workaround for https://github.com/stellar/xdrgen/issues/152 -// -// The "correct" way would be to replace bare instances of each constant with -// xdr.lookup("..."), but that's more error-prone. -const SCSYMBOL_LIMIT = 32; -const SC_SPEC_DOC_LIMIT = 1024; - // === xdr source ============================================================ // // typedef opaque Value<>; @@ -187,7 +180,7 @@ xdr.union("ScpStatementPledges", { // { // NodeID nodeID; // v // uint64 slotIndex; // i -// +// // union switch (SCPStatementType type) // { // case SCP_ST_PREPARE: @@ -332,10 +325,10 @@ xdr.enum("AssetType", { // { // case ASSET_TYPE_CREDIT_ALPHANUM4: // AssetCode4 assetCode4; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM12: // AssetCode12 assetCode12; -// +// // // add other asset types here in the future // }; // @@ -387,13 +380,13 @@ xdr.struct("AlphaNum12", [ // { // case ASSET_TYPE_NATIVE: // Not credit // void; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM4: // AlphaNum4 alphaNum4; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM12: // AlphaNum12 alphaNum12; -// +// // // add other asset types here in the future // }; // @@ -506,7 +499,7 @@ xdr.struct("Signer", [ // // enum AccountFlags // { // masks for each flag -// +// // // Flags set on issuer accounts // // TrustLines are created with authorized set to "false" requiring // // the issuer to set it for each TrustLine @@ -532,21 +525,21 @@ xdr.enum("AccountFlags", { // === xdr source ============================================================ // -// const MASK_ACCOUNT_FLAGS = 0x7; +// const 0x7 = 0x7; // // =========================================================================== xdr.const("MASK_ACCOUNT_FLAGS", 0x7); // === xdr source ============================================================ // -// const MASK_ACCOUNT_FLAGS_V17 = 0xF; +// const 0xF = 0xF; // // =========================================================================== xdr.const("MASK_ACCOUNT_FLAGS_V17", 0xF); // === xdr source ============================================================ // -// const MAX_SIGNERS = 20; +// const 20 = 20; // // =========================================================================== xdr.const("MAX_SIGNERS", 20); @@ -565,10 +558,10 @@ xdr.typedef("SponsorshipDescriptor", xdr.option(xdr.lookup("AccountId"))); // // We can use this to add more fields, or because it is first, to // // change AccountEntryExtensionV3 into a union. // ExtensionPoint ext; -// +// // // Ledger number at which `seqNum` took on its present value. // uint32 seqLedger; -// +// // // Time at which `seqNum` took on its present value. // TimePoint seqTime; // }; @@ -609,8 +602,8 @@ xdr.union("AccountEntryExtensionV2Ext", { // { // uint32 numSponsored; // uint32 numSponsoring; -// SponsorshipDescriptor signerSponsoringIDs; -// +// SponsorshipDescriptor signerSponsoringIDs<20>; +// // union switch (int v) // { // case 0: @@ -657,7 +650,7 @@ xdr.union("AccountEntryExtensionV1Ext", { // struct AccountEntryExtensionV1 // { // Liabilities liabilities; -// +// // union switch (int v) // { // case 0: @@ -708,15 +701,15 @@ xdr.union("AccountEntryExt", { // // drives the reserve // AccountID* inflationDest; // Account to vote for during inflation // uint32 flags; // see AccountFlags -// +// // string32 homeDomain; // can be used for reverse federation and memo lookup -// +// // // fields used for signatures // // thresholds stores unsigned bytes: [weight of master|low|medium|high] // Thresholds thresholds; -// -// Signer signers; // possible signers for this account -// +// +// Signer signers<20>; // possible signers for this account +// // // reserved for future use // union switch (int v) // { @@ -765,21 +758,21 @@ xdr.enum("TrustLineFlags", { // === xdr source ============================================================ // -// const MASK_TRUSTLINE_FLAGS = 1; +// const 1 = 1; // // =========================================================================== xdr.const("MASK_TRUSTLINE_FLAGS", 1); // === xdr source ============================================================ // -// const MASK_TRUSTLINE_FLAGS_V13 = 3; +// const 3 = 3; // // =========================================================================== xdr.const("MASK_TRUSTLINE_FLAGS_V13", 3); // === xdr source ============================================================ // -// const MASK_TRUSTLINE_FLAGS_V17 = 7; +// const 7 = 7; // // =========================================================================== xdr.const("MASK_TRUSTLINE_FLAGS_V17", 7); @@ -802,16 +795,16 @@ xdr.enum("LiquidityPoolType", { // { // case ASSET_TYPE_NATIVE: // Not credit // void; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM4: // AlphaNum4 alphaNum4; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM12: // AlphaNum12 alphaNum12; -// +// // case ASSET_TYPE_POOL_SHARE: // PoolID liquidityPoolID; -// +// // // add other asset types here in the future // }; // @@ -856,7 +849,7 @@ xdr.union("TrustLineEntryExtensionV2Ext", { // struct TrustLineEntryExtensionV2 // { // int32 liquidityPoolUseCount; -// +// // union switch (int v) // { // case 0: @@ -899,7 +892,7 @@ xdr.union("TrustLineEntryV1Ext", { // struct // { // Liabilities liabilities; -// +// // union switch (int v) // { // case 0: @@ -926,7 +919,7 @@ xdr.struct("TrustLineEntryV1", [ // struct // { // Liabilities liabilities; -// +// // union switch (int v) // { // case 0: @@ -959,10 +952,10 @@ xdr.union("TrustLineEntryExt", { // TrustLineAsset asset; // type of asset (with issuer) // int64 balance; // how much of this asset the user has. // // Asset defines the unit for this; -// +// // int64 limit; // balance cannot be above this // uint32 flags; // see TrustLineFlags -// +// // // reserved for future use // union switch (int v) // { @@ -972,7 +965,7 @@ xdr.union("TrustLineEntryExt", { // struct // { // Liabilities liabilities; -// +// // union switch (int v) // { // case 0: @@ -1012,7 +1005,7 @@ xdr.enum("OfferEntryFlags", { // === xdr source ============================================================ // -// const MASK_OFFERENTRY_FLAGS = 1; +// const 1 = 1; // // =========================================================================== xdr.const("MASK_OFFERENTRY_FLAGS", 1); @@ -1045,7 +1038,7 @@ xdr.union("OfferEntryExt", { // Asset selling; // A // Asset buying; // B // int64 amount; // amount of A -// +// // /* price for this offer: // price of A in terms of B // price=AmountB/AmountA=priceNumerator/priceDenominator @@ -1053,7 +1046,7 @@ xdr.union("OfferEntryExt", { // */ // Price price; // uint32 flags; // see OfferEntryFlags -// +// // // reserved for future use // union switch (int v) // { @@ -1101,7 +1094,7 @@ xdr.union("DataEntryExt", { // AccountID accountID; // account this data belongs to // string64 dataName; // DataValue dataValue; -// +// // // reserved for future use // union switch (int v) // { @@ -1247,7 +1240,7 @@ xdr.enum("ClaimableBalanceFlags", { // === xdr source ============================================================ // -// const MASK_CLAIMABLE_BALANCE_FLAGS = 0x1; +// const 0x1 = 0x1; // // =========================================================================== xdr.const("MASK_CLAIMABLE_BALANCE_FLAGS", 0x1); @@ -1281,7 +1274,7 @@ xdr.union("ClaimableBalanceEntryExtensionV1Ext", { // void; // } // ext; -// +// // uint32 flags; // see ClaimableBalanceFlags // }; // @@ -1320,16 +1313,16 @@ xdr.union("ClaimableBalanceEntryExt", { // { // // Unique identifier for this ClaimableBalanceEntry // ClaimableBalanceID balanceID; -// +// // // List of claimants with associated predicate // Claimant claimants<10>; -// +// // // Any asset including native // Asset asset; -// +// // // Amount of asset // int64 amount; -// +// // // reserved for future use // union switch (int v) // { @@ -1371,7 +1364,7 @@ xdr.struct("LiquidityPoolConstantProductParameters", [ // struct // { // LiquidityPoolConstantProductParameters params; -// +// // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued @@ -1396,7 +1389,7 @@ xdr.struct("LiquidityPoolEntryConstantProduct", [ // struct // { // LiquidityPoolConstantProductParameters params; -// +// // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued @@ -1422,14 +1415,14 @@ xdr.union("LiquidityPoolEntryBody", { // struct LiquidityPoolEntry // { // PoolID liquidityPoolID; -// +// // union switch (LiquidityPoolType type) // { // case LIQUIDITY_POOL_CONSTANT_PRODUCT: // struct // { // LiquidityPoolConstantProductParameters params; -// +// // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued @@ -1463,7 +1456,7 @@ xdr.enum("ContractDataDurability", { // // struct ContractDataEntry { // ExtensionPoint ext; -// +// // SCAddress contract; // SCVal key; // ContractDataDurability durability; @@ -1565,7 +1558,7 @@ xdr.union("ContractCodeEntryExt", { // ContractCodeCostInputs costInputs; // } v1; // } ext; -// +// // Hash hash; // opaque code<>; // }; @@ -1615,7 +1608,7 @@ xdr.union("LedgerEntryExtensionV1Ext", { // struct LedgerEntryExtensionV1 // { // SponsorshipDescriptor sponsoringID; -// +// // union switch (int v) // { // case 0: @@ -1714,7 +1707,7 @@ xdr.union("LedgerEntryExt", { // struct LedgerEntry // { // uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed -// +// // union switch (LedgerEntryType type) // { // case ACCOUNT: @@ -1739,7 +1732,7 @@ xdr.union("LedgerEntryExt", { // TTLEntry ttl; // } // data; -// +// // // reserved for future use // union switch (int v) // { @@ -1898,34 +1891,34 @@ xdr.struct("LedgerKeyTtl", [ // { // AccountID accountID; // } account; -// +// // case TRUSTLINE: // struct // { // AccountID accountID; // TrustLineAsset asset; // } trustLine; -// +// // case OFFER: // struct // { // AccountID sellerID; // int64 offerID; // } offer; -// +// // case DATA: // struct // { // AccountID accountID; // string64 dataName; // } data; -// +// // case CLAIMABLE_BALANCE: // struct // { // ClaimableBalanceID balanceID; // } claimableBalance; -// +// // case LIQUIDITY_POOL: // struct // { @@ -1999,7 +1992,8 @@ xdr.union("LedgerKey", { // ENVELOPE_TYPE_OP_ID = 6, // ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7, // ENVELOPE_TYPE_CONTRACT_ID = 8, -// ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9 +// ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9, +// ENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESS = 10 // }; // // =========================================================================== @@ -2014,6 +2008,7 @@ xdr.enum("EnvelopeType", { envelopeTypePoolRevokeOpId: 7, envelopeTypeContractId: 8, envelopeTypeSorobanAuthorization: 9, + envelopeTypeSorobanAuthorizationWithAddress: 10, }); // === xdr source ============================================================ @@ -2097,7 +2092,7 @@ xdr.union("BucketMetadataExt", { // { // // Indicates the protocol version used to create / merge this bucket. // uint32 ledgerVersion; -// +// // // reserved for future use // union switch (int v) // { @@ -2122,7 +2117,7 @@ xdr.struct("BucketMetadata", [ // case LIVEENTRY: // case INITENTRY: // LedgerEntry liveEntry; -// +// // case DEADENTRY: // LedgerKey deadEntry; // case METAENTRY: @@ -2152,7 +2147,7 @@ xdr.union("BucketEntry", { // { // case HOT_ARCHIVE_ARCHIVED: // LedgerEntry archivedEntry; -// +// // case HOT_ARCHIVE_LIVE: // LedgerKey key; // case HOT_ARCHIVE_METAENTRY: @@ -2239,14 +2234,14 @@ xdr.union("StellarValueExt", { // { // Hash txSetHash; // transaction set to apply to previous ledger // TimePoint closeTime; // network close time -// +// // // upgrades to apply to the previous ledger (usually empty) // // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop // // unknown steps during consensus if needed. // // see notes below on 'LedgerUpgrade' for more detail // // max size is dictated by number of upgrade types (+ room for future) // UpgradeType upgrades<6>; -// +// // // reserved for future use // union switch (StellarValueType v) // { @@ -2268,7 +2263,7 @@ xdr.struct("StellarValue", [ // === xdr source ============================================================ // -// const MASK_LEDGER_HEADER_FLAGS = 0x7; +// const 0x7 = 0x7; // // =========================================================================== xdr.const("MASK_LEDGER_HEADER_FLAGS", 0x7); @@ -2313,7 +2308,7 @@ xdr.union("LedgerHeaderExtensionV1Ext", { // struct LedgerHeaderExtensionV1 // { // uint32 flags; // LedgerHeaderFlags -// +// // union switch (int v) // { // case 0: @@ -2360,28 +2355,28 @@ xdr.union("LedgerHeaderExt", { // StellarValue scpValue; // what consensus agreed to // Hash txSetResultHash; // the TransactionResultSet that led to this ledger // Hash bucketListHash; // hash of the ledger state -// +// // uint32 ledgerSeq; // sequence number of this ledger -// +// // int64 totalCoins; // total number of stroops in existence. // // 10,000,000 stroops in 1 XLM -// +// // int64 feePool; // fees burned since last inflation run // uint32 inflationSeq; // inflation sequence number -// +// // uint64 idPool; // last used global ID, used for generating objects -// +// // uint32 baseFee; // base fee per operation in stroops // uint32 baseReserve; // account base reserve in stroops -// +// // uint32 maxTxSetSize; // maximum size a transaction set can be -// +// // Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back // // in time without walking the chain back ledger by ledger // // each slot contains the oldest ledger that is mod of // // either 50 5000 50000 or 500000 depending on index // // skipList[0] mod(50), skipList[1] mod(5000), etc -// +// // // reserved for future use // union switch (int v) // { @@ -2718,7 +2713,7 @@ xdr.union("TransactionHistoryEntryExt", { // { // uint32 ledgerSeq; // TransactionSet txSet; -// +// // // when v != 0, txSet must be empty // union switch (int v) // { @@ -2762,7 +2757,7 @@ xdr.union("TransactionHistoryResultEntryExt", { // { // uint32 ledgerSeq; // TransactionResultSet txResultSet; -// +// // // reserved for future use // union switch (int v) // { @@ -2804,7 +2799,7 @@ xdr.union("LedgerHeaderHistoryEntryExt", { // { // Hash hash; // LedgerHeader header; -// +// // // reserved for future use // union switch (int v) // { @@ -3037,10 +3032,10 @@ xdr.union("ContractEventBody", { // // We can use this to add more fields, or because it // // is first, to change ContractEvent into a union. // ExtensionPoint ext; -// +// // ContractID* contractID; // ContractEventType type; -// +// // union switch (int v) // { // case 0: @@ -3080,22 +3075,22 @@ xdr.struct("DiagnosticEvent", [ // struct SorobanTransactionMetaExtV1 // { // ExtensionPoint ext; -// +// // // The following are the components of the overall Soroban resource fee // // charged for the transaction. // // The following relation holds: // // `resourceFeeCharged = totalNonRefundableResourceFeeCharged + totalRefundableResourceFeeCharged` -// // where `resourceFeeCharged` is the overall fee charged for the -// // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee` +// // where `resourceFeeCharged` is the overall fee charged for the +// // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee` // // i.e.we never charge more than the declared resource fee. -// // The inclusion fee for charged the Soroban transaction can be found using +// // The inclusion fee for charged the Soroban transaction can be found using // // the following equation: // // `result.feeCharged = resourceFeeCharged + inclusionFeeCharged`. -// +// // // Total amount (in stroops) that has been charged for non-refundable // // Soroban resources. // // Non-refundable resources are charged based on the usage declared in -// // the transaction envelope (such as `instructions`, `readBytes` etc.) and +// // the transaction envelope (such as `instructions`, `readBytes` etc.) and // // is charged regardless of the success of the transaction. // int64 totalNonRefundableResourceFeeCharged; // // Total amount (in stroops) that has been charged for refundable @@ -3107,7 +3102,7 @@ xdr.struct("DiagnosticEvent", [ // // transactions, this will be `0` for failed transactions. // int64 totalRefundableResourceFeeCharged; // // Amount (in stroops) that has been charged for rent. -// // This is a part of `totalNonRefundableResourceFeeCharged`. +// // This is a part of `totalRefundableResourceFeeCharged`. // int64 rentFeeCharged; // }; // @@ -3144,14 +3139,14 @@ xdr.union("SorobanTransactionMetaExt", { // === xdr source ============================================================ // -// struct SorobanTransactionMeta +// struct SorobanTransactionMeta // { // SorobanTransactionMetaExt ext; -// +// // ContractEvent events<>; // custom events populated by the // // contracts themselves. // SCVal returnValue; // return value of the host fn invocation -// +// // // Diagnostics events that are not hashed. // // This will contain all contract and diagnostic events. Even ones // // that were emitted in a failed contract call. @@ -3171,13 +3166,13 @@ xdr.struct("SorobanTransactionMeta", [ // struct TransactionMetaV3 // { // ExtensionPoint ext; -// +// // LedgerEntryChanges txChangesBefore; // tx level changes before operations // // are applied if any // OperationMeta operations<>; // meta for each operation // LedgerEntryChanges txChangesAfter; // tx level changes after operations are // // applied if any -// SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for +// SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for // // Soroban transactions). // }; // @@ -3195,9 +3190,9 @@ xdr.struct("TransactionMetaV3", [ // struct OperationMetaV2 // { // ExtensionPoint ext; -// +// // LedgerEntryChanges changes; -// +// // ContractEvent events<>; // }; // @@ -3213,7 +3208,7 @@ xdr.struct("OperationMetaV2", [ // struct SorobanTransactionMetaV2 // { // SorobanTransactionMetaExt ext; -// +// // SCVal* returnValue; // }; // @@ -3226,13 +3221,13 @@ xdr.struct("SorobanTransactionMetaV2", [ // === xdr source ============================================================ // // enum TransactionEventStage { -// // The event has happened before any one of the transactions has its +// // The event has happened before any one of the transactions has its // // operations applied. // TRANSACTION_EVENT_STAGE_BEFORE_ALL_TXS = 0, // // The event has happened immediately after operations of the transaction // // have been applied. // TRANSACTION_EVENT_STAGE_AFTER_TX = 1, -// // The event has happened after every transaction had its operations +// // The event has happened after every transaction had its operations // // applied. // TRANSACTION_EVENT_STAGE_AFTER_ALL_TXS = 2 // }; @@ -3246,7 +3241,7 @@ xdr.enum("TransactionEventStage", { // === xdr source ============================================================ // -// struct TransactionEvent { +// struct TransactionEvent { // TransactionEventStage stage; // Stage at which an event has occurred. // ContractEvent event; // The contract event that has occurred. // }; @@ -3262,7 +3257,7 @@ xdr.struct("TransactionEvent", [ // struct TransactionMetaV4 // { // ExtensionPoint ext; -// +// // LedgerEntryChanges txChangesBefore; // tx level changes before operations // // are applied if any // OperationMetaV2 operations<>; // meta for each operation @@ -3270,7 +3265,7 @@ xdr.struct("TransactionEvent", [ // // applied if any // SorobanTransactionMetaV2* sorobanMeta; // Soroban-specific meta (only for // // Soroban transactions). -// +// // TransactionEvent events<>; // Used for transaction-level events (like fee payment) // DiagnosticEvent diagnosticEvents<>; // Used for all diagnostic information // }; @@ -3357,11 +3352,11 @@ xdr.struct("TransactionResultMeta", [ // struct TransactionResultMetaV1 // { // ExtensionPoint ext; -// +// // TransactionResultPair result; // LedgerEntryChanges feeProcessing; // TransactionMeta txApplyProcessing; -// +// // LedgerEntryChanges postTxApplyFeeProcessing; // }; // @@ -3395,15 +3390,15 @@ xdr.struct("UpgradeEntryMeta", [ // LedgerHeaderHistoryEntry ledgerHeader; // // NB: txSet is sorted in "Hash order" // TransactionSet 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<>; // }; @@ -3459,29 +3454,29 @@ xdr.union("LedgerCloseMetaExt", { // struct LedgerCloseMetaV1 // { // LedgerCloseMetaExt ext; -// +// // 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<>; -// +// // // Size in bytes of live Soroban state, to support downstream // // systems calculating storage fees correctly. // uint64 totalByteSizeOfLiveSorobanState; -// +// // // TTL and data/code keys that have been evicted at this ledger. // LedgerKey evictedKeys<>; -// +// // // Maintained for backwards compatibility, should never be populated. // LedgerEntry unused<>; // }; @@ -3504,26 +3499,26 @@ xdr.struct("LedgerCloseMetaV1", [ // struct LedgerCloseMetaV2 // { // LedgerCloseMetaExt ext; -// +// // LedgerHeaderHistoryEntry ledgerHeader; -// +// // GeneralizedTransactionSet txSet; -// +// // // NB: transactions are sorted in apply order here // // fees for all transactions are processed first // // followed by applying transactions // TransactionResultMetaV1 txProcessing<>; -// +// // // upgrades are applied last // UpgradeEntryMeta upgradesProcessing<>; -// +// // // other misc information attached to the ledger close // SCPHistoryEntry scpInfo<>; -// +// // // Size in bytes of live Soroban state, to support downstream // // systems calculating storage fees correctly. // uint64 totalByteSizeOfLiveSorobanState; -// +// // // TTL and data/code keys that have been evicted at this ledger. // LedgerKey evictedKeys<>; // }; @@ -3674,7 +3669,7 @@ xdr.struct("Hello", [ // === xdr source ============================================================ // -// const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200; +// const 200 = 200; // // =========================================================================== xdr.const("AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED", 200); @@ -3760,33 +3755,33 @@ xdr.struct("PeerAddress", [ // AUTH = 2, // DONT_HAVE = 3, // // GET_PEERS (4) is deprecated -// +// // PEERS = 5, -// +// // GET_TX_SET = 6, // gets a particular txset by hash // TX_SET = 7, // GENERALIZED_TX_SET = 17, -// +// // TRANSACTION = 8, // pass on a tx you have heard about -// +// // // SCP // GET_SCP_QUORUMSET = 9, // SCP_QUORUMSET = 10, // SCP_MESSAGE = 11, // GET_SCP_STATE = 12, -// +// // // new messages // HELLO = 13, -// +// // // SURVEY_REQUEST (14) removed and replaced by TIME_SLICED_SURVEY_REQUEST // // SURVEY_RESPONSE (15) removed and replaced by TIME_SLICED_SURVEY_RESPONSE -// +// // SEND_MORE = 16, // SEND_MORE_EXTENDED = 20, -// +// // FLOOD_ADVERT = 18, // FLOOD_DEMAND = 19, -// +// // TIME_SLICED_SURVEY_REQUEST = 21, // TIME_SLICED_SURVEY_RESPONSE = 22, // TIME_SLICED_SURVEY_START_COLLECTING = 23, @@ -4034,12 +4029,12 @@ xdr.struct("SignedTimeSlicedSurveyResponseMessage", [ // uint64 bytesRead; // uint64 bytesWritten; // uint64 secondsConnected; -// +// // uint64 uniqueFloodBytesRecv; // uint64 duplicateFloodBytesRecv; // uint64 uniqueFetchBytesRecv; // uint64 duplicateFetchBytesRecv; -// +// // uint64 uniqueFloodMessageRecv; // uint64 duplicateFloodMessageRecv; // uint64 uniqueFetchMessageRecv; @@ -4073,14 +4068,14 @@ xdr.struct("PeerStats", [ // uint32 droppedAuthenticatedPeers; // uint32 totalInboundPeerCount; // uint32 totalOutboundPeerCount; -// +// // // SCP stats // uint32 p75SCPFirstToSelfLatencyMs; // uint32 p75SCPSelfToOtherLatencyMs; -// +// // // How many times the node lost sync in the time slice // uint32 lostSyncCount; -// +// // // Config data // bool isValidator; // uint32 maxInboundPeerCount; @@ -4160,14 +4155,14 @@ xdr.union("SurveyResponseBody", { // === xdr source ============================================================ // -// const TX_ADVERT_VECTOR_MAX_SIZE = 1000; +// const 1000 = 1000; // // =========================================================================== xdr.const("TX_ADVERT_VECTOR_MAX_SIZE", 1000); // === xdr source ============================================================ // -// typedef Hash TxAdvertVector; +// typedef Hash TxAdvertVector<1000>; // // =========================================================================== xdr.typedef("TxAdvertVector", xdr.varArray(xdr.lookup("Hash"), xdr.lookup("TX_ADVERT_VECTOR_MAX_SIZE"))); @@ -4186,14 +4181,14 @@ xdr.struct("FloodAdvert", [ // === xdr source ============================================================ // -// const TX_DEMAND_VECTOR_MAX_SIZE = 1000; +// const 1000 = 1000; // // =========================================================================== xdr.const("TX_DEMAND_VECTOR_MAX_SIZE", 1000); // === xdr source ============================================================ // -// typedef Hash TxDemandVector; +// typedef Hash TxDemandVector<1000>; // // =========================================================================== xdr.typedef("TxDemandVector", xdr.varArray(xdr.lookup("Hash"), xdr.lookup("TX_DEMAND_VECTOR_MAX_SIZE"))); @@ -4224,31 +4219,31 @@ xdr.struct("FloodDemand", [ // DontHave dontHave; // case PEERS: // PeerAddress peers<100>; -// +// // case GET_TX_SET: // uint256 txSetHash; // case TX_SET: // TransactionSet txSet; // case GENERALIZED_TX_SET: // GeneralizedTransactionSet generalizedTxSet; -// +// // case TRANSACTION: // TransactionEnvelope transaction; -// +// // case TIME_SLICED_SURVEY_REQUEST: // SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage; -// +// // case TIME_SLICED_SURVEY_RESPONSE: // SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage; -// +// // case TIME_SLICED_SURVEY_START_COLLECTING: // SignedTimeSlicedSurveyStartCollectingMessage // signedTimeSlicedSurveyStartCollectingMessage; -// +// // case TIME_SLICED_SURVEY_STOP_COLLECTING: // SignedTimeSlicedSurveyStopCollectingMessage // signedTimeSlicedSurveyStopCollectingMessage; -// +// // // SCP // case GET_SCP_QUORUMSET: // uint256 qSetHash; @@ -4364,7 +4359,7 @@ xdr.union("AuthenticatedMessage", { // === xdr source ============================================================ // -// const MAX_OPS_PER_TX = 100; +// const 100 = 100; // // =========================================================================== xdr.const("MAX_OPS_PER_TX", 100); @@ -4547,11 +4542,11 @@ xdr.struct("PaymentOp", [ // int64 sendMax; // the maximum amount of sendAsset to // // send (excluding fees). // // The operation will fail if can't be met -// +// // MuxedAccount destination; // recipient of the payment // Asset destAsset; // what they end up with // int64 destAmount; // amount they end up with -// +// // Asset path<5>; // additional hops it must go through to get there // }; // @@ -4571,13 +4566,13 @@ xdr.struct("PathPaymentStrictReceiveOp", [ // { // Asset sendAsset; // asset we pay with // int64 sendAmount; // amount of sendAsset to send (excluding fees) -// +// // MuxedAccount destination; // recipient of the payment // Asset destAsset; // what they end up with // int64 destMin; // the minimum amount of dest asset to // // be received // // The operation will fail if it can't be met -// +// // Asset path<5>; // additional hops it must go through to get there // }; // @@ -4599,7 +4594,7 @@ xdr.struct("PathPaymentStrictSendOp", [ // Asset buying; // int64 amount; // amount being sold. if set to 0, delete the offer // Price price; // price of thing being sold in terms of what you are buying -// +// // // 0=create a new offer, otherwise edit an existing offer // int64 offerID; // }; @@ -4622,7 +4617,7 @@ xdr.struct("ManageSellOfferOp", [ // int64 buyAmount; // amount being bought. if set to 0, delete the offer // Price price; // price of thing being bought in terms of what you are // // selling -// +// // // 0=create a new offer, otherwise edit an existing offer // int64 offerID; // }; @@ -4659,18 +4654,18 @@ xdr.struct("CreatePassiveSellOfferOp", [ // struct SetOptionsOp // { // AccountID* inflationDest; // sets the inflation destination -// +// // uint32* clearFlags; // which flags to clear // uint32* setFlags; // which flags to set -// +// // // account threshold manipulation // uint32* masterWeight; // weight of the master account // uint32* lowThreshold; // uint32* medThreshold; // uint32* highThreshold; -// +// // string32* homeDomain; // sets the home domain -// +// // // Add, update or remove a signer for the account // // signer is deleted if the weight is 0 // Signer* signer; @@ -4695,16 +4690,16 @@ xdr.struct("SetOptionsOp", [ // { // case ASSET_TYPE_NATIVE: // Not credit // void; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM4: // AlphaNum4 alphaNum4; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM12: // AlphaNum12 alphaNum12; -// +// // case ASSET_TYPE_POOL_SHARE: // LiquidityPoolParameters liquidityPool; -// +// // // add other asset types here in the future // }; // @@ -4730,7 +4725,7 @@ xdr.union("ChangeTrustAsset", { // struct ChangeTrustOp // { // ChangeTrustAsset line; -// +// // // if limit is set to 0, deletes the trust line // int64 limit; // }; @@ -4747,7 +4742,7 @@ xdr.struct("ChangeTrustOp", [ // { // AccountID trustor; // AssetCode asset; -// +// // // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG // uint32 authorize; // }; @@ -4915,7 +4910,7 @@ xdr.struct("ClawbackClaimableBalanceOp", [ // { // AccountID trustor; // Asset asset; -// +// // uint32 clearFlags; // which flags to clear // uint32 setFlags; // which flags to set // }; @@ -4930,7 +4925,7 @@ xdr.struct("SetTrustLineFlagsOp", [ // === xdr source ============================================================ // -// const LIQUIDITY_POOL_FEE_V18 = 30; +// const 30 = 30; // // =========================================================================== xdr.const("LIQUIDITY_POOL_FEE_V18", 30); @@ -5150,7 +5145,7 @@ xdr.enum("SorobanAuthorizedFunctionType", { // // This variant of auth payload for creating new contract instances // // doesn't allow specifying the constructor arguments, creating contracts // // with constructors that take arguments is only possible by authorizing -// // `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN` +// // `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN` // // (protocol 22+). // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: // CreateContractArgs createContractHostFn; @@ -5197,7 +5192,7 @@ xdr.struct("SorobanAuthorizedInvocation", [ // { // SCAddress address; // int64 nonce; -// uint32 signatureExpirationLedger; +// uint32 signatureExpirationLedger; // SCVal signature; // }; // @@ -5209,18 +5204,52 @@ xdr.struct("SorobanAddressCredentials", [ ["signature", xdr.lookup("ScVal")], ]); +// === xdr source ============================================================ +// +// struct SorobanDelegateSignature +// { +// SCAddress address; +// SCVal signature; +// SorobanDelegateSignature nestedDelegates<>; +// }; +// +// =========================================================================== +xdr.struct("SorobanDelegateSignature", [ + ["address", xdr.lookup("ScAddress")], + ["signature", xdr.lookup("ScVal")], + ["nestedDelegates", xdr.varArray(xdr.lookup("SorobanDelegateSignature"), 2147483647)], +]); + +// === xdr source ============================================================ +// +// struct SorobanAddressCredentialsWithDelegates +// { +// SorobanAddressCredentials addressCredentials; +// SorobanDelegateSignature delegates<>; +// }; +// +// =========================================================================== +xdr.struct("SorobanAddressCredentialsWithDelegates", [ + ["addressCredentials", xdr.lookup("SorobanAddressCredentials")], + ["delegates", xdr.varArray(xdr.lookup("SorobanDelegateSignature"), 2147483647)], +]); + // === xdr source ============================================================ // // enum SorobanCredentialsType // { // SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0, -// SOROBAN_CREDENTIALS_ADDRESS = 1 +// SOROBAN_CREDENTIALS_ADDRESS = 1, +// SOROBAN_CREDENTIALS_ADDRESS_V2 = 2, +// SOROBAN_CREDENTIALS_ADDRESS_WITH_DELEGATES = 3 // }; // // =========================================================================== xdr.enum("SorobanCredentialsType", { sorobanCredentialsSourceAccount: 0, sorobanCredentialsAddress: 1, + sorobanCredentialsAddressV2: 2, + sorobanCredentialsAddressWithDelegates: 3, }); // === xdr source ============================================================ @@ -5231,6 +5260,10 @@ xdr.enum("SorobanCredentialsType", { // void; // case SOROBAN_CREDENTIALS_ADDRESS: // SorobanAddressCredentials address; +// case SOROBAN_CREDENTIALS_ADDRESS_V2: +// SorobanAddressCredentials addressV2; +// case SOROBAN_CREDENTIALS_ADDRESS_WITH_DELEGATES: +// SorobanAddressCredentialsWithDelegates addressWithDelegates; // }; // // =========================================================================== @@ -5240,9 +5273,13 @@ xdr.union("SorobanCredentials", { switches: [ ["sorobanCredentialsSourceAccount", xdr.void()], ["sorobanCredentialsAddress", "address"], + ["sorobanCredentialsAddressV2", "addressV2"], + ["sorobanCredentialsAddressWithDelegates", "addressWithDelegates"], ], arms: { address: xdr.lookup("SorobanAddressCredentials"), + addressV2: xdr.lookup("SorobanAddressCredentials"), + addressWithDelegates: xdr.lookup("SorobanAddressCredentialsWithDelegates"), }, }); @@ -5439,7 +5476,7 @@ xdr.union("OperationBody", { // // if not set, the runtime defaults to "sourceAccount" specified at // // the transaction level // MuxedAccount* sourceAccount; -// +// // union switch (OperationType type) // { // case CREATE_ACCOUNT: @@ -5527,7 +5564,7 @@ xdr.struct("HashIdPreimageOperationId", [ // struct // { // AccountID sourceAccount; -// SequenceNumber seqNum; +// SequenceNumber seqNum; // uint32 opNum; // PoolID liquidityPoolID; // Asset asset; @@ -5574,6 +5611,26 @@ xdr.struct("HashIdPreimageSorobanAuthorization", [ ["invocation", xdr.lookup("SorobanAuthorizedInvocation")], ]); +// === xdr source ============================================================ +// +// struct +// { +// Hash networkID; +// int64 nonce; +// uint32 signatureExpirationLedger; +// SCAddress address; +// SorobanAuthorizedInvocation invocation; +// } +// +// =========================================================================== +xdr.struct("HashIdPreimageSorobanAuthorizationWithAddress", [ + ["networkId", xdr.lookup("Hash")], + ["nonce", xdr.lookup("Int64")], + ["signatureExpirationLedger", xdr.lookup("Uint32")], + ["address", xdr.lookup("ScAddress")], + ["invocation", xdr.lookup("SorobanAuthorizedInvocation")], +]); + // === xdr source ============================================================ // // union HashIDPreimage switch (EnvelopeType type) @@ -5589,7 +5646,7 @@ xdr.struct("HashIdPreimageSorobanAuthorization", [ // struct // { // AccountID sourceAccount; -// SequenceNumber seqNum; +// SequenceNumber seqNum; // uint32 opNum; // PoolID liquidityPoolID; // Asset asset; @@ -5608,6 +5665,15 @@ xdr.struct("HashIdPreimageSorobanAuthorization", [ // uint32 signatureExpirationLedger; // SorobanAuthorizedInvocation invocation; // } sorobanAuthorization; +// case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESS: +// struct +// { +// Hash networkID; +// int64 nonce; +// uint32 signatureExpirationLedger; +// SCAddress address; +// SorobanAuthorizedInvocation invocation; +// } sorobanAuthorizationWithAddress; // }; // // =========================================================================== @@ -5619,12 +5685,14 @@ xdr.union("HashIdPreimage", { ["envelopeTypePoolRevokeOpId", "revokeId"], ["envelopeTypeContractId", "contractId"], ["envelopeTypeSorobanAuthorization", "sorobanAuthorization"], + ["envelopeTypeSorobanAuthorizationWithAddress", "sorobanAuthorizationWithAddress"], ], arms: { operationId: xdr.lookup("HashIdPreimageOperationId"), revokeId: xdr.lookup("HashIdPreimageRevokeId"), contractId: xdr.lookup("HashIdPreimageContractId"), sorobanAuthorization: xdr.lookup("HashIdPreimageSorobanAuthorization"), + sorobanAuthorizationWithAddress: xdr.lookup("HashIdPreimageSorobanAuthorizationWithAddress"), }, }); @@ -5716,12 +5784,12 @@ xdr.struct("LedgerBounds", [ // struct PreconditionsV2 // { // TimeBounds* timeBounds; -// +// // // Transaction only valid for ledger numbers n such that // // minLedger <= n < maxLedger (if maxLedger == 0, then // // only minLedger is checked) // LedgerBounds* ledgerBounds; -// +// // // If NULL, only valid when sourceAccount's sequence number // // is seqNum - 1. Otherwise, valid when sourceAccount's // // sequence number n satisfies minSeqNum <= n < tx.seqNum. @@ -5729,16 +5797,16 @@ xdr.struct("LedgerBounds", [ // // is always raised to tx.seqNum, and a transaction is not // // valid if tx.seqNum is too high to ensure replay protection. // SequenceNumber* minSeqNum; -// +// // // For the transaction to be valid, the current ledger time must // // be at least minSeqAge greater than sourceAccount's seqTime. // Duration minSeqAge; -// +// // // For the transaction to be valid, the current ledger number // // must be at least minSeqLedgerGap greater than sourceAccount's // // seqLedger. // uint32 minSeqLedgerGap; -// +// // // For the transaction to be valid, there must be a signature // // corresponding to every Signer in this array, even if the // // signature is not otherwise required by the sourceAccount or @@ -5816,12 +5884,12 @@ xdr.struct("LedgerFootprint", [ // === xdr source ============================================================ // // struct SorobanResources -// { +// { // // The ledger footprint of the transaction. // LedgerFootprint footprint; // // The maximum number of instructions this transaction can use -// uint32 instructions; -// +// uint32 instructions; +// // // The maximum number of bytes this transaction can read from disk backed entries // uint32 diskReadBytes; // // The maximum number of bytes this transaction can write to ledger @@ -5887,7 +5955,7 @@ xdr.union("SorobanTransactionDataExt", { // } ext; // SorobanResources resources; // // Amount of the transaction `fee` allocated to the Soroban resource fees. -// // The fraction of `resourceFee` corresponding to `resources` specified +// // 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 @@ -5933,7 +6001,7 @@ xdr.union("TransactionV0Ext", { // SequenceNumber seqNum; // TimeBounds* timeBounds; // Memo memo; -// Operation operations; +// Operation operations<100>; // union switch (int v) // { // case 0: @@ -5998,20 +6066,20 @@ xdr.union("TransactionExt", { // { // // account used to run the transaction // MuxedAccount sourceAccount; -// +// // // the fee the sourceAccount will pay // uint32 fee; -// +// // // sequence number to consume in the account // SequenceNumber seqNum; -// +// // // validity conditions // Preconditions cond; -// +// // Memo memo; -// -// Operation operations; -// +// +// Operation operations<100>; +// // union switch (int v) // { // case 0: @@ -6230,11 +6298,11 @@ xdr.enum("ClaimAtomType", { // // emitted to identify the offer // uint256 sellerEd25519; // Account that owns the offer // int64 offerID; -// +// // // amount and asset taken from the owner // Asset assetSold; // int64 amountSold; -// +// // // amount and asset sent to the owner // Asset assetBought; // int64 amountBought; @@ -6257,11 +6325,11 @@ xdr.struct("ClaimOfferAtomV0", [ // // emitted to identify the offer // AccountID sellerID; // Account that owns the offer // int64 offerID; -// +// // // amount and asset taken from the owner // Asset assetSold; // int64 amountSold; -// +// // // amount and asset sent to the owner // Asset assetBought; // int64 amountBought; @@ -6282,11 +6350,11 @@ xdr.struct("ClaimOfferAtom", [ // struct ClaimLiquidityAtom // { // PoolID liquidityPoolID; -// +// // // amount and asset taken from the pool // Asset assetSold; // int64 amountSold; -// +// // // amount and asset sent to the pool // Asset assetBought; // int64 amountBought; @@ -6335,7 +6403,7 @@ xdr.union("ClaimAtom", { // { // // codes considered as "success" for the operation // CREATE_ACCOUNT_SUCCESS = 0, // account was created -// +// // // codes considered as "failure" for the operation // CREATE_ACCOUNT_MALFORMED = -1, // invalid destination // CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account @@ -6387,7 +6455,7 @@ xdr.union("CreateAccountResult", { // { // // codes considered as "success" for the operation // PAYMENT_SUCCESS = 0, // payment successfully completed -// +// // // codes considered as "failure" for the operation // PAYMENT_MALFORMED = -1, // bad input // PAYMENT_UNDERFUNDED = -2, // not enough funds in source account @@ -6458,7 +6526,7 @@ xdr.union("PaymentResult", { // { // // codes considered as "success" for the operation // PATH_PAYMENT_STRICT_RECEIVE_SUCCESS = 0, // success -// +// // // codes considered as "failure" for the operation // PATH_PAYMENT_STRICT_RECEIVE_MALFORMED = -1, // bad input // PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED = @@ -6589,7 +6657,7 @@ xdr.union("PathPaymentStrictReceiveResult", { // { // // codes considered as "success" for the operation // PATH_PAYMENT_STRICT_SEND_SUCCESS = 0, // success -// +// // // codes considered as "failure" for the operation // PATH_PAYMENT_STRICT_SEND_MALFORMED = -1, // bad input // PATH_PAYMENT_STRICT_SEND_UNDERFUNDED = @@ -6702,7 +6770,7 @@ xdr.union("PathPaymentStrictSendResult", { // { // // codes considered as "success" for the operation // MANAGE_SELL_OFFER_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // MANAGE_SELL_OFFER_MALFORMED = -1, // generated offer would be invalid // MANAGE_SELL_OFFER_SELL_NO_TRUST = @@ -6716,11 +6784,11 @@ xdr.union("PathPaymentStrictSendResult", { // -8, // would cross an offer from the same user // MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling // MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying -// +// // // update errors // MANAGE_SELL_OFFER_NOT_FOUND = // -11, // offerID does not match an existing offer -// +// // MANAGE_SELL_OFFER_LOW_RESERVE = // -12 // not enough funds to create a new Offer // }; @@ -6789,7 +6857,7 @@ xdr.union("ManageOfferSuccessResultOffer", { // { // // offers that got claimed while creating this offer // ClaimAtom offersClaimed<>; -// +// // union switch (ManageOfferEffect effect) // { // case MANAGE_OFFER_CREATED: @@ -6858,7 +6926,7 @@ xdr.union("ManageSellOfferResult", { // { // // codes considered as "success" for the operation // MANAGE_BUY_OFFER_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // MANAGE_BUY_OFFER_MALFORMED = -1, // generated offer would be invalid // MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling @@ -6870,11 +6938,11 @@ xdr.union("ManageSellOfferResult", { // MANAGE_BUY_OFFER_CROSS_SELF = -8, // would cross an offer from the same user // MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling // MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying -// +// // // update errors // MANAGE_BUY_OFFER_NOT_FOUND = // -11, // offerID does not match an existing offer -// +// // MANAGE_BUY_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer // }; // @@ -7468,7 +7536,7 @@ xdr.union("ClaimClaimableBalanceResult", { // { // // codes considered as "success" for the operation // BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED = -1, // BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED = -2, @@ -7516,7 +7584,7 @@ xdr.union("BeginSponsoringFutureReservesResult", { // { // // codes considered as "success" for the operation // END_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED = -1 // }; @@ -7556,7 +7624,7 @@ xdr.union("EndSponsoringFutureReservesResult", { // { // // codes considered as "success" for the operation // REVOKE_SPONSORSHIP_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // REVOKE_SPONSORSHIP_DOES_NOT_EXIST = -1, // REVOKE_SPONSORSHIP_NOT_SPONSOR = -2, @@ -7611,7 +7679,7 @@ xdr.union("RevokeSponsorshipResult", { // { // // codes considered as "success" for the operation // CLAWBACK_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // CLAWBACK_MALFORMED = -1, // CLAWBACK_NOT_CLAWBACK_ENABLED = -2, @@ -7662,7 +7730,7 @@ xdr.union("ClawbackResult", { // { // // codes considered as "success" for the operation // CLAWBACK_CLAIMABLE_BALANCE_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, // CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER = -2, @@ -7710,7 +7778,7 @@ xdr.union("ClawbackClaimableBalanceResult", { // { // // codes considered as "success" for the operation // SET_TRUST_LINE_FLAGS_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // SET_TRUST_LINE_FLAGS_MALFORMED = -1, // SET_TRUST_LINE_FLAGS_NO_TRUST_LINE = -2, @@ -7766,7 +7834,7 @@ xdr.union("SetTrustLineFlagsResult", { // { // // codes considered as "success" for the operation // LIQUIDITY_POOL_DEPOSIT_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // LIQUIDITY_POOL_DEPOSIT_MALFORMED = -1, // bad input // LIQUIDITY_POOL_DEPOSIT_NO_TRUST = -2, // no trust line for one of the @@ -7779,7 +7847,7 @@ xdr.union("SetTrustLineFlagsResult", { // // have sufficient limit // LIQUIDITY_POOL_DEPOSIT_BAD_PRICE = -6, // deposit price outside bounds // LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7, // pool reserves are full -// LIQUIDITY_POOL_DEPOSIT_TRUSTLINE_FROZEN = -8 // trustline for one of the +// LIQUIDITY_POOL_DEPOSIT_TRUSTLINE_FROZEN = -8 // trustline for one of the // // assets is frozen // }; // @@ -7838,7 +7906,7 @@ xdr.union("LiquidityPoolDepositResult", { // { // // codes considered as "success" for the operation // LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input // LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the @@ -7848,7 +7916,7 @@ xdr.union("LiquidityPoolDepositResult", { // LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one // // of the assets // LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5, // didn't withdraw enough -// LIQUIDITY_POOL_WITHDRAW_TRUSTLINE_FROZEN = -6 // trustline for one of the +// LIQUIDITY_POOL_WITHDRAW_TRUSTLINE_FROZEN = -6 // trustline for one of the // // assets is frozen // }; // @@ -7901,7 +7969,7 @@ xdr.union("LiquidityPoolWithdrawResult", { // { // // codes considered as "success" for the operation // INVOKE_HOST_FUNCTION_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // INVOKE_HOST_FUNCTION_MALFORMED = -1, // INVOKE_HOST_FUNCTION_TRAPPED = -2, @@ -7957,7 +8025,7 @@ xdr.union("InvokeHostFunctionResult", { // { // // codes considered as "success" for the operation // EXTEND_FOOTPRINT_TTL_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // EXTEND_FOOTPRINT_TTL_MALFORMED = -1, // EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, @@ -8004,7 +8072,7 @@ xdr.union("ExtendFootprintTtlResult", { // { // // codes considered as "success" for the operation // RESTORE_FOOTPRINT_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // RESTORE_FOOTPRINT_MALFORMED = -1, // RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2, @@ -8050,7 +8118,7 @@ xdr.union("RestoreFootprintResult", { // enum OperationResultCode // { // opINNER = 0, // inner object result is valid -// +// // opBAD_AUTH = -1, // too few valid signatures / wrong network // opNO_ACCOUNT = -2, // source account was not found // opNOT_SUPPORTED = -3, // operation not supported at this time @@ -8290,21 +8358,21 @@ xdr.union("OperationResult", { // { // txFEE_BUMP_INNER_SUCCESS = 1, // fee bump inner transaction succeeded // txSUCCESS = 0, // all operations succeeded -// +// // txFAILED = -1, // one of the operations failed (none were applied) -// +// // txTOO_EARLY = -2, // ledger closeTime before minTime // txTOO_LATE = -3, // ledger closeTime after maxTime // txMISSING_OPERATION = -4, // no operation was specified // txBAD_SEQ = -5, // sequence number does not match source account -// +// // txBAD_AUTH = -6, // too few valid signatures / wrong network // txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve // txNO_ACCOUNT = -8, // source account not found // txINSUFFICIENT_FEE = -9, // fee is too small // txBAD_AUTH_EXTRA = -10, // unused signatures attached to transaction // txINTERNAL_ERROR = -11, // an unknown error occurred -// +// // txNOT_SUPPORTED = -12, // transaction type not supported // txFEE_BUMP_INNER_FAILED = -13, // fee bump inner transaction failed // txBAD_SPONSORSHIP = -14, // sponsorship not confirmed @@ -8420,7 +8488,7 @@ xdr.union("InnerTransactionResultExt", { // { // // Always 0. Here for binary compatibility. // int64 feeCharged; -// +// // union switch (TransactionResultCode code) // { // // txFEE_BUMP_INNER_SUCCESS is not included @@ -8447,7 +8515,7 @@ xdr.union("InnerTransactionResultExt", { // void; // } // result; -// +// // // reserved for future use // union switch (int v) // { @@ -8564,7 +8632,7 @@ xdr.union("TransactionResultExt", { // struct TransactionResult // { // int64 feeCharged; // actual fee charged for the transaction -// +// // union switch (TransactionResultCode code) // { // case txFEE_BUMP_INNER_SUCCESS: @@ -8593,7 +8661,7 @@ xdr.union("TransactionResultExt", { // void; // } // result; -// +// // // reserved for future use // union switch (int v) // { @@ -8929,10 +8997,10 @@ xdr.enum("BinaryFuseFilterType", { // struct SerializedBinaryFuseFilter // { // BinaryFuseFilterType type; -// +// // // Seed used to hash input to filter // ShortHashSeed inputHashSeed; -// +// // // Seed used for internal filter hash operations // ShortHashSeed filterSeed; // uint32 segmentLength; @@ -8940,7 +9008,7 @@ xdr.enum("BinaryFuseFilterType", { // uint32 segmentCount; // uint32 segmentCountLength; // uint32 fingerprintLength; // Length in terms of element count, not bytes -// +// // // Array of uint8_t, uint16_t, or uint32_t depending on filter type // opaque fingerprints<>; // }; @@ -9004,54 +9072,55 @@ xdr.union("ClaimableBalanceId", { // SCV_BOOL = 0, // SCV_VOID = 1, // SCV_ERROR = 2, -// +// // // 32 bits is the smallest type in WASM or XDR; no need for u8/u16. // SCV_U32 = 3, // SCV_I32 = 4, -// +// // // 64 bits is naturally supported by both WASM and XDR also. // SCV_U64 = 5, // SCV_I64 = 6, -// +// // // Time-related u64 subtypes with their own functions and formatting. // SCV_TIMEPOINT = 7, // SCV_DURATION = 8, -// +// // // 128 bits is naturally supported by Rust and we use it for Soroban // // fixed-point arithmetic prices / balances / similar "quantities". These // // are represented in XDR as a pair of 2 u64s. // SCV_U128 = 9, // SCV_I128 = 10, -// +// // // 256 bits is the size of sha256 output, ed25519 keys, and the EVM machine // // word, so for interop use we include this even though it requires a small // // amount of Rust guest and/or host library code. // SCV_U256 = 11, // SCV_I256 = 12, -// +// // // Bytes come in 3 flavors, 2 of which have meaningfully different // // formatting and validity-checking / domain-restriction. // SCV_BYTES = 13, // SCV_STRING = 14, // SCV_SYMBOL = 15, -// +// // // Vecs and maps are just polymorphic containers of other ScVals. // SCV_VEC = 16, // SCV_MAP = 17, -// +// // // Address is the universal identifier for contracts and classic // // accounts. // SCV_ADDRESS = 18, -// +// // // The following are the internal SCVal variants that are not -// // exposed to the contracts. +// // exposed to the contracts. // SCV_CONTRACT_INSTANCE = 19, -// +// // // SCV_LEDGER_KEY_CONTRACT_INSTANCE and SCV_LEDGER_KEY_NONCE are unique // // symbolic SCVals used as the key for ledger entries for a contract's // // instance and an address' nonce, respectively. // SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20, // SCV_LEDGER_KEY_NONCE = 21 +// // }; // // =========================================================================== @@ -9349,7 +9418,7 @@ xdr.union("ScAddress", { // === xdr source ============================================================ // -// const SCSYMBOL_LIMIT = 32; +// const 32 = 32; // // =========================================================================== xdr.const("SCSYMBOL_LIMIT", 32); @@ -9384,10 +9453,10 @@ xdr.typedef("ScString", xdr.string()); // === xdr source ============================================================ // -// typedef string SCSymbol; +// typedef string SCSymbol<32>; // // =========================================================================== -xdr.typedef("ScSymbol", xdr.string(SCSYMBOL_LIMIT)); +xdr.typedef("ScSymbol", xdr.string(32)); // === xdr source ============================================================ // @@ -9417,19 +9486,19 @@ xdr.struct("ScContractInstance", [ // // union SCVal switch (SCValType type) // { -// +// // case SCV_BOOL: // bool b; // case SCV_VOID: // void; // case SCV_ERROR: // SCError error; -// +// // case SCV_U32: // uint32 u32; // case SCV_I32: // int32 i32; -// +// // case SCV_U64: // uint64 u64; // case SCV_I64: @@ -9438,34 +9507,34 @@ xdr.struct("ScContractInstance", [ // TimePoint timepoint; // case SCV_DURATION: // Duration duration; -// +// // case SCV_U128: // UInt128Parts u128; // case SCV_I128: // Int128Parts i128; -// +// // case SCV_U256: // UInt256Parts u256; // case SCV_I256: // Int256Parts i256; -// +// // case SCV_BYTES: // SCBytes bytes; // case SCV_STRING: // SCString str; // case SCV_SYMBOL: // SCSymbol sym; -// +// // // Vec and Map are recursive so need to live // // behind an option, due to xdrpp limitations. // case SCV_VEC: // SCVec *vec; // case SCV_MAP: // SCMap *map; -// +// // case SCV_ADDRESS: // SCAddress address; -// +// // // Special SCVals reserved for system-constructed contract-data // // ledger keys, not generally usable elsewhere. // case SCV_CONTRACT_INSTANCE: @@ -9474,6 +9543,7 @@ xdr.struct("ScContractInstance", [ // void; // case SCV_LEDGER_KEY_NONCE: // SCNonceKey nonce_key; +// // }; // // =========================================================================== @@ -9638,7 +9708,7 @@ xdr.union("ScMetaEntry", { // === xdr source ============================================================ // -// const SC_SPEC_DOC_LIMIT = 1024; +// const 1024 = 1024; // // =========================================================================== xdr.const("SC_SPEC_DOC_LIMIT", 1024); @@ -9648,7 +9718,7 @@ xdr.const("SC_SPEC_DOC_LIMIT", 1024); // enum SCSpecType // { // SC_SPEC_TYPE_VAL = 0, -// +// // // Types with no parameters. // SC_SPEC_TYPE_BOOL = 1, // SC_SPEC_TYPE_VOID = 2, @@ -9668,7 +9738,7 @@ xdr.const("SC_SPEC_DOC_LIMIT", 1024); // SC_SPEC_TYPE_SYMBOL = 17, // SC_SPEC_TYPE_ADDRESS = 19, // SC_SPEC_TYPE_MUXED_ADDRESS = 20, -// +// // // Types with parameters. // SC_SPEC_TYPE_OPTION = 1000, // SC_SPEC_TYPE_RESULT = 1001, @@ -9676,7 +9746,7 @@ xdr.const("SC_SPEC_DOC_LIMIT", 1024); // SC_SPEC_TYPE_MAP = 1004, // SC_SPEC_TYPE_TUPLE = 1005, // SC_SPEC_TYPE_BYTES_N = 1006, -// +// // // User defined types. // SC_SPEC_TYPE_UDT = 2000 // }; @@ -9886,14 +9956,14 @@ xdr.union("ScSpecTypeDef", { // // struct SCSpecUDTStructFieldV0 // { -// string doc; +// string doc<1024>; // string name<30>; // SCSpecTypeDef type; // }; // // =========================================================================== xdr.struct("ScSpecUdtStructFieldV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(30)], ["type", xdr.lookup("ScSpecTypeDef")], ]); @@ -9902,7 +9972,7 @@ xdr.struct("ScSpecUdtStructFieldV0", [ // // struct SCSpecUDTStructV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTStructFieldV0 fields<>; @@ -9910,7 +9980,7 @@ xdr.struct("ScSpecUdtStructFieldV0", [ // // =========================================================================== xdr.struct("ScSpecUdtStructV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.string(60)], ["fields", xdr.varArray(xdr.lookup("ScSpecUdtStructFieldV0"), 2147483647)], @@ -9920,13 +9990,13 @@ xdr.struct("ScSpecUdtStructV0", [ // // struct SCSpecUDTUnionCaseVoidV0 // { -// string doc; +// string doc<1024>; // string name<60>; // }; // // =========================================================================== xdr.struct("ScSpecUdtUnionCaseVoidV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(60)], ]); @@ -9934,14 +10004,14 @@ xdr.struct("ScSpecUdtUnionCaseVoidV0", [ // // struct SCSpecUDTUnionCaseTupleV0 // { -// string doc; +// string doc<1024>; // string name<60>; // SCSpecTypeDef type<>; // }; // // =========================================================================== xdr.struct("ScSpecUdtUnionCaseTupleV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(60)], ["type", xdr.varArray(xdr.lookup("ScSpecTypeDef"), 2147483647)], ]); @@ -9988,7 +10058,7 @@ xdr.union("ScSpecUdtUnionCaseV0", { // // struct SCSpecUDTUnionV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTUnionCaseV0 cases<>; @@ -9996,7 +10066,7 @@ xdr.union("ScSpecUdtUnionCaseV0", { // // =========================================================================== xdr.struct("ScSpecUdtUnionV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.string(60)], ["cases", xdr.varArray(xdr.lookup("ScSpecUdtUnionCaseV0"), 2147483647)], @@ -10006,14 +10076,14 @@ xdr.struct("ScSpecUdtUnionV0", [ // // struct SCSpecUDTEnumCaseV0 // { -// string doc; +// string doc<1024>; // string name<60>; // uint32 value; // }; // // =========================================================================== xdr.struct("ScSpecUdtEnumCaseV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(60)], ["value", xdr.lookup("Uint32")], ]); @@ -10022,7 +10092,7 @@ xdr.struct("ScSpecUdtEnumCaseV0", [ // // struct SCSpecUDTEnumV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTEnumCaseV0 cases<>; @@ -10030,7 +10100,7 @@ xdr.struct("ScSpecUdtEnumCaseV0", [ // // =========================================================================== xdr.struct("ScSpecUdtEnumV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.string(60)], ["cases", xdr.varArray(xdr.lookup("ScSpecUdtEnumCaseV0"), 2147483647)], @@ -10040,14 +10110,14 @@ xdr.struct("ScSpecUdtEnumV0", [ // // struct SCSpecUDTErrorEnumCaseV0 // { -// string doc; +// string doc<1024>; // string name<60>; // uint32 value; // }; // // =========================================================================== xdr.struct("ScSpecUdtErrorEnumCaseV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(60)], ["value", xdr.lookup("Uint32")], ]); @@ -10056,7 +10126,7 @@ xdr.struct("ScSpecUdtErrorEnumCaseV0", [ // // struct SCSpecUDTErrorEnumV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTErrorEnumCaseV0 cases<>; @@ -10064,7 +10134,7 @@ xdr.struct("ScSpecUdtErrorEnumCaseV0", [ // // =========================================================================== xdr.struct("ScSpecUdtErrorEnumV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.string(60)], ["cases", xdr.varArray(xdr.lookup("ScSpecUdtErrorEnumCaseV0"), 2147483647)], @@ -10074,14 +10144,14 @@ xdr.struct("ScSpecUdtErrorEnumV0", [ // // struct SCSpecFunctionInputV0 // { -// string doc; +// string doc<1024>; // string name<30>; // SCSpecTypeDef type; // }; // // =========================================================================== xdr.struct("ScSpecFunctionInputV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(30)], ["type", xdr.lookup("ScSpecTypeDef")], ]); @@ -10090,7 +10160,7 @@ xdr.struct("ScSpecFunctionInputV0", [ // // struct SCSpecFunctionV0 // { -// string doc; +// string doc<1024>; // SCSymbol name; // SCSpecFunctionInputV0 inputs<>; // SCSpecTypeDef outputs<1>; @@ -10098,7 +10168,7 @@ xdr.struct("ScSpecFunctionInputV0", [ // // =========================================================================== xdr.struct("ScSpecFunctionV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.lookup("ScSymbol")], ["inputs", xdr.varArray(xdr.lookup("ScSpecFunctionInputV0"), 2147483647)], ["outputs", xdr.varArray(xdr.lookup("ScSpecTypeDef"), 1)], @@ -10122,7 +10192,7 @@ xdr.enum("ScSpecEventParamLocationV0", { // // struct SCSpecEventParamV0 // { -// string doc; +// string doc<1024>; // string name<30>; // SCSpecTypeDef type; // SCSpecEventParamLocationV0 location; @@ -10130,7 +10200,7 @@ xdr.enum("ScSpecEventParamLocationV0", { // // =========================================================================== xdr.struct("ScSpecEventParamV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(30)], ["type", xdr.lookup("ScSpecTypeDef")], ["location", xdr.lookup("ScSpecEventParamLocationV0")], @@ -10156,7 +10226,7 @@ xdr.enum("ScSpecEventDataFormat", { // // struct SCSpecEventV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // SCSymbol name; // SCSymbol prefixTopics<2>; @@ -10166,7 +10236,7 @@ xdr.enum("ScSpecEventDataFormat", { // // =========================================================================== xdr.struct("ScSpecEventV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.lookup("ScSymbol")], ["prefixTopics", xdr.varArray(xdr.lookup("ScSymbol"), 2)], @@ -10266,7 +10336,7 @@ xdr.struct("ConfigSettingContractExecutionLanesV0", [ // int64 txMaxInstructions; // // Cost of 10000 instructions // int64 feeRatePerInstructionsIncrement; -// +// // // Memory limit per transaction. Unlike instructions, there is no fee // // for memory, just the limit. // uint32 txMemoryLimit; @@ -10308,7 +10378,7 @@ xdr.struct("ConfigSettingContractParallelComputeV0", [ // uint32 ledgerMaxWriteLedgerEntries; // // Maximum number of bytes that can be written per ledger // uint32 ledgerMaxWriteBytes; -// +// // // Maximum number of disk entry read operations per transaction // uint32 txMaxDiskReadEntries; // // Maximum number of bytes of disk reads that can be performed per transaction @@ -10317,12 +10387,12 @@ xdr.struct("ConfigSettingContractParallelComputeV0", [ // uint32 txMaxWriteLedgerEntries; // // Maximum number of bytes that can be written per transaction // uint32 txMaxWriteBytes; -// +// // int64 feeDiskReadLedgerEntry; // Fee per disk ledger entry read // int64 feeWriteLedgerEntry; // Fee per ledger entry write -// +// // int64 feeDiskRead1KB; // Fee for reading 1KB disk -// +// // // The following parameters determine the write fee per 1KB. // // Rent fee grows linearly until soroban state reaches this size // int64 sorobanStateTargetSizeBytes; @@ -10407,7 +10477,7 @@ xdr.struct("ConfigSettingContractEventsV0", [ // uint32 ledgerMaxTxsSizeBytes; // // Maximum size in bytes for a transaction // uint32 txMaxSizeBytes; -// +// // // Fee for 1 KB of transaction size // int64 feeTxSize1KB; // }; @@ -10433,7 +10503,7 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // // Cost of a host function dispatch, not including the actual work done by // // the function nor the cost of VM invocation machinary // DispatchHostFunction = 4, -// // Cost of visiting a host object from the host object storage. Exists to +// // 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 = 5, @@ -10473,7 +10543,7 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // Int256Shift = 21, // // Cost of drawing random bytes using a ChaCha20 PRNG // ChaCha20DrawBytes = 22, -// +// // // Cost of parsing wasm bytes that only encode instructions. // ParseWasmInstructions = 23, // // Cost of parsing a known number of wasm functions. @@ -10494,7 +10564,7 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // ParseWasmExports = 31, // // Cost of parsing a known number of data segment bytes. // ParseWasmDataSegmentBytes = 32, -// +// // // Cost of instantiating wasm bytes that only encode instructions. // InstantiateWasmInstructions = 33, // // Cost of instantiating a known number of wasm functions. @@ -10515,13 +10585,13 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // InstantiateWasmExports = 41, // // Cost of instantiating a known number of data segment bytes. // InstantiateWasmDataSegmentBytes = 42, -// +// // // Cost of decoding a bytes array representing an uncompressed SEC-1 encoded // // point on a 256-bit elliptic curve // Sec1DecodePointUncompressed = 43, // // Cost of verifying an ECDSA Secp256r1 signature // VerifyEcdsaSecp256r1Sig = 44, -// +// // // Cost of encoding a BLS12-381 Fp (base field element) // Bls12381EncodeFp = 45, // // Cost of decoding a BLS12-381 Fp (base field element) @@ -10572,7 +10642,7 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // Bls12381FrPow = 68, // // Cost of performing BLS12-381 scalar element inversion // Bls12381FrInv = 69, -// +// // // Cost of encoding a BN254 Fp (base field element) // Bn254EncodeFp = 70, // // Cost of decoding a BN254 Fp (base field element) @@ -10702,7 +10772,7 @@ xdr.enum("ContractCostType", { // struct ContractCostParamEntry { // // use `ext` to add more terms (e.g. higher order polynomials) in the future // ExtensionPoint ext; -// +// // int64 constTerm; // int64 linearTerm; // }; @@ -10720,23 +10790,23 @@ xdr.struct("ContractCostParamEntry", [ // 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 archival meta in a single ledger // uint32 maxEntriesToArchive; -// +// // // Number of snapshots to use when calculating average live Soroban State size // uint32 liveSorobanStateSizeWindowSampleSize; -// +// // // How often to sample the live Soroban State size for the average, in ledgers // uint32 liveSorobanStateSizeWindowSamplePeriod; -// +// // // Maximum number of bytes that we scan for eviction per ledger // uint32 evictionScanSize; -// +// // // Lowest BucketList level to be scanned to evict entries // uint32 startingEvictionScanLevel; // }; @@ -10839,14 +10909,14 @@ xdr.struct("FreezeBypassTxsDelta", [ // === xdr source ============================================================ // -// const CONTRACT_COST_COUNT_LIMIT = 1024; +// const 1024 = 1024; // // =========================================================================== xdr.const("CONTRACT_COST_COUNT_LIMIT", 1024); // === xdr source ============================================================ // -// typedef ContractCostParamEntry ContractCostParams; +// typedef ContractCostParamEntry ContractCostParams<1024>; // // =========================================================================== xdr.typedef("ContractCostParams", xdr.varArray(xdr.lookup("ContractCostParamEntry"), xdr.lookup("CONTRACT_COST_COUNT_LIMIT"))); @@ -11009,10 +11079,10 @@ xdr.union("ConfigSettingEntry", { // { // // starting ledger sequence number in the batch // uint32 startSequence; -// +// // // ending ledger sequence number in the batch // uint32 endSequence; -// +// // // Ledger close meta for each ledger within the batch // LedgerCloseMeta ledgerCloseMetas<>; // }; diff --git a/src/generated/next_generated.js b/src/generated/next_generated.js index d4e763ce..9f6840af 100644 --- a/src/generated/next_generated.js +++ b/src/generated/next_generated.js @@ -9,13 +9,6 @@ import * as XDR from '@stellar/js-xdr'; var types = XDR.config(xdr => { -// Workaround for https://github.com/stellar/xdrgen/issues/152 -// -// The "correct" way would be to replace bare instances of each constant with -// xdr.lookup("..."), but that's more error-prone. -const SCSYMBOL_LIMIT = 32; -const SC_SPEC_DOC_LIMIT = 1024; - // === xdr source ============================================================ // // typedef opaque Value<>; @@ -187,7 +180,7 @@ xdr.union("ScpStatementPledges", { // { // NodeID nodeID; // v // uint64 slotIndex; // i -// +// // union switch (SCPStatementType type) // { // case SCP_ST_PREPARE: @@ -332,10 +325,10 @@ xdr.enum("AssetType", { // { // case ASSET_TYPE_CREDIT_ALPHANUM4: // AssetCode4 assetCode4; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM12: // AssetCode12 assetCode12; -// +// // // add other asset types here in the future // }; // @@ -387,13 +380,13 @@ xdr.struct("AlphaNum12", [ // { // case ASSET_TYPE_NATIVE: // Not credit // void; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM4: // AlphaNum4 alphaNum4; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM12: // AlphaNum12 alphaNum12; -// +// // // add other asset types here in the future // }; // @@ -506,7 +499,7 @@ xdr.struct("Signer", [ // // enum AccountFlags // { // masks for each flag -// +// // // Flags set on issuer accounts // // TrustLines are created with authorized set to "false" requiring // // the issuer to set it for each TrustLine @@ -532,21 +525,21 @@ xdr.enum("AccountFlags", { // === xdr source ============================================================ // -// const MASK_ACCOUNT_FLAGS = 0x7; +// const 0x7 = 0x7; // // =========================================================================== xdr.const("MASK_ACCOUNT_FLAGS", 0x7); // === xdr source ============================================================ // -// const MASK_ACCOUNT_FLAGS_V17 = 0xF; +// const 0xF = 0xF; // // =========================================================================== xdr.const("MASK_ACCOUNT_FLAGS_V17", 0xF); // === xdr source ============================================================ // -// const MAX_SIGNERS = 20; +// const 20 = 20; // // =========================================================================== xdr.const("MAX_SIGNERS", 20); @@ -565,10 +558,10 @@ xdr.typedef("SponsorshipDescriptor", xdr.option(xdr.lookup("AccountId"))); // // We can use this to add more fields, or because it is first, to // // change AccountEntryExtensionV3 into a union. // ExtensionPoint ext; -// +// // // Ledger number at which `seqNum` took on its present value. // uint32 seqLedger; -// +// // // Time at which `seqNum` took on its present value. // TimePoint seqTime; // }; @@ -609,8 +602,8 @@ xdr.union("AccountEntryExtensionV2Ext", { // { // uint32 numSponsored; // uint32 numSponsoring; -// SponsorshipDescriptor signerSponsoringIDs; -// +// SponsorshipDescriptor signerSponsoringIDs<20>; +// // union switch (int v) // { // case 0: @@ -657,7 +650,7 @@ xdr.union("AccountEntryExtensionV1Ext", { // struct AccountEntryExtensionV1 // { // Liabilities liabilities; -// +// // union switch (int v) // { // case 0: @@ -708,15 +701,15 @@ xdr.union("AccountEntryExt", { // // drives the reserve // AccountID* inflationDest; // Account to vote for during inflation // uint32 flags; // see AccountFlags -// +// // string32 homeDomain; // can be used for reverse federation and memo lookup -// +// // // fields used for signatures // // thresholds stores unsigned bytes: [weight of master|low|medium|high] // Thresholds thresholds; -// -// Signer signers; // possible signers for this account -// +// +// Signer signers<20>; // possible signers for this account +// // // reserved for future use // union switch (int v) // { @@ -765,21 +758,21 @@ xdr.enum("TrustLineFlags", { // === xdr source ============================================================ // -// const MASK_TRUSTLINE_FLAGS = 1; +// const 1 = 1; // // =========================================================================== xdr.const("MASK_TRUSTLINE_FLAGS", 1); // === xdr source ============================================================ // -// const MASK_TRUSTLINE_FLAGS_V13 = 3; +// const 3 = 3; // // =========================================================================== xdr.const("MASK_TRUSTLINE_FLAGS_V13", 3); // === xdr source ============================================================ // -// const MASK_TRUSTLINE_FLAGS_V17 = 7; +// const 7 = 7; // // =========================================================================== xdr.const("MASK_TRUSTLINE_FLAGS_V17", 7); @@ -802,16 +795,16 @@ xdr.enum("LiquidityPoolType", { // { // case ASSET_TYPE_NATIVE: // Not credit // void; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM4: // AlphaNum4 alphaNum4; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM12: // AlphaNum12 alphaNum12; -// +// // case ASSET_TYPE_POOL_SHARE: // PoolID liquidityPoolID; -// +// // // add other asset types here in the future // }; // @@ -856,7 +849,7 @@ xdr.union("TrustLineEntryExtensionV2Ext", { // struct TrustLineEntryExtensionV2 // { // int32 liquidityPoolUseCount; -// +// // union switch (int v) // { // case 0: @@ -899,7 +892,7 @@ xdr.union("TrustLineEntryV1Ext", { // struct // { // Liabilities liabilities; -// +// // union switch (int v) // { // case 0: @@ -926,7 +919,7 @@ xdr.struct("TrustLineEntryV1", [ // struct // { // Liabilities liabilities; -// +// // union switch (int v) // { // case 0: @@ -959,10 +952,10 @@ xdr.union("TrustLineEntryExt", { // TrustLineAsset asset; // type of asset (with issuer) // int64 balance; // how much of this asset the user has. // // Asset defines the unit for this; -// +// // int64 limit; // balance cannot be above this // uint32 flags; // see TrustLineFlags -// +// // // reserved for future use // union switch (int v) // { @@ -972,7 +965,7 @@ xdr.union("TrustLineEntryExt", { // struct // { // Liabilities liabilities; -// +// // union switch (int v) // { // case 0: @@ -1012,7 +1005,7 @@ xdr.enum("OfferEntryFlags", { // === xdr source ============================================================ // -// const MASK_OFFERENTRY_FLAGS = 1; +// const 1 = 1; // // =========================================================================== xdr.const("MASK_OFFERENTRY_FLAGS", 1); @@ -1045,7 +1038,7 @@ xdr.union("OfferEntryExt", { // Asset selling; // A // Asset buying; // B // int64 amount; // amount of A -// +// // /* price for this offer: // price of A in terms of B // price=AmountB/AmountA=priceNumerator/priceDenominator @@ -1053,7 +1046,7 @@ xdr.union("OfferEntryExt", { // */ // Price price; // uint32 flags; // see OfferEntryFlags -// +// // // reserved for future use // union switch (int v) // { @@ -1101,7 +1094,7 @@ xdr.union("DataEntryExt", { // AccountID accountID; // account this data belongs to // string64 dataName; // DataValue dataValue; -// +// // // reserved for future use // union switch (int v) // { @@ -1247,7 +1240,7 @@ xdr.enum("ClaimableBalanceFlags", { // === xdr source ============================================================ // -// const MASK_CLAIMABLE_BALANCE_FLAGS = 0x1; +// const 0x1 = 0x1; // // =========================================================================== xdr.const("MASK_CLAIMABLE_BALANCE_FLAGS", 0x1); @@ -1281,7 +1274,7 @@ xdr.union("ClaimableBalanceEntryExtensionV1Ext", { // void; // } // ext; -// +// // uint32 flags; // see ClaimableBalanceFlags // }; // @@ -1320,16 +1313,16 @@ xdr.union("ClaimableBalanceEntryExt", { // { // // Unique identifier for this ClaimableBalanceEntry // ClaimableBalanceID balanceID; -// +// // // List of claimants with associated predicate // Claimant claimants<10>; -// +// // // Any asset including native // Asset asset; -// +// // // Amount of asset // int64 amount; -// +// // // reserved for future use // union switch (int v) // { @@ -1371,7 +1364,7 @@ xdr.struct("LiquidityPoolConstantProductParameters", [ // struct // { // LiquidityPoolConstantProductParameters params; -// +// // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued @@ -1396,7 +1389,7 @@ xdr.struct("LiquidityPoolEntryConstantProduct", [ // struct // { // LiquidityPoolConstantProductParameters params; -// +// // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued @@ -1422,14 +1415,14 @@ xdr.union("LiquidityPoolEntryBody", { // struct LiquidityPoolEntry // { // PoolID liquidityPoolID; -// +// // union switch (LiquidityPoolType type) // { // case LIQUIDITY_POOL_CONSTANT_PRODUCT: // struct // { // LiquidityPoolConstantProductParameters params; -// +// // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued @@ -1463,7 +1456,7 @@ xdr.enum("ContractDataDurability", { // // struct ContractDataEntry { // ExtensionPoint ext; -// +// // SCAddress contract; // SCVal key; // ContractDataDurability durability; @@ -1565,7 +1558,7 @@ xdr.union("ContractCodeEntryExt", { // ContractCodeCostInputs costInputs; // } v1; // } ext; -// +// // Hash hash; // opaque code<>; // }; @@ -1615,7 +1608,7 @@ xdr.union("LedgerEntryExtensionV1Ext", { // struct LedgerEntryExtensionV1 // { // SponsorshipDescriptor sponsoringID; -// +// // union switch (int v) // { // case 0: @@ -1714,7 +1707,7 @@ xdr.union("LedgerEntryExt", { // struct LedgerEntry // { // uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed -// +// // union switch (LedgerEntryType type) // { // case ACCOUNT: @@ -1739,7 +1732,7 @@ xdr.union("LedgerEntryExt", { // TTLEntry ttl; // } // data; -// +// // // reserved for future use // union switch (int v) // { @@ -1898,34 +1891,34 @@ xdr.struct("LedgerKeyTtl", [ // { // AccountID accountID; // } account; -// +// // case TRUSTLINE: // struct // { // AccountID accountID; // TrustLineAsset asset; // } trustLine; -// +// // case OFFER: // struct // { // AccountID sellerID; // int64 offerID; // } offer; -// +// // case DATA: // struct // { // AccountID accountID; // string64 dataName; // } data; -// +// // case CLAIMABLE_BALANCE: // struct // { // ClaimableBalanceID balanceID; // } claimableBalance; -// +// // case LIQUIDITY_POOL: // struct // { @@ -1999,7 +1992,8 @@ xdr.union("LedgerKey", { // ENVELOPE_TYPE_OP_ID = 6, // ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7, // ENVELOPE_TYPE_CONTRACT_ID = 8, -// ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9 +// ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9, +// ENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESS = 10 // }; // // =========================================================================== @@ -2014,6 +2008,7 @@ xdr.enum("EnvelopeType", { envelopeTypePoolRevokeOpId: 7, envelopeTypeContractId: 8, envelopeTypeSorobanAuthorization: 9, + envelopeTypeSorobanAuthorizationWithAddress: 10, }); // === xdr source ============================================================ @@ -2097,7 +2092,7 @@ xdr.union("BucketMetadataExt", { // { // // Indicates the protocol version used to create / merge this bucket. // uint32 ledgerVersion; -// +// // // reserved for future use // union switch (int v) // { @@ -2122,7 +2117,7 @@ xdr.struct("BucketMetadata", [ // case LIVEENTRY: // case INITENTRY: // LedgerEntry liveEntry; -// +// // case DEADENTRY: // LedgerKey deadEntry; // case METAENTRY: @@ -2152,7 +2147,7 @@ xdr.union("BucketEntry", { // { // case HOT_ARCHIVE_ARCHIVED: // LedgerEntry archivedEntry; -// +// // case HOT_ARCHIVE_LIVE: // LedgerKey key; // case HOT_ARCHIVE_METAENTRY: @@ -2239,14 +2234,14 @@ xdr.union("StellarValueExt", { // { // Hash txSetHash; // transaction set to apply to previous ledger // TimePoint closeTime; // network close time -// +// // // upgrades to apply to the previous ledger (usually empty) // // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop // // unknown steps during consensus if needed. // // see notes below on 'LedgerUpgrade' for more detail // // max size is dictated by number of upgrade types (+ room for future) // UpgradeType upgrades<6>; -// +// // // reserved for future use // union switch (StellarValueType v) // { @@ -2268,7 +2263,7 @@ xdr.struct("StellarValue", [ // === xdr source ============================================================ // -// const MASK_LEDGER_HEADER_FLAGS = 0x7; +// const 0x7 = 0x7; // // =========================================================================== xdr.const("MASK_LEDGER_HEADER_FLAGS", 0x7); @@ -2313,7 +2308,7 @@ xdr.union("LedgerHeaderExtensionV1Ext", { // struct LedgerHeaderExtensionV1 // { // uint32 flags; // LedgerHeaderFlags -// +// // union switch (int v) // { // case 0: @@ -2360,28 +2355,28 @@ xdr.union("LedgerHeaderExt", { // StellarValue scpValue; // what consensus agreed to // Hash txSetResultHash; // the TransactionResultSet that led to this ledger // Hash bucketListHash; // hash of the ledger state -// +// // uint32 ledgerSeq; // sequence number of this ledger -// +// // int64 totalCoins; // total number of stroops in existence. // // 10,000,000 stroops in 1 XLM -// +// // int64 feePool; // fees burned since last inflation run // uint32 inflationSeq; // inflation sequence number -// +// // uint64 idPool; // last used global ID, used for generating objects -// +// // uint32 baseFee; // base fee per operation in stroops // uint32 baseReserve; // account base reserve in stroops -// +// // uint32 maxTxSetSize; // maximum size a transaction set can be -// +// // Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back // // in time without walking the chain back ledger by ledger // // each slot contains the oldest ledger that is mod of // // either 50 5000 50000 or 500000 depending on index // // skipList[0] mod(50), skipList[1] mod(5000), etc -// +// // // reserved for future use // union switch (int v) // { @@ -2718,7 +2713,7 @@ xdr.union("TransactionHistoryEntryExt", { // { // uint32 ledgerSeq; // TransactionSet txSet; -// +// // // when v != 0, txSet must be empty // union switch (int v) // { @@ -2762,7 +2757,7 @@ xdr.union("TransactionHistoryResultEntryExt", { // { // uint32 ledgerSeq; // TransactionResultSet txResultSet; -// +// // // reserved for future use // union switch (int v) // { @@ -2804,7 +2799,7 @@ xdr.union("LedgerHeaderHistoryEntryExt", { // { // Hash hash; // LedgerHeader header; -// +// // // reserved for future use // union switch (int v) // { @@ -3037,10 +3032,10 @@ xdr.union("ContractEventBody", { // // We can use this to add more fields, or because it // // is first, to change ContractEvent into a union. // ExtensionPoint ext; -// +// // ContractID* contractID; // ContractEventType type; -// +// // union switch (int v) // { // case 0: @@ -3080,22 +3075,22 @@ xdr.struct("DiagnosticEvent", [ // struct SorobanTransactionMetaExtV1 // { // ExtensionPoint ext; -// +// // // The following are the components of the overall Soroban resource fee // // charged for the transaction. // // The following relation holds: // // `resourceFeeCharged = totalNonRefundableResourceFeeCharged + totalRefundableResourceFeeCharged` -// // where `resourceFeeCharged` is the overall fee charged for the -// // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee` +// // where `resourceFeeCharged` is the overall fee charged for the +// // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee` // // i.e.we never charge more than the declared resource fee. -// // The inclusion fee for charged the Soroban transaction can be found using +// // The inclusion fee for charged the Soroban transaction can be found using // // the following equation: // // `result.feeCharged = resourceFeeCharged + inclusionFeeCharged`. -// +// // // Total amount (in stroops) that has been charged for non-refundable // // Soroban resources. // // Non-refundable resources are charged based on the usage declared in -// // the transaction envelope (such as `instructions`, `readBytes` etc.) and +// // the transaction envelope (such as `instructions`, `readBytes` etc.) and // // is charged regardless of the success of the transaction. // int64 totalNonRefundableResourceFeeCharged; // // Total amount (in stroops) that has been charged for refundable @@ -3107,7 +3102,7 @@ xdr.struct("DiagnosticEvent", [ // // transactions, this will be `0` for failed transactions. // int64 totalRefundableResourceFeeCharged; // // Amount (in stroops) that has been charged for rent. -// // This is a part of `totalNonRefundableResourceFeeCharged`. +// // This is a part of `totalRefundableResourceFeeCharged`. // int64 rentFeeCharged; // }; // @@ -3144,14 +3139,14 @@ xdr.union("SorobanTransactionMetaExt", { // === xdr source ============================================================ // -// struct SorobanTransactionMeta +// struct SorobanTransactionMeta // { // SorobanTransactionMetaExt ext; -// +// // ContractEvent events<>; // custom events populated by the // // contracts themselves. // SCVal returnValue; // return value of the host fn invocation -// +// // // Diagnostics events that are not hashed. // // This will contain all contract and diagnostic events. Even ones // // that were emitted in a failed contract call. @@ -3171,13 +3166,13 @@ xdr.struct("SorobanTransactionMeta", [ // struct TransactionMetaV3 // { // ExtensionPoint ext; -// +// // LedgerEntryChanges txChangesBefore; // tx level changes before operations // // are applied if any // OperationMeta operations<>; // meta for each operation // LedgerEntryChanges txChangesAfter; // tx level changes after operations are // // applied if any -// SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for +// SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for // // Soroban transactions). // }; // @@ -3195,9 +3190,9 @@ xdr.struct("TransactionMetaV3", [ // struct OperationMetaV2 // { // ExtensionPoint ext; -// +// // LedgerEntryChanges changes; -// +// // ContractEvent events<>; // }; // @@ -3213,7 +3208,7 @@ xdr.struct("OperationMetaV2", [ // struct SorobanTransactionMetaV2 // { // SorobanTransactionMetaExt ext; -// +// // SCVal* returnValue; // }; // @@ -3226,13 +3221,13 @@ xdr.struct("SorobanTransactionMetaV2", [ // === xdr source ============================================================ // // enum TransactionEventStage { -// // The event has happened before any one of the transactions has its +// // The event has happened before any one of the transactions has its // // operations applied. // TRANSACTION_EVENT_STAGE_BEFORE_ALL_TXS = 0, // // The event has happened immediately after operations of the transaction // // have been applied. // TRANSACTION_EVENT_STAGE_AFTER_TX = 1, -// // The event has happened after every transaction had its operations +// // The event has happened after every transaction had its operations // // applied. // TRANSACTION_EVENT_STAGE_AFTER_ALL_TXS = 2 // }; @@ -3246,7 +3241,7 @@ xdr.enum("TransactionEventStage", { // === xdr source ============================================================ // -// struct TransactionEvent { +// struct TransactionEvent { // TransactionEventStage stage; // Stage at which an event has occurred. // ContractEvent event; // The contract event that has occurred. // }; @@ -3262,7 +3257,7 @@ xdr.struct("TransactionEvent", [ // struct TransactionMetaV4 // { // ExtensionPoint ext; -// +// // LedgerEntryChanges txChangesBefore; // tx level changes before operations // // are applied if any // OperationMetaV2 operations<>; // meta for each operation @@ -3270,7 +3265,7 @@ xdr.struct("TransactionEvent", [ // // applied if any // SorobanTransactionMetaV2* sorobanMeta; // Soroban-specific meta (only for // // Soroban transactions). -// +// // TransactionEvent events<>; // Used for transaction-level events (like fee payment) // DiagnosticEvent diagnosticEvents<>; // Used for all diagnostic information // }; @@ -3357,11 +3352,11 @@ xdr.struct("TransactionResultMeta", [ // struct TransactionResultMetaV1 // { // ExtensionPoint ext; -// +// // TransactionResultPair result; // LedgerEntryChanges feeProcessing; // TransactionMeta txApplyProcessing; -// +// // LedgerEntryChanges postTxApplyFeeProcessing; // }; // @@ -3395,15 +3390,15 @@ xdr.struct("UpgradeEntryMeta", [ // LedgerHeaderHistoryEntry ledgerHeader; // // NB: txSet is sorted in "Hash order" // TransactionSet 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<>; // }; @@ -3459,29 +3454,29 @@ xdr.union("LedgerCloseMetaExt", { // struct LedgerCloseMetaV1 // { // LedgerCloseMetaExt ext; -// +// // 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<>; -// +// // // Size in bytes of live Soroban state, to support downstream // // systems calculating storage fees correctly. // uint64 totalByteSizeOfLiveSorobanState; -// +// // // TTL and data/code keys that have been evicted at this ledger. // LedgerKey evictedKeys<>; -// +// // // Maintained for backwards compatibility, should never be populated. // LedgerEntry unused<>; // }; @@ -3504,26 +3499,26 @@ xdr.struct("LedgerCloseMetaV1", [ // struct LedgerCloseMetaV2 // { // LedgerCloseMetaExt ext; -// +// // LedgerHeaderHistoryEntry ledgerHeader; -// +// // GeneralizedTransactionSet txSet; -// +// // // NB: transactions are sorted in apply order here // // fees for all transactions are processed first // // followed by applying transactions // TransactionResultMetaV1 txProcessing<>; -// +// // // upgrades are applied last // UpgradeEntryMeta upgradesProcessing<>; -// +// // // other misc information attached to the ledger close // SCPHistoryEntry scpInfo<>; -// +// // // Size in bytes of live Soroban state, to support downstream // // systems calculating storage fees correctly. // uint64 totalByteSizeOfLiveSorobanState; -// +// // // TTL and data/code keys that have been evicted at this ledger. // LedgerKey evictedKeys<>; // }; @@ -3674,7 +3669,7 @@ xdr.struct("Hello", [ // === xdr source ============================================================ // -// const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200; +// const 200 = 200; // // =========================================================================== xdr.const("AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED", 200); @@ -3760,33 +3755,33 @@ xdr.struct("PeerAddress", [ // AUTH = 2, // DONT_HAVE = 3, // // GET_PEERS (4) is deprecated -// +// // PEERS = 5, -// +// // GET_TX_SET = 6, // gets a particular txset by hash // TX_SET = 7, // GENERALIZED_TX_SET = 17, -// +// // TRANSACTION = 8, // pass on a tx you have heard about -// +// // // SCP // GET_SCP_QUORUMSET = 9, // SCP_QUORUMSET = 10, // SCP_MESSAGE = 11, // GET_SCP_STATE = 12, -// +// // // new messages // HELLO = 13, -// +// // // SURVEY_REQUEST (14) removed and replaced by TIME_SLICED_SURVEY_REQUEST // // SURVEY_RESPONSE (15) removed and replaced by TIME_SLICED_SURVEY_RESPONSE -// +// // SEND_MORE = 16, // SEND_MORE_EXTENDED = 20, -// +// // FLOOD_ADVERT = 18, // FLOOD_DEMAND = 19, -// +// // TIME_SLICED_SURVEY_REQUEST = 21, // TIME_SLICED_SURVEY_RESPONSE = 22, // TIME_SLICED_SURVEY_START_COLLECTING = 23, @@ -4034,12 +4029,12 @@ xdr.struct("SignedTimeSlicedSurveyResponseMessage", [ // uint64 bytesRead; // uint64 bytesWritten; // uint64 secondsConnected; -// +// // uint64 uniqueFloodBytesRecv; // uint64 duplicateFloodBytesRecv; // uint64 uniqueFetchBytesRecv; // uint64 duplicateFetchBytesRecv; -// +// // uint64 uniqueFloodMessageRecv; // uint64 duplicateFloodMessageRecv; // uint64 uniqueFetchMessageRecv; @@ -4073,14 +4068,14 @@ xdr.struct("PeerStats", [ // uint32 droppedAuthenticatedPeers; // uint32 totalInboundPeerCount; // uint32 totalOutboundPeerCount; -// +// // // SCP stats // uint32 p75SCPFirstToSelfLatencyMs; // uint32 p75SCPSelfToOtherLatencyMs; -// +// // // How many times the node lost sync in the time slice // uint32 lostSyncCount; -// +// // // Config data // bool isValidator; // uint32 maxInboundPeerCount; @@ -4160,14 +4155,14 @@ xdr.union("SurveyResponseBody", { // === xdr source ============================================================ // -// const TX_ADVERT_VECTOR_MAX_SIZE = 1000; +// const 1000 = 1000; // // =========================================================================== xdr.const("TX_ADVERT_VECTOR_MAX_SIZE", 1000); // === xdr source ============================================================ // -// typedef Hash TxAdvertVector; +// typedef Hash TxAdvertVector<1000>; // // =========================================================================== xdr.typedef("TxAdvertVector", xdr.varArray(xdr.lookup("Hash"), xdr.lookup("TX_ADVERT_VECTOR_MAX_SIZE"))); @@ -4186,14 +4181,14 @@ xdr.struct("FloodAdvert", [ // === xdr source ============================================================ // -// const TX_DEMAND_VECTOR_MAX_SIZE = 1000; +// const 1000 = 1000; // // =========================================================================== xdr.const("TX_DEMAND_VECTOR_MAX_SIZE", 1000); // === xdr source ============================================================ // -// typedef Hash TxDemandVector; +// typedef Hash TxDemandVector<1000>; // // =========================================================================== xdr.typedef("TxDemandVector", xdr.varArray(xdr.lookup("Hash"), xdr.lookup("TX_DEMAND_VECTOR_MAX_SIZE"))); @@ -4224,31 +4219,31 @@ xdr.struct("FloodDemand", [ // DontHave dontHave; // case PEERS: // PeerAddress peers<100>; -// +// // case GET_TX_SET: // uint256 txSetHash; // case TX_SET: // TransactionSet txSet; // case GENERALIZED_TX_SET: // GeneralizedTransactionSet generalizedTxSet; -// +// // case TRANSACTION: // TransactionEnvelope transaction; -// +// // case TIME_SLICED_SURVEY_REQUEST: // SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage; -// +// // case TIME_SLICED_SURVEY_RESPONSE: // SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage; -// +// // case TIME_SLICED_SURVEY_START_COLLECTING: // SignedTimeSlicedSurveyStartCollectingMessage // signedTimeSlicedSurveyStartCollectingMessage; -// +// // case TIME_SLICED_SURVEY_STOP_COLLECTING: // SignedTimeSlicedSurveyStopCollectingMessage // signedTimeSlicedSurveyStopCollectingMessage; -// +// // // SCP // case GET_SCP_QUORUMSET: // uint256 qSetHash; @@ -4364,7 +4359,7 @@ xdr.union("AuthenticatedMessage", { // === xdr source ============================================================ // -// const MAX_OPS_PER_TX = 100; +// const 100 = 100; // // =========================================================================== xdr.const("MAX_OPS_PER_TX", 100); @@ -4547,11 +4542,11 @@ xdr.struct("PaymentOp", [ // int64 sendMax; // the maximum amount of sendAsset to // // send (excluding fees). // // The operation will fail if can't be met -// +// // MuxedAccount destination; // recipient of the payment // Asset destAsset; // what they end up with // int64 destAmount; // amount they end up with -// +// // Asset path<5>; // additional hops it must go through to get there // }; // @@ -4571,13 +4566,13 @@ xdr.struct("PathPaymentStrictReceiveOp", [ // { // Asset sendAsset; // asset we pay with // int64 sendAmount; // amount of sendAsset to send (excluding fees) -// +// // MuxedAccount destination; // recipient of the payment // Asset destAsset; // what they end up with // int64 destMin; // the minimum amount of dest asset to // // be received // // The operation will fail if it can't be met -// +// // Asset path<5>; // additional hops it must go through to get there // }; // @@ -4599,7 +4594,7 @@ xdr.struct("PathPaymentStrictSendOp", [ // Asset buying; // int64 amount; // amount being sold. if set to 0, delete the offer // Price price; // price of thing being sold in terms of what you are buying -// +// // // 0=create a new offer, otherwise edit an existing offer // int64 offerID; // }; @@ -4622,7 +4617,7 @@ xdr.struct("ManageSellOfferOp", [ // int64 buyAmount; // amount being bought. if set to 0, delete the offer // Price price; // price of thing being bought in terms of what you are // // selling -// +// // // 0=create a new offer, otherwise edit an existing offer // int64 offerID; // }; @@ -4659,18 +4654,18 @@ xdr.struct("CreatePassiveSellOfferOp", [ // struct SetOptionsOp // { // AccountID* inflationDest; // sets the inflation destination -// +// // uint32* clearFlags; // which flags to clear // uint32* setFlags; // which flags to set -// +// // // account threshold manipulation // uint32* masterWeight; // weight of the master account // uint32* lowThreshold; // uint32* medThreshold; // uint32* highThreshold; -// +// // string32* homeDomain; // sets the home domain -// +// // // Add, update or remove a signer for the account // // signer is deleted if the weight is 0 // Signer* signer; @@ -4695,16 +4690,16 @@ xdr.struct("SetOptionsOp", [ // { // case ASSET_TYPE_NATIVE: // Not credit // void; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM4: // AlphaNum4 alphaNum4; -// +// // case ASSET_TYPE_CREDIT_ALPHANUM12: // AlphaNum12 alphaNum12; -// +// // case ASSET_TYPE_POOL_SHARE: // LiquidityPoolParameters liquidityPool; -// +// // // add other asset types here in the future // }; // @@ -4730,7 +4725,7 @@ xdr.union("ChangeTrustAsset", { // struct ChangeTrustOp // { // ChangeTrustAsset line; -// +// // // if limit is set to 0, deletes the trust line // int64 limit; // }; @@ -4747,7 +4742,7 @@ xdr.struct("ChangeTrustOp", [ // { // AccountID trustor; // AssetCode asset; -// +// // // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG // uint32 authorize; // }; @@ -4915,7 +4910,7 @@ xdr.struct("ClawbackClaimableBalanceOp", [ // { // AccountID trustor; // Asset asset; -// +// // uint32 clearFlags; // which flags to clear // uint32 setFlags; // which flags to set // }; @@ -4930,7 +4925,7 @@ xdr.struct("SetTrustLineFlagsOp", [ // === xdr source ============================================================ // -// const LIQUIDITY_POOL_FEE_V18 = 30; +// const 30 = 30; // // =========================================================================== xdr.const("LIQUIDITY_POOL_FEE_V18", 30); @@ -5150,7 +5145,7 @@ xdr.enum("SorobanAuthorizedFunctionType", { // // This variant of auth payload for creating new contract instances // // doesn't allow specifying the constructor arguments, creating contracts // // with constructors that take arguments is only possible by authorizing -// // `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN` +// // `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN` // // (protocol 22+). // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: // CreateContractArgs createContractHostFn; @@ -5197,7 +5192,7 @@ xdr.struct("SorobanAuthorizedInvocation", [ // { // SCAddress address; // int64 nonce; -// uint32 signatureExpirationLedger; +// uint32 signatureExpirationLedger; // SCVal signature; // }; // @@ -5209,18 +5204,52 @@ xdr.struct("SorobanAddressCredentials", [ ["signature", xdr.lookup("ScVal")], ]); +// === xdr source ============================================================ +// +// struct SorobanDelegateSignature +// { +// SCAddress address; +// SCVal signature; +// SorobanDelegateSignature nestedDelegates<>; +// }; +// +// =========================================================================== +xdr.struct("SorobanDelegateSignature", [ + ["address", xdr.lookup("ScAddress")], + ["signature", xdr.lookup("ScVal")], + ["nestedDelegates", xdr.varArray(xdr.lookup("SorobanDelegateSignature"), 2147483647)], +]); + +// === xdr source ============================================================ +// +// struct SorobanAddressCredentialsWithDelegates +// { +// SorobanAddressCredentials addressCredentials; +// SorobanDelegateSignature delegates<>; +// }; +// +// =========================================================================== +xdr.struct("SorobanAddressCredentialsWithDelegates", [ + ["addressCredentials", xdr.lookup("SorobanAddressCredentials")], + ["delegates", xdr.varArray(xdr.lookup("SorobanDelegateSignature"), 2147483647)], +]); + // === xdr source ============================================================ // // enum SorobanCredentialsType // { // SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0, -// SOROBAN_CREDENTIALS_ADDRESS = 1 +// SOROBAN_CREDENTIALS_ADDRESS = 1, +// SOROBAN_CREDENTIALS_ADDRESS_V2 = 2, +// SOROBAN_CREDENTIALS_ADDRESS_WITH_DELEGATES = 3 // }; // // =========================================================================== xdr.enum("SorobanCredentialsType", { sorobanCredentialsSourceAccount: 0, sorobanCredentialsAddress: 1, + sorobanCredentialsAddressV2: 2, + sorobanCredentialsAddressWithDelegates: 3, }); // === xdr source ============================================================ @@ -5231,6 +5260,10 @@ xdr.enum("SorobanCredentialsType", { // void; // case SOROBAN_CREDENTIALS_ADDRESS: // SorobanAddressCredentials address; +// case SOROBAN_CREDENTIALS_ADDRESS_V2: +// SorobanAddressCredentials addressV2; +// case SOROBAN_CREDENTIALS_ADDRESS_WITH_DELEGATES: +// SorobanAddressCredentialsWithDelegates addressWithDelegates; // }; // // =========================================================================== @@ -5240,9 +5273,13 @@ xdr.union("SorobanCredentials", { switches: [ ["sorobanCredentialsSourceAccount", xdr.void()], ["sorobanCredentialsAddress", "address"], + ["sorobanCredentialsAddressV2", "addressV2"], + ["sorobanCredentialsAddressWithDelegates", "addressWithDelegates"], ], arms: { address: xdr.lookup("SorobanAddressCredentials"), + addressV2: xdr.lookup("SorobanAddressCredentials"), + addressWithDelegates: xdr.lookup("SorobanAddressCredentialsWithDelegates"), }, }); @@ -5439,7 +5476,7 @@ xdr.union("OperationBody", { // // if not set, the runtime defaults to "sourceAccount" specified at // // the transaction level // MuxedAccount* sourceAccount; -// +// // union switch (OperationType type) // { // case CREATE_ACCOUNT: @@ -5527,7 +5564,7 @@ xdr.struct("HashIdPreimageOperationId", [ // struct // { // AccountID sourceAccount; -// SequenceNumber seqNum; +// SequenceNumber seqNum; // uint32 opNum; // PoolID liquidityPoolID; // Asset asset; @@ -5574,6 +5611,26 @@ xdr.struct("HashIdPreimageSorobanAuthorization", [ ["invocation", xdr.lookup("SorobanAuthorizedInvocation")], ]); +// === xdr source ============================================================ +// +// struct +// { +// Hash networkID; +// int64 nonce; +// uint32 signatureExpirationLedger; +// SCAddress address; +// SorobanAuthorizedInvocation invocation; +// } +// +// =========================================================================== +xdr.struct("HashIdPreimageSorobanAuthorizationWithAddress", [ + ["networkId", xdr.lookup("Hash")], + ["nonce", xdr.lookup("Int64")], + ["signatureExpirationLedger", xdr.lookup("Uint32")], + ["address", xdr.lookup("ScAddress")], + ["invocation", xdr.lookup("SorobanAuthorizedInvocation")], +]); + // === xdr source ============================================================ // // union HashIDPreimage switch (EnvelopeType type) @@ -5589,7 +5646,7 @@ xdr.struct("HashIdPreimageSorobanAuthorization", [ // struct // { // AccountID sourceAccount; -// SequenceNumber seqNum; +// SequenceNumber seqNum; // uint32 opNum; // PoolID liquidityPoolID; // Asset asset; @@ -5608,6 +5665,15 @@ xdr.struct("HashIdPreimageSorobanAuthorization", [ // uint32 signatureExpirationLedger; // SorobanAuthorizedInvocation invocation; // } sorobanAuthorization; +// case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESS: +// struct +// { +// Hash networkID; +// int64 nonce; +// uint32 signatureExpirationLedger; +// SCAddress address; +// SorobanAuthorizedInvocation invocation; +// } sorobanAuthorizationWithAddress; // }; // // =========================================================================== @@ -5619,12 +5685,14 @@ xdr.union("HashIdPreimage", { ["envelopeTypePoolRevokeOpId", "revokeId"], ["envelopeTypeContractId", "contractId"], ["envelopeTypeSorobanAuthorization", "sorobanAuthorization"], + ["envelopeTypeSorobanAuthorizationWithAddress", "sorobanAuthorizationWithAddress"], ], arms: { operationId: xdr.lookup("HashIdPreimageOperationId"), revokeId: xdr.lookup("HashIdPreimageRevokeId"), contractId: xdr.lookup("HashIdPreimageContractId"), sorobanAuthorization: xdr.lookup("HashIdPreimageSorobanAuthorization"), + sorobanAuthorizationWithAddress: xdr.lookup("HashIdPreimageSorobanAuthorizationWithAddress"), }, }); @@ -5716,12 +5784,12 @@ xdr.struct("LedgerBounds", [ // struct PreconditionsV2 // { // TimeBounds* timeBounds; -// +// // // Transaction only valid for ledger numbers n such that // // minLedger <= n < maxLedger (if maxLedger == 0, then // // only minLedger is checked) // LedgerBounds* ledgerBounds; -// +// // // If NULL, only valid when sourceAccount's sequence number // // is seqNum - 1. Otherwise, valid when sourceAccount's // // sequence number n satisfies minSeqNum <= n < tx.seqNum. @@ -5729,16 +5797,16 @@ xdr.struct("LedgerBounds", [ // // is always raised to tx.seqNum, and a transaction is not // // valid if tx.seqNum is too high to ensure replay protection. // SequenceNumber* minSeqNum; -// +// // // For the transaction to be valid, the current ledger time must // // be at least minSeqAge greater than sourceAccount's seqTime. // Duration minSeqAge; -// +// // // For the transaction to be valid, the current ledger number // // must be at least minSeqLedgerGap greater than sourceAccount's // // seqLedger. // uint32 minSeqLedgerGap; -// +// // // For the transaction to be valid, there must be a signature // // corresponding to every Signer in this array, even if the // // signature is not otherwise required by the sourceAccount or @@ -5816,12 +5884,12 @@ xdr.struct("LedgerFootprint", [ // === xdr source ============================================================ // // struct SorobanResources -// { +// { // // The ledger footprint of the transaction. // LedgerFootprint footprint; // // The maximum number of instructions this transaction can use -// uint32 instructions; -// +// uint32 instructions; +// // // The maximum number of bytes this transaction can read from disk backed entries // uint32 diskReadBytes; // // The maximum number of bytes this transaction can write to ledger @@ -5887,7 +5955,7 @@ xdr.union("SorobanTransactionDataExt", { // } ext; // SorobanResources resources; // // Amount of the transaction `fee` allocated to the Soroban resource fees. -// // The fraction of `resourceFee` corresponding to `resources` specified +// // 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 @@ -5933,7 +6001,7 @@ xdr.union("TransactionV0Ext", { // SequenceNumber seqNum; // TimeBounds* timeBounds; // Memo memo; -// Operation operations; +// Operation operations<100>; // union switch (int v) // { // case 0: @@ -5998,20 +6066,20 @@ xdr.union("TransactionExt", { // { // // account used to run the transaction // MuxedAccount sourceAccount; -// +// // // the fee the sourceAccount will pay // uint32 fee; -// +// // // sequence number to consume in the account // SequenceNumber seqNum; -// +// // // validity conditions // Preconditions cond; -// +// // Memo memo; -// -// Operation operations; -// +// +// Operation operations<100>; +// // union switch (int v) // { // case 0: @@ -6230,11 +6298,11 @@ xdr.enum("ClaimAtomType", { // // emitted to identify the offer // uint256 sellerEd25519; // Account that owns the offer // int64 offerID; -// +// // // amount and asset taken from the owner // Asset assetSold; // int64 amountSold; -// +// // // amount and asset sent to the owner // Asset assetBought; // int64 amountBought; @@ -6257,11 +6325,11 @@ xdr.struct("ClaimOfferAtomV0", [ // // emitted to identify the offer // AccountID sellerID; // Account that owns the offer // int64 offerID; -// +// // // amount and asset taken from the owner // Asset assetSold; // int64 amountSold; -// +// // // amount and asset sent to the owner // Asset assetBought; // int64 amountBought; @@ -6282,11 +6350,11 @@ xdr.struct("ClaimOfferAtom", [ // struct ClaimLiquidityAtom // { // PoolID liquidityPoolID; -// +// // // amount and asset taken from the pool // Asset assetSold; // int64 amountSold; -// +// // // amount and asset sent to the pool // Asset assetBought; // int64 amountBought; @@ -6335,7 +6403,7 @@ xdr.union("ClaimAtom", { // { // // codes considered as "success" for the operation // CREATE_ACCOUNT_SUCCESS = 0, // account was created -// +// // // codes considered as "failure" for the operation // CREATE_ACCOUNT_MALFORMED = -1, // invalid destination // CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account @@ -6387,7 +6455,7 @@ xdr.union("CreateAccountResult", { // { // // codes considered as "success" for the operation // PAYMENT_SUCCESS = 0, // payment successfully completed -// +// // // codes considered as "failure" for the operation // PAYMENT_MALFORMED = -1, // bad input // PAYMENT_UNDERFUNDED = -2, // not enough funds in source account @@ -6458,7 +6526,7 @@ xdr.union("PaymentResult", { // { // // codes considered as "success" for the operation // PATH_PAYMENT_STRICT_RECEIVE_SUCCESS = 0, // success -// +// // // codes considered as "failure" for the operation // PATH_PAYMENT_STRICT_RECEIVE_MALFORMED = -1, // bad input // PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED = @@ -6589,7 +6657,7 @@ xdr.union("PathPaymentStrictReceiveResult", { // { // // codes considered as "success" for the operation // PATH_PAYMENT_STRICT_SEND_SUCCESS = 0, // success -// +// // // codes considered as "failure" for the operation // PATH_PAYMENT_STRICT_SEND_MALFORMED = -1, // bad input // PATH_PAYMENT_STRICT_SEND_UNDERFUNDED = @@ -6702,7 +6770,7 @@ xdr.union("PathPaymentStrictSendResult", { // { // // codes considered as "success" for the operation // MANAGE_SELL_OFFER_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // MANAGE_SELL_OFFER_MALFORMED = -1, // generated offer would be invalid // MANAGE_SELL_OFFER_SELL_NO_TRUST = @@ -6716,11 +6784,11 @@ xdr.union("PathPaymentStrictSendResult", { // -8, // would cross an offer from the same user // MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling // MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying -// +// // // update errors // MANAGE_SELL_OFFER_NOT_FOUND = // -11, // offerID does not match an existing offer -// +// // MANAGE_SELL_OFFER_LOW_RESERVE = // -12 // not enough funds to create a new Offer // }; @@ -6789,7 +6857,7 @@ xdr.union("ManageOfferSuccessResultOffer", { // { // // offers that got claimed while creating this offer // ClaimAtom offersClaimed<>; -// +// // union switch (ManageOfferEffect effect) // { // case MANAGE_OFFER_CREATED: @@ -6858,7 +6926,7 @@ xdr.union("ManageSellOfferResult", { // { // // codes considered as "success" for the operation // MANAGE_BUY_OFFER_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // MANAGE_BUY_OFFER_MALFORMED = -1, // generated offer would be invalid // MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling @@ -6870,11 +6938,11 @@ xdr.union("ManageSellOfferResult", { // MANAGE_BUY_OFFER_CROSS_SELF = -8, // would cross an offer from the same user // MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling // MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying -// +// // // update errors // MANAGE_BUY_OFFER_NOT_FOUND = // -11, // offerID does not match an existing offer -// +// // MANAGE_BUY_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer // }; // @@ -7468,7 +7536,7 @@ xdr.union("ClaimClaimableBalanceResult", { // { // // codes considered as "success" for the operation // BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED = -1, // BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED = -2, @@ -7516,7 +7584,7 @@ xdr.union("BeginSponsoringFutureReservesResult", { // { // // codes considered as "success" for the operation // END_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED = -1 // }; @@ -7556,7 +7624,7 @@ xdr.union("EndSponsoringFutureReservesResult", { // { // // codes considered as "success" for the operation // REVOKE_SPONSORSHIP_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // REVOKE_SPONSORSHIP_DOES_NOT_EXIST = -1, // REVOKE_SPONSORSHIP_NOT_SPONSOR = -2, @@ -7611,7 +7679,7 @@ xdr.union("RevokeSponsorshipResult", { // { // // codes considered as "success" for the operation // CLAWBACK_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // CLAWBACK_MALFORMED = -1, // CLAWBACK_NOT_CLAWBACK_ENABLED = -2, @@ -7662,7 +7730,7 @@ xdr.union("ClawbackResult", { // { // // codes considered as "success" for the operation // CLAWBACK_CLAIMABLE_BALANCE_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, // CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER = -2, @@ -7710,7 +7778,7 @@ xdr.union("ClawbackClaimableBalanceResult", { // { // // codes considered as "success" for the operation // SET_TRUST_LINE_FLAGS_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // SET_TRUST_LINE_FLAGS_MALFORMED = -1, // SET_TRUST_LINE_FLAGS_NO_TRUST_LINE = -2, @@ -7766,7 +7834,7 @@ xdr.union("SetTrustLineFlagsResult", { // { // // codes considered as "success" for the operation // LIQUIDITY_POOL_DEPOSIT_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // LIQUIDITY_POOL_DEPOSIT_MALFORMED = -1, // bad input // LIQUIDITY_POOL_DEPOSIT_NO_TRUST = -2, // no trust line for one of the @@ -7779,7 +7847,7 @@ xdr.union("SetTrustLineFlagsResult", { // // have sufficient limit // LIQUIDITY_POOL_DEPOSIT_BAD_PRICE = -6, // deposit price outside bounds // LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7, // pool reserves are full -// LIQUIDITY_POOL_DEPOSIT_TRUSTLINE_FROZEN = -8 // trustline for one of the +// LIQUIDITY_POOL_DEPOSIT_TRUSTLINE_FROZEN = -8 // trustline for one of the // // assets is frozen // }; // @@ -7838,7 +7906,7 @@ xdr.union("LiquidityPoolDepositResult", { // { // // codes considered as "success" for the operation // LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input // LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the @@ -7848,7 +7916,7 @@ xdr.union("LiquidityPoolDepositResult", { // LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one // // of the assets // LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5, // didn't withdraw enough -// LIQUIDITY_POOL_WITHDRAW_TRUSTLINE_FROZEN = -6 // trustline for one of the +// LIQUIDITY_POOL_WITHDRAW_TRUSTLINE_FROZEN = -6 // trustline for one of the // // assets is frozen // }; // @@ -7901,7 +7969,7 @@ xdr.union("LiquidityPoolWithdrawResult", { // { // // codes considered as "success" for the operation // INVOKE_HOST_FUNCTION_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // INVOKE_HOST_FUNCTION_MALFORMED = -1, // INVOKE_HOST_FUNCTION_TRAPPED = -2, @@ -7957,7 +8025,7 @@ xdr.union("InvokeHostFunctionResult", { // { // // codes considered as "success" for the operation // EXTEND_FOOTPRINT_TTL_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // EXTEND_FOOTPRINT_TTL_MALFORMED = -1, // EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, @@ -8004,7 +8072,7 @@ xdr.union("ExtendFootprintTtlResult", { // { // // codes considered as "success" for the operation // RESTORE_FOOTPRINT_SUCCESS = 0, -// +// // // codes considered as "failure" for the operation // RESTORE_FOOTPRINT_MALFORMED = -1, // RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2, @@ -8050,7 +8118,7 @@ xdr.union("RestoreFootprintResult", { // enum OperationResultCode // { // opINNER = 0, // inner object result is valid -// +// // opBAD_AUTH = -1, // too few valid signatures / wrong network // opNO_ACCOUNT = -2, // source account was not found // opNOT_SUPPORTED = -3, // operation not supported at this time @@ -8290,21 +8358,21 @@ xdr.union("OperationResult", { // { // txFEE_BUMP_INNER_SUCCESS = 1, // fee bump inner transaction succeeded // txSUCCESS = 0, // all operations succeeded -// +// // txFAILED = -1, // one of the operations failed (none were applied) -// +// // txTOO_EARLY = -2, // ledger closeTime before minTime // txTOO_LATE = -3, // ledger closeTime after maxTime // txMISSING_OPERATION = -4, // no operation was specified // txBAD_SEQ = -5, // sequence number does not match source account -// +// // txBAD_AUTH = -6, // too few valid signatures / wrong network // txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve // txNO_ACCOUNT = -8, // source account not found // txINSUFFICIENT_FEE = -9, // fee is too small // txBAD_AUTH_EXTRA = -10, // unused signatures attached to transaction // txINTERNAL_ERROR = -11, // an unknown error occurred -// +// // txNOT_SUPPORTED = -12, // transaction type not supported // txFEE_BUMP_INNER_FAILED = -13, // fee bump inner transaction failed // txBAD_SPONSORSHIP = -14, // sponsorship not confirmed @@ -8420,7 +8488,7 @@ xdr.union("InnerTransactionResultExt", { // { // // Always 0. Here for binary compatibility. // int64 feeCharged; -// +// // union switch (TransactionResultCode code) // { // // txFEE_BUMP_INNER_SUCCESS is not included @@ -8447,7 +8515,7 @@ xdr.union("InnerTransactionResultExt", { // void; // } // result; -// +// // // reserved for future use // union switch (int v) // { @@ -8564,7 +8632,7 @@ xdr.union("TransactionResultExt", { // struct TransactionResult // { // int64 feeCharged; // actual fee charged for the transaction -// +// // union switch (TransactionResultCode code) // { // case txFEE_BUMP_INNER_SUCCESS: @@ -8593,7 +8661,7 @@ xdr.union("TransactionResultExt", { // void; // } // result; -// +// // // reserved for future use // union switch (int v) // { @@ -8929,10 +8997,10 @@ xdr.enum("BinaryFuseFilterType", { // struct SerializedBinaryFuseFilter // { // BinaryFuseFilterType type; -// +// // // Seed used to hash input to filter // ShortHashSeed inputHashSeed; -// +// // // Seed used for internal filter hash operations // ShortHashSeed filterSeed; // uint32 segmentLength; @@ -8940,7 +9008,7 @@ xdr.enum("BinaryFuseFilterType", { // uint32 segmentCount; // uint32 segmentCountLength; // uint32 fingerprintLength; // Length in terms of element count, not bytes -// +// // // Array of uint8_t, uint16_t, or uint32_t depending on filter type // opaque fingerprints<>; // }; @@ -9004,54 +9072,56 @@ xdr.union("ClaimableBalanceId", { // SCV_BOOL = 0, // SCV_VOID = 1, // SCV_ERROR = 2, -// +// // // 32 bits is the smallest type in WASM or XDR; no need for u8/u16. // SCV_U32 = 3, // SCV_I32 = 4, -// +// // // 64 bits is naturally supported by both WASM and XDR also. // SCV_U64 = 5, // SCV_I64 = 6, -// +// // // Time-related u64 subtypes with their own functions and formatting. // SCV_TIMEPOINT = 7, // SCV_DURATION = 8, -// +// // // 128 bits is naturally supported by Rust and we use it for Soroban // // fixed-point arithmetic prices / balances / similar "quantities". These // // are represented in XDR as a pair of 2 u64s. // SCV_U128 = 9, // SCV_I128 = 10, -// +// // // 256 bits is the size of sha256 output, ed25519 keys, and the EVM machine // // word, so for interop use we include this even though it requires a small // // amount of Rust guest and/or host library code. // SCV_U256 = 11, // SCV_I256 = 12, -// +// // // Bytes come in 3 flavors, 2 of which have meaningfully different // // formatting and validity-checking / domain-restriction. // SCV_BYTES = 13, // SCV_STRING = 14, // SCV_SYMBOL = 15, -// +// // // Vecs and maps are just polymorphic containers of other ScVals. // SCV_VEC = 16, // SCV_MAP = 17, -// +// // // Address is the universal identifier for contracts and classic // // accounts. // SCV_ADDRESS = 18, -// +// // // The following are the internal SCVal variants that are not -// // exposed to the contracts. +// // exposed to the contracts. // SCV_CONTRACT_INSTANCE = 19, -// +// // // SCV_LEDGER_KEY_CONTRACT_INSTANCE and SCV_LEDGER_KEY_NONCE are unique // // symbolic SCVals used as the key for ledger entries for a contract's // // instance and an address' nonce, respectively. // SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20, // SCV_LEDGER_KEY_NONCE = 21 +// +// ,SCV_EXECUTABLE_TAG = 22 // }; // // =========================================================================== @@ -9078,6 +9148,7 @@ xdr.enum("ScValType", { scvContractInstance: 19, scvLedgerKeyContractInstance: 20, scvLedgerKeyNonce: 21, + scvExecutableTag: 22, }); // === xdr source ============================================================ @@ -9246,14 +9317,29 @@ xdr.struct("Int256Parts", [ // { // CONTRACT_EXECUTABLE_WASM = 0, // CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 +// ,CONTRACT_EXECUTABLE_EXTERNAL_REF = 2 // }; // // =========================================================================== xdr.enum("ContractExecutableType", { contractExecutableWasm: 0, contractExecutableStellarAsset: 1, + contractExecutableExternalRef: 2, }); +// === xdr source ============================================================ +// +// struct ContractExecutableExternalRef { +// SCAddress executable_owner; +// SCString tag; +// }; +// +// =========================================================================== +xdr.struct("ContractExecutableExternalRef", [ + ["executableOwner", xdr.lookup("ScAddress")], + ["tag", xdr.lookup("ScString")], +]); + // === xdr source ============================================================ // // union ContractExecutable switch (ContractExecutableType type) @@ -9262,6 +9348,8 @@ xdr.enum("ContractExecutableType", { // Hash wasm_hash; // case CONTRACT_EXECUTABLE_STELLAR_ASSET: // void; +// case CONTRACT_EXECUTABLE_EXTERNAL_REF: +// ContractExecutableExternalRef external_ref; // }; // // =========================================================================== @@ -9271,9 +9359,11 @@ xdr.union("ContractExecutable", { switches: [ ["contractExecutableWasm", "wasmHash"], ["contractExecutableStellarAsset", xdr.void()], + ["contractExecutableExternalRef", "externalRef"], ], arms: { wasmHash: xdr.lookup("Hash"), + externalRef: xdr.lookup("ContractExecutableExternalRef"), }, }); @@ -9349,7 +9439,7 @@ xdr.union("ScAddress", { // === xdr source ============================================================ // -// const SCSYMBOL_LIMIT = 32; +// const 32 = 32; // // =========================================================================== xdr.const("SCSYMBOL_LIMIT", 32); @@ -9384,10 +9474,10 @@ xdr.typedef("ScString", xdr.string()); // === xdr source ============================================================ // -// typedef string SCSymbol; +// typedef string SCSymbol<32>; // // =========================================================================== -xdr.typedef("ScSymbol", xdr.string(SCSYMBOL_LIMIT)); +xdr.typedef("ScSymbol", xdr.string(32)); // === xdr source ============================================================ // @@ -9417,19 +9507,19 @@ xdr.struct("ScContractInstance", [ // // union SCVal switch (SCValType type) // { -// +// // case SCV_BOOL: // bool b; // case SCV_VOID: // void; // case SCV_ERROR: // SCError error; -// +// // case SCV_U32: // uint32 u32; // case SCV_I32: // int32 i32; -// +// // case SCV_U64: // uint64 u64; // case SCV_I64: @@ -9438,34 +9528,34 @@ xdr.struct("ScContractInstance", [ // TimePoint timepoint; // case SCV_DURATION: // Duration duration; -// +// // case SCV_U128: // UInt128Parts u128; // case SCV_I128: // Int128Parts i128; -// +// // case SCV_U256: // UInt256Parts u256; // case SCV_I256: // Int256Parts i256; -// +// // case SCV_BYTES: // SCBytes bytes; // case SCV_STRING: // SCString str; // case SCV_SYMBOL: // SCSymbol sym; -// +// // // Vec and Map are recursive so need to live // // behind an option, due to xdrpp limitations. // case SCV_VEC: // SCVec *vec; // case SCV_MAP: // SCMap *map; -// +// // case SCV_ADDRESS: // SCAddress address; -// +// // // Special SCVals reserved for system-constructed contract-data // // ledger keys, not generally usable elsewhere. // case SCV_CONTRACT_INSTANCE: @@ -9474,6 +9564,9 @@ xdr.struct("ScContractInstance", [ // void; // case SCV_LEDGER_KEY_NONCE: // SCNonceKey nonce_key; +// +// case SCV_EXECUTABLE_TAG: +// SCString executable_tag; // }; // // =========================================================================== @@ -9503,6 +9596,7 @@ xdr.union("ScVal", { ["scvContractInstance", "instance"], ["scvLedgerKeyContractInstance", xdr.void()], ["scvLedgerKeyNonce", "nonceKey"], + ["scvExecutableTag", "executableTag"], ], arms: { b: xdr.bool(), @@ -9525,6 +9619,7 @@ xdr.union("ScVal", { address: xdr.lookup("ScAddress"), instance: xdr.lookup("ScContractInstance"), nonceKey: xdr.lookup("ScNonceKey"), + executableTag: xdr.lookup("ScString"), }, }); @@ -9638,7 +9733,7 @@ xdr.union("ScMetaEntry", { // === xdr source ============================================================ // -// const SC_SPEC_DOC_LIMIT = 1024; +// const 1024 = 1024; // // =========================================================================== xdr.const("SC_SPEC_DOC_LIMIT", 1024); @@ -9648,7 +9743,7 @@ xdr.const("SC_SPEC_DOC_LIMIT", 1024); // enum SCSpecType // { // SC_SPEC_TYPE_VAL = 0, -// +// // // Types with no parameters. // SC_SPEC_TYPE_BOOL = 1, // SC_SPEC_TYPE_VOID = 2, @@ -9668,7 +9763,7 @@ xdr.const("SC_SPEC_DOC_LIMIT", 1024); // SC_SPEC_TYPE_SYMBOL = 17, // SC_SPEC_TYPE_ADDRESS = 19, // SC_SPEC_TYPE_MUXED_ADDRESS = 20, -// +// // // Types with parameters. // SC_SPEC_TYPE_OPTION = 1000, // SC_SPEC_TYPE_RESULT = 1001, @@ -9676,7 +9771,7 @@ xdr.const("SC_SPEC_DOC_LIMIT", 1024); // SC_SPEC_TYPE_MAP = 1004, // SC_SPEC_TYPE_TUPLE = 1005, // SC_SPEC_TYPE_BYTES_N = 1006, -// +// // // User defined types. // SC_SPEC_TYPE_UDT = 2000 // }; @@ -9886,14 +9981,14 @@ xdr.union("ScSpecTypeDef", { // // struct SCSpecUDTStructFieldV0 // { -// string doc; +// string doc<1024>; // string name<30>; // SCSpecTypeDef type; // }; // // =========================================================================== xdr.struct("ScSpecUdtStructFieldV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(30)], ["type", xdr.lookup("ScSpecTypeDef")], ]); @@ -9902,7 +9997,7 @@ xdr.struct("ScSpecUdtStructFieldV0", [ // // struct SCSpecUDTStructV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTStructFieldV0 fields<>; @@ -9910,7 +10005,7 @@ xdr.struct("ScSpecUdtStructFieldV0", [ // // =========================================================================== xdr.struct("ScSpecUdtStructV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.string(60)], ["fields", xdr.varArray(xdr.lookup("ScSpecUdtStructFieldV0"), 2147483647)], @@ -9920,13 +10015,13 @@ xdr.struct("ScSpecUdtStructV0", [ // // struct SCSpecUDTUnionCaseVoidV0 // { -// string doc; +// string doc<1024>; // string name<60>; // }; // // =========================================================================== xdr.struct("ScSpecUdtUnionCaseVoidV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(60)], ]); @@ -9934,14 +10029,14 @@ xdr.struct("ScSpecUdtUnionCaseVoidV0", [ // // struct SCSpecUDTUnionCaseTupleV0 // { -// string doc; +// string doc<1024>; // string name<60>; // SCSpecTypeDef type<>; // }; // // =========================================================================== xdr.struct("ScSpecUdtUnionCaseTupleV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(60)], ["type", xdr.varArray(xdr.lookup("ScSpecTypeDef"), 2147483647)], ]); @@ -9988,7 +10083,7 @@ xdr.union("ScSpecUdtUnionCaseV0", { // // struct SCSpecUDTUnionV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTUnionCaseV0 cases<>; @@ -9996,7 +10091,7 @@ xdr.union("ScSpecUdtUnionCaseV0", { // // =========================================================================== xdr.struct("ScSpecUdtUnionV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.string(60)], ["cases", xdr.varArray(xdr.lookup("ScSpecUdtUnionCaseV0"), 2147483647)], @@ -10006,14 +10101,14 @@ xdr.struct("ScSpecUdtUnionV0", [ // // struct SCSpecUDTEnumCaseV0 // { -// string doc; +// string doc<1024>; // string name<60>; // uint32 value; // }; // // =========================================================================== xdr.struct("ScSpecUdtEnumCaseV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(60)], ["value", xdr.lookup("Uint32")], ]); @@ -10022,7 +10117,7 @@ xdr.struct("ScSpecUdtEnumCaseV0", [ // // struct SCSpecUDTEnumV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTEnumCaseV0 cases<>; @@ -10030,7 +10125,7 @@ xdr.struct("ScSpecUdtEnumCaseV0", [ // // =========================================================================== xdr.struct("ScSpecUdtEnumV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.string(60)], ["cases", xdr.varArray(xdr.lookup("ScSpecUdtEnumCaseV0"), 2147483647)], @@ -10040,14 +10135,14 @@ xdr.struct("ScSpecUdtEnumV0", [ // // struct SCSpecUDTErrorEnumCaseV0 // { -// string doc; +// string doc<1024>; // string name<60>; // uint32 value; // }; // // =========================================================================== xdr.struct("ScSpecUdtErrorEnumCaseV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(60)], ["value", xdr.lookup("Uint32")], ]); @@ -10056,7 +10151,7 @@ xdr.struct("ScSpecUdtErrorEnumCaseV0", [ // // struct SCSpecUDTErrorEnumV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTErrorEnumCaseV0 cases<>; @@ -10064,7 +10159,7 @@ xdr.struct("ScSpecUdtErrorEnumCaseV0", [ // // =========================================================================== xdr.struct("ScSpecUdtErrorEnumV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.string(60)], ["cases", xdr.varArray(xdr.lookup("ScSpecUdtErrorEnumCaseV0"), 2147483647)], @@ -10074,14 +10169,14 @@ xdr.struct("ScSpecUdtErrorEnumV0", [ // // struct SCSpecFunctionInputV0 // { -// string doc; +// string doc<1024>; // string name<30>; // SCSpecTypeDef type; // }; // // =========================================================================== xdr.struct("ScSpecFunctionInputV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(30)], ["type", xdr.lookup("ScSpecTypeDef")], ]); @@ -10090,7 +10185,7 @@ xdr.struct("ScSpecFunctionInputV0", [ // // struct SCSpecFunctionV0 // { -// string doc; +// string doc<1024>; // SCSymbol name; // SCSpecFunctionInputV0 inputs<>; // SCSpecTypeDef outputs<1>; @@ -10098,7 +10193,7 @@ xdr.struct("ScSpecFunctionInputV0", [ // // =========================================================================== xdr.struct("ScSpecFunctionV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.lookup("ScSymbol")], ["inputs", xdr.varArray(xdr.lookup("ScSpecFunctionInputV0"), 2147483647)], ["outputs", xdr.varArray(xdr.lookup("ScSpecTypeDef"), 1)], @@ -10122,7 +10217,7 @@ xdr.enum("ScSpecEventParamLocationV0", { // // struct SCSpecEventParamV0 // { -// string doc; +// string doc<1024>; // string name<30>; // SCSpecTypeDef type; // SCSpecEventParamLocationV0 location; @@ -10130,7 +10225,7 @@ xdr.enum("ScSpecEventParamLocationV0", { // // =========================================================================== xdr.struct("ScSpecEventParamV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["name", xdr.string(30)], ["type", xdr.lookup("ScSpecTypeDef")], ["location", xdr.lookup("ScSpecEventParamLocationV0")], @@ -10156,7 +10251,7 @@ xdr.enum("ScSpecEventDataFormat", { // // struct SCSpecEventV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // SCSymbol name; // SCSymbol prefixTopics<2>; @@ -10166,7 +10261,7 @@ xdr.enum("ScSpecEventDataFormat", { // // =========================================================================== xdr.struct("ScSpecEventV0", [ - ["doc", xdr.string(SC_SPEC_DOC_LIMIT)], + ["doc", xdr.string(1024)], ["lib", xdr.string(80)], ["name", xdr.lookup("ScSymbol")], ["prefixTopics", xdr.varArray(xdr.lookup("ScSymbol"), 2)], @@ -10266,7 +10361,7 @@ xdr.struct("ConfigSettingContractExecutionLanesV0", [ // int64 txMaxInstructions; // // Cost of 10000 instructions // int64 feeRatePerInstructionsIncrement; -// +// // // Memory limit per transaction. Unlike instructions, there is no fee // // for memory, just the limit. // uint32 txMemoryLimit; @@ -10308,7 +10403,7 @@ xdr.struct("ConfigSettingContractParallelComputeV0", [ // uint32 ledgerMaxWriteLedgerEntries; // // Maximum number of bytes that can be written per ledger // uint32 ledgerMaxWriteBytes; -// +// // // Maximum number of disk entry read operations per transaction // uint32 txMaxDiskReadEntries; // // Maximum number of bytes of disk reads that can be performed per transaction @@ -10317,12 +10412,12 @@ xdr.struct("ConfigSettingContractParallelComputeV0", [ // uint32 txMaxWriteLedgerEntries; // // Maximum number of bytes that can be written per transaction // uint32 txMaxWriteBytes; -// +// // int64 feeDiskReadLedgerEntry; // Fee per disk ledger entry read // int64 feeWriteLedgerEntry; // Fee per ledger entry write -// +// // int64 feeDiskRead1KB; // Fee for reading 1KB disk -// +// // // The following parameters determine the write fee per 1KB. // // Rent fee grows linearly until soroban state reaches this size // int64 sorobanStateTargetSizeBytes; @@ -10407,7 +10502,7 @@ xdr.struct("ConfigSettingContractEventsV0", [ // uint32 ledgerMaxTxsSizeBytes; // // Maximum size in bytes for a transaction // uint32 txMaxSizeBytes; -// +// // // Fee for 1 KB of transaction size // int64 feeTxSize1KB; // }; @@ -10433,7 +10528,7 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // // Cost of a host function dispatch, not including the actual work done by // // the function nor the cost of VM invocation machinary // DispatchHostFunction = 4, -// // Cost of visiting a host object from the host object storage. Exists to +// // 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 = 5, @@ -10473,7 +10568,7 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // Int256Shift = 21, // // Cost of drawing random bytes using a ChaCha20 PRNG // ChaCha20DrawBytes = 22, -// +// // // Cost of parsing wasm bytes that only encode instructions. // ParseWasmInstructions = 23, // // Cost of parsing a known number of wasm functions. @@ -10494,7 +10589,7 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // ParseWasmExports = 31, // // Cost of parsing a known number of data segment bytes. // ParseWasmDataSegmentBytes = 32, -// +// // // Cost of instantiating wasm bytes that only encode instructions. // InstantiateWasmInstructions = 33, // // Cost of instantiating a known number of wasm functions. @@ -10515,13 +10610,13 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // InstantiateWasmExports = 41, // // Cost of instantiating a known number of data segment bytes. // InstantiateWasmDataSegmentBytes = 42, -// +// // // Cost of decoding a bytes array representing an uncompressed SEC-1 encoded // // point on a 256-bit elliptic curve // Sec1DecodePointUncompressed = 43, // // Cost of verifying an ECDSA Secp256r1 signature // VerifyEcdsaSecp256r1Sig = 44, -// +// // // Cost of encoding a BLS12-381 Fp (base field element) // Bls12381EncodeFp = 45, // // Cost of decoding a BLS12-381 Fp (base field element) @@ -10572,7 +10667,7 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // Bls12381FrPow = 68, // // Cost of performing BLS12-381 scalar element inversion // Bls12381FrInv = 69, -// +// // // Cost of encoding a BN254 Fp (base field element) // Bn254EncodeFp = 70, // // Cost of decoding a BN254 Fp (base field element) @@ -10702,7 +10797,7 @@ xdr.enum("ContractCostType", { // struct ContractCostParamEntry { // // use `ext` to add more terms (e.g. higher order polynomials) in the future // ExtensionPoint ext; -// +// // int64 constTerm; // int64 linearTerm; // }; @@ -10720,23 +10815,23 @@ xdr.struct("ContractCostParamEntry", [ // 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 archival meta in a single ledger // uint32 maxEntriesToArchive; -// +// // // Number of snapshots to use when calculating average live Soroban State size // uint32 liveSorobanStateSizeWindowSampleSize; -// +// // // How often to sample the live Soroban State size for the average, in ledgers // uint32 liveSorobanStateSizeWindowSamplePeriod; -// +// // // Maximum number of bytes that we scan for eviction per ledger // uint32 evictionScanSize; -// +// // // Lowest BucketList level to be scanned to evict entries // uint32 startingEvictionScanLevel; // }; @@ -10839,14 +10934,14 @@ xdr.struct("FreezeBypassTxsDelta", [ // === xdr source ============================================================ // -// const CONTRACT_COST_COUNT_LIMIT = 1024; +// const 1024 = 1024; // // =========================================================================== xdr.const("CONTRACT_COST_COUNT_LIMIT", 1024); // === xdr source ============================================================ // -// typedef ContractCostParamEntry ContractCostParams; +// typedef ContractCostParamEntry ContractCostParams<1024>; // // =========================================================================== xdr.typedef("ContractCostParams", xdr.varArray(xdr.lookup("ContractCostParamEntry"), xdr.lookup("CONTRACT_COST_COUNT_LIMIT"))); @@ -11009,10 +11104,10 @@ xdr.union("ConfigSettingEntry", { // { // // starting ledger sequence number in the batch // uint32 startSequence; -// +// // // ending ledger sequence number in the batch // uint32 endSequence; -// +// // // Ledger close meta for each ledger within the batch // LedgerCloseMeta ledgerCloseMetas<>; // }; diff --git a/src/invocation.js b/src/invocation.js index 344b3571..4e9dd0a2 100644 --- a/src/invocation.js +++ b/src/invocation.js @@ -5,8 +5,9 @@ import { scValToNative } from './scval'; /** * @typedef CreateInvocation * - * @prop {'wasm'|'sac'} type a type indicating if this creation was a custom - * contract or a wrapping of an existing Stellar asset + * @prop {'wasm'|'sac'|'external_ref'} type a type indicating if this creation + * was a custom contract, a wrapping of an existing Stellar asset, or an + * externally managed contract executable (CAP-0085) * @prop {string} [token] when `type=='sac'`, the canonical {@link Asset} that * is being wrapped by this Stellar Asset Contract * @prop {object} [wasm] when `type=='wasm'`, add'l creation parameters @@ -18,6 +19,13 @@ import { scValToNative } from './scval'; * @prop {any[]} [wasm.constructorArgs] a list of natively-represented values * (see {@link scValToNative}) that are passed to the constructor when * creating this contract + * @prop {object} [externalRef] when `type=='external_ref'` (CAP-0085), the + * externally managed executable parameters. NOTE: the exact + * `ContractIdPreimage` validation for this arm is not yet finalized in the + * CAP; the preimage is not validated when building the tree. + * @prop {string} externalRef.owner the strkey of the executable's owner + * address + * @prop {string} externalRef.tag the executable tag (an SCString payload) */ /** @@ -118,7 +126,14 @@ export function buildInvocationTree(root) { // The first part may not be true in V2, but we'd need to update this code // anyway so it can still be an error. const [exec, preimage] = [inner.executable(), inner.contractIdPreimage()]; - if (!!exec.switch().value !== !!preimage.switch().value) { + // The wasm(0)↔address(0) / token(1)↔asset(1) invariant only applies to + // the pre-CAP-0085 executable arms. The external-ref arm (2) uses a + // preimage shape that is not yet finalized in the CAP, so skip the check + // for it (see the `case 2` below). + if ( + exec.switch().value < 2 && + !!exec.switch().value !== !!preimage.switch().value + ) { throw new Error( `creation function appears invalid: ${JSON.stringify( inner @@ -155,6 +170,27 @@ export function buildInvocationTree(root) { ).toString(); break; + // contractExecutableExternalRef (CAP-0085, `next` channel only) + // + // NEEDS SPEC REVIEW: the exact `ContractIdPreimage` shape for + // external-ref creation is not yet finalized in the CAP, so we decode + // the executable's owner/tag but do not attempt to validate the + // preimage here. This keeps auth-tree building non-throwing for a + // CREATE_CONTRACT_V2 carrying an external-ref executable. + case 2: { + const ref = exec.externalRef(); + const tag = ref.tag(); // ScString: string|Buffer + output.args.type = 'external_ref'; + output.args.externalRef = { + owner: Address.fromScAddress(ref.executableOwner()).toString(), + tag: + Buffer.isBuffer(tag) || ArrayBuffer.isView(tag) + ? new TextDecoder().decode(tag) + : tag + }; + break; + } + default: throw new Error(`unknown creation type: ${JSON.stringify(exec)}`); } diff --git a/src/scval.js b/src/scval.js index 8a66eb01..db1e5fa6 100644 --- a/src/scval.js +++ b/src/scval.js @@ -363,6 +363,12 @@ export function scValToNative(scv) { // Note that we assume a utf8 encoding (ascii-compatible). For other // encodings, you should probably use bytes anyway. If it cannot be decoded, // the raw bytes are returned. + // CAP-0085: the externally managed executable tag carries an SCString + // payload, so decode it the same way as scvString. This arm is gated to + // the `next` channel, so guard the case label with optional chaining (it + // resolves to `undefined` and never matches a real switch value when the + // arm is absent from the `curr` codec). + case xdr.ScValType.scvExecutableTag?.()?.value: case xdr.ScValType.scvSymbol().value: case xdr.ScValType.scvString().value: { const v = scv.value(); // string|Buffer diff --git a/types/index.d.ts b/types/index.d.ts index 1977b29a..6c43aa9b 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1270,7 +1270,7 @@ export function authorizeEntry( ): Promise; export interface CreateInvocation { - type: 'wasm' | 'sac'; + type: 'wasm' | 'sac' | 'external_ref'; token?: string; wasm?: { hash: string; @@ -1278,6 +1278,10 @@ export interface CreateInvocation { salt: string; constructorArgs?: any[]; }; + externalRef?: { + owner: string; + tag: string; + }; } export interface ExecuteInvocation { diff --git a/types/next.d.ts b/types/next.d.ts index 7b24280c..5a5b7af8 100644 --- a/types/next.d.ts +++ b/types/next.d.ts @@ -1966,7 +1966,8 @@ export namespace xdr { | 'scvAddress' | 'scvContractInstance' | 'scvLedgerKeyContractInstance' - | 'scvLedgerKeyNonce'; + | 'scvLedgerKeyNonce' + | 'scvExecutableTag'; readonly value: | 0 @@ -1990,7 +1991,8 @@ export namespace xdr { | 18 | 19 | 20 - | 21; + | 21 + | 22; static scvBool(): ScValType; @@ -2035,6 +2037,8 @@ export namespace xdr { static scvLedgerKeyContractInstance(): ScValType; static scvLedgerKeyNonce(): ScValType; + + static scvExecutableTag(): ScValType; } class ScErrorType { @@ -2110,13 +2114,18 @@ export namespace xdr { } class ContractExecutableType { - readonly name: 'contractExecutableWasm' | 'contractExecutableStellarAsset'; + readonly name: + | 'contractExecutableWasm' + | 'contractExecutableStellarAsset' + | 'contractExecutableExternalRef'; - readonly value: 0 | 1; + readonly value: 0 | 1 | 2; static contractExecutableWasm(): ContractExecutableType; static contractExecutableStellarAsset(): ContractExecutableType; + + static contractExecutableExternalRef(): ContractExecutableType; } class ScAddressType { @@ -15452,11 +15461,19 @@ export namespace xdr { wasmHash(value?: Buffer): Buffer; + externalRef( + value?: ContractExecutableExternalRef, + ): ContractExecutableExternalRef; + static contractExecutableWasm(value: Buffer): ContractExecutable; static contractExecutableStellarAsset(): ContractExecutable; - value(): Buffer | void; + static contractExecutableExternalRef( + value: ContractExecutableExternalRef, + ): ContractExecutable; + + value(): Buffer | ContractExecutableExternalRef | void; toXDR(format?: 'raw'): Buffer; @@ -15479,6 +15496,43 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } + class ContractExecutableExternalRef { + constructor(attributes: { + executableOwner: ScAddress; + tag: string | Buffer; + }); + + executableOwner(value?: ScAddress): ScAddress; + + tag(value?: string | Buffer): string | Buffer; + + toXDR(format?: 'raw'): Buffer; + + toXDR(format: 'hex' | 'base64'): string; + + static read(io: Buffer): ContractExecutableExternalRef; + + static write(value: ContractExecutableExternalRef, io: Buffer): void; + + static isValid(value: ContractExecutableExternalRef): boolean; + + static toXDR(value: ContractExecutableExternalRef): Buffer; + + static fromXDR( + input: Buffer, + format?: 'raw', + ): ContractExecutableExternalRef; + + static fromXDR( + input: string, + format: 'hex' | 'base64', + ): ContractExecutableExternalRef; + + static validateXDR(input: Buffer, format?: 'raw'): boolean; + + static validateXDR(input: string, format: 'hex' | 'base64'): boolean; + } + class ScAddress { switch(): ScAddressType; @@ -15573,6 +15627,8 @@ export namespace xdr { nonceKey(value?: ScNonceKey): ScNonceKey; + executableTag(value?: string | Buffer): string | Buffer; + static scvBool(value: boolean): ScVal; static scvVoid(): ScVal; @@ -15617,6 +15673,8 @@ export namespace xdr { static scvLedgerKeyNonce(value: ScNonceKey): ScVal; + static scvExecutableTag(value: string | Buffer): ScVal; + value(): | boolean | ScError diff --git a/types/test.ts b/types/test.ts index 43cb6019..8a9118d8 100644 --- a/types/test.ts +++ b/types/test.ts @@ -363,3 +363,9 @@ const root = new StellarSdk.xdr.SorobanAuthorizedInvocation({ subInvocations: [], }); StellarSdk.walkInvocationTree(root, (_node, _depth, _parent) => {}); + +// CAP-0085: externally managed contract executable creation shape +const externalRefCreate: StellarSdk.CreateInvocation = { + type: 'external_ref', + externalRef: { owner: 'C...', tag: 'mytag' } +}; diff --git a/xdr/curr/Stellar-contract.x b/xdr/curr/Stellar-contract.x index 0e67dc3f..2087db56 100644 --- a/xdr/curr/Stellar-contract.x +++ b/xdr/curr/Stellar-contract.x @@ -71,6 +71,7 @@ enum SCValType // instance and an address' nonce, respectively. SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20, SCV_LEDGER_KEY_NONCE = 21 + }; enum SCErrorType @@ -168,6 +169,7 @@ enum ContractExecutableType CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 }; + union ContractExecutable switch (ContractExecutableType type) { case CONTRACT_EXECUTABLE_WASM: @@ -285,6 +287,7 @@ case SCV_LEDGER_KEY_CONTRACT_INSTANCE: void; case SCV_LEDGER_KEY_NONCE: SCNonceKey nonce_key; + }; struct SCMapEntry diff --git a/xdr/curr/Stellar-ledger-entries.x b/xdr/curr/Stellar-ledger-entries.x index b9a9a168..348311c8 100644 --- a/xdr/curr/Stellar-ledger-entries.x +++ b/xdr/curr/Stellar-ledger-entries.x @@ -664,7 +664,8 @@ enum EnvelopeType ENVELOPE_TYPE_OP_ID = 6, ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7, ENVELOPE_TYPE_CONTRACT_ID = 8, - ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9 + ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9, + ENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESS = 10 }; enum BucketListType diff --git a/xdr/curr/Stellar-ledger.x b/xdr/curr/Stellar-ledger.x index a17036b8..5d751cef 100644 --- a/xdr/curr/Stellar-ledger.x +++ b/xdr/curr/Stellar-ledger.x @@ -425,7 +425,7 @@ struct SorobanTransactionMetaExtV1 // transactions, this will be `0` for failed transactions. int64 totalRefundableResourceFeeCharged; // Amount (in stroops) that has been charged for rent. - // This is a part of `totalNonRefundableResourceFeeCharged`. + // This is a part of `totalRefundableResourceFeeCharged`. int64 rentFeeCharged; }; diff --git a/xdr/curr/Stellar-transaction.x b/xdr/curr/Stellar-transaction.x index c22f5b4a..11cacd74 100644 --- a/xdr/curr/Stellar-transaction.x +++ b/xdr/curr/Stellar-transaction.x @@ -569,10 +569,25 @@ struct SorobanAddressCredentials SCVal signature; }; +struct SorobanDelegateSignature +{ + SCAddress address; + SCVal signature; + SorobanDelegateSignature nestedDelegates<>; +}; + +struct SorobanAddressCredentialsWithDelegates +{ + SorobanAddressCredentials addressCredentials; + SorobanDelegateSignature delegates<>; +}; + enum SorobanCredentialsType { SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0, - SOROBAN_CREDENTIALS_ADDRESS = 1 + SOROBAN_CREDENTIALS_ADDRESS = 1, + SOROBAN_CREDENTIALS_ADDRESS_V2 = 2, + SOROBAN_CREDENTIALS_ADDRESS_WITH_DELEGATES = 3 }; union SorobanCredentials switch (SorobanCredentialsType type) @@ -581,6 +596,10 @@ case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: void; case SOROBAN_CREDENTIALS_ADDRESS: SorobanAddressCredentials address; +case SOROBAN_CREDENTIALS_ADDRESS_V2: + SorobanAddressCredentials addressV2; +case SOROBAN_CREDENTIALS_ADDRESS_WITH_DELEGATES: + SorobanAddressCredentialsWithDelegates addressWithDelegates; }; /* Unit of authorization data for Soroban. @@ -731,6 +750,15 @@ case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: uint32 signatureExpirationLedger; SorobanAuthorizedInvocation invocation; } sorobanAuthorization; +case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESS: + struct + { + Hash networkID; + int64 nonce; + uint32 signatureExpirationLedger; + SCAddress address; + SorobanAuthorizedInvocation invocation; + } sorobanAuthorizationWithAddress; }; enum MemoType diff --git a/xdr/curr/Stellar-types.x b/xdr/curr/Stellar-types.x index f383d2e4..670be6fd 100644 --- a/xdr/curr/Stellar-types.x +++ b/xdr/curr/Stellar-types.x @@ -149,4 +149,6 @@ union ClaimableBalanceID switch (ClaimableBalanceIDType type) case CLAIMABLE_BALANCE_ID_TYPE_V0: Hash v0; }; + + } \ No newline at end of file diff --git a/xdr/next/Stellar-contract.x b/xdr/next/Stellar-contract.x index 0e67dc3f..7e8e92e3 100644 --- a/xdr/next/Stellar-contract.x +++ b/xdr/next/Stellar-contract.x @@ -71,6 +71,8 @@ enum SCValType // instance and an address' nonce, respectively. SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20, SCV_LEDGER_KEY_NONCE = 21 + + ,SCV_EXECUTABLE_TAG = 22 }; enum SCErrorType @@ -166,6 +168,12 @@ enum ContractExecutableType { CONTRACT_EXECUTABLE_WASM = 0, CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 + ,CONTRACT_EXECUTABLE_EXTERNAL_REF = 2 +}; + +struct ContractExecutableExternalRef { + SCAddress executable_owner; + SCString tag; }; union ContractExecutable switch (ContractExecutableType type) @@ -174,6 +182,8 @@ case CONTRACT_EXECUTABLE_WASM: Hash wasm_hash; case CONTRACT_EXECUTABLE_STELLAR_ASSET: void; +case CONTRACT_EXECUTABLE_EXTERNAL_REF: + ContractExecutableExternalRef external_ref; }; enum SCAddressType @@ -285,6 +295,9 @@ case SCV_LEDGER_KEY_CONTRACT_INSTANCE: void; case SCV_LEDGER_KEY_NONCE: SCNonceKey nonce_key; + +case SCV_EXECUTABLE_TAG: + SCString executable_tag; }; struct SCMapEntry diff --git a/xdr/next/Stellar-ledger-entries.x b/xdr/next/Stellar-ledger-entries.x index b9a9a168..348311c8 100644 --- a/xdr/next/Stellar-ledger-entries.x +++ b/xdr/next/Stellar-ledger-entries.x @@ -664,7 +664,8 @@ enum EnvelopeType ENVELOPE_TYPE_OP_ID = 6, ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7, ENVELOPE_TYPE_CONTRACT_ID = 8, - ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9 + ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9, + ENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESS = 10 }; enum BucketListType diff --git a/xdr/next/Stellar-ledger.x b/xdr/next/Stellar-ledger.x index a17036b8..5d751cef 100644 --- a/xdr/next/Stellar-ledger.x +++ b/xdr/next/Stellar-ledger.x @@ -425,7 +425,7 @@ struct SorobanTransactionMetaExtV1 // transactions, this will be `0` for failed transactions. int64 totalRefundableResourceFeeCharged; // Amount (in stroops) that has been charged for rent. - // This is a part of `totalNonRefundableResourceFeeCharged`. + // This is a part of `totalRefundableResourceFeeCharged`. int64 rentFeeCharged; }; diff --git a/xdr/next/Stellar-transaction.x b/xdr/next/Stellar-transaction.x index c22f5b4a..11cacd74 100644 --- a/xdr/next/Stellar-transaction.x +++ b/xdr/next/Stellar-transaction.x @@ -569,10 +569,25 @@ struct SorobanAddressCredentials SCVal signature; }; +struct SorobanDelegateSignature +{ + SCAddress address; + SCVal signature; + SorobanDelegateSignature nestedDelegates<>; +}; + +struct SorobanAddressCredentialsWithDelegates +{ + SorobanAddressCredentials addressCredentials; + SorobanDelegateSignature delegates<>; +}; + enum SorobanCredentialsType { SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0, - SOROBAN_CREDENTIALS_ADDRESS = 1 + SOROBAN_CREDENTIALS_ADDRESS = 1, + SOROBAN_CREDENTIALS_ADDRESS_V2 = 2, + SOROBAN_CREDENTIALS_ADDRESS_WITH_DELEGATES = 3 }; union SorobanCredentials switch (SorobanCredentialsType type) @@ -581,6 +596,10 @@ case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: void; case SOROBAN_CREDENTIALS_ADDRESS: SorobanAddressCredentials address; +case SOROBAN_CREDENTIALS_ADDRESS_V2: + SorobanAddressCredentials addressV2; +case SOROBAN_CREDENTIALS_ADDRESS_WITH_DELEGATES: + SorobanAddressCredentialsWithDelegates addressWithDelegates; }; /* Unit of authorization data for Soroban. @@ -731,6 +750,15 @@ case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: uint32 signatureExpirationLedger; SorobanAuthorizedInvocation invocation; } sorobanAuthorization; +case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESS: + struct + { + Hash networkID; + int64 nonce; + uint32 signatureExpirationLedger; + SCAddress address; + SorobanAuthorizedInvocation invocation; + } sorobanAuthorizationWithAddress; }; enum MemoType diff --git a/xdr/next/Stellar-types.x b/xdr/next/Stellar-types.x index f383d2e4..670be6fd 100644 --- a/xdr/next/Stellar-types.x +++ b/xdr/next/Stellar-types.x @@ -149,4 +149,6 @@ union ClaimableBalanceID switch (ClaimableBalanceIDType type) case CLAIMABLE_BALANCE_ID_TYPE_V0: Hash v0; }; + + } \ No newline at end of file