@stellar/stellar-sdk
Version:
A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.
1,553 lines (1,552 loc) • 128 kB
JavaScript
import '../../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/int.js';
import '../../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/hyper.js';
import '../../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-int.js';
import '../../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-hyper.js';
import '../../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/xdr-type.js';
import 'buffer';
import { config } from '../../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/config.js';
var types = config((xdr) => {
const SCSYMBOL_LIMIT = 32;
const SC_SPEC_DOC_LIMIT = 1024;
xdr.typedef("Value", xdr.varOpaque());
xdr.struct("ScpBallot", [
["counter", xdr.lookup("Uint32")],
["value", xdr.lookup("Value")]
]);
xdr.enum("ScpStatementType", {
scpStPrepare: 0,
scpStConfirm: 1,
scpStExternalize: 2,
scpStNominate: 3
});
xdr.struct("ScpNomination", [
["quorumSetHash", xdr.lookup("Hash")],
["votes", xdr.varArray(xdr.lookup("Value"), 2147483647)],
["accepted", xdr.varArray(xdr.lookup("Value"), 2147483647)]
]);
xdr.struct("ScpStatementPrepare", [
["quorumSetHash", xdr.lookup("Hash")],
["ballot", xdr.lookup("ScpBallot")],
["prepared", xdr.option(xdr.lookup("ScpBallot"))],
["preparedPrime", xdr.option(xdr.lookup("ScpBallot"))],
["nC", xdr.lookup("Uint32")],
["nH", xdr.lookup("Uint32")]
]);
xdr.struct("ScpStatementConfirm", [
["ballot", xdr.lookup("ScpBallot")],
["nPrepared", xdr.lookup("Uint32")],
["nCommit", xdr.lookup("Uint32")],
["nH", xdr.lookup("Uint32")],
["quorumSetHash", xdr.lookup("Hash")]
]);
xdr.struct("ScpStatementExternalize", [
["commit", xdr.lookup("ScpBallot")],
["nH", xdr.lookup("Uint32")],
["commitQuorumSetHash", xdr.lookup("Hash")]
]);
xdr.union("ScpStatementPledges", {
switchOn: xdr.lookup("ScpStatementType"),
switchName: "type",
switches: [
["scpStPrepare", "prepare"],
["scpStConfirm", "confirm"],
["scpStExternalize", "externalize"],
["scpStNominate", "nominate"]
],
arms: {
prepare: xdr.lookup("ScpStatementPrepare"),
confirm: xdr.lookup("ScpStatementConfirm"),
externalize: xdr.lookup("ScpStatementExternalize"),
nominate: xdr.lookup("ScpNomination")
}
});
xdr.struct("ScpStatement", [
["nodeId", xdr.lookup("NodeId")],
["slotIndex", xdr.lookup("Uint64")],
["pledges", xdr.lookup("ScpStatementPledges")]
]);
xdr.struct("ScpEnvelope", [
["statement", xdr.lookup("ScpStatement")],
["signature", xdr.lookup("Signature")]
]);
xdr.struct("ScpQuorumSet", [
["threshold", xdr.lookup("Uint32")],
["validators", xdr.varArray(xdr.lookup("NodeId"), 2147483647)],
["innerSets", xdr.varArray(xdr.lookup("ScpQuorumSet"), 2147483647)]
]);
xdr.typedef("Thresholds", xdr.opaque(4));
xdr.typedef("String32", xdr.string(32));
xdr.typedef("String64", xdr.string(64));
xdr.typedef("SequenceNumber", xdr.lookup("Int64"));
xdr.typedef("DataValue", xdr.varOpaque(64));
xdr.typedef("AssetCode4", xdr.opaque(4));
xdr.typedef("AssetCode12", xdr.opaque(12));
xdr.enum("AssetType", {
assetTypeNative: 0,
assetTypeCreditAlphanum4: 1,
assetTypeCreditAlphanum12: 2,
assetTypePoolShare: 3
});
xdr.union("AssetCode", {
switchOn: xdr.lookup("AssetType"),
switchName: "type",
switches: [
["assetTypeCreditAlphanum4", "assetCode4"],
["assetTypeCreditAlphanum12", "assetCode12"]
],
arms: {
assetCode4: xdr.lookup("AssetCode4"),
assetCode12: xdr.lookup("AssetCode12")
}
});
xdr.struct("AlphaNum4", [
["assetCode", xdr.lookup("AssetCode4")],
["issuer", xdr.lookup("AccountId")]
]);
xdr.struct("AlphaNum12", [
["assetCode", xdr.lookup("AssetCode12")],
["issuer", xdr.lookup("AccountId")]
]);
xdr.union("Asset", {
switchOn: xdr.lookup("AssetType"),
switchName: "type",
switches: [
["assetTypeNative", xdr.void()],
["assetTypeCreditAlphanum4", "alphaNum4"],
["assetTypeCreditAlphanum12", "alphaNum12"]
],
arms: {
alphaNum4: xdr.lookup("AlphaNum4"),
alphaNum12: xdr.lookup("AlphaNum12")
}
});
xdr.struct("Price", [
["n", xdr.lookup("Int32")],
["d", xdr.lookup("Int32")]
]);
xdr.struct("Liabilities", [
["buying", xdr.lookup("Int64")],
["selling", xdr.lookup("Int64")]
]);
xdr.enum("ThresholdIndices", {
thresholdMasterWeight: 0,
thresholdLow: 1,
thresholdMed: 2,
thresholdHigh: 3
});
xdr.enum("LedgerEntryType", {
account: 0,
trustline: 1,
offer: 2,
data: 3,
claimableBalance: 4,
liquidityPool: 5,
contractData: 6,
contractCode: 7,
configSetting: 8,
ttl: 9
});
xdr.struct("Signer", [
["key", xdr.lookup("SignerKey")],
["weight", xdr.lookup("Uint32")]
]);
xdr.enum("AccountFlags", {
authRequiredFlag: 1,
authRevocableFlag: 2,
authImmutableFlag: 4,
authClawbackEnabledFlag: 8
});
xdr.const("MASK_ACCOUNT_FLAGS", 7);
xdr.const("MASK_ACCOUNT_FLAGS_V17", 15);
xdr.const("MAX_SIGNERS", 20);
xdr.typedef("SponsorshipDescriptor", xdr.option(xdr.lookup("AccountId")));
xdr.struct("AccountEntryExtensionV3", [
["ext", xdr.lookup("ExtensionPoint")],
["seqLedger", xdr.lookup("Uint32")],
["seqTime", xdr.lookup("TimePoint")]
]);
xdr.union("AccountEntryExtensionV2Ext", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[3, "v3"]
],
arms: {
v3: xdr.lookup("AccountEntryExtensionV3")
}
});
xdr.struct("AccountEntryExtensionV2", [
["numSponsored", xdr.lookup("Uint32")],
["numSponsoring", xdr.lookup("Uint32")],
[
"signerSponsoringIDs",
xdr.varArray(
xdr.lookup("SponsorshipDescriptor"),
xdr.lookup("MAX_SIGNERS")
)
],
["ext", xdr.lookup("AccountEntryExtensionV2Ext")]
]);
xdr.union("AccountEntryExtensionV1Ext", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[2, "v2"]
],
arms: {
v2: xdr.lookup("AccountEntryExtensionV2")
}
});
xdr.struct("AccountEntryExtensionV1", [
["liabilities", xdr.lookup("Liabilities")],
["ext", xdr.lookup("AccountEntryExtensionV1Ext")]
]);
xdr.union("AccountEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "v1"]
],
arms: {
v1: xdr.lookup("AccountEntryExtensionV1")
}
});
xdr.struct("AccountEntry", [
["accountId", xdr.lookup("AccountId")],
["balance", xdr.lookup("Int64")],
["seqNum", xdr.lookup("SequenceNumber")],
["numSubEntries", xdr.lookup("Uint32")],
["inflationDest", xdr.option(xdr.lookup("AccountId"))],
["flags", xdr.lookup("Uint32")],
["homeDomain", xdr.lookup("String32")],
["thresholds", xdr.lookup("Thresholds")],
["signers", xdr.varArray(xdr.lookup("Signer"), xdr.lookup("MAX_SIGNERS"))],
["ext", xdr.lookup("AccountEntryExt")]
]);
xdr.enum("TrustLineFlags", {
authorizedFlag: 1,
authorizedToMaintainLiabilitiesFlag: 2,
trustlineClawbackEnabledFlag: 4
});
xdr.const("MASK_TRUSTLINE_FLAGS", 1);
xdr.const("MASK_TRUSTLINE_FLAGS_V13", 3);
xdr.const("MASK_TRUSTLINE_FLAGS_V17", 7);
xdr.enum("LiquidityPoolType", {
liquidityPoolConstantProduct: 0
});
xdr.union("TrustLineAsset", {
switchOn: xdr.lookup("AssetType"),
switchName: "type",
switches: [
["assetTypeNative", xdr.void()],
["assetTypeCreditAlphanum4", "alphaNum4"],
["assetTypeCreditAlphanum12", "alphaNum12"],
["assetTypePoolShare", "liquidityPoolId"]
],
arms: {
alphaNum4: xdr.lookup("AlphaNum4"),
alphaNum12: xdr.lookup("AlphaNum12"),
liquidityPoolId: xdr.lookup("PoolId")
}
});
xdr.union("TrustLineEntryExtensionV2Ext", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, xdr.void()]],
arms: {}
});
xdr.struct("TrustLineEntryExtensionV2", [
["liquidityPoolUseCount", xdr.lookup("Int32")],
["ext", xdr.lookup("TrustLineEntryExtensionV2Ext")]
]);
xdr.union("TrustLineEntryV1Ext", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[2, "v2"]
],
arms: {
v2: xdr.lookup("TrustLineEntryExtensionV2")
}
});
xdr.struct("TrustLineEntryV1", [
["liabilities", xdr.lookup("Liabilities")],
["ext", xdr.lookup("TrustLineEntryV1Ext")]
]);
xdr.union("TrustLineEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "v1"]
],
arms: {
v1: xdr.lookup("TrustLineEntryV1")
}
});
xdr.struct("TrustLineEntry", [
["accountId", xdr.lookup("AccountId")],
["asset", xdr.lookup("TrustLineAsset")],
["balance", xdr.lookup("Int64")],
["limit", xdr.lookup("Int64")],
["flags", xdr.lookup("Uint32")],
["ext", xdr.lookup("TrustLineEntryExt")]
]);
xdr.enum("OfferEntryFlags", {
passiveFlag: 1
});
xdr.const("MASK_OFFERENTRY_FLAGS", 1);
xdr.union("OfferEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, xdr.void()]],
arms: {}
});
xdr.struct("OfferEntry", [
["sellerId", xdr.lookup("AccountId")],
["offerId", xdr.lookup("Int64")],
["selling", xdr.lookup("Asset")],
["buying", xdr.lookup("Asset")],
["amount", xdr.lookup("Int64")],
["price", xdr.lookup("Price")],
["flags", xdr.lookup("Uint32")],
["ext", xdr.lookup("OfferEntryExt")]
]);
xdr.union("DataEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, xdr.void()]],
arms: {}
});
xdr.struct("DataEntry", [
["accountId", xdr.lookup("AccountId")],
["dataName", xdr.lookup("String64")],
["dataValue", xdr.lookup("DataValue")],
["ext", xdr.lookup("DataEntryExt")]
]);
xdr.enum("ClaimPredicateType", {
claimPredicateUnconditional: 0,
claimPredicateAnd: 1,
claimPredicateOr: 2,
claimPredicateNot: 3,
claimPredicateBeforeAbsoluteTime: 4,
claimPredicateBeforeRelativeTime: 5
});
xdr.union("ClaimPredicate", {
switchOn: xdr.lookup("ClaimPredicateType"),
switchName: "type",
switches: [
["claimPredicateUnconditional", xdr.void()],
["claimPredicateAnd", "andPredicates"],
["claimPredicateOr", "orPredicates"],
["claimPredicateNot", "notPredicate"],
["claimPredicateBeforeAbsoluteTime", "absBefore"],
["claimPredicateBeforeRelativeTime", "relBefore"]
],
arms: {
andPredicates: xdr.varArray(xdr.lookup("ClaimPredicate"), 2),
orPredicates: xdr.varArray(xdr.lookup("ClaimPredicate"), 2),
notPredicate: xdr.option(xdr.lookup("ClaimPredicate")),
absBefore: xdr.lookup("Int64"),
relBefore: xdr.lookup("Int64")
}
});
xdr.enum("ClaimantType", {
claimantTypeV0: 0
});
xdr.struct("ClaimantV0", [
["destination", xdr.lookup("AccountId")],
["predicate", xdr.lookup("ClaimPredicate")]
]);
xdr.union("Claimant", {
switchOn: xdr.lookup("ClaimantType"),
switchName: "type",
switches: [["claimantTypeV0", "v0"]],
arms: {
v0: xdr.lookup("ClaimantV0")
}
});
xdr.enum("ClaimableBalanceFlags", {
claimableBalanceClawbackEnabledFlag: 1
});
xdr.const("MASK_CLAIMABLE_BALANCE_FLAGS", 1);
xdr.union("ClaimableBalanceEntryExtensionV1Ext", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, xdr.void()]],
arms: {}
});
xdr.struct("ClaimableBalanceEntryExtensionV1", [
["ext", xdr.lookup("ClaimableBalanceEntryExtensionV1Ext")],
["flags", xdr.lookup("Uint32")]
]);
xdr.union("ClaimableBalanceEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "v1"]
],
arms: {
v1: xdr.lookup("ClaimableBalanceEntryExtensionV1")
}
});
xdr.struct("ClaimableBalanceEntry", [
["balanceId", xdr.lookup("ClaimableBalanceId")],
["claimants", xdr.varArray(xdr.lookup("Claimant"), 10)],
["asset", xdr.lookup("Asset")],
["amount", xdr.lookup("Int64")],
["ext", xdr.lookup("ClaimableBalanceEntryExt")]
]);
xdr.struct("LiquidityPoolConstantProductParameters", [
["assetA", xdr.lookup("Asset")],
["assetB", xdr.lookup("Asset")],
["fee", xdr.lookup("Int32")]
]);
xdr.struct("LiquidityPoolEntryConstantProduct", [
["params", xdr.lookup("LiquidityPoolConstantProductParameters")],
["reserveA", xdr.lookup("Int64")],
["reserveB", xdr.lookup("Int64")],
["totalPoolShares", xdr.lookup("Int64")],
["poolSharesTrustLineCount", xdr.lookup("Int64")]
]);
xdr.union("LiquidityPoolEntryBody", {
switchOn: xdr.lookup("LiquidityPoolType"),
switchName: "type",
switches: [["liquidityPoolConstantProduct", "constantProduct"]],
arms: {
constantProduct: xdr.lookup("LiquidityPoolEntryConstantProduct")
}
});
xdr.struct("LiquidityPoolEntry", [
["liquidityPoolId", xdr.lookup("PoolId")],
["body", xdr.lookup("LiquidityPoolEntryBody")]
]);
xdr.enum("ContractDataDurability", {
temporary: 0,
persistent: 1
});
xdr.struct("ContractDataEntry", [
["ext", xdr.lookup("ExtensionPoint")],
["contract", xdr.lookup("ScAddress")],
["key", xdr.lookup("ScVal")],
["durability", xdr.lookup("ContractDataDurability")],
["val", xdr.lookup("ScVal")]
]);
xdr.struct("ContractCodeCostInputs", [
["ext", xdr.lookup("ExtensionPoint")],
["nInstructions", xdr.lookup("Uint32")],
["nFunctions", xdr.lookup("Uint32")],
["nGlobals", xdr.lookup("Uint32")],
["nTableEntries", xdr.lookup("Uint32")],
["nTypes", xdr.lookup("Uint32")],
["nDataSegments", xdr.lookup("Uint32")],
["nElemSegments", xdr.lookup("Uint32")],
["nImports", xdr.lookup("Uint32")],
["nExports", xdr.lookup("Uint32")],
["nDataSegmentBytes", xdr.lookup("Uint32")]
]);
xdr.struct("ContractCodeEntryV1", [
["ext", xdr.lookup("ExtensionPoint")],
["costInputs", xdr.lookup("ContractCodeCostInputs")]
]);
xdr.union("ContractCodeEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "v1"]
],
arms: {
v1: xdr.lookup("ContractCodeEntryV1")
}
});
xdr.struct("ContractCodeEntry", [
["ext", xdr.lookup("ContractCodeEntryExt")],
["hash", xdr.lookup("Hash")],
["code", xdr.varOpaque()]
]);
xdr.struct("TtlEntry", [
["keyHash", xdr.lookup("Hash")],
["liveUntilLedgerSeq", xdr.lookup("Uint32")]
]);
xdr.union("LedgerEntryExtensionV1Ext", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, xdr.void()]],
arms: {}
});
xdr.struct("LedgerEntryExtensionV1", [
["sponsoringId", xdr.lookup("SponsorshipDescriptor")],
["ext", xdr.lookup("LedgerEntryExtensionV1Ext")]
]);
xdr.union("LedgerEntryData", {
switchOn: xdr.lookup("LedgerEntryType"),
switchName: "type",
switches: [
["account", "account"],
["trustline", "trustLine"],
["offer", "offer"],
["data", "data"],
["claimableBalance", "claimableBalance"],
["liquidityPool", "liquidityPool"],
["contractData", "contractData"],
["contractCode", "contractCode"],
["configSetting", "configSetting"],
["ttl", "ttl"]
],
arms: {
account: xdr.lookup("AccountEntry"),
trustLine: xdr.lookup("TrustLineEntry"),
offer: xdr.lookup("OfferEntry"),
data: xdr.lookup("DataEntry"),
claimableBalance: xdr.lookup("ClaimableBalanceEntry"),
liquidityPool: xdr.lookup("LiquidityPoolEntry"),
contractData: xdr.lookup("ContractDataEntry"),
contractCode: xdr.lookup("ContractCodeEntry"),
configSetting: xdr.lookup("ConfigSettingEntry"),
ttl: xdr.lookup("TtlEntry")
}
});
xdr.union("LedgerEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "v1"]
],
arms: {
v1: xdr.lookup("LedgerEntryExtensionV1")
}
});
xdr.struct("LedgerEntry", [
["lastModifiedLedgerSeq", xdr.lookup("Uint32")],
["data", xdr.lookup("LedgerEntryData")],
["ext", xdr.lookup("LedgerEntryExt")]
]);
xdr.struct("LedgerKeyAccount", [["accountId", xdr.lookup("AccountId")]]);
xdr.struct("LedgerKeyTrustLine", [
["accountId", xdr.lookup("AccountId")],
["asset", xdr.lookup("TrustLineAsset")]
]);
xdr.struct("LedgerKeyOffer", [
["sellerId", xdr.lookup("AccountId")],
["offerId", xdr.lookup("Int64")]
]);
xdr.struct("LedgerKeyData", [
["accountId", xdr.lookup("AccountId")],
["dataName", xdr.lookup("String64")]
]);
xdr.struct("LedgerKeyClaimableBalance", [
["balanceId", xdr.lookup("ClaimableBalanceId")]
]);
xdr.struct("LedgerKeyLiquidityPool", [
["liquidityPoolId", xdr.lookup("PoolId")]
]);
xdr.struct("LedgerKeyContractData", [
["contract", xdr.lookup("ScAddress")],
["key", xdr.lookup("ScVal")],
["durability", xdr.lookup("ContractDataDurability")]
]);
xdr.struct("LedgerKeyContractCode", [["hash", xdr.lookup("Hash")]]);
xdr.struct("LedgerKeyConfigSetting", [
["configSettingId", xdr.lookup("ConfigSettingId")]
]);
xdr.struct("LedgerKeyTtl", [["keyHash", xdr.lookup("Hash")]]);
xdr.union("LedgerKey", {
switchOn: xdr.lookup("LedgerEntryType"),
switchName: "type",
switches: [
["account", "account"],
["trustline", "trustLine"],
["offer", "offer"],
["data", "data"],
["claimableBalance", "claimableBalance"],
["liquidityPool", "liquidityPool"],
["contractData", "contractData"],
["contractCode", "contractCode"],
["configSetting", "configSetting"],
["ttl", "ttl"]
],
arms: {
account: xdr.lookup("LedgerKeyAccount"),
trustLine: xdr.lookup("LedgerKeyTrustLine"),
offer: xdr.lookup("LedgerKeyOffer"),
data: xdr.lookup("LedgerKeyData"),
claimableBalance: xdr.lookup("LedgerKeyClaimableBalance"),
liquidityPool: xdr.lookup("LedgerKeyLiquidityPool"),
contractData: xdr.lookup("LedgerKeyContractData"),
contractCode: xdr.lookup("LedgerKeyContractCode"),
configSetting: xdr.lookup("LedgerKeyConfigSetting"),
ttl: xdr.lookup("LedgerKeyTtl")
}
});
xdr.enum("EnvelopeType", {
envelopeTypeTxV0: 0,
envelopeTypeScp: 1,
envelopeTypeTx: 2,
envelopeTypeAuth: 3,
envelopeTypeScpvalue: 4,
envelopeTypeTxFeeBump: 5,
envelopeTypeOpId: 6,
envelopeTypePoolRevokeOpId: 7,
envelopeTypeContractId: 8,
envelopeTypeSorobanAuthorization: 9,
envelopeTypeSorobanAuthorizationWithAddress: 10
});
xdr.enum("BucketListType", {
live: 0,
hotArchive: 1
});
xdr.enum("BucketEntryType", {
metaentry: -1,
liveentry: 0,
deadentry: 1,
initentry: 2
});
xdr.enum("HotArchiveBucketEntryType", {
hotArchiveMetaentry: -1,
hotArchiveArchived: 0,
hotArchiveLive: 1
});
xdr.union("BucketMetadataExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "bucketListType"]
],
arms: {
bucketListType: xdr.lookup("BucketListType")
}
});
xdr.struct("BucketMetadata", [
["ledgerVersion", xdr.lookup("Uint32")],
["ext", xdr.lookup("BucketMetadataExt")]
]);
xdr.union("BucketEntry", {
switchOn: xdr.lookup("BucketEntryType"),
switchName: "type",
switches: [
["liveentry", "liveEntry"],
["initentry", "liveEntry"],
["deadentry", "deadEntry"],
["metaentry", "metaEntry"]
],
arms: {
liveEntry: xdr.lookup("LedgerEntry"),
deadEntry: xdr.lookup("LedgerKey"),
metaEntry: xdr.lookup("BucketMetadata")
}
});
xdr.union("HotArchiveBucketEntry", {
switchOn: xdr.lookup("HotArchiveBucketEntryType"),
switchName: "type",
switches: [
["hotArchiveArchived", "archivedEntry"],
["hotArchiveLive", "key"],
["hotArchiveMetaentry", "metaEntry"]
],
arms: {
archivedEntry: xdr.lookup("LedgerEntry"),
key: xdr.lookup("LedgerKey"),
metaEntry: xdr.lookup("BucketMetadata")
}
});
xdr.typedef("UpgradeType", xdr.varOpaque(128));
xdr.enum("StellarValueType", {
stellarValueBasic: 0,
stellarValueSigned: 1
});
xdr.struct("LedgerCloseValueSignature", [
["nodeId", xdr.lookup("NodeId")],
["signature", xdr.lookup("Signature")]
]);
xdr.union("StellarValueExt", {
switchOn: xdr.lookup("StellarValueType"),
switchName: "v",
switches: [
["stellarValueBasic", xdr.void()],
["stellarValueSigned", "lcValueSignature"]
],
arms: {
lcValueSignature: xdr.lookup("LedgerCloseValueSignature")
}
});
xdr.struct("StellarValue", [
["txSetHash", xdr.lookup("Hash")],
["closeTime", xdr.lookup("TimePoint")],
["upgrades", xdr.varArray(xdr.lookup("UpgradeType"), 6)],
["ext", xdr.lookup("StellarValueExt")]
]);
xdr.const("MASK_LEDGER_HEADER_FLAGS", 7);
xdr.enum("LedgerHeaderFlags", {
disableLiquidityPoolTradingFlag: 1,
disableLiquidityPoolDepositFlag: 2,
disableLiquidityPoolWithdrawalFlag: 4
});
xdr.union("LedgerHeaderExtensionV1Ext", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, xdr.void()]],
arms: {}
});
xdr.struct("LedgerHeaderExtensionV1", [
["flags", xdr.lookup("Uint32")],
["ext", xdr.lookup("LedgerHeaderExtensionV1Ext")]
]);
xdr.union("LedgerHeaderExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "v1"]
],
arms: {
v1: xdr.lookup("LedgerHeaderExtensionV1")
}
});
xdr.struct("LedgerHeader", [
["ledgerVersion", xdr.lookup("Uint32")],
["previousLedgerHash", xdr.lookup("Hash")],
["scpValue", xdr.lookup("StellarValue")],
["txSetResultHash", xdr.lookup("Hash")],
["bucketListHash", xdr.lookup("Hash")],
["ledgerSeq", xdr.lookup("Uint32")],
["totalCoins", xdr.lookup("Int64")],
["feePool", xdr.lookup("Int64")],
["inflationSeq", xdr.lookup("Uint32")],
["idPool", xdr.lookup("Uint64")],
["baseFee", xdr.lookup("Uint32")],
["baseReserve", xdr.lookup("Uint32")],
["maxTxSetSize", xdr.lookup("Uint32")],
["skipList", xdr.array(xdr.lookup("Hash"), 4)],
["ext", xdr.lookup("LedgerHeaderExt")]
]);
xdr.enum("LedgerUpgradeType", {
ledgerUpgradeVersion: 1,
ledgerUpgradeBaseFee: 2,
ledgerUpgradeMaxTxSetSize: 3,
ledgerUpgradeBaseReserve: 4,
ledgerUpgradeFlags: 5,
ledgerUpgradeConfig: 6,
ledgerUpgradeMaxSorobanTxSetSize: 7
});
xdr.struct("ConfigUpgradeSetKey", [
["contractId", xdr.lookup("ContractId")],
["contentHash", xdr.lookup("Hash")]
]);
xdr.union("LedgerUpgrade", {
switchOn: xdr.lookup("LedgerUpgradeType"),
switchName: "type",
switches: [
["ledgerUpgradeVersion", "newLedgerVersion"],
["ledgerUpgradeBaseFee", "newBaseFee"],
["ledgerUpgradeMaxTxSetSize", "newMaxTxSetSize"],
["ledgerUpgradeBaseReserve", "newBaseReserve"],
["ledgerUpgradeFlags", "newFlags"],
["ledgerUpgradeConfig", "newConfig"],
["ledgerUpgradeMaxSorobanTxSetSize", "newMaxSorobanTxSetSize"]
],
arms: {
newLedgerVersion: xdr.lookup("Uint32"),
newBaseFee: xdr.lookup("Uint32"),
newMaxTxSetSize: xdr.lookup("Uint32"),
newBaseReserve: xdr.lookup("Uint32"),
newFlags: xdr.lookup("Uint32"),
newConfig: xdr.lookup("ConfigUpgradeSetKey"),
newMaxSorobanTxSetSize: xdr.lookup("Uint32")
}
});
xdr.struct("ConfigUpgradeSet", [
[
"updatedEntry",
xdr.varArray(xdr.lookup("ConfigSettingEntry"), 2147483647)
]
]);
xdr.enum("TxSetComponentType", {
txsetCompTxsMaybeDiscountedFee: 0
});
xdr.typedef(
"DependentTxCluster",
xdr.varArray(xdr.lookup("TransactionEnvelope"), 2147483647)
);
xdr.typedef(
"ParallelTxExecutionStage",
xdr.varArray(xdr.lookup("DependentTxCluster"), 2147483647)
);
xdr.struct("ParallelTxsComponent", [
["baseFee", xdr.option(xdr.lookup("Int64"))],
[
"executionStages",
xdr.varArray(xdr.lookup("ParallelTxExecutionStage"), 2147483647)
]
]);
xdr.struct("TxSetComponentTxsMaybeDiscountedFee", [
["baseFee", xdr.option(xdr.lookup("Int64"))],
["txes", xdr.varArray(xdr.lookup("TransactionEnvelope"), 2147483647)]
]);
xdr.union("TxSetComponent", {
switchOn: xdr.lookup("TxSetComponentType"),
switchName: "type",
switches: [["txsetCompTxsMaybeDiscountedFee", "txsMaybeDiscountedFee"]],
arms: {
txsMaybeDiscountedFee: xdr.lookup("TxSetComponentTxsMaybeDiscountedFee")
}
});
xdr.union("TransactionPhase", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, "v0Components"],
[1, "parallelTxsComponent"]
],
arms: {
v0Components: xdr.varArray(xdr.lookup("TxSetComponent"), 2147483647),
parallelTxsComponent: xdr.lookup("ParallelTxsComponent")
}
});
xdr.struct("TransactionSet", [
["previousLedgerHash", xdr.lookup("Hash")],
["txes", xdr.varArray(xdr.lookup("TransactionEnvelope"), 2147483647)]
]);
xdr.struct("TransactionSetV1", [
["previousLedgerHash", xdr.lookup("Hash")],
["phases", xdr.varArray(xdr.lookup("TransactionPhase"), 2147483647)]
]);
xdr.union("GeneralizedTransactionSet", {
switchOn: xdr.int(),
switchName: "v",
switches: [[1, "v1TxSet"]],
arms: {
v1TxSet: xdr.lookup("TransactionSetV1")
}
});
xdr.struct("TransactionResultPair", [
["transactionHash", xdr.lookup("Hash")],
["result", xdr.lookup("TransactionResult")]
]);
xdr.struct("TransactionResultSet", [
["results", xdr.varArray(xdr.lookup("TransactionResultPair"), 2147483647)]
]);
xdr.union("TransactionHistoryEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "generalizedTxSet"]
],
arms: {
generalizedTxSet: xdr.lookup("GeneralizedTransactionSet")
}
});
xdr.struct("TransactionHistoryEntry", [
["ledgerSeq", xdr.lookup("Uint32")],
["txSet", xdr.lookup("TransactionSet")],
["ext", xdr.lookup("TransactionHistoryEntryExt")]
]);
xdr.union("TransactionHistoryResultEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, xdr.void()]],
arms: {}
});
xdr.struct("TransactionHistoryResultEntry", [
["ledgerSeq", xdr.lookup("Uint32")],
["txResultSet", xdr.lookup("TransactionResultSet")],
["ext", xdr.lookup("TransactionHistoryResultEntryExt")]
]);
xdr.union("LedgerHeaderHistoryEntryExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, xdr.void()]],
arms: {}
});
xdr.struct("LedgerHeaderHistoryEntry", [
["hash", xdr.lookup("Hash")],
["header", xdr.lookup("LedgerHeader")],
["ext", xdr.lookup("LedgerHeaderHistoryEntryExt")]
]);
xdr.struct("LedgerScpMessages", [
["ledgerSeq", xdr.lookup("Uint32")],
["messages", xdr.varArray(xdr.lookup("ScpEnvelope"), 2147483647)]
]);
xdr.struct("ScpHistoryEntryV0", [
["quorumSets", xdr.varArray(xdr.lookup("ScpQuorumSet"), 2147483647)],
["ledgerMessages", xdr.lookup("LedgerScpMessages")]
]);
xdr.union("ScpHistoryEntry", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, "v0"]],
arms: {
v0: xdr.lookup("ScpHistoryEntryV0")
}
});
xdr.enum("LedgerEntryChangeType", {
ledgerEntryCreated: 0,
ledgerEntryUpdated: 1,
ledgerEntryRemoved: 2,
ledgerEntryState: 3,
ledgerEntryRestored: 4
});
xdr.union("LedgerEntryChange", {
switchOn: xdr.lookup("LedgerEntryChangeType"),
switchName: "type",
switches: [
["ledgerEntryCreated", "created"],
["ledgerEntryUpdated", "updated"],
["ledgerEntryRemoved", "removed"],
["ledgerEntryState", "state"],
["ledgerEntryRestored", "restored"]
],
arms: {
created: xdr.lookup("LedgerEntry"),
updated: xdr.lookup("LedgerEntry"),
removed: xdr.lookup("LedgerKey"),
state: xdr.lookup("LedgerEntry"),
restored: xdr.lookup("LedgerEntry")
}
});
xdr.typedef(
"LedgerEntryChanges",
xdr.varArray(xdr.lookup("LedgerEntryChange"), 2147483647)
);
xdr.struct("OperationMeta", [["changes", xdr.lookup("LedgerEntryChanges")]]);
xdr.struct("TransactionMetaV1", [
["txChanges", xdr.lookup("LedgerEntryChanges")],
["operations", xdr.varArray(xdr.lookup("OperationMeta"), 2147483647)]
]);
xdr.struct("TransactionMetaV2", [
["txChangesBefore", xdr.lookup("LedgerEntryChanges")],
["operations", xdr.varArray(xdr.lookup("OperationMeta"), 2147483647)],
["txChangesAfter", xdr.lookup("LedgerEntryChanges")]
]);
xdr.enum("ContractEventType", {
system: 0,
contract: 1,
diagnostic: 2
});
xdr.struct("ContractEventV0", [
["topics", xdr.varArray(xdr.lookup("ScVal"), 2147483647)],
["data", xdr.lookup("ScVal")]
]);
xdr.union("ContractEventBody", {
switchOn: xdr.int(),
switchName: "v",
switches: [[0, "v0"]],
arms: {
v0: xdr.lookup("ContractEventV0")
}
});
xdr.struct("ContractEvent", [
["ext", xdr.lookup("ExtensionPoint")],
["contractId", xdr.option(xdr.lookup("ContractId"))],
["type", xdr.lookup("ContractEventType")],
["body", xdr.lookup("ContractEventBody")]
]);
xdr.struct("DiagnosticEvent", [
["inSuccessfulContractCall", xdr.bool()],
["event", xdr.lookup("ContractEvent")]
]);
xdr.struct("SorobanTransactionMetaExtV1", [
["ext", xdr.lookup("ExtensionPoint")],
["totalNonRefundableResourceFeeCharged", xdr.lookup("Int64")],
["totalRefundableResourceFeeCharged", xdr.lookup("Int64")],
["rentFeeCharged", xdr.lookup("Int64")]
]);
xdr.union("SorobanTransactionMetaExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "v1"]
],
arms: {
v1: xdr.lookup("SorobanTransactionMetaExtV1")
}
});
xdr.struct("SorobanTransactionMeta", [
["ext", xdr.lookup("SorobanTransactionMetaExt")],
["events", xdr.varArray(xdr.lookup("ContractEvent"), 2147483647)],
["returnValue", xdr.lookup("ScVal")],
[
"diagnosticEvents",
xdr.varArray(xdr.lookup("DiagnosticEvent"), 2147483647)
]
]);
xdr.struct("TransactionMetaV3", [
["ext", xdr.lookup("ExtensionPoint")],
["txChangesBefore", xdr.lookup("LedgerEntryChanges")],
["operations", xdr.varArray(xdr.lookup("OperationMeta"), 2147483647)],
["txChangesAfter", xdr.lookup("LedgerEntryChanges")],
["sorobanMeta", xdr.option(xdr.lookup("SorobanTransactionMeta"))]
]);
xdr.struct("OperationMetaV2", [
["ext", xdr.lookup("ExtensionPoint")],
["changes", xdr.lookup("LedgerEntryChanges")],
["events", xdr.varArray(xdr.lookup("ContractEvent"), 2147483647)]
]);
xdr.struct("SorobanTransactionMetaV2", [
["ext", xdr.lookup("SorobanTransactionMetaExt")],
["returnValue", xdr.option(xdr.lookup("ScVal"))]
]);
xdr.enum("TransactionEventStage", {
transactionEventStageBeforeAllTxes: 0,
transactionEventStageAfterTx: 1,
transactionEventStageAfterAllTxes: 2
});
xdr.struct("TransactionEvent", [
["stage", xdr.lookup("TransactionEventStage")],
["event", xdr.lookup("ContractEvent")]
]);
xdr.struct("TransactionMetaV4", [
["ext", xdr.lookup("ExtensionPoint")],
["txChangesBefore", xdr.lookup("LedgerEntryChanges")],
["operations", xdr.varArray(xdr.lookup("OperationMetaV2"), 2147483647)],
["txChangesAfter", xdr.lookup("LedgerEntryChanges")],
["sorobanMeta", xdr.option(xdr.lookup("SorobanTransactionMetaV2"))],
["events", xdr.varArray(xdr.lookup("TransactionEvent"), 2147483647)],
[
"diagnosticEvents",
xdr.varArray(xdr.lookup("DiagnosticEvent"), 2147483647)
]
]);
xdr.struct("InvokeHostFunctionSuccessPreImage", [
["returnValue", xdr.lookup("ScVal")],
["events", xdr.varArray(xdr.lookup("ContractEvent"), 2147483647)]
]);
xdr.union("TransactionMeta", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, "operations"],
[1, "v1"],
[2, "v2"],
[3, "v3"],
[4, "v4"]
],
arms: {
operations: xdr.varArray(xdr.lookup("OperationMeta"), 2147483647),
v1: xdr.lookup("TransactionMetaV1"),
v2: xdr.lookup("TransactionMetaV2"),
v3: xdr.lookup("TransactionMetaV3"),
v4: xdr.lookup("TransactionMetaV4")
}
});
xdr.struct("TransactionResultMeta", [
["result", xdr.lookup("TransactionResultPair")],
["feeProcessing", xdr.lookup("LedgerEntryChanges")],
["txApplyProcessing", xdr.lookup("TransactionMeta")]
]);
xdr.struct("TransactionResultMetaV1", [
["ext", xdr.lookup("ExtensionPoint")],
["result", xdr.lookup("TransactionResultPair")],
["feeProcessing", xdr.lookup("LedgerEntryChanges")],
["txApplyProcessing", xdr.lookup("TransactionMeta")],
["postTxApplyFeeProcessing", xdr.lookup("LedgerEntryChanges")]
]);
xdr.struct("UpgradeEntryMeta", [
["upgrade", xdr.lookup("LedgerUpgrade")],
["changes", xdr.lookup("LedgerEntryChanges")]
]);
xdr.struct("LedgerCloseMetaV0", [
["ledgerHeader", xdr.lookup("LedgerHeaderHistoryEntry")],
["txSet", xdr.lookup("TransactionSet")],
[
"txProcessing",
xdr.varArray(xdr.lookup("TransactionResultMeta"), 2147483647)
],
[
"upgradesProcessing",
xdr.varArray(xdr.lookup("UpgradeEntryMeta"), 2147483647)
],
["scpInfo", xdr.varArray(xdr.lookup("ScpHistoryEntry"), 2147483647)]
]);
xdr.struct("LedgerCloseMetaExtV1", [
["ext", xdr.lookup("ExtensionPoint")],
["sorobanFeeWrite1Kb", xdr.lookup("Int64")]
]);
xdr.union("LedgerCloseMetaExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
[1, "v1"]
],
arms: {
v1: xdr.lookup("LedgerCloseMetaExtV1")
}
});
xdr.struct("LedgerCloseMetaV1", [
["ext", xdr.lookup("LedgerCloseMetaExt")],
["ledgerHeader", xdr.lookup("LedgerHeaderHistoryEntry")],
["txSet", xdr.lookup("GeneralizedTransactionSet")],
[
"txProcessing",
xdr.varArray(xdr.lookup("TransactionResultMeta"), 2147483647)
],
[
"upgradesProcessing",
xdr.varArray(xdr.lookup("UpgradeEntryMeta"), 2147483647)
],
["scpInfo", xdr.varArray(xdr.lookup("ScpHistoryEntry"), 2147483647)],
["totalByteSizeOfLiveSorobanState", xdr.lookup("Uint64")],
["evictedKeys", xdr.varArray(xdr.lookup("LedgerKey"), 2147483647)],
["unused", xdr.varArray(xdr.lookup("LedgerEntry"), 2147483647)]
]);
xdr.struct("LedgerCloseMetaV2", [
["ext", xdr.lookup("LedgerCloseMetaExt")],
["ledgerHeader", xdr.lookup("LedgerHeaderHistoryEntry")],
["txSet", xdr.lookup("GeneralizedTransactionSet")],
[
"txProcessing",
xdr.varArray(xdr.lookup("TransactionResultMetaV1"), 2147483647)
],
[
"upgradesProcessing",
xdr.varArray(xdr.lookup("UpgradeEntryMeta"), 2147483647)
],
["scpInfo", xdr.varArray(xdr.lookup("ScpHistoryEntry"), 2147483647)],
["totalByteSizeOfLiveSorobanState", xdr.lookup("Uint64")],
["evictedKeys", xdr.varArray(xdr.lookup("LedgerKey"), 2147483647)]
]);
xdr.union("LedgerCloseMeta", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, "v0"],
[1, "v1"],
[2, "v2"]
],
arms: {
v0: xdr.lookup("LedgerCloseMetaV0"),
v1: xdr.lookup("LedgerCloseMetaV1"),
v2: xdr.lookup("LedgerCloseMetaV2")
}
});
xdr.enum("ErrorCode", {
errMisc: 0,
errData: 1,
errConf: 2,
errAuth: 3,
errLoad: 4
});
xdr.struct("Error", [
["code", xdr.lookup("ErrorCode")],
["msg", xdr.string(100)]
]);
xdr.struct("SendMore", [["numMessages", xdr.lookup("Uint32")]]);
xdr.struct("SendMoreExtended", [
["numMessages", xdr.lookup("Uint32")],
["numBytes", xdr.lookup("Uint32")]
]);
xdr.struct("AuthCert", [
["pubkey", xdr.lookup("Curve25519Public")],
["expiration", xdr.lookup("Uint64")],
["sig", xdr.lookup("Signature")]
]);
xdr.struct("Hello", [
["ledgerVersion", xdr.lookup("Uint32")],
["overlayVersion", xdr.lookup("Uint32")],
["overlayMinVersion", xdr.lookup("Uint32")],
["networkId", xdr.lookup("Hash")],
["versionStr", xdr.string(100)],
["listeningPort", xdr.int()],
["peerId", xdr.lookup("NodeId")],
["cert", xdr.lookup("AuthCert")],
["nonce", xdr.lookup("Uint256")]
]);
xdr.const("AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED", 200);
xdr.struct("Auth", [["flags", xdr.int()]]);
xdr.enum("IpAddrType", {
iPv4: 0,
iPv6: 1
});
xdr.union("PeerAddressIp", {
switchOn: xdr.lookup("IpAddrType"),
switchName: "type",
switches: [
["iPv4", "ipv4"],
["iPv6", "ipv6"]
],
arms: {
ipv4: xdr.opaque(4),
ipv6: xdr.opaque(16)
}
});
xdr.struct("PeerAddress", [
["ip", xdr.lookup("PeerAddressIp")],
["port", xdr.lookup("Uint32")],
["numFailures", xdr.lookup("Uint32")]
]);
xdr.enum("MessageType", {
errorMsg: 0,
auth: 2,
dontHave: 3,
peers: 5,
getTxSet: 6,
txSet: 7,
generalizedTxSet: 17,
transaction: 8,
getScpQuorumset: 9,
scpQuorumset: 10,
scpMessage: 11,
getScpState: 12,
hello: 13,
sendMore: 16,
sendMoreExtended: 20,
floodAdvert: 18,
floodDemand: 19,
timeSlicedSurveyRequest: 21,
timeSlicedSurveyResponse: 22,
timeSlicedSurveyStartCollecting: 23,
timeSlicedSurveyStopCollecting: 24
});
xdr.struct("DontHave", [
["type", xdr.lookup("MessageType")],
["reqHash", xdr.lookup("Uint256")]
]);
xdr.enum("SurveyMessageCommandType", {
timeSlicedSurveyTopology: 1
});
xdr.enum("SurveyMessageResponseType", {
surveyTopologyResponseV2: 2
});
xdr.struct("TimeSlicedSurveyStartCollectingMessage", [
["surveyorId", xdr.lookup("NodeId")],
["nonce", xdr.lookup("Uint32")],
["ledgerNum", xdr.lookup("Uint32")]
]);
xdr.struct("SignedTimeSlicedSurveyStartCollectingMessage", [
["signature", xdr.lookup("Signature")],
["startCollecting", xdr.lookup("TimeSlicedSurveyStartCollectingMessage")]
]);
xdr.struct("TimeSlicedSurveyStopCollectingMessage", [
["surveyorId", xdr.lookup("NodeId")],
["nonce", xdr.lookup("Uint32")],
["ledgerNum", xdr.lookup("Uint32")]
]);
xdr.struct("SignedTimeSlicedSurveyStopCollectingMessage", [
["signature", xdr.lookup("Signature")],
["stopCollecting", xdr.lookup("TimeSlicedSurveyStopCollectingMessage")]
]);
xdr.struct("SurveyRequestMessage", [
["surveyorPeerId", xdr.lookup("NodeId")],
["surveyedPeerId", xdr.lookup("NodeId")],
["ledgerNum", xdr.lookup("Uint32")],
["encryptionKey", xdr.lookup("Curve25519Public")],
["commandType", xdr.lookup("SurveyMessageCommandType")]
]);
xdr.struct("TimeSlicedSurveyRequestMessage", [
["request", xdr.lookup("SurveyRequestMessage")],
["nonce", xdr.lookup("Uint32")],
["inboundPeersIndex", xdr.lookup("Uint32")],
["outboundPeersIndex", xdr.lookup("Uint32")]
]);
xdr.struct("SignedTimeSlicedSurveyRequestMessage", [
["requestSignature", xdr.lookup("Signature")],
["request", xdr.lookup("TimeSlicedSurveyRequestMessage")]
]);
xdr.typedef("EncryptedBody", xdr.varOpaque(64e3));
xdr.struct("SurveyResponseMessage", [
["surveyorPeerId", xdr.lookup("NodeId")],
["surveyedPeerId", xdr.lookup("NodeId")],
["ledgerNum", xdr.lookup("Uint32")],
["commandType", xdr.lookup("SurveyMessageCommandType")],
["encryptedBody", xdr.lookup("EncryptedBody")]
]);
xdr.struct("TimeSlicedSurveyResponseMessage", [
["response", xdr.lookup("SurveyResponseMessage")],
["nonce", xdr.lookup("Uint32")]
]);
xdr.struct("SignedTimeSlicedSurveyResponseMessage", [
["responseSignature", xdr.lookup("Signature")],
["response", xdr.lookup("TimeSlicedSurveyResponseMessage")]
]);
xdr.struct("PeerStats", [
["id", xdr.lookup("NodeId")],
["versionStr", xdr.string(100)],
["messagesRead", xdr.lookup("Uint64")],
["messagesWritten", xdr.lookup("Uint64")],
["bytesRead", xdr.lookup("Uint64")],
["bytesWritten", xdr.lookup("Uint64")],
["secondsConnected", xdr.lookup("Uint64")],
["uniqueFloodBytesRecv", xdr.lookup("Uint64")],
["duplicateFloodBytesRecv", xdr.lookup("Uint64")],
["uniqueFetchBytesRecv", xdr.lookup("Uint64")],
["duplicateFetchBytesRecv", xdr.lookup("Uint64")],
["uniqueFloodMessageRecv", xdr.lookup("Uint64")],
["duplicateFloodMessageRecv", xdr.lookup("Uint64")],
["uniqueFetchMessageRecv", xdr.lookup("Uint64")],
["duplicateFetchMessageRecv", xdr.lookup("Uint64")]
]);
xdr.struct("TimeSlicedNodeData", [
["addedAuthenticatedPeers", xdr.lookup("Uint32")],
["droppedAuthenticatedPeers", xdr.lookup("Uint32")],
["totalInboundPeerCount", xdr.lookup("Uint32")],
["totalOutboundPeerCount", xdr.lookup("Uint32")],
["p75ScpFirstToSelfLatencyMs", xdr.lookup("Uint32")],
["p75ScpSelfToOtherLatencyMs", xdr.lookup("Uint32")],
["lostSyncCount", xdr.lookup("Uint32")],
["isValidator", xdr.bool()],
["maxInboundPeerCount", xdr.lookup("Uint32")],
["maxOutboundPeerCount", xdr.lookup("Uint32")]
]);
xdr.struct("TimeSlicedPeerData", [
["peerStats", xdr.lookup("PeerStats")],
["averageLatencyMs", xdr.lookup("Uint32")]
]);
xdr.typedef(
"TimeSlicedPeerDataList",
xdr.varArray(xdr.lookup("TimeSlicedPeerData"), 25)
);
xdr.struct("TopologyResponseBodyV2", [
["inboundPeers", xdr.lookup("TimeSlicedPeerDataList")],
["outboundPeers", xdr.lookup("TimeSlicedPeerDataList")],
["nodeData", xdr.lookup("TimeSlicedNodeData")]
]);
xdr.union("SurveyResponseBody", {
switchOn: xdr.lookup("SurveyMessageResponseType"),
switchName: "type",
switches: [["surveyTopologyResponseV2", "topologyResponseBodyV2"]],
arms: {
topologyResponseBodyV2: xdr.lookup("TopologyResponseBodyV2")
}
});
xdr.const("TX_ADVERT_VECTOR_MAX_SIZE", 1e3);
xdr.typedef(
"TxAdvertVector",
xdr.varArray(xdr.lookup("Hash"), xdr.lookup("TX_ADVERT_VECTOR_MAX_SIZE"))
);
xdr.struct("FloodAdvert", [["txHashes", xdr.lookup("TxAdvertVector")]]);
xdr.const("TX_DEMAND_VECTOR_MAX_SIZE", 1e3);
xdr.typedef(
"TxDemandVector",
xdr.varArray(xdr.lookup("Hash"), xdr.lookup("TX_DEMAND_VECTOR_MAX_SIZE"))
);
xdr.struct("FloodDemand", [["txHashes", xdr.lookup("TxDemandVector")]]);
xdr.union("StellarMessage", {
switchOn: xdr.lookup("MessageType"),
switchName: "type",
switches: [
["errorMsg", "error"],
["hello", "hello"],
["auth", "auth"],
["dontHave", "dontHave"],
["peers", "peers"],
["getTxSet", "txSetHash"],
["txSet", "txSet"],
["generalizedTxSet", "generalizedTxSet"],
["transaction", "transaction"],
["timeSlicedSurveyRequest", "signedTimeSlicedSurveyRequestMessage"],
["timeSlicedSurveyResponse", "signedTimeSlicedSurveyResponseMessage"],
[
"timeSlicedSurveyStartCollecting",
"signedTimeSlicedSurveyStartCollectingMessage"
],
[
"timeSlicedSurveyStopCollecting",
"signedTimeSlicedSurveyStopCollectingMessage"
],
["getScpQuorumset", "qSetHash"],
["scpQuorumset", "qSet"],
["scpMessage", "envelope"],
["getScpState", "getScpLedgerSeq"],
["sendMore", "sendMoreMessage"],
["sendMoreExtended", "sendMoreExtendedMessage"],
["floodAdvert", "floodAdvert"],
["floodDemand", "floodDemand"]
],
arms: {
error: xdr.lookup("Error"),
hello: xdr.lookup("Hello"),
auth: xdr.lookup("Auth"),
dontHave: xdr.lookup("DontHave"),
peers: xdr.varArray(xdr.lookup("PeerAddress"), 100),
txSetHash: xdr.lookup("Uint256"),
txSet: xdr.lookup("TransactionSet"),
generalizedTxSet: xdr.lookup("GeneralizedTransactionSet"),
transaction: xdr.lookup("TransactionEnvelope"),
signedTimeSlicedSurveyRequestMessage: xdr.lookup(
"SignedTimeSlicedSurveyRequestMessage"
),
signedTimeSlicedSurveyResponseMessage: xdr.lookup(
"SignedTimeSlicedSurveyResponseMessage"
),
signedTimeSlicedSurveyStartCollectingMessage: xdr.lookup(
"SignedTimeSlicedSurveyStartCollectingMessage"
),
signedTimeSlicedSurveyStopCollectingMessage: xdr.lookup(
"SignedTimeSlicedSurveyStopCollectingMessage"
),
qSetHash: xdr.lookup("Uint256"),
qSet: xdr.lookup("ScpQuorumSet"),
envelope: xdr.lookup("ScpEnvelope"),
getScpLedgerSeq: xdr.lookup("Uint32"),
sendMoreMessage: xdr.lookup("SendMore"),
sendMoreExtendedMessage: xdr.lookup("SendMoreExtended"),
floodAdvert: xdr.lookup("FloodAdvert"),
floodDemand: xdr.lookup("FloodDemand")
}
});
xdr.struct("AuthenticatedMessageV0", [
["sequence", xdr.lookup("Uint64")],
["message", xdr.lookup("StellarMessage")],
["mac", xdr.lookup("HmacSha256Mac")]
]);
xdr.union("AuthenticatedMessage", {
switchOn: xdr.lookup("Uint32"),
switchName: "v",
switches: [[0, "v0"]],
arms: {
v0: xdr.lookup("AuthenticatedMessageV0")
}
});
xdr.const("MAX_OPS_PER_TX", 100);
xdr.union("LiquidityPoolParameters", {
switchOn: xdr.lookup("LiquidityPoolType"),
switchName: "type",
switches: [["liquidityPoolConstantProduct", "constantProduct"]],
arms: {
constantProduct: xdr.lookup("LiquidityPoolConstantProductParameters")
}
});
xdr.struct("MuxedAccountMed25519", [
["id", xdr.lookup("Uint64")],
["ed25519", xdr.lookup("Uint256")]
]);
xdr.union("MuxedAccount", {
switchOn: xdr.lookup("CryptoKeyType"),
switchName: "type",
switches: [
["keyTypeEd25519", "ed25519"],
["keyTypeMuxedEd25519", "med25519"]
],
arms: {
ed25519: xdr.lookup("Uint256"),
med25519: xdr.lookup("MuxedAccountMed25519")
}
});
xdr.struct("DecoratedSignature", [
["hint", xdr.lookup("SignatureHint")],
["signature", xdr.lookup("Signature")]
]);
xdr.enum("OperationType", {
createAccount: 0,
payment: 1,
pathPaymentStrictReceive: 2,
manageSellOffer: 3,
createPassiveSellOffer: 4,
setOptions: 5,
changeTrust: 6,
allowTrust: 7,
accountMerge: 8,
inflation: 9,
manageData: 10,
bumpSequence: 11,
manageBuyOffer: 12,
pathPaymentStrictSend: 13,
createClaimableBalance: 14,
claimClaimableBalance: 15,
beginSponsoringFutureReserves: 16,
endSponsoringFutureReserves: 17,
revokeSponsorship: 18,
clawback: 19,
clawbackClaimableBalance: 20,
setTrustLineFlags: 21,
liquidityPoolDeposit: 22,
liquidityPoolWithdraw: 23,
invokeHostFunction: 24,
extendFootprintTtl: 25,
restoreFootprint: 26
});
xdr.struct("CreateAccountOp", [
["destination", xdr.lookup("AccountId")],
["startingBalance", xdr.lookup("Int64")]
]);
xdr.struct("PaymentOp", [
["destination", xdr.lookup("MuxedAccount")],
["asset", xdr.lookup("Asset")],
["amount", xdr.lookup("Int64")]
]);
xdr.struct("PathPaymentStrictReceiveOp", [
["sendAsset", xdr.lookup("Asset")],
["sendMax", xdr.lookup("Int64")],
["destination", xdr.lookup("MuxedAccount")],
["destAsset", xdr.lookup("Asset")],
["destAmount", xdr.lookup("Int64")],
["path", xdr.varArray(xdr.lookup("Asset"), 5)]
]);
xdr.struct("PathPaymentStrictSendOp", [
["sendAsset", xdr.lookup("Asset")],
["sendAmount", xdr.lookup("Int64")],
["destination", xdr.lookup("MuxedAccount")],
["destAsset", xdr.lookup("Asset")],
["destMin", xdr.lookup("Int64")],
["path", xdr.varArray(xdr.lookup("Asset"), 5)]
]);
xdr.struct("ManageSellOfferOp", [
["selling", xdr.lookup("Asset")],
["buying", xdr.lookup("Asset")],
["amount", xdr.lookup("Int64")],
["price", xdr.lookup("Price")],
["offerId", xdr.lookup("Int64")]
]);
xdr.struct("ManageBuyOfferOp", [
["selling", xdr.lookup("Asset")],
["buying", xdr.lookup("Asset")],
["buyAmount", xdr.lookup("Int64")],
["price", xdr.lookup("Price")],
["offerId", xdr.lookup("Int64")]
]);
xdr.struct("CreatePassiveSellOfferOp", [
["selling", xdr.lookup("Asset")],
["buying", xdr.lookup("Asset")],
["amount", xdr.lookup("Int64")],
["price", xdr.lookup("Price")]
]);
xdr.struct("SetOptionsOp", [
["inflationDest", xdr.option(xdr.lookup("AccountId"))],
["clearFlags", xdr.option(xdr.lookup("Uint32"))],
["setFlags", xdr.option(xdr.lookup("Uint32"))],
["masterWeight", xdr.option(xdr.lookup("Uint32"))],
["lowThreshold", xdr.option(xdr.lookup("Uint32"))],
["medThreshold", xdr.option(xdr.lookup("Uint32"))],
["highThreshold", xdr.option(xdr.lookup("Uint32"))],
["homeDomain", xdr.option(xdr.lookup("String32"))],
["signer", xdr.option(xdr.lookup("Signer"))]
]);
xdr.union("ChangeTrustAsset", {
switchOn: xdr.lookup("AssetType"),
switchName: "type",
switches: [
["assetTypeNative", xdr.void()],
["assetTypeCreditAlphanum4", "alphaNum4"],
["assetTypeCreditAlphanum12", "alphaNum12"],
["assetTypePoolShare", "liquidityPool"]
],
arms: {
alphaNum4: xdr.lookup("AlphaNum4"),
alphaNum12: xdr.lookup("AlphaNum12"),
liquidityPool: xdr.lookup("LiquidityPoolParameters")
}
});
xdr.struct("ChangeTrustOp", [
["line", xdr.lookup("ChangeTrustAsset")],
["limit", xdr.lookup("Int64")]
]);
xdr.struct("AllowTrustOp", [
["trustor", xdr.lookup("AccountId")],
["asset", xdr.lookup("AssetCode")],
["authorize", xdr.lookup("Uint32")]
]);
xdr.struct("ManageDataOp", [
["dataName", xdr.lookup("String64")],
["dataValue", xdr.option(xdr.lookup("DataValue"))]
]);
xdr.