@okxweb3/coin-stellar
Version:
@okxweb3/coin-stellar is a Stellar SDK for building Web3 wallets and applications. It supports Stellar and PI blockchains, enabling private key management, address generation, transaction signing, trustline creation, and asset transfers
1,418 lines • 128 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const XDR = __importStar(require("@stellar/js-xdr"));
var types = XDR.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("PoolId", xdr.lookup("Hash"));
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", 0x7);
xdr.const("MASK_ACCOUNT_FLAGS_V17", 0xF);
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("ClaimableBalanceIdType", {
claimableBalanceIdTypeV0: 0,
});
xdr.union("ClaimableBalanceId", {
switchOn: xdr.lookup("ClaimableBalanceIdType"),
switchName: "type",
switches: [
["claimableBalanceIdTypeV0", "v0"],
],
arms: {
v0: xdr.lookup("Hash"),
},
});
xdr.enum("ClaimableBalanceFlags", {
claimableBalanceClawbackEnabledFlag: 1,
});
xdr.const("MASK_CLAIMABLE_BALANCE_FLAGS", 0x1);
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,
});
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", 0x7);
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("Hash")],
["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("BucketEntryType", {
metaentry: -1,
liveentry: 0,
deadentry: 1,
initentry: 2,
});
xdr.union("BucketMetadataExt", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, xdr.void()],
],
arms: {},
});
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.enum("TxSetComponentType", {
txsetCompTxsMaybeDiscountedFee: 0,
});
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"],
],
arms: {
v0Components: xdr.varArray(xdr.lookup("TxSetComponent"), 2147483647),
},
});
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,
});
xdr.union("LedgerEntryChange", {
switchOn: xdr.lookup("LedgerEntryChangeType"),
switchName: "type",
switches: [
["ledgerEntryCreated", "created"],
["ledgerEntryUpdated", "updated"],
["ledgerEntryRemoved", "removed"],
["ledgerEntryState", "state"],
],
arms: {
created: xdr.lookup("LedgerEntry"),
updated: xdr.lookup("LedgerEntry"),
removed: xdr.lookup("LedgerKey"),
state: 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("Hash"))],
["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("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"],
],
arms: {
operations: xdr.varArray(xdr.lookup("OperationMeta"), 2147483647),
v1: xdr.lookup("TransactionMetaV1"),
v2: xdr.lookup("TransactionMetaV2"),
v3: xdr.lookup("TransactionMetaV3"),
},
});
xdr.struct("TransactionResultMeta", [
["result", xdr.lookup("TransactionResultPair")],
["feeProcessing", xdr.lookup("LedgerEntryChanges")],
["txApplyProcessing", xdr.lookup("TransactionMeta")],
]);
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)],
["totalByteSizeOfBucketList", xdr.lookup("Uint64")],
["evictedTemporaryLedgerKeys", xdr.varArray(xdr.lookup("LedgerKey"), 2147483647)],
["evictedPersistentLedgerEntries", xdr.varArray(xdr.lookup("LedgerEntry"), 2147483647)],
]);
xdr.union("LedgerCloseMeta", {
switchOn: xdr.int(),
switchName: "v",
switches: [
[0, "v0"],
[1, "v1"],
],
arms: {
v0: xdr.lookup("LedgerCloseMetaV0"),
v1: xdr.lookup("LedgerCloseMetaV1"),
},
});
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,
getPeers: 4,
peers: 5,
getTxSet: 6,
txSet: 7,
generalizedTxSet: 17,
transaction: 8,
getScpQuorumset: 9,
scpQuorumset: 10,
scpMessage: 11,
getScpState: 12,
hello: 13,
surveyRequest: 14,
surveyResponse: 15,
sendMore: 16,
sendMoreExtended: 20,
floodAdvert: 18,
floodDemand: 19,
});
xdr.struct("DontHave", [
["type", xdr.lookup("MessageType")],
["reqHash", xdr.lookup("Uint256")],
]);
xdr.enum("SurveyMessageCommandType", {
surveyTopology: 0,
});
xdr.enum("SurveyMessageResponseType", {
surveyTopologyResponseV0: 0,
surveyTopologyResponseV1: 1,
});
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("SignedSurveyRequestMessage", [
["requestSignature", xdr.lookup("Signature")],
["request", xdr.lookup("SurveyRequestMessage")],
]);
xdr.typedef("EncryptedBody", xdr.varOpaque(64000));
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("SignedSurveyResponseMessage", [
["responseSignature", xdr.lookup("Signature")],
["response", xdr.lookup("SurveyResponseMessage")],
]);
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.typedef("PeerStatList", xdr.varArray(xdr.lookup("PeerStats"), 25));
xdr.struct("TopologyResponseBodyV0", [
["inboundPeers", xdr.lookup("PeerStatList")],
["outboundPeers", xdr.lookup("PeerStatList")],
["totalInboundPeerCount", xdr.lookup("Uint32")],
["totalOutboundPeerCount", xdr.lookup("Uint32")],
]);
xdr.struct("TopologyResponseBodyV1", [
["inboundPeers", xdr.lookup("PeerStatList")],
["outboundPeers", xdr.lookup("PeerStatList")],
["totalInboundPeerCount", xdr.lookup("Uint32")],
["totalOutboundPeerCount", xdr.lookup("Uint32")],
["maxInboundPeerCount", xdr.lookup("Uint32")],
["maxOutboundPeerCount", xdr.lookup("Uint32")],
]);
xdr.union("SurveyResponseBody", {
switchOn: xdr.lookup("SurveyMessageResponseType"),
switchName: "type",
switches: [
["surveyTopologyResponseV0", "topologyResponseBodyV0"],
["surveyTopologyResponseV1", "topologyResponseBodyV1"],
],
arms: {
topologyResponseBodyV0: xdr.lookup("TopologyResponseBodyV0"),
topologyResponseBodyV1: xdr.lookup("TopologyResponseBodyV1"),
},
});
xdr.const("TX_ADVERT_VECTOR_MAX_SIZE", 1000);
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", 1000);
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"],
["getPeers", xdr.void()],
["peers", "peers"],
["getTxSet", "txSetHash"],
["txSet", "txSet"],
["generalizedTxSet", "generalizedTxSet"],
["transaction", "transaction"],
["surveyRequest", "signedSurveyRequestMessage"],
["surveyResponse", "signedSurveyResponseMessage"],
["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"),
signedSurveyRequestMessage: xdr.lookup("SignedSurveyRequestMessage"),
signedSurveyResponseMessage: xdr.lookup("SignedSurveyResponseMessage"),
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", {
swi