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..e3007235 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +### Added +* XDR definitions updated for Protocol 28 / CAP-0084 (muxed contract addresses): new `SC_ADDRESS_TYPE_MUXED_CONTRACT` arm on `ScAddress` and `MuxedContract` struct, gated behind the `CAP_0084_MUXED_CONTRACT` feature in the regen. `Address` now decodes/encodes the muxed-contract arm (`Address.muxedContract(contractId, id)`, `Address.fromScAddress`/`toScAddress`) with `contractId()` / `muxedId()` accessors, and renders it as `:` (display only — there is no canonical strkey yet, so the string is not parsable back via the `Address` constructor, and `toBuffer()` is unsupported for this arm). + ## [`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..92073af7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,12 @@ -XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/cff714a5ebaaaf2dac343b3546c2df73f0b7a36e +# CAP-83 + CAP-84 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_0084_MUXED_CONTRACT is gated to the `next` channel only: the muxed +# contract address arm is not enabled on `curr` until protocol 28 ships. +XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/7b5618146590e15d2e250538dccbc7c89ac55c58 XDR_BASE_LOCAL_CURR=xdr/curr +XDR_FEATURES_CURR=CAP_0083 +XDR_FEATURES_NEXT=CAP_0083,CAP_0084_MUXED_CONTRACT XDR_FILES_CURR= \ Stellar-SCP.x \ Stellar-ledger-entries.x \ @@ -15,7 +22,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/7b5618146590e15d2e250538dccbc7c89ac55c58 XDR_BASE_LOCAL_NEXT=xdr/next XDR_FILES_NEXT= \ Stellar-SCP.x \ @@ -42,24 +49,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 +78,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 +94,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/address.js b/src/address.js index d3d0734d..bf40b082 100644 --- a/src/address.js +++ b/src/address.js @@ -6,9 +6,13 @@ import xdr from './xdr'; * * `Address` represents a single address in the Stellar network that can be * inputted to or outputted by a smart contract. An address can represent an - * account, muxed account, contract, claimable balance, or a liquidity pool - * (the latter two can only be present as the *output* of Core in the form - * of an event, never an input to a smart contract). + * account, muxed account, contract, muxed contract, claimable balance, or a + * liquidity pool (the latter two can only be present as the *output* of Core + * in the form of an event, never an input to a smart contract). + * + * Muxed-contract addresses (CAP-0084) have no canonical StrKey yet, so they + * cannot be constructed from a string; build them with + * {@link Address.muxedContract} or {@link Address.fromScAddress}. * * @constructor * @@ -96,6 +100,31 @@ export class Address { return new Address(StrKey.encodeMed25519PublicKey(buffer)); } + /** + * Creates a new muxed-contract Address object (CAP-0084). + * + * A muxed-contract address (`SC_ADDRESS_TYPE_MUXED_CONTRACT`) pairs a + * 32-byte contract ID with a `uint64` multiplexing ID. There is no canonical + * StrKey form for it yet, so unlike the other factories it does not route + * through the {@link Address} constructor and the resulting address cannot be + * parsed back out of a string. Round-trip it through {@link Address.fromScAddress} + * / {@link Address#toScAddress} instead; {@link Address#toString} renders the + * display-only form `:`. + * + * @param {Buffer} contractId - the raw 32 bytes of the contract ID + * @param {number|bigint|string|xdr.Uint64} id - the uint64 multiplexing ID; + * pass a string or {@link xdr.Uint64} for values above + * `Number.MAX_SAFE_INTEGER` to avoid precision loss + * @returns {Address} + */ + static muxedContract(contractId, id) { + const address = Object.create(Address.prototype); + address._type = 'muxedContract'; + address._key = Buffer.from(contractId); + address._muxId = id instanceof xdr.Uint64 ? id : new xdr.Uint64(id); + return address; + } + /** * Convert this from an xdr.ScVal type. * @@ -133,6 +162,14 @@ export class Address { } case xdr.ScAddressType.scAddressTypeLiquidityPool().value: return Address.liquidityPool(scAddress.liquidityPoolId()); + // CAP-0084 muxed contract addresses are gated to the `next` channel: + // `scAddressTypeMuxedContract` is absent from the `curr` codec, so guard + // the case label with optional chaining (it resolves to `undefined` and + // never matches a real switch value when the arm is not defined). + case xdr.ScAddressType.scAddressTypeMuxedContract?.()?.value: { + const muxed = scAddress.muxedContract(); + return Address.muxedContract(muxed.contractId(), muxed.id()); + } default: throw new Error(`Unsupported address type: ${scAddress.switch().name}`); } @@ -155,6 +192,11 @@ export class Address { return StrKey.encodeLiquidityPool(this._key); case 'muxedAccount': return StrKey.encodeMed25519PublicKey(this._key); + case 'muxedContract': + // Display-only form `:`. This is NOT a canonical StrKey: + // the Address constructor cannot parse it back, so muxed-contract + // addresses round-trip via ScAddress/ScVal, not via this string. + return `${StrKey.encodeContract(this._key)}:${this._muxId.toString()}`; default: throw new Error('Unsupported address type'); } @@ -201,6 +243,14 @@ export class Address { }) ); + case 'muxedContract': + return xdr.ScAddress.scAddressTypeMuxedContract( + new xdr.MuxedContract({ + id: this._muxId, + contractId: this._key + }) + ); + default: throw new Error(`Unsupported address type: ${this._type}`); } @@ -210,8 +260,41 @@ export class Address { * Return the raw public key bytes for this address. * * @returns {Buffer} + * @throws {Error} for muxed-contract addresses, which have no single-buffer + * encoding (use {@link Address#contractId} / {@link Address#muxedId}) */ toBuffer() { + if (this._type === 'muxedContract') { + throw new Error('toBuffer is not supported for muxed-contract addresses'); + } return this._key; } + + /** + * For a muxed-contract address, returns the raw 32-byte contract ID. + * + * @returns {Buffer} + * @throws {Error} if this is not a muxed-contract address + */ + contractId() { + if (this._type !== 'muxedContract') { + throw new Error( + 'contractId() is only valid for muxed-contract addresses' + ); + } + return this._key; + } + + /** + * For a muxed-contract address, returns the `uint64` multiplexing ID. + * + * @returns {xdr.Uint64} + * @throws {Error} if this is not a muxed-contract address + */ + muxedId() { + if (this._type !== 'muxedContract') { + throw new Error('muxedId() is only valid for muxed-contract addresses'); + } + return this._muxId; + } } diff --git a/src/generated/curr_generated.js b/src/generated/curr_generated.js index d4e763ce..87996680 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: @@ -2188,12 +2183,15 @@ xdr.typedef("UpgradeType", xdr.varOpaque(128)); // { // STELLAR_VALUE_BASIC = 0, // STELLAR_VALUE_SIGNED = 1 +// , +// STELLAR_VALUE_EMPTY_TX_SET = 2 // }; // // =========================================================================== xdr.enum("StellarValueType", { stellarValueBasic: 0, stellarValueSigned: 1, + stellarValueEmptyTxSet: 2, }); // === xdr source ============================================================ @@ -2210,6 +2208,24 @@ xdr.struct("LedgerCloseValueSignature", [ ["signature", xdr.lookup("Signature")], ]); +// === xdr source ============================================================ +// +// struct +// { +// Hash txSetHash; +// Hash previousLedgerHash; +// uint32 previousLedgerVersion; +// LedgerCloseValueSignature lcValueSignature; +// } +// +// =========================================================================== +xdr.struct("StellarValueProposedValue", [ + ["txSetHash", xdr.lookup("Hash")], + ["previousLedgerHash", xdr.lookup("Hash")], + ["previousLedgerVersion", xdr.lookup("Uint32")], + ["lcValueSignature", xdr.lookup("LedgerCloseValueSignature")], +]); + // === xdr source ============================================================ // // union switch (StellarValueType v) @@ -2218,6 +2234,14 @@ xdr.struct("LedgerCloseValueSignature", [ // void; // case STELLAR_VALUE_SIGNED: // LedgerCloseValueSignature lcValueSignature; +// case STELLAR_VALUE_EMPTY_TX_SET: +// struct +// { +// Hash txSetHash; +// Hash previousLedgerHash; +// uint32 previousLedgerVersion; +// LedgerCloseValueSignature lcValueSignature; +// } proposedValue; // } // // =========================================================================== @@ -2227,9 +2251,11 @@ xdr.union("StellarValueExt", { switches: [ ["stellarValueBasic", xdr.void()], ["stellarValueSigned", "lcValueSignature"], + ["stellarValueEmptyTxSet", "proposedValue"], ], arms: { lcValueSignature: xdr.lookup("LedgerCloseValueSignature"), + proposedValue: xdr.lookup("StellarValueProposedValue"), }, }); @@ -2239,14 +2265,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) // { @@ -2254,6 +2280,14 @@ xdr.union("StellarValueExt", { // void; // case STELLAR_VALUE_SIGNED: // LedgerCloseValueSignature lcValueSignature; +// case STELLAR_VALUE_EMPTY_TX_SET: +// struct +// { +// Hash txSetHash; +// Hash previousLedgerHash; +// uint32 previousLedgerVersion; +// LedgerCloseValueSignature lcValueSignature; +// } proposedValue; // } // ext; // }; @@ -2268,7 +2302,7 @@ xdr.struct("StellarValue", [ // === xdr source ============================================================ // -// const MASK_LEDGER_HEADER_FLAGS = 0x7; +// const 0x7 = 0x7; // // =========================================================================== xdr.const("MASK_LEDGER_HEADER_FLAGS", 0x7); @@ -2313,7 +2347,7 @@ xdr.union("LedgerHeaderExtensionV1Ext", { // struct LedgerHeaderExtensionV1 // { // uint32 flags; // LedgerHeaderFlags -// +// // union switch (int v) // { // case 0: @@ -2360,28 +2394,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 +2752,7 @@ xdr.union("TransactionHistoryEntryExt", { // { // uint32 ledgerSeq; // TransactionSet txSet; -// +// // // when v != 0, txSet must be empty // union switch (int v) // { @@ -2762,7 +2796,7 @@ xdr.union("TransactionHistoryResultEntryExt", { // { // uint32 ledgerSeq; // TransactionResultSet txResultSet; -// +// // // reserved for future use // union switch (int v) // { @@ -2804,7 +2838,7 @@ xdr.union("LedgerHeaderHistoryEntryExt", { // { // Hash hash; // LedgerHeader header; -// +// // // reserved for future use // union switch (int v) // { @@ -3037,10 +3071,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 +3114,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 +3141,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 +3178,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 +3205,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 +3229,9 @@ xdr.struct("TransactionMetaV3", [ // struct OperationMetaV2 // { // ExtensionPoint ext; -// +// // LedgerEntryChanges changes; -// +// // ContractEvent events<>; // }; // @@ -3213,7 +3247,7 @@ xdr.struct("OperationMetaV2", [ // struct SorobanTransactionMetaV2 // { // SorobanTransactionMetaExt ext; -// +// // SCVal* returnValue; // }; // @@ -3226,13 +3260,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 +3280,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 +3296,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 +3304,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 +3391,11 @@ xdr.struct("TransactionResultMeta", [ // struct TransactionResultMetaV1 // { // ExtensionPoint ext; -// +// // TransactionResultPair result; // LedgerEntryChanges feeProcessing; // TransactionMeta txApplyProcessing; -// +// // LedgerEntryChanges postTxApplyFeeProcessing; // }; // @@ -3395,15 +3429,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 +3493,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 +3538,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 +3708,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 +3794,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 +4068,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 +4107,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 +4194,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 +4220,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 +4258,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 +4398,7 @@ xdr.union("AuthenticatedMessage", { // === xdr source ============================================================ // -// const MAX_OPS_PER_TX = 100; +// const 100 = 100; // // =========================================================================== xdr.const("MAX_OPS_PER_TX", 100); @@ -4547,11 +4581,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 +4605,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 +4633,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 +4656,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 +4693,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 +4729,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 +4764,7 @@ xdr.union("ChangeTrustAsset", { // struct ChangeTrustOp // { // ChangeTrustAsset line; -// +// // // if limit is set to 0, deletes the trust line // int64 limit; // }; @@ -4747,7 +4781,7 @@ xdr.struct("ChangeTrustOp", [ // { // AccountID trustor; // AssetCode asset; -// +// // // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG // uint32 authorize; // }; @@ -4915,7 +4949,7 @@ xdr.struct("ClawbackClaimableBalanceOp", [ // { // AccountID trustor; // Asset asset; -// +// // uint32 clearFlags; // which flags to clear // uint32 setFlags; // which flags to set // }; @@ -4930,7 +4964,7 @@ xdr.struct("SetTrustLineFlagsOp", [ // === xdr source ============================================================ // -// const LIQUIDITY_POOL_FEE_V18 = 30; +// const 30 = 30; // // =========================================================================== xdr.const("LIQUIDITY_POOL_FEE_V18", 30); @@ -5150,7 +5184,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 +5231,7 @@ xdr.struct("SorobanAuthorizedInvocation", [ // { // SCAddress address; // int64 nonce; -// uint32 signatureExpirationLedger; +// uint32 signatureExpirationLedger; // SCVal signature; // }; // @@ -5209,18 +5243,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 +5299,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 +5312,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 +5515,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 +5603,7 @@ xdr.struct("HashIdPreimageOperationId", [ // struct // { // AccountID sourceAccount; -// SequenceNumber seqNum; +// SequenceNumber seqNum; // uint32 opNum; // PoolID liquidityPoolID; // Asset asset; @@ -5574,6 +5650,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 +5685,7 @@ xdr.struct("HashIdPreimageSorobanAuthorization", [ // struct // { // AccountID sourceAccount; -// SequenceNumber seqNum; +// SequenceNumber seqNum; // uint32 opNum; // PoolID liquidityPoolID; // Asset asset; @@ -5608,6 +5704,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 +5724,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 +5823,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 +5836,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 +5923,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 +5994,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 +6040,7 @@ xdr.union("TransactionV0Ext", { // SequenceNumber seqNum; // TimeBounds* timeBounds; // Memo memo; -// Operation operations; +// Operation operations<100>; // union switch (int v) // { // case 0: @@ -5998,20 +6105,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 +6337,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 +6364,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 +6389,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 +6442,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 +6494,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 +6565,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 +6696,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 +6809,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 +6823,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 +6896,7 @@ xdr.union("ManageOfferSuccessResultOffer", { // { // // offers that got claimed while creating this offer // ClaimAtom offersClaimed<>; -// +// // union switch (ManageOfferEffect effect) // { // case MANAGE_OFFER_CREATED: @@ -6858,7 +6965,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 +6977,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 +7575,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 +7623,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 +7663,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 +7718,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 +7769,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 +7817,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 +7873,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 +7886,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 +7945,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 +7955,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 +8008,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 +8064,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 +8111,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 +8157,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 +8397,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 +8527,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 +8554,7 @@ xdr.union("InnerTransactionResultExt", { // void; // } // result; -// +// // // reserved for future use // union switch (int v) // { @@ -8564,7 +8671,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 +8700,7 @@ xdr.union("TransactionResultExt", { // void; // } // result; -// +// // // reserved for future use // union switch (int v) // { @@ -8929,10 +9036,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 +9047,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,49 +9111,49 @@ 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. @@ -9349,7 +9456,7 @@ xdr.union("ScAddress", { // === xdr source ============================================================ // -// const SCSYMBOL_LIMIT = 32; +// const 32 = 32; // // =========================================================================== xdr.const("SCSYMBOL_LIMIT", 32); @@ -9384,10 +9491,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 +9524,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 +9545,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: @@ -9638,7 +9745,7 @@ xdr.union("ScMetaEntry", { // === xdr source ============================================================ // -// const SC_SPEC_DOC_LIMIT = 1024; +// const 1024 = 1024; // // =========================================================================== xdr.const("SC_SPEC_DOC_LIMIT", 1024); @@ -9648,7 +9755,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 +9775,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 +9783,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 +9993,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 +10009,7 @@ xdr.struct("ScSpecUdtStructFieldV0", [ // // struct SCSpecUDTStructV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTStructFieldV0 fields<>; @@ -9910,7 +10017,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 +10027,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 +10041,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 +10095,7 @@ xdr.union("ScSpecUdtUnionCaseV0", { // // struct SCSpecUDTUnionV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTUnionCaseV0 cases<>; @@ -9996,7 +10103,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 +10113,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 +10129,7 @@ xdr.struct("ScSpecUdtEnumCaseV0", [ // // struct SCSpecUDTEnumV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTEnumCaseV0 cases<>; @@ -10030,7 +10137,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 +10147,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 +10163,7 @@ xdr.struct("ScSpecUdtErrorEnumCaseV0", [ // // struct SCSpecUDTErrorEnumV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTErrorEnumCaseV0 cases<>; @@ -10064,7 +10171,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 +10181,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 +10197,7 @@ xdr.struct("ScSpecFunctionInputV0", [ // // struct SCSpecFunctionV0 // { -// string doc; +// string doc<1024>; // SCSymbol name; // SCSpecFunctionInputV0 inputs<>; // SCSpecTypeDef outputs<1>; @@ -10098,7 +10205,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 +10229,7 @@ xdr.enum("ScSpecEventParamLocationV0", { // // struct SCSpecEventParamV0 // { -// string doc; +// string doc<1024>; // string name<30>; // SCSpecTypeDef type; // SCSpecEventParamLocationV0 location; @@ -10130,7 +10237,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 +10263,7 @@ xdr.enum("ScSpecEventDataFormat", { // // struct SCSpecEventV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // SCSymbol name; // SCSymbol prefixTopics<2>; @@ -10166,7 +10273,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 +10373,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 +10415,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 +10424,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 +10514,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 +10540,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 +10580,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 +10601,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 +10622,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 +10679,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 +10809,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 +10827,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 +10946,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 +11116,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..0d2fb935 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: @@ -2188,12 +2183,15 @@ xdr.typedef("UpgradeType", xdr.varOpaque(128)); // { // STELLAR_VALUE_BASIC = 0, // STELLAR_VALUE_SIGNED = 1 +// , +// STELLAR_VALUE_EMPTY_TX_SET = 2 // }; // // =========================================================================== xdr.enum("StellarValueType", { stellarValueBasic: 0, stellarValueSigned: 1, + stellarValueEmptyTxSet: 2, }); // === xdr source ============================================================ @@ -2210,6 +2208,24 @@ xdr.struct("LedgerCloseValueSignature", [ ["signature", xdr.lookup("Signature")], ]); +// === xdr source ============================================================ +// +// struct +// { +// Hash txSetHash; +// Hash previousLedgerHash; +// uint32 previousLedgerVersion; +// LedgerCloseValueSignature lcValueSignature; +// } +// +// =========================================================================== +xdr.struct("StellarValueProposedValue", [ + ["txSetHash", xdr.lookup("Hash")], + ["previousLedgerHash", xdr.lookup("Hash")], + ["previousLedgerVersion", xdr.lookup("Uint32")], + ["lcValueSignature", xdr.lookup("LedgerCloseValueSignature")], +]); + // === xdr source ============================================================ // // union switch (StellarValueType v) @@ -2218,6 +2234,14 @@ xdr.struct("LedgerCloseValueSignature", [ // void; // case STELLAR_VALUE_SIGNED: // LedgerCloseValueSignature lcValueSignature; +// case STELLAR_VALUE_EMPTY_TX_SET: +// struct +// { +// Hash txSetHash; +// Hash previousLedgerHash; +// uint32 previousLedgerVersion; +// LedgerCloseValueSignature lcValueSignature; +// } proposedValue; // } // // =========================================================================== @@ -2227,9 +2251,11 @@ xdr.union("StellarValueExt", { switches: [ ["stellarValueBasic", xdr.void()], ["stellarValueSigned", "lcValueSignature"], + ["stellarValueEmptyTxSet", "proposedValue"], ], arms: { lcValueSignature: xdr.lookup("LedgerCloseValueSignature"), + proposedValue: xdr.lookup("StellarValueProposedValue"), }, }); @@ -2239,14 +2265,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) // { @@ -2254,6 +2280,14 @@ xdr.union("StellarValueExt", { // void; // case STELLAR_VALUE_SIGNED: // LedgerCloseValueSignature lcValueSignature; +// case STELLAR_VALUE_EMPTY_TX_SET: +// struct +// { +// Hash txSetHash; +// Hash previousLedgerHash; +// uint32 previousLedgerVersion; +// LedgerCloseValueSignature lcValueSignature; +// } proposedValue; // } // ext; // }; @@ -2268,7 +2302,7 @@ xdr.struct("StellarValue", [ // === xdr source ============================================================ // -// const MASK_LEDGER_HEADER_FLAGS = 0x7; +// const 0x7 = 0x7; // // =========================================================================== xdr.const("MASK_LEDGER_HEADER_FLAGS", 0x7); @@ -2313,7 +2347,7 @@ xdr.union("LedgerHeaderExtensionV1Ext", { // struct LedgerHeaderExtensionV1 // { // uint32 flags; // LedgerHeaderFlags -// +// // union switch (int v) // { // case 0: @@ -2360,28 +2394,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 +2752,7 @@ xdr.union("TransactionHistoryEntryExt", { // { // uint32 ledgerSeq; // TransactionSet txSet; -// +// // // when v != 0, txSet must be empty // union switch (int v) // { @@ -2762,7 +2796,7 @@ xdr.union("TransactionHistoryResultEntryExt", { // { // uint32 ledgerSeq; // TransactionResultSet txResultSet; -// +// // // reserved for future use // union switch (int v) // { @@ -2804,7 +2838,7 @@ xdr.union("LedgerHeaderHistoryEntryExt", { // { // Hash hash; // LedgerHeader header; -// +// // // reserved for future use // union switch (int v) // { @@ -3037,10 +3071,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 +3114,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 +3141,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 +3178,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 +3205,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 +3229,9 @@ xdr.struct("TransactionMetaV3", [ // struct OperationMetaV2 // { // ExtensionPoint ext; -// +// // LedgerEntryChanges changes; -// +// // ContractEvent events<>; // }; // @@ -3213,7 +3247,7 @@ xdr.struct("OperationMetaV2", [ // struct SorobanTransactionMetaV2 // { // SorobanTransactionMetaExt ext; -// +// // SCVal* returnValue; // }; // @@ -3226,13 +3260,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 +3280,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 +3296,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 +3304,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 +3391,11 @@ xdr.struct("TransactionResultMeta", [ // struct TransactionResultMetaV1 // { // ExtensionPoint ext; -// +// // TransactionResultPair result; // LedgerEntryChanges feeProcessing; // TransactionMeta txApplyProcessing; -// +// // LedgerEntryChanges postTxApplyFeeProcessing; // }; // @@ -3395,15 +3429,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 +3493,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 +3538,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 +3708,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 +3794,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 +4068,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 +4107,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 +4194,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 +4220,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 +4258,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 +4398,7 @@ xdr.union("AuthenticatedMessage", { // === xdr source ============================================================ // -// const MAX_OPS_PER_TX = 100; +// const 100 = 100; // // =========================================================================== xdr.const("MAX_OPS_PER_TX", 100); @@ -4547,11 +4581,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 +4605,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 +4633,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 +4656,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 +4693,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 +4729,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 +4764,7 @@ xdr.union("ChangeTrustAsset", { // struct ChangeTrustOp // { // ChangeTrustAsset line; -// +// // // if limit is set to 0, deletes the trust line // int64 limit; // }; @@ -4747,7 +4781,7 @@ xdr.struct("ChangeTrustOp", [ // { // AccountID trustor; // AssetCode asset; -// +// // // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG // uint32 authorize; // }; @@ -4915,7 +4949,7 @@ xdr.struct("ClawbackClaimableBalanceOp", [ // { // AccountID trustor; // Asset asset; -// +// // uint32 clearFlags; // which flags to clear // uint32 setFlags; // which flags to set // }; @@ -4930,7 +4964,7 @@ xdr.struct("SetTrustLineFlagsOp", [ // === xdr source ============================================================ // -// const LIQUIDITY_POOL_FEE_V18 = 30; +// const 30 = 30; // // =========================================================================== xdr.const("LIQUIDITY_POOL_FEE_V18", 30); @@ -5150,7 +5184,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 +5231,7 @@ xdr.struct("SorobanAuthorizedInvocation", [ // { // SCAddress address; // int64 nonce; -// uint32 signatureExpirationLedger; +// uint32 signatureExpirationLedger; // SCVal signature; // }; // @@ -5209,18 +5243,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 +5299,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 +5312,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 +5515,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 +5603,7 @@ xdr.struct("HashIdPreimageOperationId", [ // struct // { // AccountID sourceAccount; -// SequenceNumber seqNum; +// SequenceNumber seqNum; // uint32 opNum; // PoolID liquidityPoolID; // Asset asset; @@ -5574,6 +5650,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 +5685,7 @@ xdr.struct("HashIdPreimageSorobanAuthorization", [ // struct // { // AccountID sourceAccount; -// SequenceNumber seqNum; +// SequenceNumber seqNum; // uint32 opNum; // PoolID liquidityPoolID; // Asset asset; @@ -5608,6 +5704,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 +5724,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 +5823,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 +5836,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 +5923,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 +5994,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 +6040,7 @@ xdr.union("TransactionV0Ext", { // SequenceNumber seqNum; // TimeBounds* timeBounds; // Memo memo; -// Operation operations; +// Operation operations<100>; // union switch (int v) // { // case 0: @@ -5998,20 +6105,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 +6337,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 +6364,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 +6389,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 +6442,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 +6494,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 +6565,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 +6696,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 +6809,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 +6823,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 +6896,7 @@ xdr.union("ManageOfferSuccessResultOffer", { // { // // offers that got claimed while creating this offer // ClaimAtom offersClaimed<>; -// +// // union switch (ManageOfferEffect effect) // { // case MANAGE_OFFER_CREATED: @@ -6858,7 +6965,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 +6977,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 +7575,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 +7623,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 +7663,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 +7718,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 +7769,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 +7817,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 +7873,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 +7886,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 +7945,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 +7955,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 +8008,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 +8064,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 +8111,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 +8157,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 +8397,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 +8527,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 +8554,7 @@ xdr.union("InnerTransactionResultExt", { // void; // } // result; -// +// // // reserved for future use // union switch (int v) // { @@ -8564,7 +8671,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 +8700,7 @@ xdr.union("TransactionResultExt", { // void; // } // result; -// +// // // reserved for future use // union switch (int v) // { @@ -8929,10 +9036,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 +9047,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,49 +9111,49 @@ 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. @@ -9286,6 +9393,8 @@ xdr.union("ContractExecutable", { // SC_ADDRESS_TYPE_MUXED_ACCOUNT = 2, // SC_ADDRESS_TYPE_CLAIMABLE_BALANCE = 3, // SC_ADDRESS_TYPE_LIQUIDITY_POOL = 4 +// , +// SC_ADDRESS_TYPE_MUXED_CONTRACT = 5 // }; // // =========================================================================== @@ -9295,6 +9404,7 @@ xdr.enum("ScAddressType", { scAddressTypeMuxedAccount: 2, scAddressTypeClaimableBalance: 3, scAddressTypeLiquidityPool: 4, + scAddressTypeMuxedContract: 5, }); // === xdr source ============================================================ @@ -9311,6 +9421,20 @@ xdr.struct("MuxedEd25519Account", [ ["ed25519", xdr.lookup("Uint256")], ]); +// === xdr source ============================================================ +// +// struct MuxedContract +// { +// uint64 id; +// ContractID contractId; +// }; +// +// =========================================================================== +xdr.struct("MuxedContract", [ + ["id", xdr.lookup("Uint64")], + ["contractId", xdr.lookup("ContractId")], +]); + // === xdr source ============================================================ // // union SCAddress switch (SCAddressType type) @@ -9325,6 +9449,8 @@ xdr.struct("MuxedEd25519Account", [ // ClaimableBalanceID claimableBalanceId; // case SC_ADDRESS_TYPE_LIQUIDITY_POOL: // PoolID liquidityPoolId; +// case SC_ADDRESS_TYPE_MUXED_CONTRACT: +// MuxedContract muxedContract; // }; // // =========================================================================== @@ -9337,6 +9463,7 @@ xdr.union("ScAddress", { ["scAddressTypeMuxedAccount", "muxedAccount"], ["scAddressTypeClaimableBalance", "claimableBalanceId"], ["scAddressTypeLiquidityPool", "liquidityPoolId"], + ["scAddressTypeMuxedContract", "muxedContract"], ], arms: { accountId: xdr.lookup("AccountId"), @@ -9344,12 +9471,13 @@ xdr.union("ScAddress", { muxedAccount: xdr.lookup("MuxedEd25519Account"), claimableBalanceId: xdr.lookup("ClaimableBalanceId"), liquidityPoolId: xdr.lookup("PoolId"), + muxedContract: xdr.lookup("MuxedContract"), }, }); // === xdr source ============================================================ // -// const SCSYMBOL_LIMIT = 32; +// const 32 = 32; // // =========================================================================== xdr.const("SCSYMBOL_LIMIT", 32); @@ -9384,10 +9512,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 +9545,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 +9566,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: @@ -9638,7 +9766,7 @@ xdr.union("ScMetaEntry", { // === xdr source ============================================================ // -// const SC_SPEC_DOC_LIMIT = 1024; +// const 1024 = 1024; // // =========================================================================== xdr.const("SC_SPEC_DOC_LIMIT", 1024); @@ -9648,7 +9776,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 +9796,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 +9804,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 +10014,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 +10030,7 @@ xdr.struct("ScSpecUdtStructFieldV0", [ // // struct SCSpecUDTStructV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTStructFieldV0 fields<>; @@ -9910,7 +10038,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 +10048,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 +10062,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 +10116,7 @@ xdr.union("ScSpecUdtUnionCaseV0", { // // struct SCSpecUDTUnionV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTUnionCaseV0 cases<>; @@ -9996,7 +10124,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 +10134,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 +10150,7 @@ xdr.struct("ScSpecUdtEnumCaseV0", [ // // struct SCSpecUDTEnumV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTEnumCaseV0 cases<>; @@ -10030,7 +10158,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 +10168,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 +10184,7 @@ xdr.struct("ScSpecUdtErrorEnumCaseV0", [ // // struct SCSpecUDTErrorEnumV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // string name<60>; // SCSpecUDTErrorEnumCaseV0 cases<>; @@ -10064,7 +10192,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 +10202,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 +10218,7 @@ xdr.struct("ScSpecFunctionInputV0", [ // // struct SCSpecFunctionV0 // { -// string doc; +// string doc<1024>; // SCSymbol name; // SCSpecFunctionInputV0 inputs<>; // SCSpecTypeDef outputs<1>; @@ -10098,7 +10226,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 +10250,7 @@ xdr.enum("ScSpecEventParamLocationV0", { // // struct SCSpecEventParamV0 // { -// string doc; +// string doc<1024>; // string name<30>; // SCSpecTypeDef type; // SCSpecEventParamLocationV0 location; @@ -10130,7 +10258,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 +10284,7 @@ xdr.enum("ScSpecEventDataFormat", { // // struct SCSpecEventV0 // { -// string doc; +// string doc<1024>; // string lib<80>; // SCSymbol name; // SCSymbol prefixTopics<2>; @@ -10166,7 +10294,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 +10394,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 +10436,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 +10445,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 +10535,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 +10561,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 +10601,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 +10622,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 +10643,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 +10700,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 +10830,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 +10848,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 +10967,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 +11137,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/test/unit/address_test.js b/test/unit/address_test.js index f503c3c3..079f9d7c 100644 --- a/test/unit/address_test.js +++ b/test/unit/address_test.js @@ -322,4 +322,97 @@ describe('Address', function () { ); }); }); + + describe('muxed-contract addresses (CAP-0084)', function () { + // 2^64 - 1: a uint64 well above Number.MAX_SAFE_INTEGER, used to prove the + // muxing id survives a fromScAddress -> toScAddress round-trip and the + // muxedId() accessor without precision loss. + const MUXED_CONTRACT_ID = '18446744073709551615'; + const CONTRACT_RAW = StellarBase.StrKey.decodeContract(CONTRACT); + + // CAP-0084's SC_ADDRESS_TYPE_MUXED_CONTRACT arm is gated to the `next` + // channel, so the curr-bound default codec cannot construct or encode it + // yet. Codec round-trip coverage runs only once the arm lands in the + // active codec; the Address-level assertions below are codec-agnostic. + const codecHasMuxedContract = + typeof StellarBase.xdr.ScAddressType.scAddressTypeMuxedContract === + 'function'; + const itCodec = codecHasMuxedContract ? it : it.skip; + + function muxedContractScAddress(id) { + return StellarBase.xdr.ScAddress.scAddressTypeMuxedContract( + new StellarBase.xdr.MuxedContract({ + id: new StellarBase.xdr.Uint64(id), + contractId: CONTRACT_RAW + }) + ); + } + + it('.muxedContract factory exposes its components', function () { + const a = StellarBase.Address.muxedContract( + CONTRACT_RAW, + MUXED_CONTRACT_ID + ); + expect(a.contractId()).to.deep.equal(CONTRACT_RAW); + expect(a.muxedId().toString()).to.equal(MUXED_CONTRACT_ID); + }); + + it('renders the display form :', function () { + const a = StellarBase.Address.muxedContract( + CONTRACT_RAW, + MUXED_CONTRACT_ID + ); + expect(a.toString()).to.equal(`${CONTRACT}:${MUXED_CONTRACT_ID}`); + }); + + itCodec('fromScAddress decodes the arm without precision loss', function () { + const sc = muxedContractScAddress(MUXED_CONTRACT_ID); + const a = StellarBase.Address.fromScAddress(sc); + expect(a.contractId()).to.deep.equal(CONTRACT_RAW); + expect(a.muxedId().toString()).to.equal(MUXED_CONTRACT_ID); + expect(a.toString()).to.equal(`${CONTRACT}:${MUXED_CONTRACT_ID}`); + }); + + itCodec('round-trips Address -> ScAddress byte-for-byte', function () { + const sc = muxedContractScAddress(MUXED_CONTRACT_ID); + const out = StellarBase.Address.fromScAddress(sc).toScAddress(); + expect(out.switch()).to.equal( + StellarBase.xdr.ScAddressType.scAddressTypeMuxedContract() + ); + expect(out.toXDR()).to.deep.equal(sc.toXDR()); + expect(StellarBase.xdr.ScAddress.fromXDR(out.toXDR())).to.eql(sc); + }); + + itCodec('round-trips through ScVal', function () { + const scVal = StellarBase.Address.muxedContract( + CONTRACT_RAW, + MUXED_CONTRACT_ID + ).toScVal(); + const back = StellarBase.Address.fromScVal(scVal); + expect(back.toString()).to.equal(`${CONTRACT}:${MUXED_CONTRACT_ID}`); + expect(back.muxedId().toString()).to.equal(MUXED_CONTRACT_ID); + }); + + it('toBuffer throws (no canonical single-buffer encoding)', function () { + const a = StellarBase.Address.muxedContract( + CONTRACT_RAW, + MUXED_CONTRACT_ID + ); + expect(() => a.toBuffer()).to.throw( + /toBuffer is not supported for muxed-contract addresses/ + ); + }); + + it('constructor cannot parse the display string (no strkey yet)', function () { + expect( + () => new StellarBase.Address(`${CONTRACT}:${MUXED_CONTRACT_ID}`) + ).to.throw(/Unsupported address type/); + }); + + it('contractId/muxedId throw for non-muxed-contract addresses', function () { + const c = new StellarBase.Address(CONTRACT); + expect(() => c.muxedId()).to.throw(/only valid for muxed-contract/); + expect(() => c.contractId()).to.throw(/only valid for muxed-contract/); + }); + }); }); diff --git a/types/index.d.ts b/types/index.d.ts index 1977b29a..14a5b801 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -17,12 +17,18 @@ export class Address { static fromString(address: string): Address; static account(buffer: Buffer): Address; static contract(buffer: Buffer): Address; + static muxedContract( + contractId: Buffer, + id: number | bigint | string | xdr.Uint64, + ): Address; static fromScVal(scVal: xdr.ScVal): Address; static fromScAddress(scAddress: xdr.ScAddress): Address; toString(): string; toScVal(): xdr.ScVal; toScAddress(): xdr.ScAddress; toBuffer(): Buffer; + contractId(): Buffer; + muxedId(): xdr.Uint64; } export class Contract { diff --git a/types/next.d.ts b/types/next.d.ts index 7b24280c..eca7ff2f 100644 --- a/types/next.d.ts +++ b/types/next.d.ts @@ -2125,9 +2125,10 @@ export namespace xdr { | 'scAddressTypeContract' | 'scAddressTypeMuxedAccount' | 'scAddressTypeClaimableBalance' - | 'scAddressTypeLiquidityPool'; + | 'scAddressTypeLiquidityPool' + | 'scAddressTypeMuxedContract'; - readonly value: 0 | 1 | 2 | 3 | 4; + readonly value: 0 | 1 | 2 | 3 | 4 | 5; static scAddressTypeAccount(): ScAddressType; @@ -2138,6 +2139,8 @@ export namespace xdr { static scAddressTypeClaimableBalance(): ScAddressType; static scAddressTypeLiquidityPool(): ScAddressType; + + static scAddressTypeMuxedContract(): ScAddressType; } class ScEnvMetaKind { @@ -9365,6 +9368,34 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } + class MuxedContract { + constructor(attributes: { id: Uint64; contractId: ContractId }); + + id(value?: Uint64): Uint64; + + contractId(value?: ContractId): ContractId; + + toXDR(format?: 'raw'): Buffer; + + toXDR(format: 'hex' | 'base64'): string; + + static read(io: Buffer): MuxedContract; + + static write(value: MuxedContract, io: Buffer): void; + + static isValid(value: MuxedContract): boolean; + + static toXDR(value: MuxedContract): Buffer; + + static fromXDR(input: Buffer, format?: 'raw'): MuxedContract; + + static fromXDR(input: string, format: 'hex' | 'base64'): MuxedContract; + + static validateXDR(input: Buffer, format?: 'raw'): boolean; + + static validateXDR(input: string, format: 'hex' | 'base64'): boolean; + } + class ScNonceKey { constructor(attributes: { nonce: Int64 }); @@ -15492,6 +15523,8 @@ export namespace xdr { liquidityPoolId(value?: PoolId): PoolId; + muxedContract(value?: MuxedContract): MuxedContract; + static scAddressTypeAccount(value: AccountId): ScAddress; static scAddressTypeContract(value: ContractId): ScAddress; @@ -15502,12 +15535,15 @@ export namespace xdr { static scAddressTypeLiquidityPool(value: PoolId): ScAddress; + static scAddressTypeMuxedContract(value: MuxedContract): ScAddress; + value(): | AccountId | ContractId | MuxedEd25519Account | ClaimableBalanceId - | PoolId; + | PoolId + | MuxedContract; toXDR(format?: 'raw'): Buffer; diff --git a/types/test.ts b/types/test.ts index 43cb6019..0f698577 100644 --- a/types/test.ts +++ b/types/test.ts @@ -363,3 +363,11 @@ const root = new StellarSdk.xdr.SorobanAuthorizedInvocation({ subInvocations: [], }); StellarSdk.walkInvocationTree(root, (_node, _depth, _parent) => {}); + +// CAP-0084 muxed-contract Address surface +const muxedContractAddr = StellarSdk.Address.muxedContract(Buffer.alloc(32), '18446744073709551615'); // $ExpectType Address +StellarSdk.Address.muxedContract(Buffer.alloc(32), 42); +StellarSdk.Address.muxedContract(Buffer.alloc(32), BigInt(42)); +const muxedContractId: Buffer = muxedContractAddr.contractId(); +const muxedContractMuxId: StellarSdk.xdr.Uint64 = muxedContractAddr.muxedId(); +const muxedContractBuffer: Buffer = muxedContractAddr.toBuffer(); diff --git a/xdr/curr/Stellar-contract.x b/xdr/curr/Stellar-contract.x index 0e67dc3f..f1afaf1d 100644 --- a/xdr/curr/Stellar-contract.x +++ b/xdr/curr/Stellar-contract.x @@ -191,6 +191,7 @@ struct MuxedEd25519Account uint256 ed25519; }; + union SCAddress switch (SCAddressType type) { case SC_ADDRESS_TYPE_ACCOUNT: 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..ab51d3bf 100644 --- a/xdr/curr/Stellar-ledger.x +++ b/xdr/curr/Stellar-ledger.x @@ -14,6 +14,8 @@ enum StellarValueType { STELLAR_VALUE_BASIC = 0, STELLAR_VALUE_SIGNED = 1 + , + STELLAR_VALUE_EMPTY_TX_SET = 2 }; struct LedgerCloseValueSignature @@ -43,6 +45,14 @@ struct StellarValue void; case STELLAR_VALUE_SIGNED: LedgerCloseValueSignature lcValueSignature; + case STELLAR_VALUE_EMPTY_TX_SET: + struct + { + Hash txSetHash; + Hash previousLedgerHash; + uint32 previousLedgerVersion; + LedgerCloseValueSignature lcValueSignature; + } proposedValue; } ext; }; @@ -425,7 +435,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..527460d9 100644 --- a/xdr/next/Stellar-contract.x +++ b/xdr/next/Stellar-contract.x @@ -183,6 +183,8 @@ enum SCAddressType SC_ADDRESS_TYPE_MUXED_ACCOUNT = 2, SC_ADDRESS_TYPE_CLAIMABLE_BALANCE = 3, SC_ADDRESS_TYPE_LIQUIDITY_POOL = 4 + , + SC_ADDRESS_TYPE_MUXED_CONTRACT = 5 }; struct MuxedEd25519Account @@ -191,6 +193,12 @@ struct MuxedEd25519Account uint256 ed25519; }; +struct MuxedContract +{ + uint64 id; + ContractID contractId; +}; + union SCAddress switch (SCAddressType type) { case SC_ADDRESS_TYPE_ACCOUNT: @@ -203,6 +211,8 @@ case SC_ADDRESS_TYPE_CLAIMABLE_BALANCE: ClaimableBalanceID claimableBalanceId; case SC_ADDRESS_TYPE_LIQUIDITY_POOL: PoolID liquidityPoolId; +case SC_ADDRESS_TYPE_MUXED_CONTRACT: + MuxedContract muxedContract; }; %struct SCVal; 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..ab51d3bf 100644 --- a/xdr/next/Stellar-ledger.x +++ b/xdr/next/Stellar-ledger.x @@ -14,6 +14,8 @@ enum StellarValueType { STELLAR_VALUE_BASIC = 0, STELLAR_VALUE_SIGNED = 1 + , + STELLAR_VALUE_EMPTY_TX_SET = 2 }; struct LedgerCloseValueSignature @@ -43,6 +45,14 @@ struct StellarValue void; case STELLAR_VALUE_SIGNED: LedgerCloseValueSignature lcValueSignature; + case STELLAR_VALUE_EMPTY_TX_SET: + struct + { + Hash txSetHash; + Hash previousLedgerHash; + uint32 previousLedgerVersion; + LedgerCloseValueSignature lcValueSignature; + } proposedValue; } ext; }; @@ -425,7 +435,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