diff --git a/stellar-dotnet-sdk-console/stellar-dotnet-sdk-console.csproj b/stellar-dotnet-sdk-console/stellar-dotnet-sdk-console.csproj index d3786040..a8f0a43d 100644 --- a/stellar-dotnet-sdk-console/stellar-dotnet-sdk-console.csproj +++ b/stellar-dotnet-sdk-console/stellar-dotnet-sdk-console.csproj @@ -10,4 +10,8 @@ + + + + diff --git a/stellar-dotnet-sdk-test/AddressTest.cs b/stellar-dotnet-sdk-test/AddressTest.cs new file mode 100644 index 00000000..fad884b9 --- /dev/null +++ b/stellar-dotnet-sdk-test/AddressTest.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using stellar_dotnet_sdk; + +namespace stellar_dotnet_sdk_test; + +[TestClass] +public class AddressTest +{ + [TestMethod] + public void TestAccountIdWithInvalidArgument() + { + const string invalidAccountId = "Invalidid"; + var ex = Assert.ThrowsException(() => new SCAccountId(invalidAccountId)); + Assert.AreEqual("Invalid account id (Parameter 'value')", ex.Message); + } + + [TestMethod] + public void TestContractIdWithInvalidArgument() + { + const string invalidContractId = "Invalidid"; + var ex = Assert.ThrowsException(() => new SCContractId(invalidContractId)); + Assert.AreEqual("Invalid contract id (Parameter 'value')", ex.Message); + } + + [TestMethod] + public void TestAccountIdWithValidArgument() + { + var scAccountId = new SCAccountId("GCZFMH32MF5EAWETZTKF3ZV5SEVJPI53UEMDNSW55WBR75GMZJU4U573"); + + // Act + var scAccountIdXdrBase64 = scAccountId.ToXdrBase64(); + var fromXdrBase64ScAccountId = (SCAccountId)SCVal.FromXdrBase64(scAccountIdXdrBase64); + + // Assert + Assert.AreEqual(scAccountId.InnerValue, fromXdrBase64ScAccountId.InnerValue); + } + + [TestMethod] + public void TestContractIdWithValidArgument() + { + var scContractId = new SCContractId("CAC2UYJQMC4ISUZ5REYB2AMDC44YKBNZWG4JB6N6GBL66CEKQO3RDSAB"); + + // Act + var scContractIdXdrBase64 = scContractId.ToXdrBase64(); + var fromXdrBase64ScContractId = (SCContractId)SCVal.FromXdrBase64(scContractIdXdrBase64); + + // Assert + Assert.AreEqual(scContractId.InnerValue, fromXdrBase64ScContractId.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-test/ScValTest.cs b/stellar-dotnet-sdk-test/ScValTest.cs new file mode 100644 index 00000000..6e6dd5d4 --- /dev/null +++ b/stellar-dotnet-sdk-test/ScValTest.cs @@ -0,0 +1,717 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using stellar_dotnet_sdk; +using xdrSDK = stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk_test; + +[TestClass] +public class ScValTest +{ + private const string WasmHash = "ZBYoEJT3IaPMMk3FoRmnEQHoDxewPZL+Uor+xWI4uII="; + + [TestMethod] + public void TestScBool() + { + var scBoolTrue = new SCBool(true); + var scBoolFalse = new SCBool(false); + + // Act + var scBoolTrueXdrBase64 = scBoolTrue.ToXdrBase64(); + var fromXdrBase64ScBoolTrue = (SCBool)SCVal.FromXdrBase64(scBoolTrueXdrBase64); + + var scBoolFalseXdrBase64 = scBoolFalse.ToXdrBase64(); + var fromXdrBase64ScBoolFalse = (SCBool)SCVal.FromXdrBase64(scBoolFalseXdrBase64); + + // Assert + Assert.AreEqual(scBoolTrue.InnerValue, fromXdrBase64ScBoolTrue.InnerValue); + Assert.AreEqual(scBoolFalse.InnerValue, fromXdrBase64ScBoolFalse.InnerValue); + } + + [TestMethod] + public void TestSCContractError() + { + var error = new SCContractError(1); + + // Act + var contractErrorXdrBase64 = error.ToXdrBase64(); + var fromXdrBase64ContractError = (SCContractError)SCVal.FromXdrBase64(contractErrorXdrBase64); + + // Assert + Assert.AreEqual(error.ContractCode, fromXdrBase64ContractError.ContractCode); + } + + [TestMethod] + public void TestSCWasmVmError() + { + var arithDomainError = new SCWasmVmError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCWasmVmError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCWasmVmError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var internalErrorXdrBase64 = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCWasmVmError)SCVal.FromXdrBase64(internalErrorXdrBase64); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestSCContextError() + { + var arithDomainError = new SCContextError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCContextError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCContextError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var xdrBase64InternalError = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCContextError)SCVal.FromXdrBase64(xdrBase64InternalError); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestSCStorageError() + { + var arithDomainError = new SCStorageError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCStorageError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCStorageError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var xdrBase64InternalError = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCStorageError)SCVal.FromXdrBase64(xdrBase64InternalError); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestSCObjectError() + { + var arithDomainError = new SCObjectError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCObjectError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCObjectError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var xdrBase64InternalError = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCObjectError)SCVal.FromXdrBase64(xdrBase64InternalError); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestSCCryptoError() + { + var arithDomainError = new SCCryptoError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCCryptoError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCCryptoError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var xdrBase64InternalError = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCCryptoError)SCVal.FromXdrBase64(xdrBase64InternalError); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestSCEventsError() + { + var arithDomainError = new SCEventsError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCEventsError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCEventsError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var xdrBase64InternalError = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCEventsError)SCVal.FromXdrBase64(xdrBase64InternalError); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestSCBudgetError() + { + var arithDomainError = new SCBudgetError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCBudgetError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCBudgetError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var xdrBase64InternalError = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCBudgetError)SCVal.FromXdrBase64(xdrBase64InternalError); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestSCValueError() + { + var arithDomainError = new SCValueError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCValueError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCValueError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var xdrBase64InternalError = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCValueError)SCVal.FromXdrBase64(xdrBase64InternalError); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestSCAuthError() + { + var arithDomainError = new SCAuthError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_ARITH_DOMAIN + }; + var internalError = new SCAuthError + { + Code = xdrSDK.SCErrorCode.SCErrorCodeEnum.SCEC_INTERNAL_ERROR + }; + // Act + var arithDomainErrorXdrBase64 = arithDomainError.ToXdrBase64(); + var fromXdrBase64ArithDomainError = (SCAuthError)SCVal.FromXdrBase64(arithDomainErrorXdrBase64); + + var xdrBase64InternalError = internalError.ToXdrBase64(); + var fromXdrBase64InternalError = (SCAuthError)SCVal.FromXdrBase64(xdrBase64InternalError); + + // Assert + Assert.AreEqual(arithDomainError.Code, fromXdrBase64ArithDomainError.Code); + Assert.AreEqual(internalError.Code, fromXdrBase64InternalError.Code); + } + + [TestMethod] + public void TestScUint32() + { + var scUint32 = new SCUint32(1319013123); + + // Act + var scUint32XdrBase64 = scUint32.ToXdrBase64(); + var xdrScUint32 = (SCUint32)SCVal.FromXdrBase64(scUint32XdrBase64); + + // Assert + Assert.AreEqual(scUint32.InnerValue, xdrScUint32.InnerValue); + } + + [TestMethod] + public void TestScInt32() + { + var scInt32 = new SCInt32(-192049123); + + // Act + var scInt32XdrBase64 = scInt32.ToXdrBase64(); + var fromXdrBase64ScInt32 = (SCInt32)SCVal.FromXdrBase64(scInt32XdrBase64); + + // Assert + Assert.AreEqual(scInt32.InnerValue, fromXdrBase64ScInt32.InnerValue); + } + + [TestMethod] + public void TestScUint64() + { + var scUint64 = new SCUint64 + { + InnerValue = 18446744073709551615 + }; + + // Act + var scUint64XdrBase64 = scUint64.ToXdrBase64(); + var fromXdrBase64ScUint64 = (SCUint64)SCVal.FromXdrBase64(scUint64XdrBase64); + + // Assert + Assert.AreEqual(scUint64.InnerValue, fromXdrBase64ScUint64.InnerValue); + } + + [TestMethod] + public void TestScInt64() + { + var scInt64 = new SCInt64(-9223372036854775807); + + // Act + var scInt64XdrBase64 = scInt64.ToXdrBase64(); + var fromXdrBase64ScInt64 = (SCInt64)SCVal.FromXdrBase64(scInt64XdrBase64); + + // Assert + Assert.AreEqual(scInt64.InnerValue, fromXdrBase64ScInt64.InnerValue); + } + + [TestMethod] + public void TestScTimePoint() + { + var scTimePoint = new SCTimePoint(18446744073709551615); + + // Act + var scTimePointXdrBase64 = scTimePoint.ToXdrBase64(); + var fromXdrBase64ScTimePoint = (SCTimePoint)SCVal.FromXdrBase64(scTimePointXdrBase64); + + // Assert + Assert.AreEqual(scTimePoint.InnerValue, fromXdrBase64ScTimePoint.InnerValue); + } + + [TestMethod] + public void TestScDuration() + { + var scDuration = new SCDuration(18446744073709551615); + + // Act + var scDurationXdrBase64 = scDuration.ToXdrBase64(); + var fromXdrBase64ScDuration = (SCDuration)SCVal.FromXdrBase64(scDurationXdrBase64); + + // Assert + Assert.AreEqual(scDuration.InnerValue, fromXdrBase64ScDuration.InnerValue); + } + + [TestMethod] + public void TestScUint128() + { + var scUint128 = new SCUint128 + { + Hi = 18446744073709551615, + Lo = 1 + }; + + // Act + var scUint128XdrBase64 = scUint128.ToXdrBase64(); + var fromXdrBase64ScUint128 = (SCUint128)SCVal.FromXdrBase64(scUint128XdrBase64); + + // Assert + Assert.AreEqual(scUint128.Hi, fromXdrBase64ScUint128.Hi); + Assert.AreEqual(scUint128.Lo, fromXdrBase64ScUint128.Lo); + } + + [TestMethod] + public void TestScInt128() + { + var scInt128 = new SCInt128 + { + Lo = 18446744073709551615, + Hi = -9223372036854775807 + }; + + // Act + var scInt128XdrBase64 = scInt128.ToXdrBase64(); + var fromXdrBase64ScInt128 = (SCInt128)SCVal.FromXdrBase64(scInt128XdrBase64); + + // Assert + Assert.AreEqual(scInt128.Lo, fromXdrBase64ScInt128.Lo); + Assert.AreEqual(scInt128.Hi, fromXdrBase64ScInt128.Hi); + } + + [TestMethod] + public void TestScUint256() + { + var scUint256 = new SCUint256 + { + HiHi = 18446744073709551615, + HiLo = 1, + LoHi = 18446744073709551614, + LoLo = 0 + }; + + // Act + var scUint256XdrBase64 = scUint256.ToXdrBase64(); + var fromXdrBase64ScUint256 = (SCUint256)SCVal.FromXdrBase64(scUint256XdrBase64); + + // Assert + Assert.AreEqual(scUint256.HiHi, fromXdrBase64ScUint256.HiHi); + Assert.AreEqual(scUint256.HiLo, fromXdrBase64ScUint256.HiLo); + Assert.AreEqual(scUint256.LoHi, fromXdrBase64ScUint256.LoHi); + Assert.AreEqual(scUint256.LoLo, fromXdrBase64ScUint256.LoLo); + } + + [TestMethod] + public void TestScInt256() + { + var scInt256 = new SCInt256 + { + HiHi = -9223372036854775807, + HiLo = 18446744073709551614, + LoHi = 18446744073709551615, + LoLo = 18446744073709551613 + }; + + // Act + var scInt256XdrBase64 = scInt256.ToXdrBase64(); + var fromXdrBase64ScInt256 = (SCInt256)SCVal.FromXdrBase64(scInt256XdrBase64); + + // Assert + Assert.AreEqual(scInt256.HiHi, fromXdrBase64ScInt256.HiHi); + Assert.AreEqual(scInt256.HiLo, fromXdrBase64ScInt256.HiLo); + Assert.AreEqual(scInt256.LoHi, fromXdrBase64ScInt256.LoHi); + Assert.AreEqual(scInt256.LoLo, fromXdrBase64ScInt256.LoLo); + } + + [TestMethod] + public void TestScBytesWithValidArgument() + { + byte[] bytes = { 0x00, 0x01, 0x03, 0x03, 0x34, 0x45, 0x66, 0x46 }; + var scBytes = new SCBytes(bytes); + + // Act + var scBytesXdrBase64 = scBytes.ToXdrBase64(); + var fromXdrBase64ScBytes = (SCBytes)SCVal.FromXdrBase64(scBytesXdrBase64); + + // Assert + CollectionAssert.AreEqual(scBytes.InnerValue, fromXdrBase64ScBytes.InnerValue); + } + + [TestMethod] + public void TestScBytesWithEmptyArgument() + { + var bytes = Array.Empty(); + var scBytes = new SCBytes(bytes); + + // Act + var scBytesXdrBase64 = scBytes.ToXdrBase64(); + var fromXdrBase64ScBytes = (SCBytes)SCVal.FromXdrBase64(scBytesXdrBase64); + + // Assert + CollectionAssert.AreEqual(scBytes.InnerValue, fromXdrBase64ScBytes.InnerValue); + } + + [TestMethod] + public void TestScString() + { + var scString = new SCString("hello world"); + + // Act + var scStringXdrBase64 = scString.ToXdrBase64(); + var fromXdrBase64ScString = (SCString)SCVal.FromXdrBase64(scStringXdrBase64); + + // Assert + Assert.AreEqual(scString.InnerValue, fromXdrBase64ScString.InnerValue); + } + + [TestMethod] + public void TestScStringWithEmptyArgument() + { + var scString = new SCString(""); + + // Act + var scStringXdrBase64 = scString.ToXdrBase64(); + var fromXdrBase64ScString = (SCString)SCVal.FromXdrBase64(scStringXdrBase64); + + // Assert + Assert.AreEqual(scString.InnerValue, fromXdrBase64ScString.InnerValue); + } + + [TestMethod] + public void TestScSymbol() + { + var scSymbol = new SCSymbol("Is this a symbol?"); + + // Act + var scSymbolXdrBase64 = scSymbol.ToXdrBase64(); + var fromXdrBase64ScSymbol = (SCSymbol)SCVal.FromXdrBase64(scSymbolXdrBase64); + + // Assert + Assert.AreEqual(scSymbol.InnerValue, fromXdrBase64ScSymbol.InnerValue); + } + + /// + /// + /// It's not necessary to check each of the scVec.InnerValue element for type and properties, + /// since there are already other tests in the class that cover different scenarios for + /// + /// + [TestMethod] + public void TestScVecWithValidEntries() + { + var scSymbol = new SCSymbol("Is this a symbol?"); + var scString = new SCString("hello world"); + var scVals = new SCVal[] { scString, scSymbol }; + var scVec = new SCVec(scVals); + + // Act + var scVecXdrBase64 = scVec.ToXdrBase64(); + var fromXdrBase64ScVec = (SCVec)SCVal.FromXdrBase64(scVecXdrBase64); + + // Assert + Assert.AreEqual(scVec.InnerValue.Length, fromXdrBase64ScVec.InnerValue.Length); + for (var i = 0; i < scVec.InnerValue.Length; i++) + Assert.AreEqual(scVec.InnerValue[i].ToXdrBase64(), fromXdrBase64ScVec.InnerValue[i].ToXdrBase64()); + } + + /// + /// + /// It's not necessary to check each of the scMap Key and Value for type and properties, + /// since there are already other tests in the class that cover different scenarios for + /// + /// + [TestMethod] + public void TestScMapWithValidEntries() + { + var entry1 = new SCMapEntry + { + Key = new SCString("key 1"), + Value = new SCBool(false) + }; + var entry2 = new SCMapEntry + { + Key = new SCUint32(1), + Value = new SCString("this is value 2") + }; + var entry3 = new SCMapEntry + { + Key = new SCUint32(1), + Value = new SCSymbol("$$$") + }; + var nestedScMap = new SCMap + { + Entries = new[] { entry1, entry2 } + }; + var entry4 = new SCMapEntry + { + Key = new SCUint32(1), + Value = nestedScMap + }; + + var mapEntries = new[] { entry1, entry2, entry3, entry3, entry4 }; + var scMap = new SCMap { Entries = mapEntries }; + + // Act + var scMapXdrBase64 = scMap.ToXdrBase64(); + var fromXdrBase64ScMap = (SCMap)SCVal.FromXdrBase64(scMapXdrBase64); + + // Assert + Assert.AreEqual(scMap.Entries.Length, fromXdrBase64ScMap.Entries.Length); + for (var i = 0; i < scMap.Entries.Length; i++) + { + Assert.AreEqual(scMap.Entries[i].Key.ToXdrBase64(), fromXdrBase64ScMap.Entries[i].Key.ToXdrBase64()); + Assert.AreEqual(scMap.Entries[i].Value.ToXdrBase64(), fromXdrBase64ScMap.Entries[i].Value.ToXdrBase64()); + } + } + + [TestMethod] + public void TestScMapWithNoEntries() + { + var scMap = new SCMap(); + + // Act + var scMapXdrBase64 = scMap.ToXdrBase64(); + var fromXdrBase64ScMap = (SCMap)SCVal.FromXdrBase64(scMapXdrBase64); + + // Assert + Assert.AreEqual(0, fromXdrBase64ScMap.Entries.Length); + } + + [TestMethod] + public void TestSCContractExecutableWasmWithMissingStorage() + { + var contractExecutable = new ContractExecutableWasm(WasmHash); + + var contractInstance = new SCContractInstance + { + Executable = contractExecutable + }; + + // Act + var contractInstanceXdrBase64 = contractInstance.ToXdrBase64(); + var fromXdrBase64ContractInstance = (SCContractInstance)SCVal.FromXdrBase64(contractInstanceXdrBase64); + + var decodedContractExecutable = (ContractExecutableWasm)fromXdrBase64ContractInstance.Executable; + + // Assert + Assert.AreEqual(contractExecutable.WasmHash, decodedContractExecutable.WasmHash); + Assert.AreEqual(contractInstance.Storage.Entries.Length, fromXdrBase64ContractInstance.Storage.Entries.Length); + } + + /// + /// + /// It's not necessary to check each of the entries element Key and Value for type and properties, + /// since there are already other tests in the class that cover different scenarios for + /// + /// + [TestMethod] + public void TestSCContractExecutableWasm() + { + var contractExecutable = new ContractExecutableWasm(WasmHash); + + var entry1 = new SCMapEntry + { + Key = new SCString("key 1"), + Value = new SCBool(false) + }; + var entry2 = new SCMapEntry + { + Key = new SCUint32(111), + Value = new SCString("2nd value") + }; + var entry3 = new SCMapEntry + { + Key = new SCUint32(1), + Value = new SCSymbol("&") + }; + + SCMapEntry[] mapEntries = { entry1, entry2, entry3 }; + var scMap = new SCMap { Entries = mapEntries }; + + var contractInstance = new SCContractInstance + { + Executable = contractExecutable, + Storage = scMap + }; + + // Act + var contractInstanceXdrBase64 = contractInstance.ToXdrBase64(); + var fromXdrBase64ContractInstance = (SCContractInstance)SCVal.FromXdrBase64(contractInstanceXdrBase64); + + var decodedContractExecutable = (ContractExecutableWasm)fromXdrBase64ContractInstance.Executable; + + var entries = contractInstance.Storage.Entries; + var decodedEntries = fromXdrBase64ContractInstance.Storage.Entries; + + // Assert + Assert.AreEqual(contractExecutable.WasmHash, decodedContractExecutable.WasmHash); + Assert.AreEqual(entries.Length, decodedEntries.Length); + for (var i = 0; i < entries.Length; i++) + { + Assert.AreEqual(entries[i].Key.ToXdrBase64(), decodedEntries[i].Key.ToXdrBase64()); + Assert.AreEqual(entries[i].Value.ToXdrBase64(), decodedEntries[i].Value.ToXdrBase64()); + } + } + + [TestMethod] + public void TestSCContractExecutableStellarAssetWithMissingStorage() + { + var contractInstance = new SCContractInstance + { + Executable = new ContractExecutableStellarAsset() + }; + + var contractInstanceXdrBase64 = contractInstance.ToXdrBase64(); + var fromXdrBase64ContractInstance = (SCContractInstance)SCVal.FromXdrBase64(contractInstanceXdrBase64); + + Assert.AreEqual(0, fromXdrBase64ContractInstance.Storage.Entries.Length); + // Nothing else to compare, as the XDR ContractExecutable of type CONTRACT_EXECUTABLE_STELLAR_ASSET doesn't have any property + } + + /// + /// + /// It's not necessary to check each of the entries element Key and Value for type and properties, + /// since there are already other tests in the class that cover different scenarios for + /// + /// + [TestMethod] + public void TestSCContractExecutableStellarAsset() + { + var entry1 = new SCMapEntry + { + Key = new SCString("key 1"), + Value = new SCBool(false) + }; + var entry2 = new SCMapEntry + { + Key = new SCUint32(111), + Value = new SCString("2nd value") + }; + var entry3 = new SCMapEntry + { + Key = new SCUint32(1), + Value = new SCSymbol("&") + }; + + SCMapEntry[] mapEntries = { entry1, entry2, entry3 }; + var scMap = new SCMap { Entries = mapEntries }; + + var contractInstance = new SCContractInstance + { + Executable = new ContractExecutableStellarAsset(), + Storage = scMap + }; + + var contractInstanceXdrBase64 = contractInstance.ToXdrBase64(); + var fromXdrBase64ContractInstance = (SCContractInstance)SCVal.FromXdrBase64(contractInstanceXdrBase64); + + var entries = contractInstance.Storage.Entries; + var decodedEntries = fromXdrBase64ContractInstance.Storage.Entries; + + Assert.AreEqual(entries.Length, decodedEntries.Length); + for (var i = 0; i < entries.Length; i++) + { + Assert.AreEqual(entries[i].Key.ToXdrBase64(), decodedEntries[i].Key.ToXdrBase64()); + Assert.AreEqual(entries[i].Value.ToXdrBase64(), decodedEntries[i].Value.ToXdrBase64()); + } + } + + [TestMethod] + public void TestScNonceKey() + { + var scNonceKey = new SCNonceKey(-9223372036854775807); + + // Act + var scNonceKeyXdrBase64 = scNonceKey.ToXdrBase64(); + var fromXdrBase64ScNonceKey = (SCNonceKey)SCVal.FromXdrBase64(scNonceKeyXdrBase64); + + // Assert + Assert.AreEqual(scNonceKey.Nonce, fromXdrBase64ScNonceKey.Nonce); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-test/SorobanAuthorizationTest.cs b/stellar-dotnet-sdk-test/SorobanAuthorizationTest.cs new file mode 100644 index 00000000..9a423ce7 --- /dev/null +++ b/stellar-dotnet-sdk-test/SorobanAuthorizationTest.cs @@ -0,0 +1,298 @@ +using System; +using System.Security.Cryptography; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using stellar_dotnet_sdk; +using SCAddress = stellar_dotnet_sdk.SCAddress; +using SCString = stellar_dotnet_sdk.SCString; +using InitSorobanAddressCredentials = stellar_dotnet_sdk.SorobanAddressCredentials; +using SorobanAuthorizationEntry = stellar_dotnet_sdk.SorobanAuthorizationEntry; +using SorobanAuthorizedInvocation = stellar_dotnet_sdk.SorobanAuthorizedInvocation; +using SorobanCredentials = stellar_dotnet_sdk.SorobanCredentials; +using xdrSDK = stellar_dotnet_sdk.xdr; +using ContractExecutable = stellar_dotnet_sdk.ContractExecutable; + +namespace stellar_dotnet_sdk_test; + +[TestClass] +public class SorobanAuthorizationTest +{ + private const long Nonce = -9223372036854775807; + private const uint SignatureExpirationLedger = 1319013123; + + private readonly SCAddress _accountAddress = + new SCAccountId("GAEBBKKHGCAD53X244CFGTVEKG7LWUQOAEW4STFHMGYHHFS5WOQZZTMP"); + + private readonly ContractExecutable _contractExecutableWasm = + new ContractExecutableWasm("ZBYoEJT3IaPMMk3FoRmnEQHoDxewPZL+Uor+xWI4uII="); + + private readonly SCString _signature = new("Signature"); + + private SorobanAddressCredentials InitSorobanAddressCredentials() + { + return new SorobanAddressCredentials + { + Address = _accountAddress, + Nonce = Nonce, + SignatureExpirationLedger = SignatureExpirationLedger, + Signature = _signature + }; + } + + private ContractIDAddressPreimage InitContractIDAddressPreimage() + { + var random32Bytes = new byte[32]; + RandomNumberGenerator.Create().GetBytes(random32Bytes); + + return new ContractIDAddressPreimage + { + Address = _accountAddress, + Salt = new xdrSDK.Uint256(random32Bytes) + }; + } + + [TestMethod] + public void TestSorobanAddressCredentialsWithValidCredentials() + { + var sorobanCredentials = InitSorobanAddressCredentials(); + + // Act + var credentialsXdrBase64 = sorobanCredentials.ToXdrBase64(); + var decodedCredentials = (InitSorobanAddressCredentials)SorobanCredentials.FromXdrBase64(credentialsXdrBase64); + + // Assert + Assert.AreEqual(((SCAccountId)sorobanCredentials.Address).InnerValue, + ((SCAccountId)decodedCredentials.Address).InnerValue); + Assert.AreEqual(sorobanCredentials.Nonce, decodedCredentials.Nonce); + Assert.AreEqual(((SCString)sorobanCredentials.Signature).InnerValue, + ((SCString)decodedCredentials.Signature).InnerValue); + Assert.AreEqual(sorobanCredentials.SignatureExpirationLedger, decodedCredentials.SignatureExpirationLedger); + } + + [TestMethod] + public void TestSorobanAddressCredentialsWithMissingAddress() + { + var sorobanCredentials = InitSorobanAddressCredentials(); + sorobanCredentials.Address = null; + + var ex = Assert.ThrowsException(() => sorobanCredentials.ToXdrBase64()); + Assert.AreEqual("Address cannot be null", ex.Message); + } + + [TestMethod] + public void TestSorobanAddressCredentialsWithAddressBeingAContractAddress() + { + var contractAddress = new SCContractId("CAC2UYJQMC4ISUZ5REYB2AMDC44YKBNZWG4JB6N6GBL66CEKQO3RDSAB"); + var sorobanCredentials = InitSorobanAddressCredentials(); + sorobanCredentials.Address = contractAddress; + + // Act + var credentialsXdrBase64 = sorobanCredentials.ToXdrBase64(); + var decodedCredentials = (InitSorobanAddressCredentials)SorobanCredentials.FromXdrBase64(credentialsXdrBase64); + + // Assert + Assert.AreEqual(contractAddress.InnerValue, ((SCContractId)decodedCredentials.Address).InnerValue); + Assert.AreEqual(sorobanCredentials.Nonce, decodedCredentials.Nonce); + Assert.AreEqual(((SCString)sorobanCredentials.Signature).InnerValue, + ((SCString)decodedCredentials.Signature).InnerValue); + Assert.AreEqual(sorobanCredentials.SignatureExpirationLedger, decodedCredentials.SignatureExpirationLedger); + } + + [TestMethod] + public void TestSorobanAddressCredentialsWithMissingSignature() + { + var sorobanCredentials = InitSorobanAddressCredentials(); + sorobanCredentials.Signature = null; + + var ex = Assert.ThrowsException(() => sorobanCredentials.ToXdrBase64()); + Assert.AreEqual("Signature cannot be null", ex.Message); + } + + [TestMethod] + public void TestSorobanAddressCredentialsWithZeroSignatureExpirationLedger() + { + var sorobanCredentials = InitSorobanAddressCredentials(); + sorobanCredentials.SignatureExpirationLedger = 0; + + // Act + var credentialsXdrBase64 = sorobanCredentials.ToXdrBase64(); + var decodedCredentials = (InitSorobanAddressCredentials)SorobanCredentials.FromXdrBase64(credentialsXdrBase64); + + // Assert + Assert.AreEqual(((SCAccountId)sorobanCredentials.Address).InnerValue, + ((SCAccountId)decodedCredentials.Address).InnerValue); + Assert.AreEqual(sorobanCredentials.Nonce, decodedCredentials.Nonce); + Assert.AreEqual(((SCString)sorobanCredentials.Signature).InnerValue, + ((SCString)decodedCredentials.Signature).InnerValue); + Assert.AreEqual(sorobanCredentials.SignatureExpirationLedger, decodedCredentials.SignatureExpirationLedger); + } + + [TestMethod] + public void TestSorobanAddressCredentialsWithZeroNonce() + { + var sorobanCredentials = InitSorobanAddressCredentials(); + sorobanCredentials.Nonce = 0; + // Act + var credentialsXdrBase64 = sorobanCredentials.ToXdrBase64(); + var decodedCredentials = (InitSorobanAddressCredentials)SorobanCredentials.FromXdrBase64(credentialsXdrBase64); + + // Assert + Assert.AreEqual(((SCAccountId)sorobanCredentials.Address).InnerValue, + ((SCAccountId)decodedCredentials.Address).InnerValue); + Assert.AreEqual(sorobanCredentials.Nonce, decodedCredentials.Nonce); + Assert.AreEqual(((SCString)sorobanCredentials.Signature).InnerValue, + ((SCString)decodedCredentials.Signature).InnerValue); + Assert.AreEqual(sorobanCredentials.SignatureExpirationLedger, decodedCredentials.SignatureExpirationLedger); + } + + /// + /// + /// It's not necessary to check for the authEntry.Credentials type and properties, + /// since there are already other tests in the class that cover different + /// scenarios + /// for + /// + [TestMethod] + public void TestSorobanAuthorizationEntryWithEmptySubInvocations() + { + var rootInvocation = new SorobanAuthorizedInvocation + { + Function = new SorobanAuthorizedCreateContractFunction + { + HostFunction = + new CreateContractHostFunction(InitContractIDAddressPreimage(), _contractExecutableWasm) + }, + SubInvocations = Array.Empty() + }; + + var authEntry = new SorobanAuthorizationEntry + { + RootInvocation = rootInvocation, + Credentials = InitSorobanAddressCredentials() + }; + + var authEntryXdrBase64 = authEntry.ToXdrBase64(); + var decodedAuthEntry = SorobanAuthorizationEntry.FromXdrBase64(authEntryXdrBase64); + + TestEqualInvocations(authEntry.RootInvocation, decodedAuthEntry.RootInvocation); + + Assert.AreEqual(authEntry.Credentials.ToXdrBase64(), decodedAuthEntry.Credentials.ToXdrBase64()); + } + + /// + /// + /// It's not necessary to check for the authEntry.Credentials type and properties, + /// since there are already other tests in the class that cover different + /// scenarios + /// for + /// + [TestMethod] + public void TestSorobanAuthorizationEntryContainingAuthorizedCreateContractFunction() + { + var authorizedCreateContractFn = new SorobanAuthorizedCreateContractFunction + { + HostFunction = new CreateContractHostFunction(InitContractIDAddressPreimage(), _contractExecutableWasm) + }; + + var rootInvocation = new SorobanAuthorizedInvocation + { + Function = authorizedCreateContractFn, + SubInvocations = new SorobanAuthorizedInvocation[] + { + new() + { + Function = authorizedCreateContractFn, + SubInvocations = Array.Empty() + } + } + }; + + var authEntry = new SorobanAuthorizationEntry + { + RootInvocation = rootInvocation, + Credentials = InitSorobanAddressCredentials() + }; + + var authEntryXdrBase64 = authEntry.ToXdrBase64(); + var decodedAuthEntry = SorobanAuthorizationEntry.FromXdrBase64(authEntryXdrBase64); + + TestEqualInvocations(authEntry.RootInvocation, decodedAuthEntry.RootInvocation); + + Assert.AreEqual(authEntry.Credentials.ToXdrBase64(), decodedAuthEntry.Credentials.ToXdrBase64()); + } + + /// + /// + /// It's not necessary to check for the authEntry.Credentials type and properties, + /// since there are already other tests in the class that cover different + /// scenarios + /// for + /// + [TestMethod] + public void TestSorobanAuthorizationEntryContainingAuthorizedContractFunction() + { + var contractAddress = new SCContractId("CDJ4RICANSXXZ275W2OY2U7RO73HYURBGBRHVW2UUXZNGEBIVBNRKEF7"); + var authorizedContractFn = new SorobanAuthorizedContractFunction + { + HostFunction = new InvokeContractHostFunction(contractAddress, new SCSymbol("hello"), + new SCVal[] { new SCBool(false), new SCString("world") }) + }; + + var rootInvocation = new SorobanAuthorizedInvocation + { + Function = authorizedContractFn, + SubInvocations = new SorobanAuthorizedInvocation[] + { + new() + { + Function = authorizedContractFn, + SubInvocations = Array.Empty() + } + } + }; + + var authEntry = new SorobanAuthorizationEntry + { + RootInvocation = rootInvocation, + Credentials = InitSorobanAddressCredentials() + }; + + var authEntryXdrBase64 = authEntry.ToXdrBase64(); + var decodedAuthEntry = SorobanAuthorizationEntry.FromXdrBase64(authEntryXdrBase64); + + TestEqualInvocations(authEntry.RootInvocation, decodedAuthEntry.RootInvocation); + + Assert.AreEqual(authEntry.Credentials.ToXdrBase64(), decodedAuthEntry.Credentials.ToXdrBase64()); + } + + /// + /// + /// It's not necessary to check for the HostFunction type and properties, + /// since there are already other tests in the class that + /// cover different scenarios + /// for + /// + private void TestEqualInvocations(SorobanAuthorizedInvocation expected, SorobanAuthorizedInvocation actual) + { + Assert.AreEqual(expected.Function.GetType(), actual.Function.GetType()); + switch (expected.Function) + { + case SorobanAuthorizedContractFunction expectedContractFn: + var expectedContractHostFunction = expectedContractFn.HostFunction; + var actualContractHostFunction = ((SorobanAuthorizedContractFunction)actual.Function).HostFunction; + Assert.AreEqual(expectedContractHostFunction.ToXdrBase64(), + actualContractHostFunction.ToXdrBase64()); + break; + case SorobanAuthorizedCreateContractFunction expectedCreateContractFn: + var expectedCreateContractHostFunction = expectedCreateContractFn.HostFunction; + var actualCreateContractHostFunction = + ((SorobanAuthorizedCreateContractFunction)actual.Function).HostFunction; + Assert.AreEqual(expectedCreateContractHostFunction.ToXdrBase64(), + actualCreateContractHostFunction.ToXdrBase64()); + break; + } + + Assert.AreEqual(expected.SubInvocations.Length, actual.SubInvocations.Length); + for (var i = 0; i < expected.SubInvocations.Length; i++) + TestEqualInvocations(expected.SubInvocations[0], actual.SubInvocations[0]); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-test/operations/FootprintOperationTest.cs b/stellar-dotnet-sdk-test/operations/FootprintOperationTest.cs new file mode 100644 index 00000000..345c9f8a --- /dev/null +++ b/stellar-dotnet-sdk-test/operations/FootprintOperationTest.cs @@ -0,0 +1,131 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using stellar_dotnet_sdk; + +namespace stellar_dotnet_sdk_test.operations; + +[TestClass] +public class FootprintOperationTest +{ + private readonly KeyPair _sourceAccount = + KeyPair.FromSecretSeed("SC4CGETADVYTCR5HEAVZRB3DZQY5Y4J7RFNJTRA6ESMHIPEZUSTE2QDK"); + + [TestMethod] + public void TestExtendFootprintOperationWithMissingExtensionPoint() + { + var extendTo = 10000U; + var builder = new ExtendFootprintOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetExtendTo(extendTo); + + var ex = Assert.ThrowsException(() => builder.Build()); + Assert.AreEqual("Extension point cannot be null", ex.Message); + } + + [TestMethod] + public void TestExtendFootprintOperationWithMissingExtendTo() + { + var zeroExt = new ExtensionPointZero(); + var builder = new ExtendFootprintOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetExtensionPoint(zeroExt); + + var ex = Assert.ThrowsException(() => builder.Build()); + Assert.AreEqual("Extend to cannot be null", ex.Message); + } + + [TestMethod] + public void TestExtendFootprintOperationWithMissingSourceAccount() + { + var zeroExt = new ExtensionPointZero(); + var extendTo = 10000U; + var builder = new ExtendFootprintOperation.Builder(); + builder.SetExtendTo(extendTo); + builder.SetExtensionPoint(zeroExt); + + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = ExtendFootprintOperation.FromOperationXdrBase64(operationXdrBase64); + + // Assert + Assert.AreEqual(operation.ExtendTo, decodedOperation.ExtendTo); + Assert.AreEqual(operation.ExtensionPoint.ToXdrBase64(), decodedOperation.ExtensionPoint.ToXdrBase64()); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } + + [TestMethod] + public void TestExtendFootprintOperationWithValidConfiguration() + { + var zeroExt = new ExtensionPointZero(); + var extendTo = 10000U; + var builder = new ExtendFootprintOperation.Builder(); + builder.SetExtendTo(extendTo); + builder.SetExtensionPoint(zeroExt); + builder.SetSourceAccount(_sourceAccount); + + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = ExtendFootprintOperation.FromOperationXdrBase64(operationXdrBase64); + + // Assert + Assert.AreEqual(operation.ExtendTo, decodedOperation.ExtendTo); + Assert.AreEqual(operation.ExtensionPoint.ToXdrBase64(), decodedOperation.ExtensionPoint.ToXdrBase64()); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } + + [TestMethod] + public void TestRestoreFootprintOperationWithMissingExtensionPoint() + { + var builder = new RestoreFootprintOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + + var ex = Assert.ThrowsException(() => builder.Build()); + Assert.AreEqual("Extension point cannot be null", ex.Message); + } + + [TestMethod] + public void TestRestoreFootprintOperationWithMissingSourceAccount() + { + var zeroExt = new ExtensionPointZero(); + var builder = new RestoreFootprintOperation.Builder(); + builder.SetExtensionPoint(zeroExt); + + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = RestoreFootprintOperation.FromOperationXdrBase64(operationXdrBase64); + + // Assert + Assert.AreEqual(operation.ExtensionPoint.ToXdrBase64(), decodedOperation.ExtensionPoint.ToXdrBase64()); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } + + [TestMethod] + public void TestRestoreFootprintOperationWithValidConfiguration() + { + var zeroExt = new ExtensionPointZero(); + var builder = new RestoreFootprintOperation.Builder(); + builder.SetExtensionPoint(zeroExt); + builder.SetSourceAccount(_sourceAccount); + + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = RestoreFootprintOperation.FromOperationXdrBase64(operationXdrBase64); + + // Assert + // ExtensionPoint has no properties + Assert.AreEqual(operation.ExtensionPoint.ToXdrBase64(), decodedOperation.ExtensionPoint.ToXdrBase64()); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-test/operations/InvokeHostFunctionOperationTest.cs b/stellar-dotnet-sdk-test/operations/InvokeHostFunctionOperationTest.cs new file mode 100644 index 00000000..d79e9683 --- /dev/null +++ b/stellar-dotnet-sdk-test/operations/InvokeHostFunctionOperationTest.cs @@ -0,0 +1,453 @@ +using System; +using System.Security.Cryptography; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using stellar_dotnet_sdk; +using xdrSDK = stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk_test.operations; + +[TestClass] +public class InvokeHostFunctionOperationTest +{ + private const string WasmHash = "ZBYoEJT3IaPMMk3FoRmnEQHoDxewPZL+Uor+xWI4uII="; + private const long Nonce = -9223372036854775807; + private const uint SignatureExpirationLedger = 1319013123; + + private readonly SCAddress _accountAddress = + new SCAccountId("GAEBBKKHGCAD53X244CFGTVEKG7LWUQOAEW4STFHMGYHHFS5WOQZZTMP"); + + private readonly SCVal[] _args = { new SCString("world"), new SCBytes(new byte[] { 0x00, 0x01, 0x02 }) }; + + private readonly SCAddress _contractAddress = + new SCContractId("CDJ4RICANSXXZ275W2OY2U7RO73HYURBGBRHVW2UUXZNGEBIVBNRKEF7"); + + private readonly SCSymbol _functionName = new("hello"); + private readonly SCString _signature = new("Signature"); + + private readonly KeyPair _sourceAccount = + KeyPair.FromSecretSeed("SC4CGETADVYTCR5HEAVZRB3DZQY5Y4J7RFNJTRA6ESMHIPEZUSTE2QDK"); + + private SorobanAddressCredentials InitSorobanAddressCredentials() + { + return new SorobanAddressCredentials + { + Address = _accountAddress, + Nonce = Nonce, + SignatureExpirationLedger = SignatureExpirationLedger, + Signature = _signature + }; + } + + private SorobanAuthorizationEntry InitAuthEntry() + { + var authorizedContractFn = new SorobanAuthorizedContractFunction + { + HostFunction = new InvokeContractHostFunction(_contractAddress, _functionName, _args) + }; + + var rootInvocation = new SorobanAuthorizedInvocation + { + Function = authorizedContractFn, + SubInvocations = new SorobanAuthorizedInvocation[] + { + new() + { + Function = authorizedContractFn, + SubInvocations = Array.Empty() + } + } + }; + + return new SorobanAuthorizationEntry + { + RootInvocation = rootInvocation, + Credentials = InitSorobanAddressCredentials() + }; + } + + [TestMethod] + public void TestCreateContractOperationWithMissingSourceAccount() + { + var contractExecutableWasm = new ContractExecutableWasm(WasmHash); + var random32Bytes = new byte[32]; + RandomNumberGenerator.Create().GetBytes(random32Bytes); + var contractIdAddressPreimage = new ContractIDAddressPreimage + { + Address = _accountAddress, + Salt = new xdrSDK.Uint256(random32Bytes) + }; + var builder = new CreateContractOperation.Builder(); + builder.SetContractIDPreimage(contractIdAddressPreimage); + builder.SetExecutable(contractExecutableWasm); + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + var decodedOperation = CreateContractOperation.FromOperationXdrBase64(operationXdrBase64); + + var contractIdPreimage = (ContractIDAddressPreimage)operation.HostFunction.ContractIDPreimage; + var decodedContractIdPreimage = (ContractIDAddressPreimage)decodedOperation.HostFunction.ContractIDPreimage; + + var address = (SCAccountId)contractIdPreimage.Address; + var decodedAddress = (SCAccountId)decodedContractIdPreimage.Address; + + var contractExecutable = (ContractExecutableWasm)operation.HostFunction.Executable; + var decodedContractExecutable = (ContractExecutableWasm)decodedOperation.HostFunction.Executable; + + // Assert + Assert.AreEqual(address.InnerValue, decodedAddress.InnerValue); + CollectionAssert.AreEqual(contractIdPreimage.Salt.InnerValue, decodedContractIdPreimage.Salt.InnerValue); + Assert.AreEqual(contractExecutable.WasmHash, decodedContractExecutable.WasmHash); + Assert.IsTrue(operation.Auth.Length == 0); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } + + [TestMethod] + public void TestCreateContractOperationWithMissingPreimage() + { + var contractExecutableWasm = new ContractExecutableWasm(WasmHash); + var builder = new CreateContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetExecutable(contractExecutableWasm); + var ex = Assert.ThrowsException(() => builder.Build()); + Assert.AreEqual("Contract ID preimage cannot be null", ex.Message); + } + + [TestMethod] + public void TestCreateContractOperationWithMissingExecutable() + { + var random32Bytes = new byte[32]; + RandomNumberGenerator.Create().GetBytes(random32Bytes); + var contractIdAddressPreimage = new ContractIDAddressPreimage + { + Address = _accountAddress, + Salt = new xdrSDK.Uint256(random32Bytes) + }; + var builder = new CreateContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetContractIDPreimage(contractIdAddressPreimage); + var ex = Assert.ThrowsException(() => builder.Build()); + Assert.AreEqual("Executable cannot be null", ex.Message); + } + + [TestMethod] + public void TestCreateContractOperationFromAddressWithMissingAuthorizationEntry() + { + var contractExecutableWasm = new ContractExecutableWasm(WasmHash); + var random32Bytes = new byte[32]; + RandomNumberGenerator.Create().GetBytes(random32Bytes); + var contractIdAddressPreimage = new ContractIDAddressPreimage + { + Address = _accountAddress, + Salt = new xdrSDK.Uint256(random32Bytes) + }; + var builder = new CreateContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetExecutable(contractExecutableWasm); + builder.SetContractIDPreimage(contractIdAddressPreimage); + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = CreateContractOperation.FromOperationXdrBase64(operationXdrBase64); + + var contractIdPreimage = (ContractIDAddressPreimage)operation.HostFunction.ContractIDPreimage; + var decodedContractIdPreimage = (ContractIDAddressPreimage)decodedOperation.HostFunction.ContractIDPreimage; + + var address = (SCAccountId)contractIdPreimage.Address; + var decodedAddress = (SCAccountId)decodedContractIdPreimage.Address; + + var contractExecutable = (ContractExecutableWasm)operation.HostFunction.Executable; + var decodedContractExecutable = (ContractExecutableWasm)decodedOperation.HostFunction.Executable; + + // Assert + Assert.AreEqual(address.InnerValue, decodedAddress.InnerValue); + CollectionAssert.AreEqual(contractIdPreimage.Salt.InnerValue, decodedContractIdPreimage.Salt.InnerValue); + Assert.AreEqual(contractExecutable.WasmHash, decodedContractExecutable.WasmHash); + Assert.AreEqual(operation.Auth.Length, decodedOperation.Auth.Length); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } + + /// + /// + /// It's not necessary to check each of the operation.Auth element for the type and properties, + /// since there is already the dedicated test class for + /// + /// + [TestMethod] + public void TestCreateContractOperationFromAddressWithValidArguments() + { + var contractExecutableWasm = new ContractExecutableWasm(WasmHash); + var random32Bytes = new byte[32]; + RandomNumberGenerator.Create().GetBytes(random32Bytes); + var contractIdAddressPreimage = new ContractIDAddressPreimage + { + Address = _accountAddress, + Salt = new xdrSDK.Uint256(random32Bytes) + }; + var builder = new CreateContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetExecutable(contractExecutableWasm); + builder.SetContractIDPreimage(contractIdAddressPreimage); + builder.SetAuth(new[] { InitAuthEntry() }); + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = CreateContractOperation.FromOperationXdrBase64(operationXdrBase64); + + var contractIdPreimage = (ContractIDAddressPreimage)operation.HostFunction.ContractIDPreimage; + var decodedContractIdPreimage = (ContractIDAddressPreimage)decodedOperation.HostFunction.ContractIDPreimage; + + var address = (SCAccountId)contractIdPreimage.Address; + var decodedAddress = (SCAccountId)decodedContractIdPreimage.Address; + + var contractExecutable = (ContractExecutableWasm)operation.HostFunction.Executable; + var decodedContractExecutable = (ContractExecutableWasm)decodedOperation.HostFunction.Executable; + + // Assert + Assert.AreEqual(address.InnerValue, decodedAddress.InnerValue); + CollectionAssert.AreEqual(contractIdPreimage.Salt.InnerValue, decodedContractIdPreimage.Salt.InnerValue); + Assert.AreEqual(contractExecutable.WasmHash, decodedContractExecutable.WasmHash); + Assert.AreEqual(operation.Auth.Length, decodedOperation.Auth.Length); + for (var i = 0; i < operation.Auth.Length; i++) + Assert.AreEqual(operation.Auth[i].ToXdrBase64(), decodedOperation.Auth[i].ToXdrBase64()); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } + + [TestMethod] + public void TestCreateContractOperationWithStellarAssetExecutable() + { + var builder = new CreateContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetExecutable(new ContractExecutableStellarAsset()); + builder.SetContractIDPreimage(new ContractIDAssetPreimage + { + Asset = + new AssetTypeCreditAlphaNum4("VNDC", + "GAEBBKKHGCAD53X244CFGTVEKG7LWUQOAEW4STFHMGYHHFS5WOQZZTMP") + }); + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = CreateContractOperation.FromOperationXdrBase64(operationXdrBase64); + + var contractIdPreimage = (ContractIDAssetPreimage)operation.HostFunction.ContractIDPreimage; + var decodedContractIdPreimage = (ContractIDAssetPreimage)decodedOperation.HostFunction.ContractIDPreimage; + + var asset = (AssetTypeCreditAlphaNum4)contractIdPreimage.Asset; + var decodedAsset = (AssetTypeCreditAlphaNum4)decodedContractIdPreimage.Asset; + + // Assert + Assert.AreEqual(asset.Code, decodedAsset.Code); + Assert.AreEqual(asset.Issuer, decodedAsset.Issuer); + + Assert.IsTrue(operation.Auth.Length == 0); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } + + [TestMethod] + public void TestUploadContractOperationWithMissingWasm() + { + var builder = new UploadContractOperation.Builder(); + + var ex = Assert.ThrowsException(() => builder.Build()); + Assert.AreEqual("Wasm cannot be null", ex.Message); + } + + [TestMethod] + public void TestUploadContractOperationWithMissingSourceAccount() + { + byte[] wasm = { 0x00, 0x01, 0x02, 0x03, 0x34, 0x45, 0x66, 0x46 }; + + var builder = new UploadContractOperation.Builder(); + builder.SetWasm(wasm); + + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = UploadContractOperation.FromOperationXdrBase64(operationXdrBase64); + + // Assert + CollectionAssert.AreEqual(operation.HostFunction.Wasm, decodedOperation.HostFunction.Wasm); + Assert.AreEqual(operation.Auth.Length, decodedOperation.Auth.Length); + Assert.AreEqual(operation.SourceAccount?.AccountId, decodedOperation.SourceAccount?.AccountId); + } + + [TestMethod] + public void TestUploadContractOperationWithMissingAuthorizationEntry() + { + // Arrange + byte[] wasm = { 0x00, 0x01, 0x02, 0x03, 0x34, 0x45, 0x66, 0x46 }; + + var builder = new UploadContractOperation.Builder(); + builder.SetWasm(wasm); + builder.SetSourceAccount(_sourceAccount); + + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = UploadContractOperation.FromOperationXdrBase64(operationXdrBase64); + + // Assert + CollectionAssert.AreEqual(operation.HostFunction.Wasm, decodedOperation.HostFunction.Wasm); + Assert.AreEqual(operation.Auth.Length, decodedOperation.Auth.Length); + Assert.AreEqual(_sourceAccount.AccountId, decodedOperation.SourceAccount!.AccountId); + } + + /// + /// + /// It's not necessary to check each of the operation.Auth element for the type and properties, + /// since there is already the dedicated test class for + /// + /// + [TestMethod] + public void TestUploadContractOperationWithValidArguments() + { + // Arrange + byte[] wasm = { 0x00, 0x01, 0x02, 0x03, 0x34, 0x45, 0x66, 0x46 }; + + var builder = new UploadContractOperation.Builder(); + builder.SetWasm(wasm); + builder.SetSourceAccount(_sourceAccount); + var authEntry = InitAuthEntry(); + builder.AddAuth(authEntry); + builder.AddAuth(authEntry); + builder.RemoveAuth(authEntry); + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = UploadContractOperation.FromOperationXdrBase64(operationXdrBase64); + + // Assert + CollectionAssert.AreEqual(operation.HostFunction.Wasm, decodedOperation.HostFunction.Wasm); + Assert.AreEqual(operation.Auth.Length, decodedOperation.Auth.Length); + for (var i = 0; i < operation.Auth.Length; i++) + Assert.AreEqual(operation.Auth[i].ToXdrBase64(), decodedOperation.Auth[i].ToXdrBase64()); + Assert.AreEqual(_sourceAccount.AccountId, decodedOperation.SourceAccount!.AccountId); + } + + [TestMethod] + public void TestInvokeContractOperationWithMissingAddress() + { + var builder = new InvokeContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetFunctionName(_functionName); + builder.SetArgs(_args); + + var ex = Assert.ThrowsException(() => builder.Build()); + Assert.AreEqual("Contract address cannot be null", ex.Message); + } + + [TestMethod] + public void TestInvokeContractOperationWithMissingFunctionName() + { + var arg = new SCString("world"); + SCVal[] args = { arg }; + var builder = new InvokeContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetArgs(args); + builder.SetContractAddress(_contractAddress); + + var ex = Assert.ThrowsException(() => builder.Build()); + Assert.AreEqual("Function name cannot be null", ex.Message); + } + + /// + /// + /// It's not necessary to check each of the hostFunction.Args element for type and properties, + /// since there are already other tests in the class that cover different scenarios for + /// + /// + [TestMethod] + public void TestInvokeContractOperationWithMissingAuthorizationEntry() + { + var builder = new InvokeContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetFunctionName(_functionName); + builder.SetArgs(_args); + builder.SetContractAddress(_contractAddress); + + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = InvokeContractOperation.FromOperationXdrBase64(operationXdrBase64); + + var address = (SCContractId)operation.HostFunction.ContractAddress; + var decodedAddress = (SCContractId)decodedOperation.HostFunction.ContractAddress; + + var hostFunction = operation.HostFunction; + var decodedFunction = decodedOperation.HostFunction; + + // Assert + Assert.AreEqual(address.InnerValue, decodedAddress.InnerValue); + Assert.AreEqual(hostFunction.FunctionName.InnerValue, decodedFunction.FunctionName.InnerValue); + Assert.AreEqual(hostFunction.Args.Length, decodedFunction.Args.Length); + + for (var i = 0; i < hostFunction.Args.Length; i++) + Assert.AreEqual(hostFunction.Args[i].ToXdrBase64(), + decodedFunction.Args[i].ToXdrBase64()); + Assert.AreEqual(operation.Auth.Length, decodedOperation.Auth.Length); + + Assert.AreEqual(_sourceAccount.AccountId, decodedOperation.SourceAccount!.AccountId); + } + + /// + /// + /// It's not necessary to check each of the hostFunction.Args element for type and properties, + /// since there are already other tests in class that cover different scenarios for + /// + /// It's not necessary to check each of the operation.Auth element for the type and properties, + /// since there is already the dedicated test class for + /// + /// + [TestMethod] + public void TestInvokeContractOperationWithValidArguments() + { + var builder = new InvokeContractOperation.Builder(); + builder.SetSourceAccount(_sourceAccount); + builder.SetFunctionName(_functionName); + builder.SetArgs(_args); + builder.SetContractAddress(_contractAddress); + builder.AddAuth(InitAuthEntry()); + + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + + var decodedOperation = InvokeContractOperation.FromOperationXdrBase64(operationXdrBase64); + + var hostFunction = operation.HostFunction; + var decodedHostFunction = decodedOperation.HostFunction; + + // Assert + Assert.AreEqual( + ((SCContractId)_contractAddress).InnerValue, + ((SCContractId)decodedHostFunction.ContractAddress).InnerValue); + Assert.AreEqual(hostFunction.FunctionName.InnerValue, decodedHostFunction.FunctionName.InnerValue); + Assert.AreEqual(hostFunction.Args.Length, decodedHostFunction.Args.Length); + + for (var i = 0; i < hostFunction.Args.Length; i++) + Assert.AreEqual(hostFunction.Args[i].ToXdrBase64(), + decodedHostFunction.Args[i].ToXdrBase64()); + Assert.AreEqual(operation.Auth.Length, decodedOperation.Auth.Length); + + for (var i = 0; i < operation.Auth.Length; i++) + Assert.AreEqual(operation.Auth[i].ToXdrBase64(), decodedOperation.Auth[i].ToXdrBase64()); + + Assert.AreEqual(_sourceAccount.AccountId, decodedOperation.SourceAccount!.AccountId); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-test/operations/SetOptionsOperationTest.cs b/stellar-dotnet-sdk-test/operations/SetOptionsOperationTest.cs index a07318b3..b173cc7d 100644 --- a/stellar-dotnet-sdk-test/operations/SetOptionsOperationTest.cs +++ b/stellar-dotnet-sdk-test/operations/SetOptionsOperationTest.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using stellar_dotnet_sdk; using xdrSDK = stellar_dotnet_sdk.xdr; -using System; using System.Linq; using System.Text; @@ -44,22 +43,22 @@ public void TestSetOptionsOperation() .SetSourceAccount(source) .Build(); - var xdr = operation.ToXdr(); - var parsedOperation = (SetOptionsOperation)Operation.FromXdr(xdr); - - Assert.AreEqual(inflationDestination.AccountId, parsedOperation.InflationDestination.AccountId); - Assert.AreEqual(1U, parsedOperation.ClearFlags); - Assert.AreEqual(1U, parsedOperation.SetFlags); - Assert.AreEqual(1U, parsedOperation.MasterKeyWeight); - Assert.AreEqual(2U, parsedOperation.LowThreshold); - Assert.AreEqual(3U, parsedOperation.MediumThreshold); - Assert.AreEqual(4U, parsedOperation.HighThreshold); - Assert.AreEqual(homeDomain, parsedOperation.HomeDomain); - Assert.AreEqual(signer.Discriminant.InnerValue, parsedOperation.Signer.Discriminant.InnerValue); - Assert.AreEqual(signer.Ed25519.InnerValue, parsedOperation.Signer.Ed25519.InnerValue); - Assert.AreEqual(1U, parsedOperation.SignerWeight); - Assert.AreEqual(source.AccountId, parsedOperation.SourceAccount.AccountId); - Assert.AreEqual(OperationThreshold.High, parsedOperation.Threshold); + var operationXdrBase64 = operation.ToXdrBase64(); + var decodedOperation = SetOptionsOperation.FromOperationXdrBase64(operationXdrBase64); + + Assert.AreEqual(inflationDestination.AccountId, decodedOperation.InflationDestination.AccountId); + Assert.AreEqual(1U, decodedOperation.ClearFlags); + Assert.AreEqual(1U, decodedOperation.SetFlags); + Assert.AreEqual(1U, decodedOperation.MasterKeyWeight); + Assert.AreEqual(2U, decodedOperation.LowThreshold); + Assert.AreEqual(3U, decodedOperation.MediumThreshold); + Assert.AreEqual(4U, decodedOperation.HighThreshold); + Assert.AreEqual(homeDomain, decodedOperation.HomeDomain); + Assert.AreEqual(signer.Discriminant.InnerValue, decodedOperation.Signer.Discriminant.InnerValue); + CollectionAssert.AreEqual(signer.Ed25519.InnerValue, decodedOperation.Signer.Ed25519.InnerValue); + Assert.AreEqual(1U, decodedOperation.SignerWeight); + Assert.AreEqual(source.AccountId, decodedOperation.SourceAccount.AccountId); + Assert.AreEqual(OperationThreshold.High, decodedOperation.Threshold); Assert.AreEqual( "AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAUAAAABAAAAAO3gUmG83C+VCqO6FztuMtXJF/l7grZA7MjRzqdZ9W8QAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAIAAAABAAAAAwAAAAEAAAAEAAAAAQAAAAtzdGVsbGFyLm9yZwAAAAABAAAAAET+21WXwEtXRyxb/GBe1tc5V/WUzIOW4yJp+XQgNUUiAAAAAQ==", @@ -79,24 +78,24 @@ public void TestSetOptionsOperationSingleField() .SetSourceAccount(source) .Build(); - var xdr = operation.ToXdr(); - var parsedOperation = (SetOptionsOperation)Operation.FromXdr(xdr); - - Assert.AreEqual(null, parsedOperation.InflationDestination); - Assert.AreEqual(null, parsedOperation.ClearFlags); - Assert.AreEqual(null, parsedOperation.SetFlags); - Assert.AreEqual(null, parsedOperation.MasterKeyWeight); - Assert.AreEqual(null, parsedOperation.LowThreshold); - Assert.AreEqual(null, parsedOperation.MediumThreshold); - Assert.AreEqual(null, parsedOperation.HighThreshold); - Assert.AreEqual(homeDomain, parsedOperation.HomeDomain); - Assert.AreEqual(null, parsedOperation.Signer); - Assert.AreEqual(null, parsedOperation.SignerWeight); - Assert.AreEqual(source.AccountId, parsedOperation.SourceAccount.AccountId); + var operationXdrBase64 = operation.ToXdrBase64(); + var decodedOperation = SetOptionsOperation.FromOperationXdrBase64(operationXdrBase64); + + Assert.AreEqual(null, decodedOperation.InflationDestination); + Assert.AreEqual(null, decodedOperation.ClearFlags); + Assert.AreEqual(null, decodedOperation.SetFlags); + Assert.AreEqual(null, decodedOperation.MasterKeyWeight); + Assert.AreEqual(null, decodedOperation.LowThreshold); + Assert.AreEqual(null, decodedOperation.MediumThreshold); + Assert.AreEqual(null, decodedOperation.HighThreshold); + Assert.AreEqual(homeDomain, decodedOperation.HomeDomain); + Assert.AreEqual(null, decodedOperation.Signer); + Assert.AreEqual(null, decodedOperation.SignerWeight); + Assert.AreEqual(source.AccountId, decodedOperation.SourceAccount.AccountId); Assert.AreEqual( "AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAtzdGVsbGFyLm9yZwAAAAAA", - operation.ToXdrBase64()); + operationXdrBase64); } [TestMethod] @@ -113,24 +112,24 @@ public void TestSetOptionsOperationSignerSha256() .SetSourceAccount(source) .Build(); - var xdr = operation.ToXdr(); - var parsedOperation = (SetOptionsOperation)Operation.FromXdr(xdr); - - Assert.AreEqual(null, parsedOperation.InflationDestination); - Assert.AreEqual(null, parsedOperation.ClearFlags); - Assert.AreEqual(null, parsedOperation.SetFlags); - Assert.AreEqual(null, parsedOperation.MasterKeyWeight); - Assert.AreEqual(null, parsedOperation.LowThreshold); - Assert.AreEqual(null, parsedOperation.MediumThreshold); - Assert.AreEqual(null, parsedOperation.HighThreshold); - Assert.AreEqual(null, parsedOperation.HomeDomain); - Assert.IsTrue(hash.SequenceEqual(parsedOperation.Signer.HashX.InnerValue)); - Assert.AreEqual(10U, parsedOperation.SignerWeight); - Assert.AreEqual(source.AccountId, parsedOperation.SourceAccount.AccountId); + var operationXdrBase64 = operation.ToXdrBase64(); + var decodedOperation = SetOptionsOperation.FromOperationXdrBase64(operationXdrBase64); + + Assert.AreEqual(null, decodedOperation.InflationDestination); + Assert.AreEqual(null, decodedOperation.ClearFlags); + Assert.AreEqual(null, decodedOperation.SetFlags); + Assert.AreEqual(null, decodedOperation.MasterKeyWeight); + Assert.AreEqual(null, decodedOperation.LowThreshold); + Assert.AreEqual(null, decodedOperation.MediumThreshold); + Assert.AreEqual(null, decodedOperation.HighThreshold); + Assert.AreEqual(null, decodedOperation.HomeDomain); + Assert.IsTrue(hash.SequenceEqual(decodedOperation.Signer.HashX.InnerValue)); + Assert.AreEqual(10U, decodedOperation.SignerWeight); + Assert.AreEqual(source.AccountId, decodedOperation.SourceAccount.AccountId); Assert.AreEqual( "AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAACbpRqMkaQAfCYSk/n3xIl4fCoHfKqxF34ht2iuvSYEJQAAAAK", - operation.ToXdrBase64()); + operationXdrBase64); } [TestMethod] @@ -157,50 +156,53 @@ public void TestSetOptionsOperationPreAuthTxSigner() .SetSourceAccount(opSource) .Build(); - var xdr = operation.ToXdr(); - var parsedOperation = (SetOptionsOperation)Operation.FromXdr(xdr); - - Assert.AreEqual(operation.InflationDestination, parsedOperation.InflationDestination); - Assert.AreEqual(operation.ClearFlags, parsedOperation.ClearFlags); - Assert.AreEqual(operation.SetFlags, parsedOperation.SetFlags); - Assert.AreEqual(operation.MasterKeyWeight, parsedOperation.MasterKeyWeight); - Assert.AreEqual(operation.LowThreshold, parsedOperation.LowThreshold); - Assert.AreEqual(operation.MediumThreshold, parsedOperation.MediumThreshold); - Assert.AreEqual(operation.HighThreshold, parsedOperation.HighThreshold); - Assert.AreEqual(operation.HomeDomain, parsedOperation.HomeDomain); - Assert.IsTrue(transaction.Hash().SequenceEqual(parsedOperation.Signer.PreAuthTx.InnerValue)); - Assert.AreEqual(operation.SignerWeight, parsedOperation.SignerWeight); - Assert.AreEqual(operation.SourceAccount.AccountId, parsedOperation.SourceAccount.AccountId); + var operationXdrBase64 = operation.ToXdrBase64(); + var decodedOperation = SetOptionsOperation.FromOperationXdrBase64(operationXdrBase64); + + Assert.AreEqual(operation.InflationDestination, decodedOperation.InflationDestination); + Assert.AreEqual(operation.ClearFlags, decodedOperation.ClearFlags); + Assert.AreEqual(operation.SetFlags, decodedOperation.SetFlags); + Assert.AreEqual(operation.MasterKeyWeight, decodedOperation.MasterKeyWeight); + Assert.AreEqual(operation.LowThreshold, decodedOperation.LowThreshold); + Assert.AreEqual(operation.MediumThreshold, decodedOperation.MediumThreshold); + Assert.AreEqual(operation.HighThreshold, decodedOperation.HighThreshold); + Assert.AreEqual(operation.HomeDomain, decodedOperation.HomeDomain); + Assert.IsTrue(transaction.Hash().SequenceEqual(decodedOperation.Signer.PreAuthTx.InnerValue)); + Assert.AreEqual(operation.SignerWeight, decodedOperation.SignerWeight); + Assert.AreEqual(operation.SourceAccount.AccountId, decodedOperation.SourceAccount.AccountId); } [TestMethod] public void TestPayloadSignerKey() { - SetOptionsOperation.Builder builder = new SetOptionsOperation.Builder(); - String payloadSignerStrKey = "GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ"; + // Arrange + const string payloadSignerStrKey = "GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ"; + + var builder = new SetOptionsOperation.Builder(); - byte[] payload = Util.HexToBytes("0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20"); - SignedPayloadSigner signedPayloadSigner = new SignedPayloadSigner(StrKey.DecodeStellarAccountId(payloadSignerStrKey), payload); - xdrSDK.SignerKey signerKey = Signer.SignedPayload(signedPayloadSigner); + var payload = Util.HexToBytes("0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20"); + var signedPayloadSigner = new SignedPayloadSigner(StrKey.DecodeStellarAccountId(payloadSignerStrKey), payload); + var signerKey = Signer.SignedPayload(signedPayloadSigner); builder.SetSigner(signerKey, 1); builder.SetSourceAccount(source); - SetOptionsOperation operation = builder.Build(); - - xdrSDK.Operation xdrOperation = operation.ToXdr(); - SetOptionsOperation parsedOperation = (SetOptionsOperation)Operation.FromXdr(xdrOperation); - - // verify round trip between xdr and pojo - Assert.AreEqual(source.AccountId, parsedOperation.SourceAccount.AccountId); - Assert.AreEqual(signedPayloadSigner.SignerAccountID.InnerValue.Ed25519, parsedOperation.Signer.Ed25519SignedPayload.Ed25519); - Assert.IsTrue(signedPayloadSigner.Payload.SequenceEqual(parsedOperation.Signer.Ed25519SignedPayload.Payload)); + var operation = builder.Build(); + + // Act + var operationXdrBase64 = operation.ToXdrBase64(); + var decodedOperation = SetOptionsOperation.FromOperationXdrBase64(operationXdrBase64); + // Assert // verify serialized xdr emitted with signed payload - Assert.AreEqual("AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + - "AAAAAAAAAAAAAAAEAAAADPww0v5OtDZlx0EzMkPcFURyDiq2XNKSi+w16A/x/6JoAAAAgAQIDBAUGBwgJCgsMDQ4PEBES" + - "ExQVFhcYGRobHB0eHyAAAAAB", - operation.ToXdrBase64()); + Assert.AreEqual( + "AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADPww0v5OtDZlx0EzMkPcFURyDiq2XNKSi+w16A/x/6JoAAAAgAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAAAAAB", + operationXdrBase64); + + // verify round trip between xdr and pojo + Assert.AreEqual(source.AccountId, decodedOperation.SourceAccount.AccountId); + CollectionAssert.AreEqual(signedPayloadSigner.SignerAccountID.InnerValue.Ed25519.InnerValue, decodedOperation.Signer.Ed25519SignedPayload.Ed25519.InnerValue); + CollectionAssert.AreEqual(signedPayloadSigner.Payload, decodedOperation.Signer.Ed25519SignedPayload.Payload); } } } diff --git a/stellar-dotnet-sdk-test/stellar-dotnet-sdk-test.csproj b/stellar-dotnet-sdk-test/stellar-dotnet-sdk-test.csproj index c43e6e4d..f6196787 100644 --- a/stellar-dotnet-sdk-test/stellar-dotnet-sdk-test.csproj +++ b/stellar-dotnet-sdk-test/stellar-dotnet-sdk-test.csproj @@ -20,6 +20,7 @@ + diff --git a/stellar-dotnet-sdk-xdr/Stellar-contract-config-setting.x b/stellar-dotnet-sdk-xdr/Stellar-contract-config-setting.x new file mode 100644 index 00000000..b187a18c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/Stellar-contract-config-setting.x @@ -0,0 +1,236 @@ +%#include "xdr/Stellar-types.h" + +namespace stellar { +// General “Soroban execution lane” settings +struct ConfigSettingContractExecutionLanesV0 +{ + // maximum number of Soroban transactions per ledger + uint32 ledgerMaxTxCount; +}; + +// "Compute" settings for contracts (instructions and memory). +struct ConfigSettingContractComputeV0 +{ + // Maximum instructions per ledger + int64 ledgerMaxInstructions; + // Maximum instructions per transaction + 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; +}; + +// Ledger access settings for contracts. +struct ConfigSettingContractLedgerCostV0 +{ + // Maximum number of ledger entry read operations per ledger + uint32 ledgerMaxReadLedgerEntries; + // Maximum number of bytes that can be read per ledger + uint32 ledgerMaxReadBytes; + // Maximum number of ledger entry write operations per ledger + uint32 ledgerMaxWriteLedgerEntries; + // Maximum number of bytes that can be written per ledger + uint32 ledgerMaxWriteBytes; + + // Maximum number of ledger entry read operations per transaction + uint32 txMaxReadLedgerEntries; + // Maximum number of bytes that can be read per transaction + uint32 txMaxReadBytes; + // Maximum number of ledger entry write operations per transaction + uint32 txMaxWriteLedgerEntries; + // Maximum number of bytes that can be written per transaction + uint32 txMaxWriteBytes; + + int64 feeReadLedgerEntry; // Fee per ledger entry read + int64 feeWriteLedgerEntry; // Fee per ledger entry write + + int64 feeRead1KB; // Fee for reading 1KB + + // The following parameters determine the write fee per 1KB. + // Write fee grows linearly until bucket list reaches this size + int64 bucketListTargetSizeBytes; + // Fee per 1KB write when the bucket list is empty + int64 writeFee1KBBucketListLow; + // Fee per 1KB write when the bucket list has reached `bucketListTargetSizeBytes` + int64 writeFee1KBBucketListHigh; + // Write fee multiplier for any additional data past the first `bucketListTargetSizeBytes` + uint32 bucketListWriteFeeGrowthFactor; +}; + +// Historical data (pushed to core archives) settings for contracts. +struct ConfigSettingContractHistoricalDataV0 +{ + int64 feeHistorical1KB; // Fee for storing 1KB in archives +}; + +// Contract event-related settings. +struct ConfigSettingContractEventsV0 +{ + // Maximum size of events that a contract call can emit. + uint32 txMaxContractEventsSizeBytes; + // Fee for generating 1KB of contract events. + int64 feeContractEvents1KB; +}; + +// Bandwidth related data settings for contracts. +// We consider bandwidth to only be consumed by the transaction envelopes, hence +// this concerns only transaction sizes. +struct ConfigSettingContractBandwidthV0 +{ + // Maximum sum of all transaction sizes in the ledger in bytes + uint32 ledgerMaxTxsSizeBytes; + // Maximum size in bytes for a transaction + uint32 txMaxSizeBytes; + + // Fee for 1 KB of transaction size + int64 feeTxSize1KB; +}; + +enum ContractCostType { + // Cost of running 1 wasm instruction + WasmInsnExec = 0, + // Cost of allocating a slice of memory (in bytes) + MemAlloc = 1, + // Cost of copying a slice of bytes into a pre-allocated memory + MemCpy = 2, + // Cost of comparing two slices of memory + MemCmp = 3, + // Cost of a host function dispatch, not including the actual work done by + // the function nor the cost of VM invocation machinary + DispatchHostFunction = 4, + // Cost of visiting a host object from the host object storage. Exists to + // make sure some baseline cost coverage, i.e. repeatly visiting objects + // by the guest will always incur some charges. + VisitObject = 5, + // Cost of serializing an xdr object to bytes + ValSer = 6, + // Cost of deserializing an xdr object from bytes + ValDeser = 7, + // Cost of computing the sha256 hash from bytes + ComputeSha256Hash = 8, + // Cost of computing the ed25519 pubkey from bytes + ComputeEd25519PubKey = 9, + // Cost of verifying ed25519 signature of a payload. + VerifyEd25519Sig = 10, + // Cost of instantiation a VM from wasm bytes code. + VmInstantiation = 11, + // Cost of instantiation a VM from a cached state. + VmCachedInstantiation = 12, + // Cost of invoking a function on the VM. If the function is a host function, + // additional cost will be covered by `DispatchHostFunction`. + InvokeVmFunction = 13, + // Cost of computing a keccak256 hash from bytes. + ComputeKeccak256Hash = 14, + // Cost of computing an ECDSA secp256k1 signature from bytes. + ComputeEcdsaSecp256k1Sig = 15, + // Cost of recovering an ECDSA secp256k1 key from a signature. + RecoverEcdsaSecp256k1Key = 16, + // Cost of int256 addition (`+`) and subtraction (`-`) operations + Int256AddSub = 17, + // Cost of int256 multiplication (`*`) operation + Int256Mul = 18, + // Cost of int256 division (`/`) operation + Int256Div = 19, + // Cost of int256 power (`exp`) operation + Int256Pow = 20, + // Cost of int256 shift (`shl`, `shr`) operation + Int256Shift = 21, + // Cost of drawing random bytes using a ChaCha20 PRNG + ChaCha20DrawBytes = 22 +}; + +struct ContractCostParamEntry { + // use `ext` to add more terms (e.g. higher order polynomials) in the future + ExtensionPoint ext; + + int64 constTerm; + int64 linearTerm; +}; + +struct StateArchivalSettings { + uint32 maxEntryTTL; + uint32 minTemporaryTTL; + uint32 minPersistentTTL; + + // rent_fee = wfee_rate_average / rent_rate_denominator_for_type + int64 persistentRentRateDenominator; + int64 tempRentRateDenominator; + + // max number of entries that emit archival meta in a single ledger + uint32 maxEntriesToArchive; + + // Number of snapshots to use when calculating average BucketList size + uint32 bucketListSizeWindowSampleSize; + + // Maximum number of bytes that we scan for eviction per ledger + uint64 evictionScanSize; + + // Lowest BucketList level to be scanned to evict entries + uint32 startingEvictionScanLevel; +}; + +struct EvictionIterator { + uint32 bucketListLevel; + bool isCurrBucket; + uint64 bucketFileOffset; +}; + +// limits the ContractCostParams size to 20kB +const CONTRACT_COST_COUNT_LIMIT = 1024; + +typedef ContractCostParamEntry ContractCostParams; + +// Identifiers of all the network settings. +enum ConfigSettingID +{ + CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES = 0, + CONFIG_SETTING_CONTRACT_COMPUTE_V0 = 1, + CONFIG_SETTING_CONTRACT_LEDGER_COST_V0 = 2, + CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0 = 3, + CONFIG_SETTING_CONTRACT_EVENTS_V0 = 4, + CONFIG_SETTING_CONTRACT_BANDWIDTH_V0 = 5, + CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS = 6, + CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, + CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, + CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, + CONFIG_SETTING_STATE_ARCHIVAL = 10, + CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, + CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, + CONFIG_SETTING_EVICTION_ITERATOR = 13 +}; + +union ConfigSettingEntry switch (ConfigSettingID configSettingID) +{ +case CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES: + uint32 contractMaxSizeBytes; +case CONFIG_SETTING_CONTRACT_COMPUTE_V0: + ConfigSettingContractComputeV0 contractCompute; +case CONFIG_SETTING_CONTRACT_LEDGER_COST_V0: + ConfigSettingContractLedgerCostV0 contractLedgerCost; +case CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0: + ConfigSettingContractHistoricalDataV0 contractHistoricalData; +case CONFIG_SETTING_CONTRACT_EVENTS_V0: + ConfigSettingContractEventsV0 contractEvents; +case CONFIG_SETTING_CONTRACT_BANDWIDTH_V0: + ConfigSettingContractBandwidthV0 contractBandwidth; +case CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS: + ContractCostParams contractCostParamsCpuInsns; +case CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES: + ContractCostParams contractCostParamsMemBytes; +case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: + uint32 contractDataKeySizeBytes; +case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: + uint32 contractDataEntrySizeBytes; +case CONFIG_SETTING_STATE_ARCHIVAL: + StateArchivalSettings stateArchivalSettings; +case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: + ConfigSettingContractExecutionLanesV0 contractExecutionLanes; +case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: + uint64 bucketListSizeWindow<>; +case CONFIG_SETTING_EVICTION_ITERATOR: + EvictionIterator evictionIterator; +}; +} diff --git a/stellar-dotnet-sdk-xdr/Stellar-contract-env-meta.x b/stellar-dotnet-sdk-xdr/Stellar-contract-env-meta.x new file mode 100644 index 00000000..330726de --- /dev/null +++ b/stellar-dotnet-sdk-xdr/Stellar-contract-env-meta.x @@ -0,0 +1,23 @@ +// Copyright 2022 Stellar Development Foundation and contributors. Licensed +// under the Apache License, Version 2.0. See the COPYING file at the root +// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 + +// The contract spec XDR is highly experimental, incomplete, and still being +// iterated on. Breaking changes expected. + +% #include "xdr/Stellar-types.h" +namespace stellar +{ + +enum SCEnvMetaKind +{ + SC_ENV_META_KIND_INTERFACE_VERSION = 0 +}; + +union SCEnvMetaEntry switch (SCEnvMetaKind kind) +{ +case SC_ENV_META_KIND_INTERFACE_VERSION: + uint64 interfaceVersion; +}; + +} diff --git a/stellar-dotnet-sdk-xdr/Stellar-contract-meta.x b/stellar-dotnet-sdk-xdr/Stellar-contract-meta.x new file mode 100644 index 00000000..16eb5f9e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/Stellar-contract-meta.x @@ -0,0 +1,29 @@ +// Copyright 2022 Stellar Development Foundation and contributors. Licensed +// under the Apache License, Version 2.0. See the COPYING file at the root +// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 + +// The contract meta XDR is highly experimental, incomplete, and still being +// iterated on. Breaking changes expected. + +% #include "xdr/Stellar-types.h" +namespace stellar +{ + +struct SCMetaV0 +{ + string key<>; + string val<>; +}; + +enum SCMetaKind +{ + SC_META_V0 = 0 +}; + +union SCMetaEntry switch (SCMetaKind kind) +{ +case SC_META_V0: + SCMetaV0 v0; +}; + +} diff --git a/stellar-dotnet-sdk-xdr/Stellar-contract-spec.x b/stellar-dotnet-sdk-xdr/Stellar-contract-spec.x new file mode 100644 index 00000000..6988a633 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/Stellar-contract-spec.x @@ -0,0 +1,242 @@ +// Copyright 2022 Stellar Development Foundation and contributors. Licensed +// under the Apache License, Version 2.0. See the COPYING file at the root +// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 + +// The contract Contractspec XDR is highly experimental, incomplete, and still being +// iterated on. Breaking changes expected. + +% #include "xdr/Stellar-types.h" +% #include "xdr/Stellar-contract.h" +namespace stellar +{ + +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, + SC_SPEC_TYPE_ERROR = 3, + SC_SPEC_TYPE_U32 = 4, + SC_SPEC_TYPE_I32 = 5, + SC_SPEC_TYPE_U64 = 6, + SC_SPEC_TYPE_I64 = 7, + SC_SPEC_TYPE_TIMEPOINT = 8, + SC_SPEC_TYPE_DURATION = 9, + SC_SPEC_TYPE_U128 = 10, + SC_SPEC_TYPE_I128 = 11, + SC_SPEC_TYPE_U256 = 12, + SC_SPEC_TYPE_I256 = 13, + SC_SPEC_TYPE_BYTES = 14, + SC_SPEC_TYPE_STRING = 16, + SC_SPEC_TYPE_SYMBOL = 17, + SC_SPEC_TYPE_ADDRESS = 19, + + // Types with parameters. + SC_SPEC_TYPE_OPTION = 1000, + SC_SPEC_TYPE_RESULT = 1001, + SC_SPEC_TYPE_VEC = 1002, + SC_SPEC_TYPE_MAP = 1004, + SC_SPEC_TYPE_TUPLE = 1005, + SC_SPEC_TYPE_BYTES_N = 1006, + + // User defined types. + SC_SPEC_TYPE_UDT = 2000 +}; + +struct SCSpecTypeOption +{ + SCSpecTypeDef valueType; +}; + +struct SCSpecTypeResult +{ + SCSpecTypeDef okType; + SCSpecTypeDef errorType; +}; + +struct SCSpecTypeVec +{ + SCSpecTypeDef elementType; +}; + +struct SCSpecTypeMap +{ + SCSpecTypeDef keyType; + SCSpecTypeDef valueType; +}; + +struct SCSpecTypeTuple +{ + SCSpecTypeDef valueTypes<12>; +}; + +struct SCSpecTypeBytesN +{ + uint32 n; +}; + +struct SCSpecTypeUDT +{ + string name<60>; +}; + +union SCSpecTypeDef switch (SCSpecType type) +{ +case SC_SPEC_TYPE_VAL: +case SC_SPEC_TYPE_BOOL: +case SC_SPEC_TYPE_VOID: +case SC_SPEC_TYPE_ERROR: +case SC_SPEC_TYPE_U32: +case SC_SPEC_TYPE_I32: +case SC_SPEC_TYPE_U64: +case SC_SPEC_TYPE_I64: +case SC_SPEC_TYPE_TIMEPOINT: +case SC_SPEC_TYPE_DURATION: +case SC_SPEC_TYPE_U128: +case SC_SPEC_TYPE_I128: +case SC_SPEC_TYPE_U256: +case SC_SPEC_TYPE_I256: +case SC_SPEC_TYPE_BYTES: +case SC_SPEC_TYPE_STRING: +case SC_SPEC_TYPE_SYMBOL: +case SC_SPEC_TYPE_ADDRESS: + void; +case SC_SPEC_TYPE_OPTION: + SCSpecTypeOption option; +case SC_SPEC_TYPE_RESULT: + SCSpecTypeResult result; +case SC_SPEC_TYPE_VEC: + SCSpecTypeVec vec; +case SC_SPEC_TYPE_MAP: + SCSpecTypeMap map; +case SC_SPEC_TYPE_TUPLE: + SCSpecTypeTuple tuple; +case SC_SPEC_TYPE_BYTES_N: + SCSpecTypeBytesN bytesN; +case SC_SPEC_TYPE_UDT: + SCSpecTypeUDT udt; +}; + +struct SCSpecUDTStructFieldV0 +{ + string doc; + string name<30>; + SCSpecTypeDef type; +}; + +struct SCSpecUDTStructV0 +{ + string doc; + string lib<80>; + string name<60>; + SCSpecUDTStructFieldV0 fields<40>; +}; + +struct SCSpecUDTUnionCaseVoidV0 +{ + string doc; + string name<60>; +}; + +struct SCSpecUDTUnionCaseTupleV0 +{ + string doc; + string name<60>; + SCSpecTypeDef type<12>; +}; + +enum SCSpecUDTUnionCaseV0Kind +{ + SC_SPEC_UDT_UNION_CASE_VOID_V0 = 0, + SC_SPEC_UDT_UNION_CASE_TUPLE_V0 = 1 +}; + +union SCSpecUDTUnionCaseV0 switch (SCSpecUDTUnionCaseV0Kind kind) +{ +case SC_SPEC_UDT_UNION_CASE_VOID_V0: + SCSpecUDTUnionCaseVoidV0 voidCase; +case SC_SPEC_UDT_UNION_CASE_TUPLE_V0: + SCSpecUDTUnionCaseTupleV0 tupleCase; +}; + +struct SCSpecUDTUnionV0 +{ + string doc; + string lib<80>; + string name<60>; + SCSpecUDTUnionCaseV0 cases<50>; +}; + +struct SCSpecUDTEnumCaseV0 +{ + string doc; + string name<60>; + uint32 value; +}; + +struct SCSpecUDTEnumV0 +{ + string doc; + string lib<80>; + string name<60>; + SCSpecUDTEnumCaseV0 cases<50>; +}; + +struct SCSpecUDTErrorEnumCaseV0 +{ + string doc; + string name<60>; + uint32 value; +}; + +struct SCSpecUDTErrorEnumV0 +{ + string doc; + string lib<80>; + string name<60>; + SCSpecUDTErrorEnumCaseV0 cases<50>; +}; + +struct SCSpecFunctionInputV0 +{ + string doc; + string name<30>; + SCSpecTypeDef type; +}; + +struct SCSpecFunctionV0 +{ + string doc; + SCSymbol name; + SCSpecFunctionInputV0 inputs<10>; + SCSpecTypeDef outputs<1>; +}; + +enum SCSpecEntryKind +{ + SC_SPEC_ENTRY_FUNCTION_V0 = 0, + SC_SPEC_ENTRY_UDT_STRUCT_V0 = 1, + SC_SPEC_ENTRY_UDT_UNION_V0 = 2, + SC_SPEC_ENTRY_UDT_ENUM_V0 = 3, + SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0 = 4 +}; + +union SCSpecEntry switch (SCSpecEntryKind kind) +{ +case SC_SPEC_ENTRY_FUNCTION_V0: + SCSpecFunctionV0 functionV0; +case SC_SPEC_ENTRY_UDT_STRUCT_V0: + SCSpecUDTStructV0 udtStructV0; +case SC_SPEC_ENTRY_UDT_UNION_V0: + SCSpecUDTUnionV0 udtUnionV0; +case SC_SPEC_ENTRY_UDT_ENUM_V0: + SCSpecUDTEnumV0 udtEnumV0; +case SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0: + SCSpecUDTErrorEnumV0 udtErrorEnumV0; +}; + +} diff --git a/stellar-dotnet-sdk-xdr/Stellar-contract.x b/stellar-dotnet-sdk-xdr/Stellar-contract.x new file mode 100644 index 00000000..51130056 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/Stellar-contract.x @@ -0,0 +1,282 @@ +// Copyright 2022 Stellar Development Foundation and contributors. Licensed +// under the Apache License, Version 2.0. See the COPYING file at the root +// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 + +% #include "xdr/Stellar-types.h" +namespace stellar +{ + +// We fix a maximum of 128 value types in the system for two reasons: we want to +// keep the codes relatively small (<= 8 bits) when bit-packing values into a +// u64 at the environment interface level, so that we keep many bits for +// payloads (small strings, small numeric values, object handles); and then we +// actually want to go one step further and ensure (for code-size) that our +// codes fit in a single ULEB128-code byte, which means we can only use 7 bits. +// +// We also reserve several type codes from this space because we want to _reuse_ +// the SCValType codes at the environment interface level (or at least not +// exceed its number-space) but there are more types at that level, assigned to +// optimizations/special case representations of values abstract at this level. + +enum SCValType +{ + 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. + SCV_CONTRACT_INSTANCE = 19, + + // SCV_LEDGER_KEY_CONTRACT_INSTANCE and SCV_LEDGER_KEY_NONCE are unique + // symbolic SCVals used as the key for ledger entries for a contract's + // instance and an address' nonce, respectively. + SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20, + SCV_LEDGER_KEY_NONCE = 21 +}; + +enum SCErrorType +{ + SCE_CONTRACT = 0, // Contract-specific, user-defined codes. + SCE_WASM_VM = 1, // Errors while interpreting WASM bytecode. + SCE_CONTEXT = 2, // Errors in the contract's host context. + SCE_STORAGE = 3, // Errors accessing host storage. + SCE_OBJECT = 4, // Errors working with host objects. + SCE_CRYPTO = 5, // Errors in cryptographic operations. + SCE_EVENTS = 6, // Errors while emitting events. + SCE_BUDGET = 7, // Errors relating to budget limits. + SCE_VALUE = 8, // Errors working with host values or SCVals. + SCE_AUTH = 9 // Errors from the authentication subsystem. +}; + +enum SCErrorCode +{ + SCEC_ARITH_DOMAIN = 0, // Some arithmetic was undefined (overflow, divide-by-zero). + SCEC_INDEX_BOUNDS = 1, // Something was indexed beyond its bounds. + SCEC_INVALID_INPUT = 2, // User provided some otherwise-bad data. + SCEC_MISSING_VALUE = 3, // Some value was required but not provided. + SCEC_EXISTING_VALUE = 4, // Some value was provided where not allowed. + SCEC_EXCEEDED_LIMIT = 5, // Some arbitrary limit -- gas or otherwise -- was hit. + SCEC_INVALID_ACTION = 6, // Data was valid but action requested was not. + SCEC_INTERNAL_ERROR = 7, // The host detected an error in its own logic. + SCEC_UNEXPECTED_TYPE = 8, // Some type wasn't as expected. + SCEC_UNEXPECTED_SIZE = 9 // Something's size wasn't as expected. +}; + +// Smart contract errors are split into a type (SCErrorType) and a code. When an +// error is of type SCE_CONTRACT it carries a user-defined uint32 code that +// Soroban assigns no specific meaning to. In all other cases, the type +// specifies a subsystem of the Soroban host where the error originated, and the +// accompanying code is an SCErrorCode, each of which specifies a slightly more +// precise class of errors within that subsystem. +// +// Error types and codes are not maximally precise; there is a tradeoff between +// precision and flexibility in the implementation, and the granularity here is +// chosen to be adequate for most purposes while not placing a burden on future +// system evolution and maintenance. When additional precision is needed for +// debugging, Soroban can be run with diagnostic events enabled. + +union SCError switch (SCErrorType type) +{ +case SCE_CONTRACT: + uint32 contractCode; +case SCE_WASM_VM: +case SCE_CONTEXT: +case SCE_STORAGE: +case SCE_OBJECT: +case SCE_CRYPTO: +case SCE_EVENTS: +case SCE_BUDGET: +case SCE_VALUE: +case SCE_AUTH: + SCErrorCode code; +}; + +struct UInt128Parts { + uint64 hi; + uint64 lo; +}; + +// A signed int128 has a high sign bit and 127 value bits. We break it into a +// signed high int64 (that carries the sign bit and the high 63 value bits) and +// a low unsigned uint64 that carries the low 64 bits. This will sort in +// generated code in the same order the underlying int128 sorts. +struct Int128Parts { + int64 hi; + uint64 lo; +}; + +struct UInt256Parts { + uint64 hi_hi; + uint64 hi_lo; + uint64 lo_hi; + uint64 lo_lo; +}; + +// A signed int256 has a high sign bit and 255 value bits. We break it into a +// signed high int64 (that carries the sign bit and the high 63 value bits) and +// three low unsigned `uint64`s that carry the lower bits. This will sort in +// generated code in the same order the underlying int256 sorts. +struct Int256Parts { + int64 hi_hi; + uint64 hi_lo; + uint64 lo_hi; + uint64 lo_lo; +}; + +enum ContractExecutableType +{ + CONTRACT_EXECUTABLE_WASM = 0, + CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 +}; + +union ContractExecutable switch (ContractExecutableType type) +{ +case CONTRACT_EXECUTABLE_WASM: + Hash wasm_hash; +case CONTRACT_EXECUTABLE_STELLAR_ASSET: + void; +}; + +enum SCAddressType +{ + SC_ADDRESS_TYPE_ACCOUNT = 0, + SC_ADDRESS_TYPE_CONTRACT = 1 +}; + +union SCAddress switch (SCAddressType type) +{ +case SC_ADDRESS_TYPE_ACCOUNT: + AccountID accountId; +case SC_ADDRESS_TYPE_CONTRACT: + Hash contractId; +}; + +%struct SCVal; +%struct SCMapEntry; + +const SCSYMBOL_LIMIT = 32; + +typedef SCVal SCVec<>; +typedef SCMapEntry SCMap<>; + +typedef opaque SCBytes<>; +typedef string SCString<>; +typedef string SCSymbol; + +struct SCNonceKey { + int64 nonce; +}; + +struct SCContractInstance { + ContractExecutable executable; + SCMap* storage; +}; + +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: + int64 i64; +case SCV_TIMEPOINT: + 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_LEDGER_KEY_CONTRACT_INSTANCE: + void; +case SCV_LEDGER_KEY_NONCE: + SCNonceKey nonce_key; + +case SCV_CONTRACT_INSTANCE: + SCContractInstance instance; +}; + +struct SCMapEntry +{ + SCVal key; + SCVal val; +}; + +} diff --git a/stellar-dotnet-sdk-xdr/Stellar-internal.x b/stellar-dotnet-sdk-xdr/Stellar-internal.x new file mode 100644 index 00000000..02f1b81e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/Stellar-internal.x @@ -0,0 +1,48 @@ +// Copyright 2022 Stellar Development Foundation and contributors. Licensed +// under the Apache License, Version 2.0. See the COPYING file at the root +// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 + +// This is for 'internal'-only messages that are not meant to be read/written +// by any other binaries besides a single Core instance. +%#include "xdr/Stellar-ledger.h" +%#include "xdr/Stellar-SCP.h" + +namespace stellar +{ +union StoredTransactionSet switch (int v) +{ +case 0: + TransactionSet txSet; +case 1: + GeneralizedTransactionSet generalizedTxSet; +}; + +struct StoredDebugTransactionSet +{ + StoredTransactionSet txSet; + uint32 ledgerSeq; + StellarValue scpValue; +}; + +struct PersistedSCPStateV0 +{ + SCPEnvelope scpEnvelopes<>; + SCPQuorumSet quorumSets<>; + StoredTransactionSet txSets<>; +}; + +struct PersistedSCPStateV1 +{ + // Tx sets are saved separately + SCPEnvelope scpEnvelopes<>; + SCPQuorumSet quorumSets<>; +}; + +union PersistedSCPState switch (int v) +{ +case 0: + PersistedSCPStateV0 v0; +case 1: + PersistedSCPStateV1 v1; +}; +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/Stellar-ledger-entries.x b/stellar-dotnet-sdk-xdr/Stellar-ledger-entries.x index 3eb578f1..8a8784e2 100644 --- a/stellar-dotnet-sdk-xdr/Stellar-ledger-entries.x +++ b/stellar-dotnet-sdk-xdr/Stellar-ledger-entries.x @@ -3,17 +3,16 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 %#include "xdr/Stellar-types.h" +%#include "xdr/Stellar-contract.h" +%#include "xdr/Stellar-contract-config-setting.h" namespace stellar { -typedef PublicKey AccountID; typedef opaque Thresholds[4]; typedef string string32<32>; typedef string string64<64>; typedef int64 SequenceNumber; -typedef uint64 TimePoint; -typedef uint64 Duration; typedef opaque DataValue<64>; typedef Hash PoolID; // SHA256(LiquidityPoolParameters) @@ -98,7 +97,11 @@ enum LedgerEntryType OFFER = 2, DATA = 3, CLAIMABLE_BALANCE = 4, - LIQUIDITY_POOL = 5 + LIQUIDITY_POOL = 5, + CONTRACT_DATA = 6, + CONTRACT_CODE = 7, + CONFIG_SETTING = 8, + TTL = 9 }; struct Signer @@ -491,6 +494,33 @@ struct LiquidityPoolEntry body; }; +enum ContractDataDurability { + TEMPORARY = 0, + PERSISTENT = 1 +}; + +struct ContractDataEntry { + ExtensionPoint ext; + + SCAddress contract; + SCVal key; + ContractDataDurability durability; + SCVal val; +}; + +struct ContractCodeEntry { + ExtensionPoint ext; + + Hash hash; + opaque code<>; +}; + +struct TTLEntry { + // Hash of the LedgerKey that is associated with this TTLEntry + Hash keyHash; + uint32 liveUntilLedgerSeq; +}; + struct LedgerEntryExtensionV1 { SponsorshipDescriptor sponsoringID; @@ -521,6 +551,14 @@ struct LedgerEntry ClaimableBalanceEntry claimableBalance; case LIQUIDITY_POOL: LiquidityPoolEntry liquidityPool; + case CONTRACT_DATA: + ContractDataEntry contractData; + case CONTRACT_CODE: + ContractCodeEntry contractCode; + case CONFIG_SETTING: + ConfigSettingEntry configSetting; + case TTL: + TTLEntry ttl; } data; @@ -575,6 +613,29 @@ case LIQUIDITY_POOL: { PoolID liquidityPoolID; } liquidityPool; +case CONTRACT_DATA: + struct + { + SCAddress contract; + SCVal key; + ContractDataDurability durability; + } contractData; +case CONTRACT_CODE: + struct + { + Hash hash; + } contractCode; +case CONFIG_SETTING: + struct + { + ConfigSettingID configSettingID; + } configSetting; +case TTL: + struct + { + // Hash of the LedgerKey that is associated with this TTLEntry + Hash keyHash; + } ttl; }; // list of all envelope types used in the application @@ -589,6 +650,8 @@ enum EnvelopeType ENVELOPE_TYPE_SCPVALUE = 4, ENVELOPE_TYPE_TX_FEE_BUMP = 5, ENVELOPE_TYPE_OP_ID = 6, - ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7 + ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7, + ENVELOPE_TYPE_CONTRACT_ID = 8, + ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9 }; } diff --git a/stellar-dotnet-sdk-xdr/Stellar-ledger.x b/stellar-dotnet-sdk-xdr/Stellar-ledger.x index 84b84cbf..b18a3a0d 100644 --- a/stellar-dotnet-sdk-xdr/Stellar-ledger.x +++ b/stellar-dotnet-sdk-xdr/Stellar-ledger.x @@ -122,7 +122,14 @@ enum LedgerUpgradeType LEDGER_UPGRADE_BASE_FEE = 2, LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, LEDGER_UPGRADE_BASE_RESERVE = 4, - LEDGER_UPGRADE_FLAGS = 5 + LEDGER_UPGRADE_FLAGS = 5, + LEDGER_UPGRADE_CONFIG = 6, + LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 +}; + +struct ConfigUpgradeSetKey { + Hash contractID; + Hash contentHash; }; union LedgerUpgrade switch (LedgerUpgradeType type) @@ -137,6 +144,17 @@ case LEDGER_UPGRADE_BASE_RESERVE: uint32 newBaseReserve; // update baseReserve case LEDGER_UPGRADE_FLAGS: uint32 newFlags; // update flags +case LEDGER_UPGRADE_CONFIG: + // Update arbitrary `ConfigSetting` entries identified by the key. + ConfigUpgradeSetKey newConfig; +case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without + // using `LEDGER_UPGRADE_CONFIG`. + uint32 newMaxSorobanTxSetSize; +}; + +struct ConfigUpgradeSet { + ConfigSettingEntry updatedEntry<>; }; /* Entries used to define the bucket list */ @@ -176,6 +194,29 @@ case METAENTRY: BucketMetadata metaEntry; }; +enum TxSetComponentType +{ + // txs with effective fee <= bid derived from a base fee (if any). + // If base fee is not specified, no discount is applied. + TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE = 0 +}; + +union TxSetComponent switch (TxSetComponentType type) +{ +case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: + struct + { + int64* baseFee; + TransactionEnvelope txs<>; + } txsMaybeDiscountedFee; +}; + +union TransactionPhase switch (int v) +{ +case 0: + TxSetComponent v0Components<>; +}; + // Transaction sets are the unit used by SCP to decide on transitions // between ledgers struct TransactionSet @@ -184,6 +225,19 @@ struct TransactionSet TransactionEnvelope txs<>; }; +struct TransactionSetV1 +{ + Hash previousLedgerHash; + TransactionPhase phases<>; +}; + +union GeneralizedTransactionSet switch (int v) +{ +// We consider the legacy TransactionSet to be v0. +case 1: + TransactionSetV1 v1TxSet; +}; + struct TransactionResultPair { Hash transactionHash; @@ -203,11 +257,13 @@ struct TransactionHistoryEntry uint32 ledgerSeq; TransactionSet txSet; - // reserved for future use + // when v != 0, txSet must be empty union switch (int v) { case 0: void; + case 1: + GeneralizedTransactionSet generalizedTxSet; } ext; }; @@ -310,6 +366,74 @@ struct TransactionMetaV2 // applied if any }; +enum ContractEventType +{ + SYSTEM = 0, + CONTRACT = 1, + DIAGNOSTIC = 2 +}; + +struct ContractEvent +{ + // We can use this to add more fields, or because it + // is first, to change ContractEvent into a union. + ExtensionPoint ext; + + Hash* contractID; + ContractEventType type; + + union switch (int v) + { + case 0: + struct + { + SCVal topics<>; + SCVal data; + } v0; + } + body; +}; + +struct DiagnosticEvent +{ + bool inSuccessfulContractCall; + ContractEvent event; +}; + +struct SorobanTransactionMeta +{ + ExtensionPoint 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. + DiagnosticEvent diagnosticEvents<>; +}; + +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 + // Soroban transactions). +}; + +// This is in Stellar-ledger.x to due to a circular dependency +struct InvokeHostFunctionSuccessPreImage +{ + SCVal returnValue; + ContractEvent events<>; +}; + // this is the meta produced when applying transactions // it does not include pre-apply updates such as fees union TransactionMeta switch (int v) @@ -320,6 +444,8 @@ case 1: TransactionMetaV1 v1; case 2: TransactionMetaV2 v2; +case 3: + TransactionMetaV3 v3; }; // This struct groups together changes on a per transaction basis @@ -358,9 +484,44 @@ struct LedgerCloseMetaV0 SCPHistoryEntry scpInfo<>; }; +struct LedgerCloseMetaV1 +{ + // We forgot to add an ExtensionPoint in v0 but at least + // we can add one now in v1. + ExtensionPoint 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 BucketList, to support downstream + // systems calculating storage fees correctly. + uint64 totalByteSizeOfBucketList; + + // Temp keys that are being evicted at this ledger. + LedgerKey evictedTemporaryLedgerKeys<>; + + // Archived restorable ledger entries that are being + // evicted at this ledger. + LedgerEntry evictedPersistentLedgerEntries<>; +}; + union LedgerCloseMeta switch (int v) { case 0: LedgerCloseMetaV0 v0; +case 1: + LedgerCloseMetaV1 v1; }; } diff --git a/stellar-dotnet-sdk-xdr/Stellar-overlay.x b/stellar-dotnet-sdk-xdr/Stellar-overlay.x index 9e3a083d..4c964736 100644 --- a/stellar-dotnet-sdk-xdr/Stellar-overlay.x +++ b/stellar-dotnet-sdk-xdr/Stellar-overlay.x @@ -27,6 +27,12 @@ struct SendMore uint32 numMessages; }; +struct SendMoreExtended +{ + uint32 numMessages; + uint32 numBytes; +}; + struct AuthCert { Curve25519Public pubkey; @@ -47,11 +53,18 @@ struct Hello uint256 nonce; }; +// During the roll-out phrase, nodes can disable flow control in bytes. +// Therefore, we need a way to communicate with other nodes +// that we want/don't want flow control in bytes. +// We use the `flags` field in the Auth message with a special value +// set to communicate this. Note that AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED != 0 +// AND AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED != 100 (as previously +// that value was used for other purposes). +const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200; + struct Auth { - // Empty message, just to confirm - // establishment of MAC keys. - int unused; + int flags; }; enum IPAddrType @@ -74,6 +87,7 @@ struct PeerAddress uint32 numFailures; }; +// Next ID: 21 enum MessageType { ERROR_MSG = 0, @@ -85,6 +99,7 @@ enum MessageType 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 @@ -100,7 +115,11 @@ enum MessageType SURVEY_REQUEST = 14, SURVEY_RESPONSE = 15, - SEND_MORE = 16 + SEND_MORE = 16, + SEND_MORE_EXTENDED = 20, + + FLOOD_ADVERT = 18, + FLOOD_DEMAND = 19 }; struct DontHave @@ -114,6 +133,12 @@ enum SurveyMessageCommandType SURVEY_TOPOLOGY = 0 }; +enum SurveyMessageResponseType +{ + SURVEY_TOPOLOGY_RESPONSE_V0 = 0, + SURVEY_TOPOLOGY_RESPONSE_V1 = 1 +}; + struct SurveyRequestMessage { NodeID surveyorPeerID; @@ -168,19 +193,49 @@ struct PeerStats typedef PeerStats PeerStatList<25>; -struct TopologyResponseBody +struct TopologyResponseBodyV0 +{ + PeerStatList inboundPeers; + PeerStatList outboundPeers; + + uint32 totalInboundPeerCount; + uint32 totalOutboundPeerCount; +}; + +struct TopologyResponseBodyV1 { PeerStatList inboundPeers; PeerStatList outboundPeers; uint32 totalInboundPeerCount; uint32 totalOutboundPeerCount; + + uint32 maxInboundPeerCount; + uint32 maxOutboundPeerCount; }; -union SurveyResponseBody switch (SurveyMessageCommandType type) +union SurveyResponseBody switch (SurveyMessageResponseType type) +{ +case SURVEY_TOPOLOGY_RESPONSE_V0: + TopologyResponseBodyV0 topologyResponseBodyV0; +case SURVEY_TOPOLOGY_RESPONSE_V1: + TopologyResponseBodyV1 topologyResponseBodyV1; +}; + +const TX_ADVERT_VECTOR_MAX_SIZE = 1000; +typedef Hash TxAdvertVector; + +struct FloodAdvert +{ + TxAdvertVector txHashes; +}; + +const TX_DEMAND_VECTOR_MAX_SIZE = 1000; +typedef Hash TxDemandVector; + +struct FloodDemand { -case SURVEY_TOPOLOGY: - TopologyResponseBody topologyResponseBody; + TxDemandVector txHashes; }; union StellarMessage switch (MessageType type) @@ -202,6 +257,8 @@ case GET_TX_SET: uint256 txSetHash; case TX_SET: TransactionSet txSet; +case GENERALIZED_TX_SET: + GeneralizedTransactionSet generalizedTxSet; case TRANSACTION: TransactionEnvelope transaction; @@ -223,6 +280,13 @@ case GET_SCP_STATE: uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest case SEND_MORE: SendMore sendMoreMessage; +case SEND_MORE_EXTENDED: + SendMoreExtended sendMoreExtendedMessage; +// Pull mode +case FLOOD_ADVERT: + FloodAdvert floodAdvert; +case FLOOD_DEMAND: + FloodDemand floodDemand; }; union AuthenticatedMessage switch (uint32 v) diff --git a/stellar-dotnet-sdk-xdr/Stellar-transaction.x b/stellar-dotnet-sdk-xdr/Stellar-transaction.x index f2f593c2..c7f0f5e2 100644 --- a/stellar-dotnet-sdk-xdr/Stellar-transaction.x +++ b/stellar-dotnet-sdk-xdr/Stellar-transaction.x @@ -2,11 +2,15 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 +%#include "xdr/Stellar-contract.h" %#include "xdr/Stellar-ledger-entries.h" namespace stellar { +// maximum number of operations per transaction +const MAX_OPS_PER_TX = 100; + union LiquidityPoolParameters switch (LiquidityPoolType type) { case LIQUIDITY_POOL_CONSTANT_PRODUCT: @@ -57,7 +61,10 @@ enum OperationType CLAWBACK_CLAIMABLE_BALANCE = 20, SET_TRUST_LINE_FLAGS = 21, LIQUIDITY_POOL_DEPOSIT = 22, - LIQUIDITY_POOL_WITHDRAW = 23 + LIQUIDITY_POOL_WITHDRAW = 23, + INVOKE_HOST_FUNCTION = 24, + EXTEND_FOOTPRINT_TTL = 25, + RESTORE_FOOTPRINT = 26 }; /* CreateAccount @@ -465,6 +472,141 @@ struct LiquidityPoolWithdrawOp int64 minAmountB; // minimum amount of second asset to withdraw }; +enum HostFunctionType +{ + HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0, + HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1, + HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2 +}; + +enum ContractIDPreimageType +{ + CONTRACT_ID_PREIMAGE_FROM_ADDRESS = 0, + CONTRACT_ID_PREIMAGE_FROM_ASSET = 1 +}; + +union ContractIDPreimage switch (ContractIDPreimageType type) +{ +case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: + struct + { + SCAddress address; + uint256 salt; + } fromAddress; +case CONTRACT_ID_PREIMAGE_FROM_ASSET: + Asset fromAsset; +}; + +struct CreateContractArgs +{ + ContractIDPreimage contractIDPreimage; + ContractExecutable executable; +}; + +struct InvokeContractArgs { + SCAddress contractAddress; + SCSymbol functionName; + SCVal args<>; +}; + +union HostFunction switch (HostFunctionType type) +{ +case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: + InvokeContractArgs invokeContract; +case HOST_FUNCTION_TYPE_CREATE_CONTRACT: + CreateContractArgs createContract; +case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: + opaque wasm<>; +}; + +enum SorobanAuthorizedFunctionType +{ + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0, + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1 +}; + +union SorobanAuthorizedFunction switch (SorobanAuthorizedFunctionType type) +{ +case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: + InvokeContractArgs contractFn; +case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: + CreateContractArgs createContractHostFn; +}; + +struct SorobanAuthorizedInvocation +{ + SorobanAuthorizedFunction function; + SorobanAuthorizedInvocation subInvocations<>; +}; + +struct SorobanAddressCredentials +{ + SCAddress address; + int64 nonce; + uint32 signatureExpirationLedger; + SCVal signature; +}; + +enum SorobanCredentialsType +{ + SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0, + SOROBAN_CREDENTIALS_ADDRESS = 1 +}; + +union SorobanCredentials switch (SorobanCredentialsType type) +{ +case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: + void; +case SOROBAN_CREDENTIALS_ADDRESS: + SorobanAddressCredentials address; +}; + +/* Unit of authorization data for Soroban. + + Represents an authorization for executing the tree of authorized contract + and/or host function calls by the user defined by `credentials`. +*/ +struct SorobanAuthorizationEntry +{ + SorobanCredentials credentials; + SorobanAuthorizedInvocation rootInvocation; +}; + +/* Upload WASM, create, and invoke contracts in Soroban. + + Threshold: med + Result: InvokeHostFunctionResult +*/ +struct InvokeHostFunctionOp +{ + // Host function to invoke. + HostFunction hostFunction; + // Per-address authorizations for this host function. + SorobanAuthorizationEntry auth<>; +}; + +/* Extend the TTL of the entries specified in the readOnly footprint + so they will live at least extendTo ledgers from lcl. + + Threshold: med + Result: ExtendFootprintTTLResult +*/ +struct ExtendFootprintTTLOp +{ + ExtensionPoint ext; + uint32 extendTo; +}; + +/* Restore the archived entries specified in the readWrite footprint. + + Threshold: med + Result: RestoreFootprintOp +*/ +struct RestoreFootprintOp +{ + ExtensionPoint ext; +}; + /* An operation is the lowest unit of work that a transaction does */ struct Operation { @@ -523,6 +665,12 @@ struct Operation LiquidityPoolDepositOp liquidityPoolDepositOp; case LIQUIDITY_POOL_WITHDRAW: LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; + case INVOKE_HOST_FUNCTION: + InvokeHostFunctionOp invokeHostFunctionOp; + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLOp extendFootprintTTLOp; + case RESTORE_FOOTPRINT: + RestoreFootprintOp restoreFootprintOp; } body; }; @@ -540,11 +688,25 @@ case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: struct { AccountID sourceAccount; - SequenceNumber seqNum; + SequenceNumber seqNum; uint32 opNum; PoolID liquidityPoolID; Asset asset; } revokeID; +case ENVELOPE_TYPE_CONTRACT_ID: + struct + { + Hash networkID; + ContractIDPreimage contractIDPreimage; + } contractID; +case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + struct + { + Hash networkID; + int64 nonce; + uint32 signatureExpirationLedger; + SorobanAuthorizedInvocation invocation; + } sorobanAuthorization; }; enum MemoType @@ -632,8 +794,44 @@ case PRECOND_V2: PreconditionsV2 v2; }; -// maximum number of operations per transaction -const MAX_OPS_PER_TX = 100; +// Ledger key sets touched by a smart contract transaction. +struct LedgerFootprint +{ + LedgerKey readOnly<>; + LedgerKey readWrite<>; +}; + +// Resource limits for a Soroban transaction. +// The transaction will fail if it exceeds any of these limits. +struct SorobanResources +{ + // The ledger footprint of the transaction. + LedgerFootprint footprint; + // The maximum number of instructions this transaction can use + uint32 instructions; + + // The maximum number of bytes this transaction can read from ledger + uint32 readBytes; + // The maximum number of bytes this transaction can write to ledger + uint32 writeBytes; +}; + +// The transaction extension for Soroban. +struct SorobanTransactionData +{ + ExtensionPoint ext; + SorobanResources resources; + // Amount of the transaction `fee` allocated to the Soroban resource fees. + // The fraction of `resourceFee` corresponding to `resources` specified + // above is *not* refundable (i.e. fees for instructions, ledger I/O), as + // well as fees for the transaction size. + // The remaining part of the fee is refundable and the charged value is + // based on the actual consumption of refundable resources (events, ledger + // rent bumps). + // The `inclusionFee` used for prioritization of the transaction is defined + // as `tx.fee - resourceFee`. + int64 resourceFee; +}; // TransactionV0 is a transaction with the AccountID discriminant stripped off, // leaving a raw ed25519 public key to identify the source account. This is used @@ -695,6 +893,8 @@ struct Transaction { case 0: void; + case 1: + SorobanTransactionData sorobanData; } ext; }; @@ -847,7 +1047,10 @@ union CreateAccountResult switch (CreateAccountResultCode code) { case CREATE_ACCOUNT_SUCCESS: void; -default: +case CREATE_ACCOUNT_MALFORMED: +case CREATE_ACCOUNT_UNDERFUNDED: +case CREATE_ACCOUNT_LOW_RESERVE: +case CREATE_ACCOUNT_ALREADY_EXIST: void; }; @@ -874,7 +1077,15 @@ union PaymentResult switch (PaymentResultCode code) { case PAYMENT_SUCCESS: void; -default: +case PAYMENT_MALFORMED: +case PAYMENT_UNDERFUNDED: +case PAYMENT_SRC_NO_TRUST: +case PAYMENT_SRC_NOT_AUTHORIZED: +case PAYMENT_NO_DESTINATION: +case PAYMENT_NO_TRUST: +case PAYMENT_NOT_AUTHORIZED: +case PAYMENT_LINE_FULL: +case PAYMENT_NO_ISSUER: void; }; @@ -925,9 +1136,20 @@ case PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: ClaimAtom offers<>; SimplePaymentResult last; } success; +case PATH_PAYMENT_STRICT_RECEIVE_MALFORMED: +case PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED: +case PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST: +case PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED: +case PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION: +case PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST: +case PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED: +case PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL: + void; case PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: Asset noIssuer; // the asset that caused the error -default: +case PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS: +case PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF: +case PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX: void; }; @@ -969,9 +1191,20 @@ case PATH_PAYMENT_STRICT_SEND_SUCCESS: ClaimAtom offers<>; SimplePaymentResult last; } success; +case PATH_PAYMENT_STRICT_SEND_MALFORMED: +case PATH_PAYMENT_STRICT_SEND_UNDERFUNDED: +case PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST: +case PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED: +case PATH_PAYMENT_STRICT_SEND_NO_DESTINATION: +case PATH_PAYMENT_STRICT_SEND_NO_TRUST: +case PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED: +case PATH_PAYMENT_STRICT_SEND_LINE_FULL: + void; case PATH_PAYMENT_STRICT_SEND_NO_ISSUER: Asset noIssuer; // the asset that caused the error -default: +case PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS: +case PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF: +case PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN: void; }; @@ -1021,7 +1254,7 @@ struct ManageOfferSuccessResult case MANAGE_OFFER_CREATED: case MANAGE_OFFER_UPDATED: OfferEntry offer; - default: + case MANAGE_OFFER_DELETED: void; } offer; @@ -1031,7 +1264,18 @@ union ManageSellOfferResult switch (ManageSellOfferResultCode code) { case MANAGE_SELL_OFFER_SUCCESS: ManageOfferSuccessResult success; -default: +case MANAGE_SELL_OFFER_MALFORMED: +case MANAGE_SELL_OFFER_SELL_NO_TRUST: +case MANAGE_SELL_OFFER_BUY_NO_TRUST: +case MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED: +case MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED: +case MANAGE_SELL_OFFER_LINE_FULL: +case MANAGE_SELL_OFFER_UNDERFUNDED: +case MANAGE_SELL_OFFER_CROSS_SELF: +case MANAGE_SELL_OFFER_SELL_NO_ISSUER: +case MANAGE_SELL_OFFER_BUY_NO_ISSUER: +case MANAGE_SELL_OFFER_NOT_FOUND: +case MANAGE_SELL_OFFER_LOW_RESERVE: void; }; @@ -1065,7 +1309,18 @@ union ManageBuyOfferResult switch (ManageBuyOfferResultCode code) { case MANAGE_BUY_OFFER_SUCCESS: ManageOfferSuccessResult success; -default: +case MANAGE_BUY_OFFER_MALFORMED: +case MANAGE_BUY_OFFER_SELL_NO_TRUST: +case MANAGE_BUY_OFFER_BUY_NO_TRUST: +case MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED: +case MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED: +case MANAGE_BUY_OFFER_LINE_FULL: +case MANAGE_BUY_OFFER_UNDERFUNDED: +case MANAGE_BUY_OFFER_CROSS_SELF: +case MANAGE_BUY_OFFER_SELL_NO_ISSUER: +case MANAGE_BUY_OFFER_BUY_NO_ISSUER: +case MANAGE_BUY_OFFER_NOT_FOUND: +case MANAGE_BUY_OFFER_LOW_RESERVE: void; }; @@ -1093,7 +1348,16 @@ union SetOptionsResult switch (SetOptionsResultCode code) { case SET_OPTIONS_SUCCESS: void; -default: +case SET_OPTIONS_LOW_RESERVE: +case SET_OPTIONS_TOO_MANY_SIGNERS: +case SET_OPTIONS_BAD_FLAGS: +case SET_OPTIONS_INVALID_INFLATION: +case SET_OPTIONS_CANT_CHANGE: +case SET_OPTIONS_UNKNOWN_FLAG: +case SET_OPTIONS_THRESHOLD_OUT_OF_RANGE: +case SET_OPTIONS_BAD_SIGNER: +case SET_OPTIONS_INVALID_HOME_DOMAIN: +case SET_OPTIONS_AUTH_REVOCABLE_REQUIRED: void; }; @@ -1122,7 +1386,14 @@ union ChangeTrustResult switch (ChangeTrustResultCode code) { case CHANGE_TRUST_SUCCESS: void; -default: +case CHANGE_TRUST_MALFORMED: +case CHANGE_TRUST_NO_ISSUER: +case CHANGE_TRUST_INVALID_LIMIT: +case CHANGE_TRUST_LOW_RESERVE: +case CHANGE_TRUST_SELF_NOT_ALLOWED: +case CHANGE_TRUST_TRUST_LINE_MISSING: +case CHANGE_TRUST_CANNOT_DELETE: +case CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES: void; }; @@ -1147,7 +1418,12 @@ union AllowTrustResult switch (AllowTrustResultCode code) { case ALLOW_TRUST_SUCCESS: void; -default: +case ALLOW_TRUST_MALFORMED: +case ALLOW_TRUST_NO_TRUST_LINE: +case ALLOW_TRUST_TRUST_NOT_REQUIRED: +case ALLOW_TRUST_CANT_REVOKE: +case ALLOW_TRUST_SELF_NOT_ALLOWED: +case ALLOW_TRUST_LOW_RESERVE: void; }; @@ -1172,7 +1448,13 @@ union AccountMergeResult switch (AccountMergeResultCode code) { case ACCOUNT_MERGE_SUCCESS: int64 sourceAccountBalance; // how much got transferred from source account -default: +case ACCOUNT_MERGE_MALFORMED: +case ACCOUNT_MERGE_NO_ACCOUNT: +case ACCOUNT_MERGE_IMMUTABLE_SET: +case ACCOUNT_MERGE_HAS_SUB_ENTRIES: +case ACCOUNT_MERGE_SEQNUM_TOO_FAR: +case ACCOUNT_MERGE_DEST_FULL: +case ACCOUNT_MERGE_IS_SPONSOR: void; }; @@ -1196,7 +1478,7 @@ union InflationResult switch (InflationResultCode code) { case INFLATION_SUCCESS: InflationPayout payouts<>; -default: +case INFLATION_NOT_TIME: void; }; @@ -1219,7 +1501,10 @@ union ManageDataResult switch (ManageDataResultCode code) { case MANAGE_DATA_SUCCESS: void; -default: +case MANAGE_DATA_NOT_SUPPORTED_YET: +case MANAGE_DATA_NAME_NOT_FOUND: +case MANAGE_DATA_LOW_RESERVE: +case MANAGE_DATA_INVALID_NAME: void; }; @@ -1237,7 +1522,7 @@ union BumpSequenceResult switch (BumpSequenceResultCode code) { case BUMP_SEQUENCE_SUCCESS: void; -default: +case BUMP_SEQUENCE_BAD_SEQ: void; }; @@ -1258,7 +1543,11 @@ union CreateClaimableBalanceResult switch ( { case CREATE_CLAIMABLE_BALANCE_SUCCESS: ClaimableBalanceID balanceID; -default: +case CREATE_CLAIMABLE_BALANCE_MALFORMED: +case CREATE_CLAIMABLE_BALANCE_LOW_RESERVE: +case CREATE_CLAIMABLE_BALANCE_NO_TRUST: +case CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED: +case CREATE_CLAIMABLE_BALANCE_UNDERFUNDED: void; }; @@ -1272,14 +1561,17 @@ enum ClaimClaimableBalanceResultCode CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3, CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4, CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5 - }; union ClaimClaimableBalanceResult switch (ClaimClaimableBalanceResultCode code) { case CLAIM_CLAIMABLE_BALANCE_SUCCESS: void; -default: +case CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST: +case CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM: +case CLAIM_CLAIMABLE_BALANCE_LINE_FULL: +case CLAIM_CLAIMABLE_BALANCE_NO_TRUST: +case CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED: void; }; @@ -1301,7 +1593,9 @@ union BeginSponsoringFutureReservesResult switch ( { case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS: void; -default: +case BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED: +case BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED: +case BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE: void; }; @@ -1321,7 +1615,7 @@ union EndSponsoringFutureReservesResult switch ( { case END_SPONSORING_FUTURE_RESERVES_SUCCESS: void; -default: +case END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED: void; }; @@ -1344,7 +1638,11 @@ union RevokeSponsorshipResult switch (RevokeSponsorshipResultCode code) { case REVOKE_SPONSORSHIP_SUCCESS: void; -default: +case REVOKE_SPONSORSHIP_DOES_NOT_EXIST: +case REVOKE_SPONSORSHIP_NOT_SPONSOR: +case REVOKE_SPONSORSHIP_LOW_RESERVE: +case REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE: +case REVOKE_SPONSORSHIP_MALFORMED: void; }; @@ -1366,7 +1664,10 @@ union ClawbackResult switch (ClawbackResultCode code) { case CLAWBACK_SUCCESS: void; -default: +case CLAWBACK_MALFORMED: +case CLAWBACK_NOT_CLAWBACK_ENABLED: +case CLAWBACK_NO_TRUST: +case CLAWBACK_UNDERFUNDED: void; }; @@ -1388,7 +1689,9 @@ union ClawbackClaimableBalanceResult switch ( { case CLAWBACK_CLAIMABLE_BALANCE_SUCCESS: void; -default: +case CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST: +case CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER: +case CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED: void; }; @@ -1412,7 +1715,11 @@ union SetTrustLineFlagsResult switch (SetTrustLineFlagsResultCode code) { case SET_TRUST_LINE_FLAGS_SUCCESS: void; -default: +case SET_TRUST_LINE_FLAGS_MALFORMED: +case SET_TRUST_LINE_FLAGS_NO_TRUST_LINE: +case SET_TRUST_LINE_FLAGS_CANT_REVOKE: +case SET_TRUST_LINE_FLAGS_INVALID_STATE: +case SET_TRUST_LINE_FLAGS_LOW_RESERVE: void; }; @@ -1441,7 +1748,13 @@ union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code) { case LIQUIDITY_POOL_DEPOSIT_SUCCESS: void; -default: +case LIQUIDITY_POOL_DEPOSIT_MALFORMED: +case LIQUIDITY_POOL_DEPOSIT_NO_TRUST: +case LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED: +case LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED: +case LIQUIDITY_POOL_DEPOSIT_LINE_FULL: +case LIQUIDITY_POOL_DEPOSIT_BAD_PRICE: +case LIQUIDITY_POOL_DEPOSIT_POOL_FULL: void; }; @@ -1467,7 +1780,78 @@ union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code) { case LIQUIDITY_POOL_WITHDRAW_SUCCESS: void; -default: +case LIQUIDITY_POOL_WITHDRAW_MALFORMED: +case LIQUIDITY_POOL_WITHDRAW_NO_TRUST: +case LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED: +case LIQUIDITY_POOL_WITHDRAW_LINE_FULL: +case LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM: + void; +}; + +enum InvokeHostFunctionResultCode +{ + // 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, + INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, + INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, + INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 +}; + +union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code) +{ +case INVOKE_HOST_FUNCTION_SUCCESS: + Hash success; // sha256(InvokeHostFunctionSuccessPreImage) +case INVOKE_HOST_FUNCTION_MALFORMED: +case INVOKE_HOST_FUNCTION_TRAPPED: +case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: +case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: +case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: + void; +}; + +enum ExtendFootprintTTLResultCode +{ + // 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, + EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 +}; + +union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code) +{ +case EXTEND_FOOTPRINT_TTL_SUCCESS: + void; +case EXTEND_FOOTPRINT_TTL_MALFORMED: +case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: +case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: + void; +}; + +enum RestoreFootprintResultCode +{ + // 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, + RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3 +}; + +union RestoreFootprintResult switch (RestoreFootprintResultCode code) +{ +case RESTORE_FOOTPRINT_SUCCESS: + void; +case RESTORE_FOOTPRINT_MALFORMED: +case RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED: +case RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE: void; }; @@ -1537,9 +1921,20 @@ case opINNER: LiquidityPoolDepositResult liquidityPoolDepositResult; case LIQUIDITY_POOL_WITHDRAW: LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; + case INVOKE_HOST_FUNCTION: + InvokeHostFunctionResult invokeHostFunctionResult; + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLResult extendFootprintTTLResult; + case RESTORE_FOOTPRINT: + RestoreFootprintResult restoreFootprintResult; } tr; -default: +case opBAD_AUTH: +case opNO_ACCOUNT: +case opNOT_SUPPORTED: +case opTOO_MANY_SUBENTRIES: +case opEXCEEDED_WORK_LIMIT: +case opTOO_MANY_SPONSORING: void; }; @@ -1562,12 +1957,12 @@ enum TransactionResultCode 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 - txBAD_MIN_SEQ_AGE_OR_GAP = - -15, // minSeqAge or minSeqLedgerGap conditions not met - txMALFORMED = -16 // precondition is invalid + txNOT_SUPPORTED = -12, // transaction type not supported + txFEE_BUMP_INNER_FAILED = -13, // fee bump inner transaction failed + txBAD_SPONSORSHIP = -14, // sponsorship not confirmed + txBAD_MIN_SEQ_AGE_OR_GAP = -15, // minSeqAge or minSeqLedgerGap conditions not met + txMALFORMED = -16, // precondition is invalid + txSOROBAN_INVALID = -17 // soroban-specific preconditions were not met }; // InnerTransactionResult must be binary compatible with TransactionResult @@ -1598,6 +1993,7 @@ struct InnerTransactionResult case txBAD_SPONSORSHIP: case txBAD_MIN_SEQ_AGE_OR_GAP: case txMALFORMED: + case txSOROBAN_INVALID: void; } result; @@ -1629,7 +2025,22 @@ struct TransactionResult case txSUCCESS: case txFAILED: OperationResult results<>; - default: + case txTOO_EARLY: + case txTOO_LATE: + case txMISSING_OPERATION: + case txBAD_SEQ: + case txBAD_AUTH: + case txINSUFFICIENT_BALANCE: + case txNO_ACCOUNT: + case txINSUFFICIENT_FEE: + case txBAD_AUTH_EXTRA: + case txINTERNAL_ERROR: + case txNOT_SUPPORTED: + // case txFEE_BUMP_INNER_FAILED: handled above + case txBAD_SPONSORSHIP: + case txBAD_MIN_SEQ_AGE_OR_GAP: + case txMALFORMED: + case txSOROBAN_INVALID: void; } result; diff --git a/stellar-dotnet-sdk-xdr/Stellar-types.x b/stellar-dotnet-sdk-xdr/Stellar-types.x index c3a1ebe2..d71bf0d4 100644 --- a/stellar-dotnet-sdk-xdr/Stellar-types.x +++ b/stellar-dotnet-sdk-xdr/Stellar-types.x @@ -14,6 +14,9 @@ typedef int int32; typedef unsigned hyper uint64; typedef hyper int64; +typedef uint64 TimePoint; +typedef uint64 Duration; + // An ExtensionPoint is always marshaled as a 32-bit 0 value. At a // later point, it can be replaced by a different union so as to // extend a structure. @@ -79,6 +82,7 @@ typedef opaque Signature<64>; typedef opaque SignatureHint[4]; typedef PublicKey NodeID; +typedef PublicKey AccountID; struct Curve25519Secret { diff --git a/stellar-dotnet-sdk-xdr/generate.sh b/stellar-dotnet-sdk-xdr/generate.sh new file mode 100755 index 00000000..85133183 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generate.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Store the current ulimit +original_ulimit=$(ulimit -n) +echo "Original ulimit: $original_ulimit" + +# Set the new ulimit +ulimit -n 4096 +echo "New ulimit: $(ulimit -n)" + +# Run the xdrgen command +sudo xdrgen -o ./generated *.x --language=csharp --namespace=stellar_dotnet_sdk.xdr +echo "Ran xdrgen command" + +# Reset the ulimit to its original value +ulimit -n "$original_ulimit" +echo "Reset ulimit to original value: $original_ulimit" \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AccountEntry.cs b/stellar-dotnet-sdk-xdr/generated/AccountEntry.cs index d0efc27f..d5de7c47 100644 --- a/stellar-dotnet-sdk-xdr/generated/AccountEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/AccountEntry.cs @@ -1,142 +1,131 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // struct AccountEntry - // { - // AccountID accountID; // master public key for this account - // int64 balance; // in stroops - // SequenceNumber seqNum; // last sequence number used for this account - // uint32 numSubEntries; // number of sub-entries this account has - // // 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 - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // case 1: - // AccountEntryExtensionV1 v1; - // } - // ext; - // }; +// struct AccountEntry +// { +// AccountID accountID; // master public key for this account +// int64 balance; // in stroops +// SequenceNumber seqNum; // last sequence number used for this account +// uint32 numSubEntries; // number of sub-entries this account has +// // 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 +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// AccountEntryExtensionV1 v1; +// } +// ext; +// }; - // =========================================================================== - public class AccountEntry - { - public AccountEntry() { } - public AccountID AccountID { get; set; } - public Int64 Balance { get; set; } - public SequenceNumber SeqNum { get; set; } - public Uint32 NumSubEntries { get; set; } - public AccountID InflationDest { get; set; } - public Uint32 Flags { get; set; } - public String32 HomeDomain { get; set; } - public Thresholds Thresholds { get; set; } - public Signer[] Signers { get; set; } - public AccountEntryExt Ext { get; set; } +// =========================================================================== +public class AccountEntry +{ + public AccountID AccountID { get; set; } + public Int64 Balance { get; set; } + public SequenceNumber SeqNum { get; set; } + public Uint32 NumSubEntries { get; set; } + public AccountID InflationDest { get; set; } + public Uint32 Flags { get; set; } + public String32 HomeDomain { get; set; } + public Thresholds Thresholds { get; set; } + public Signer[] Signers { get; set; } + public AccountEntryExt Ext { get; set; } - public static void Encode(XdrDataOutputStream stream, AccountEntry encodedAccountEntry) + public static void Encode(XdrDataOutputStream stream, AccountEntry encodedAccountEntry) + { + AccountID.Encode(stream, encodedAccountEntry.AccountID); + Int64.Encode(stream, encodedAccountEntry.Balance); + SequenceNumber.Encode(stream, encodedAccountEntry.SeqNum); + Uint32.Encode(stream, encodedAccountEntry.NumSubEntries); + if (encodedAccountEntry.InflationDest != null) { - AccountID.Encode(stream, encodedAccountEntry.AccountID); - Int64.Encode(stream, encodedAccountEntry.Balance); - SequenceNumber.Encode(stream, encodedAccountEntry.SeqNum); - Uint32.Encode(stream, encodedAccountEntry.NumSubEntries); - if (encodedAccountEntry.InflationDest != null) - { - stream.WriteInt(1); - AccountID.Encode(stream, encodedAccountEntry.InflationDest); - } - else - { - stream.WriteInt(0); - } - Uint32.Encode(stream, encodedAccountEntry.Flags); - String32.Encode(stream, encodedAccountEntry.HomeDomain); - Thresholds.Encode(stream, encodedAccountEntry.Thresholds); - int signerssize = encodedAccountEntry.Signers.Length; - stream.WriteInt(signerssize); - for (int i = 0; i < signerssize; i++) - { - Signer.Encode(stream, encodedAccountEntry.Signers[i]); - } - AccountEntryExt.Encode(stream, encodedAccountEntry.Ext); + stream.WriteInt(1); + AccountID.Encode(stream, encodedAccountEntry.InflationDest); } - public static AccountEntry Decode(XdrDataInputStream stream) + else { - AccountEntry decodedAccountEntry = new AccountEntry(); - decodedAccountEntry.AccountID = AccountID.Decode(stream); - decodedAccountEntry.Balance = Int64.Decode(stream); - decodedAccountEntry.SeqNum = SequenceNumber.Decode(stream); - decodedAccountEntry.NumSubEntries = Uint32.Decode(stream); - int InflationDestPresent = stream.ReadInt(); - if (InflationDestPresent != 0) - { - decodedAccountEntry.InflationDest = AccountID.Decode(stream); - } - decodedAccountEntry.Flags = Uint32.Decode(stream); - decodedAccountEntry.HomeDomain = String32.Decode(stream); - decodedAccountEntry.Thresholds = Thresholds.Decode(stream); - int signerssize = stream.ReadInt(); - decodedAccountEntry.Signers = new Signer[signerssize]; - for (int i = 0; i < signerssize; i++) - { - decodedAccountEntry.Signers[i] = Signer.Decode(stream); - } - decodedAccountEntry.Ext = AccountEntryExt.Decode(stream); - return decodedAccountEntry; + stream.WriteInt(0); } - public class AccountEntryExt - { - public AccountEntryExt() { } + Uint32.Encode(stream, encodedAccountEntry.Flags); + String32.Encode(stream, encodedAccountEntry.HomeDomain); + Thresholds.Encode(stream, encodedAccountEntry.Thresholds); + var signerssize = encodedAccountEntry.Signers.Length; + stream.WriteInt(signerssize); + for (var i = 0; i < signerssize; i++) Signer.Encode(stream, encodedAccountEntry.Signers[i]); + AccountEntryExt.Encode(stream, encodedAccountEntry.Ext); + } + + public static AccountEntry Decode(XdrDataInputStream stream) + { + var decodedAccountEntry = new AccountEntry(); + decodedAccountEntry.AccountID = AccountID.Decode(stream); + decodedAccountEntry.Balance = Int64.Decode(stream); + decodedAccountEntry.SeqNum = SequenceNumber.Decode(stream); + decodedAccountEntry.NumSubEntries = Uint32.Decode(stream); + var InflationDestPresent = stream.ReadInt(); + if (InflationDestPresent != 0) decodedAccountEntry.InflationDest = AccountID.Decode(stream); + decodedAccountEntry.Flags = Uint32.Decode(stream); + decodedAccountEntry.HomeDomain = String32.Decode(stream); + decodedAccountEntry.Thresholds = Thresholds.Decode(stream); + var signerssize = stream.ReadInt(); + decodedAccountEntry.Signers = new Signer[signerssize]; + for (var i = 0; i < signerssize; i++) decodedAccountEntry.Signers[i] = Signer.Decode(stream); + decodedAccountEntry.Ext = AccountEntryExt.Decode(stream); + return decodedAccountEntry; + } - public int Discriminant { get; set; } = new int(); + public class AccountEntryExt + { + public int Discriminant { get; set; } + + public AccountEntryExtensionV1 V1 { get; set; } - public AccountEntryExtensionV1 V1 { get; set; } - public static void Encode(XdrDataOutputStream stream, AccountEntryExt encodedAccountEntryExt) + public static void Encode(XdrDataOutputStream stream, AccountEntryExt encodedAccountEntryExt) + { + stream.WriteInt(encodedAccountEntryExt.Discriminant); + switch (encodedAccountEntryExt.Discriminant) { - stream.WriteInt((int)encodedAccountEntryExt.Discriminant); - switch (encodedAccountEntryExt.Discriminant) - { - case 0: - break; - case 1: - AccountEntryExtensionV1.Encode(stream, encodedAccountEntryExt.V1); - break; - } + case 0: + break; + case 1: + AccountEntryExtensionV1.Encode(stream, encodedAccountEntryExt.V1); + break; } - public static AccountEntryExt Decode(XdrDataInputStream stream) + } + + public static AccountEntryExt Decode(XdrDataInputStream stream) + { + var decodedAccountEntryExt = new AccountEntryExt(); + var discriminant = stream.ReadInt(); + decodedAccountEntryExt.Discriminant = discriminant; + switch (decodedAccountEntryExt.Discriminant) { - AccountEntryExt decodedAccountEntryExt = new AccountEntryExt(); - int discriminant = stream.ReadInt(); - decodedAccountEntryExt.Discriminant = discriminant; - switch (decodedAccountEntryExt.Discriminant) - { - case 0: - break; - case 1: - decodedAccountEntryExt.V1 = AccountEntryExtensionV1.Decode(stream); - break; - } - return decodedAccountEntryExt; + case 0: + break; + case 1: + decodedAccountEntryExt.V1 = AccountEntryExtensionV1.Decode(stream); + break; } + return decodedAccountEntryExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV1.cs b/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV1.cs index ab1afea9..cb6af49a 100644 --- a/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV1.cs +++ b/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV1.cs @@ -1,81 +1,79 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct AccountEntryExtensionV1 +// { +// Liabilities liabilities; +// +// union switch (int v) +// { +// case 0: +// void; +// case 2: +// AccountEntryExtensionV2 v2; +// } +// ext; +// }; - // struct AccountEntryExtensionV1 - // { - // Liabilities liabilities; - // - // union switch (int v) - // { - // case 0: - // void; - // case 2: - // AccountEntryExtensionV2 v2; - // } - // ext; - // }; +// =========================================================================== +public class AccountEntryExtensionV1 +{ + public Liabilities Liabilities { get; set; } + public AccountEntryExtensionV1Ext Ext { get; set; } - // =========================================================================== - public class AccountEntryExtensionV1 + public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV1 encodedAccountEntryExtensionV1) { - public AccountEntryExtensionV1() { } - public Liabilities Liabilities { get; set; } - public AccountEntryExtensionV1Ext Ext { get; set; } + Liabilities.Encode(stream, encodedAccountEntryExtensionV1.Liabilities); + AccountEntryExtensionV1Ext.Encode(stream, encodedAccountEntryExtensionV1.Ext); + } - public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV1 encodedAccountEntryExtensionV1) - { - Liabilities.Encode(stream, encodedAccountEntryExtensionV1.Liabilities); - AccountEntryExtensionV1Ext.Encode(stream, encodedAccountEntryExtensionV1.Ext); - } - public static AccountEntryExtensionV1 Decode(XdrDataInputStream stream) - { - AccountEntryExtensionV1 decodedAccountEntryExtensionV1 = new AccountEntryExtensionV1(); - decodedAccountEntryExtensionV1.Liabilities = Liabilities.Decode(stream); - decodedAccountEntryExtensionV1.Ext = AccountEntryExtensionV1Ext.Decode(stream); - return decodedAccountEntryExtensionV1; - } + public static AccountEntryExtensionV1 Decode(XdrDataInputStream stream) + { + var decodedAccountEntryExtensionV1 = new AccountEntryExtensionV1(); + decodedAccountEntryExtensionV1.Liabilities = Liabilities.Decode(stream); + decodedAccountEntryExtensionV1.Ext = AccountEntryExtensionV1Ext.Decode(stream); + return decodedAccountEntryExtensionV1; + } - public class AccountEntryExtensionV1Ext - { - public AccountEntryExtensionV1Ext() { } + public class AccountEntryExtensionV1Ext + { + public int Discriminant { get; set; } - public int Discriminant { get; set; } = new int(); + public AccountEntryExtensionV2 V2 { get; set; } - public AccountEntryExtensionV2 V2 { get; set; } - public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV1Ext encodedAccountEntryExtensionV1Ext) + public static void Encode(XdrDataOutputStream stream, + AccountEntryExtensionV1Ext encodedAccountEntryExtensionV1Ext) + { + stream.WriteInt(encodedAccountEntryExtensionV1Ext.Discriminant); + switch (encodedAccountEntryExtensionV1Ext.Discriminant) { - stream.WriteInt((int)encodedAccountEntryExtensionV1Ext.Discriminant); - switch (encodedAccountEntryExtensionV1Ext.Discriminant) - { - case 0: - break; - case 2: - AccountEntryExtensionV2.Encode(stream, encodedAccountEntryExtensionV1Ext.V2); - break; - } + case 0: + break; + case 2: + AccountEntryExtensionV2.Encode(stream, encodedAccountEntryExtensionV1Ext.V2); + break; } - public static AccountEntryExtensionV1Ext Decode(XdrDataInputStream stream) + } + + public static AccountEntryExtensionV1Ext Decode(XdrDataInputStream stream) + { + var decodedAccountEntryExtensionV1Ext = new AccountEntryExtensionV1Ext(); + var discriminant = stream.ReadInt(); + decodedAccountEntryExtensionV1Ext.Discriminant = discriminant; + switch (decodedAccountEntryExtensionV1Ext.Discriminant) { - AccountEntryExtensionV1Ext decodedAccountEntryExtensionV1Ext = new AccountEntryExtensionV1Ext(); - int discriminant = stream.ReadInt(); - decodedAccountEntryExtensionV1Ext.Discriminant = discriminant; - switch (decodedAccountEntryExtensionV1Ext.Discriminant) - { - case 0: - break; - case 2: - decodedAccountEntryExtensionV1Ext.V2 = AccountEntryExtensionV2.Decode(stream); - break; - } - return decodedAccountEntryExtensionV1Ext; + case 0: + break; + case 2: + decodedAccountEntryExtensionV1Ext.V2 = AccountEntryExtensionV2.Decode(stream); + break; } + return decodedAccountEntryExtensionV1Ext; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV2.cs b/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV2.cs index 46986818..9b56c0b7 100644 --- a/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV2.cs +++ b/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV2.cs @@ -1,99 +1,93 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct AccountEntryExtensionV2 +// { +// uint32 numSponsored; +// uint32 numSponsoring; +// SponsorshipDescriptor signerSponsoringIDs; +// +// union switch (int v) +// { +// case 0: +// void; +// case 3: +// AccountEntryExtensionV3 v3; +// } +// ext; +// }; + +// =========================================================================== +public class AccountEntryExtensionV2 { + public Uint32 NumSponsored { get; set; } + public Uint32 NumSponsoring { get; set; } + public SponsorshipDescriptor[] SignerSponsoringIDs { get; set; } + public AccountEntryExtensionV2Ext Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV2 encodedAccountEntryExtensionV2) + { + Uint32.Encode(stream, encodedAccountEntryExtensionV2.NumSponsored); + Uint32.Encode(stream, encodedAccountEntryExtensionV2.NumSponsoring); + var signerSponsoringIDssize = encodedAccountEntryExtensionV2.SignerSponsoringIDs.Length; + stream.WriteInt(signerSponsoringIDssize); + for (var i = 0; i < signerSponsoringIDssize; i++) + SponsorshipDescriptor.Encode(stream, encodedAccountEntryExtensionV2.SignerSponsoringIDs[i]); + AccountEntryExtensionV2Ext.Encode(stream, encodedAccountEntryExtensionV2.Ext); + } - // struct AccountEntryExtensionV2 - // { - // uint32 numSponsored; - // uint32 numSponsoring; - // SponsorshipDescriptor signerSponsoringIDs; - // - // union switch (int v) - // { - // case 0: - // void; - // case 3: - // AccountEntryExtensionV3 v3; - // } - // ext; - // }; + public static AccountEntryExtensionV2 Decode(XdrDataInputStream stream) + { + var decodedAccountEntryExtensionV2 = new AccountEntryExtensionV2(); + decodedAccountEntryExtensionV2.NumSponsored = Uint32.Decode(stream); + decodedAccountEntryExtensionV2.NumSponsoring = Uint32.Decode(stream); + var signerSponsoringIDssize = stream.ReadInt(); + decodedAccountEntryExtensionV2.SignerSponsoringIDs = new SponsorshipDescriptor[signerSponsoringIDssize]; + for (var i = 0; i < signerSponsoringIDssize; i++) + decodedAccountEntryExtensionV2.SignerSponsoringIDs[i] = SponsorshipDescriptor.Decode(stream); + decodedAccountEntryExtensionV2.Ext = AccountEntryExtensionV2Ext.Decode(stream); + return decodedAccountEntryExtensionV2; + } - // =========================================================================== - public class AccountEntryExtensionV2 + public class AccountEntryExtensionV2Ext { - public AccountEntryExtensionV2() { } - public Uint32 NumSponsored { get; set; } - public Uint32 NumSponsoring { get; set; } - public SponsorshipDescriptor[] SignerSponsoringIDs { get; set; } - public AccountEntryExtensionV2Ext Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV2 encodedAccountEntryExtensionV2) - { - Uint32.Encode(stream, encodedAccountEntryExtensionV2.NumSponsored); - Uint32.Encode(stream, encodedAccountEntryExtensionV2.NumSponsoring); - int signerSponsoringIDssize = encodedAccountEntryExtensionV2.SignerSponsoringIDs.Length; - stream.WriteInt(signerSponsoringIDssize); - for (int i = 0; i < signerSponsoringIDssize; i++) - { - SponsorshipDescriptor.Encode(stream, encodedAccountEntryExtensionV2.SignerSponsoringIDs[i]); - } - AccountEntryExtensionV2Ext.Encode(stream, encodedAccountEntryExtensionV2.Ext); - } - public static AccountEntryExtensionV2 Decode(XdrDataInputStream stream) + public AccountEntryExtensionV3 V3 { get; set; } + + public static void Encode(XdrDataOutputStream stream, + AccountEntryExtensionV2Ext encodedAccountEntryExtensionV2Ext) { - AccountEntryExtensionV2 decodedAccountEntryExtensionV2 = new AccountEntryExtensionV2(); - decodedAccountEntryExtensionV2.NumSponsored = Uint32.Decode(stream); - decodedAccountEntryExtensionV2.NumSponsoring = Uint32.Decode(stream); - int signerSponsoringIDssize = stream.ReadInt(); - decodedAccountEntryExtensionV2.SignerSponsoringIDs = new SponsorshipDescriptor[signerSponsoringIDssize]; - for (int i = 0; i < signerSponsoringIDssize; i++) + stream.WriteInt(encodedAccountEntryExtensionV2Ext.Discriminant); + switch (encodedAccountEntryExtensionV2Ext.Discriminant) { - decodedAccountEntryExtensionV2.SignerSponsoringIDs[i] = SponsorshipDescriptor.Decode(stream); + case 0: + break; + case 3: + AccountEntryExtensionV3.Encode(stream, encodedAccountEntryExtensionV2Ext.V3); + break; } - decodedAccountEntryExtensionV2.Ext = AccountEntryExtensionV2Ext.Decode(stream); - return decodedAccountEntryExtensionV2; } - public class AccountEntryExtensionV2Ext + public static AccountEntryExtensionV2Ext Decode(XdrDataInputStream stream) { - public AccountEntryExtensionV2Ext() { } - - public int Discriminant { get; set; } = new int(); - - public AccountEntryExtensionV3 V3 { get; set; } - public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV2Ext encodedAccountEntryExtensionV2Ext) - { - stream.WriteInt((int)encodedAccountEntryExtensionV2Ext.Discriminant); - switch (encodedAccountEntryExtensionV2Ext.Discriminant) - { - case 0: - break; - case 3: - AccountEntryExtensionV3.Encode(stream, encodedAccountEntryExtensionV2Ext.V3); - break; - } - } - public static AccountEntryExtensionV2Ext Decode(XdrDataInputStream stream) + var decodedAccountEntryExtensionV2Ext = new AccountEntryExtensionV2Ext(); + var discriminant = stream.ReadInt(); + decodedAccountEntryExtensionV2Ext.Discriminant = discriminant; + switch (decodedAccountEntryExtensionV2Ext.Discriminant) { - AccountEntryExtensionV2Ext decodedAccountEntryExtensionV2Ext = new AccountEntryExtensionV2Ext(); - int discriminant = stream.ReadInt(); - decodedAccountEntryExtensionV2Ext.Discriminant = discriminant; - switch (decodedAccountEntryExtensionV2Ext.Discriminant) - { - case 0: - break; - case 3: - decodedAccountEntryExtensionV2Ext.V3 = AccountEntryExtensionV3.Decode(stream); - break; - } - return decodedAccountEntryExtensionV2Ext; + case 0: + break; + case 3: + decodedAccountEntryExtensionV2Ext.V3 = AccountEntryExtensionV3.Decode(stream); + break; } + return decodedAccountEntryExtensionV2Ext; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV3.cs b/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV3.cs index 7fc33a6a..93fe690f 100644 --- a/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV3.cs +++ b/stellar-dotnet-sdk-xdr/generated/AccountEntryExtensionV3.cs @@ -1,46 +1,43 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct AccountEntryExtensionV3 +// { +// // 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; +// }; - // struct AccountEntryExtensionV3 - // { - // // 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; - // }; +// =========================================================================== +public class AccountEntryExtensionV3 +{ + public ExtensionPoint Ext { get; set; } + public Uint32 SeqLedger { get; set; } + public TimePoint SeqTime { get; set; } - // =========================================================================== - public class AccountEntryExtensionV3 + public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV3 encodedAccountEntryExtensionV3) { - public AccountEntryExtensionV3() { } - public ExtensionPoint Ext { get; set; } - public Uint32 SeqLedger { get; set; } - public TimePoint SeqTime { get; set; } + ExtensionPoint.Encode(stream, encodedAccountEntryExtensionV3.Ext); + Uint32.Encode(stream, encodedAccountEntryExtensionV3.SeqLedger); + TimePoint.Encode(stream, encodedAccountEntryExtensionV3.SeqTime); + } - public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV3 encodedAccountEntryExtensionV3) - { - ExtensionPoint.Encode(stream, encodedAccountEntryExtensionV3.Ext); - Uint32.Encode(stream, encodedAccountEntryExtensionV3.SeqLedger); - TimePoint.Encode(stream, encodedAccountEntryExtensionV3.SeqTime); - } - public static AccountEntryExtensionV3 Decode(XdrDataInputStream stream) - { - AccountEntryExtensionV3 decodedAccountEntryExtensionV3 = new AccountEntryExtensionV3(); - decodedAccountEntryExtensionV3.Ext = ExtensionPoint.Decode(stream); - decodedAccountEntryExtensionV3.SeqLedger = Uint32.Decode(stream); - decodedAccountEntryExtensionV3.SeqTime = TimePoint.Decode(stream); - return decodedAccountEntryExtensionV3; - } + public static AccountEntryExtensionV3 Decode(XdrDataInputStream stream) + { + var decodedAccountEntryExtensionV3 = new AccountEntryExtensionV3(); + decodedAccountEntryExtensionV3.Ext = ExtensionPoint.Decode(stream); + decodedAccountEntryExtensionV3.SeqLedger = Uint32.Decode(stream); + decodedAccountEntryExtensionV3.SeqTime = TimePoint.Decode(stream); + return decodedAccountEntryExtensionV3; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AccountFlags.cs b/stellar-dotnet-sdk-xdr/generated/AccountFlags.cs index c3852862..d7b962d0 100644 --- a/stellar-dotnet-sdk-xdr/generated/AccountFlags.cs +++ b/stellar-dotnet-sdk-xdr/generated/AccountFlags.cs @@ -1,67 +1,67 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // 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 - // AUTH_REQUIRED_FLAG = 0x1, - // // If set, the authorized flag in TrustLines can be cleared - // // otherwise, authorization cannot be revoked - // AUTH_REVOCABLE_FLAG = 0x2, - // // Once set, causes all AUTH_* flags to be read-only - // AUTH_IMMUTABLE_FLAG = 0x4, - // // Trustlines are created with clawback enabled set to "true", - // // and claimable balances created from those trustlines are created - // // with clawback enabled set to "true" - // AUTH_CLAWBACK_ENABLED_FLAG = 0x8 - // }; +// 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 +// AUTH_REQUIRED_FLAG = 0x1, +// // If set, the authorized flag in TrustLines can be cleared +// // otherwise, authorization cannot be revoked +// AUTH_REVOCABLE_FLAG = 0x2, +// // Once set, causes all AUTH_* flags to be read-only +// AUTH_IMMUTABLE_FLAG = 0x4, +// // Trustlines are created with clawback enabled set to "true", +// // and claimable balances created from those trustlines are created +// // with clawback enabled set to "true" +// AUTH_CLAWBACK_ENABLED_FLAG = 0x8 +// }; - // =========================================================================== - public class AccountFlags +// =========================================================================== +public class AccountFlags +{ + public enum AccountFlagsEnum { - public enum AccountFlagsEnum - { - AUTH_REQUIRED_FLAG = 1, - AUTH_REVOCABLE_FLAG = 2, - AUTH_IMMUTABLE_FLAG = 4, - AUTH_CLAWBACK_ENABLED_FLAG = 8, - } - public AccountFlagsEnum InnerValue { get; set; } = default(AccountFlagsEnum); + AUTH_REQUIRED_FLAG = 1, + AUTH_REVOCABLE_FLAG = 2, + AUTH_IMMUTABLE_FLAG = 4, + AUTH_CLAWBACK_ENABLED_FLAG = 8 + } - public static AccountFlags Create(AccountFlagsEnum v) - { - return new AccountFlags - { - InnerValue = v - }; - } + public AccountFlagsEnum InnerValue { get; set; } = default; - public static AccountFlags Decode(XdrDataInputStream stream) + public static AccountFlags Create(AccountFlagsEnum v) + { + return new AccountFlags { - int value = stream.ReadInt(); - switch (value) - { - case 1: return Create(AccountFlagsEnum.AUTH_REQUIRED_FLAG); - case 2: return Create(AccountFlagsEnum.AUTH_REVOCABLE_FLAG); - case 4: return Create(AccountFlagsEnum.AUTH_IMMUTABLE_FLAG); - case 8: return Create(AccountFlagsEnum.AUTH_CLAWBACK_ENABLED_FLAG); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, AccountFlags value) + public static AccountFlags Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 1: return Create(AccountFlagsEnum.AUTH_REQUIRED_FLAG); + case 2: return Create(AccountFlagsEnum.AUTH_REVOCABLE_FLAG); + case 4: return Create(AccountFlagsEnum.AUTH_IMMUTABLE_FLAG); + case 8: return Create(AccountFlagsEnum.AUTH_CLAWBACK_ENABLED_FLAG); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, AccountFlags value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AccountID.cs b/stellar-dotnet-sdk-xdr/generated/AccountID.cs index 7f39f94c..3f967d13 100644 --- a/stellar-dotnet-sdk-xdr/generated/AccountID.cs +++ b/stellar-dotnet-sdk-xdr/generated/AccountID.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef PublicKey AccountID; + +// =========================================================================== +public class AccountID { + public AccountID() + { + } - // === xdr source ============================================================ + public AccountID(PublicKey value) + { + InnerValue = value; + } + + public PublicKey InnerValue { get; set; } = default; - // typedef PublicKey AccountID; + public static void Encode(XdrDataOutputStream stream, AccountID encodedAccountID) + { + PublicKey.Encode(stream, encodedAccountID.InnerValue); + } - // =========================================================================== - public class AccountID + public static AccountID Decode(XdrDataInputStream stream) { - public PublicKey InnerValue { get; set; } = default(PublicKey); - - public AccountID() { } - - public AccountID(PublicKey value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, AccountID encodedAccountID) - { - PublicKey.Encode(stream, encodedAccountID.InnerValue); - } - public static AccountID Decode(XdrDataInputStream stream) - { - AccountID decodedAccountID = new AccountID(); - decodedAccountID.InnerValue = PublicKey.Decode(stream); - return decodedAccountID; - } + var decodedAccountID = new AccountID(); + decodedAccountID.InnerValue = PublicKey.Decode(stream); + return decodedAccountID; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AccountMergeResult.cs b/stellar-dotnet-sdk-xdr/generated/AccountMergeResult.cs index 1db632ca..d552d7be 100644 --- a/stellar-dotnet-sdk-xdr/generated/AccountMergeResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/AccountMergeResult.cs @@ -1,54 +1,70 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union AccountMergeResult switch (AccountMergeResultCode code) - // { - // case ACCOUNT_MERGE_SUCCESS: - // int64 sourceAccountBalance; // how much got transferred from source account - // default: - // void; - // }; +// union AccountMergeResult switch (AccountMergeResultCode code) +// { +// case ACCOUNT_MERGE_SUCCESS: +// int64 sourceAccountBalance; // how much got transferred from source account +// case ACCOUNT_MERGE_MALFORMED: +// case ACCOUNT_MERGE_NO_ACCOUNT: +// case ACCOUNT_MERGE_IMMUTABLE_SET: +// case ACCOUNT_MERGE_HAS_SUB_ENTRIES: +// case ACCOUNT_MERGE_SEQNUM_TOO_FAR: +// case ACCOUNT_MERGE_DEST_FULL: +// case ACCOUNT_MERGE_IS_SPONSOR: +// void; +// }; - // =========================================================================== - public class AccountMergeResult - { - public AccountMergeResult() { } +// =========================================================================== +public class AccountMergeResult +{ + public AccountMergeResultCode Discriminant { get; set; } = new(); - public AccountMergeResultCode Discriminant { get; set; } = new AccountMergeResultCode(); + public Int64 SourceAccountBalance { get; set; } - public Int64 SourceAccountBalance { get; set; } - public static void Encode(XdrDataOutputStream stream, AccountMergeResult encodedAccountMergeResult) + public static void Encode(XdrDataOutputStream stream, AccountMergeResult encodedAccountMergeResult) + { + stream.WriteInt((int)encodedAccountMergeResult.Discriminant.InnerValue); + switch (encodedAccountMergeResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedAccountMergeResult.Discriminant.InnerValue); - switch (encodedAccountMergeResult.Discriminant.InnerValue) - { - case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS: - Int64.Encode(stream, encodedAccountMergeResult.SourceAccountBalance); - break; - default: - break; - } + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS: + Int64.Encode(stream, encodedAccountMergeResult.SourceAccountBalance); + break; + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_MALFORMED: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_NO_ACCOUNT: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_IMMUTABLE_SET: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_HAS_SUB_ENTRIES: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SEQNUM_TOO_FAR: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_DEST_FULL: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_IS_SPONSOR: + break; } - public static AccountMergeResult Decode(XdrDataInputStream stream) + } + + public static AccountMergeResult Decode(XdrDataInputStream stream) + { + var decodedAccountMergeResult = new AccountMergeResult(); + var discriminant = AccountMergeResultCode.Decode(stream); + decodedAccountMergeResult.Discriminant = discriminant; + switch (decodedAccountMergeResult.Discriminant.InnerValue) { - AccountMergeResult decodedAccountMergeResult = new AccountMergeResult(); - AccountMergeResultCode discriminant = AccountMergeResultCode.Decode(stream); - decodedAccountMergeResult.Discriminant = discriminant; - switch (decodedAccountMergeResult.Discriminant.InnerValue) - { - case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS: - decodedAccountMergeResult.SourceAccountBalance = Int64.Decode(stream); - break; - default: - break; - } - return decodedAccountMergeResult; + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS: + decodedAccountMergeResult.SourceAccountBalance = Int64.Decode(stream); + break; + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_MALFORMED: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_NO_ACCOUNT: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_IMMUTABLE_SET: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_HAS_SUB_ENTRIES: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SEQNUM_TOO_FAR: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_DEST_FULL: + case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_IS_SPONSOR: + break; } + + return decodedAccountMergeResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AccountMergeResultCode.cs b/stellar-dotnet-sdk-xdr/generated/AccountMergeResultCode.cs index 4078fac1..2a19bace 100644 --- a/stellar-dotnet-sdk-xdr/generated/AccountMergeResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/AccountMergeResultCode.cs @@ -1,72 +1,72 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum AccountMergeResultCode - // { - // // codes considered as "success" for the operation - // ACCOUNT_MERGE_SUCCESS = 0, - // // codes considered as "failure" for the operation - // ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself - // ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist - // ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set - // ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers - // ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, // sequence number is over max allowed - // ACCOUNT_MERGE_DEST_FULL = -6, // can't add source balance to - // // destination balance - // ACCOUNT_MERGE_IS_SPONSOR = -7 // can't merge account that is a sponsor - // }; +// enum AccountMergeResultCode +// { +// // codes considered as "success" for the operation +// ACCOUNT_MERGE_SUCCESS = 0, +// // codes considered as "failure" for the operation +// ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself +// ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist +// ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set +// ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers +// ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, // sequence number is over max allowed +// ACCOUNT_MERGE_DEST_FULL = -6, // can't add source balance to +// // destination balance +// ACCOUNT_MERGE_IS_SPONSOR = -7 // can't merge account that is a sponsor +// }; - // =========================================================================== - public class AccountMergeResultCode +// =========================================================================== +public class AccountMergeResultCode +{ + public enum AccountMergeResultCodeEnum { - public enum AccountMergeResultCodeEnum - { - ACCOUNT_MERGE_SUCCESS = 0, - ACCOUNT_MERGE_MALFORMED = -1, - ACCOUNT_MERGE_NO_ACCOUNT = -2, - ACCOUNT_MERGE_IMMUTABLE_SET = -3, - ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, - ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, - ACCOUNT_MERGE_DEST_FULL = -6, - ACCOUNT_MERGE_IS_SPONSOR = -7, - } - public AccountMergeResultCodeEnum InnerValue { get; set; } = default(AccountMergeResultCodeEnum); + ACCOUNT_MERGE_SUCCESS = 0, + ACCOUNT_MERGE_MALFORMED = -1, + ACCOUNT_MERGE_NO_ACCOUNT = -2, + ACCOUNT_MERGE_IMMUTABLE_SET = -3, + ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, + ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, + ACCOUNT_MERGE_DEST_FULL = -6, + ACCOUNT_MERGE_IS_SPONSOR = -7 + } - public static AccountMergeResultCode Create(AccountMergeResultCodeEnum v) - { - return new AccountMergeResultCode - { - InnerValue = v - }; - } + public AccountMergeResultCodeEnum InnerValue { get; set; } = default; - public static AccountMergeResultCode Decode(XdrDataInputStream stream) + public static AccountMergeResultCode Create(AccountMergeResultCodeEnum v) + { + return new AccountMergeResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS); - case -1: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_MALFORMED); - case -2: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_NO_ACCOUNT); - case -3: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_IMMUTABLE_SET); - case -4: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_HAS_SUB_ENTRIES); - case -5: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_SEQNUM_TOO_FAR); - case -6: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_DEST_FULL); - case -7: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_IS_SPONSOR); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, AccountMergeResultCode value) + public static AccountMergeResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS); + case -1: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_MALFORMED); + case -2: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_NO_ACCOUNT); + case -3: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_IMMUTABLE_SET); + case -4: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_HAS_SUB_ENTRIES); + case -5: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_SEQNUM_TOO_FAR); + case -6: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_DEST_FULL); + case -7: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_IS_SPONSOR); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, AccountMergeResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AllowTrustOp.cs b/stellar-dotnet-sdk-xdr/generated/AllowTrustOp.cs index da0bacb1..4936f51c 100644 --- a/stellar-dotnet-sdk-xdr/generated/AllowTrustOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/AllowTrustOp.cs @@ -1,42 +1,39 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct AllowTrustOp +// { +// AccountID trustor; +// AssetCode asset; +// +// // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG +// uint32 authorize; +// }; - // struct AllowTrustOp - // { - // AccountID trustor; - // AssetCode asset; - // - // // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG - // uint32 authorize; - // }; +// =========================================================================== +public class AllowTrustOp +{ + public AccountID Trustor { get; set; } + public AssetCode Asset { get; set; } + public Uint32 Authorize { get; set; } - // =========================================================================== - public class AllowTrustOp + public static void Encode(XdrDataOutputStream stream, AllowTrustOp encodedAllowTrustOp) { - public AllowTrustOp() { } - public AccountID Trustor { get; set; } - public AssetCode Asset { get; set; } - public Uint32 Authorize { get; set; } + AccountID.Encode(stream, encodedAllowTrustOp.Trustor); + AssetCode.Encode(stream, encodedAllowTrustOp.Asset); + Uint32.Encode(stream, encodedAllowTrustOp.Authorize); + } - public static void Encode(XdrDataOutputStream stream, AllowTrustOp encodedAllowTrustOp) - { - AccountID.Encode(stream, encodedAllowTrustOp.Trustor); - AssetCode.Encode(stream, encodedAllowTrustOp.Asset); - Uint32.Encode(stream, encodedAllowTrustOp.Authorize); - } - public static AllowTrustOp Decode(XdrDataInputStream stream) - { - AllowTrustOp decodedAllowTrustOp = new AllowTrustOp(); - decodedAllowTrustOp.Trustor = AccountID.Decode(stream); - decodedAllowTrustOp.Asset = AssetCode.Decode(stream); - decodedAllowTrustOp.Authorize = Uint32.Decode(stream); - return decodedAllowTrustOp; - } + public static AllowTrustOp Decode(XdrDataInputStream stream) + { + var decodedAllowTrustOp = new AllowTrustOp(); + decodedAllowTrustOp.Trustor = AccountID.Decode(stream); + decodedAllowTrustOp.Asset = AssetCode.Decode(stream); + decodedAllowTrustOp.Authorize = Uint32.Decode(stream); + return decodedAllowTrustOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AllowTrustResult.cs b/stellar-dotnet-sdk-xdr/generated/AllowTrustResult.cs index 4032eafb..91c0367d 100644 --- a/stellar-dotnet-sdk-xdr/generated/AllowTrustResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/AllowTrustResult.cs @@ -1,51 +1,63 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union AllowTrustResult switch (AllowTrustResultCode code) - // { - // case ALLOW_TRUST_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class AllowTrustResult - { - public AllowTrustResult() { } +// union AllowTrustResult switch (AllowTrustResultCode code) +// { +// case ALLOW_TRUST_SUCCESS: +// void; +// case ALLOW_TRUST_MALFORMED: +// case ALLOW_TRUST_NO_TRUST_LINE: +// case ALLOW_TRUST_TRUST_NOT_REQUIRED: +// case ALLOW_TRUST_CANT_REVOKE: +// case ALLOW_TRUST_SELF_NOT_ALLOWED: +// case ALLOW_TRUST_LOW_RESERVE: +// void; +// }; - public AllowTrustResultCode Discriminant { get; set; } = new AllowTrustResultCode(); +// =========================================================================== +public class AllowTrustResult +{ + public AllowTrustResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, AllowTrustResult encodedAllowTrustResult) + public static void Encode(XdrDataOutputStream stream, AllowTrustResult encodedAllowTrustResult) + { + stream.WriteInt((int)encodedAllowTrustResult.Discriminant.InnerValue); + switch (encodedAllowTrustResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedAllowTrustResult.Discriminant.InnerValue); - switch (encodedAllowTrustResult.Discriminant.InnerValue) - { - case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS: - break; - default: - break; - } + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS: + break; + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_MALFORMED: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_NO_TRUST_LINE: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_TRUST_NOT_REQUIRED: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_CANT_REVOKE: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_SELF_NOT_ALLOWED: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_LOW_RESERVE: + break; } - public static AllowTrustResult Decode(XdrDataInputStream stream) + } + + public static AllowTrustResult Decode(XdrDataInputStream stream) + { + var decodedAllowTrustResult = new AllowTrustResult(); + var discriminant = AllowTrustResultCode.Decode(stream); + decodedAllowTrustResult.Discriminant = discriminant; + switch (decodedAllowTrustResult.Discriminant.InnerValue) { - AllowTrustResult decodedAllowTrustResult = new AllowTrustResult(); - AllowTrustResultCode discriminant = AllowTrustResultCode.Decode(stream); - decodedAllowTrustResult.Discriminant = discriminant; - switch (decodedAllowTrustResult.Discriminant.InnerValue) - { - case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS: - break; - default: - break; - } - return decodedAllowTrustResult; + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS: + break; + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_MALFORMED: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_NO_TRUST_LINE: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_TRUST_NOT_REQUIRED: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_CANT_REVOKE: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_SELF_NOT_ALLOWED: + case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_LOW_RESERVE: + break; } + + return decodedAllowTrustResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AllowTrustResultCode.cs b/stellar-dotnet-sdk-xdr/generated/AllowTrustResultCode.cs index 07be311a..ded689b7 100644 --- a/stellar-dotnet-sdk-xdr/generated/AllowTrustResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/AllowTrustResultCode.cs @@ -1,70 +1,70 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum AllowTrustResultCode - // { - // // codes considered as "success" for the operation - // ALLOW_TRUST_SUCCESS = 0, - // // codes considered as "failure" for the operation - // ALLOW_TRUST_MALFORMED = -1, // asset is not ASSET_TYPE_ALPHANUM - // ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline - // // source account does not require trust - // ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, - // ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust, - // ALLOW_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed - // ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created - // // on revoke due to low reserves - // }; +// enum AllowTrustResultCode +// { +// // codes considered as "success" for the operation +// ALLOW_TRUST_SUCCESS = 0, +// // codes considered as "failure" for the operation +// ALLOW_TRUST_MALFORMED = -1, // asset is not ASSET_TYPE_ALPHANUM +// ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline +// // source account does not require trust +// ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, +// ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust, +// ALLOW_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed +// ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created +// // on revoke due to low reserves +// }; - // =========================================================================== - public class AllowTrustResultCode +// =========================================================================== +public class AllowTrustResultCode +{ + public enum AllowTrustResultCodeEnum { - public enum AllowTrustResultCodeEnum - { - ALLOW_TRUST_SUCCESS = 0, - ALLOW_TRUST_MALFORMED = -1, - ALLOW_TRUST_NO_TRUST_LINE = -2, - ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, - ALLOW_TRUST_CANT_REVOKE = -4, - ALLOW_TRUST_SELF_NOT_ALLOWED = -5, - ALLOW_TRUST_LOW_RESERVE = -6, - } - public AllowTrustResultCodeEnum InnerValue { get; set; } = default(AllowTrustResultCodeEnum); + ALLOW_TRUST_SUCCESS = 0, + ALLOW_TRUST_MALFORMED = -1, + ALLOW_TRUST_NO_TRUST_LINE = -2, + ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, + ALLOW_TRUST_CANT_REVOKE = -4, + ALLOW_TRUST_SELF_NOT_ALLOWED = -5, + ALLOW_TRUST_LOW_RESERVE = -6 + } - public static AllowTrustResultCode Create(AllowTrustResultCodeEnum v) - { - return new AllowTrustResultCode - { - InnerValue = v - }; - } + public AllowTrustResultCodeEnum InnerValue { get; set; } = default; - public static AllowTrustResultCode Decode(XdrDataInputStream stream) + public static AllowTrustResultCode Create(AllowTrustResultCodeEnum v) + { + return new AllowTrustResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS); - case -1: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_MALFORMED); - case -2: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_NO_TRUST_LINE); - case -3: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_TRUST_NOT_REQUIRED); - case -4: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_CANT_REVOKE); - case -5: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_SELF_NOT_ALLOWED); - case -6: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_LOW_RESERVE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, AllowTrustResultCode value) + public static AllowTrustResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS); + case -1: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_MALFORMED); + case -2: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_NO_TRUST_LINE); + case -3: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_TRUST_NOT_REQUIRED); + case -4: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_CANT_REVOKE); + case -5: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_SELF_NOT_ALLOWED); + case -6: return Create(AllowTrustResultCodeEnum.ALLOW_TRUST_LOW_RESERVE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, AllowTrustResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AlphaNum12.cs b/stellar-dotnet-sdk-xdr/generated/AlphaNum12.cs index 7caefb51..58584a07 100644 --- a/stellar-dotnet-sdk-xdr/generated/AlphaNum12.cs +++ b/stellar-dotnet-sdk-xdr/generated/AlphaNum12.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct AlphaNum12 +// { +// AssetCode12 assetCode; +// AccountID issuer; +// }; - // struct AlphaNum12 - // { - // AssetCode12 assetCode; - // AccountID issuer; - // }; +// =========================================================================== +public class AlphaNum12 +{ + public AssetCode12 AssetCode { get; set; } + public AccountID Issuer { get; set; } - // =========================================================================== - public class AlphaNum12 + public static void Encode(XdrDataOutputStream stream, AlphaNum12 encodedAlphaNum12) { - public AlphaNum12() { } - public AssetCode12 AssetCode { get; set; } - public AccountID Issuer { get; set; } + AssetCode12.Encode(stream, encodedAlphaNum12.AssetCode); + AccountID.Encode(stream, encodedAlphaNum12.Issuer); + } - public static void Encode(XdrDataOutputStream stream, AlphaNum12 encodedAlphaNum12) - { - AssetCode12.Encode(stream, encodedAlphaNum12.AssetCode); - AccountID.Encode(stream, encodedAlphaNum12.Issuer); - } - public static AlphaNum12 Decode(XdrDataInputStream stream) - { - AlphaNum12 decodedAlphaNum12 = new AlphaNum12(); - decodedAlphaNum12.AssetCode = AssetCode12.Decode(stream); - decodedAlphaNum12.Issuer = AccountID.Decode(stream); - return decodedAlphaNum12; - } + public static AlphaNum12 Decode(XdrDataInputStream stream) + { + var decodedAlphaNum12 = new AlphaNum12(); + decodedAlphaNum12.AssetCode = AssetCode12.Decode(stream); + decodedAlphaNum12.Issuer = AccountID.Decode(stream); + return decodedAlphaNum12; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AlphaNum4.cs b/stellar-dotnet-sdk-xdr/generated/AlphaNum4.cs index a9bcb974..a59f7e91 100644 --- a/stellar-dotnet-sdk-xdr/generated/AlphaNum4.cs +++ b/stellar-dotnet-sdk-xdr/generated/AlphaNum4.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct AlphaNum4 +// { +// AssetCode4 assetCode; +// AccountID issuer; +// }; - // struct AlphaNum4 - // { - // AssetCode4 assetCode; - // AccountID issuer; - // }; +// =========================================================================== +public class AlphaNum4 +{ + public AssetCode4 AssetCode { get; set; } + public AccountID Issuer { get; set; } - // =========================================================================== - public class AlphaNum4 + public static void Encode(XdrDataOutputStream stream, AlphaNum4 encodedAlphaNum4) { - public AlphaNum4() { } - public AssetCode4 AssetCode { get; set; } - public AccountID Issuer { get; set; } + AssetCode4.Encode(stream, encodedAlphaNum4.AssetCode); + AccountID.Encode(stream, encodedAlphaNum4.Issuer); + } - public static void Encode(XdrDataOutputStream stream, AlphaNum4 encodedAlphaNum4) - { - AssetCode4.Encode(stream, encodedAlphaNum4.AssetCode); - AccountID.Encode(stream, encodedAlphaNum4.Issuer); - } - public static AlphaNum4 Decode(XdrDataInputStream stream) - { - AlphaNum4 decodedAlphaNum4 = new AlphaNum4(); - decodedAlphaNum4.AssetCode = AssetCode4.Decode(stream); - decodedAlphaNum4.Issuer = AccountID.Decode(stream); - return decodedAlphaNum4; - } + public static AlphaNum4 Decode(XdrDataInputStream stream) + { + var decodedAlphaNum4 = new AlphaNum4(); + decodedAlphaNum4.AssetCode = AssetCode4.Decode(stream); + decodedAlphaNum4.Issuer = AccountID.Decode(stream); + return decodedAlphaNum4; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Asset.cs b/stellar-dotnet-sdk-xdr/generated/Asset.cs index 2f5cfc12..2376328e 100644 --- a/stellar-dotnet-sdk-xdr/generated/Asset.cs +++ b/stellar-dotnet-sdk-xdr/generated/Asset.cs @@ -1,67 +1,65 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union Asset switch (AssetType type) - // { - // 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 - // }; +// union Asset switch (AssetType type) +// { +// 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 +// }; - // =========================================================================== - public class Asset - { - public Asset() { } +// =========================================================================== +public class Asset +{ + public AssetType Discriminant { get; set; } = new(); - public AssetType Discriminant { get; set; } = new AssetType(); + public AlphaNum4 AlphaNum4 { get; set; } + public AlphaNum12 AlphaNum12 { get; set; } - public AlphaNum4 AlphaNum4 { get; set; } - public AlphaNum12 AlphaNum12 { get; set; } - public static void Encode(XdrDataOutputStream stream, Asset encodedAsset) + public static void Encode(XdrDataOutputStream stream, Asset encodedAsset) + { + stream.WriteInt((int)encodedAsset.Discriminant.InnerValue); + switch (encodedAsset.Discriminant.InnerValue) { - stream.WriteInt((int)encodedAsset.Discriminant.InnerValue); - switch (encodedAsset.Discriminant.InnerValue) - { - case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: - AlphaNum4.Encode(stream, encodedAsset.AlphaNum4); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: - AlphaNum12.Encode(stream, encodedAsset.AlphaNum12); - break; - } + case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: + AlphaNum4.Encode(stream, encodedAsset.AlphaNum4); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: + AlphaNum12.Encode(stream, encodedAsset.AlphaNum12); + break; } - public static Asset Decode(XdrDataInputStream stream) + } + + public static Asset Decode(XdrDataInputStream stream) + { + var decodedAsset = new Asset(); + var discriminant = AssetType.Decode(stream); + decodedAsset.Discriminant = discriminant; + switch (decodedAsset.Discriminant.InnerValue) { - Asset decodedAsset = new Asset(); - AssetType discriminant = AssetType.Decode(stream); - decodedAsset.Discriminant = discriminant; - switch (decodedAsset.Discriminant.InnerValue) - { - case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: - decodedAsset.AlphaNum4 = AlphaNum4.Decode(stream); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: - decodedAsset.AlphaNum12 = AlphaNum12.Decode(stream); - break; - } - return decodedAsset; + case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: + decodedAsset.AlphaNum4 = AlphaNum4.Decode(stream); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: + decodedAsset.AlphaNum12 = AlphaNum12.Decode(stream); + break; } + + return decodedAsset; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AssetCode.cs b/stellar-dotnet-sdk-xdr/generated/AssetCode.cs index a1171be6..4c5d7f4e 100644 --- a/stellar-dotnet-sdk-xdr/generated/AssetCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/AssetCode.cs @@ -1,60 +1,58 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ - - // union AssetCode switch (AssetType type) - // { - // case ASSET_TYPE_CREDIT_ALPHANUM4: - // AssetCode4 assetCode4; - // - // case ASSET_TYPE_CREDIT_ALPHANUM12: - // AssetCode12 assetCode12; - // - // // add other asset types here in the future - // }; - - // =========================================================================== - public class AssetCode - { - public AssetCode() { } +// === xdr source ============================================================ + +// union AssetCode switch (AssetType type) +// { +// case ASSET_TYPE_CREDIT_ALPHANUM4: +// AssetCode4 assetCode4; +// +// case ASSET_TYPE_CREDIT_ALPHANUM12: +// AssetCode12 assetCode12; +// +// // add other asset types here in the future +// }; + +// =========================================================================== +public class AssetCode +{ + public AssetType Discriminant { get; set; } = new(); - public AssetType Discriminant { get; set; } = new AssetType(); + public AssetCode4 AssetCode4 { get; set; } + public AssetCode12 AssetCode12 { get; set; } - public AssetCode4 AssetCode4 { get; set; } - public AssetCode12 AssetCode12 { get; set; } - public static void Encode(XdrDataOutputStream stream, AssetCode encodedAssetCode) + public static void Encode(XdrDataOutputStream stream, AssetCode encodedAssetCode) + { + stream.WriteInt((int)encodedAssetCode.Discriminant.InnerValue); + switch (encodedAssetCode.Discriminant.InnerValue) { - stream.WriteInt((int)encodedAssetCode.Discriminant.InnerValue); - switch (encodedAssetCode.Discriminant.InnerValue) - { - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: - AssetCode4.Encode(stream, encodedAssetCode.AssetCode4); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: - AssetCode12.Encode(stream, encodedAssetCode.AssetCode12); - break; - } + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: + AssetCode4.Encode(stream, encodedAssetCode.AssetCode4); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: + AssetCode12.Encode(stream, encodedAssetCode.AssetCode12); + break; } - public static AssetCode Decode(XdrDataInputStream stream) + } + + public static AssetCode Decode(XdrDataInputStream stream) + { + var decodedAssetCode = new AssetCode(); + var discriminant = AssetType.Decode(stream); + decodedAssetCode.Discriminant = discriminant; + switch (decodedAssetCode.Discriminant.InnerValue) { - AssetCode decodedAssetCode = new AssetCode(); - AssetType discriminant = AssetType.Decode(stream); - decodedAssetCode.Discriminant = discriminant; - switch (decodedAssetCode.Discriminant.InnerValue) - { - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: - decodedAssetCode.AssetCode4 = AssetCode4.Decode(stream); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: - decodedAssetCode.AssetCode12 = AssetCode12.Decode(stream); - break; - } - return decodedAssetCode; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: + decodedAssetCode.AssetCode4 = AssetCode4.Decode(stream); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: + decodedAssetCode.AssetCode12 = AssetCode12.Decode(stream); + break; } + + return decodedAssetCode; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AssetCode12.cs b/stellar-dotnet-sdk-xdr/generated/AssetCode12.cs index 2f8de819..890e9275 100644 --- a/stellar-dotnet-sdk-xdr/generated/AssetCode12.cs +++ b/stellar-dotnet-sdk-xdr/generated/AssetCode12.cs @@ -1,38 +1,38 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque AssetCode12[12]; + +// =========================================================================== +public class AssetCode12 { + public AssetCode12() + { + } - // === xdr source ============================================================ + public AssetCode12(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque AssetCode12[12]; + public static void Encode(XdrDataOutputStream stream, AssetCode12 encodedAssetCode12) + { + var AssetCode12size = encodedAssetCode12.InnerValue.Length; + stream.Write(encodedAssetCode12.InnerValue, 0, AssetCode12size); + } - // =========================================================================== - public class AssetCode12 + public static AssetCode12 Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public AssetCode12() { } - - public AssetCode12(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, AssetCode12 encodedAssetCode12) - { - int AssetCode12size = encodedAssetCode12.InnerValue.Length; - stream.Write(encodedAssetCode12.InnerValue, 0, AssetCode12size); - } - public static AssetCode12 Decode(XdrDataInputStream stream) - { - AssetCode12 decodedAssetCode12 = new AssetCode12(); - int AssetCode12size = 12; - decodedAssetCode12.InnerValue = new byte[AssetCode12size]; - stream.Read(decodedAssetCode12.InnerValue, 0, AssetCode12size); - return decodedAssetCode12; - } + var decodedAssetCode12 = new AssetCode12(); + var AssetCode12size = 12; + decodedAssetCode12.InnerValue = new byte[AssetCode12size]; + stream.Read(decodedAssetCode12.InnerValue, 0, AssetCode12size); + return decodedAssetCode12; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AssetCode4.cs b/stellar-dotnet-sdk-xdr/generated/AssetCode4.cs index c2945def..57640972 100644 --- a/stellar-dotnet-sdk-xdr/generated/AssetCode4.cs +++ b/stellar-dotnet-sdk-xdr/generated/AssetCode4.cs @@ -1,38 +1,38 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque AssetCode4[4]; + +// =========================================================================== +public class AssetCode4 { + public AssetCode4() + { + } - // === xdr source ============================================================ + public AssetCode4(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque AssetCode4[4]; + public static void Encode(XdrDataOutputStream stream, AssetCode4 encodedAssetCode4) + { + var AssetCode4size = encodedAssetCode4.InnerValue.Length; + stream.Write(encodedAssetCode4.InnerValue, 0, AssetCode4size); + } - // =========================================================================== - public class AssetCode4 + public static AssetCode4 Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public AssetCode4() { } - - public AssetCode4(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, AssetCode4 encodedAssetCode4) - { - int AssetCode4size = encodedAssetCode4.InnerValue.Length; - stream.Write(encodedAssetCode4.InnerValue, 0, AssetCode4size); - } - public static AssetCode4 Decode(XdrDataInputStream stream) - { - AssetCode4 decodedAssetCode4 = new AssetCode4(); - int AssetCode4size = 4; - decodedAssetCode4.InnerValue = new byte[AssetCode4size]; - stream.Read(decodedAssetCode4.InnerValue, 0, AssetCode4size); - return decodedAssetCode4; - } + var decodedAssetCode4 = new AssetCode4(); + var AssetCode4size = 4; + decodedAssetCode4.InnerValue = new byte[AssetCode4size]; + stream.Read(decodedAssetCode4.InnerValue, 0, AssetCode4size); + return decodedAssetCode4; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AssetType.cs b/stellar-dotnet-sdk-xdr/generated/AssetType.cs index fc0815f9..ecf8e28d 100644 --- a/stellar-dotnet-sdk-xdr/generated/AssetType.cs +++ b/stellar-dotnet-sdk-xdr/generated/AssetType.cs @@ -1,57 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum AssetType - // { - // ASSET_TYPE_NATIVE = 0, - // ASSET_TYPE_CREDIT_ALPHANUM4 = 1, - // ASSET_TYPE_CREDIT_ALPHANUM12 = 2, - // ASSET_TYPE_POOL_SHARE = 3 - // }; +// enum AssetType +// { +// ASSET_TYPE_NATIVE = 0, +// ASSET_TYPE_CREDIT_ALPHANUM4 = 1, +// ASSET_TYPE_CREDIT_ALPHANUM12 = 2, +// ASSET_TYPE_POOL_SHARE = 3 +// }; - // =========================================================================== - public class AssetType +// =========================================================================== +public class AssetType +{ + public enum AssetTypeEnum { - public enum AssetTypeEnum - { - ASSET_TYPE_NATIVE = 0, - ASSET_TYPE_CREDIT_ALPHANUM4 = 1, - ASSET_TYPE_CREDIT_ALPHANUM12 = 2, - ASSET_TYPE_POOL_SHARE = 3, - } - public AssetTypeEnum InnerValue { get; set; } = default(AssetTypeEnum); + ASSET_TYPE_NATIVE = 0, + ASSET_TYPE_CREDIT_ALPHANUM4 = 1, + ASSET_TYPE_CREDIT_ALPHANUM12 = 2, + ASSET_TYPE_POOL_SHARE = 3 + } - public static AssetType Create(AssetTypeEnum v) - { - return new AssetType - { - InnerValue = v - }; - } + public AssetTypeEnum InnerValue { get; set; } = default; - public static AssetType Decode(XdrDataInputStream stream) + public static AssetType Create(AssetTypeEnum v) + { + return new AssetType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(AssetTypeEnum.ASSET_TYPE_NATIVE); - case 1: return Create(AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4); - case 2: return Create(AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12); - case 3: return Create(AssetTypeEnum.ASSET_TYPE_POOL_SHARE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, AssetType value) + public static AssetType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(AssetTypeEnum.ASSET_TYPE_NATIVE); + case 1: return Create(AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4); + case 2: return Create(AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12); + case 3: return Create(AssetTypeEnum.ASSET_TYPE_POOL_SHARE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, AssetType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Auth.cs b/stellar-dotnet-sdk-xdr/generated/Auth.cs index fa407271..344b1a15 100644 --- a/stellar-dotnet-sdk-xdr/generated/Auth.cs +++ b/stellar-dotnet-sdk-xdr/generated/Auth.cs @@ -1,34 +1,29 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct Auth +// { +// int flags; +// }; - // struct Auth - // { - // // Empty message, just to confirm - // // establishment of MAC keys. - // int unused; - // }; +// =========================================================================== +public class Auth +{ + public int Flags { get; set; } - // =========================================================================== - public class Auth + public static void Encode(XdrDataOutputStream stream, Auth encodedAuth) { - public Auth() { } - public int Unused { get; set; } + stream.WriteInt(encodedAuth.Flags); + } - public static void Encode(XdrDataOutputStream stream, Auth encodedAuth) - { - stream.WriteInt(encodedAuth.Unused); - } - public static Auth Decode(XdrDataInputStream stream) - { - Auth decodedAuth = new Auth(); - decodedAuth.Unused = stream.ReadInt(); - return decodedAuth; - } + public static Auth Decode(XdrDataInputStream stream) + { + var decodedAuth = new Auth(); + decodedAuth.Flags = stream.ReadInt(); + return decodedAuth; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AuthCert.cs b/stellar-dotnet-sdk-xdr/generated/AuthCert.cs index bd84ecbf..569affaf 100644 --- a/stellar-dotnet-sdk-xdr/generated/AuthCert.cs +++ b/stellar-dotnet-sdk-xdr/generated/AuthCert.cs @@ -1,40 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct AuthCert +// { +// Curve25519Public pubkey; +// uint64 expiration; +// Signature sig; +// }; - // struct AuthCert - // { - // Curve25519Public pubkey; - // uint64 expiration; - // Signature sig; - // }; +// =========================================================================== +public class AuthCert +{ + public Curve25519Public Pubkey { get; set; } + public Uint64 Expiration { get; set; } + public Signature Sig { get; set; } - // =========================================================================== - public class AuthCert + public static void Encode(XdrDataOutputStream stream, AuthCert encodedAuthCert) { - public AuthCert() { } - public Curve25519Public Pubkey { get; set; } - public Uint64 Expiration { get; set; } - public Signature Sig { get; set; } + Curve25519Public.Encode(stream, encodedAuthCert.Pubkey); + Uint64.Encode(stream, encodedAuthCert.Expiration); + Signature.Encode(stream, encodedAuthCert.Sig); + } - public static void Encode(XdrDataOutputStream stream, AuthCert encodedAuthCert) - { - Curve25519Public.Encode(stream, encodedAuthCert.Pubkey); - Uint64.Encode(stream, encodedAuthCert.Expiration); - Signature.Encode(stream, encodedAuthCert.Sig); - } - public static AuthCert Decode(XdrDataInputStream stream) - { - AuthCert decodedAuthCert = new AuthCert(); - decodedAuthCert.Pubkey = Curve25519Public.Decode(stream); - decodedAuthCert.Expiration = Uint64.Decode(stream); - decodedAuthCert.Sig = Signature.Decode(stream); - return decodedAuthCert; - } + public static AuthCert Decode(XdrDataInputStream stream) + { + var decodedAuthCert = new AuthCert(); + decodedAuthCert.Pubkey = Curve25519Public.Decode(stream); + decodedAuthCert.Expiration = Uint64.Decode(stream); + decodedAuthCert.Sig = Signature.Decode(stream); + return decodedAuthCert; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/AuthenticatedMessage.cs b/stellar-dotnet-sdk-xdr/generated/AuthenticatedMessage.cs index 178d548b..e7318514 100644 --- a/stellar-dotnet-sdk-xdr/generated/AuthenticatedMessage.cs +++ b/stellar-dotnet-sdk-xdr/generated/AuthenticatedMessage.cs @@ -1,77 +1,74 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union AuthenticatedMessage switch (uint32 v) - // { - // case 0: - // struct - // { - // uint64 sequence; - // StellarMessage message; - // HmacSha256Mac mac; - // } v0; - // }; +// union AuthenticatedMessage switch (uint32 v) +// { +// case 0: +// struct +// { +// uint64 sequence; +// StellarMessage message; +// HmacSha256Mac mac; +// } v0; +// }; - // =========================================================================== - public class AuthenticatedMessage - { - public AuthenticatedMessage() { } +// =========================================================================== +public class AuthenticatedMessage +{ + public Uint32 Discriminant { get; set; } = new(); - public Uint32 Discriminant { get; set; } = new Uint32(); + public AuthenticatedMessageV0 V0 { get; set; } - public AuthenticatedMessageV0 V0 { get; set; } - public static void Encode(XdrDataOutputStream stream, AuthenticatedMessage encodedAuthenticatedMessage) + public static void Encode(XdrDataOutputStream stream, AuthenticatedMessage encodedAuthenticatedMessage) + { + stream.WriteInt((int)encodedAuthenticatedMessage.Discriminant.InnerValue); + switch (encodedAuthenticatedMessage.Discriminant.InnerValue) { - stream.WriteInt((int)encodedAuthenticatedMessage.Discriminant.InnerValue); - switch (encodedAuthenticatedMessage.Discriminant.InnerValue) - { - case 0: - AuthenticatedMessageV0.Encode(stream, encodedAuthenticatedMessage.V0); - break; - } + case 0: + AuthenticatedMessageV0.Encode(stream, encodedAuthenticatedMessage.V0); + break; } - public static AuthenticatedMessage Decode(XdrDataInputStream stream) + } + + public static AuthenticatedMessage Decode(XdrDataInputStream stream) + { + var decodedAuthenticatedMessage = new AuthenticatedMessage(); + var discriminant = Uint32.Decode(stream); + decodedAuthenticatedMessage.Discriminant = discriminant; + switch (decodedAuthenticatedMessage.Discriminant.InnerValue) { - AuthenticatedMessage decodedAuthenticatedMessage = new AuthenticatedMessage(); - Uint32 discriminant = Uint32.Decode(stream); - decodedAuthenticatedMessage.Discriminant = discriminant; - switch (decodedAuthenticatedMessage.Discriminant.InnerValue) - { - case 0: - decodedAuthenticatedMessage.V0 = AuthenticatedMessageV0.Decode(stream); - break; - } - return decodedAuthenticatedMessage; + case 0: + decodedAuthenticatedMessage.V0 = AuthenticatedMessageV0.Decode(stream); + break; } - public class AuthenticatedMessageV0 - { - public AuthenticatedMessageV0() { } - public Uint64 Sequence { get; set; } - public StellarMessage Message { get; set; } - public HmacSha256Mac Mac { get; set; } + return decodedAuthenticatedMessage; + } - public static void Encode(XdrDataOutputStream stream, AuthenticatedMessageV0 encodedAuthenticatedMessageV0) - { - Uint64.Encode(stream, encodedAuthenticatedMessageV0.Sequence); - StellarMessage.Encode(stream, encodedAuthenticatedMessageV0.Message); - HmacSha256Mac.Encode(stream, encodedAuthenticatedMessageV0.Mac); - } - public static AuthenticatedMessageV0 Decode(XdrDataInputStream stream) - { - AuthenticatedMessageV0 decodedAuthenticatedMessageV0 = new AuthenticatedMessageV0(); - decodedAuthenticatedMessageV0.Sequence = Uint64.Decode(stream); - decodedAuthenticatedMessageV0.Message = StellarMessage.Decode(stream); - decodedAuthenticatedMessageV0.Mac = HmacSha256Mac.Decode(stream); - return decodedAuthenticatedMessageV0; - } + public class AuthenticatedMessageV0 + { + public Uint64 Sequence { get; set; } + public StellarMessage Message { get; set; } + public HmacSha256Mac Mac { get; set; } + public static void Encode(XdrDataOutputStream stream, AuthenticatedMessageV0 encodedAuthenticatedMessageV0) + { + Uint64.Encode(stream, encodedAuthenticatedMessageV0.Sequence); + StellarMessage.Encode(stream, encodedAuthenticatedMessageV0.Message); + HmacSha256Mac.Encode(stream, encodedAuthenticatedMessageV0.Mac); + } + + public static AuthenticatedMessageV0 Decode(XdrDataInputStream stream) + { + var decodedAuthenticatedMessageV0 = new AuthenticatedMessageV0(); + decodedAuthenticatedMessageV0.Sequence = Uint64.Decode(stream); + decodedAuthenticatedMessageV0.Message = StellarMessage.Decode(stream); + decodedAuthenticatedMessageV0.Mac = HmacSha256Mac.Decode(stream); + return decodedAuthenticatedMessageV0; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesOp.cs b/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesOp.cs index 6ef1f7b7..14852599 100644 --- a/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesOp.cs @@ -1,32 +1,30 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct BeginSponsoringFutureReservesOp +// { +// AccountID sponsoredID; +// }; - // struct BeginSponsoringFutureReservesOp - // { - // AccountID sponsoredID; - // }; +// =========================================================================== +public class BeginSponsoringFutureReservesOp +{ + public AccountID SponsoredID { get; set; } - // =========================================================================== - public class BeginSponsoringFutureReservesOp + public static void Encode(XdrDataOutputStream stream, + BeginSponsoringFutureReservesOp encodedBeginSponsoringFutureReservesOp) { - public BeginSponsoringFutureReservesOp() { } - public AccountID SponsoredID { get; set; } + AccountID.Encode(stream, encodedBeginSponsoringFutureReservesOp.SponsoredID); + } - public static void Encode(XdrDataOutputStream stream, BeginSponsoringFutureReservesOp encodedBeginSponsoringFutureReservesOp) - { - AccountID.Encode(stream, encodedBeginSponsoringFutureReservesOp.SponsoredID); - } - public static BeginSponsoringFutureReservesOp Decode(XdrDataInputStream stream) - { - BeginSponsoringFutureReservesOp decodedBeginSponsoringFutureReservesOp = new BeginSponsoringFutureReservesOp(); - decodedBeginSponsoringFutureReservesOp.SponsoredID = AccountID.Decode(stream); - return decodedBeginSponsoringFutureReservesOp; - } + public static BeginSponsoringFutureReservesOp Decode(XdrDataInputStream stream) + { + var decodedBeginSponsoringFutureReservesOp = new BeginSponsoringFutureReservesOp(); + decodedBeginSponsoringFutureReservesOp.SponsoredID = AccountID.Decode(stream); + return decodedBeginSponsoringFutureReservesOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesResult.cs b/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesResult.cs index ee359875..d17a66a4 100644 --- a/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesResult.cs @@ -1,52 +1,64 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union BeginSponsoringFutureReservesResult switch ( - // BeginSponsoringFutureReservesResultCode code) - // { - // case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class BeginSponsoringFutureReservesResult - { - public BeginSponsoringFutureReservesResult() { } +// union BeginSponsoringFutureReservesResult switch ( +// BeginSponsoringFutureReservesResultCode code) +// { +// case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS: +// void; +// case BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED: +// case BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED: +// case BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE: +// void; +// }; - public BeginSponsoringFutureReservesResultCode Discriminant { get; set; } = new BeginSponsoringFutureReservesResultCode(); +// =========================================================================== +public class BeginSponsoringFutureReservesResult +{ + public BeginSponsoringFutureReservesResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, BeginSponsoringFutureReservesResult encodedBeginSponsoringFutureReservesResult) + public static void Encode(XdrDataOutputStream stream, + BeginSponsoringFutureReservesResult encodedBeginSponsoringFutureReservesResult) + { + stream.WriteInt((int)encodedBeginSponsoringFutureReservesResult.Discriminant.InnerValue); + switch (encodedBeginSponsoringFutureReservesResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedBeginSponsoringFutureReservesResult.Discriminant.InnerValue); - switch (encodedBeginSponsoringFutureReservesResult.Discriminant.InnerValue) - { - case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS: - break; - default: - break; - } + case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS: + break; + case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED: + case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED: + case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE: + break; } - public static BeginSponsoringFutureReservesResult Decode(XdrDataInputStream stream) + } + + public static BeginSponsoringFutureReservesResult Decode(XdrDataInputStream stream) + { + var decodedBeginSponsoringFutureReservesResult = new BeginSponsoringFutureReservesResult(); + var discriminant = BeginSponsoringFutureReservesResultCode.Decode(stream); + decodedBeginSponsoringFutureReservesResult.Discriminant = discriminant; + switch (decodedBeginSponsoringFutureReservesResult.Discriminant.InnerValue) { - BeginSponsoringFutureReservesResult decodedBeginSponsoringFutureReservesResult = new BeginSponsoringFutureReservesResult(); - BeginSponsoringFutureReservesResultCode discriminant = BeginSponsoringFutureReservesResultCode.Decode(stream); - decodedBeginSponsoringFutureReservesResult.Discriminant = discriminant; - switch (decodedBeginSponsoringFutureReservesResult.Discriminant.InnerValue) - { - case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS: - break; - default: - break; - } - return decodedBeginSponsoringFutureReservesResult; + case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS: + break; + case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED: + case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED: + case BeginSponsoringFutureReservesResultCode.BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE: + break; } + + return decodedBeginSponsoringFutureReservesResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesResultCode.cs b/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesResultCode.cs index 02ce4271..c0f39dc7 100644 --- a/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/BeginSponsoringFutureReservesResultCode.cs @@ -1,60 +1,64 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ - - // enum BeginSponsoringFutureReservesResultCode - // { - // // 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, - // BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE = -3 - // }; - - // =========================================================================== - public class BeginSponsoringFutureReservesResultCode +// enum BeginSponsoringFutureReservesResultCode +// { +// // 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, +// BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE = -3 +// }; + +// =========================================================================== +public class BeginSponsoringFutureReservesResultCode +{ + public enum BeginSponsoringFutureReservesResultCodeEnum { - public enum BeginSponsoringFutureReservesResultCodeEnum - { - BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, - BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED = -1, - BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED = -2, - BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE = -3, - } - public BeginSponsoringFutureReservesResultCodeEnum InnerValue { get; set; } = default(BeginSponsoringFutureReservesResultCodeEnum); + BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, + BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED = -1, + BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED = -2, + BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE = -3 + } - public static BeginSponsoringFutureReservesResultCode Create(BeginSponsoringFutureReservesResultCodeEnum v) - { - return new BeginSponsoringFutureReservesResultCode - { - InnerValue = v - }; - } + public BeginSponsoringFutureReservesResultCodeEnum InnerValue { get; set; } = default; - public static BeginSponsoringFutureReservesResultCode Decode(XdrDataInputStream stream) + public static BeginSponsoringFutureReservesResultCode Create(BeginSponsoringFutureReservesResultCodeEnum v) + { + return new BeginSponsoringFutureReservesResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS); - case -1: return Create(BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED); - case -2: return Create(BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED); - case -3: return Create(BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, BeginSponsoringFutureReservesResultCode value) + public static BeginSponsoringFutureReservesResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS); + case -1: + return Create(BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED); + case -2: + return Create(BeginSponsoringFutureReservesResultCodeEnum + .BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED); + case -3: + return Create(BeginSponsoringFutureReservesResultCodeEnum.BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, BeginSponsoringFutureReservesResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BucketEntry.cs b/stellar-dotnet-sdk-xdr/generated/BucketEntry.cs index 18b8af40..85b80dff 100644 --- a/stellar-dotnet-sdk-xdr/generated/BucketEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/BucketEntry.cs @@ -1,70 +1,68 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union BucketEntry switch (BucketEntryType type) - // { - // case LIVEENTRY: - // case INITENTRY: - // LedgerEntry liveEntry; - // - // case DEADENTRY: - // LedgerKey deadEntry; - // case METAENTRY: - // BucketMetadata metaEntry; - // }; +// union BucketEntry switch (BucketEntryType type) +// { +// case LIVEENTRY: +// case INITENTRY: +// LedgerEntry liveEntry; +// +// case DEADENTRY: +// LedgerKey deadEntry; +// case METAENTRY: +// BucketMetadata metaEntry; +// }; - // =========================================================================== - public class BucketEntry - { - public BucketEntry() { } +// =========================================================================== +public class BucketEntry +{ + public BucketEntryType Discriminant { get; set; } = new(); - public BucketEntryType Discriminant { get; set; } = new BucketEntryType(); + public LedgerEntry LiveEntry { get; set; } + public LedgerKey DeadEntry { get; set; } + public BucketMetadata MetaEntry { get; set; } - public LedgerEntry LiveEntry { get; set; } - public LedgerKey DeadEntry { get; set; } - public BucketMetadata MetaEntry { get; set; } - public static void Encode(XdrDataOutputStream stream, BucketEntry encodedBucketEntry) + public static void Encode(XdrDataOutputStream stream, BucketEntry encodedBucketEntry) + { + stream.WriteInt((int)encodedBucketEntry.Discriminant.InnerValue); + switch (encodedBucketEntry.Discriminant.InnerValue) { - stream.WriteInt((int)encodedBucketEntry.Discriminant.InnerValue); - switch (encodedBucketEntry.Discriminant.InnerValue) - { - case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY: - case BucketEntryType.BucketEntryTypeEnum.INITENTRY: - LedgerEntry.Encode(stream, encodedBucketEntry.LiveEntry); - break; - case BucketEntryType.BucketEntryTypeEnum.DEADENTRY: - LedgerKey.Encode(stream, encodedBucketEntry.DeadEntry); - break; - case BucketEntryType.BucketEntryTypeEnum.METAENTRY: - BucketMetadata.Encode(stream, encodedBucketEntry.MetaEntry); - break; - } + case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY: + case BucketEntryType.BucketEntryTypeEnum.INITENTRY: + LedgerEntry.Encode(stream, encodedBucketEntry.LiveEntry); + break; + case BucketEntryType.BucketEntryTypeEnum.DEADENTRY: + LedgerKey.Encode(stream, encodedBucketEntry.DeadEntry); + break; + case BucketEntryType.BucketEntryTypeEnum.METAENTRY: + BucketMetadata.Encode(stream, encodedBucketEntry.MetaEntry); + break; } - public static BucketEntry Decode(XdrDataInputStream stream) + } + + public static BucketEntry Decode(XdrDataInputStream stream) + { + var decodedBucketEntry = new BucketEntry(); + var discriminant = BucketEntryType.Decode(stream); + decodedBucketEntry.Discriminant = discriminant; + switch (decodedBucketEntry.Discriminant.InnerValue) { - BucketEntry decodedBucketEntry = new BucketEntry(); - BucketEntryType discriminant = BucketEntryType.Decode(stream); - decodedBucketEntry.Discriminant = discriminant; - switch (decodedBucketEntry.Discriminant.InnerValue) - { - case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY: - case BucketEntryType.BucketEntryTypeEnum.INITENTRY: - decodedBucketEntry.LiveEntry = LedgerEntry.Decode(stream); - break; - case BucketEntryType.BucketEntryTypeEnum.DEADENTRY: - decodedBucketEntry.DeadEntry = LedgerKey.Decode(stream); - break; - case BucketEntryType.BucketEntryTypeEnum.METAENTRY: - decodedBucketEntry.MetaEntry = BucketMetadata.Decode(stream); - break; - } - return decodedBucketEntry; + case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY: + case BucketEntryType.BucketEntryTypeEnum.INITENTRY: + decodedBucketEntry.LiveEntry = LedgerEntry.Decode(stream); + break; + case BucketEntryType.BucketEntryTypeEnum.DEADENTRY: + decodedBucketEntry.DeadEntry = LedgerKey.Decode(stream); + break; + case BucketEntryType.BucketEntryTypeEnum.METAENTRY: + decodedBucketEntry.MetaEntry = BucketMetadata.Decode(stream); + break; } + + return decodedBucketEntry; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BucketEntryType.cs b/stellar-dotnet-sdk-xdr/generated/BucketEntryType.cs index 3ef2444f..07092443 100644 --- a/stellar-dotnet-sdk-xdr/generated/BucketEntryType.cs +++ b/stellar-dotnet-sdk-xdr/generated/BucketEntryType.cs @@ -1,59 +1,59 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum BucketEntryType - // { - // METAENTRY = - // -1, // At-and-after protocol 11: bucket metadata, should come first. - // LIVEENTRY = 0, // Before protocol 11: created-or-updated; - // // At-and-after protocol 11: only updated. - // DEADENTRY = 1, - // INITENTRY = 2 // At-and-after protocol 11: only created. - // }; +// enum BucketEntryType +// { +// METAENTRY = +// -1, // At-and-after protocol 11: bucket metadata, should come first. +// LIVEENTRY = 0, // Before protocol 11: created-or-updated; +// // At-and-after protocol 11: only updated. +// DEADENTRY = 1, +// INITENTRY = 2 // At-and-after protocol 11: only created. +// }; - // =========================================================================== - public class BucketEntryType +// =========================================================================== +public class BucketEntryType +{ + public enum BucketEntryTypeEnum { - public enum BucketEntryTypeEnum - { - METAENTRY = -1, - LIVEENTRY = 0, - DEADENTRY = 1, - INITENTRY = 2, - } - public BucketEntryTypeEnum InnerValue { get; set; } = default(BucketEntryTypeEnum); + METAENTRY = -1, + LIVEENTRY = 0, + DEADENTRY = 1, + INITENTRY = 2 + } - public static BucketEntryType Create(BucketEntryTypeEnum v) - { - return new BucketEntryType - { - InnerValue = v - }; - } + public BucketEntryTypeEnum InnerValue { get; set; } = default; - public static BucketEntryType Decode(XdrDataInputStream stream) + public static BucketEntryType Create(BucketEntryTypeEnum v) + { + return new BucketEntryType { - int value = stream.ReadInt(); - switch (value) - { - case -1: return Create(BucketEntryTypeEnum.METAENTRY); - case 0: return Create(BucketEntryTypeEnum.LIVEENTRY); - case 1: return Create(BucketEntryTypeEnum.DEADENTRY); - case 2: return Create(BucketEntryTypeEnum.INITENTRY); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, BucketEntryType value) + public static BucketEntryType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case -1: return Create(BucketEntryTypeEnum.METAENTRY); + case 0: return Create(BucketEntryTypeEnum.LIVEENTRY); + case 1: return Create(BucketEntryTypeEnum.DEADENTRY); + case 2: return Create(BucketEntryTypeEnum.INITENTRY); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, BucketEntryType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BucketMetadata.cs b/stellar-dotnet-sdk-xdr/generated/BucketMetadata.cs index 9af8a56f..168a9948 100644 --- a/stellar-dotnet-sdk-xdr/generated/BucketMetadata.cs +++ b/stellar-dotnet-sdk-xdr/generated/BucketMetadata.cs @@ -1,74 +1,70 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct BucketMetadata +// { +// // Indicates the protocol version used to create / merge this bucket. +// uint32 ledgerVersion; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; + +// =========================================================================== +public class BucketMetadata { + public Uint32 LedgerVersion { get; set; } + public BucketMetadataExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, BucketMetadata encodedBucketMetadata) + { + Uint32.Encode(stream, encodedBucketMetadata.LedgerVersion); + BucketMetadataExt.Encode(stream, encodedBucketMetadata.Ext); + } - // struct BucketMetadata - // { - // // Indicates the protocol version used to create / merge this bucket. - // uint32 ledgerVersion; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static BucketMetadata Decode(XdrDataInputStream stream) + { + var decodedBucketMetadata = new BucketMetadata(); + decodedBucketMetadata.LedgerVersion = Uint32.Decode(stream); + decodedBucketMetadata.Ext = BucketMetadataExt.Decode(stream); + return decodedBucketMetadata; + } - // =========================================================================== - public class BucketMetadata + public class BucketMetadataExt { - public BucketMetadata() { } - public Uint32 LedgerVersion { get; set; } - public BucketMetadataExt Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, BucketMetadata encodedBucketMetadata) + public static void Encode(XdrDataOutputStream stream, BucketMetadataExt encodedBucketMetadataExt) { - Uint32.Encode(stream, encodedBucketMetadata.LedgerVersion); - BucketMetadataExt.Encode(stream, encodedBucketMetadata.Ext); - } - public static BucketMetadata Decode(XdrDataInputStream stream) - { - BucketMetadata decodedBucketMetadata = new BucketMetadata(); - decodedBucketMetadata.LedgerVersion = Uint32.Decode(stream); - decodedBucketMetadata.Ext = BucketMetadataExt.Decode(stream); - return decodedBucketMetadata; + stream.WriteInt(encodedBucketMetadataExt.Discriminant); + switch (encodedBucketMetadataExt.Discriminant) + { + case 0: + break; + } } - public class BucketMetadataExt + public static BucketMetadataExt Decode(XdrDataInputStream stream) { - public BucketMetadataExt() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, BucketMetadataExt encodedBucketMetadataExt) - { - stream.WriteInt((int)encodedBucketMetadataExt.Discriminant); - switch (encodedBucketMetadataExt.Discriminant) - { - case 0: - break; - } - } - public static BucketMetadataExt Decode(XdrDataInputStream stream) + var decodedBucketMetadataExt = new BucketMetadataExt(); + var discriminant = stream.ReadInt(); + decodedBucketMetadataExt.Discriminant = discriminant; + switch (decodedBucketMetadataExt.Discriminant) { - BucketMetadataExt decodedBucketMetadataExt = new BucketMetadataExt(); - int discriminant = stream.ReadInt(); - decodedBucketMetadataExt.Discriminant = discriminant; - switch (decodedBucketMetadataExt.Discriminant) - { - case 0: - break; - } - return decodedBucketMetadataExt; + case 0: + break; } + return decodedBucketMetadataExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BumpSequenceOp.cs b/stellar-dotnet-sdk-xdr/generated/BumpSequenceOp.cs index 20ba9f8f..09b5b80d 100644 --- a/stellar-dotnet-sdk-xdr/generated/BumpSequenceOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/BumpSequenceOp.cs @@ -1,32 +1,29 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct BumpSequenceOp +// { +// SequenceNumber bumpTo; +// }; - // struct BumpSequenceOp - // { - // SequenceNumber bumpTo; - // }; +// =========================================================================== +public class BumpSequenceOp +{ + public SequenceNumber BumpTo { get; set; } - // =========================================================================== - public class BumpSequenceOp + public static void Encode(XdrDataOutputStream stream, BumpSequenceOp encodedBumpSequenceOp) { - public BumpSequenceOp() { } - public SequenceNumber BumpTo { get; set; } + SequenceNumber.Encode(stream, encodedBumpSequenceOp.BumpTo); + } - public static void Encode(XdrDataOutputStream stream, BumpSequenceOp encodedBumpSequenceOp) - { - SequenceNumber.Encode(stream, encodedBumpSequenceOp.BumpTo); - } - public static BumpSequenceOp Decode(XdrDataInputStream stream) - { - BumpSequenceOp decodedBumpSequenceOp = new BumpSequenceOp(); - decodedBumpSequenceOp.BumpTo = SequenceNumber.Decode(stream); - return decodedBumpSequenceOp; - } + public static BumpSequenceOp Decode(XdrDataInputStream stream) + { + var decodedBumpSequenceOp = new BumpSequenceOp(); + decodedBumpSequenceOp.BumpTo = SequenceNumber.Decode(stream); + return decodedBumpSequenceOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BumpSequenceResult.cs b/stellar-dotnet-sdk-xdr/generated/BumpSequenceResult.cs index d4743568..847fef61 100644 --- a/stellar-dotnet-sdk-xdr/generated/BumpSequenceResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/BumpSequenceResult.cs @@ -1,51 +1,48 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union BumpSequenceResult switch (BumpSequenceResultCode code) - // { - // case BUMP_SEQUENCE_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class BumpSequenceResult - { - public BumpSequenceResult() { } +// union BumpSequenceResult switch (BumpSequenceResultCode code) +// { +// case BUMP_SEQUENCE_SUCCESS: +// void; +// case BUMP_SEQUENCE_BAD_SEQ: +// void; +// }; - public BumpSequenceResultCode Discriminant { get; set; } = new BumpSequenceResultCode(); +// =========================================================================== +public class BumpSequenceResult +{ + public BumpSequenceResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, BumpSequenceResult encodedBumpSequenceResult) + public static void Encode(XdrDataOutputStream stream, BumpSequenceResult encodedBumpSequenceResult) + { + stream.WriteInt((int)encodedBumpSequenceResult.Discriminant.InnerValue); + switch (encodedBumpSequenceResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedBumpSequenceResult.Discriminant.InnerValue); - switch (encodedBumpSequenceResult.Discriminant.InnerValue) - { - case BumpSequenceResultCode.BumpSequenceResultCodeEnum.BUMP_SEQUENCE_SUCCESS: - break; - default: - break; - } + case BumpSequenceResultCode.BumpSequenceResultCodeEnum.BUMP_SEQUENCE_SUCCESS: + break; + case BumpSequenceResultCode.BumpSequenceResultCodeEnum.BUMP_SEQUENCE_BAD_SEQ: + break; } - public static BumpSequenceResult Decode(XdrDataInputStream stream) + } + + public static BumpSequenceResult Decode(XdrDataInputStream stream) + { + var decodedBumpSequenceResult = new BumpSequenceResult(); + var discriminant = BumpSequenceResultCode.Decode(stream); + decodedBumpSequenceResult.Discriminant = discriminant; + switch (decodedBumpSequenceResult.Discriminant.InnerValue) { - BumpSequenceResult decodedBumpSequenceResult = new BumpSequenceResult(); - BumpSequenceResultCode discriminant = BumpSequenceResultCode.Decode(stream); - decodedBumpSequenceResult.Discriminant = discriminant; - switch (decodedBumpSequenceResult.Discriminant.InnerValue) - { - case BumpSequenceResultCode.BumpSequenceResultCodeEnum.BUMP_SEQUENCE_SUCCESS: - break; - default: - break; - } - return decodedBumpSequenceResult; + case BumpSequenceResultCode.BumpSequenceResultCodeEnum.BUMP_SEQUENCE_SUCCESS: + break; + case BumpSequenceResultCode.BumpSequenceResultCodeEnum.BUMP_SEQUENCE_BAD_SEQ: + break; } + + return decodedBumpSequenceResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/BumpSequenceResultCode.cs b/stellar-dotnet-sdk-xdr/generated/BumpSequenceResultCode.cs index c93010b3..2ee6f469 100644 --- a/stellar-dotnet-sdk-xdr/generated/BumpSequenceResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/BumpSequenceResultCode.cs @@ -1,53 +1,53 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum BumpSequenceResultCode - // { - // // codes considered as "success" for the operation - // BUMP_SEQUENCE_SUCCESS = 0, - // // codes considered as "failure" for the operation - // BUMP_SEQUENCE_BAD_SEQ = -1 // `bumpTo` is not within bounds - // }; +// enum BumpSequenceResultCode +// { +// // codes considered as "success" for the operation +// BUMP_SEQUENCE_SUCCESS = 0, +// // codes considered as "failure" for the operation +// BUMP_SEQUENCE_BAD_SEQ = -1 // `bumpTo` is not within bounds +// }; - // =========================================================================== - public class BumpSequenceResultCode +// =========================================================================== +public class BumpSequenceResultCode +{ + public enum BumpSequenceResultCodeEnum { - public enum BumpSequenceResultCodeEnum - { - BUMP_SEQUENCE_SUCCESS = 0, - BUMP_SEQUENCE_BAD_SEQ = -1, - } - public BumpSequenceResultCodeEnum InnerValue { get; set; } = default(BumpSequenceResultCodeEnum); + BUMP_SEQUENCE_SUCCESS = 0, + BUMP_SEQUENCE_BAD_SEQ = -1 + } - public static BumpSequenceResultCode Create(BumpSequenceResultCodeEnum v) - { - return new BumpSequenceResultCode - { - InnerValue = v - }; - } + public BumpSequenceResultCodeEnum InnerValue { get; set; } = default; - public static BumpSequenceResultCode Decode(XdrDataInputStream stream) + public static BumpSequenceResultCode Create(BumpSequenceResultCodeEnum v) + { + return new BumpSequenceResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(BumpSequenceResultCodeEnum.BUMP_SEQUENCE_SUCCESS); - case -1: return Create(BumpSequenceResultCodeEnum.BUMP_SEQUENCE_BAD_SEQ); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, BumpSequenceResultCode value) + public static BumpSequenceResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(BumpSequenceResultCodeEnum.BUMP_SEQUENCE_SUCCESS); + case -1: return Create(BumpSequenceResultCodeEnum.BUMP_SEQUENCE_BAD_SEQ); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, BumpSequenceResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ChangeTrustAsset.cs b/stellar-dotnet-sdk-xdr/generated/ChangeTrustAsset.cs index 7300d0fb..1309c69e 100644 --- a/stellar-dotnet-sdk-xdr/generated/ChangeTrustAsset.cs +++ b/stellar-dotnet-sdk-xdr/generated/ChangeTrustAsset.cs @@ -1,77 +1,75 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union ChangeTrustAsset switch (AssetType type) - // { - // 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 - // }; +// union ChangeTrustAsset switch (AssetType type) +// { +// 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 +// }; - // =========================================================================== - public class ChangeTrustAsset - { - public ChangeTrustAsset() { } +// =========================================================================== +public class ChangeTrustAsset +{ + public AssetType Discriminant { get; set; } = new(); - public AssetType Discriminant { get; set; } = new AssetType(); + public AlphaNum4 AlphaNum4 { get; set; } + public AlphaNum12 AlphaNum12 { get; set; } + public LiquidityPoolParameters LiquidityPool { get; set; } - public AlphaNum4 AlphaNum4 { get; set; } - public AlphaNum12 AlphaNum12 { get; set; } - public LiquidityPoolParameters LiquidityPool { get; set; } - public static void Encode(XdrDataOutputStream stream, ChangeTrustAsset encodedChangeTrustAsset) + public static void Encode(XdrDataOutputStream stream, ChangeTrustAsset encodedChangeTrustAsset) + { + stream.WriteInt((int)encodedChangeTrustAsset.Discriminant.InnerValue); + switch (encodedChangeTrustAsset.Discriminant.InnerValue) { - stream.WriteInt((int)encodedChangeTrustAsset.Discriminant.InnerValue); - switch (encodedChangeTrustAsset.Discriminant.InnerValue) - { - case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: - AlphaNum4.Encode(stream, encodedChangeTrustAsset.AlphaNum4); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: - AlphaNum12.Encode(stream, encodedChangeTrustAsset.AlphaNum12); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_POOL_SHARE: - LiquidityPoolParameters.Encode(stream, encodedChangeTrustAsset.LiquidityPool); - break; - } + case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: + AlphaNum4.Encode(stream, encodedChangeTrustAsset.AlphaNum4); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: + AlphaNum12.Encode(stream, encodedChangeTrustAsset.AlphaNum12); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_POOL_SHARE: + LiquidityPoolParameters.Encode(stream, encodedChangeTrustAsset.LiquidityPool); + break; } - public static ChangeTrustAsset Decode(XdrDataInputStream stream) + } + + public static ChangeTrustAsset Decode(XdrDataInputStream stream) + { + var decodedChangeTrustAsset = new ChangeTrustAsset(); + var discriminant = AssetType.Decode(stream); + decodedChangeTrustAsset.Discriminant = discriminant; + switch (decodedChangeTrustAsset.Discriminant.InnerValue) { - ChangeTrustAsset decodedChangeTrustAsset = new ChangeTrustAsset(); - AssetType discriminant = AssetType.Decode(stream); - decodedChangeTrustAsset.Discriminant = discriminant; - switch (decodedChangeTrustAsset.Discriminant.InnerValue) - { - case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: - decodedChangeTrustAsset.AlphaNum4 = AlphaNum4.Decode(stream); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: - decodedChangeTrustAsset.AlphaNum12 = AlphaNum12.Decode(stream); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_POOL_SHARE: - decodedChangeTrustAsset.LiquidityPool = LiquidityPoolParameters.Decode(stream); - break; - } - return decodedChangeTrustAsset; + case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: + decodedChangeTrustAsset.AlphaNum4 = AlphaNum4.Decode(stream); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: + decodedChangeTrustAsset.AlphaNum12 = AlphaNum12.Decode(stream); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_POOL_SHARE: + decodedChangeTrustAsset.LiquidityPool = LiquidityPoolParameters.Decode(stream); + break; } + + return decodedChangeTrustAsset; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ChangeTrustOp.cs b/stellar-dotnet-sdk-xdr/generated/ChangeTrustOp.cs index 26fc1281..21f40e88 100644 --- a/stellar-dotnet-sdk-xdr/generated/ChangeTrustOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/ChangeTrustOp.cs @@ -1,38 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct ChangeTrustOp +// { +// ChangeTrustAsset line; +// +// // if limit is set to 0, deletes the trust line +// int64 limit; +// }; - // struct ChangeTrustOp - // { - // ChangeTrustAsset line; - // - // // if limit is set to 0, deletes the trust line - // int64 limit; - // }; +// =========================================================================== +public class ChangeTrustOp +{ + public ChangeTrustAsset Line { get; set; } + public Int64 Limit { get; set; } - // =========================================================================== - public class ChangeTrustOp + public static void Encode(XdrDataOutputStream stream, ChangeTrustOp encodedChangeTrustOp) { - public ChangeTrustOp() { } - public ChangeTrustAsset Line { get; set; } - public Int64 Limit { get; set; } + ChangeTrustAsset.Encode(stream, encodedChangeTrustOp.Line); + Int64.Encode(stream, encodedChangeTrustOp.Limit); + } - public static void Encode(XdrDataOutputStream stream, ChangeTrustOp encodedChangeTrustOp) - { - ChangeTrustAsset.Encode(stream, encodedChangeTrustOp.Line); - Int64.Encode(stream, encodedChangeTrustOp.Limit); - } - public static ChangeTrustOp Decode(XdrDataInputStream stream) - { - ChangeTrustOp decodedChangeTrustOp = new ChangeTrustOp(); - decodedChangeTrustOp.Line = ChangeTrustAsset.Decode(stream); - decodedChangeTrustOp.Limit = Int64.Decode(stream); - return decodedChangeTrustOp; - } + public static ChangeTrustOp Decode(XdrDataInputStream stream) + { + var decodedChangeTrustOp = new ChangeTrustOp(); + decodedChangeTrustOp.Line = ChangeTrustAsset.Decode(stream); + decodedChangeTrustOp.Limit = Int64.Decode(stream); + return decodedChangeTrustOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ChangeTrustResult.cs b/stellar-dotnet-sdk-xdr/generated/ChangeTrustResult.cs index e53bb328..85fcbd5f 100644 --- a/stellar-dotnet-sdk-xdr/generated/ChangeTrustResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/ChangeTrustResult.cs @@ -1,51 +1,69 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union ChangeTrustResult switch (ChangeTrustResultCode code) - // { - // case CHANGE_TRUST_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class ChangeTrustResult - { - public ChangeTrustResult() { } +// union ChangeTrustResult switch (ChangeTrustResultCode code) +// { +// case CHANGE_TRUST_SUCCESS: +// void; +// case CHANGE_TRUST_MALFORMED: +// case CHANGE_TRUST_NO_ISSUER: +// case CHANGE_TRUST_INVALID_LIMIT: +// case CHANGE_TRUST_LOW_RESERVE: +// case CHANGE_TRUST_SELF_NOT_ALLOWED: +// case CHANGE_TRUST_TRUST_LINE_MISSING: +// case CHANGE_TRUST_CANNOT_DELETE: +// case CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES: +// void; +// }; - public ChangeTrustResultCode Discriminant { get; set; } = new ChangeTrustResultCode(); +// =========================================================================== +public class ChangeTrustResult +{ + public ChangeTrustResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, ChangeTrustResult encodedChangeTrustResult) + public static void Encode(XdrDataOutputStream stream, ChangeTrustResult encodedChangeTrustResult) + { + stream.WriteInt((int)encodedChangeTrustResult.Discriminant.InnerValue); + switch (encodedChangeTrustResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedChangeTrustResult.Discriminant.InnerValue); - switch (encodedChangeTrustResult.Discriminant.InnerValue) - { - case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS: - break; - default: - break; - } + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS: + break; + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_MALFORMED: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_NO_ISSUER: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_INVALID_LIMIT: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_LOW_RESERVE: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_SELF_NOT_ALLOWED: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_TRUST_LINE_MISSING: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_CANNOT_DELETE: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES: + break; } - public static ChangeTrustResult Decode(XdrDataInputStream stream) + } + + public static ChangeTrustResult Decode(XdrDataInputStream stream) + { + var decodedChangeTrustResult = new ChangeTrustResult(); + var discriminant = ChangeTrustResultCode.Decode(stream); + decodedChangeTrustResult.Discriminant = discriminant; + switch (decodedChangeTrustResult.Discriminant.InnerValue) { - ChangeTrustResult decodedChangeTrustResult = new ChangeTrustResult(); - ChangeTrustResultCode discriminant = ChangeTrustResultCode.Decode(stream); - decodedChangeTrustResult.Discriminant = discriminant; - switch (decodedChangeTrustResult.Discriminant.InnerValue) - { - case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS: - break; - default: - break; - } - return decodedChangeTrustResult; + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS: + break; + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_MALFORMED: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_NO_ISSUER: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_INVALID_LIMIT: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_LOW_RESERVE: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_SELF_NOT_ALLOWED: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_TRUST_LINE_MISSING: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_CANNOT_DELETE: + case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES: + break; } + + return decodedChangeTrustResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ChangeTrustResultCode.cs b/stellar-dotnet-sdk-xdr/generated/ChangeTrustResultCode.cs index 4a707511..a6ab94f2 100644 --- a/stellar-dotnet-sdk-xdr/generated/ChangeTrustResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/ChangeTrustResultCode.cs @@ -1,78 +1,78 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ChangeTrustResultCode - // { - // // codes considered as "success" for the operation - // CHANGE_TRUST_SUCCESS = 0, - // // codes considered as "failure" for the operation - // CHANGE_TRUST_MALFORMED = -1, // bad input - // CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer - // CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance - // // cannot create with a limit of 0 - // CHANGE_TRUST_LOW_RESERVE = - // -4, // not enough funds to create a new trust line, - // CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed - // CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool - // CHANGE_TRUST_CANNOT_DELETE = - // -7, // Asset trustline is still referenced in a pool - // CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = - // -8 // Asset trustline is deauthorized - // }; +// enum ChangeTrustResultCode +// { +// // codes considered as "success" for the operation +// CHANGE_TRUST_SUCCESS = 0, +// // codes considered as "failure" for the operation +// CHANGE_TRUST_MALFORMED = -1, // bad input +// CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer +// CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance +// // cannot create with a limit of 0 +// CHANGE_TRUST_LOW_RESERVE = +// -4, // not enough funds to create a new trust line, +// CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed +// CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool +// CHANGE_TRUST_CANNOT_DELETE = +// -7, // Asset trustline is still referenced in a pool +// CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = +// -8 // Asset trustline is deauthorized +// }; - // =========================================================================== - public class ChangeTrustResultCode +// =========================================================================== +public class ChangeTrustResultCode +{ + public enum ChangeTrustResultCodeEnum { - public enum ChangeTrustResultCodeEnum - { - CHANGE_TRUST_SUCCESS = 0, - CHANGE_TRUST_MALFORMED = -1, - CHANGE_TRUST_NO_ISSUER = -2, - CHANGE_TRUST_INVALID_LIMIT = -3, - CHANGE_TRUST_LOW_RESERVE = -4, - CHANGE_TRUST_SELF_NOT_ALLOWED = -5, - CHANGE_TRUST_TRUST_LINE_MISSING = -6, - CHANGE_TRUST_CANNOT_DELETE = -7, - CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = -8, - } - public ChangeTrustResultCodeEnum InnerValue { get; set; } = default(ChangeTrustResultCodeEnum); + CHANGE_TRUST_SUCCESS = 0, + CHANGE_TRUST_MALFORMED = -1, + CHANGE_TRUST_NO_ISSUER = -2, + CHANGE_TRUST_INVALID_LIMIT = -3, + CHANGE_TRUST_LOW_RESERVE = -4, + CHANGE_TRUST_SELF_NOT_ALLOWED = -5, + CHANGE_TRUST_TRUST_LINE_MISSING = -6, + CHANGE_TRUST_CANNOT_DELETE = -7, + CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = -8 + } - public static ChangeTrustResultCode Create(ChangeTrustResultCodeEnum v) - { - return new ChangeTrustResultCode - { - InnerValue = v - }; - } + public ChangeTrustResultCodeEnum InnerValue { get; set; } = default; - public static ChangeTrustResultCode Decode(XdrDataInputStream stream) + public static ChangeTrustResultCode Create(ChangeTrustResultCodeEnum v) + { + return new ChangeTrustResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS); - case -1: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_MALFORMED); - case -2: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_NO_ISSUER); - case -3: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_INVALID_LIMIT); - case -4: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_LOW_RESERVE); - case -5: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_SELF_NOT_ALLOWED); - case -6: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_TRUST_LINE_MISSING); - case -7: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_CANNOT_DELETE); - case -8: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ChangeTrustResultCode value) + public static ChangeTrustResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS); + case -1: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_MALFORMED); + case -2: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_NO_ISSUER); + case -3: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_INVALID_LIMIT); + case -4: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_LOW_RESERVE); + case -5: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_SELF_NOT_ALLOWED); + case -6: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_TRUST_LINE_MISSING); + case -7: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_CANNOT_DELETE); + case -8: return Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ChangeTrustResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimAtom.cs b/stellar-dotnet-sdk-xdr/generated/ClaimAtom.cs index ad7c41fd..4275916b 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimAtom.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimAtom.cs @@ -1,66 +1,64 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union ClaimAtom switch (ClaimAtomType type) - // { - // case CLAIM_ATOM_TYPE_V0: - // ClaimOfferAtomV0 v0; - // case CLAIM_ATOM_TYPE_ORDER_BOOK: - // ClaimOfferAtom orderBook; - // case CLAIM_ATOM_TYPE_LIQUIDITY_POOL: - // ClaimLiquidityAtom liquidityPool; - // }; +// union ClaimAtom switch (ClaimAtomType type) +// { +// case CLAIM_ATOM_TYPE_V0: +// ClaimOfferAtomV0 v0; +// case CLAIM_ATOM_TYPE_ORDER_BOOK: +// ClaimOfferAtom orderBook; +// case CLAIM_ATOM_TYPE_LIQUIDITY_POOL: +// ClaimLiquidityAtom liquidityPool; +// }; - // =========================================================================== - public class ClaimAtom - { - public ClaimAtom() { } +// =========================================================================== +public class ClaimAtom +{ + public ClaimAtomType Discriminant { get; set; } = new(); - public ClaimAtomType Discriminant { get; set; } = new ClaimAtomType(); + public ClaimOfferAtomV0 V0 { get; set; } + public ClaimOfferAtom OrderBook { get; set; } + public ClaimLiquidityAtom LiquidityPool { get; set; } - public ClaimOfferAtomV0 V0 { get; set; } - public ClaimOfferAtom OrderBook { get; set; } - public ClaimLiquidityAtom LiquidityPool { get; set; } - public static void Encode(XdrDataOutputStream stream, ClaimAtom encodedClaimAtom) + public static void Encode(XdrDataOutputStream stream, ClaimAtom encodedClaimAtom) + { + stream.WriteInt((int)encodedClaimAtom.Discriminant.InnerValue); + switch (encodedClaimAtom.Discriminant.InnerValue) { - stream.WriteInt((int)encodedClaimAtom.Discriminant.InnerValue); - switch (encodedClaimAtom.Discriminant.InnerValue) - { - case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_V0: - ClaimOfferAtomV0.Encode(stream, encodedClaimAtom.V0); - break; - case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_ORDER_BOOK: - ClaimOfferAtom.Encode(stream, encodedClaimAtom.OrderBook); - break; - case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_LIQUIDITY_POOL: - ClaimLiquidityAtom.Encode(stream, encodedClaimAtom.LiquidityPool); - break; - } + case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_V0: + ClaimOfferAtomV0.Encode(stream, encodedClaimAtom.V0); + break; + case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_ORDER_BOOK: + ClaimOfferAtom.Encode(stream, encodedClaimAtom.OrderBook); + break; + case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_LIQUIDITY_POOL: + ClaimLiquidityAtom.Encode(stream, encodedClaimAtom.LiquidityPool); + break; } - public static ClaimAtom Decode(XdrDataInputStream stream) + } + + public static ClaimAtom Decode(XdrDataInputStream stream) + { + var decodedClaimAtom = new ClaimAtom(); + var discriminant = ClaimAtomType.Decode(stream); + decodedClaimAtom.Discriminant = discriminant; + switch (decodedClaimAtom.Discriminant.InnerValue) { - ClaimAtom decodedClaimAtom = new ClaimAtom(); - ClaimAtomType discriminant = ClaimAtomType.Decode(stream); - decodedClaimAtom.Discriminant = discriminant; - switch (decodedClaimAtom.Discriminant.InnerValue) - { - case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_V0: - decodedClaimAtom.V0 = ClaimOfferAtomV0.Decode(stream); - break; - case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_ORDER_BOOK: - decodedClaimAtom.OrderBook = ClaimOfferAtom.Decode(stream); - break; - case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_LIQUIDITY_POOL: - decodedClaimAtom.LiquidityPool = ClaimLiquidityAtom.Decode(stream); - break; - } - return decodedClaimAtom; + case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_V0: + decodedClaimAtom.V0 = ClaimOfferAtomV0.Decode(stream); + break; + case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_ORDER_BOOK: + decodedClaimAtom.OrderBook = ClaimOfferAtom.Decode(stream); + break; + case ClaimAtomType.ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_LIQUIDITY_POOL: + decodedClaimAtom.LiquidityPool = ClaimLiquidityAtom.Decode(stream); + break; } + + return decodedClaimAtom; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimAtomType.cs b/stellar-dotnet-sdk-xdr/generated/ClaimAtomType.cs index d3ac5947..536a8c1a 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimAtomType.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimAtomType.cs @@ -1,54 +1,54 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ClaimAtomType - // { - // CLAIM_ATOM_TYPE_V0 = 0, - // CLAIM_ATOM_TYPE_ORDER_BOOK = 1, - // CLAIM_ATOM_TYPE_LIQUIDITY_POOL = 2 - // }; +// enum ClaimAtomType +// { +// CLAIM_ATOM_TYPE_V0 = 0, +// CLAIM_ATOM_TYPE_ORDER_BOOK = 1, +// CLAIM_ATOM_TYPE_LIQUIDITY_POOL = 2 +// }; - // =========================================================================== - public class ClaimAtomType +// =========================================================================== +public class ClaimAtomType +{ + public enum ClaimAtomTypeEnum { - public enum ClaimAtomTypeEnum - { - CLAIM_ATOM_TYPE_V0 = 0, - CLAIM_ATOM_TYPE_ORDER_BOOK = 1, - CLAIM_ATOM_TYPE_LIQUIDITY_POOL = 2, - } - public ClaimAtomTypeEnum InnerValue { get; set; } = default(ClaimAtomTypeEnum); + CLAIM_ATOM_TYPE_V0 = 0, + CLAIM_ATOM_TYPE_ORDER_BOOK = 1, + CLAIM_ATOM_TYPE_LIQUIDITY_POOL = 2 + } - public static ClaimAtomType Create(ClaimAtomTypeEnum v) - { - return new ClaimAtomType - { - InnerValue = v - }; - } + public ClaimAtomTypeEnum InnerValue { get; set; } = default; - public static ClaimAtomType Decode(XdrDataInputStream stream) + public static ClaimAtomType Create(ClaimAtomTypeEnum v) + { + return new ClaimAtomType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_V0); - case 1: return Create(ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_ORDER_BOOK); - case 2: return Create(ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_LIQUIDITY_POOL); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ClaimAtomType value) + public static ClaimAtomType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_V0); + case 1: return Create(ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_ORDER_BOOK); + case 2: return Create(ClaimAtomTypeEnum.CLAIM_ATOM_TYPE_LIQUIDITY_POOL); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ClaimAtomType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceOp.cs b/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceOp.cs index c17b94e7..8fe8937d 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceOp.cs @@ -1,32 +1,29 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct ClaimClaimableBalanceOp +// { +// ClaimableBalanceID balanceID; +// }; - // struct ClaimClaimableBalanceOp - // { - // ClaimableBalanceID balanceID; - // }; +// =========================================================================== +public class ClaimClaimableBalanceOp +{ + public ClaimableBalanceID BalanceID { get; set; } - // =========================================================================== - public class ClaimClaimableBalanceOp + public static void Encode(XdrDataOutputStream stream, ClaimClaimableBalanceOp encodedClaimClaimableBalanceOp) { - public ClaimClaimableBalanceOp() { } - public ClaimableBalanceID BalanceID { get; set; } + ClaimableBalanceID.Encode(stream, encodedClaimClaimableBalanceOp.BalanceID); + } - public static void Encode(XdrDataOutputStream stream, ClaimClaimableBalanceOp encodedClaimClaimableBalanceOp) - { - ClaimableBalanceID.Encode(stream, encodedClaimClaimableBalanceOp.BalanceID); - } - public static ClaimClaimableBalanceOp Decode(XdrDataInputStream stream) - { - ClaimClaimableBalanceOp decodedClaimClaimableBalanceOp = new ClaimClaimableBalanceOp(); - decodedClaimClaimableBalanceOp.BalanceID = ClaimableBalanceID.Decode(stream); - return decodedClaimClaimableBalanceOp; - } + public static ClaimClaimableBalanceOp Decode(XdrDataInputStream stream) + { + var decodedClaimClaimableBalanceOp = new ClaimClaimableBalanceOp(); + decodedClaimClaimableBalanceOp.BalanceID = ClaimableBalanceID.Decode(stream); + return decodedClaimClaimableBalanceOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceResult.cs b/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceResult.cs index 161813d2..092ece26 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceResult.cs @@ -1,51 +1,67 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union ClaimClaimableBalanceResult switch (ClaimClaimableBalanceResultCode code) - // { - // case CLAIM_CLAIMABLE_BALANCE_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class ClaimClaimableBalanceResult - { - public ClaimClaimableBalanceResult() { } +// union ClaimClaimableBalanceResult switch (ClaimClaimableBalanceResultCode code) +// { +// case CLAIM_CLAIMABLE_BALANCE_SUCCESS: +// void; +// case CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST: +// case CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM: +// case CLAIM_CLAIMABLE_BALANCE_LINE_FULL: +// case CLAIM_CLAIMABLE_BALANCE_NO_TRUST: +// case CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED: +// void; +// }; - public ClaimClaimableBalanceResultCode Discriminant { get; set; } = new ClaimClaimableBalanceResultCode(); +// =========================================================================== +public class ClaimClaimableBalanceResult +{ + public ClaimClaimableBalanceResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, ClaimClaimableBalanceResult encodedClaimClaimableBalanceResult) + public static void Encode(XdrDataOutputStream stream, + ClaimClaimableBalanceResult encodedClaimClaimableBalanceResult) + { + stream.WriteInt((int)encodedClaimClaimableBalanceResult.Discriminant.InnerValue); + switch (encodedClaimClaimableBalanceResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedClaimClaimableBalanceResult.Discriminant.InnerValue); - switch (encodedClaimClaimableBalanceResult.Discriminant.InnerValue) - { - case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_SUCCESS: - break; - default: - break; - } + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_SUCCESS: + break; + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum + .CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST: + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum + .CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM: + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_LINE_FULL: + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_NO_TRUST: + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum + .CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED: + break; } - public static ClaimClaimableBalanceResult Decode(XdrDataInputStream stream) + } + + public static ClaimClaimableBalanceResult Decode(XdrDataInputStream stream) + { + var decodedClaimClaimableBalanceResult = new ClaimClaimableBalanceResult(); + var discriminant = ClaimClaimableBalanceResultCode.Decode(stream); + decodedClaimClaimableBalanceResult.Discriminant = discriminant; + switch (decodedClaimClaimableBalanceResult.Discriminant.InnerValue) { - ClaimClaimableBalanceResult decodedClaimClaimableBalanceResult = new ClaimClaimableBalanceResult(); - ClaimClaimableBalanceResultCode discriminant = ClaimClaimableBalanceResultCode.Decode(stream); - decodedClaimClaimableBalanceResult.Discriminant = discriminant; - switch (decodedClaimClaimableBalanceResult.Discriminant.InnerValue) - { - case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_SUCCESS: - break; - default: - break; - } - return decodedClaimClaimableBalanceResult; + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_SUCCESS: + break; + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum + .CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST: + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum + .CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM: + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_LINE_FULL: + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_NO_TRUST: + case ClaimClaimableBalanceResultCode.ClaimClaimableBalanceResultCodeEnum + .CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED: + break; } + + return decodedClaimClaimableBalanceResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceResultCode.cs b/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceResultCode.cs index 0e924bc4..76641767 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimClaimableBalanceResultCode.cs @@ -1,64 +1,63 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ClaimClaimableBalanceResultCode - // { - // CLAIM_CLAIMABLE_BALANCE_SUCCESS = 0, - // CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, - // CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM = -2, - // CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3, - // CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4, - // CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5 - // - // }; +// enum ClaimClaimableBalanceResultCode +// { +// CLAIM_CLAIMABLE_BALANCE_SUCCESS = 0, +// CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, +// CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM = -2, +// CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3, +// CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4, +// CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5 +// }; - // =========================================================================== - public class ClaimClaimableBalanceResultCode +// =========================================================================== +public class ClaimClaimableBalanceResultCode +{ + public enum ClaimClaimableBalanceResultCodeEnum { - public enum ClaimClaimableBalanceResultCodeEnum - { - CLAIM_CLAIMABLE_BALANCE_SUCCESS = 0, - CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, - CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM = -2, - CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3, - CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4, - CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5, - } - public ClaimClaimableBalanceResultCodeEnum InnerValue { get; set; } = default(ClaimClaimableBalanceResultCodeEnum); + CLAIM_CLAIMABLE_BALANCE_SUCCESS = 0, + CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, + CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM = -2, + CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3, + CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4, + CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5 + } - public static ClaimClaimableBalanceResultCode Create(ClaimClaimableBalanceResultCodeEnum v) - { - return new ClaimClaimableBalanceResultCode - { - InnerValue = v - }; - } + public ClaimClaimableBalanceResultCodeEnum InnerValue { get; set; } = default; - public static ClaimClaimableBalanceResultCode Decode(XdrDataInputStream stream) + public static ClaimClaimableBalanceResultCode Create(ClaimClaimableBalanceResultCodeEnum v) + { + return new ClaimClaimableBalanceResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_SUCCESS); - case -1: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST); - case -2: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM); - case -3: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_LINE_FULL); - case -4: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_NO_TRUST); - case -5: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ClaimClaimableBalanceResultCode value) + public static ClaimClaimableBalanceResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_SUCCESS); + case -1: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST); + case -2: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM); + case -3: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_LINE_FULL); + case -4: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_NO_TRUST); + case -5: return Create(ClaimClaimableBalanceResultCodeEnum.CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ClaimClaimableBalanceResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimLiquidityAtom.cs b/stellar-dotnet-sdk-xdr/generated/ClaimLiquidityAtom.cs index 1abbdecd..7b8f4b82 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimLiquidityAtom.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimLiquidityAtom.cs @@ -1,52 +1,49 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// 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; +// }; - // 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; - // }; +// =========================================================================== +public class ClaimLiquidityAtom +{ + public PoolID LiquidityPoolID { get; set; } + public Asset AssetSold { get; set; } + public Int64 AmountSold { get; set; } + public Asset AssetBought { get; set; } + public Int64 AmountBought { get; set; } - // =========================================================================== - public class ClaimLiquidityAtom + public static void Encode(XdrDataOutputStream stream, ClaimLiquidityAtom encodedClaimLiquidityAtom) { - public ClaimLiquidityAtom() { } - public PoolID LiquidityPoolID { get; set; } - public Asset AssetSold { get; set; } - public Int64 AmountSold { get; set; } - public Asset AssetBought { get; set; } - public Int64 AmountBought { get; set; } + PoolID.Encode(stream, encodedClaimLiquidityAtom.LiquidityPoolID); + Asset.Encode(stream, encodedClaimLiquidityAtom.AssetSold); + Int64.Encode(stream, encodedClaimLiquidityAtom.AmountSold); + Asset.Encode(stream, encodedClaimLiquidityAtom.AssetBought); + Int64.Encode(stream, encodedClaimLiquidityAtom.AmountBought); + } - public static void Encode(XdrDataOutputStream stream, ClaimLiquidityAtom encodedClaimLiquidityAtom) - { - PoolID.Encode(stream, encodedClaimLiquidityAtom.LiquidityPoolID); - Asset.Encode(stream, encodedClaimLiquidityAtom.AssetSold); - Int64.Encode(stream, encodedClaimLiquidityAtom.AmountSold); - Asset.Encode(stream, encodedClaimLiquidityAtom.AssetBought); - Int64.Encode(stream, encodedClaimLiquidityAtom.AmountBought); - } - public static ClaimLiquidityAtom Decode(XdrDataInputStream stream) - { - ClaimLiquidityAtom decodedClaimLiquidityAtom = new ClaimLiquidityAtom(); - decodedClaimLiquidityAtom.LiquidityPoolID = PoolID.Decode(stream); - decodedClaimLiquidityAtom.AssetSold = Asset.Decode(stream); - decodedClaimLiquidityAtom.AmountSold = Int64.Decode(stream); - decodedClaimLiquidityAtom.AssetBought = Asset.Decode(stream); - decodedClaimLiquidityAtom.AmountBought = Int64.Decode(stream); - return decodedClaimLiquidityAtom; - } + public static ClaimLiquidityAtom Decode(XdrDataInputStream stream) + { + var decodedClaimLiquidityAtom = new ClaimLiquidityAtom(); + decodedClaimLiquidityAtom.LiquidityPoolID = PoolID.Decode(stream); + decodedClaimLiquidityAtom.AssetSold = Asset.Decode(stream); + decodedClaimLiquidityAtom.AmountSold = Int64.Decode(stream); + decodedClaimLiquidityAtom.AssetBought = Asset.Decode(stream); + decodedClaimLiquidityAtom.AmountBought = Int64.Decode(stream); + return decodedClaimLiquidityAtom; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimOfferAtom.cs b/stellar-dotnet-sdk-xdr/generated/ClaimOfferAtom.cs index b47c1e0b..6356b852 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimOfferAtom.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimOfferAtom.cs @@ -1,57 +1,54 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct ClaimOfferAtom +// { +// // 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; +// }; - // struct ClaimOfferAtom - // { - // // 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; - // }; +// =========================================================================== +public class ClaimOfferAtom +{ + public AccountID SellerID { get; set; } + public Int64 OfferID { get; set; } + public Asset AssetSold { get; set; } + public Int64 AmountSold { get; set; } + public Asset AssetBought { get; set; } + public Int64 AmountBought { get; set; } - // =========================================================================== - public class ClaimOfferAtom + public static void Encode(XdrDataOutputStream stream, ClaimOfferAtom encodedClaimOfferAtom) { - public ClaimOfferAtom() { } - public AccountID SellerID { get; set; } - public Int64 OfferID { get; set; } - public Asset AssetSold { get; set; } - public Int64 AmountSold { get; set; } - public Asset AssetBought { get; set; } - public Int64 AmountBought { get; set; } + AccountID.Encode(stream, encodedClaimOfferAtom.SellerID); + Int64.Encode(stream, encodedClaimOfferAtom.OfferID); + Asset.Encode(stream, encodedClaimOfferAtom.AssetSold); + Int64.Encode(stream, encodedClaimOfferAtom.AmountSold); + Asset.Encode(stream, encodedClaimOfferAtom.AssetBought); + Int64.Encode(stream, encodedClaimOfferAtom.AmountBought); + } - public static void Encode(XdrDataOutputStream stream, ClaimOfferAtom encodedClaimOfferAtom) - { - AccountID.Encode(stream, encodedClaimOfferAtom.SellerID); - Int64.Encode(stream, encodedClaimOfferAtom.OfferID); - Asset.Encode(stream, encodedClaimOfferAtom.AssetSold); - Int64.Encode(stream, encodedClaimOfferAtom.AmountSold); - Asset.Encode(stream, encodedClaimOfferAtom.AssetBought); - Int64.Encode(stream, encodedClaimOfferAtom.AmountBought); - } - public static ClaimOfferAtom Decode(XdrDataInputStream stream) - { - ClaimOfferAtom decodedClaimOfferAtom = new ClaimOfferAtom(); - decodedClaimOfferAtom.SellerID = AccountID.Decode(stream); - decodedClaimOfferAtom.OfferID = Int64.Decode(stream); - decodedClaimOfferAtom.AssetSold = Asset.Decode(stream); - decodedClaimOfferAtom.AmountSold = Int64.Decode(stream); - decodedClaimOfferAtom.AssetBought = Asset.Decode(stream); - decodedClaimOfferAtom.AmountBought = Int64.Decode(stream); - return decodedClaimOfferAtom; - } + public static ClaimOfferAtom Decode(XdrDataInputStream stream) + { + var decodedClaimOfferAtom = new ClaimOfferAtom(); + decodedClaimOfferAtom.SellerID = AccountID.Decode(stream); + decodedClaimOfferAtom.OfferID = Int64.Decode(stream); + decodedClaimOfferAtom.AssetSold = Asset.Decode(stream); + decodedClaimOfferAtom.AmountSold = Int64.Decode(stream); + decodedClaimOfferAtom.AssetBought = Asset.Decode(stream); + decodedClaimOfferAtom.AmountBought = Int64.Decode(stream); + return decodedClaimOfferAtom; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimOfferAtomV0.cs b/stellar-dotnet-sdk-xdr/generated/ClaimOfferAtomV0.cs index c9c9e244..6b4d2cea 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimOfferAtomV0.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimOfferAtomV0.cs @@ -1,57 +1,54 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct ClaimOfferAtomV0 +// { +// // 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; +// }; - // struct ClaimOfferAtomV0 - // { - // // 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; - // }; +// =========================================================================== +public class ClaimOfferAtomV0 +{ + public Uint256 SellerEd25519 { get; set; } + public Int64 OfferID { get; set; } + public Asset AssetSold { get; set; } + public Int64 AmountSold { get; set; } + public Asset AssetBought { get; set; } + public Int64 AmountBought { get; set; } - // =========================================================================== - public class ClaimOfferAtomV0 + public static void Encode(XdrDataOutputStream stream, ClaimOfferAtomV0 encodedClaimOfferAtomV0) { - public ClaimOfferAtomV0() { } - public Uint256 SellerEd25519 { get; set; } - public Int64 OfferID { get; set; } - public Asset AssetSold { get; set; } - public Int64 AmountSold { get; set; } - public Asset AssetBought { get; set; } - public Int64 AmountBought { get; set; } + Uint256.Encode(stream, encodedClaimOfferAtomV0.SellerEd25519); + Int64.Encode(stream, encodedClaimOfferAtomV0.OfferID); + Asset.Encode(stream, encodedClaimOfferAtomV0.AssetSold); + Int64.Encode(stream, encodedClaimOfferAtomV0.AmountSold); + Asset.Encode(stream, encodedClaimOfferAtomV0.AssetBought); + Int64.Encode(stream, encodedClaimOfferAtomV0.AmountBought); + } - public static void Encode(XdrDataOutputStream stream, ClaimOfferAtomV0 encodedClaimOfferAtomV0) - { - Uint256.Encode(stream, encodedClaimOfferAtomV0.SellerEd25519); - Int64.Encode(stream, encodedClaimOfferAtomV0.OfferID); - Asset.Encode(stream, encodedClaimOfferAtomV0.AssetSold); - Int64.Encode(stream, encodedClaimOfferAtomV0.AmountSold); - Asset.Encode(stream, encodedClaimOfferAtomV0.AssetBought); - Int64.Encode(stream, encodedClaimOfferAtomV0.AmountBought); - } - public static ClaimOfferAtomV0 Decode(XdrDataInputStream stream) - { - ClaimOfferAtomV0 decodedClaimOfferAtomV0 = new ClaimOfferAtomV0(); - decodedClaimOfferAtomV0.SellerEd25519 = Uint256.Decode(stream); - decodedClaimOfferAtomV0.OfferID = Int64.Decode(stream); - decodedClaimOfferAtomV0.AssetSold = Asset.Decode(stream); - decodedClaimOfferAtomV0.AmountSold = Int64.Decode(stream); - decodedClaimOfferAtomV0.AssetBought = Asset.Decode(stream); - decodedClaimOfferAtomV0.AmountBought = Int64.Decode(stream); - return decodedClaimOfferAtomV0; - } + public static ClaimOfferAtomV0 Decode(XdrDataInputStream stream) + { + var decodedClaimOfferAtomV0 = new ClaimOfferAtomV0(); + decodedClaimOfferAtomV0.SellerEd25519 = Uint256.Decode(stream); + decodedClaimOfferAtomV0.OfferID = Int64.Decode(stream); + decodedClaimOfferAtomV0.AssetSold = Asset.Decode(stream); + decodedClaimOfferAtomV0.AmountSold = Int64.Decode(stream); + decodedClaimOfferAtomV0.AssetBought = Asset.Decode(stream); + decodedClaimOfferAtomV0.AmountBought = Int64.Decode(stream); + return decodedClaimOfferAtomV0; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimPredicate.cs b/stellar-dotnet-sdk-xdr/generated/ClaimPredicate.cs index 53995e12..28cf673d 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimPredicate.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimPredicate.cs @@ -1,123 +1,107 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union ClaimPredicate switch (ClaimPredicateType type) - // { - // case CLAIM_PREDICATE_UNCONDITIONAL: - // void; - // case CLAIM_PREDICATE_AND: - // ClaimPredicate andPredicates<2>; - // case CLAIM_PREDICATE_OR: - // ClaimPredicate orPredicates<2>; - // case CLAIM_PREDICATE_NOT: - // ClaimPredicate* notPredicate; - // case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME: - // int64 absBefore; // Predicate will be true if closeTime < absBefore - // case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: - // int64 relBefore; // Seconds since closeTime of the ledger in which the - // // ClaimableBalanceEntry was created - // }; +// union ClaimPredicate switch (ClaimPredicateType type) +// { +// case CLAIM_PREDICATE_UNCONDITIONAL: +// void; +// case CLAIM_PREDICATE_AND: +// ClaimPredicate andPredicates<2>; +// case CLAIM_PREDICATE_OR: +// ClaimPredicate orPredicates<2>; +// case CLAIM_PREDICATE_NOT: +// ClaimPredicate* notPredicate; +// case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME: +// int64 absBefore; // Predicate will be true if closeTime < absBefore +// case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: +// int64 relBefore; // Seconds since closeTime of the ledger in which the +// // ClaimableBalanceEntry was created +// }; - // =========================================================================== - public class ClaimPredicate - { - public ClaimPredicate() { } +// =========================================================================== +public class ClaimPredicate +{ + public ClaimPredicateType Discriminant { get; set; } = new(); - public ClaimPredicateType Discriminant { get; set; } = new ClaimPredicateType(); + public ClaimPredicate[] AndPredicates { get; set; } + public ClaimPredicate[] OrPredicates { get; set; } + public ClaimPredicate NotPredicate { get; set; } + public Int64 AbsBefore { get; set; } + public Int64 RelBefore { get; set; } - public ClaimPredicate[] AndPredicates { get; set; } - public ClaimPredicate[] OrPredicates { get; set; } - public ClaimPredicate NotPredicate { get; set; } - public Int64 AbsBefore { get; set; } - public Int64 RelBefore { get; set; } - public static void Encode(XdrDataOutputStream stream, ClaimPredicate encodedClaimPredicate) + public static void Encode(XdrDataOutputStream stream, ClaimPredicate encodedClaimPredicate) + { + stream.WriteInt((int)encodedClaimPredicate.Discriminant.InnerValue); + switch (encodedClaimPredicate.Discriminant.InnerValue) { - stream.WriteInt((int)encodedClaimPredicate.Discriminant.InnerValue); - switch (encodedClaimPredicate.Discriminant.InnerValue) - { - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_UNCONDITIONAL: - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_AND: - int andPredicatessize = encodedClaimPredicate.AndPredicates.Length; - stream.WriteInt(andPredicatessize); - for (int i = 0; i < andPredicatessize; i++) - { - ClaimPredicate.Encode(stream, encodedClaimPredicate.AndPredicates[i]); - } - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_OR: - int orPredicatessize = encodedClaimPredicate.OrPredicates.Length; - stream.WriteInt(orPredicatessize); - for (int i = 0; i < orPredicatessize; i++) - { - ClaimPredicate.Encode(stream, encodedClaimPredicate.OrPredicates[i]); - } - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_NOT: - if (encodedClaimPredicate.NotPredicate != null) - { - stream.WriteInt(1); - ClaimPredicate.Encode(stream, encodedClaimPredicate.NotPredicate); - } - else - { - stream.WriteInt(0); - } - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME: - Int64.Encode(stream, encodedClaimPredicate.AbsBefore); - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: - Int64.Encode(stream, encodedClaimPredicate.RelBefore); - break; - } + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_UNCONDITIONAL: + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_AND: + var andPredicatessize = encodedClaimPredicate.AndPredicates.Length; + stream.WriteInt(andPredicatessize); + for (var i = 0; i < andPredicatessize; i++) Encode(stream, encodedClaimPredicate.AndPredicates[i]); + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_OR: + var orPredicatessize = encodedClaimPredicate.OrPredicates.Length; + stream.WriteInt(orPredicatessize); + for (var i = 0; i < orPredicatessize; i++) Encode(stream, encodedClaimPredicate.OrPredicates[i]); + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_NOT: + if (encodedClaimPredicate.NotPredicate != null) + { + stream.WriteInt(1); + Encode(stream, encodedClaimPredicate.NotPredicate); + } + else + { + stream.WriteInt(0); + } + + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME: + Int64.Encode(stream, encodedClaimPredicate.AbsBefore); + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: + Int64.Encode(stream, encodedClaimPredicate.RelBefore); + break; } - public static ClaimPredicate Decode(XdrDataInputStream stream) + } + + public static ClaimPredicate Decode(XdrDataInputStream stream) + { + var decodedClaimPredicate = new ClaimPredicate(); + var discriminant = ClaimPredicateType.Decode(stream); + decodedClaimPredicate.Discriminant = discriminant; + switch (decodedClaimPredicate.Discriminant.InnerValue) { - ClaimPredicate decodedClaimPredicate = new ClaimPredicate(); - ClaimPredicateType discriminant = ClaimPredicateType.Decode(stream); - decodedClaimPredicate.Discriminant = discriminant; - switch (decodedClaimPredicate.Discriminant.InnerValue) - { - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_UNCONDITIONAL: - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_AND: - int andPredicatessize = stream.ReadInt(); - decodedClaimPredicate.AndPredicates = new ClaimPredicate[andPredicatessize]; - for (int i = 0; i < andPredicatessize; i++) - { - decodedClaimPredicate.AndPredicates[i] = ClaimPredicate.Decode(stream); - } - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_OR: - int orPredicatessize = stream.ReadInt(); - decodedClaimPredicate.OrPredicates = new ClaimPredicate[orPredicatessize]; - for (int i = 0; i < orPredicatessize; i++) - { - decodedClaimPredicate.OrPredicates[i] = ClaimPredicate.Decode(stream); - } - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_NOT: - int NotPredicatePresent = stream.ReadInt(); - if (NotPredicatePresent != 0) - { - decodedClaimPredicate.NotPredicate = ClaimPredicate.Decode(stream); - } - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME: - decodedClaimPredicate.AbsBefore = Int64.Decode(stream); - break; - case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: - decodedClaimPredicate.RelBefore = Int64.Decode(stream); - break; - } - return decodedClaimPredicate; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_UNCONDITIONAL: + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_AND: + var andPredicatessize = stream.ReadInt(); + decodedClaimPredicate.AndPredicates = new ClaimPredicate[andPredicatessize]; + for (var i = 0; i < andPredicatessize; i++) decodedClaimPredicate.AndPredicates[i] = Decode(stream); + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_OR: + var orPredicatessize = stream.ReadInt(); + decodedClaimPredicate.OrPredicates = new ClaimPredicate[orPredicatessize]; + for (var i = 0; i < orPredicatessize; i++) decodedClaimPredicate.OrPredicates[i] = Decode(stream); + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_NOT: + var NotPredicatePresent = stream.ReadInt(); + if (NotPredicatePresent != 0) decodedClaimPredicate.NotPredicate = Decode(stream); + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME: + decodedClaimPredicate.AbsBefore = Int64.Decode(stream); + break; + case ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: + decodedClaimPredicate.RelBefore = Int64.Decode(stream); + break; } + + return decodedClaimPredicate; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimPredicateType.cs b/stellar-dotnet-sdk-xdr/generated/ClaimPredicateType.cs index a1ad8422..ed53bc80 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimPredicateType.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimPredicateType.cs @@ -1,63 +1,63 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ClaimPredicateType - // { - // CLAIM_PREDICATE_UNCONDITIONAL = 0, - // CLAIM_PREDICATE_AND = 1, - // CLAIM_PREDICATE_OR = 2, - // CLAIM_PREDICATE_NOT = 3, - // CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME = 4, - // CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5 - // }; +// enum ClaimPredicateType +// { +// CLAIM_PREDICATE_UNCONDITIONAL = 0, +// CLAIM_PREDICATE_AND = 1, +// CLAIM_PREDICATE_OR = 2, +// CLAIM_PREDICATE_NOT = 3, +// CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME = 4, +// CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5 +// }; - // =========================================================================== - public class ClaimPredicateType +// =========================================================================== +public class ClaimPredicateType +{ + public enum ClaimPredicateTypeEnum { - public enum ClaimPredicateTypeEnum - { - CLAIM_PREDICATE_UNCONDITIONAL = 0, - CLAIM_PREDICATE_AND = 1, - CLAIM_PREDICATE_OR = 2, - CLAIM_PREDICATE_NOT = 3, - CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME = 4, - CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5, - } - public ClaimPredicateTypeEnum InnerValue { get; set; } = default(ClaimPredicateTypeEnum); + CLAIM_PREDICATE_UNCONDITIONAL = 0, + CLAIM_PREDICATE_AND = 1, + CLAIM_PREDICATE_OR = 2, + CLAIM_PREDICATE_NOT = 3, + CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME = 4, + CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5 + } - public static ClaimPredicateType Create(ClaimPredicateTypeEnum v) - { - return new ClaimPredicateType - { - InnerValue = v - }; - } + public ClaimPredicateTypeEnum InnerValue { get; set; } = default; - public static ClaimPredicateType Decode(XdrDataInputStream stream) + public static ClaimPredicateType Create(ClaimPredicateTypeEnum v) + { + return new ClaimPredicateType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_UNCONDITIONAL); - case 1: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_AND); - case 2: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_OR); - case 3: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_NOT); - case 4: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME); - case 5: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_RELATIVE_TIME); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ClaimPredicateType value) + public static ClaimPredicateType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_UNCONDITIONAL); + case 1: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_AND); + case 2: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_OR); + case 3: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_NOT); + case 4: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME); + case 5: return Create(ClaimPredicateTypeEnum.CLAIM_PREDICATE_BEFORE_RELATIVE_TIME); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ClaimPredicateType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceEntry.cs b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceEntry.cs index 3db8f1eb..4db2c712 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceEntry.cs @@ -1,111 +1,102 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ClaimableBalanceEntry +// { +// // 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) +// { +// case 0: +// void; +// case 1: +// ClaimableBalanceEntryExtensionV1 v1; +// } +// ext; +// }; + +// =========================================================================== +public class ClaimableBalanceEntry { + public ClaimableBalanceID BalanceID { get; set; } + public Claimant[] Claimants { get; set; } + public Asset Asset { get; set; } + public Int64 Amount { get; set; } + public ClaimableBalanceEntryExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, ClaimableBalanceEntry encodedClaimableBalanceEntry) + { + ClaimableBalanceID.Encode(stream, encodedClaimableBalanceEntry.BalanceID); + var claimantssize = encodedClaimableBalanceEntry.Claimants.Length; + stream.WriteInt(claimantssize); + for (var i = 0; i < claimantssize; i++) Claimant.Encode(stream, encodedClaimableBalanceEntry.Claimants[i]); + Asset.Encode(stream, encodedClaimableBalanceEntry.Asset); + Int64.Encode(stream, encodedClaimableBalanceEntry.Amount); + ClaimableBalanceEntryExt.Encode(stream, encodedClaimableBalanceEntry.Ext); + } - // struct ClaimableBalanceEntry - // { - // // 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) - // { - // case 0: - // void; - // case 1: - // ClaimableBalanceEntryExtensionV1 v1; - // } - // ext; - // }; + public static ClaimableBalanceEntry Decode(XdrDataInputStream stream) + { + var decodedClaimableBalanceEntry = new ClaimableBalanceEntry(); + decodedClaimableBalanceEntry.BalanceID = ClaimableBalanceID.Decode(stream); + var claimantssize = stream.ReadInt(); + decodedClaimableBalanceEntry.Claimants = new Claimant[claimantssize]; + for (var i = 0; i < claimantssize; i++) decodedClaimableBalanceEntry.Claimants[i] = Claimant.Decode(stream); + decodedClaimableBalanceEntry.Asset = Asset.Decode(stream); + decodedClaimableBalanceEntry.Amount = Int64.Decode(stream); + decodedClaimableBalanceEntry.Ext = ClaimableBalanceEntryExt.Decode(stream); + return decodedClaimableBalanceEntry; + } - // =========================================================================== - public class ClaimableBalanceEntry + public class ClaimableBalanceEntryExt { - public ClaimableBalanceEntry() { } - public ClaimableBalanceID BalanceID { get; set; } - public Claimant[] Claimants { get; set; } - public Asset Asset { get; set; } - public Int64 Amount { get; set; } - public ClaimableBalanceEntryExt Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, ClaimableBalanceEntry encodedClaimableBalanceEntry) - { - ClaimableBalanceID.Encode(stream, encodedClaimableBalanceEntry.BalanceID); - int claimantssize = encodedClaimableBalanceEntry.Claimants.Length; - stream.WriteInt(claimantssize); - for (int i = 0; i < claimantssize; i++) - { - Claimant.Encode(stream, encodedClaimableBalanceEntry.Claimants[i]); - } - Asset.Encode(stream, encodedClaimableBalanceEntry.Asset); - Int64.Encode(stream, encodedClaimableBalanceEntry.Amount); - ClaimableBalanceEntryExt.Encode(stream, encodedClaimableBalanceEntry.Ext); - } - public static ClaimableBalanceEntry Decode(XdrDataInputStream stream) + public ClaimableBalanceEntryExtensionV1 V1 { get; set; } + + public static void Encode(XdrDataOutputStream stream, ClaimableBalanceEntryExt encodedClaimableBalanceEntryExt) { - ClaimableBalanceEntry decodedClaimableBalanceEntry = new ClaimableBalanceEntry(); - decodedClaimableBalanceEntry.BalanceID = ClaimableBalanceID.Decode(stream); - int claimantssize = stream.ReadInt(); - decodedClaimableBalanceEntry.Claimants = new Claimant[claimantssize]; - for (int i = 0; i < claimantssize; i++) + stream.WriteInt(encodedClaimableBalanceEntryExt.Discriminant); + switch (encodedClaimableBalanceEntryExt.Discriminant) { - decodedClaimableBalanceEntry.Claimants[i] = Claimant.Decode(stream); + case 0: + break; + case 1: + ClaimableBalanceEntryExtensionV1.Encode(stream, encodedClaimableBalanceEntryExt.V1); + break; } - decodedClaimableBalanceEntry.Asset = Asset.Decode(stream); - decodedClaimableBalanceEntry.Amount = Int64.Decode(stream); - decodedClaimableBalanceEntry.Ext = ClaimableBalanceEntryExt.Decode(stream); - return decodedClaimableBalanceEntry; } - public class ClaimableBalanceEntryExt + public static ClaimableBalanceEntryExt Decode(XdrDataInputStream stream) { - public ClaimableBalanceEntryExt() { } - - public int Discriminant { get; set; } = new int(); - - public ClaimableBalanceEntryExtensionV1 V1 { get; set; } - public static void Encode(XdrDataOutputStream stream, ClaimableBalanceEntryExt encodedClaimableBalanceEntryExt) - { - stream.WriteInt((int)encodedClaimableBalanceEntryExt.Discriminant); - switch (encodedClaimableBalanceEntryExt.Discriminant) - { - case 0: - break; - case 1: - ClaimableBalanceEntryExtensionV1.Encode(stream, encodedClaimableBalanceEntryExt.V1); - break; - } - } - public static ClaimableBalanceEntryExt Decode(XdrDataInputStream stream) + var decodedClaimableBalanceEntryExt = new ClaimableBalanceEntryExt(); + var discriminant = stream.ReadInt(); + decodedClaimableBalanceEntryExt.Discriminant = discriminant; + switch (decodedClaimableBalanceEntryExt.Discriminant) { - ClaimableBalanceEntryExt decodedClaimableBalanceEntryExt = new ClaimableBalanceEntryExt(); - int discriminant = stream.ReadInt(); - decodedClaimableBalanceEntryExt.Discriminant = discriminant; - switch (decodedClaimableBalanceEntryExt.Discriminant) - { - case 0: - break; - case 1: - decodedClaimableBalanceEntryExt.V1 = ClaimableBalanceEntryExtensionV1.Decode(stream); - break; - } - return decodedClaimableBalanceEntryExt; + case 0: + break; + case 1: + decodedClaimableBalanceEntryExt.V1 = ClaimableBalanceEntryExtensionV1.Decode(stream); + break; } + return decodedClaimableBalanceEntryExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceEntryExtensionV1.cs b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceEntryExtensionV1.cs index 9f62ae64..6ba04d29 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceEntryExtensionV1.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceEntryExtensionV1.cs @@ -1,72 +1,70 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ClaimableBalanceEntryExtensionV1 +// { +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// +// uint32 flags; // see ClaimableBalanceFlags +// }; + +// =========================================================================== +public class ClaimableBalanceEntryExtensionV1 { + public ClaimableBalanceEntryExtensionV1Ext Ext { get; set; } + public Uint32 Flags { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, + ClaimableBalanceEntryExtensionV1 encodedClaimableBalanceEntryExtensionV1) + { + ClaimableBalanceEntryExtensionV1Ext.Encode(stream, encodedClaimableBalanceEntryExtensionV1.Ext); + Uint32.Encode(stream, encodedClaimableBalanceEntryExtensionV1.Flags); + } - // struct ClaimableBalanceEntryExtensionV1 - // { - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // - // uint32 flags; // see ClaimableBalanceFlags - // }; + public static ClaimableBalanceEntryExtensionV1 Decode(XdrDataInputStream stream) + { + var decodedClaimableBalanceEntryExtensionV1 = new ClaimableBalanceEntryExtensionV1(); + decodedClaimableBalanceEntryExtensionV1.Ext = ClaimableBalanceEntryExtensionV1Ext.Decode(stream); + decodedClaimableBalanceEntryExtensionV1.Flags = Uint32.Decode(stream); + return decodedClaimableBalanceEntryExtensionV1; + } - // =========================================================================== - public class ClaimableBalanceEntryExtensionV1 + public class ClaimableBalanceEntryExtensionV1Ext { - public ClaimableBalanceEntryExtensionV1() { } - public ClaimableBalanceEntryExtensionV1Ext Ext { get; set; } - public Uint32 Flags { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, ClaimableBalanceEntryExtensionV1 encodedClaimableBalanceEntryExtensionV1) + public static void Encode(XdrDataOutputStream stream, + ClaimableBalanceEntryExtensionV1Ext encodedClaimableBalanceEntryExtensionV1Ext) { - ClaimableBalanceEntryExtensionV1Ext.Encode(stream, encodedClaimableBalanceEntryExtensionV1.Ext); - Uint32.Encode(stream, encodedClaimableBalanceEntryExtensionV1.Flags); - } - public static ClaimableBalanceEntryExtensionV1 Decode(XdrDataInputStream stream) - { - ClaimableBalanceEntryExtensionV1 decodedClaimableBalanceEntryExtensionV1 = new ClaimableBalanceEntryExtensionV1(); - decodedClaimableBalanceEntryExtensionV1.Ext = ClaimableBalanceEntryExtensionV1Ext.Decode(stream); - decodedClaimableBalanceEntryExtensionV1.Flags = Uint32.Decode(stream); - return decodedClaimableBalanceEntryExtensionV1; + stream.WriteInt(encodedClaimableBalanceEntryExtensionV1Ext.Discriminant); + switch (encodedClaimableBalanceEntryExtensionV1Ext.Discriminant) + { + case 0: + break; + } } - public class ClaimableBalanceEntryExtensionV1Ext + public static ClaimableBalanceEntryExtensionV1Ext Decode(XdrDataInputStream stream) { - public ClaimableBalanceEntryExtensionV1Ext() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, ClaimableBalanceEntryExtensionV1Ext encodedClaimableBalanceEntryExtensionV1Ext) - { - stream.WriteInt((int)encodedClaimableBalanceEntryExtensionV1Ext.Discriminant); - switch (encodedClaimableBalanceEntryExtensionV1Ext.Discriminant) - { - case 0: - break; - } - } - public static ClaimableBalanceEntryExtensionV1Ext Decode(XdrDataInputStream stream) + var decodedClaimableBalanceEntryExtensionV1Ext = new ClaimableBalanceEntryExtensionV1Ext(); + var discriminant = stream.ReadInt(); + decodedClaimableBalanceEntryExtensionV1Ext.Discriminant = discriminant; + switch (decodedClaimableBalanceEntryExtensionV1Ext.Discriminant) { - ClaimableBalanceEntryExtensionV1Ext decodedClaimableBalanceEntryExtensionV1Ext = new ClaimableBalanceEntryExtensionV1Ext(); - int discriminant = stream.ReadInt(); - decodedClaimableBalanceEntryExtensionV1Ext.Discriminant = discriminant; - switch (decodedClaimableBalanceEntryExtensionV1Ext.Discriminant) - { - case 0: - break; - } - return decodedClaimableBalanceEntryExtensionV1Ext; + case 0: + break; } + return decodedClaimableBalanceEntryExtensionV1Ext; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceFlags.cs b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceFlags.cs index 5255b7b5..f38750e3 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceFlags.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceFlags.cs @@ -1,50 +1,50 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ClaimableBalanceFlags - // { - // // If set, the issuer account of the asset held by the claimable balance may - // // clawback the claimable balance - // CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG = 0x1 - // }; +// enum ClaimableBalanceFlags +// { +// // If set, the issuer account of the asset held by the claimable balance may +// // clawback the claimable balance +// CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG = 0x1 +// }; - // =========================================================================== - public class ClaimableBalanceFlags +// =========================================================================== +public class ClaimableBalanceFlags +{ + public enum ClaimableBalanceFlagsEnum { - public enum ClaimableBalanceFlagsEnum - { - CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG = 1, - } - public ClaimableBalanceFlagsEnum InnerValue { get; set; } = default(ClaimableBalanceFlagsEnum); + CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG = 1 + } - public static ClaimableBalanceFlags Create(ClaimableBalanceFlagsEnum v) - { - return new ClaimableBalanceFlags - { - InnerValue = v - }; - } + public ClaimableBalanceFlagsEnum InnerValue { get; set; } = default; - public static ClaimableBalanceFlags Decode(XdrDataInputStream stream) + public static ClaimableBalanceFlags Create(ClaimableBalanceFlagsEnum v) + { + return new ClaimableBalanceFlags { - int value = stream.ReadInt(); - switch (value) - { - case 1: return Create(ClaimableBalanceFlagsEnum.CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ClaimableBalanceFlags value) + public static ClaimableBalanceFlags Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 1: return Create(ClaimableBalanceFlagsEnum.CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ClaimableBalanceFlags value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceID.cs b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceID.cs index 27220227..36e7e4f0 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceID.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceID.cs @@ -1,48 +1,46 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union ClaimableBalanceID switch (ClaimableBalanceIDType type) - // { - // case CLAIMABLE_BALANCE_ID_TYPE_V0: - // Hash v0; - // }; +// union ClaimableBalanceID switch (ClaimableBalanceIDType type) +// { +// case CLAIMABLE_BALANCE_ID_TYPE_V0: +// Hash v0; +// }; - // =========================================================================== - public class ClaimableBalanceID - { - public ClaimableBalanceID() { } +// =========================================================================== +public class ClaimableBalanceID +{ + public ClaimableBalanceIDType Discriminant { get; set; } = new(); - public ClaimableBalanceIDType Discriminant { get; set; } = new ClaimableBalanceIDType(); + public Hash V0 { get; set; } - public Hash V0 { get; set; } - public static void Encode(XdrDataOutputStream stream, ClaimableBalanceID encodedClaimableBalanceID) + public static void Encode(XdrDataOutputStream stream, ClaimableBalanceID encodedClaimableBalanceID) + { + stream.WriteInt((int)encodedClaimableBalanceID.Discriminant.InnerValue); + switch (encodedClaimableBalanceID.Discriminant.InnerValue) { - stream.WriteInt((int)encodedClaimableBalanceID.Discriminant.InnerValue); - switch (encodedClaimableBalanceID.Discriminant.InnerValue) - { - case ClaimableBalanceIDType.ClaimableBalanceIDTypeEnum.CLAIMABLE_BALANCE_ID_TYPE_V0: - Hash.Encode(stream, encodedClaimableBalanceID.V0); - break; - } + case ClaimableBalanceIDType.ClaimableBalanceIDTypeEnum.CLAIMABLE_BALANCE_ID_TYPE_V0: + Hash.Encode(stream, encodedClaimableBalanceID.V0); + break; } - public static ClaimableBalanceID Decode(XdrDataInputStream stream) + } + + public static ClaimableBalanceID Decode(XdrDataInputStream stream) + { + var decodedClaimableBalanceID = new ClaimableBalanceID(); + var discriminant = ClaimableBalanceIDType.Decode(stream); + decodedClaimableBalanceID.Discriminant = discriminant; + switch (decodedClaimableBalanceID.Discriminant.InnerValue) { - ClaimableBalanceID decodedClaimableBalanceID = new ClaimableBalanceID(); - ClaimableBalanceIDType discriminant = ClaimableBalanceIDType.Decode(stream); - decodedClaimableBalanceID.Discriminant = discriminant; - switch (decodedClaimableBalanceID.Discriminant.InnerValue) - { - case ClaimableBalanceIDType.ClaimableBalanceIDTypeEnum.CLAIMABLE_BALANCE_ID_TYPE_V0: - decodedClaimableBalanceID.V0 = Hash.Decode(stream); - break; - } - return decodedClaimableBalanceID; + case ClaimableBalanceIDType.ClaimableBalanceIDTypeEnum.CLAIMABLE_BALANCE_ID_TYPE_V0: + decodedClaimableBalanceID.V0 = Hash.Decode(stream); + break; } + + return decodedClaimableBalanceID; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceIDType.cs b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceIDType.cs index afd04bf9..506567e2 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceIDType.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimableBalanceIDType.cs @@ -1,48 +1,48 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ClaimableBalanceIDType - // { - // CLAIMABLE_BALANCE_ID_TYPE_V0 = 0 - // }; +// enum ClaimableBalanceIDType +// { +// CLAIMABLE_BALANCE_ID_TYPE_V0 = 0 +// }; - // =========================================================================== - public class ClaimableBalanceIDType +// =========================================================================== +public class ClaimableBalanceIDType +{ + public enum ClaimableBalanceIDTypeEnum { - public enum ClaimableBalanceIDTypeEnum - { - CLAIMABLE_BALANCE_ID_TYPE_V0 = 0, - } - public ClaimableBalanceIDTypeEnum InnerValue { get; set; } = default(ClaimableBalanceIDTypeEnum); + CLAIMABLE_BALANCE_ID_TYPE_V0 = 0 + } - public static ClaimableBalanceIDType Create(ClaimableBalanceIDTypeEnum v) - { - return new ClaimableBalanceIDType - { - InnerValue = v - }; - } + public ClaimableBalanceIDTypeEnum InnerValue { get; set; } = default; - public static ClaimableBalanceIDType Decode(XdrDataInputStream stream) + public static ClaimableBalanceIDType Create(ClaimableBalanceIDTypeEnum v) + { + return new ClaimableBalanceIDType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ClaimableBalanceIDTypeEnum.CLAIMABLE_BALANCE_ID_TYPE_V0); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ClaimableBalanceIDType value) + public static ClaimableBalanceIDType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ClaimableBalanceIDTypeEnum.CLAIMABLE_BALANCE_ID_TYPE_V0); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ClaimableBalanceIDType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Claimant.cs b/stellar-dotnet-sdk-xdr/generated/Claimant.cs index 79d359e2..5242d028 100644 --- a/stellar-dotnet-sdk-xdr/generated/Claimant.cs +++ b/stellar-dotnet-sdk-xdr/generated/Claimant.cs @@ -1,73 +1,70 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union Claimant switch (ClaimantType type) - // { - // case CLAIMANT_TYPE_V0: - // struct - // { - // AccountID destination; // The account that can use this condition - // ClaimPredicate predicate; // Claimable if predicate is true - // } v0; - // }; +// union Claimant switch (ClaimantType type) +// { +// case CLAIMANT_TYPE_V0: +// struct +// { +// AccountID destination; // The account that can use this condition +// ClaimPredicate predicate; // Claimable if predicate is true +// } v0; +// }; - // =========================================================================== - public class Claimant - { - public Claimant() { } +// =========================================================================== +public class Claimant +{ + public ClaimantType Discriminant { get; set; } = new(); - public ClaimantType Discriminant { get; set; } = new ClaimantType(); + public ClaimantV0 V0 { get; set; } - public ClaimantV0 V0 { get; set; } - public static void Encode(XdrDataOutputStream stream, Claimant encodedClaimant) + public static void Encode(XdrDataOutputStream stream, Claimant encodedClaimant) + { + stream.WriteInt((int)encodedClaimant.Discriminant.InnerValue); + switch (encodedClaimant.Discriminant.InnerValue) { - stream.WriteInt((int)encodedClaimant.Discriminant.InnerValue); - switch (encodedClaimant.Discriminant.InnerValue) - { - case ClaimantType.ClaimantTypeEnum.CLAIMANT_TYPE_V0: - ClaimantV0.Encode(stream, encodedClaimant.V0); - break; - } + case ClaimantType.ClaimantTypeEnum.CLAIMANT_TYPE_V0: + ClaimantV0.Encode(stream, encodedClaimant.V0); + break; } - public static Claimant Decode(XdrDataInputStream stream) + } + + public static Claimant Decode(XdrDataInputStream stream) + { + var decodedClaimant = new Claimant(); + var discriminant = ClaimantType.Decode(stream); + decodedClaimant.Discriminant = discriminant; + switch (decodedClaimant.Discriminant.InnerValue) { - Claimant decodedClaimant = new Claimant(); - ClaimantType discriminant = ClaimantType.Decode(stream); - decodedClaimant.Discriminant = discriminant; - switch (decodedClaimant.Discriminant.InnerValue) - { - case ClaimantType.ClaimantTypeEnum.CLAIMANT_TYPE_V0: - decodedClaimant.V0 = ClaimantV0.Decode(stream); - break; - } - return decodedClaimant; + case ClaimantType.ClaimantTypeEnum.CLAIMANT_TYPE_V0: + decodedClaimant.V0 = ClaimantV0.Decode(stream); + break; } - public class ClaimantV0 - { - public ClaimantV0() { } - public AccountID Destination { get; set; } - public ClaimPredicate Predicate { get; set; } + return decodedClaimant; + } - public static void Encode(XdrDataOutputStream stream, ClaimantV0 encodedClaimantV0) - { - AccountID.Encode(stream, encodedClaimantV0.Destination); - ClaimPredicate.Encode(stream, encodedClaimantV0.Predicate); - } - public static ClaimantV0 Decode(XdrDataInputStream stream) - { - ClaimantV0 decodedClaimantV0 = new ClaimantV0(); - decodedClaimantV0.Destination = AccountID.Decode(stream); - decodedClaimantV0.Predicate = ClaimPredicate.Decode(stream); - return decodedClaimantV0; - } + public class ClaimantV0 + { + public AccountID Destination { get; set; } + public ClaimPredicate Predicate { get; set; } + public static void Encode(XdrDataOutputStream stream, ClaimantV0 encodedClaimantV0) + { + AccountID.Encode(stream, encodedClaimantV0.Destination); + ClaimPredicate.Encode(stream, encodedClaimantV0.Predicate); + } + + public static ClaimantV0 Decode(XdrDataInputStream stream) + { + var decodedClaimantV0 = new ClaimantV0(); + decodedClaimantV0.Destination = AccountID.Decode(stream); + decodedClaimantV0.Predicate = ClaimPredicate.Decode(stream); + return decodedClaimantV0; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClaimantType.cs b/stellar-dotnet-sdk-xdr/generated/ClaimantType.cs index 3c53dcf9..b91123fa 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClaimantType.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClaimantType.cs @@ -1,48 +1,48 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ClaimantType - // { - // CLAIMANT_TYPE_V0 = 0 - // }; +// enum ClaimantType +// { +// CLAIMANT_TYPE_V0 = 0 +// }; - // =========================================================================== - public class ClaimantType +// =========================================================================== +public class ClaimantType +{ + public enum ClaimantTypeEnum { - public enum ClaimantTypeEnum - { - CLAIMANT_TYPE_V0 = 0, - } - public ClaimantTypeEnum InnerValue { get; set; } = default(ClaimantTypeEnum); + CLAIMANT_TYPE_V0 = 0 + } - public static ClaimantType Create(ClaimantTypeEnum v) - { - return new ClaimantType - { - InnerValue = v - }; - } + public ClaimantTypeEnum InnerValue { get; set; } = default; - public static ClaimantType Decode(XdrDataInputStream stream) + public static ClaimantType Create(ClaimantTypeEnum v) + { + return new ClaimantType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ClaimantTypeEnum.CLAIMANT_TYPE_V0); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ClaimantType value) + public static ClaimantType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ClaimantTypeEnum.CLAIMANT_TYPE_V0); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ClaimantType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceOp.cs b/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceOp.cs index b9b8bde0..58a37a5f 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceOp.cs @@ -1,32 +1,29 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct ClawbackClaimableBalanceOp +// { +// ClaimableBalanceID balanceID; +// }; - // struct ClawbackClaimableBalanceOp - // { - // ClaimableBalanceID balanceID; - // }; +// =========================================================================== +public class ClawbackClaimableBalanceOp +{ + public ClaimableBalanceID BalanceID { get; set; } - // =========================================================================== - public class ClawbackClaimableBalanceOp + public static void Encode(XdrDataOutputStream stream, ClawbackClaimableBalanceOp encodedClawbackClaimableBalanceOp) { - public ClawbackClaimableBalanceOp() { } - public ClaimableBalanceID BalanceID { get; set; } + ClaimableBalanceID.Encode(stream, encodedClawbackClaimableBalanceOp.BalanceID); + } - public static void Encode(XdrDataOutputStream stream, ClawbackClaimableBalanceOp encodedClawbackClaimableBalanceOp) - { - ClaimableBalanceID.Encode(stream, encodedClawbackClaimableBalanceOp.BalanceID); - } - public static ClawbackClaimableBalanceOp Decode(XdrDataInputStream stream) - { - ClawbackClaimableBalanceOp decodedClawbackClaimableBalanceOp = new ClawbackClaimableBalanceOp(); - decodedClawbackClaimableBalanceOp.BalanceID = ClaimableBalanceID.Decode(stream); - return decodedClawbackClaimableBalanceOp; - } + public static ClawbackClaimableBalanceOp Decode(XdrDataInputStream stream) + { + var decodedClawbackClaimableBalanceOp = new ClawbackClaimableBalanceOp(); + decodedClawbackClaimableBalanceOp.BalanceID = ClaimableBalanceID.Decode(stream); + return decodedClawbackClaimableBalanceOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceResult.cs b/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceResult.cs index 64d10170..9b472714 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceResult.cs @@ -1,52 +1,64 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union ClawbackClaimableBalanceResult switch ( - // ClawbackClaimableBalanceResultCode code) - // { - // case CLAWBACK_CLAIMABLE_BALANCE_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class ClawbackClaimableBalanceResult - { - public ClawbackClaimableBalanceResult() { } +// union ClawbackClaimableBalanceResult switch ( +// ClawbackClaimableBalanceResultCode code) +// { +// case CLAWBACK_CLAIMABLE_BALANCE_SUCCESS: +// void; +// case CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST: +// case CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER: +// case CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED: +// void; +// }; - public ClawbackClaimableBalanceResultCode Discriminant { get; set; } = new ClawbackClaimableBalanceResultCode(); +// =========================================================================== +public class ClawbackClaimableBalanceResult +{ + public ClawbackClaimableBalanceResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, ClawbackClaimableBalanceResult encodedClawbackClaimableBalanceResult) + public static void Encode(XdrDataOutputStream stream, + ClawbackClaimableBalanceResult encodedClawbackClaimableBalanceResult) + { + stream.WriteInt((int)encodedClawbackClaimableBalanceResult.Discriminant.InnerValue); + switch (encodedClawbackClaimableBalanceResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedClawbackClaimableBalanceResult.Discriminant.InnerValue); - switch (encodedClawbackClaimableBalanceResult.Discriminant.InnerValue) - { - case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_SUCCESS: - break; - default: - break; - } + case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum + .CLAWBACK_CLAIMABLE_BALANCE_SUCCESS: + break; + case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum + .CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST: + case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum + .CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER: + case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum + .CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED: + break; } - public static ClawbackClaimableBalanceResult Decode(XdrDataInputStream stream) + } + + public static ClawbackClaimableBalanceResult Decode(XdrDataInputStream stream) + { + var decodedClawbackClaimableBalanceResult = new ClawbackClaimableBalanceResult(); + var discriminant = ClawbackClaimableBalanceResultCode.Decode(stream); + decodedClawbackClaimableBalanceResult.Discriminant = discriminant; + switch (decodedClawbackClaimableBalanceResult.Discriminant.InnerValue) { - ClawbackClaimableBalanceResult decodedClawbackClaimableBalanceResult = new ClawbackClaimableBalanceResult(); - ClawbackClaimableBalanceResultCode discriminant = ClawbackClaimableBalanceResultCode.Decode(stream); - decodedClawbackClaimableBalanceResult.Discriminant = discriminant; - switch (decodedClawbackClaimableBalanceResult.Discriminant.InnerValue) - { - case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_SUCCESS: - break; - default: - break; - } - return decodedClawbackClaimableBalanceResult; + case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum + .CLAWBACK_CLAIMABLE_BALANCE_SUCCESS: + break; + case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum + .CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST: + case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum + .CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER: + case ClawbackClaimableBalanceResultCode.ClawbackClaimableBalanceResultCodeEnum + .CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED: + break; } + + return decodedClawbackClaimableBalanceResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceResultCode.cs b/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceResultCode.cs index 7e0398ce..1a0f1b19 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClawbackClaimableBalanceResultCode.cs @@ -1,60 +1,61 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ - - // enum ClawbackClaimableBalanceResultCode - // { - // // 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, - // CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED = -3 - // }; - - // =========================================================================== - public class ClawbackClaimableBalanceResultCode +// enum ClawbackClaimableBalanceResultCode +// { +// // 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, +// CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED = -3 +// }; + +// =========================================================================== +public class ClawbackClaimableBalanceResultCode +{ + public enum ClawbackClaimableBalanceResultCodeEnum { - public enum ClawbackClaimableBalanceResultCodeEnum - { - CLAWBACK_CLAIMABLE_BALANCE_SUCCESS = 0, - CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, - CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER = -2, - CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED = -3, - } - public ClawbackClaimableBalanceResultCodeEnum InnerValue { get; set; } = default(ClawbackClaimableBalanceResultCodeEnum); + CLAWBACK_CLAIMABLE_BALANCE_SUCCESS = 0, + CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, + CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER = -2, + CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED = -3 + } - public static ClawbackClaimableBalanceResultCode Create(ClawbackClaimableBalanceResultCodeEnum v) - { - return new ClawbackClaimableBalanceResultCode - { - InnerValue = v - }; - } + public ClawbackClaimableBalanceResultCodeEnum InnerValue { get; set; } = default; - public static ClawbackClaimableBalanceResultCode Decode(XdrDataInputStream stream) + public static ClawbackClaimableBalanceResultCode Create(ClawbackClaimableBalanceResultCodeEnum v) + { + return new ClawbackClaimableBalanceResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_SUCCESS); - case -1: return Create(ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST); - case -2: return Create(ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER); - case -3: return Create(ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ClawbackClaimableBalanceResultCode value) + public static ClawbackClaimableBalanceResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_SUCCESS); + case -1: return Create(ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST); + case -2: return Create(ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER); + case -3: + return Create(ClawbackClaimableBalanceResultCodeEnum.CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ClawbackClaimableBalanceResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClawbackOp.cs b/stellar-dotnet-sdk-xdr/generated/ClawbackOp.cs index 1a11f8d5..1111c05a 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClawbackOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClawbackOp.cs @@ -1,40 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct ClawbackOp +// { +// Asset asset; +// MuxedAccount from; +// int64 amount; +// }; - // struct ClawbackOp - // { - // Asset asset; - // MuxedAccount from; - // int64 amount; - // }; +// =========================================================================== +public class ClawbackOp +{ + public Asset Asset { get; set; } + public MuxedAccount From { get; set; } + public Int64 Amount { get; set; } - // =========================================================================== - public class ClawbackOp + public static void Encode(XdrDataOutputStream stream, ClawbackOp encodedClawbackOp) { - public ClawbackOp() { } - public Asset Asset { get; set; } - public MuxedAccount From { get; set; } - public Int64 Amount { get; set; } + Asset.Encode(stream, encodedClawbackOp.Asset); + MuxedAccount.Encode(stream, encodedClawbackOp.From); + Int64.Encode(stream, encodedClawbackOp.Amount); + } - public static void Encode(XdrDataOutputStream stream, ClawbackOp encodedClawbackOp) - { - Asset.Encode(stream, encodedClawbackOp.Asset); - MuxedAccount.Encode(stream, encodedClawbackOp.From); - Int64.Encode(stream, encodedClawbackOp.Amount); - } - public static ClawbackOp Decode(XdrDataInputStream stream) - { - ClawbackOp decodedClawbackOp = new ClawbackOp(); - decodedClawbackOp.Asset = Asset.Decode(stream); - decodedClawbackOp.From = MuxedAccount.Decode(stream); - decodedClawbackOp.Amount = Int64.Decode(stream); - return decodedClawbackOp; - } + public static ClawbackOp Decode(XdrDataInputStream stream) + { + var decodedClawbackOp = new ClawbackOp(); + decodedClawbackOp.Asset = Asset.Decode(stream); + decodedClawbackOp.From = MuxedAccount.Decode(stream); + decodedClawbackOp.Amount = Int64.Decode(stream); + return decodedClawbackOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClawbackResult.cs b/stellar-dotnet-sdk-xdr/generated/ClawbackResult.cs index 0c15e4b4..d6bfcff5 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClawbackResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClawbackResult.cs @@ -1,51 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union ClawbackResult switch (ClawbackResultCode code) - // { - // case CLAWBACK_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class ClawbackResult - { - public ClawbackResult() { } +// union ClawbackResult switch (ClawbackResultCode code) +// { +// case CLAWBACK_SUCCESS: +// void; +// case CLAWBACK_MALFORMED: +// case CLAWBACK_NOT_CLAWBACK_ENABLED: +// case CLAWBACK_NO_TRUST: +// case CLAWBACK_UNDERFUNDED: +// void; +// }; - public ClawbackResultCode Discriminant { get; set; } = new ClawbackResultCode(); +// =========================================================================== +public class ClawbackResult +{ + public ClawbackResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, ClawbackResult encodedClawbackResult) + public static void Encode(XdrDataOutputStream stream, ClawbackResult encodedClawbackResult) + { + stream.WriteInt((int)encodedClawbackResult.Discriminant.InnerValue); + switch (encodedClawbackResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedClawbackResult.Discriminant.InnerValue); - switch (encodedClawbackResult.Discriminant.InnerValue) - { - case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_SUCCESS: - break; - default: - break; - } + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_SUCCESS: + break; + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_MALFORMED: + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_NOT_CLAWBACK_ENABLED: + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_NO_TRUST: + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_UNDERFUNDED: + break; } - public static ClawbackResult Decode(XdrDataInputStream stream) + } + + public static ClawbackResult Decode(XdrDataInputStream stream) + { + var decodedClawbackResult = new ClawbackResult(); + var discriminant = ClawbackResultCode.Decode(stream); + decodedClawbackResult.Discriminant = discriminant; + switch (decodedClawbackResult.Discriminant.InnerValue) { - ClawbackResult decodedClawbackResult = new ClawbackResult(); - ClawbackResultCode discriminant = ClawbackResultCode.Decode(stream); - decodedClawbackResult.Discriminant = discriminant; - switch (decodedClawbackResult.Discriminant.InnerValue) - { - case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_SUCCESS: - break; - default: - break; - } - return decodedClawbackResult; + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_SUCCESS: + break; + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_MALFORMED: + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_NOT_CLAWBACK_ENABLED: + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_NO_TRUST: + case ClawbackResultCode.ClawbackResultCodeEnum.CLAWBACK_UNDERFUNDED: + break; } + + return decodedClawbackResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ClawbackResultCode.cs b/stellar-dotnet-sdk-xdr/generated/ClawbackResultCode.cs index 442addc1..476fa805 100644 --- a/stellar-dotnet-sdk-xdr/generated/ClawbackResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/ClawbackResultCode.cs @@ -1,63 +1,63 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ - - // enum ClawbackResultCode - // { - // // 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, - // CLAWBACK_NO_TRUST = -3, - // CLAWBACK_UNDERFUNDED = -4 - // }; - - // =========================================================================== - public class ClawbackResultCode +// enum ClawbackResultCode +// { +// // 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, +// CLAWBACK_NO_TRUST = -3, +// CLAWBACK_UNDERFUNDED = -4 +// }; + +// =========================================================================== +public class ClawbackResultCode +{ + public enum ClawbackResultCodeEnum { - public enum ClawbackResultCodeEnum - { - CLAWBACK_SUCCESS = 0, - CLAWBACK_MALFORMED = -1, - CLAWBACK_NOT_CLAWBACK_ENABLED = -2, - CLAWBACK_NO_TRUST = -3, - CLAWBACK_UNDERFUNDED = -4, - } - public ClawbackResultCodeEnum InnerValue { get; set; } = default(ClawbackResultCodeEnum); + CLAWBACK_SUCCESS = 0, + CLAWBACK_MALFORMED = -1, + CLAWBACK_NOT_CLAWBACK_ENABLED = -2, + CLAWBACK_NO_TRUST = -3, + CLAWBACK_UNDERFUNDED = -4 + } - public static ClawbackResultCode Create(ClawbackResultCodeEnum v) - { - return new ClawbackResultCode - { - InnerValue = v - }; - } + public ClawbackResultCodeEnum InnerValue { get; set; } = default; - public static ClawbackResultCode Decode(XdrDataInputStream stream) + public static ClawbackResultCode Create(ClawbackResultCodeEnum v) + { + return new ClawbackResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ClawbackResultCodeEnum.CLAWBACK_SUCCESS); - case -1: return Create(ClawbackResultCodeEnum.CLAWBACK_MALFORMED); - case -2: return Create(ClawbackResultCodeEnum.CLAWBACK_NOT_CLAWBACK_ENABLED); - case -3: return Create(ClawbackResultCodeEnum.CLAWBACK_NO_TRUST); - case -4: return Create(ClawbackResultCodeEnum.CLAWBACK_UNDERFUNDED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ClawbackResultCode value) + public static ClawbackResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ClawbackResultCodeEnum.CLAWBACK_SUCCESS); + case -1: return Create(ClawbackResultCodeEnum.CLAWBACK_MALFORMED); + case -2: return Create(ClawbackResultCodeEnum.CLAWBACK_NOT_CLAWBACK_ENABLED); + case -3: return Create(ClawbackResultCodeEnum.CLAWBACK_NO_TRUST); + case -4: return Create(ClawbackResultCodeEnum.CLAWBACK_UNDERFUNDED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ClawbackResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractBandwidthV0.cs b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractBandwidthV0.cs new file mode 100644 index 00000000..4c7e239c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractBandwidthV0.cs @@ -0,0 +1,42 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ConfigSettingContractBandwidthV0 +// { +// // Maximum sum of all transaction sizes in the ledger in bytes +// uint32 ledgerMaxTxsSizeBytes; +// // Maximum size in bytes for a transaction +// uint32 txMaxSizeBytes; +// +// // Fee for 1 KB of transaction size +// int64 feeTxSize1KB; +// }; + +// =========================================================================== +public class ConfigSettingContractBandwidthV0 +{ + public Uint32 LedgerMaxTxsSizeBytes { get; set; } + public Uint32 TxMaxSizeBytes { get; set; } + public Int64 FeeTxSize1KB { get; set; } + + public static void Encode(XdrDataOutputStream stream, + ConfigSettingContractBandwidthV0 encodedConfigSettingContractBandwidthV0) + { + Uint32.Encode(stream, encodedConfigSettingContractBandwidthV0.LedgerMaxTxsSizeBytes); + Uint32.Encode(stream, encodedConfigSettingContractBandwidthV0.TxMaxSizeBytes); + Int64.Encode(stream, encodedConfigSettingContractBandwidthV0.FeeTxSize1KB); + } + + public static ConfigSettingContractBandwidthV0 Decode(XdrDataInputStream stream) + { + var decodedConfigSettingContractBandwidthV0 = new ConfigSettingContractBandwidthV0(); + decodedConfigSettingContractBandwidthV0.LedgerMaxTxsSizeBytes = Uint32.Decode(stream); + decodedConfigSettingContractBandwidthV0.TxMaxSizeBytes = Uint32.Decode(stream); + decodedConfigSettingContractBandwidthV0.FeeTxSize1KB = Int64.Decode(stream); + return decodedConfigSettingContractBandwidthV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractComputeV0.cs b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractComputeV0.cs new file mode 100644 index 00000000..41f2ca91 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractComputeV0.cs @@ -0,0 +1,48 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ConfigSettingContractComputeV0 +// { +// // Maximum instructions per ledger +// int64 ledgerMaxInstructions; +// // Maximum instructions per transaction +// 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; +// }; + +// =========================================================================== +public class ConfigSettingContractComputeV0 +{ + public Int64 LedgerMaxInstructions { get; set; } + public Int64 TxMaxInstructions { get; set; } + public Int64 FeeRatePerInstructionsIncrement { get; set; } + public Uint32 TxMemoryLimit { get; set; } + + public static void Encode(XdrDataOutputStream stream, + ConfigSettingContractComputeV0 encodedConfigSettingContractComputeV0) + { + Int64.Encode(stream, encodedConfigSettingContractComputeV0.LedgerMaxInstructions); + Int64.Encode(stream, encodedConfigSettingContractComputeV0.TxMaxInstructions); + Int64.Encode(stream, encodedConfigSettingContractComputeV0.FeeRatePerInstructionsIncrement); + Uint32.Encode(stream, encodedConfigSettingContractComputeV0.TxMemoryLimit); + } + + public static ConfigSettingContractComputeV0 Decode(XdrDataInputStream stream) + { + var decodedConfigSettingContractComputeV0 = new ConfigSettingContractComputeV0(); + decodedConfigSettingContractComputeV0.LedgerMaxInstructions = Int64.Decode(stream); + decodedConfigSettingContractComputeV0.TxMaxInstructions = Int64.Decode(stream); + decodedConfigSettingContractComputeV0.FeeRatePerInstructionsIncrement = Int64.Decode(stream); + decodedConfigSettingContractComputeV0.TxMemoryLimit = Uint32.Decode(stream); + return decodedConfigSettingContractComputeV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractEventsV0.cs b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractEventsV0.cs new file mode 100644 index 00000000..06010866 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractEventsV0.cs @@ -0,0 +1,36 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ConfigSettingContractEventsV0 +// { +// // Maximum size of events that a contract call can emit. +// uint32 txMaxContractEventsSizeBytes; +// // Fee for generating 1KB of contract events. +// int64 feeContractEvents1KB; +// }; + +// =========================================================================== +public class ConfigSettingContractEventsV0 +{ + public Uint32 TxMaxContractEventsSizeBytes { get; set; } + public Int64 FeeContractEvents1KB { get; set; } + + public static void Encode(XdrDataOutputStream stream, + ConfigSettingContractEventsV0 encodedConfigSettingContractEventsV0) + { + Uint32.Encode(stream, encodedConfigSettingContractEventsV0.TxMaxContractEventsSizeBytes); + Int64.Encode(stream, encodedConfigSettingContractEventsV0.FeeContractEvents1KB); + } + + public static ConfigSettingContractEventsV0 Decode(XdrDataInputStream stream) + { + var decodedConfigSettingContractEventsV0 = new ConfigSettingContractEventsV0(); + decodedConfigSettingContractEventsV0.TxMaxContractEventsSizeBytes = Uint32.Decode(stream); + decodedConfigSettingContractEventsV0.FeeContractEvents1KB = Int64.Decode(stream); + return decodedConfigSettingContractEventsV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractExecutionLanesV0.cs b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractExecutionLanesV0.cs new file mode 100644 index 00000000..19967490 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractExecutionLanesV0.cs @@ -0,0 +1,31 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ConfigSettingContractExecutionLanesV0 +// { +// // maximum number of Soroban transactions per ledger +// uint32 ledgerMaxTxCount; +// }; + +// =========================================================================== +public class ConfigSettingContractExecutionLanesV0 +{ + public Uint32 LedgerMaxTxCount { get; set; } + + public static void Encode(XdrDataOutputStream stream, + ConfigSettingContractExecutionLanesV0 encodedConfigSettingContractExecutionLanesV0) + { + Uint32.Encode(stream, encodedConfigSettingContractExecutionLanesV0.LedgerMaxTxCount); + } + + public static ConfigSettingContractExecutionLanesV0 Decode(XdrDataInputStream stream) + { + var decodedConfigSettingContractExecutionLanesV0 = new ConfigSettingContractExecutionLanesV0(); + decodedConfigSettingContractExecutionLanesV0.LedgerMaxTxCount = Uint32.Decode(stream); + return decodedConfigSettingContractExecutionLanesV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractHistoricalDataV0.cs b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractHistoricalDataV0.cs new file mode 100644 index 00000000..ae468c3c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractHistoricalDataV0.cs @@ -0,0 +1,30 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ConfigSettingContractHistoricalDataV0 +// { +// int64 feeHistorical1KB; // Fee for storing 1KB in archives +// }; + +// =========================================================================== +public class ConfigSettingContractHistoricalDataV0 +{ + public Int64 FeeHistorical1KB { get; set; } + + public static void Encode(XdrDataOutputStream stream, + ConfigSettingContractHistoricalDataV0 encodedConfigSettingContractHistoricalDataV0) + { + Int64.Encode(stream, encodedConfigSettingContractHistoricalDataV0.FeeHistorical1KB); + } + + public static ConfigSettingContractHistoricalDataV0 Decode(XdrDataInputStream stream) + { + var decodedConfigSettingContractHistoricalDataV0 = new ConfigSettingContractHistoricalDataV0(); + decodedConfigSettingContractHistoricalDataV0.FeeHistorical1KB = Int64.Decode(stream); + return decodedConfigSettingContractHistoricalDataV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractLedgerCostV0.cs b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractLedgerCostV0.cs new file mode 100644 index 00000000..4758ee91 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigSettingContractLedgerCostV0.cs @@ -0,0 +1,103 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ConfigSettingContractLedgerCostV0 +// { +// // Maximum number of ledger entry read operations per ledger +// uint32 ledgerMaxReadLedgerEntries; +// // Maximum number of bytes that can be read per ledger +// uint32 ledgerMaxReadBytes; +// // Maximum number of ledger entry write operations per ledger +// uint32 ledgerMaxWriteLedgerEntries; +// // Maximum number of bytes that can be written per ledger +// uint32 ledgerMaxWriteBytes; +// +// // Maximum number of ledger entry read operations per transaction +// uint32 txMaxReadLedgerEntries; +// // Maximum number of bytes that can be read per transaction +// uint32 txMaxReadBytes; +// // Maximum number of ledger entry write operations per transaction +// uint32 txMaxWriteLedgerEntries; +// // Maximum number of bytes that can be written per transaction +// uint32 txMaxWriteBytes; +// +// int64 feeReadLedgerEntry; // Fee per ledger entry read +// int64 feeWriteLedgerEntry; // Fee per ledger entry write +// +// int64 feeRead1KB; // Fee for reading 1KB +// +// // The following parameters determine the write fee per 1KB. +// // Write fee grows linearly until bucket list reaches this size +// int64 bucketListTargetSizeBytes; +// // Fee per 1KB write when the bucket list is empty +// int64 writeFee1KBBucketListLow; +// // Fee per 1KB write when the bucket list has reached `bucketListTargetSizeBytes` +// int64 writeFee1KBBucketListHigh; +// // Write fee multiplier for any additional data past the first `bucketListTargetSizeBytes` +// uint32 bucketListWriteFeeGrowthFactor; +// }; + +// =========================================================================== +public class ConfigSettingContractLedgerCostV0 +{ + public Uint32 LedgerMaxReadLedgerEntries { get; set; } + public Uint32 LedgerMaxReadBytes { get; set; } + public Uint32 LedgerMaxWriteLedgerEntries { get; set; } + public Uint32 LedgerMaxWriteBytes { get; set; } + public Uint32 TxMaxReadLedgerEntries { get; set; } + public Uint32 TxMaxReadBytes { get; set; } + public Uint32 TxMaxWriteLedgerEntries { get; set; } + public Uint32 TxMaxWriteBytes { get; set; } + public Int64 FeeReadLedgerEntry { get; set; } + public Int64 FeeWriteLedgerEntry { get; set; } + public Int64 FeeRead1KB { get; set; } + public Int64 BucketListTargetSizeBytes { get; set; } + public Int64 WriteFee1KBBucketListLow { get; set; } + public Int64 WriteFee1KBBucketListHigh { get; set; } + public Uint32 BucketListWriteFeeGrowthFactor { get; set; } + + public static void Encode(XdrDataOutputStream stream, + ConfigSettingContractLedgerCostV0 encodedConfigSettingContractLedgerCostV0) + { + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.LedgerMaxReadLedgerEntries); + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.LedgerMaxReadBytes); + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.LedgerMaxWriteLedgerEntries); + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.LedgerMaxWriteBytes); + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.TxMaxReadLedgerEntries); + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.TxMaxReadBytes); + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.TxMaxWriteLedgerEntries); + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.TxMaxWriteBytes); + Int64.Encode(stream, encodedConfigSettingContractLedgerCostV0.FeeReadLedgerEntry); + Int64.Encode(stream, encodedConfigSettingContractLedgerCostV0.FeeWriteLedgerEntry); + Int64.Encode(stream, encodedConfigSettingContractLedgerCostV0.FeeRead1KB); + Int64.Encode(stream, encodedConfigSettingContractLedgerCostV0.BucketListTargetSizeBytes); + Int64.Encode(stream, encodedConfigSettingContractLedgerCostV0.WriteFee1KBBucketListLow); + Int64.Encode(stream, encodedConfigSettingContractLedgerCostV0.WriteFee1KBBucketListHigh); + Uint32.Encode(stream, encodedConfigSettingContractLedgerCostV0.BucketListWriteFeeGrowthFactor); + } + + public static ConfigSettingContractLedgerCostV0 Decode(XdrDataInputStream stream) + { + var decodedConfigSettingContractLedgerCostV0 = new ConfigSettingContractLedgerCostV0(); + decodedConfigSettingContractLedgerCostV0.LedgerMaxReadLedgerEntries = Uint32.Decode(stream); + decodedConfigSettingContractLedgerCostV0.LedgerMaxReadBytes = Uint32.Decode(stream); + decodedConfigSettingContractLedgerCostV0.LedgerMaxWriteLedgerEntries = Uint32.Decode(stream); + decodedConfigSettingContractLedgerCostV0.LedgerMaxWriteBytes = Uint32.Decode(stream); + decodedConfigSettingContractLedgerCostV0.TxMaxReadLedgerEntries = Uint32.Decode(stream); + decodedConfigSettingContractLedgerCostV0.TxMaxReadBytes = Uint32.Decode(stream); + decodedConfigSettingContractLedgerCostV0.TxMaxWriteLedgerEntries = Uint32.Decode(stream); + decodedConfigSettingContractLedgerCostV0.TxMaxWriteBytes = Uint32.Decode(stream); + decodedConfigSettingContractLedgerCostV0.FeeReadLedgerEntry = Int64.Decode(stream); + decodedConfigSettingContractLedgerCostV0.FeeWriteLedgerEntry = Int64.Decode(stream); + decodedConfigSettingContractLedgerCostV0.FeeRead1KB = Int64.Decode(stream); + decodedConfigSettingContractLedgerCostV0.BucketListTargetSizeBytes = Int64.Decode(stream); + decodedConfigSettingContractLedgerCostV0.WriteFee1KBBucketListLow = Int64.Decode(stream); + decodedConfigSettingContractLedgerCostV0.WriteFee1KBBucketListHigh = Int64.Decode(stream); + decodedConfigSettingContractLedgerCostV0.BucketListWriteFeeGrowthFactor = Uint32.Decode(stream); + return decodedConfigSettingContractLedgerCostV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigSettingEntry.cs b/stellar-dotnet-sdk-xdr/generated/ConfigSettingEntry.cs new file mode 100644 index 00000000..023b8133 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigSettingEntry.cs @@ -0,0 +1,169 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union ConfigSettingEntry switch (ConfigSettingID configSettingID) +// { +// case CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES: +// uint32 contractMaxSizeBytes; +// case CONFIG_SETTING_CONTRACT_COMPUTE_V0: +// ConfigSettingContractComputeV0 contractCompute; +// case CONFIG_SETTING_CONTRACT_LEDGER_COST_V0: +// ConfigSettingContractLedgerCostV0 contractLedgerCost; +// case CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0: +// ConfigSettingContractHistoricalDataV0 contractHistoricalData; +// case CONFIG_SETTING_CONTRACT_EVENTS_V0: +// ConfigSettingContractEventsV0 contractEvents; +// case CONFIG_SETTING_CONTRACT_BANDWIDTH_V0: +// ConfigSettingContractBandwidthV0 contractBandwidth; +// case CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS: +// ContractCostParams contractCostParamsCpuInsns; +// case CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES: +// ContractCostParams contractCostParamsMemBytes; +// case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: +// uint32 contractDataKeySizeBytes; +// case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: +// uint32 contractDataEntrySizeBytes; +// case CONFIG_SETTING_STATE_ARCHIVAL: +// StateArchivalSettings stateArchivalSettings; +// case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: +// ConfigSettingContractExecutionLanesV0 contractExecutionLanes; +// case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: +// uint64 bucketListSizeWindow<>; +// case CONFIG_SETTING_EVICTION_ITERATOR: +// EvictionIterator evictionIterator; +// }; + +// =========================================================================== +public class ConfigSettingEntry +{ + public ConfigSettingID Discriminant { get; set; } = new(); + + public Uint32 ContractMaxSizeBytes { get; set; } + public ConfigSettingContractComputeV0 ContractCompute { get; set; } + public ConfigSettingContractLedgerCostV0 ContractLedgerCost { get; set; } + public ConfigSettingContractHistoricalDataV0 ContractHistoricalData { get; set; } + public ConfigSettingContractEventsV0 ContractEvents { get; set; } + public ConfigSettingContractBandwidthV0 ContractBandwidth { get; set; } + public ContractCostParams ContractCostParamsCpuInsns { get; set; } + public ContractCostParams ContractCostParamsMemBytes { get; set; } + public Uint32 ContractDataKeySizeBytes { get; set; } + public Uint32 ContractDataEntrySizeBytes { get; set; } + public StateArchivalSettings StateArchivalSettings { get; set; } + public ConfigSettingContractExecutionLanesV0 ContractExecutionLanes { get; set; } + public Uint64[] BucketListSizeWindow { get; set; } + public EvictionIterator EvictionIterator { get; set; } + + public static void Encode(XdrDataOutputStream stream, ConfigSettingEntry encodedConfigSettingEntry) + { + stream.WriteInt((int)encodedConfigSettingEntry.Discriminant.InnerValue); + switch (encodedConfigSettingEntry.Discriminant.InnerValue) + { + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES: + Uint32.Encode(stream, encodedConfigSettingEntry.ContractMaxSizeBytes); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COMPUTE_V0: + ConfigSettingContractComputeV0.Encode(stream, encodedConfigSettingEntry.ContractCompute); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_LEDGER_COST_V0: + ConfigSettingContractLedgerCostV0.Encode(stream, encodedConfigSettingEntry.ContractLedgerCost); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0: + ConfigSettingContractHistoricalDataV0.Encode(stream, encodedConfigSettingEntry.ContractHistoricalData); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_EVENTS_V0: + ConfigSettingContractEventsV0.Encode(stream, encodedConfigSettingEntry.ContractEvents); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_BANDWIDTH_V0: + ConfigSettingContractBandwidthV0.Encode(stream, encodedConfigSettingEntry.ContractBandwidth); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS: + ContractCostParams.Encode(stream, encodedConfigSettingEntry.ContractCostParamsCpuInsns); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES: + ContractCostParams.Encode(stream, encodedConfigSettingEntry.ContractCostParamsMemBytes); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: + Uint32.Encode(stream, encodedConfigSettingEntry.ContractDataKeySizeBytes); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: + Uint32.Encode(stream, encodedConfigSettingEntry.ContractDataEntrySizeBytes); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_STATE_ARCHIVAL: + StateArchivalSettings.Encode(stream, encodedConfigSettingEntry.StateArchivalSettings); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_EXECUTION_LANES: + ConfigSettingContractExecutionLanesV0.Encode(stream, encodedConfigSettingEntry.ContractExecutionLanes); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: + var bucketListSizeWindowsize = encodedConfigSettingEntry.BucketListSizeWindow.Length; + stream.WriteInt(bucketListSizeWindowsize); + for (var i = 0; i < bucketListSizeWindowsize; i++) + Uint64.Encode(stream, encodedConfigSettingEntry.BucketListSizeWindow[i]); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_EVICTION_ITERATOR: + EvictionIterator.Encode(stream, encodedConfigSettingEntry.EvictionIterator); + break; + } + } + + public static ConfigSettingEntry Decode(XdrDataInputStream stream) + { + var decodedConfigSettingEntry = new ConfigSettingEntry(); + var discriminant = ConfigSettingID.Decode(stream); + decodedConfigSettingEntry.Discriminant = discriminant; + switch (decodedConfigSettingEntry.Discriminant.InnerValue) + { + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES: + decodedConfigSettingEntry.ContractMaxSizeBytes = Uint32.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COMPUTE_V0: + decodedConfigSettingEntry.ContractCompute = ConfigSettingContractComputeV0.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_LEDGER_COST_V0: + decodedConfigSettingEntry.ContractLedgerCost = ConfigSettingContractLedgerCostV0.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0: + decodedConfigSettingEntry.ContractHistoricalData = ConfigSettingContractHistoricalDataV0.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_EVENTS_V0: + decodedConfigSettingEntry.ContractEvents = ConfigSettingContractEventsV0.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_BANDWIDTH_V0: + decodedConfigSettingEntry.ContractBandwidth = ConfigSettingContractBandwidthV0.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS: + decodedConfigSettingEntry.ContractCostParamsCpuInsns = ContractCostParams.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES: + decodedConfigSettingEntry.ContractCostParamsMemBytes = ContractCostParams.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: + decodedConfigSettingEntry.ContractDataKeySizeBytes = Uint32.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: + decodedConfigSettingEntry.ContractDataEntrySizeBytes = Uint32.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_STATE_ARCHIVAL: + decodedConfigSettingEntry.StateArchivalSettings = StateArchivalSettings.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_EXECUTION_LANES: + decodedConfigSettingEntry.ContractExecutionLanes = ConfigSettingContractExecutionLanesV0.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: + var bucketListSizeWindowsize = stream.ReadInt(); + decodedConfigSettingEntry.BucketListSizeWindow = new Uint64[bucketListSizeWindowsize]; + for (var i = 0; i < bucketListSizeWindowsize; i++) + decodedConfigSettingEntry.BucketListSizeWindow[i] = Uint64.Decode(stream); + break; + case ConfigSettingID.ConfigSettingIDEnum.CONFIG_SETTING_EVICTION_ITERATOR: + decodedConfigSettingEntry.EvictionIterator = EvictionIterator.Decode(stream); + break; + } + + return decodedConfigSettingEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigSettingID.cs b/stellar-dotnet-sdk-xdr/generated/ConfigSettingID.cs new file mode 100644 index 00000000..8244d61d --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigSettingID.cs @@ -0,0 +1,87 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum ConfigSettingID +// { +// CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES = 0, +// CONFIG_SETTING_CONTRACT_COMPUTE_V0 = 1, +// CONFIG_SETTING_CONTRACT_LEDGER_COST_V0 = 2, +// CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0 = 3, +// CONFIG_SETTING_CONTRACT_EVENTS_V0 = 4, +// CONFIG_SETTING_CONTRACT_BANDWIDTH_V0 = 5, +// CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS = 6, +// CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, +// CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, +// CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, +// CONFIG_SETTING_STATE_ARCHIVAL = 10, +// CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, +// CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, +// CONFIG_SETTING_EVICTION_ITERATOR = 13 +// }; + +// =========================================================================== +public class ConfigSettingID +{ + public enum ConfigSettingIDEnum + { + CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES = 0, + CONFIG_SETTING_CONTRACT_COMPUTE_V0 = 1, + CONFIG_SETTING_CONTRACT_LEDGER_COST_V0 = 2, + CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0 = 3, + CONFIG_SETTING_CONTRACT_EVENTS_V0 = 4, + CONFIG_SETTING_CONTRACT_BANDWIDTH_V0 = 5, + CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS = 6, + CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, + CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, + CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, + CONFIG_SETTING_STATE_ARCHIVAL = 10, + CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, + CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, + CONFIG_SETTING_EVICTION_ITERATOR = 13 + } + + public ConfigSettingIDEnum InnerValue { get; set; } = default; + + public static ConfigSettingID Create(ConfigSettingIDEnum v) + { + return new ConfigSettingID + { + InnerValue = v + }; + } + + public static ConfigSettingID Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES); + case 1: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COMPUTE_V0); + case 2: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_LEDGER_COST_V0); + case 3: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0); + case 4: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_EVENTS_V0); + case 5: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_BANDWIDTH_V0); + case 6: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS); + case 7: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES); + case 8: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES); + case 9: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES); + case 10: return Create(ConfigSettingIDEnum.CONFIG_SETTING_STATE_ARCHIVAL); + case 11: return Create(ConfigSettingIDEnum.CONFIG_SETTING_CONTRACT_EXECUTION_LANES); + case 12: return Create(ConfigSettingIDEnum.CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW); + case 13: return Create(ConfigSettingIDEnum.CONFIG_SETTING_EVICTION_ITERATOR); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, ConfigSettingID value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigUpgradeSet.cs b/stellar-dotnet-sdk-xdr/generated/ConfigUpgradeSet.cs new file mode 100644 index 00000000..cf0a67a1 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigUpgradeSet.cs @@ -0,0 +1,34 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ConfigUpgradeSet { +// ConfigSettingEntry updatedEntry<>; +// }; + +// =========================================================================== +public class ConfigUpgradeSet +{ + public ConfigSettingEntry[] UpdatedEntry { get; set; } + + public static void Encode(XdrDataOutputStream stream, ConfigUpgradeSet encodedConfigUpgradeSet) + { + var updatedEntrysize = encodedConfigUpgradeSet.UpdatedEntry.Length; + stream.WriteInt(updatedEntrysize); + for (var i = 0; i < updatedEntrysize; i++) + ConfigSettingEntry.Encode(stream, encodedConfigUpgradeSet.UpdatedEntry[i]); + } + + public static ConfigUpgradeSet Decode(XdrDataInputStream stream) + { + var decodedConfigUpgradeSet = new ConfigUpgradeSet(); + var updatedEntrysize = stream.ReadInt(); + decodedConfigUpgradeSet.UpdatedEntry = new ConfigSettingEntry[updatedEntrysize]; + for (var i = 0; i < updatedEntrysize; i++) + decodedConfigUpgradeSet.UpdatedEntry[i] = ConfigSettingEntry.Decode(stream); + return decodedConfigUpgradeSet; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ConfigUpgradeSetKey.cs b/stellar-dotnet-sdk-xdr/generated/ConfigUpgradeSetKey.cs new file mode 100644 index 00000000..cb0d5a37 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ConfigUpgradeSetKey.cs @@ -0,0 +1,32 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ConfigUpgradeSetKey { +// Hash contractID; +// Hash contentHash; +// }; + +// =========================================================================== +public class ConfigUpgradeSetKey +{ + public Hash ContractID { get; set; } + public Hash ContentHash { get; set; } + + public static void Encode(XdrDataOutputStream stream, ConfigUpgradeSetKey encodedConfigUpgradeSetKey) + { + Hash.Encode(stream, encodedConfigUpgradeSetKey.ContractID); + Hash.Encode(stream, encodedConfigUpgradeSetKey.ContentHash); + } + + public static ConfigUpgradeSetKey Decode(XdrDataInputStream stream) + { + var decodedConfigUpgradeSetKey = new ConfigUpgradeSetKey(); + decodedConfigUpgradeSetKey.ContractID = Hash.Decode(stream); + decodedConfigUpgradeSetKey.ContentHash = Hash.Decode(stream); + return decodedConfigUpgradeSetKey; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractCodeEntry.cs b/stellar-dotnet-sdk-xdr/generated/ContractCodeEntry.cs new file mode 100644 index 00000000..681c850c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractCodeEntry.cs @@ -0,0 +1,41 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ContractCodeEntry { +// ExtensionPoint ext; +// +// Hash hash; +// opaque code<>; +// }; + +// =========================================================================== +public class ContractCodeEntry +{ + public ExtensionPoint Ext { get; set; } + public Hash Hash { get; set; } + public byte[] Code { get; set; } + + public static void Encode(XdrDataOutputStream stream, ContractCodeEntry encodedContractCodeEntry) + { + ExtensionPoint.Encode(stream, encodedContractCodeEntry.Ext); + Hash.Encode(stream, encodedContractCodeEntry.Hash); + var codesize = encodedContractCodeEntry.Code.Length; + stream.WriteInt(codesize); + stream.Write(encodedContractCodeEntry.Code, 0, codesize); + } + + public static ContractCodeEntry Decode(XdrDataInputStream stream) + { + var decodedContractCodeEntry = new ContractCodeEntry(); + decodedContractCodeEntry.Ext = ExtensionPoint.Decode(stream); + decodedContractCodeEntry.Hash = Hash.Decode(stream); + var codesize = stream.ReadInt(); + decodedContractCodeEntry.Code = new byte[codesize]; + stream.Read(decodedContractCodeEntry.Code, 0, codesize); + return decodedContractCodeEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractCostParamEntry.cs b/stellar-dotnet-sdk-xdr/generated/ContractCostParamEntry.cs new file mode 100644 index 00000000..396a5c5e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractCostParamEntry.cs @@ -0,0 +1,38 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ContractCostParamEntry { +// // use `ext` to add more terms (e.g. higher order polynomials) in the future +// ExtensionPoint ext; +// +// int64 constTerm; +// int64 linearTerm; +// }; + +// =========================================================================== +public class ContractCostParamEntry +{ + public ExtensionPoint Ext { get; set; } + public Int64 ConstTerm { get; set; } + public Int64 LinearTerm { get; set; } + + public static void Encode(XdrDataOutputStream stream, ContractCostParamEntry encodedContractCostParamEntry) + { + ExtensionPoint.Encode(stream, encodedContractCostParamEntry.Ext); + Int64.Encode(stream, encodedContractCostParamEntry.ConstTerm); + Int64.Encode(stream, encodedContractCostParamEntry.LinearTerm); + } + + public static ContractCostParamEntry Decode(XdrDataInputStream stream) + { + var decodedContractCostParamEntry = new ContractCostParamEntry(); + decodedContractCostParamEntry.Ext = ExtensionPoint.Decode(stream); + decodedContractCostParamEntry.ConstTerm = Int64.Decode(stream); + decodedContractCostParamEntry.LinearTerm = Int64.Decode(stream); + return decodedContractCostParamEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractCostParams.cs b/stellar-dotnet-sdk-xdr/generated/ContractCostParams.cs new file mode 100644 index 00000000..03ce639b --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractCostParams.cs @@ -0,0 +1,41 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef ContractCostParamEntry ContractCostParams; + +// =========================================================================== +public class ContractCostParams +{ + public ContractCostParams() + { + } + + public ContractCostParams(ContractCostParamEntry[] value) + { + InnerValue = value; + } + + public ContractCostParamEntry[] InnerValue { get; set; } = default; + + public static void Encode(XdrDataOutputStream stream, ContractCostParams encodedContractCostParams) + { + var ContractCostParamssize = encodedContractCostParams.InnerValue.Length; + stream.WriteInt(ContractCostParamssize); + for (var i = 0; i < ContractCostParamssize; i++) + ContractCostParamEntry.Encode(stream, encodedContractCostParams.InnerValue[i]); + } + + public static ContractCostParams Decode(XdrDataInputStream stream) + { + var decodedContractCostParams = new ContractCostParams(); + var ContractCostParamssize = stream.ReadInt(); + decodedContractCostParams.InnerValue = new ContractCostParamEntry[ContractCostParamssize]; + for (var i = 0; i < ContractCostParamssize; i++) + decodedContractCostParams.InnerValue[i] = ContractCostParamEntry.Decode(stream); + return decodedContractCostParams; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractCostType.cs b/stellar-dotnet-sdk-xdr/generated/ContractCostType.cs new file mode 100644 index 00000000..c2ab6d14 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractCostType.cs @@ -0,0 +1,140 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum ContractCostType { +// // Cost of running 1 wasm instruction +// WasmInsnExec = 0, +// // Cost of allocating a slice of memory (in bytes) +// MemAlloc = 1, +// // Cost of copying a slice of bytes into a pre-allocated memory +// MemCpy = 2, +// // Cost of comparing two slices of memory +// MemCmp = 3, +// // Cost of a host function dispatch, not including the actual work done by +// // the function nor the cost of VM invocation machinary +// DispatchHostFunction = 4, +// // Cost of visiting a host object from the host object storage. Exists to +// // make sure some baseline cost coverage, i.e. repeatly visiting objects +// // by the guest will always incur some charges. +// VisitObject = 5, +// // Cost of serializing an xdr object to bytes +// ValSer = 6, +// // Cost of deserializing an xdr object from bytes +// ValDeser = 7, +// // Cost of computing the sha256 hash from bytes +// ComputeSha256Hash = 8, +// // Cost of computing the ed25519 pubkey from bytes +// ComputeEd25519PubKey = 9, +// // Cost of verifying ed25519 signature of a payload. +// VerifyEd25519Sig = 10, +// // Cost of instantiation a VM from wasm bytes code. +// VmInstantiation = 11, +// // Cost of instantiation a VM from a cached state. +// VmCachedInstantiation = 12, +// // Cost of invoking a function on the VM. If the function is a host function, +// // additional cost will be covered by `DispatchHostFunction`. +// InvokeVmFunction = 13, +// // Cost of computing a keccak256 hash from bytes. +// ComputeKeccak256Hash = 14, +// // Cost of computing an ECDSA secp256k1 signature from bytes. +// ComputeEcdsaSecp256k1Sig = 15, +// // Cost of recovering an ECDSA secp256k1 key from a signature. +// RecoverEcdsaSecp256k1Key = 16, +// // Cost of int256 addition (`+`) and subtraction (`-`) operations +// Int256AddSub = 17, +// // Cost of int256 multiplication (`*`) operation +// Int256Mul = 18, +// // Cost of int256 division (`/`) operation +// Int256Div = 19, +// // Cost of int256 power (`exp`) operation +// Int256Pow = 20, +// // Cost of int256 shift (`shl`, `shr`) operation +// Int256Shift = 21, +// // Cost of drawing random bytes using a ChaCha20 PRNG +// ChaCha20DrawBytes = 22 +// }; + +// =========================================================================== +public class ContractCostType +{ + public enum ContractCostTypeEnum + { + WasmInsnExec = 0, + MemAlloc = 1, + MemCpy = 2, + MemCmp = 3, + DispatchHostFunction = 4, + VisitObject = 5, + ValSer = 6, + ValDeser = 7, + ComputeSha256Hash = 8, + ComputeEd25519PubKey = 9, + VerifyEd25519Sig = 10, + VmInstantiation = 11, + VmCachedInstantiation = 12, + InvokeVmFunction = 13, + ComputeKeccak256Hash = 14, + ComputeEcdsaSecp256k1Sig = 15, + RecoverEcdsaSecp256k1Key = 16, + Int256AddSub = 17, + Int256Mul = 18, + Int256Div = 19, + Int256Pow = 20, + Int256Shift = 21, + ChaCha20DrawBytes = 22 + } + + public ContractCostTypeEnum InnerValue { get; set; } = default; + + public static ContractCostType Create(ContractCostTypeEnum v) + { + return new ContractCostType + { + InnerValue = v + }; + } + + public static ContractCostType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(ContractCostTypeEnum.WasmInsnExec); + case 1: return Create(ContractCostTypeEnum.MemAlloc); + case 2: return Create(ContractCostTypeEnum.MemCpy); + case 3: return Create(ContractCostTypeEnum.MemCmp); + case 4: return Create(ContractCostTypeEnum.DispatchHostFunction); + case 5: return Create(ContractCostTypeEnum.VisitObject); + case 6: return Create(ContractCostTypeEnum.ValSer); + case 7: return Create(ContractCostTypeEnum.ValDeser); + case 8: return Create(ContractCostTypeEnum.ComputeSha256Hash); + case 9: return Create(ContractCostTypeEnum.ComputeEd25519PubKey); + case 10: return Create(ContractCostTypeEnum.VerifyEd25519Sig); + case 11: return Create(ContractCostTypeEnum.VmInstantiation); + case 12: return Create(ContractCostTypeEnum.VmCachedInstantiation); + case 13: return Create(ContractCostTypeEnum.InvokeVmFunction); + case 14: return Create(ContractCostTypeEnum.ComputeKeccak256Hash); + case 15: return Create(ContractCostTypeEnum.ComputeEcdsaSecp256k1Sig); + case 16: return Create(ContractCostTypeEnum.RecoverEcdsaSecp256k1Key); + case 17: return Create(ContractCostTypeEnum.Int256AddSub); + case 18: return Create(ContractCostTypeEnum.Int256Mul); + case 19: return Create(ContractCostTypeEnum.Int256Div); + case 20: return Create(ContractCostTypeEnum.Int256Pow); + case 21: return Create(ContractCostTypeEnum.Int256Shift); + case 22: return Create(ContractCostTypeEnum.ChaCha20DrawBytes); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, ContractCostType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractDataDurability.cs b/stellar-dotnet-sdk-xdr/generated/ContractDataDurability.cs new file mode 100644 index 00000000..2b582f46 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractDataDurability.cs @@ -0,0 +1,50 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum ContractDataDurability { +// TEMPORARY = 0, +// PERSISTENT = 1 +// }; + +// =========================================================================== +public class ContractDataDurability +{ + public enum ContractDataDurabilityEnum + { + TEMPORARY = 0, + PERSISTENT = 1 + } + + public ContractDataDurabilityEnum InnerValue { get; set; } = default; + + public static ContractDataDurability Create(ContractDataDurabilityEnum v) + { + return new ContractDataDurability + { + InnerValue = v + }; + } + + public static ContractDataDurability Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(ContractDataDurabilityEnum.TEMPORARY); + case 1: return Create(ContractDataDurabilityEnum.PERSISTENT); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, ContractDataDurability value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractDataEntry.cs b/stellar-dotnet-sdk-xdr/generated/ContractDataEntry.cs new file mode 100644 index 00000000..69aac7d9 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractDataEntry.cs @@ -0,0 +1,45 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ContractDataEntry { +// ExtensionPoint ext; +// +// SCAddress contract; +// SCVal key; +// ContractDataDurability durability; +// SCVal val; +// }; + +// =========================================================================== +public class ContractDataEntry +{ + public ExtensionPoint Ext { get; set; } + public SCAddress Contract { get; set; } + public SCVal Key { get; set; } + public ContractDataDurability Durability { get; set; } + public SCVal Val { get; set; } + + public static void Encode(XdrDataOutputStream stream, ContractDataEntry encodedContractDataEntry) + { + ExtensionPoint.Encode(stream, encodedContractDataEntry.Ext); + SCAddress.Encode(stream, encodedContractDataEntry.Contract); + SCVal.Encode(stream, encodedContractDataEntry.Key); + ContractDataDurability.Encode(stream, encodedContractDataEntry.Durability); + SCVal.Encode(stream, encodedContractDataEntry.Val); + } + + public static ContractDataEntry Decode(XdrDataInputStream stream) + { + var decodedContractDataEntry = new ContractDataEntry(); + decodedContractDataEntry.Ext = ExtensionPoint.Decode(stream); + decodedContractDataEntry.Contract = SCAddress.Decode(stream); + decodedContractDataEntry.Key = SCVal.Decode(stream); + decodedContractDataEntry.Durability = ContractDataDurability.Decode(stream); + decodedContractDataEntry.Val = SCVal.Decode(stream); + return decodedContractDataEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractEvent.cs b/stellar-dotnet-sdk-xdr/generated/ContractEvent.cs new file mode 100644 index 00000000..9acd1470 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractEvent.cs @@ -0,0 +1,121 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ContractEvent +// { +// // We can use this to add more fields, or because it +// // is first, to change ContractEvent into a union. +// ExtensionPoint ext; +// +// Hash* contractID; +// ContractEventType type; +// +// union switch (int v) +// { +// case 0: +// struct +// { +// SCVal topics<>; +// SCVal data; +// } v0; +// } +// body; +// }; + +// =========================================================================== +public class ContractEvent +{ + public ExtensionPoint Ext { get; set; } + public Hash ContractID { get; set; } + public ContractEventType Type { get; set; } + public ContractEventBody Body { get; set; } + + public static void Encode(XdrDataOutputStream stream, ContractEvent encodedContractEvent) + { + ExtensionPoint.Encode(stream, encodedContractEvent.Ext); + if (encodedContractEvent.ContractID != null) + { + stream.WriteInt(1); + Hash.Encode(stream, encodedContractEvent.ContractID); + } + else + { + stream.WriteInt(0); + } + + ContractEventType.Encode(stream, encodedContractEvent.Type); + ContractEventBody.Encode(stream, encodedContractEvent.Body); + } + + public static ContractEvent Decode(XdrDataInputStream stream) + { + var decodedContractEvent = new ContractEvent(); + decodedContractEvent.Ext = ExtensionPoint.Decode(stream); + var ContractIDPresent = stream.ReadInt(); + if (ContractIDPresent != 0) decodedContractEvent.ContractID = Hash.Decode(stream); + decodedContractEvent.Type = ContractEventType.Decode(stream); + decodedContractEvent.Body = ContractEventBody.Decode(stream); + return decodedContractEvent; + } + + public class ContractEventBody + { + public int Discriminant { get; set; } + + public ContractEventV0 V0 { get; set; } + + public static void Encode(XdrDataOutputStream stream, ContractEventBody encodedContractEventBody) + { + stream.WriteInt(encodedContractEventBody.Discriminant); + switch (encodedContractEventBody.Discriminant) + { + case 0: + ContractEventV0.Encode(stream, encodedContractEventBody.V0); + break; + } + } + + public static ContractEventBody Decode(XdrDataInputStream stream) + { + var decodedContractEventBody = new ContractEventBody(); + var discriminant = stream.ReadInt(); + decodedContractEventBody.Discriminant = discriminant; + switch (decodedContractEventBody.Discriminant) + { + case 0: + decodedContractEventBody.V0 = ContractEventV0.Decode(stream); + break; + } + + return decodedContractEventBody; + } + + public class ContractEventV0 + { + public SCVal[] Topics { get; set; } + public SCVal Data { get; set; } + + public static void Encode(XdrDataOutputStream stream, ContractEventV0 encodedContractEventV0) + { + var topicssize = encodedContractEventV0.Topics.Length; + stream.WriteInt(topicssize); + for (var i = 0; i < topicssize; i++) SCVal.Encode(stream, encodedContractEventV0.Topics[i]); + SCVal.Encode(stream, encodedContractEventV0.Data); + } + + public static ContractEventV0 Decode(XdrDataInputStream stream) + { + var decodedContractEventV0 = new ContractEventV0(); + var topicssize = stream.ReadInt(); + decodedContractEventV0.Topics = new SCVal[topicssize]; + for (var i = 0; i < topicssize; i++) decodedContractEventV0.Topics[i] = SCVal.Decode(stream); + decodedContractEventV0.Data = SCVal.Decode(stream); + return decodedContractEventV0; + } + } + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractEventType.cs b/stellar-dotnet-sdk-xdr/generated/ContractEventType.cs new file mode 100644 index 00000000..ab3705fa --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractEventType.cs @@ -0,0 +1,54 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum ContractEventType +// { +// SYSTEM = 0, +// CONTRACT = 1, +// DIAGNOSTIC = 2 +// }; + +// =========================================================================== +public class ContractEventType +{ + public enum ContractEventTypeEnum + { + SYSTEM = 0, + CONTRACT = 1, + DIAGNOSTIC = 2 + } + + public ContractEventTypeEnum InnerValue { get; set; } = default; + + public static ContractEventType Create(ContractEventTypeEnum v) + { + return new ContractEventType + { + InnerValue = v + }; + } + + public static ContractEventType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(ContractEventTypeEnum.SYSTEM); + case 1: return Create(ContractEventTypeEnum.CONTRACT); + case 2: return Create(ContractEventTypeEnum.DIAGNOSTIC); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, ContractEventType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractExecutable.cs b/stellar-dotnet-sdk-xdr/generated/ContractExecutable.cs new file mode 100644 index 00000000..bb205480 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractExecutable.cs @@ -0,0 +1,52 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union ContractExecutable switch (ContractExecutableType type) +// { +// case CONTRACT_EXECUTABLE_WASM: +// Hash wasm_hash; +// case CONTRACT_EXECUTABLE_STELLAR_ASSET: +// void; +// }; + +// =========================================================================== +public class ContractExecutable +{ + public ContractExecutableType Discriminant { get; set; } = new(); + + public Hash WasmHash { get; set; } + + public static void Encode(XdrDataOutputStream stream, ContractExecutable encodedContractExecutable) + { + stream.WriteInt((int)encodedContractExecutable.Discriminant.InnerValue); + switch (encodedContractExecutable.Discriminant.InnerValue) + { + case ContractExecutableType.ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_WASM: + Hash.Encode(stream, encodedContractExecutable.WasmHash); + break; + case ContractExecutableType.ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_STELLAR_ASSET: + break; + } + } + + public static ContractExecutable Decode(XdrDataInputStream stream) + { + var decodedContractExecutable = new ContractExecutable(); + var discriminant = ContractExecutableType.Decode(stream); + decodedContractExecutable.Discriminant = discriminant; + switch (decodedContractExecutable.Discriminant.InnerValue) + { + case ContractExecutableType.ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_WASM: + decodedContractExecutable.WasmHash = Hash.Decode(stream); + break; + case ContractExecutableType.ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_STELLAR_ASSET: + break; + } + + return decodedContractExecutable; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractExecutableType.cs b/stellar-dotnet-sdk-xdr/generated/ContractExecutableType.cs new file mode 100644 index 00000000..a326aaca --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractExecutableType.cs @@ -0,0 +1,51 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum ContractExecutableType +// { +// CONTRACT_EXECUTABLE_WASM = 0, +// CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 +// }; + +// =========================================================================== +public class ContractExecutableType +{ + public enum ContractExecutableTypeEnum + { + CONTRACT_EXECUTABLE_WASM = 0, + CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 + } + + public ContractExecutableTypeEnum InnerValue { get; set; } = default; + + public static ContractExecutableType Create(ContractExecutableTypeEnum v) + { + return new ContractExecutableType + { + InnerValue = v + }; + } + + public static ContractExecutableType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_WASM); + case 1: return Create(ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_STELLAR_ASSET); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, ContractExecutableType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractIDPreimage.cs b/stellar-dotnet-sdk-xdr/generated/ContractIDPreimage.cs new file mode 100644 index 00000000..130ffbe5 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractIDPreimage.cs @@ -0,0 +1,80 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union ContractIDPreimage switch (ContractIDPreimageType type) +// { +// case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: +// struct +// { +// SCAddress address; +// uint256 salt; +// } fromAddress; +// case CONTRACT_ID_PREIMAGE_FROM_ASSET: +// Asset fromAsset; +// }; + +// =========================================================================== +public class ContractIDPreimage +{ + public ContractIDPreimageType Discriminant { get; set; } = new(); + + public ContractIDPreimageFromAddress FromAddress { get; set; } + public Asset FromAsset { get; set; } + + public static void Encode(XdrDataOutputStream stream, ContractIDPreimage encodedContractIDPreimage) + { + stream.WriteInt((int)encodedContractIDPreimage.Discriminant.InnerValue); + switch (encodedContractIDPreimage.Discriminant.InnerValue) + { + case ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ADDRESS: + ContractIDPreimageFromAddress.Encode(stream, encodedContractIDPreimage.FromAddress); + break; + case ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ASSET: + Asset.Encode(stream, encodedContractIDPreimage.FromAsset); + break; + } + } + + public static ContractIDPreimage Decode(XdrDataInputStream stream) + { + var decodedContractIDPreimage = new ContractIDPreimage(); + var discriminant = ContractIDPreimageType.Decode(stream); + decodedContractIDPreimage.Discriminant = discriminant; + switch (decodedContractIDPreimage.Discriminant.InnerValue) + { + case ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ADDRESS: + decodedContractIDPreimage.FromAddress = ContractIDPreimageFromAddress.Decode(stream); + break; + case ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ASSET: + decodedContractIDPreimage.FromAsset = Asset.Decode(stream); + break; + } + + return decodedContractIDPreimage; + } + + public class ContractIDPreimageFromAddress + { + public SCAddress Address { get; set; } + public Uint256 Salt { get; set; } + + public static void Encode(XdrDataOutputStream stream, + ContractIDPreimageFromAddress encodedContractIDPreimageFromAddress) + { + SCAddress.Encode(stream, encodedContractIDPreimageFromAddress.Address); + Uint256.Encode(stream, encodedContractIDPreimageFromAddress.Salt); + } + + public static ContractIDPreimageFromAddress Decode(XdrDataInputStream stream) + { + var decodedContractIDPreimageFromAddress = new ContractIDPreimageFromAddress(); + decodedContractIDPreimageFromAddress.Address = SCAddress.Decode(stream); + decodedContractIDPreimageFromAddress.Salt = Uint256.Decode(stream); + return decodedContractIDPreimageFromAddress; + } + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ContractIDPreimageType.cs b/stellar-dotnet-sdk-xdr/generated/ContractIDPreimageType.cs new file mode 100644 index 00000000..a9ed0e89 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ContractIDPreimageType.cs @@ -0,0 +1,51 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum ContractIDPreimageType +// { +// CONTRACT_ID_PREIMAGE_FROM_ADDRESS = 0, +// CONTRACT_ID_PREIMAGE_FROM_ASSET = 1 +// }; + +// =========================================================================== +public class ContractIDPreimageType +{ + public enum ContractIDPreimageTypeEnum + { + CONTRACT_ID_PREIMAGE_FROM_ADDRESS = 0, + CONTRACT_ID_PREIMAGE_FROM_ASSET = 1 + } + + public ContractIDPreimageTypeEnum InnerValue { get; set; } = default; + + public static ContractIDPreimageType Create(ContractIDPreimageTypeEnum v) + { + return new ContractIDPreimageType + { + InnerValue = v + }; + } + + public static ContractIDPreimageType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ADDRESS); + case 1: return Create(ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ASSET); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, ContractIDPreimageType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CreateAccountOp.cs b/stellar-dotnet-sdk-xdr/generated/CreateAccountOp.cs index 46cc5d87..946a2217 100644 --- a/stellar-dotnet-sdk-xdr/generated/CreateAccountOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/CreateAccountOp.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct CreateAccountOp +// { +// AccountID destination; // account to create +// int64 startingBalance; // amount they end up with +// }; - // struct CreateAccountOp - // { - // AccountID destination; // account to create - // int64 startingBalance; // amount they end up with - // }; +// =========================================================================== +public class CreateAccountOp +{ + public AccountID Destination { get; set; } + public Int64 StartingBalance { get; set; } - // =========================================================================== - public class CreateAccountOp + public static void Encode(XdrDataOutputStream stream, CreateAccountOp encodedCreateAccountOp) { - public CreateAccountOp() { } - public AccountID Destination { get; set; } - public Int64 StartingBalance { get; set; } + AccountID.Encode(stream, encodedCreateAccountOp.Destination); + Int64.Encode(stream, encodedCreateAccountOp.StartingBalance); + } - public static void Encode(XdrDataOutputStream stream, CreateAccountOp encodedCreateAccountOp) - { - AccountID.Encode(stream, encodedCreateAccountOp.Destination); - Int64.Encode(stream, encodedCreateAccountOp.StartingBalance); - } - public static CreateAccountOp Decode(XdrDataInputStream stream) - { - CreateAccountOp decodedCreateAccountOp = new CreateAccountOp(); - decodedCreateAccountOp.Destination = AccountID.Decode(stream); - decodedCreateAccountOp.StartingBalance = Int64.Decode(stream); - return decodedCreateAccountOp; - } + public static CreateAccountOp Decode(XdrDataInputStream stream) + { + var decodedCreateAccountOp = new CreateAccountOp(); + decodedCreateAccountOp.Destination = AccountID.Decode(stream); + decodedCreateAccountOp.StartingBalance = Int64.Decode(stream); + return decodedCreateAccountOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CreateAccountResult.cs b/stellar-dotnet-sdk-xdr/generated/CreateAccountResult.cs index d888bd44..9a5a39a0 100644 --- a/stellar-dotnet-sdk-xdr/generated/CreateAccountResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/CreateAccountResult.cs @@ -1,51 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union CreateAccountResult switch (CreateAccountResultCode code) - // { - // case CREATE_ACCOUNT_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class CreateAccountResult - { - public CreateAccountResult() { } +// union CreateAccountResult switch (CreateAccountResultCode code) +// { +// case CREATE_ACCOUNT_SUCCESS: +// void; +// case CREATE_ACCOUNT_MALFORMED: +// case CREATE_ACCOUNT_UNDERFUNDED: +// case CREATE_ACCOUNT_LOW_RESERVE: +// case CREATE_ACCOUNT_ALREADY_EXIST: +// void; +// }; - public CreateAccountResultCode Discriminant { get; set; } = new CreateAccountResultCode(); +// =========================================================================== +public class CreateAccountResult +{ + public CreateAccountResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, CreateAccountResult encodedCreateAccountResult) + public static void Encode(XdrDataOutputStream stream, CreateAccountResult encodedCreateAccountResult) + { + stream.WriteInt((int)encodedCreateAccountResult.Discriminant.InnerValue); + switch (encodedCreateAccountResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedCreateAccountResult.Discriminant.InnerValue); - switch (encodedCreateAccountResult.Discriminant.InnerValue) - { - case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS: - break; - default: - break; - } + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS: + break; + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_MALFORMED: + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_UNDERFUNDED: + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_LOW_RESERVE: + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_ALREADY_EXIST: + break; } - public static CreateAccountResult Decode(XdrDataInputStream stream) + } + + public static CreateAccountResult Decode(XdrDataInputStream stream) + { + var decodedCreateAccountResult = new CreateAccountResult(); + var discriminant = CreateAccountResultCode.Decode(stream); + decodedCreateAccountResult.Discriminant = discriminant; + switch (decodedCreateAccountResult.Discriminant.InnerValue) { - CreateAccountResult decodedCreateAccountResult = new CreateAccountResult(); - CreateAccountResultCode discriminant = CreateAccountResultCode.Decode(stream); - decodedCreateAccountResult.Discriminant = discriminant; - switch (decodedCreateAccountResult.Discriminant.InnerValue) - { - case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS: - break; - default: - break; - } - return decodedCreateAccountResult; + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS: + break; + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_MALFORMED: + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_UNDERFUNDED: + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_LOW_RESERVE: + case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_ALREADY_EXIST: + break; } + + return decodedCreateAccountResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CreateAccountResultCode.cs b/stellar-dotnet-sdk-xdr/generated/CreateAccountResultCode.cs index 832d6e4a..b52123f9 100644 --- a/stellar-dotnet-sdk-xdr/generated/CreateAccountResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/CreateAccountResultCode.cs @@ -1,64 +1,64 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum CreateAccountResultCode - // { - // // 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 - // CREATE_ACCOUNT_LOW_RESERVE = - // -3, // would create an account below the min reserve - // CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists - // }; +// enum CreateAccountResultCode +// { +// // 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 +// CREATE_ACCOUNT_LOW_RESERVE = +// -3, // would create an account below the min reserve +// CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists +// }; - // =========================================================================== - public class CreateAccountResultCode +// =========================================================================== +public class CreateAccountResultCode +{ + public enum CreateAccountResultCodeEnum { - public enum CreateAccountResultCodeEnum - { - CREATE_ACCOUNT_SUCCESS = 0, - CREATE_ACCOUNT_MALFORMED = -1, - CREATE_ACCOUNT_UNDERFUNDED = -2, - CREATE_ACCOUNT_LOW_RESERVE = -3, - CREATE_ACCOUNT_ALREADY_EXIST = -4, - } - public CreateAccountResultCodeEnum InnerValue { get; set; } = default(CreateAccountResultCodeEnum); + CREATE_ACCOUNT_SUCCESS = 0, + CREATE_ACCOUNT_MALFORMED = -1, + CREATE_ACCOUNT_UNDERFUNDED = -2, + CREATE_ACCOUNT_LOW_RESERVE = -3, + CREATE_ACCOUNT_ALREADY_EXIST = -4 + } - public static CreateAccountResultCode Create(CreateAccountResultCodeEnum v) - { - return new CreateAccountResultCode - { - InnerValue = v - }; - } + public CreateAccountResultCodeEnum InnerValue { get; set; } = default; - public static CreateAccountResultCode Decode(XdrDataInputStream stream) + public static CreateAccountResultCode Create(CreateAccountResultCodeEnum v) + { + return new CreateAccountResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS); - case -1: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_MALFORMED); - case -2: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_UNDERFUNDED); - case -3: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_LOW_RESERVE); - case -4: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_ALREADY_EXIST); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, CreateAccountResultCode value) + public static CreateAccountResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS); + case -1: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_MALFORMED); + case -2: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_UNDERFUNDED); + case -3: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_LOW_RESERVE); + case -4: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_ALREADY_EXIST); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, CreateAccountResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceOp.cs b/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceOp.cs index 7f4602d5..e4485662 100644 --- a/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceOp.cs @@ -1,50 +1,41 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct CreateClaimableBalanceOp +// { +// Asset asset; +// int64 amount; +// Claimant claimants<10>; +// }; - // struct CreateClaimableBalanceOp - // { - // Asset asset; - // int64 amount; - // Claimant claimants<10>; - // }; +// =========================================================================== +public class CreateClaimableBalanceOp +{ + public Asset Asset { get; set; } + public Int64 Amount { get; set; } + public Claimant[] Claimants { get; set; } - // =========================================================================== - public class CreateClaimableBalanceOp + public static void Encode(XdrDataOutputStream stream, CreateClaimableBalanceOp encodedCreateClaimableBalanceOp) { - public CreateClaimableBalanceOp() { } - public Asset Asset { get; set; } - public Int64 Amount { get; set; } - public Claimant[] Claimants { get; set; } + Asset.Encode(stream, encodedCreateClaimableBalanceOp.Asset); + Int64.Encode(stream, encodedCreateClaimableBalanceOp.Amount); + var claimantssize = encodedCreateClaimableBalanceOp.Claimants.Length; + stream.WriteInt(claimantssize); + for (var i = 0; i < claimantssize; i++) Claimant.Encode(stream, encodedCreateClaimableBalanceOp.Claimants[i]); + } - public static void Encode(XdrDataOutputStream stream, CreateClaimableBalanceOp encodedCreateClaimableBalanceOp) - { - Asset.Encode(stream, encodedCreateClaimableBalanceOp.Asset); - Int64.Encode(stream, encodedCreateClaimableBalanceOp.Amount); - int claimantssize = encodedCreateClaimableBalanceOp.Claimants.Length; - stream.WriteInt(claimantssize); - for (int i = 0; i < claimantssize; i++) - { - Claimant.Encode(stream, encodedCreateClaimableBalanceOp.Claimants[i]); - } - } - public static CreateClaimableBalanceOp Decode(XdrDataInputStream stream) - { - CreateClaimableBalanceOp decodedCreateClaimableBalanceOp = new CreateClaimableBalanceOp(); - decodedCreateClaimableBalanceOp.Asset = Asset.Decode(stream); - decodedCreateClaimableBalanceOp.Amount = Int64.Decode(stream); - int claimantssize = stream.ReadInt(); - decodedCreateClaimableBalanceOp.Claimants = new Claimant[claimantssize]; - for (int i = 0; i < claimantssize; i++) - { - decodedCreateClaimableBalanceOp.Claimants[i] = Claimant.Decode(stream); - } - return decodedCreateClaimableBalanceOp; - } + public static CreateClaimableBalanceOp Decode(XdrDataInputStream stream) + { + var decodedCreateClaimableBalanceOp = new CreateClaimableBalanceOp(); + decodedCreateClaimableBalanceOp.Asset = Asset.Decode(stream); + decodedCreateClaimableBalanceOp.Amount = Int64.Decode(stream); + var claimantssize = stream.ReadInt(); + decodedCreateClaimableBalanceOp.Claimants = new Claimant[claimantssize]; + for (var i = 0; i < claimantssize; i++) decodedCreateClaimableBalanceOp.Claimants[i] = Claimant.Decode(stream); + return decodedCreateClaimableBalanceOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceResult.cs b/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceResult.cs index fb101604..e60510b0 100644 --- a/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceResult.cs @@ -1,55 +1,76 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union CreateClaimableBalanceResult switch ( - // CreateClaimableBalanceResultCode code) - // { - // case CREATE_CLAIMABLE_BALANCE_SUCCESS: - // ClaimableBalanceID balanceID; - // default: - // void; - // }; +// union CreateClaimableBalanceResult switch ( +// CreateClaimableBalanceResultCode code) +// { +// case CREATE_CLAIMABLE_BALANCE_SUCCESS: +// ClaimableBalanceID balanceID; +// case CREATE_CLAIMABLE_BALANCE_MALFORMED: +// case CREATE_CLAIMABLE_BALANCE_LOW_RESERVE: +// case CREATE_CLAIMABLE_BALANCE_NO_TRUST: +// case CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED: +// case CREATE_CLAIMABLE_BALANCE_UNDERFUNDED: +// void; +// }; - // =========================================================================== - public class CreateClaimableBalanceResult - { - public CreateClaimableBalanceResult() { } +// =========================================================================== +public class CreateClaimableBalanceResult +{ + public CreateClaimableBalanceResultCode Discriminant { get; set; } = new(); - public CreateClaimableBalanceResultCode Discriminant { get; set; } = new CreateClaimableBalanceResultCode(); + public ClaimableBalanceID BalanceID { get; set; } - public ClaimableBalanceID BalanceID { get; set; } - public static void Encode(XdrDataOutputStream stream, CreateClaimableBalanceResult encodedCreateClaimableBalanceResult) + public static void Encode(XdrDataOutputStream stream, + CreateClaimableBalanceResult encodedCreateClaimableBalanceResult) + { + stream.WriteInt((int)encodedCreateClaimableBalanceResult.Discriminant.InnerValue); + switch (encodedCreateClaimableBalanceResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedCreateClaimableBalanceResult.Discriminant.InnerValue); - switch (encodedCreateClaimableBalanceResult.Discriminant.InnerValue) - { - case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_SUCCESS: - ClaimableBalanceID.Encode(stream, encodedCreateClaimableBalanceResult.BalanceID); - break; - default: - break; - } + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_SUCCESS: + ClaimableBalanceID.Encode(stream, encodedCreateClaimableBalanceResult.BalanceID); + break; + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_MALFORMED: + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_LOW_RESERVE: + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_NO_TRUST: + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED: + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_UNDERFUNDED: + break; } - public static CreateClaimableBalanceResult Decode(XdrDataInputStream stream) + } + + public static CreateClaimableBalanceResult Decode(XdrDataInputStream stream) + { + var decodedCreateClaimableBalanceResult = new CreateClaimableBalanceResult(); + var discriminant = CreateClaimableBalanceResultCode.Decode(stream); + decodedCreateClaimableBalanceResult.Discriminant = discriminant; + switch (decodedCreateClaimableBalanceResult.Discriminant.InnerValue) { - CreateClaimableBalanceResult decodedCreateClaimableBalanceResult = new CreateClaimableBalanceResult(); - CreateClaimableBalanceResultCode discriminant = CreateClaimableBalanceResultCode.Decode(stream); - decodedCreateClaimableBalanceResult.Discriminant = discriminant; - switch (decodedCreateClaimableBalanceResult.Discriminant.InnerValue) - { - case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_SUCCESS: - decodedCreateClaimableBalanceResult.BalanceID = ClaimableBalanceID.Decode(stream); - break; - default: - break; - } - return decodedCreateClaimableBalanceResult; + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_SUCCESS: + decodedCreateClaimableBalanceResult.BalanceID = ClaimableBalanceID.Decode(stream); + break; + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_MALFORMED: + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_LOW_RESERVE: + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_NO_TRUST: + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED: + case CreateClaimableBalanceResultCode.CreateClaimableBalanceResultCodeEnum + .CREATE_CLAIMABLE_BALANCE_UNDERFUNDED: + break; } + + return decodedCreateClaimableBalanceResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceResultCode.cs b/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceResultCode.cs index a8d06903..1b2b1420 100644 --- a/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/CreateClaimableBalanceResultCode.cs @@ -1,63 +1,63 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum CreateClaimableBalanceResultCode - // { - // CREATE_CLAIMABLE_BALANCE_SUCCESS = 0, - // CREATE_CLAIMABLE_BALANCE_MALFORMED = -1, - // CREATE_CLAIMABLE_BALANCE_LOW_RESERVE = -2, - // CREATE_CLAIMABLE_BALANCE_NO_TRUST = -3, - // CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -4, - // CREATE_CLAIMABLE_BALANCE_UNDERFUNDED = -5 - // }; +// enum CreateClaimableBalanceResultCode +// { +// CREATE_CLAIMABLE_BALANCE_SUCCESS = 0, +// CREATE_CLAIMABLE_BALANCE_MALFORMED = -1, +// CREATE_CLAIMABLE_BALANCE_LOW_RESERVE = -2, +// CREATE_CLAIMABLE_BALANCE_NO_TRUST = -3, +// CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -4, +// CREATE_CLAIMABLE_BALANCE_UNDERFUNDED = -5 +// }; - // =========================================================================== - public class CreateClaimableBalanceResultCode +// =========================================================================== +public class CreateClaimableBalanceResultCode +{ + public enum CreateClaimableBalanceResultCodeEnum { - public enum CreateClaimableBalanceResultCodeEnum - { - CREATE_CLAIMABLE_BALANCE_SUCCESS = 0, - CREATE_CLAIMABLE_BALANCE_MALFORMED = -1, - CREATE_CLAIMABLE_BALANCE_LOW_RESERVE = -2, - CREATE_CLAIMABLE_BALANCE_NO_TRUST = -3, - CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -4, - CREATE_CLAIMABLE_BALANCE_UNDERFUNDED = -5, - } - public CreateClaimableBalanceResultCodeEnum InnerValue { get; set; } = default(CreateClaimableBalanceResultCodeEnum); + CREATE_CLAIMABLE_BALANCE_SUCCESS = 0, + CREATE_CLAIMABLE_BALANCE_MALFORMED = -1, + CREATE_CLAIMABLE_BALANCE_LOW_RESERVE = -2, + CREATE_CLAIMABLE_BALANCE_NO_TRUST = -3, + CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -4, + CREATE_CLAIMABLE_BALANCE_UNDERFUNDED = -5 + } - public static CreateClaimableBalanceResultCode Create(CreateClaimableBalanceResultCodeEnum v) - { - return new CreateClaimableBalanceResultCode - { - InnerValue = v - }; - } + public CreateClaimableBalanceResultCodeEnum InnerValue { get; set; } = default; - public static CreateClaimableBalanceResultCode Decode(XdrDataInputStream stream) + public static CreateClaimableBalanceResultCode Create(CreateClaimableBalanceResultCodeEnum v) + { + return new CreateClaimableBalanceResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_SUCCESS); - case -1: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_MALFORMED); - case -2: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_LOW_RESERVE); - case -3: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_NO_TRUST); - case -4: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED); - case -5: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_UNDERFUNDED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, CreateClaimableBalanceResultCode value) + public static CreateClaimableBalanceResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_SUCCESS); + case -1: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_MALFORMED); + case -2: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_LOW_RESERVE); + case -3: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_NO_TRUST); + case -4: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED); + case -5: return Create(CreateClaimableBalanceResultCodeEnum.CREATE_CLAIMABLE_BALANCE_UNDERFUNDED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, CreateClaimableBalanceResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CreateContractArgs.cs b/stellar-dotnet-sdk-xdr/generated/CreateContractArgs.cs new file mode 100644 index 00000000..75122d72 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/CreateContractArgs.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct CreateContractArgs +// { +// ContractIDPreimage contractIDPreimage; +// ContractExecutable executable; +// }; + +// =========================================================================== +public class CreateContractArgs +{ + public ContractIDPreimage ContractIDPreimage { get; set; } + public ContractExecutable Executable { get; set; } + + public static void Encode(XdrDataOutputStream stream, CreateContractArgs encodedCreateContractArgs) + { + ContractIDPreimage.Encode(stream, encodedCreateContractArgs.ContractIDPreimage); + ContractExecutable.Encode(stream, encodedCreateContractArgs.Executable); + } + + public static CreateContractArgs Decode(XdrDataInputStream stream) + { + var decodedCreateContractArgs = new CreateContractArgs(); + decodedCreateContractArgs.ContractIDPreimage = ContractIDPreimage.Decode(stream); + decodedCreateContractArgs.Executable = ContractExecutable.Decode(stream); + return decodedCreateContractArgs; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CreatePassiveSellOfferOp.cs b/stellar-dotnet-sdk-xdr/generated/CreatePassiveSellOfferOp.cs index 908a0e02..19fbdcd6 100644 --- a/stellar-dotnet-sdk-xdr/generated/CreatePassiveSellOfferOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/CreatePassiveSellOfferOp.cs @@ -1,44 +1,41 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct CreatePassiveSellOfferOp +// { +// Asset selling; // A +// Asset buying; // B +// int64 amount; // amount taker gets +// Price price; // cost of A in terms of B +// }; - // struct CreatePassiveSellOfferOp - // { - // Asset selling; // A - // Asset buying; // B - // int64 amount; // amount taker gets - // Price price; // cost of A in terms of B - // }; +// =========================================================================== +public class CreatePassiveSellOfferOp +{ + public Asset Selling { get; set; } + public Asset Buying { get; set; } + public Int64 Amount { get; set; } + public Price Price { get; set; } - // =========================================================================== - public class CreatePassiveSellOfferOp + public static void Encode(XdrDataOutputStream stream, CreatePassiveSellOfferOp encodedCreatePassiveSellOfferOp) { - public CreatePassiveSellOfferOp() { } - public Asset Selling { get; set; } - public Asset Buying { get; set; } - public Int64 Amount { get; set; } - public Price Price { get; set; } + Asset.Encode(stream, encodedCreatePassiveSellOfferOp.Selling); + Asset.Encode(stream, encodedCreatePassiveSellOfferOp.Buying); + Int64.Encode(stream, encodedCreatePassiveSellOfferOp.Amount); + Price.Encode(stream, encodedCreatePassiveSellOfferOp.Price); + } - public static void Encode(XdrDataOutputStream stream, CreatePassiveSellOfferOp encodedCreatePassiveSellOfferOp) - { - Asset.Encode(stream, encodedCreatePassiveSellOfferOp.Selling); - Asset.Encode(stream, encodedCreatePassiveSellOfferOp.Buying); - Int64.Encode(stream, encodedCreatePassiveSellOfferOp.Amount); - Price.Encode(stream, encodedCreatePassiveSellOfferOp.Price); - } - public static CreatePassiveSellOfferOp Decode(XdrDataInputStream stream) - { - CreatePassiveSellOfferOp decodedCreatePassiveSellOfferOp = new CreatePassiveSellOfferOp(); - decodedCreatePassiveSellOfferOp.Selling = Asset.Decode(stream); - decodedCreatePassiveSellOfferOp.Buying = Asset.Decode(stream); - decodedCreatePassiveSellOfferOp.Amount = Int64.Decode(stream); - decodedCreatePassiveSellOfferOp.Price = Price.Decode(stream); - return decodedCreatePassiveSellOfferOp; - } + public static CreatePassiveSellOfferOp Decode(XdrDataInputStream stream) + { + var decodedCreatePassiveSellOfferOp = new CreatePassiveSellOfferOp(); + decodedCreatePassiveSellOfferOp.Selling = Asset.Decode(stream); + decodedCreatePassiveSellOfferOp.Buying = Asset.Decode(stream); + decodedCreatePassiveSellOfferOp.Amount = Int64.Decode(stream); + decodedCreatePassiveSellOfferOp.Price = Price.Decode(stream); + return decodedCreatePassiveSellOfferOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/CryptoKeyType.cs b/stellar-dotnet-sdk-xdr/generated/CryptoKeyType.cs index 8f358b94..88ebf703 100644 --- a/stellar-dotnet-sdk-xdr/generated/CryptoKeyType.cs +++ b/stellar-dotnet-sdk-xdr/generated/CryptoKeyType.cs @@ -1,62 +1,61 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum CryptoKeyType +// { +// KEY_TYPE_ED25519 = 0, +// KEY_TYPE_PRE_AUTH_TX = 1, +// KEY_TYPE_HASH_X = 2, +// KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3, +// // MUXED enum values for supported type are derived from the enum values +// // above by ORing them with 0x100 +// KEY_TYPE_MUXED_ED25519 = 0x100 +// }; + +// =========================================================================== +public class CryptoKeyType { + public enum CryptoKeyTypeEnum + { + KEY_TYPE_ED25519 = 0, + KEY_TYPE_PRE_AUTH_TX = 1, + KEY_TYPE_HASH_X = 2, + KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3, + KEY_TYPE_MUXED_ED25519 = 256 + } + + public CryptoKeyTypeEnum InnerValue { get; set; } = default; - // === xdr source ============================================================ - - // enum CryptoKeyType - // { - // KEY_TYPE_ED25519 = 0, - // KEY_TYPE_PRE_AUTH_TX = 1, - // KEY_TYPE_HASH_X = 2, - // KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3, - // // MUXED enum values for supported type are derived from the enum values - // // above by ORing them with 0x100 - // KEY_TYPE_MUXED_ED25519 = 0x100 - // }; - - // =========================================================================== - public class CryptoKeyType + public static CryptoKeyType Create(CryptoKeyTypeEnum v) { - public enum CryptoKeyTypeEnum + return new CryptoKeyType { - KEY_TYPE_ED25519 = 0, - KEY_TYPE_PRE_AUTH_TX = 1, - KEY_TYPE_HASH_X = 2, - KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3, - KEY_TYPE_MUXED_ED25519 = 256, - } - public CryptoKeyTypeEnum InnerValue { get; set; } = default(CryptoKeyTypeEnum); - - public static CryptoKeyType Create(CryptoKeyTypeEnum v) - { - return new CryptoKeyType - { - InnerValue = v - }; - } + InnerValue = v + }; + } - public static CryptoKeyType Decode(XdrDataInputStream stream) - { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(CryptoKeyTypeEnum.KEY_TYPE_ED25519); - case 1: return Create(CryptoKeyTypeEnum.KEY_TYPE_PRE_AUTH_TX); - case 2: return Create(CryptoKeyTypeEnum.KEY_TYPE_HASH_X); - case 3: return Create(CryptoKeyTypeEnum.KEY_TYPE_ED25519_SIGNED_PAYLOAD); - case 256: return Create(CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519); - default: - throw new Exception("Unknown enum value: " + value); - } - } - - public static void Encode(XdrDataOutputStream stream, CryptoKeyType value) + public static CryptoKeyType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + return value switch { - stream.WriteInt((int)value.InnerValue); - } + 0 => Create(CryptoKeyTypeEnum.KEY_TYPE_ED25519), + 1 => Create(CryptoKeyTypeEnum.KEY_TYPE_PRE_AUTH_TX), + 2 => Create(CryptoKeyTypeEnum.KEY_TYPE_HASH_X), + 3 => Create(CryptoKeyTypeEnum.KEY_TYPE_ED25519_SIGNED_PAYLOAD), + 256 => Create(CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519), + _ => throw new Exception("Unknown enum value: " + value) + }; + } + + public static void Encode(XdrDataOutputStream stream, CryptoKeyType value) + { + stream.WriteInt((int)value.InnerValue); } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Curve25519Public.cs b/stellar-dotnet-sdk-xdr/generated/Curve25519Public.cs index ef74df43..2fa5b5a0 100644 --- a/stellar-dotnet-sdk-xdr/generated/Curve25519Public.cs +++ b/stellar-dotnet-sdk-xdr/generated/Curve25519Public.cs @@ -1,35 +1,32 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct Curve25519Public +// { +// opaque key[32]; +// }; - // struct Curve25519Public - // { - // opaque key[32]; - // }; +// =========================================================================== +public class Curve25519Public +{ + public byte[] Key { get; set; } - // =========================================================================== - public class Curve25519Public + public static void Encode(XdrDataOutputStream stream, Curve25519Public encodedCurve25519Public) { - public Curve25519Public() { } - public byte[] Key { get; set; } + var keysize = encodedCurve25519Public.Key.Length; + stream.Write(encodedCurve25519Public.Key, 0, keysize); + } - public static void Encode(XdrDataOutputStream stream, Curve25519Public encodedCurve25519Public) - { - int keysize = encodedCurve25519Public.Key.Length; - stream.Write(encodedCurve25519Public.Key, 0, keysize); - } - public static Curve25519Public Decode(XdrDataInputStream stream) - { - Curve25519Public decodedCurve25519Public = new Curve25519Public(); - int keysize = 32; - decodedCurve25519Public.Key = new byte[keysize]; - stream.Read(decodedCurve25519Public.Key, 0, keysize); - return decodedCurve25519Public; - } + public static Curve25519Public Decode(XdrDataInputStream stream) + { + var decodedCurve25519Public = new Curve25519Public(); + var keysize = 32; + decodedCurve25519Public.Key = new byte[keysize]; + stream.Read(decodedCurve25519Public.Key, 0, keysize); + return decodedCurve25519Public; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Curve25519Secret.cs b/stellar-dotnet-sdk-xdr/generated/Curve25519Secret.cs index 5d1c3345..3ee1d0d5 100644 --- a/stellar-dotnet-sdk-xdr/generated/Curve25519Secret.cs +++ b/stellar-dotnet-sdk-xdr/generated/Curve25519Secret.cs @@ -1,35 +1,32 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct Curve25519Secret +// { +// opaque key[32]; +// }; - // struct Curve25519Secret - // { - // opaque key[32]; - // }; +// =========================================================================== +public class Curve25519Secret +{ + public byte[] Key { get; set; } - // =========================================================================== - public class Curve25519Secret + public static void Encode(XdrDataOutputStream stream, Curve25519Secret encodedCurve25519Secret) { - public Curve25519Secret() { } - public byte[] Key { get; set; } + var keysize = encodedCurve25519Secret.Key.Length; + stream.Write(encodedCurve25519Secret.Key, 0, keysize); + } - public static void Encode(XdrDataOutputStream stream, Curve25519Secret encodedCurve25519Secret) - { - int keysize = encodedCurve25519Secret.Key.Length; - stream.Write(encodedCurve25519Secret.Key, 0, keysize); - } - public static Curve25519Secret Decode(XdrDataInputStream stream) - { - Curve25519Secret decodedCurve25519Secret = new Curve25519Secret(); - int keysize = 32; - decodedCurve25519Secret.Key = new byte[keysize]; - stream.Read(decodedCurve25519Secret.Key, 0, keysize); - return decodedCurve25519Secret; - } + public static Curve25519Secret Decode(XdrDataInputStream stream) + { + var decodedCurve25519Secret = new Curve25519Secret(); + var keysize = 32; + decodedCurve25519Secret.Key = new byte[keysize]; + stream.Read(decodedCurve25519Secret.Key, 0, keysize); + return decodedCurve25519Secret; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/DataEntry.cs b/stellar-dotnet-sdk-xdr/generated/DataEntry.cs index 9b43481d..2a28dc28 100644 --- a/stellar-dotnet-sdk-xdr/generated/DataEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/DataEntry.cs @@ -1,81 +1,77 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct DataEntry +// { +// AccountID accountID; // account this data belongs to +// string64 dataName; +// DataValue dataValue; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; + +// =========================================================================== +public class DataEntry { + public AccountID AccountID { get; set; } + public String64 DataName { get; set; } + public DataValue DataValue { get; set; } + public DataEntryExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, DataEntry encodedDataEntry) + { + AccountID.Encode(stream, encodedDataEntry.AccountID); + String64.Encode(stream, encodedDataEntry.DataName); + DataValue.Encode(stream, encodedDataEntry.DataValue); + DataEntryExt.Encode(stream, encodedDataEntry.Ext); + } - // struct DataEntry - // { - // AccountID accountID; // account this data belongs to - // string64 dataName; - // DataValue dataValue; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static DataEntry Decode(XdrDataInputStream stream) + { + var decodedDataEntry = new DataEntry(); + decodedDataEntry.AccountID = AccountID.Decode(stream); + decodedDataEntry.DataName = String64.Decode(stream); + decodedDataEntry.DataValue = DataValue.Decode(stream); + decodedDataEntry.Ext = DataEntryExt.Decode(stream); + return decodedDataEntry; + } - // =========================================================================== - public class DataEntry + public class DataEntryExt { - public DataEntry() { } - public AccountID AccountID { get; set; } - public String64 DataName { get; set; } - public DataValue DataValue { get; set; } - public DataEntryExt Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, DataEntry encodedDataEntry) + public static void Encode(XdrDataOutputStream stream, DataEntryExt encodedDataEntryExt) { - AccountID.Encode(stream, encodedDataEntry.AccountID); - String64.Encode(stream, encodedDataEntry.DataName); - DataValue.Encode(stream, encodedDataEntry.DataValue); - DataEntryExt.Encode(stream, encodedDataEntry.Ext); - } - public static DataEntry Decode(XdrDataInputStream stream) - { - DataEntry decodedDataEntry = new DataEntry(); - decodedDataEntry.AccountID = AccountID.Decode(stream); - decodedDataEntry.DataName = String64.Decode(stream); - decodedDataEntry.DataValue = DataValue.Decode(stream); - decodedDataEntry.Ext = DataEntryExt.Decode(stream); - return decodedDataEntry; + stream.WriteInt(encodedDataEntryExt.Discriminant); + switch (encodedDataEntryExt.Discriminant) + { + case 0: + break; + } } - public class DataEntryExt + public static DataEntryExt Decode(XdrDataInputStream stream) { - public DataEntryExt() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, DataEntryExt encodedDataEntryExt) - { - stream.WriteInt((int)encodedDataEntryExt.Discriminant); - switch (encodedDataEntryExt.Discriminant) - { - case 0: - break; - } - } - public static DataEntryExt Decode(XdrDataInputStream stream) + var decodedDataEntryExt = new DataEntryExt(); + var discriminant = stream.ReadInt(); + decodedDataEntryExt.Discriminant = discriminant; + switch (decodedDataEntryExt.Discriminant) { - DataEntryExt decodedDataEntryExt = new DataEntryExt(); - int discriminant = stream.ReadInt(); - decodedDataEntryExt.Discriminant = discriminant; - switch (decodedDataEntryExt.Discriminant) - { - case 0: - break; - } - return decodedDataEntryExt; + case 0: + break; } + return decodedDataEntryExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/DataValue.cs b/stellar-dotnet-sdk-xdr/generated/DataValue.cs index f37be27d..4066f99e 100644 --- a/stellar-dotnet-sdk-xdr/generated/DataValue.cs +++ b/stellar-dotnet-sdk-xdr/generated/DataValue.cs @@ -1,39 +1,39 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque DataValue<64>; + +// =========================================================================== +public class DataValue { + public DataValue() + { + } - // === xdr source ============================================================ + public DataValue(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque DataValue<64>; + public static void Encode(XdrDataOutputStream stream, DataValue encodedDataValue) + { + var DataValuesize = encodedDataValue.InnerValue.Length; + stream.WriteInt(DataValuesize); + stream.Write(encodedDataValue.InnerValue, 0, DataValuesize); + } - // =========================================================================== - public class DataValue + public static DataValue Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public DataValue() { } - - public DataValue(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, DataValue encodedDataValue) - { - int DataValuesize = encodedDataValue.InnerValue.Length; - stream.WriteInt(DataValuesize); - stream.Write(encodedDataValue.InnerValue, 0, DataValuesize); - } - public static DataValue Decode(XdrDataInputStream stream) - { - DataValue decodedDataValue = new DataValue(); - int DataValuesize = stream.ReadInt(); - decodedDataValue.InnerValue = new byte[DataValuesize]; - stream.Read(decodedDataValue.InnerValue, 0, DataValuesize); - return decodedDataValue; - } + var decodedDataValue = new DataValue(); + var DataValuesize = stream.ReadInt(); + decodedDataValue.InnerValue = new byte[DataValuesize]; + stream.Read(decodedDataValue.InnerValue, 0, DataValuesize); + return decodedDataValue; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/DecoratedSignature.cs b/stellar-dotnet-sdk-xdr/generated/DecoratedSignature.cs index b312b343..5f88683f 100644 --- a/stellar-dotnet-sdk-xdr/generated/DecoratedSignature.cs +++ b/stellar-dotnet-sdk-xdr/generated/DecoratedSignature.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct DecoratedSignature +// { +// SignatureHint hint; // last 4 bytes of the public key, used as a hint +// Signature signature; // actual signature +// }; - // struct DecoratedSignature - // { - // SignatureHint hint; // last 4 bytes of the public key, used as a hint - // Signature signature; // actual signature - // }; +// =========================================================================== +public class DecoratedSignature +{ + public SignatureHint Hint { get; set; } + public Signature Signature { get; set; } - // =========================================================================== - public class DecoratedSignature + public static void Encode(XdrDataOutputStream stream, DecoratedSignature encodedDecoratedSignature) { - public DecoratedSignature() { } - public SignatureHint Hint { get; set; } - public Signature Signature { get; set; } + SignatureHint.Encode(stream, encodedDecoratedSignature.Hint); + Signature.Encode(stream, encodedDecoratedSignature.Signature); + } - public static void Encode(XdrDataOutputStream stream, DecoratedSignature encodedDecoratedSignature) - { - SignatureHint.Encode(stream, encodedDecoratedSignature.Hint); - Signature.Encode(stream, encodedDecoratedSignature.Signature); - } - public static DecoratedSignature Decode(XdrDataInputStream stream) - { - DecoratedSignature decodedDecoratedSignature = new DecoratedSignature(); - decodedDecoratedSignature.Hint = SignatureHint.Decode(stream); - decodedDecoratedSignature.Signature = Signature.Decode(stream); - return decodedDecoratedSignature; - } + public static DecoratedSignature Decode(XdrDataInputStream stream) + { + var decodedDecoratedSignature = new DecoratedSignature(); + decodedDecoratedSignature.Hint = SignatureHint.Decode(stream); + decodedDecoratedSignature.Signature = Signature.Decode(stream); + return decodedDecoratedSignature; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/DiagnosticEvent.cs b/stellar-dotnet-sdk-xdr/generated/DiagnosticEvent.cs new file mode 100644 index 00000000..374c8314 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/DiagnosticEvent.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct DiagnosticEvent +// { +// bool inSuccessfulContractCall; +// ContractEvent event; +// }; + +// =========================================================================== +public class DiagnosticEvent +{ + public bool InSuccessfulContractCall { get; set; } + public ContractEvent Event { get; set; } + + public static void Encode(XdrDataOutputStream stream, DiagnosticEvent encodedDiagnosticEvent) + { + stream.WriteInt(encodedDiagnosticEvent.InSuccessfulContractCall ? 1 : 0); + ContractEvent.Encode(stream, encodedDiagnosticEvent.Event); + } + + public static DiagnosticEvent Decode(XdrDataInputStream stream) + { + var decodedDiagnosticEvent = new DiagnosticEvent(); + decodedDiagnosticEvent.InSuccessfulContractCall = stream.ReadInt() == 1 ? true : false; + decodedDiagnosticEvent.Event = ContractEvent.Decode(stream); + return decodedDiagnosticEvent; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/DontHave.cs b/stellar-dotnet-sdk-xdr/generated/DontHave.cs index 9e32bf8f..fd04e372 100644 --- a/stellar-dotnet-sdk-xdr/generated/DontHave.cs +++ b/stellar-dotnet-sdk-xdr/generated/DontHave.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct DontHave +// { +// MessageType type; +// uint256 reqHash; +// }; - // struct DontHave - // { - // MessageType type; - // uint256 reqHash; - // }; +// =========================================================================== +public class DontHave +{ + public MessageType Type { get; set; } + public Uint256 ReqHash { get; set; } - // =========================================================================== - public class DontHave + public static void Encode(XdrDataOutputStream stream, DontHave encodedDontHave) { - public DontHave() { } - public MessageType Type { get; set; } - public Uint256 ReqHash { get; set; } + MessageType.Encode(stream, encodedDontHave.Type); + Uint256.Encode(stream, encodedDontHave.ReqHash); + } - public static void Encode(XdrDataOutputStream stream, DontHave encodedDontHave) - { - MessageType.Encode(stream, encodedDontHave.Type); - Uint256.Encode(stream, encodedDontHave.ReqHash); - } - public static DontHave Decode(XdrDataInputStream stream) - { - DontHave decodedDontHave = new DontHave(); - decodedDontHave.Type = MessageType.Decode(stream); - decodedDontHave.ReqHash = Uint256.Decode(stream); - return decodedDontHave; - } + public static DontHave Decode(XdrDataInputStream stream) + { + var decodedDontHave = new DontHave(); + decodedDontHave.Type = MessageType.Decode(stream); + decodedDontHave.ReqHash = Uint256.Decode(stream); + return decodedDontHave; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Duration.cs b/stellar-dotnet-sdk-xdr/generated/Duration.cs index 3757c51c..300dccc3 100644 --- a/stellar-dotnet-sdk-xdr/generated/Duration.cs +++ b/stellar-dotnet-sdk-xdr/generated/Duration.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef uint64 Duration; + +// =========================================================================== +public class Duration { + public Duration() + { + } - // === xdr source ============================================================ + public Duration(Uint64 value) + { + InnerValue = value; + } + + public Uint64 InnerValue { get; set; } = default; - // typedef uint64 Duration; + public static void Encode(XdrDataOutputStream stream, Duration encodedDuration) + { + Uint64.Encode(stream, encodedDuration.InnerValue); + } - // =========================================================================== - public class Duration + public static Duration Decode(XdrDataInputStream stream) { - public Uint64 InnerValue { get; set; } = default(Uint64); - - public Duration() { } - - public Duration(Uint64 value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Duration encodedDuration) - { - Uint64.Encode(stream, encodedDuration.InnerValue); - } - public static Duration Decode(XdrDataInputStream stream) - { - Duration decodedDuration = new Duration(); - decodedDuration.InnerValue = Uint64.Decode(stream); - return decodedDuration; - } + var decodedDuration = new Duration(); + decodedDuration.InnerValue = Uint64.Decode(stream); + return decodedDuration; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/EncryptedBody.cs b/stellar-dotnet-sdk-xdr/generated/EncryptedBody.cs index 07ed2d52..d545c308 100644 --- a/stellar-dotnet-sdk-xdr/generated/EncryptedBody.cs +++ b/stellar-dotnet-sdk-xdr/generated/EncryptedBody.cs @@ -1,39 +1,39 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque EncryptedBody<64000>; + +// =========================================================================== +public class EncryptedBody { + public EncryptedBody() + { + } - // === xdr source ============================================================ + public EncryptedBody(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque EncryptedBody<64000>; + public static void Encode(XdrDataOutputStream stream, EncryptedBody encodedEncryptedBody) + { + var EncryptedBodysize = encodedEncryptedBody.InnerValue.Length; + stream.WriteInt(EncryptedBodysize); + stream.Write(encodedEncryptedBody.InnerValue, 0, EncryptedBodysize); + } - // =========================================================================== - public class EncryptedBody + public static EncryptedBody Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public EncryptedBody() { } - - public EncryptedBody(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, EncryptedBody encodedEncryptedBody) - { - int EncryptedBodysize = encodedEncryptedBody.InnerValue.Length; - stream.WriteInt(EncryptedBodysize); - stream.Write(encodedEncryptedBody.InnerValue, 0, EncryptedBodysize); - } - public static EncryptedBody Decode(XdrDataInputStream stream) - { - EncryptedBody decodedEncryptedBody = new EncryptedBody(); - int EncryptedBodysize = stream.ReadInt(); - decodedEncryptedBody.InnerValue = new byte[EncryptedBodysize]; - stream.Read(decodedEncryptedBody.InnerValue, 0, EncryptedBodysize); - return decodedEncryptedBody; - } + var decodedEncryptedBody = new EncryptedBody(); + var EncryptedBodysize = stream.ReadInt(); + decodedEncryptedBody.InnerValue = new byte[EncryptedBodysize]; + stream.Read(decodedEncryptedBody.InnerValue, 0, EncryptedBodysize); + return decodedEncryptedBody; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/EndSponsoringFutureReservesResult.cs b/stellar-dotnet-sdk-xdr/generated/EndSponsoringFutureReservesResult.cs index 3cea9ba1..fc2ae701 100644 --- a/stellar-dotnet-sdk-xdr/generated/EndSponsoringFutureReservesResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/EndSponsoringFutureReservesResult.cs @@ -1,52 +1,54 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union EndSponsoringFutureReservesResult switch ( - // EndSponsoringFutureReservesResultCode code) - // { - // case END_SPONSORING_FUTURE_RESERVES_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class EndSponsoringFutureReservesResult - { - public EndSponsoringFutureReservesResult() { } +// union EndSponsoringFutureReservesResult switch ( +// EndSponsoringFutureReservesResultCode code) +// { +// case END_SPONSORING_FUTURE_RESERVES_SUCCESS: +// void; +// case END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED: +// void; +// }; - public EndSponsoringFutureReservesResultCode Discriminant { get; set; } = new EndSponsoringFutureReservesResultCode(); +// =========================================================================== +public class EndSponsoringFutureReservesResult +{ + public EndSponsoringFutureReservesResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, EndSponsoringFutureReservesResult encodedEndSponsoringFutureReservesResult) + public static void Encode(XdrDataOutputStream stream, + EndSponsoringFutureReservesResult encodedEndSponsoringFutureReservesResult) + { + stream.WriteInt((int)encodedEndSponsoringFutureReservesResult.Discriminant.InnerValue); + switch (encodedEndSponsoringFutureReservesResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedEndSponsoringFutureReservesResult.Discriminant.InnerValue); - switch (encodedEndSponsoringFutureReservesResult.Discriminant.InnerValue) - { - case EndSponsoringFutureReservesResultCode.EndSponsoringFutureReservesResultCodeEnum.END_SPONSORING_FUTURE_RESERVES_SUCCESS: - break; - default: - break; - } + case EndSponsoringFutureReservesResultCode.EndSponsoringFutureReservesResultCodeEnum + .END_SPONSORING_FUTURE_RESERVES_SUCCESS: + break; + case EndSponsoringFutureReservesResultCode.EndSponsoringFutureReservesResultCodeEnum + .END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED: + break; } - public static EndSponsoringFutureReservesResult Decode(XdrDataInputStream stream) + } + + public static EndSponsoringFutureReservesResult Decode(XdrDataInputStream stream) + { + var decodedEndSponsoringFutureReservesResult = new EndSponsoringFutureReservesResult(); + var discriminant = EndSponsoringFutureReservesResultCode.Decode(stream); + decodedEndSponsoringFutureReservesResult.Discriminant = discriminant; + switch (decodedEndSponsoringFutureReservesResult.Discriminant.InnerValue) { - EndSponsoringFutureReservesResult decodedEndSponsoringFutureReservesResult = new EndSponsoringFutureReservesResult(); - EndSponsoringFutureReservesResultCode discriminant = EndSponsoringFutureReservesResultCode.Decode(stream); - decodedEndSponsoringFutureReservesResult.Discriminant = discriminant; - switch (decodedEndSponsoringFutureReservesResult.Discriminant.InnerValue) - { - case EndSponsoringFutureReservesResultCode.EndSponsoringFutureReservesResultCodeEnum.END_SPONSORING_FUTURE_RESERVES_SUCCESS: - break; - default: - break; - } - return decodedEndSponsoringFutureReservesResult; + case EndSponsoringFutureReservesResultCode.EndSponsoringFutureReservesResultCodeEnum + .END_SPONSORING_FUTURE_RESERVES_SUCCESS: + break; + case EndSponsoringFutureReservesResultCode.EndSponsoringFutureReservesResultCodeEnum + .END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED: + break; } + + return decodedEndSponsoringFutureReservesResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/EndSponsoringFutureReservesResultCode.cs b/stellar-dotnet-sdk-xdr/generated/EndSponsoringFutureReservesResultCode.cs index f0f7c041..3b3f7c4c 100644 --- a/stellar-dotnet-sdk-xdr/generated/EndSponsoringFutureReservesResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/EndSponsoringFutureReservesResultCode.cs @@ -1,54 +1,55 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum EndSponsoringFutureReservesResultCode - // { - // // 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 - // }; +// enum EndSponsoringFutureReservesResultCode +// { +// // 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 +// }; - // =========================================================================== - public class EndSponsoringFutureReservesResultCode +// =========================================================================== +public class EndSponsoringFutureReservesResultCode +{ + public enum EndSponsoringFutureReservesResultCodeEnum { - public enum EndSponsoringFutureReservesResultCodeEnum - { - END_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, - END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED = -1, - } - public EndSponsoringFutureReservesResultCodeEnum InnerValue { get; set; } = default(EndSponsoringFutureReservesResultCodeEnum); + END_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, + END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED = -1 + } - public static EndSponsoringFutureReservesResultCode Create(EndSponsoringFutureReservesResultCodeEnum v) - { - return new EndSponsoringFutureReservesResultCode - { - InnerValue = v - }; - } + public EndSponsoringFutureReservesResultCodeEnum InnerValue { get; set; } = default; - public static EndSponsoringFutureReservesResultCode Decode(XdrDataInputStream stream) + public static EndSponsoringFutureReservesResultCode Create(EndSponsoringFutureReservesResultCodeEnum v) + { + return new EndSponsoringFutureReservesResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(EndSponsoringFutureReservesResultCodeEnum.END_SPONSORING_FUTURE_RESERVES_SUCCESS); - case -1: return Create(EndSponsoringFutureReservesResultCodeEnum.END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, EndSponsoringFutureReservesResultCode value) + public static EndSponsoringFutureReservesResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(EndSponsoringFutureReservesResultCodeEnum.END_SPONSORING_FUTURE_RESERVES_SUCCESS); + case -1: + return Create(EndSponsoringFutureReservesResultCodeEnum.END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, EndSponsoringFutureReservesResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/EnvelopeType.cs b/stellar-dotnet-sdk-xdr/generated/EnvelopeType.cs index 46e40ec2..0a52f3a9 100644 --- a/stellar-dotnet-sdk-xdr/generated/EnvelopeType.cs +++ b/stellar-dotnet-sdk-xdr/generated/EnvelopeType.cs @@ -1,69 +1,75 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum EnvelopeType - // { - // ENVELOPE_TYPE_TX_V0 = 0, - // ENVELOPE_TYPE_SCP = 1, - // ENVELOPE_TYPE_TX = 2, - // ENVELOPE_TYPE_AUTH = 3, - // ENVELOPE_TYPE_SCPVALUE = 4, - // ENVELOPE_TYPE_TX_FEE_BUMP = 5, - // ENVELOPE_TYPE_OP_ID = 6, - // ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7 - // }; +// enum EnvelopeType +// { +// ENVELOPE_TYPE_TX_V0 = 0, +// ENVELOPE_TYPE_SCP = 1, +// ENVELOPE_TYPE_TX = 2, +// ENVELOPE_TYPE_AUTH = 3, +// ENVELOPE_TYPE_SCPVALUE = 4, +// ENVELOPE_TYPE_TX_FEE_BUMP = 5, +// ENVELOPE_TYPE_OP_ID = 6, +// ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7, +// ENVELOPE_TYPE_CONTRACT_ID = 8, +// ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9 +// }; - // =========================================================================== - public class EnvelopeType +// =========================================================================== +public class EnvelopeType +{ + public enum EnvelopeTypeEnum { - public enum EnvelopeTypeEnum - { - ENVELOPE_TYPE_TX_V0 = 0, - ENVELOPE_TYPE_SCP = 1, - ENVELOPE_TYPE_TX = 2, - ENVELOPE_TYPE_AUTH = 3, - ENVELOPE_TYPE_SCPVALUE = 4, - ENVELOPE_TYPE_TX_FEE_BUMP = 5, - ENVELOPE_TYPE_OP_ID = 6, - ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7, - } - public EnvelopeTypeEnum InnerValue { get; set; } = default(EnvelopeTypeEnum); + ENVELOPE_TYPE_TX_V0 = 0, + ENVELOPE_TYPE_SCP = 1, + ENVELOPE_TYPE_TX = 2, + ENVELOPE_TYPE_AUTH = 3, + ENVELOPE_TYPE_SCPVALUE = 4, + ENVELOPE_TYPE_TX_FEE_BUMP = 5, + ENVELOPE_TYPE_OP_ID = 6, + ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7, + ENVELOPE_TYPE_CONTRACT_ID = 8, + ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9 + } - public static EnvelopeType Create(EnvelopeTypeEnum v) - { - return new EnvelopeType - { - InnerValue = v - }; - } + public EnvelopeTypeEnum InnerValue { get; set; } = default; - public static EnvelopeType Decode(XdrDataInputStream stream) + public static EnvelopeType Create(EnvelopeTypeEnum v) + { + return new EnvelopeType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_TX_V0); - case 1: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_SCP); - case 2: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_TX); - case 3: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_AUTH); - case 4: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_SCPVALUE); - case 5: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP); - case 6: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_OP_ID); - case 7: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_POOL_REVOKE_OP_ID); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, EnvelopeType value) + public static EnvelopeType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_TX_V0); + case 1: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_SCP); + case 2: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_TX); + case 3: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_AUTH); + case 4: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_SCPVALUE); + case 5: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP); + case 6: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_OP_ID); + case 7: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_POOL_REVOKE_OP_ID); + case 8: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_CONTRACT_ID); + case 9: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_SOROBAN_AUTHORIZATION); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, EnvelopeType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Error.cs b/stellar-dotnet-sdk-xdr/generated/Error.cs index 2dc0fde4..243c1b50 100644 --- a/stellar-dotnet-sdk-xdr/generated/Error.cs +++ b/stellar-dotnet-sdk-xdr/generated/Error.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct Error +// { +// ErrorCode code; +// string msg<100>; +// }; - // struct Error - // { - // ErrorCode code; - // string msg<100>; - // }; +// =========================================================================== +public class Error +{ + public ErrorCode Code { get; set; } + public string Msg { get; set; } - // =========================================================================== - public class Error + public static void Encode(XdrDataOutputStream stream, Error encodedError) { - public Error() { } - public ErrorCode Code { get; set; } - public String Msg { get; set; } + ErrorCode.Encode(stream, encodedError.Code); + stream.WriteString(encodedError.Msg); + } - public static void Encode(XdrDataOutputStream stream, Error encodedError) - { - ErrorCode.Encode(stream, encodedError.Code); - stream.WriteString(encodedError.Msg); - } - public static Error Decode(XdrDataInputStream stream) - { - Error decodedError = new Error(); - decodedError.Code = ErrorCode.Decode(stream); - decodedError.Msg = stream.ReadString(); - return decodedError; - } + public static Error Decode(XdrDataInputStream stream) + { + var decodedError = new Error(); + decodedError.Code = ErrorCode.Decode(stream); + decodedError.Msg = stream.ReadString(); + return decodedError; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ErrorCode.cs b/stellar-dotnet-sdk-xdr/generated/ErrorCode.cs index 692898db..9a8f5ba7 100644 --- a/stellar-dotnet-sdk-xdr/generated/ErrorCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/ErrorCode.cs @@ -1,60 +1,60 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ErrorCode - // { - // ERR_MISC = 0, // Unspecific error - // ERR_DATA = 1, // Malformed data - // ERR_CONF = 2, // Misconfiguration error - // ERR_AUTH = 3, // Authentication failure - // ERR_LOAD = 4 // System overloaded - // }; +// enum ErrorCode +// { +// ERR_MISC = 0, // Unspecific error +// ERR_DATA = 1, // Malformed data +// ERR_CONF = 2, // Misconfiguration error +// ERR_AUTH = 3, // Authentication failure +// ERR_LOAD = 4 // System overloaded +// }; - // =========================================================================== - public class ErrorCode +// =========================================================================== +public class ErrorCode +{ + public enum ErrorCodeEnum { - public enum ErrorCodeEnum - { - ERR_MISC = 0, - ERR_DATA = 1, - ERR_CONF = 2, - ERR_AUTH = 3, - ERR_LOAD = 4, - } - public ErrorCodeEnum InnerValue { get; set; } = default(ErrorCodeEnum); + ERR_MISC = 0, + ERR_DATA = 1, + ERR_CONF = 2, + ERR_AUTH = 3, + ERR_LOAD = 4 + } - public static ErrorCode Create(ErrorCodeEnum v) - { - return new ErrorCode - { - InnerValue = v - }; - } + public ErrorCodeEnum InnerValue { get; set; } = default; - public static ErrorCode Decode(XdrDataInputStream stream) + public static ErrorCode Create(ErrorCodeEnum v) + { + return new ErrorCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ErrorCodeEnum.ERR_MISC); - case 1: return Create(ErrorCodeEnum.ERR_DATA); - case 2: return Create(ErrorCodeEnum.ERR_CONF); - case 3: return Create(ErrorCodeEnum.ERR_AUTH); - case 4: return Create(ErrorCodeEnum.ERR_LOAD); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ErrorCode value) + public static ErrorCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ErrorCodeEnum.ERR_MISC); + case 1: return Create(ErrorCodeEnum.ERR_DATA); + case 2: return Create(ErrorCodeEnum.ERR_CONF); + case 3: return Create(ErrorCodeEnum.ERR_AUTH); + case 4: return Create(ErrorCodeEnum.ERR_LOAD); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ErrorCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/EvictionIterator.cs b/stellar-dotnet-sdk-xdr/generated/EvictionIterator.cs new file mode 100644 index 00000000..1bf589e8 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/EvictionIterator.cs @@ -0,0 +1,36 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct EvictionIterator { +// uint32 bucketListLevel; +// bool isCurrBucket; +// uint64 bucketFileOffset; +// }; + +// =========================================================================== +public class EvictionIterator +{ + public Uint32 BucketListLevel { get; set; } + public bool IsCurrBucket { get; set; } + public Uint64 BucketFileOffset { get; set; } + + public static void Encode(XdrDataOutputStream stream, EvictionIterator encodedEvictionIterator) + { + Uint32.Encode(stream, encodedEvictionIterator.BucketListLevel); + stream.WriteInt(encodedEvictionIterator.IsCurrBucket ? 1 : 0); + Uint64.Encode(stream, encodedEvictionIterator.BucketFileOffset); + } + + public static EvictionIterator Decode(XdrDataInputStream stream) + { + var decodedEvictionIterator = new EvictionIterator(); + decodedEvictionIterator.BucketListLevel = Uint32.Decode(stream); + decodedEvictionIterator.IsCurrBucket = stream.ReadInt() == 1 ? true : false; + decodedEvictionIterator.BucketFileOffset = Uint64.Decode(stream); + return decodedEvictionIterator; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLOp.cs b/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLOp.cs new file mode 100644 index 00000000..1d81464e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLOp.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ExtendFootprintTTLOp +// { +// ExtensionPoint ext; +// uint32 extendTo; +// }; + +// =========================================================================== +public class ExtendFootprintTTLOp +{ + public ExtensionPoint Ext { get; set; } + public Uint32 ExtendTo { get; set; } + + public static void Encode(XdrDataOutputStream stream, ExtendFootprintTTLOp encodedExtendFootprintTTLOp) + { + ExtensionPoint.Encode(stream, encodedExtendFootprintTTLOp.Ext); + Uint32.Encode(stream, encodedExtendFootprintTTLOp.ExtendTo); + } + + public static ExtendFootprintTTLOp Decode(XdrDataInputStream stream) + { + var decodedExtendFootprintTTLOp = new ExtendFootprintTTLOp(); + decodedExtendFootprintTTLOp.Ext = ExtensionPoint.Decode(stream); + decodedExtendFootprintTTLOp.ExtendTo = Uint32.Decode(stream); + return decodedExtendFootprintTTLOp; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLResult.cs b/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLResult.cs new file mode 100644 index 00000000..44d8a056 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLResult.cs @@ -0,0 +1,58 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code) +// { +// case EXTEND_FOOTPRINT_TTL_SUCCESS: +// void; +// case EXTEND_FOOTPRINT_TTL_MALFORMED: +// case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: +// case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: +// void; +// }; + +// =========================================================================== +public class ExtendFootprintTTLResult +{ + public ExtendFootprintTTLResultCode Discriminant { get; set; } = new(); + + public static void Encode(XdrDataOutputStream stream, ExtendFootprintTTLResult encodedExtendFootprintTTLResult) + { + stream.WriteInt((int)encodedExtendFootprintTTLResult.Discriminant.InnerValue); + switch (encodedExtendFootprintTTLResult.Discriminant.InnerValue) + { + case ExtendFootprintTTLResultCode.ExtendFootprintTTLResultCodeEnum.EXTEND_FOOTPRINT_TTL_SUCCESS: + break; + case ExtendFootprintTTLResultCode.ExtendFootprintTTLResultCodeEnum.EXTEND_FOOTPRINT_TTL_MALFORMED: + case ExtendFootprintTTLResultCode.ExtendFootprintTTLResultCodeEnum + .EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: + case ExtendFootprintTTLResultCode.ExtendFootprintTTLResultCodeEnum + .EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: + break; + } + } + + public static ExtendFootprintTTLResult Decode(XdrDataInputStream stream) + { + var decodedExtendFootprintTTLResult = new ExtendFootprintTTLResult(); + var discriminant = ExtendFootprintTTLResultCode.Decode(stream); + decodedExtendFootprintTTLResult.Discriminant = discriminant; + switch (decodedExtendFootprintTTLResult.Discriminant.InnerValue) + { + case ExtendFootprintTTLResultCode.ExtendFootprintTTLResultCodeEnum.EXTEND_FOOTPRINT_TTL_SUCCESS: + break; + case ExtendFootprintTTLResultCode.ExtendFootprintTTLResultCodeEnum.EXTEND_FOOTPRINT_TTL_MALFORMED: + case ExtendFootprintTTLResultCode.ExtendFootprintTTLResultCodeEnum + .EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: + case ExtendFootprintTTLResultCode.ExtendFootprintTTLResultCodeEnum + .EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: + break; + } + + return decodedExtendFootprintTTLResult; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLResultCode.cs b/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLResultCode.cs new file mode 100644 index 00000000..2381ffdd --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/ExtendFootprintTTLResultCode.cs @@ -0,0 +1,60 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum ExtendFootprintTTLResultCode +// { +// // 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, +// EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 +// }; + +// =========================================================================== +public class ExtendFootprintTTLResultCode +{ + public enum ExtendFootprintTTLResultCodeEnum + { + EXTEND_FOOTPRINT_TTL_SUCCESS = 0, + EXTEND_FOOTPRINT_TTL_MALFORMED = -1, + EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, + EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 + } + + public ExtendFootprintTTLResultCodeEnum InnerValue { get; set; } = default; + + public static ExtendFootprintTTLResultCode Create(ExtendFootprintTTLResultCodeEnum v) + { + return new ExtendFootprintTTLResultCode + { + InnerValue = v + }; + } + + public static ExtendFootprintTTLResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(ExtendFootprintTTLResultCodeEnum.EXTEND_FOOTPRINT_TTL_SUCCESS); + case -1: return Create(ExtendFootprintTTLResultCodeEnum.EXTEND_FOOTPRINT_TTL_MALFORMED); + case -2: return Create(ExtendFootprintTTLResultCodeEnum.EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED); + case -3: return Create(ExtendFootprintTTLResultCodeEnum.EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, ExtendFootprintTTLResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ExtensionPoint.cs b/stellar-dotnet-sdk-xdr/generated/ExtensionPoint.cs index 5d3faac0..a8aa9221 100644 --- a/stellar-dotnet-sdk-xdr/generated/ExtensionPoint.cs +++ b/stellar-dotnet-sdk-xdr/generated/ExtensionPoint.cs @@ -1,45 +1,42 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union ExtensionPoint switch (int v) - // { - // case 0: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class ExtensionPoint - { - public ExtensionPoint() { } +// union ExtensionPoint switch (int v) +// { +// case 0: +// void; +// }; - public int Discriminant { get; set; } = new int(); +// =========================================================================== +public class ExtensionPoint +{ + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, ExtensionPoint encodedExtensionPoint) + public static void Encode(XdrDataOutputStream stream, ExtensionPoint encodedExtensionPoint) + { + stream.WriteInt(encodedExtensionPoint.Discriminant); + switch (encodedExtensionPoint.Discriminant) { - stream.WriteInt((int)encodedExtensionPoint.Discriminant); - switch (encodedExtensionPoint.Discriminant) - { - case 0: - break; - } + case 0: + break; } - public static ExtensionPoint Decode(XdrDataInputStream stream) + } + + public static ExtensionPoint Decode(XdrDataInputStream stream) + { + var decodedExtensionPoint = new ExtensionPoint(); + var discriminant = stream.ReadInt(); + decodedExtensionPoint.Discriminant = discriminant; + switch (decodedExtensionPoint.Discriminant) { - ExtensionPoint decodedExtensionPoint = new ExtensionPoint(); - int discriminant = stream.ReadInt(); - decodedExtensionPoint.Discriminant = discriminant; - switch (decodedExtensionPoint.Discriminant) - { - case 0: - break; - } - return decodedExtensionPoint; + case 0: + break; } + + return decodedExtensionPoint; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/FeeBumpTransaction.cs b/stellar-dotnet-sdk-xdr/generated/FeeBumpTransaction.cs index 0b1542b0..b5f06f7d 100644 --- a/stellar-dotnet-sdk-xdr/generated/FeeBumpTransaction.cs +++ b/stellar-dotnet-sdk-xdr/generated/FeeBumpTransaction.cs @@ -1,116 +1,114 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct FeeBumpTransaction +// { +// MuxedAccount feeSource; +// int64 fee; +// union switch (EnvelopeType type) +// { +// case ENVELOPE_TYPE_TX: +// TransactionV1Envelope v1; +// } +// innerTx; +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; - // struct FeeBumpTransaction - // { - // MuxedAccount feeSource; - // int64 fee; - // union switch (EnvelopeType type) - // { - // case ENVELOPE_TYPE_TX: - // TransactionV1Envelope v1; - // } - // innerTx; - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; +// =========================================================================== +public class FeeBumpTransaction +{ + public MuxedAccount FeeSource { get; set; } + public Int64 Fee { get; set; } + public FeeBumpTransactionInnerTx InnerTx { get; set; } + public FeeBumpTransactionExt Ext { get; set; } - // =========================================================================== - public class FeeBumpTransaction + public static void Encode(XdrDataOutputStream stream, FeeBumpTransaction encodedFeeBumpTransaction) { - public FeeBumpTransaction() { } - public MuxedAccount FeeSource { get; set; } - public Int64 Fee { get; set; } - public FeeBumpTransactionInnerTx InnerTx { get; set; } - public FeeBumpTransactionExt Ext { get; set; } + MuxedAccount.Encode(stream, encodedFeeBumpTransaction.FeeSource); + Int64.Encode(stream, encodedFeeBumpTransaction.Fee); + FeeBumpTransactionInnerTx.Encode(stream, encodedFeeBumpTransaction.InnerTx); + FeeBumpTransactionExt.Encode(stream, encodedFeeBumpTransaction.Ext); + } - public static void Encode(XdrDataOutputStream stream, FeeBumpTransaction encodedFeeBumpTransaction) - { - MuxedAccount.Encode(stream, encodedFeeBumpTransaction.FeeSource); - Int64.Encode(stream, encodedFeeBumpTransaction.Fee); - FeeBumpTransactionInnerTx.Encode(stream, encodedFeeBumpTransaction.InnerTx); - FeeBumpTransactionExt.Encode(stream, encodedFeeBumpTransaction.Ext); - } - public static FeeBumpTransaction Decode(XdrDataInputStream stream) - { - FeeBumpTransaction decodedFeeBumpTransaction = new FeeBumpTransaction(); - decodedFeeBumpTransaction.FeeSource = MuxedAccount.Decode(stream); - decodedFeeBumpTransaction.Fee = Int64.Decode(stream); - decodedFeeBumpTransaction.InnerTx = FeeBumpTransactionInnerTx.Decode(stream); - decodedFeeBumpTransaction.Ext = FeeBumpTransactionExt.Decode(stream); - return decodedFeeBumpTransaction; - } + public static FeeBumpTransaction Decode(XdrDataInputStream stream) + { + var decodedFeeBumpTransaction = new FeeBumpTransaction(); + decodedFeeBumpTransaction.FeeSource = MuxedAccount.Decode(stream); + decodedFeeBumpTransaction.Fee = Int64.Decode(stream); + decodedFeeBumpTransaction.InnerTx = FeeBumpTransactionInnerTx.Decode(stream); + decodedFeeBumpTransaction.Ext = FeeBumpTransactionExt.Decode(stream); + return decodedFeeBumpTransaction; + } - public class FeeBumpTransactionInnerTx - { - public FeeBumpTransactionInnerTx() { } + public class FeeBumpTransactionInnerTx + { + public EnvelopeType Discriminant { get; set; } = new(); - public EnvelopeType Discriminant { get; set; } = new EnvelopeType(); + public TransactionV1Envelope V1 { get; set; } - public TransactionV1Envelope V1 { get; set; } - public static void Encode(XdrDataOutputStream stream, FeeBumpTransactionInnerTx encodedFeeBumpTransactionInnerTx) + public static void Encode(XdrDataOutputStream stream, + FeeBumpTransactionInnerTx encodedFeeBumpTransactionInnerTx) + { + stream.WriteInt((int)encodedFeeBumpTransactionInnerTx.Discriminant.InnerValue); + switch (encodedFeeBumpTransactionInnerTx.Discriminant.InnerValue) { - stream.WriteInt((int)encodedFeeBumpTransactionInnerTx.Discriminant.InnerValue); - switch (encodedFeeBumpTransactionInnerTx.Discriminant.InnerValue) - { - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: - TransactionV1Envelope.Encode(stream, encodedFeeBumpTransactionInnerTx.V1); - break; - } + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: + TransactionV1Envelope.Encode(stream, encodedFeeBumpTransactionInnerTx.V1); + break; } - public static FeeBumpTransactionInnerTx Decode(XdrDataInputStream stream) + } + + public static FeeBumpTransactionInnerTx Decode(XdrDataInputStream stream) + { + var decodedFeeBumpTransactionInnerTx = new FeeBumpTransactionInnerTx(); + var discriminant = EnvelopeType.Decode(stream); + decodedFeeBumpTransactionInnerTx.Discriminant = discriminant; + switch (decodedFeeBumpTransactionInnerTx.Discriminant.InnerValue) { - FeeBumpTransactionInnerTx decodedFeeBumpTransactionInnerTx = new FeeBumpTransactionInnerTx(); - EnvelopeType discriminant = EnvelopeType.Decode(stream); - decodedFeeBumpTransactionInnerTx.Discriminant = discriminant; - switch (decodedFeeBumpTransactionInnerTx.Discriminant.InnerValue) - { - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: - decodedFeeBumpTransactionInnerTx.V1 = TransactionV1Envelope.Decode(stream); - break; - } - return decodedFeeBumpTransactionInnerTx; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: + decodedFeeBumpTransactionInnerTx.V1 = TransactionV1Envelope.Decode(stream); + break; } + return decodedFeeBumpTransactionInnerTx; } - public class FeeBumpTransactionExt - { - public FeeBumpTransactionExt() { } + } - public int Discriminant { get; set; } = new int(); + public class FeeBumpTransactionExt + { + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, FeeBumpTransactionExt encodedFeeBumpTransactionExt) + public static void Encode(XdrDataOutputStream stream, FeeBumpTransactionExt encodedFeeBumpTransactionExt) + { + stream.WriteInt(encodedFeeBumpTransactionExt.Discriminant); + switch (encodedFeeBumpTransactionExt.Discriminant) { - stream.WriteInt((int)encodedFeeBumpTransactionExt.Discriminant); - switch (encodedFeeBumpTransactionExt.Discriminant) - { - case 0: - break; - } + case 0: + break; } - public static FeeBumpTransactionExt Decode(XdrDataInputStream stream) + } + + public static FeeBumpTransactionExt Decode(XdrDataInputStream stream) + { + var decodedFeeBumpTransactionExt = new FeeBumpTransactionExt(); + var discriminant = stream.ReadInt(); + decodedFeeBumpTransactionExt.Discriminant = discriminant; + switch (decodedFeeBumpTransactionExt.Discriminant) { - FeeBumpTransactionExt decodedFeeBumpTransactionExt = new FeeBumpTransactionExt(); - int discriminant = stream.ReadInt(); - decodedFeeBumpTransactionExt.Discriminant = discriminant; - switch (decodedFeeBumpTransactionExt.Discriminant) - { - case 0: - break; - } - return decodedFeeBumpTransactionExt; + case 0: + break; } + return decodedFeeBumpTransactionExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/FeeBumpTransactionEnvelope.cs b/stellar-dotnet-sdk-xdr/generated/FeeBumpTransactionEnvelope.cs index 3e91f7f2..daab54ca 100644 --- a/stellar-dotnet-sdk-xdr/generated/FeeBumpTransactionEnvelope.cs +++ b/stellar-dotnet-sdk-xdr/generated/FeeBumpTransactionEnvelope.cs @@ -1,48 +1,41 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct FeeBumpTransactionEnvelope +// { +// FeeBumpTransaction tx; +// /* Each decorated signature is a signature over the SHA256 hash of +// * a TransactionSignaturePayload */ +// DecoratedSignature signatures<20>; +// }; - // struct FeeBumpTransactionEnvelope - // { - // FeeBumpTransaction tx; - // /* Each decorated signature is a signature over the SHA256 hash of - // * a TransactionSignaturePayload */ - // DecoratedSignature signatures<20>; - // }; +// =========================================================================== +public class FeeBumpTransactionEnvelope +{ + public FeeBumpTransaction Tx { get; set; } + public DecoratedSignature[] Signatures { get; set; } - // =========================================================================== - public class FeeBumpTransactionEnvelope + public static void Encode(XdrDataOutputStream stream, FeeBumpTransactionEnvelope encodedFeeBumpTransactionEnvelope) { - public FeeBumpTransactionEnvelope() { } - public FeeBumpTransaction Tx { get; set; } - public DecoratedSignature[] Signatures { get; set; } + FeeBumpTransaction.Encode(stream, encodedFeeBumpTransactionEnvelope.Tx); + var signaturessize = encodedFeeBumpTransactionEnvelope.Signatures.Length; + stream.WriteInt(signaturessize); + for (var i = 0; i < signaturessize; i++) + DecoratedSignature.Encode(stream, encodedFeeBumpTransactionEnvelope.Signatures[i]); + } - public static void Encode(XdrDataOutputStream stream, FeeBumpTransactionEnvelope encodedFeeBumpTransactionEnvelope) - { - FeeBumpTransaction.Encode(stream, encodedFeeBumpTransactionEnvelope.Tx); - int signaturessize = encodedFeeBumpTransactionEnvelope.Signatures.Length; - stream.WriteInt(signaturessize); - for (int i = 0; i < signaturessize; i++) - { - DecoratedSignature.Encode(stream, encodedFeeBumpTransactionEnvelope.Signatures[i]); - } - } - public static FeeBumpTransactionEnvelope Decode(XdrDataInputStream stream) - { - FeeBumpTransactionEnvelope decodedFeeBumpTransactionEnvelope = new FeeBumpTransactionEnvelope(); - decodedFeeBumpTransactionEnvelope.Tx = FeeBumpTransaction.Decode(stream); - int signaturessize = stream.ReadInt(); - decodedFeeBumpTransactionEnvelope.Signatures = new DecoratedSignature[signaturessize]; - for (int i = 0; i < signaturessize; i++) - { - decodedFeeBumpTransactionEnvelope.Signatures[i] = DecoratedSignature.Decode(stream); - } - return decodedFeeBumpTransactionEnvelope; - } + public static FeeBumpTransactionEnvelope Decode(XdrDataInputStream stream) + { + var decodedFeeBumpTransactionEnvelope = new FeeBumpTransactionEnvelope(); + decodedFeeBumpTransactionEnvelope.Tx = FeeBumpTransaction.Decode(stream); + var signaturessize = stream.ReadInt(); + decodedFeeBumpTransactionEnvelope.Signatures = new DecoratedSignature[signaturessize]; + for (var i = 0; i < signaturessize; i++) + decodedFeeBumpTransactionEnvelope.Signatures[i] = DecoratedSignature.Decode(stream); + return decodedFeeBumpTransactionEnvelope; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/FloodAdvert.cs b/stellar-dotnet-sdk-xdr/generated/FloodAdvert.cs new file mode 100644 index 00000000..2e6a88d0 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/FloodAdvert.cs @@ -0,0 +1,29 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct FloodAdvert +// { +// TxAdvertVector txHashes; +// }; + +// =========================================================================== +public class FloodAdvert +{ + public TxAdvertVector TxHashes { get; set; } + + public static void Encode(XdrDataOutputStream stream, FloodAdvert encodedFloodAdvert) + { + TxAdvertVector.Encode(stream, encodedFloodAdvert.TxHashes); + } + + public static FloodAdvert Decode(XdrDataInputStream stream) + { + var decodedFloodAdvert = new FloodAdvert(); + decodedFloodAdvert.TxHashes = TxAdvertVector.Decode(stream); + return decodedFloodAdvert; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/FloodDemand.cs b/stellar-dotnet-sdk-xdr/generated/FloodDemand.cs new file mode 100644 index 00000000..45c9d35a --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/FloodDemand.cs @@ -0,0 +1,29 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct FloodDemand +// { +// TxDemandVector txHashes; +// }; + +// =========================================================================== +public class FloodDemand +{ + public TxDemandVector TxHashes { get; set; } + + public static void Encode(XdrDataOutputStream stream, FloodDemand encodedFloodDemand) + { + TxDemandVector.Encode(stream, encodedFloodDemand.TxHashes); + } + + public static FloodDemand Decode(XdrDataInputStream stream) + { + var decodedFloodDemand = new FloodDemand(); + decodedFloodDemand.TxHashes = TxDemandVector.Decode(stream); + return decodedFloodDemand; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/GeneralizedTransactionSet.cs b/stellar-dotnet-sdk-xdr/generated/GeneralizedTransactionSet.cs new file mode 100644 index 00000000..f20a9727 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/GeneralizedTransactionSet.cs @@ -0,0 +1,47 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union GeneralizedTransactionSet switch (int v) +// { +// // We consider the legacy TransactionSet to be v0. +// case 1: +// TransactionSetV1 v1TxSet; +// }; + +// =========================================================================== +public class GeneralizedTransactionSet +{ + public int Discriminant { get; set; } + + public TransactionSetV1 V1TxSet { get; set; } + + public static void Encode(XdrDataOutputStream stream, GeneralizedTransactionSet encodedGeneralizedTransactionSet) + { + stream.WriteInt(encodedGeneralizedTransactionSet.Discriminant); + switch (encodedGeneralizedTransactionSet.Discriminant) + { + case 1: + TransactionSetV1.Encode(stream, encodedGeneralizedTransactionSet.V1TxSet); + break; + } + } + + public static GeneralizedTransactionSet Decode(XdrDataInputStream stream) + { + var decodedGeneralizedTransactionSet = new GeneralizedTransactionSet(); + var discriminant = stream.ReadInt(); + decodedGeneralizedTransactionSet.Discriminant = discriminant; + switch (decodedGeneralizedTransactionSet.Discriminant) + { + case 1: + decodedGeneralizedTransactionSet.V1TxSet = TransactionSetV1.Decode(stream); + break; + } + + return decodedGeneralizedTransactionSet; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Hash.cs b/stellar-dotnet-sdk-xdr/generated/Hash.cs index 425d7b30..45b4d3e5 100644 --- a/stellar-dotnet-sdk-xdr/generated/Hash.cs +++ b/stellar-dotnet-sdk-xdr/generated/Hash.cs @@ -1,38 +1,38 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque Hash[32]; + +// =========================================================================== +public class Hash { + public Hash() + { + } - // === xdr source ============================================================ + public Hash(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque Hash[32]; + public static void Encode(XdrDataOutputStream stream, Hash encodedHash) + { + var Hashsize = encodedHash.InnerValue.Length; + stream.Write(encodedHash.InnerValue, 0, Hashsize); + } - // =========================================================================== - public class Hash + public static Hash Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public Hash() { } - - public Hash(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Hash encodedHash) - { - int Hashsize = encodedHash.InnerValue.Length; - stream.Write(encodedHash.InnerValue, 0, Hashsize); - } - public static Hash Decode(XdrDataInputStream stream) - { - Hash decodedHash = new Hash(); - int Hashsize = 32; - decodedHash.InnerValue = new byte[Hashsize]; - stream.Read(decodedHash.InnerValue, 0, Hashsize); - return decodedHash; - } + var decodedHash = new Hash(); + var Hashsize = 32; + decodedHash.InnerValue = new byte[Hashsize]; + stream.Read(decodedHash.InnerValue, 0, Hashsize); + return decodedHash; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/HashIDPreimage.cs b/stellar-dotnet-sdk-xdr/generated/HashIDPreimage.cs index 8541bf3a..3d4bc4cc 100644 --- a/stellar-dotnet-sdk-xdr/generated/HashIDPreimage.cs +++ b/stellar-dotnet-sdk-xdr/generated/HashIDPreimage.cs @@ -1,122 +1,195 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union HashIDPreimage switch (EnvelopeType type) +// { +// case ENVELOPE_TYPE_OP_ID: +// struct +// { +// AccountID sourceAccount; +// SequenceNumber seqNum; +// uint32 opNum; +// } operationID; +// case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: +// struct +// { +// AccountID sourceAccount; +// SequenceNumber seqNum; +// uint32 opNum; +// PoolID liquidityPoolID; +// Asset asset; +// } revokeID; +// case ENVELOPE_TYPE_CONTRACT_ID: +// struct +// { +// Hash networkID; +// ContractIDPreimage contractIDPreimage; +// } contractID; +// case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: +// struct +// { +// Hash networkID; +// int64 nonce; +// uint32 signatureExpirationLedger; +// SorobanAuthorizedInvocation invocation; +// } sorobanAuthorization; +// }; + +// =========================================================================== +public class HashIDPreimage { + public EnvelopeType Discriminant { get; set; } = new(); + + public HashIDPreimageOperationID OperationID { get; set; } + public HashIDPreimageRevokeID RevokeID { get; set; } + public HashIDPreimageContractID ContractID { get; set; } + public HashIDPreimageSorobanAuthorization SorobanAuthorization { get; set; } + + public static void Encode(XdrDataOutputStream stream, HashIDPreimage encodedHashIDPreimage) + { + stream.WriteInt((int)encodedHashIDPreimage.Discriminant.InnerValue); + switch (encodedHashIDPreimage.Discriminant.InnerValue) + { + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_OP_ID: + HashIDPreimageOperationID.Encode(stream, encodedHashIDPreimage.OperationID); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_POOL_REVOKE_OP_ID: + HashIDPreimageRevokeID.Encode(stream, encodedHashIDPreimage.RevokeID); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_CONTRACT_ID: + HashIDPreimageContractID.Encode(stream, encodedHashIDPreimage.ContractID); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + HashIDPreimageSorobanAuthorization.Encode(stream, encodedHashIDPreimage.SorobanAuthorization); + break; + } + } - // === xdr source ============================================================ - - // union HashIDPreimage switch (EnvelopeType type) - // { - // case ENVELOPE_TYPE_OP_ID: - // struct - // { - // AccountID sourceAccount; - // SequenceNumber seqNum; - // uint32 opNum; - // } operationID; - // case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: - // struct - // { - // AccountID sourceAccount; - // SequenceNumber seqNum; - // uint32 opNum; - // PoolID liquidityPoolID; - // Asset asset; - // } revokeID; - // }; - - // =========================================================================== - public class HashIDPreimage + public static HashIDPreimage Decode(XdrDataInputStream stream) { - public HashIDPreimage() { } + var decodedHashIDPreimage = new HashIDPreimage(); + var discriminant = EnvelopeType.Decode(stream); + decodedHashIDPreimage.Discriminant = discriminant; + switch (decodedHashIDPreimage.Discriminant.InnerValue) + { + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_OP_ID: + decodedHashIDPreimage.OperationID = HashIDPreimageOperationID.Decode(stream); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_POOL_REVOKE_OP_ID: + decodedHashIDPreimage.RevokeID = HashIDPreimageRevokeID.Decode(stream); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_CONTRACT_ID: + decodedHashIDPreimage.ContractID = HashIDPreimageContractID.Decode(stream); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + decodedHashIDPreimage.SorobanAuthorization = HashIDPreimageSorobanAuthorization.Decode(stream); + break; + } - public EnvelopeType Discriminant { get; set; } = new EnvelopeType(); + return decodedHashIDPreimage; + } + + public class HashIDPreimageOperationID + { + public AccountID SourceAccount { get; set; } + public SequenceNumber SeqNum { get; set; } + public Uint32 OpNum { get; set; } - public HashIDPreimageOperationID OperationID { get; set; } - public HashIDPreimageRevokeID RevokeID { get; set; } - public static void Encode(XdrDataOutputStream stream, HashIDPreimage encodedHashIDPreimage) + public static void Encode(XdrDataOutputStream stream, + HashIDPreimageOperationID encodedHashIDPreimageOperationID) { - stream.WriteInt((int)encodedHashIDPreimage.Discriminant.InnerValue); - switch (encodedHashIDPreimage.Discriminant.InnerValue) - { - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_OP_ID: - HashIDPreimageOperationID.Encode(stream, encodedHashIDPreimage.OperationID); - break; - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_POOL_REVOKE_OP_ID: - HashIDPreimageRevokeID.Encode(stream, encodedHashIDPreimage.RevokeID); - break; - } + AccountID.Encode(stream, encodedHashIDPreimageOperationID.SourceAccount); + SequenceNumber.Encode(stream, encodedHashIDPreimageOperationID.SeqNum); + Uint32.Encode(stream, encodedHashIDPreimageOperationID.OpNum); } - public static HashIDPreimage Decode(XdrDataInputStream stream) + + public static HashIDPreimageOperationID Decode(XdrDataInputStream stream) { - HashIDPreimage decodedHashIDPreimage = new HashIDPreimage(); - EnvelopeType discriminant = EnvelopeType.Decode(stream); - decodedHashIDPreimage.Discriminant = discriminant; - switch (decodedHashIDPreimage.Discriminant.InnerValue) - { - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_OP_ID: - decodedHashIDPreimage.OperationID = HashIDPreimageOperationID.Decode(stream); - break; - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_POOL_REVOKE_OP_ID: - decodedHashIDPreimage.RevokeID = HashIDPreimageRevokeID.Decode(stream); - break; - } - return decodedHashIDPreimage; + var decodedHashIDPreimageOperationID = new HashIDPreimageOperationID(); + decodedHashIDPreimageOperationID.SourceAccount = AccountID.Decode(stream); + decodedHashIDPreimageOperationID.SeqNum = SequenceNumber.Decode(stream); + decodedHashIDPreimageOperationID.OpNum = Uint32.Decode(stream); + return decodedHashIDPreimageOperationID; } + } + + public class HashIDPreimageRevokeID + { + public AccountID SourceAccount { get; set; } + public SequenceNumber SeqNum { get; set; } + public Uint32 OpNum { get; set; } + public PoolID LiquidityPoolID { get; set; } + public Asset Asset { get; set; } - public class HashIDPreimageOperationID + public static void Encode(XdrDataOutputStream stream, HashIDPreimageRevokeID encodedHashIDPreimageRevokeID) { - public HashIDPreimageOperationID() { } - public AccountID SourceAccount { get; set; } - public SequenceNumber SeqNum { get; set; } - public Uint32 OpNum { get; set; } - - public static void Encode(XdrDataOutputStream stream, HashIDPreimageOperationID encodedHashIDPreimageOperationID) - { - AccountID.Encode(stream, encodedHashIDPreimageOperationID.SourceAccount); - SequenceNumber.Encode(stream, encodedHashIDPreimageOperationID.SeqNum); - Uint32.Encode(stream, encodedHashIDPreimageOperationID.OpNum); - } - public static HashIDPreimageOperationID Decode(XdrDataInputStream stream) - { - HashIDPreimageOperationID decodedHashIDPreimageOperationID = new HashIDPreimageOperationID(); - decodedHashIDPreimageOperationID.SourceAccount = AccountID.Decode(stream); - decodedHashIDPreimageOperationID.SeqNum = SequenceNumber.Decode(stream); - decodedHashIDPreimageOperationID.OpNum = Uint32.Decode(stream); - return decodedHashIDPreimageOperationID; - } + AccountID.Encode(stream, encodedHashIDPreimageRevokeID.SourceAccount); + SequenceNumber.Encode(stream, encodedHashIDPreimageRevokeID.SeqNum); + Uint32.Encode(stream, encodedHashIDPreimageRevokeID.OpNum); + PoolID.Encode(stream, encodedHashIDPreimageRevokeID.LiquidityPoolID); + Asset.Encode(stream, encodedHashIDPreimageRevokeID.Asset); + } + public static HashIDPreimageRevokeID Decode(XdrDataInputStream stream) + { + var decodedHashIDPreimageRevokeID = new HashIDPreimageRevokeID(); + decodedHashIDPreimageRevokeID.SourceAccount = AccountID.Decode(stream); + decodedHashIDPreimageRevokeID.SeqNum = SequenceNumber.Decode(stream); + decodedHashIDPreimageRevokeID.OpNum = Uint32.Decode(stream); + decodedHashIDPreimageRevokeID.LiquidityPoolID = PoolID.Decode(stream); + decodedHashIDPreimageRevokeID.Asset = Asset.Decode(stream); + return decodedHashIDPreimageRevokeID; } - public class HashIDPreimageRevokeID + } + + public class HashIDPreimageContractID + { + public Hash NetworkID { get; set; } + public ContractIDPreimage ContractIDPreimage { get; set; } + + public static void Encode(XdrDataOutputStream stream, HashIDPreimageContractID encodedHashIDPreimageContractID) { - public HashIDPreimageRevokeID() { } - public AccountID SourceAccount { get; set; } - public SequenceNumber SeqNum { get; set; } - public Uint32 OpNum { get; set; } - public PoolID LiquidityPoolID { get; set; } - public Asset Asset { get; set; } - - public static void Encode(XdrDataOutputStream stream, HashIDPreimageRevokeID encodedHashIDPreimageRevokeID) - { - AccountID.Encode(stream, encodedHashIDPreimageRevokeID.SourceAccount); - SequenceNumber.Encode(stream, encodedHashIDPreimageRevokeID.SeqNum); - Uint32.Encode(stream, encodedHashIDPreimageRevokeID.OpNum); - PoolID.Encode(stream, encodedHashIDPreimageRevokeID.LiquidityPoolID); - Asset.Encode(stream, encodedHashIDPreimageRevokeID.Asset); - } - public static HashIDPreimageRevokeID Decode(XdrDataInputStream stream) - { - HashIDPreimageRevokeID decodedHashIDPreimageRevokeID = new HashIDPreimageRevokeID(); - decodedHashIDPreimageRevokeID.SourceAccount = AccountID.Decode(stream); - decodedHashIDPreimageRevokeID.SeqNum = SequenceNumber.Decode(stream); - decodedHashIDPreimageRevokeID.OpNum = Uint32.Decode(stream); - decodedHashIDPreimageRevokeID.LiquidityPoolID = PoolID.Decode(stream); - decodedHashIDPreimageRevokeID.Asset = Asset.Decode(stream); - return decodedHashIDPreimageRevokeID; - } + Hash.Encode(stream, encodedHashIDPreimageContractID.NetworkID); + ContractIDPreimage.Encode(stream, encodedHashIDPreimageContractID.ContractIDPreimage); + } + public static HashIDPreimageContractID Decode(XdrDataInputStream stream) + { + var decodedHashIDPreimageContractID = new HashIDPreimageContractID(); + decodedHashIDPreimageContractID.NetworkID = Hash.Decode(stream); + decodedHashIDPreimageContractID.ContractIDPreimage = ContractIDPreimage.Decode(stream); + return decodedHashIDPreimageContractID; + } + } + + public class HashIDPreimageSorobanAuthorization + { + public Hash NetworkID { get; set; } + public Int64 Nonce { get; set; } + public Uint32 SignatureExpirationLedger { get; set; } + public SorobanAuthorizedInvocation Invocation { get; set; } + + public static void Encode(XdrDataOutputStream stream, + HashIDPreimageSorobanAuthorization encodedHashIDPreimageSorobanAuthorization) + { + Hash.Encode(stream, encodedHashIDPreimageSorobanAuthorization.NetworkID); + Int64.Encode(stream, encodedHashIDPreimageSorobanAuthorization.Nonce); + Uint32.Encode(stream, encodedHashIDPreimageSorobanAuthorization.SignatureExpirationLedger); + SorobanAuthorizedInvocation.Encode(stream, encodedHashIDPreimageSorobanAuthorization.Invocation); + } + + public static HashIDPreimageSorobanAuthorization Decode(XdrDataInputStream stream) + { + var decodedHashIDPreimageSorobanAuthorization = new HashIDPreimageSorobanAuthorization(); + decodedHashIDPreimageSorobanAuthorization.NetworkID = Hash.Decode(stream); + decodedHashIDPreimageSorobanAuthorization.Nonce = Int64.Decode(stream); + decodedHashIDPreimageSorobanAuthorization.SignatureExpirationLedger = Uint32.Decode(stream); + decodedHashIDPreimageSorobanAuthorization.Invocation = SorobanAuthorizedInvocation.Decode(stream); + return decodedHashIDPreimageSorobanAuthorization; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Hello.cs b/stellar-dotnet-sdk-xdr/generated/Hello.cs index b1d646d0..b6f2d21d 100644 --- a/stellar-dotnet-sdk-xdr/generated/Hello.cs +++ b/stellar-dotnet-sdk-xdr/generated/Hello.cs @@ -1,64 +1,61 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct Hello +// { +// uint32 ledgerVersion; +// uint32 overlayVersion; +// uint32 overlayMinVersion; +// Hash networkID; +// string versionStr<100>; +// int listeningPort; +// NodeID peerID; +// AuthCert cert; +// uint256 nonce; +// }; - // struct Hello - // { - // uint32 ledgerVersion; - // uint32 overlayVersion; - // uint32 overlayMinVersion; - // Hash networkID; - // string versionStr<100>; - // int listeningPort; - // NodeID peerID; - // AuthCert cert; - // uint256 nonce; - // }; +// =========================================================================== +public class Hello +{ + public Uint32 LedgerVersion { get; set; } + public Uint32 OverlayVersion { get; set; } + public Uint32 OverlayMinVersion { get; set; } + public Hash NetworkID { get; set; } + public string VersionStr { get; set; } + public int ListeningPort { get; set; } + public NodeID PeerID { get; set; } + public AuthCert Cert { get; set; } + public Uint256 Nonce { get; set; } - // =========================================================================== - public class Hello + public static void Encode(XdrDataOutputStream stream, Hello encodedHello) { - public Hello() { } - public Uint32 LedgerVersion { get; set; } - public Uint32 OverlayVersion { get; set; } - public Uint32 OverlayMinVersion { get; set; } - public Hash NetworkID { get; set; } - public String VersionStr { get; set; } - public int ListeningPort { get; set; } - public NodeID PeerID { get; set; } - public AuthCert Cert { get; set; } - public Uint256 Nonce { get; set; } + Uint32.Encode(stream, encodedHello.LedgerVersion); + Uint32.Encode(stream, encodedHello.OverlayVersion); + Uint32.Encode(stream, encodedHello.OverlayMinVersion); + Hash.Encode(stream, encodedHello.NetworkID); + stream.WriteString(encodedHello.VersionStr); + stream.WriteInt(encodedHello.ListeningPort); + NodeID.Encode(stream, encodedHello.PeerID); + AuthCert.Encode(stream, encodedHello.Cert); + Uint256.Encode(stream, encodedHello.Nonce); + } - public static void Encode(XdrDataOutputStream stream, Hello encodedHello) - { - Uint32.Encode(stream, encodedHello.LedgerVersion); - Uint32.Encode(stream, encodedHello.OverlayVersion); - Uint32.Encode(stream, encodedHello.OverlayMinVersion); - Hash.Encode(stream, encodedHello.NetworkID); - stream.WriteString(encodedHello.VersionStr); - stream.WriteInt(encodedHello.ListeningPort); - NodeID.Encode(stream, encodedHello.PeerID); - AuthCert.Encode(stream, encodedHello.Cert); - Uint256.Encode(stream, encodedHello.Nonce); - } - public static Hello Decode(XdrDataInputStream stream) - { - Hello decodedHello = new Hello(); - decodedHello.LedgerVersion = Uint32.Decode(stream); - decodedHello.OverlayVersion = Uint32.Decode(stream); - decodedHello.OverlayMinVersion = Uint32.Decode(stream); - decodedHello.NetworkID = Hash.Decode(stream); - decodedHello.VersionStr = stream.ReadString(); - decodedHello.ListeningPort = stream.ReadInt(); - decodedHello.PeerID = NodeID.Decode(stream); - decodedHello.Cert = AuthCert.Decode(stream); - decodedHello.Nonce = Uint256.Decode(stream); - return decodedHello; - } + public static Hello Decode(XdrDataInputStream stream) + { + var decodedHello = new Hello(); + decodedHello.LedgerVersion = Uint32.Decode(stream); + decodedHello.OverlayVersion = Uint32.Decode(stream); + decodedHello.OverlayMinVersion = Uint32.Decode(stream); + decodedHello.NetworkID = Hash.Decode(stream); + decodedHello.VersionStr = stream.ReadString(); + decodedHello.ListeningPort = stream.ReadInt(); + decodedHello.PeerID = NodeID.Decode(stream); + decodedHello.Cert = AuthCert.Decode(stream); + decodedHello.Nonce = Uint256.Decode(stream); + return decodedHello; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/HmacSha256Key.cs b/stellar-dotnet-sdk-xdr/generated/HmacSha256Key.cs index c98f4fad..d0e32ba9 100644 --- a/stellar-dotnet-sdk-xdr/generated/HmacSha256Key.cs +++ b/stellar-dotnet-sdk-xdr/generated/HmacSha256Key.cs @@ -1,35 +1,32 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct HmacSha256Key +// { +// opaque key[32]; +// }; - // struct HmacSha256Key - // { - // opaque key[32]; - // }; +// =========================================================================== +public class HmacSha256Key +{ + public byte[] Key { get; set; } - // =========================================================================== - public class HmacSha256Key + public static void Encode(XdrDataOutputStream stream, HmacSha256Key encodedHmacSha256Key) { - public HmacSha256Key() { } - public byte[] Key { get; set; } + var keysize = encodedHmacSha256Key.Key.Length; + stream.Write(encodedHmacSha256Key.Key, 0, keysize); + } - public static void Encode(XdrDataOutputStream stream, HmacSha256Key encodedHmacSha256Key) - { - int keysize = encodedHmacSha256Key.Key.Length; - stream.Write(encodedHmacSha256Key.Key, 0, keysize); - } - public static HmacSha256Key Decode(XdrDataInputStream stream) - { - HmacSha256Key decodedHmacSha256Key = new HmacSha256Key(); - int keysize = 32; - decodedHmacSha256Key.Key = new byte[keysize]; - stream.Read(decodedHmacSha256Key.Key, 0, keysize); - return decodedHmacSha256Key; - } + public static HmacSha256Key Decode(XdrDataInputStream stream) + { + var decodedHmacSha256Key = new HmacSha256Key(); + var keysize = 32; + decodedHmacSha256Key.Key = new byte[keysize]; + stream.Read(decodedHmacSha256Key.Key, 0, keysize); + return decodedHmacSha256Key; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/HmacSha256Mac.cs b/stellar-dotnet-sdk-xdr/generated/HmacSha256Mac.cs index 5c4066c6..5ec86803 100644 --- a/stellar-dotnet-sdk-xdr/generated/HmacSha256Mac.cs +++ b/stellar-dotnet-sdk-xdr/generated/HmacSha256Mac.cs @@ -1,35 +1,32 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct HmacSha256Mac +// { +// opaque mac[32]; +// }; - // struct HmacSha256Mac - // { - // opaque mac[32]; - // }; +// =========================================================================== +public class HmacSha256Mac +{ + public byte[] Mac { get; set; } - // =========================================================================== - public class HmacSha256Mac + public static void Encode(XdrDataOutputStream stream, HmacSha256Mac encodedHmacSha256Mac) { - public HmacSha256Mac() { } - public byte[] Mac { get; set; } + var macsize = encodedHmacSha256Mac.Mac.Length; + stream.Write(encodedHmacSha256Mac.Mac, 0, macsize); + } - public static void Encode(XdrDataOutputStream stream, HmacSha256Mac encodedHmacSha256Mac) - { - int macsize = encodedHmacSha256Mac.Mac.Length; - stream.Write(encodedHmacSha256Mac.Mac, 0, macsize); - } - public static HmacSha256Mac Decode(XdrDataInputStream stream) - { - HmacSha256Mac decodedHmacSha256Mac = new HmacSha256Mac(); - int macsize = 32; - decodedHmacSha256Mac.Mac = new byte[macsize]; - stream.Read(decodedHmacSha256Mac.Mac, 0, macsize); - return decodedHmacSha256Mac; - } + public static HmacSha256Mac Decode(XdrDataInputStream stream) + { + var decodedHmacSha256Mac = new HmacSha256Mac(); + var macsize = 32; + decodedHmacSha256Mac.Mac = new byte[macsize]; + stream.Read(decodedHmacSha256Mac.Mac, 0, macsize); + return decodedHmacSha256Mac; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/HostFunction.cs b/stellar-dotnet-sdk-xdr/generated/HostFunction.cs new file mode 100644 index 00000000..8d3c41bb --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/HostFunction.cs @@ -0,0 +1,68 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union HostFunction switch (HostFunctionType type) +// { +// case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: +// InvokeContractArgs invokeContract; +// case HOST_FUNCTION_TYPE_CREATE_CONTRACT: +// CreateContractArgs createContract; +// case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: +// opaque wasm<>; +// }; + +// =========================================================================== +public class HostFunction +{ + public HostFunctionType Discriminant { get; set; } = new(); + + public InvokeContractArgs InvokeContract { get; set; } + public CreateContractArgs CreateContract { get; set; } + public byte[] Wasm { get; set; } + + public static void Encode(XdrDataOutputStream stream, HostFunction encodedHostFunction) + { + stream.WriteInt((int)encodedHostFunction.Discriminant.InnerValue); + switch (encodedHostFunction.Discriminant.InnerValue) + { + case HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT: + InvokeContractArgs.Encode(stream, encodedHostFunction.InvokeContract); + break; + case HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT: + CreateContractArgs.Encode(stream, encodedHostFunction.CreateContract); + break; + case HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: + var wasmsize = encodedHostFunction.Wasm.Length; + stream.WriteInt(wasmsize); + stream.Write(encodedHostFunction.Wasm, 0, wasmsize); + break; + } + } + + public static HostFunction Decode(XdrDataInputStream stream) + { + var decodedHostFunction = new HostFunction(); + var discriminant = HostFunctionType.Decode(stream); + decodedHostFunction.Discriminant = discriminant; + switch (decodedHostFunction.Discriminant.InnerValue) + { + case HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT: + decodedHostFunction.InvokeContract = InvokeContractArgs.Decode(stream); + break; + case HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT: + decodedHostFunction.CreateContract = CreateContractArgs.Decode(stream); + break; + case HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: + var wasmsize = stream.ReadInt(); + decodedHostFunction.Wasm = new byte[wasmsize]; + stream.Read(decodedHostFunction.Wasm, 0, wasmsize); + break; + } + + return decodedHostFunction; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/HostFunctionType.cs b/stellar-dotnet-sdk-xdr/generated/HostFunctionType.cs new file mode 100644 index 00000000..6b6dc9aa --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/HostFunctionType.cs @@ -0,0 +1,54 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum HostFunctionType +// { +// HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0, +// HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1, +// HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2 +// }; + +// =========================================================================== +public class HostFunctionType +{ + public enum HostFunctionTypeEnum + { + HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0, + HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1, + HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2 + } + + public HostFunctionTypeEnum InnerValue { get; set; } = default; + + public static HostFunctionType Create(HostFunctionTypeEnum v) + { + return new HostFunctionType + { + InnerValue = v + }; + } + + public static HostFunctionType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT); + case 1: return Create(HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT); + case 2: return Create(HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, HostFunctionType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/IPAddrType.cs b/stellar-dotnet-sdk-xdr/generated/IPAddrType.cs index 6527c18c..8b13738a 100644 --- a/stellar-dotnet-sdk-xdr/generated/IPAddrType.cs +++ b/stellar-dotnet-sdk-xdr/generated/IPAddrType.cs @@ -1,51 +1,51 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum IPAddrType - // { - // IPv4 = 0, - // IPv6 = 1 - // }; +// enum IPAddrType +// { +// IPv4 = 0, +// IPv6 = 1 +// }; - // =========================================================================== - public class IPAddrType +// =========================================================================== +public class IPAddrType +{ + public enum IPAddrTypeEnum { - public enum IPAddrTypeEnum - { - IPv4 = 0, - IPv6 = 1, - } - public IPAddrTypeEnum InnerValue { get; set; } = default(IPAddrTypeEnum); + IPv4 = 0, + IPv6 = 1 + } - public static IPAddrType Create(IPAddrTypeEnum v) - { - return new IPAddrType - { - InnerValue = v - }; - } + public IPAddrTypeEnum InnerValue { get; set; } = default; - public static IPAddrType Decode(XdrDataInputStream stream) + public static IPAddrType Create(IPAddrTypeEnum v) + { + return new IPAddrType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(IPAddrTypeEnum.IPv4); - case 1: return Create(IPAddrTypeEnum.IPv6); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, IPAddrType value) + public static IPAddrType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(IPAddrTypeEnum.IPv4); + case 1: return Create(IPAddrTypeEnum.IPv6); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, IPAddrType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InflationPayout.cs b/stellar-dotnet-sdk-xdr/generated/InflationPayout.cs index aca9b0ec..35eb610c 100644 --- a/stellar-dotnet-sdk-xdr/generated/InflationPayout.cs +++ b/stellar-dotnet-sdk-xdr/generated/InflationPayout.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct InflationPayout // or use PaymentResultAtom to limit types? +// { +// AccountID destination; +// int64 amount; +// }; - // struct InflationPayout // or use PaymentResultAtom to limit types? - // { - // AccountID destination; - // int64 amount; - // }; +// =========================================================================== +public class InflationPayout +{ + public AccountID Destination { get; set; } + public Int64 Amount { get; set; } - // =========================================================================== - public class InflationPayout + public static void Encode(XdrDataOutputStream stream, InflationPayout encodedInflationPayout) { - public InflationPayout() { } - public AccountID Destination { get; set; } - public Int64 Amount { get; set; } + AccountID.Encode(stream, encodedInflationPayout.Destination); + Int64.Encode(stream, encodedInflationPayout.Amount); + } - public static void Encode(XdrDataOutputStream stream, InflationPayout encodedInflationPayout) - { - AccountID.Encode(stream, encodedInflationPayout.Destination); - Int64.Encode(stream, encodedInflationPayout.Amount); - } - public static InflationPayout Decode(XdrDataInputStream stream) - { - InflationPayout decodedInflationPayout = new InflationPayout(); - decodedInflationPayout.Destination = AccountID.Decode(stream); - decodedInflationPayout.Amount = Int64.Decode(stream); - return decodedInflationPayout; - } + public static InflationPayout Decode(XdrDataInputStream stream) + { + var decodedInflationPayout = new InflationPayout(); + decodedInflationPayout.Destination = AccountID.Decode(stream); + decodedInflationPayout.Amount = Int64.Decode(stream); + return decodedInflationPayout; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InflationResult.cs b/stellar-dotnet-sdk-xdr/generated/InflationResult.cs index b043b315..47f2a4c8 100644 --- a/stellar-dotnet-sdk-xdr/generated/InflationResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/InflationResult.cs @@ -1,64 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union InflationResult switch (InflationResultCode code) - // { - // case INFLATION_SUCCESS: - // InflationPayout payouts<>; - // default: - // void; - // }; +// union InflationResult switch (InflationResultCode code) +// { +// case INFLATION_SUCCESS: +// InflationPayout payouts<>; +// case INFLATION_NOT_TIME: +// void; +// }; - // =========================================================================== - public class InflationResult - { - public InflationResult() { } +// =========================================================================== +public class InflationResult +{ + public InflationResultCode Discriminant { get; set; } = new(); - public InflationResultCode Discriminant { get; set; } = new InflationResultCode(); + public InflationPayout[] Payouts { get; set; } - public InflationPayout[] Payouts { get; set; } - public static void Encode(XdrDataOutputStream stream, InflationResult encodedInflationResult) + public static void Encode(XdrDataOutputStream stream, InflationResult encodedInflationResult) + { + stream.WriteInt((int)encodedInflationResult.Discriminant.InnerValue); + switch (encodedInflationResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedInflationResult.Discriminant.InnerValue); - switch (encodedInflationResult.Discriminant.InnerValue) - { - case InflationResultCode.InflationResultCodeEnum.INFLATION_SUCCESS: - int payoutssize = encodedInflationResult.Payouts.Length; - stream.WriteInt(payoutssize); - for (int i = 0; i < payoutssize; i++) - { - InflationPayout.Encode(stream, encodedInflationResult.Payouts[i]); - } - break; - default: - break; - } + case InflationResultCode.InflationResultCodeEnum.INFLATION_SUCCESS: + var payoutssize = encodedInflationResult.Payouts.Length; + stream.WriteInt(payoutssize); + for (var i = 0; i < payoutssize; i++) InflationPayout.Encode(stream, encodedInflationResult.Payouts[i]); + break; + case InflationResultCode.InflationResultCodeEnum.INFLATION_NOT_TIME: + break; } - public static InflationResult Decode(XdrDataInputStream stream) + } + + public static InflationResult Decode(XdrDataInputStream stream) + { + var decodedInflationResult = new InflationResult(); + var discriminant = InflationResultCode.Decode(stream); + decodedInflationResult.Discriminant = discriminant; + switch (decodedInflationResult.Discriminant.InnerValue) { - InflationResult decodedInflationResult = new InflationResult(); - InflationResultCode discriminant = InflationResultCode.Decode(stream); - decodedInflationResult.Discriminant = discriminant; - switch (decodedInflationResult.Discriminant.InnerValue) - { - case InflationResultCode.InflationResultCodeEnum.INFLATION_SUCCESS: - int payoutssize = stream.ReadInt(); - decodedInflationResult.Payouts = new InflationPayout[payoutssize]; - for (int i = 0; i < payoutssize; i++) - { - decodedInflationResult.Payouts[i] = InflationPayout.Decode(stream); - } - break; - default: - break; - } - return decodedInflationResult; + case InflationResultCode.InflationResultCodeEnum.INFLATION_SUCCESS: + var payoutssize = stream.ReadInt(); + decodedInflationResult.Payouts = new InflationPayout[payoutssize]; + for (var i = 0; i < payoutssize; i++) + decodedInflationResult.Payouts[i] = InflationPayout.Decode(stream); + break; + case InflationResultCode.InflationResultCodeEnum.INFLATION_NOT_TIME: + break; } + + return decodedInflationResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InflationResultCode.cs b/stellar-dotnet-sdk-xdr/generated/InflationResultCode.cs index dbfb99a3..21651ed3 100644 --- a/stellar-dotnet-sdk-xdr/generated/InflationResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/InflationResultCode.cs @@ -1,53 +1,53 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum InflationResultCode - // { - // // codes considered as "success" for the operation - // INFLATION_SUCCESS = 0, - // // codes considered as "failure" for the operation - // INFLATION_NOT_TIME = -1 - // }; +// enum InflationResultCode +// { +// // codes considered as "success" for the operation +// INFLATION_SUCCESS = 0, +// // codes considered as "failure" for the operation +// INFLATION_NOT_TIME = -1 +// }; - // =========================================================================== - public class InflationResultCode +// =========================================================================== +public class InflationResultCode +{ + public enum InflationResultCodeEnum { - public enum InflationResultCodeEnum - { - INFLATION_SUCCESS = 0, - INFLATION_NOT_TIME = -1, - } - public InflationResultCodeEnum InnerValue { get; set; } = default(InflationResultCodeEnum); + INFLATION_SUCCESS = 0, + INFLATION_NOT_TIME = -1 + } - public static InflationResultCode Create(InflationResultCodeEnum v) - { - return new InflationResultCode - { - InnerValue = v - }; - } + public InflationResultCodeEnum InnerValue { get; set; } = default; - public static InflationResultCode Decode(XdrDataInputStream stream) + public static InflationResultCode Create(InflationResultCodeEnum v) + { + return new InflationResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(InflationResultCodeEnum.INFLATION_SUCCESS); - case -1: return Create(InflationResultCodeEnum.INFLATION_NOT_TIME); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, InflationResultCode value) + public static InflationResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(InflationResultCodeEnum.INFLATION_SUCCESS); + case -1: return Create(InflationResultCodeEnum.INFLATION_NOT_TIME); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, InflationResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InnerTransactionResult.cs b/stellar-dotnet-sdk-xdr/generated/InnerTransactionResult.cs index 51a08765..c5dd4a72 100644 --- a/stellar-dotnet-sdk-xdr/generated/InnerTransactionResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/InnerTransactionResult.cs @@ -1,176 +1,174 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct InnerTransactionResult +// { +// // Always 0. Here for binary compatibility. +// int64 feeCharged; +// +// union switch (TransactionResultCode code) +// { +// // txFEE_BUMP_INNER_SUCCESS is not included +// case txSUCCESS: +// case txFAILED: +// OperationResult results<>; +// case txTOO_EARLY: +// case txTOO_LATE: +// case txMISSING_OPERATION: +// case txBAD_SEQ: +// case txBAD_AUTH: +// case txINSUFFICIENT_BALANCE: +// case txNO_ACCOUNT: +// case txINSUFFICIENT_FEE: +// case txBAD_AUTH_EXTRA: +// case txINTERNAL_ERROR: +// case txNOT_SUPPORTED: +// // txFEE_BUMP_INNER_FAILED is not included +// case txBAD_SPONSORSHIP: +// case txBAD_MIN_SEQ_AGE_OR_GAP: +// case txMALFORMED: +// case txSOROBAN_INVALID: +// void; +// } +// result; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; - // struct InnerTransactionResult - // { - // // Always 0. Here for binary compatibility. - // int64 feeCharged; - // - // union switch (TransactionResultCode code) - // { - // // txFEE_BUMP_INNER_SUCCESS is not included - // case txSUCCESS: - // case txFAILED: - // OperationResult results<>; - // case txTOO_EARLY: - // case txTOO_LATE: - // case txMISSING_OPERATION: - // case txBAD_SEQ: - // case txBAD_AUTH: - // case txINSUFFICIENT_BALANCE: - // case txNO_ACCOUNT: - // case txINSUFFICIENT_FEE: - // case txBAD_AUTH_EXTRA: - // case txINTERNAL_ERROR: - // case txNOT_SUPPORTED: - // // txFEE_BUMP_INNER_FAILED is not included - // case txBAD_SPONSORSHIP: - // case txBAD_MIN_SEQ_AGE_OR_GAP: - // case txMALFORMED: - // void; - // } - // result; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; +// =========================================================================== +public class InnerTransactionResult +{ + public Int64 FeeCharged { get; set; } + public InnerTransactionResultResult Result { get; set; } + public InnerTransactionResultExt Ext { get; set; } - // =========================================================================== - public class InnerTransactionResult + public static void Encode(XdrDataOutputStream stream, InnerTransactionResult encodedInnerTransactionResult) { - public InnerTransactionResult() { } - public Int64 FeeCharged { get; set; } - public InnerTransactionResultResult Result { get; set; } - public InnerTransactionResultExt Ext { get; set; } + Int64.Encode(stream, encodedInnerTransactionResult.FeeCharged); + InnerTransactionResultResult.Encode(stream, encodedInnerTransactionResult.Result); + InnerTransactionResultExt.Encode(stream, encodedInnerTransactionResult.Ext); + } - public static void Encode(XdrDataOutputStream stream, InnerTransactionResult encodedInnerTransactionResult) - { - Int64.Encode(stream, encodedInnerTransactionResult.FeeCharged); - InnerTransactionResultResult.Encode(stream, encodedInnerTransactionResult.Result); - InnerTransactionResultExt.Encode(stream, encodedInnerTransactionResult.Ext); - } - public static InnerTransactionResult Decode(XdrDataInputStream stream) - { - InnerTransactionResult decodedInnerTransactionResult = new InnerTransactionResult(); - decodedInnerTransactionResult.FeeCharged = Int64.Decode(stream); - decodedInnerTransactionResult.Result = InnerTransactionResultResult.Decode(stream); - decodedInnerTransactionResult.Ext = InnerTransactionResultExt.Decode(stream); - return decodedInnerTransactionResult; - } + public static InnerTransactionResult Decode(XdrDataInputStream stream) + { + var decodedInnerTransactionResult = new InnerTransactionResult(); + decodedInnerTransactionResult.FeeCharged = Int64.Decode(stream); + decodedInnerTransactionResult.Result = InnerTransactionResultResult.Decode(stream); + decodedInnerTransactionResult.Ext = InnerTransactionResultExt.Decode(stream); + return decodedInnerTransactionResult; + } - public class InnerTransactionResultResult - { - public InnerTransactionResultResult() { } + public class InnerTransactionResultResult + { + public TransactionResultCode Discriminant { get; set; } = new(); - public TransactionResultCode Discriminant { get; set; } = new TransactionResultCode(); + public OperationResult[] Results { get; set; } - public OperationResult[] Results { get; set; } - public static void Encode(XdrDataOutputStream stream, InnerTransactionResultResult encodedInnerTransactionResultResult) + public static void Encode(XdrDataOutputStream stream, + InnerTransactionResultResult encodedInnerTransactionResultResult) + { + stream.WriteInt((int)encodedInnerTransactionResultResult.Discriminant.InnerValue); + switch (encodedInnerTransactionResultResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedInnerTransactionResultResult.Discriminant.InnerValue); - switch (encodedInnerTransactionResultResult.Discriminant.InnerValue) - { - case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS: - case TransactionResultCode.TransactionResultCodeEnum.txFAILED: - int resultssize = encodedInnerTransactionResultResult.Results.Length; - stream.WriteInt(resultssize); - for (int i = 0; i < resultssize; i++) - { - OperationResult.Encode(stream, encodedInnerTransactionResultResult.Results[i]); - } - break; - case TransactionResultCode.TransactionResultCodeEnum.txTOO_EARLY: - case TransactionResultCode.TransactionResultCodeEnum.txTOO_LATE: - case TransactionResultCode.TransactionResultCodeEnum.txMISSING_OPERATION: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_SEQ: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH: - case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_BALANCE: - case TransactionResultCode.TransactionResultCodeEnum.txNO_ACCOUNT: - case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_FEE: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH_EXTRA: - case TransactionResultCode.TransactionResultCodeEnum.txINTERNAL_ERROR: - case TransactionResultCode.TransactionResultCodeEnum.txNOT_SUPPORTED: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_SPONSORSHIP: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_MIN_SEQ_AGE_OR_GAP: - case TransactionResultCode.TransactionResultCodeEnum.txMALFORMED: - break; - } + case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS: + case TransactionResultCode.TransactionResultCodeEnum.txFAILED: + var resultssize = encodedInnerTransactionResultResult.Results.Length; + stream.WriteInt(resultssize); + for (var i = 0; i < resultssize; i++) + OperationResult.Encode(stream, encodedInnerTransactionResultResult.Results[i]); + break; + case TransactionResultCode.TransactionResultCodeEnum.txTOO_EARLY: + case TransactionResultCode.TransactionResultCodeEnum.txTOO_LATE: + case TransactionResultCode.TransactionResultCodeEnum.txMISSING_OPERATION: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_SEQ: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH: + case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_BALANCE: + case TransactionResultCode.TransactionResultCodeEnum.txNO_ACCOUNT: + case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_FEE: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH_EXTRA: + case TransactionResultCode.TransactionResultCodeEnum.txINTERNAL_ERROR: + case TransactionResultCode.TransactionResultCodeEnum.txNOT_SUPPORTED: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_SPONSORSHIP: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_MIN_SEQ_AGE_OR_GAP: + case TransactionResultCode.TransactionResultCodeEnum.txMALFORMED: + case TransactionResultCode.TransactionResultCodeEnum.txSOROBAN_INVALID: + break; } - public static InnerTransactionResultResult Decode(XdrDataInputStream stream) + } + + public static InnerTransactionResultResult Decode(XdrDataInputStream stream) + { + var decodedInnerTransactionResultResult = new InnerTransactionResultResult(); + var discriminant = TransactionResultCode.Decode(stream); + decodedInnerTransactionResultResult.Discriminant = discriminant; + switch (decodedInnerTransactionResultResult.Discriminant.InnerValue) { - InnerTransactionResultResult decodedInnerTransactionResultResult = new InnerTransactionResultResult(); - TransactionResultCode discriminant = TransactionResultCode.Decode(stream); - decodedInnerTransactionResultResult.Discriminant = discriminant; - switch (decodedInnerTransactionResultResult.Discriminant.InnerValue) - { - case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS: - case TransactionResultCode.TransactionResultCodeEnum.txFAILED: - int resultssize = stream.ReadInt(); - decodedInnerTransactionResultResult.Results = new OperationResult[resultssize]; - for (int i = 0; i < resultssize; i++) - { - decodedInnerTransactionResultResult.Results[i] = OperationResult.Decode(stream); - } - break; - case TransactionResultCode.TransactionResultCodeEnum.txTOO_EARLY: - case TransactionResultCode.TransactionResultCodeEnum.txTOO_LATE: - case TransactionResultCode.TransactionResultCodeEnum.txMISSING_OPERATION: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_SEQ: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH: - case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_BALANCE: - case TransactionResultCode.TransactionResultCodeEnum.txNO_ACCOUNT: - case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_FEE: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH_EXTRA: - case TransactionResultCode.TransactionResultCodeEnum.txINTERNAL_ERROR: - case TransactionResultCode.TransactionResultCodeEnum.txNOT_SUPPORTED: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_SPONSORSHIP: - case TransactionResultCode.TransactionResultCodeEnum.txBAD_MIN_SEQ_AGE_OR_GAP: - case TransactionResultCode.TransactionResultCodeEnum.txMALFORMED: - break; - } - return decodedInnerTransactionResultResult; + case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS: + case TransactionResultCode.TransactionResultCodeEnum.txFAILED: + var resultssize = stream.ReadInt(); + decodedInnerTransactionResultResult.Results = new OperationResult[resultssize]; + for (var i = 0; i < resultssize; i++) + decodedInnerTransactionResultResult.Results[i] = OperationResult.Decode(stream); + break; + case TransactionResultCode.TransactionResultCodeEnum.txTOO_EARLY: + case TransactionResultCode.TransactionResultCodeEnum.txTOO_LATE: + case TransactionResultCode.TransactionResultCodeEnum.txMISSING_OPERATION: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_SEQ: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH: + case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_BALANCE: + case TransactionResultCode.TransactionResultCodeEnum.txNO_ACCOUNT: + case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_FEE: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH_EXTRA: + case TransactionResultCode.TransactionResultCodeEnum.txINTERNAL_ERROR: + case TransactionResultCode.TransactionResultCodeEnum.txNOT_SUPPORTED: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_SPONSORSHIP: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_MIN_SEQ_AGE_OR_GAP: + case TransactionResultCode.TransactionResultCodeEnum.txMALFORMED: + case TransactionResultCode.TransactionResultCodeEnum.txSOROBAN_INVALID: + break; } + return decodedInnerTransactionResultResult; } - public class InnerTransactionResultExt - { - public InnerTransactionResultExt() { } + } - public int Discriminant { get; set; } = new int(); + public class InnerTransactionResultExt + { + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, InnerTransactionResultExt encodedInnerTransactionResultExt) + public static void Encode(XdrDataOutputStream stream, + InnerTransactionResultExt encodedInnerTransactionResultExt) + { + stream.WriteInt(encodedInnerTransactionResultExt.Discriminant); + switch (encodedInnerTransactionResultExt.Discriminant) { - stream.WriteInt((int)encodedInnerTransactionResultExt.Discriminant); - switch (encodedInnerTransactionResultExt.Discriminant) - { - case 0: - break; - } + case 0: + break; } - public static InnerTransactionResultExt Decode(XdrDataInputStream stream) + } + + public static InnerTransactionResultExt Decode(XdrDataInputStream stream) + { + var decodedInnerTransactionResultExt = new InnerTransactionResultExt(); + var discriminant = stream.ReadInt(); + decodedInnerTransactionResultExt.Discriminant = discriminant; + switch (decodedInnerTransactionResultExt.Discriminant) { - InnerTransactionResultExt decodedInnerTransactionResultExt = new InnerTransactionResultExt(); - int discriminant = stream.ReadInt(); - decodedInnerTransactionResultExt.Discriminant = discriminant; - switch (decodedInnerTransactionResultExt.Discriminant) - { - case 0: - break; - } - return decodedInnerTransactionResultExt; + case 0: + break; } + return decodedInnerTransactionResultExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InnerTransactionResultPair.cs b/stellar-dotnet-sdk-xdr/generated/InnerTransactionResultPair.cs index 2d1ea999..af069528 100644 --- a/stellar-dotnet-sdk-xdr/generated/InnerTransactionResultPair.cs +++ b/stellar-dotnet-sdk-xdr/generated/InnerTransactionResultPair.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct InnerTransactionResultPair +// { +// Hash transactionHash; // hash of the inner transaction +// InnerTransactionResult result; // result for the inner transaction +// }; - // struct InnerTransactionResultPair - // { - // Hash transactionHash; // hash of the inner transaction - // InnerTransactionResult result; // result for the inner transaction - // }; +// =========================================================================== +public class InnerTransactionResultPair +{ + public Hash TransactionHash { get; set; } + public InnerTransactionResult Result { get; set; } - // =========================================================================== - public class InnerTransactionResultPair + public static void Encode(XdrDataOutputStream stream, InnerTransactionResultPair encodedInnerTransactionResultPair) { - public InnerTransactionResultPair() { } - public Hash TransactionHash { get; set; } - public InnerTransactionResult Result { get; set; } + Hash.Encode(stream, encodedInnerTransactionResultPair.TransactionHash); + InnerTransactionResult.Encode(stream, encodedInnerTransactionResultPair.Result); + } - public static void Encode(XdrDataOutputStream stream, InnerTransactionResultPair encodedInnerTransactionResultPair) - { - Hash.Encode(stream, encodedInnerTransactionResultPair.TransactionHash); - InnerTransactionResult.Encode(stream, encodedInnerTransactionResultPair.Result); - } - public static InnerTransactionResultPair Decode(XdrDataInputStream stream) - { - InnerTransactionResultPair decodedInnerTransactionResultPair = new InnerTransactionResultPair(); - decodedInnerTransactionResultPair.TransactionHash = Hash.Decode(stream); - decodedInnerTransactionResultPair.Result = InnerTransactionResult.Decode(stream); - return decodedInnerTransactionResultPair; - } + public static InnerTransactionResultPair Decode(XdrDataInputStream stream) + { + var decodedInnerTransactionResultPair = new InnerTransactionResultPair(); + decodedInnerTransactionResultPair.TransactionHash = Hash.Decode(stream); + decodedInnerTransactionResultPair.Result = InnerTransactionResult.Decode(stream); + return decodedInnerTransactionResultPair; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Int128Parts.cs b/stellar-dotnet-sdk-xdr/generated/Int128Parts.cs new file mode 100644 index 00000000..15a189a9 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/Int128Parts.cs @@ -0,0 +1,32 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct Int128Parts { +// int64 hi; +// uint64 lo; +// }; + +// =========================================================================== +public class Int128Parts +{ + public Int64 Hi { get; set; } + public Uint64 Lo { get; set; } + + public static void Encode(XdrDataOutputStream stream, Int128Parts encodedInt128Parts) + { + Int64.Encode(stream, encodedInt128Parts.Hi); + Uint64.Encode(stream, encodedInt128Parts.Lo); + } + + public static Int128Parts Decode(XdrDataInputStream stream) + { + var decodedInt128Parts = new Int128Parts(); + decodedInt128Parts.Hi = Int64.Decode(stream); + decodedInt128Parts.Lo = Uint64.Decode(stream); + return decodedInt128Parts; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Int256Parts.cs b/stellar-dotnet-sdk-xdr/generated/Int256Parts.cs new file mode 100644 index 00000000..f9826013 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/Int256Parts.cs @@ -0,0 +1,40 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct Int256Parts { +// int64 hi_hi; +// uint64 hi_lo; +// uint64 lo_hi; +// uint64 lo_lo; +// }; + +// =========================================================================== +public class Int256Parts +{ + public Int64 HiHi { get; set; } + public Uint64 HiLo { get; set; } + public Uint64 LoHi { get; set; } + public Uint64 LoLo { get; set; } + + public static void Encode(XdrDataOutputStream stream, Int256Parts encodedInt256Parts) + { + Int64.Encode(stream, encodedInt256Parts.HiHi); + Uint64.Encode(stream, encodedInt256Parts.HiLo); + Uint64.Encode(stream, encodedInt256Parts.LoHi); + Uint64.Encode(stream, encodedInt256Parts.LoLo); + } + + public static Int256Parts Decode(XdrDataInputStream stream) + { + var decodedInt256Parts = new Int256Parts(); + decodedInt256Parts.HiHi = Int64.Decode(stream); + decodedInt256Parts.HiLo = Uint64.Decode(stream); + decodedInt256Parts.LoHi = Uint64.Decode(stream); + decodedInt256Parts.LoLo = Uint64.Decode(stream); + return decodedInt256Parts; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Int32.cs b/stellar-dotnet-sdk-xdr/generated/Int32.cs index 3d47b832..b8da817a 100644 --- a/stellar-dotnet-sdk-xdr/generated/Int32.cs +++ b/stellar-dotnet-sdk-xdr/generated/Int32.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef int int32; + +// =========================================================================== +public class Int32 { + public Int32() + { + } - // === xdr source ============================================================ + public Int32(int value) + { + InnerValue = value; + } + + public int InnerValue { get; set; } = default; - // typedef int int32; + public static void Encode(XdrDataOutputStream stream, Int32 encodedInt32) + { + stream.WriteInt(encodedInt32.InnerValue); + } - // =========================================================================== - public class Int32 + public static Int32 Decode(XdrDataInputStream stream) { - public int InnerValue { get; set; } = default(int); - - public Int32() { } - - public Int32(int value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Int32 encodedInt32) - { - stream.WriteInt(encodedInt32.InnerValue); - } - public static Int32 Decode(XdrDataInputStream stream) - { - Int32 decodedInt32 = new Int32(); - decodedInt32.InnerValue = stream.ReadInt(); - return decodedInt32; - } + var decodedInt32 = new Int32(); + decodedInt32.InnerValue = stream.ReadInt(); + return decodedInt32; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Int64.cs b/stellar-dotnet-sdk-xdr/generated/Int64.cs index 3399bba4..d98ced57 100644 --- a/stellar-dotnet-sdk-xdr/generated/Int64.cs +++ b/stellar-dotnet-sdk-xdr/generated/Int64.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef hyper int64; + +// =========================================================================== +public class Int64 { + public Int64() + { + } - // === xdr source ============================================================ + public Int64(long value) + { + InnerValue = value; + } + + public long InnerValue { get; set; } = default; - // typedef hyper int64; + public static void Encode(XdrDataOutputStream stream, Int64 encodedInt64) + { + stream.WriteLong(encodedInt64.InnerValue); + } - // =========================================================================== - public class Int64 + public static Int64 Decode(XdrDataInputStream stream) { - public long InnerValue { get; set; } = default(long); - - public Int64() { } - - public Int64(long value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Int64 encodedInt64) - { - stream.WriteLong(encodedInt64.InnerValue); - } - public static Int64 Decode(XdrDataInputStream stream) - { - Int64 decodedInt64 = new Int64(); - decodedInt64.InnerValue = stream.ReadLong(); - return decodedInt64; - } + var decodedInt64 = new Int64(); + decodedInt64.InnerValue = stream.ReadLong(); + return decodedInt64; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InvokeContractArgs.cs b/stellar-dotnet-sdk-xdr/generated/InvokeContractArgs.cs new file mode 100644 index 00000000..5b718e5e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/InvokeContractArgs.cs @@ -0,0 +1,40 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct InvokeContractArgs { +// SCAddress contractAddress; +// SCSymbol functionName; +// SCVal args<>; +// }; + +// =========================================================================== +public class InvokeContractArgs +{ + public SCAddress ContractAddress { get; set; } + public SCSymbol FunctionName { get; set; } + public SCVal[] Args { get; set; } + + public static void Encode(XdrDataOutputStream stream, InvokeContractArgs encodedInvokeContractArgs) + { + SCAddress.Encode(stream, encodedInvokeContractArgs.ContractAddress); + SCSymbol.Encode(stream, encodedInvokeContractArgs.FunctionName); + var argssize = encodedInvokeContractArgs.Args.Length; + stream.WriteInt(argssize); + for (var i = 0; i < argssize; i++) SCVal.Encode(stream, encodedInvokeContractArgs.Args[i]); + } + + public static InvokeContractArgs Decode(XdrDataInputStream stream) + { + var decodedInvokeContractArgs = new InvokeContractArgs(); + decodedInvokeContractArgs.ContractAddress = SCAddress.Decode(stream); + decodedInvokeContractArgs.FunctionName = SCSymbol.Decode(stream); + var argssize = stream.ReadInt(); + decodedInvokeContractArgs.Args = new SCVal[argssize]; + for (var i = 0; i < argssize; i++) decodedInvokeContractArgs.Args[i] = SCVal.Decode(stream); + return decodedInvokeContractArgs; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionOp.cs b/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionOp.cs new file mode 100644 index 00000000..99ecf952 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionOp.cs @@ -0,0 +1,41 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct InvokeHostFunctionOp +// { +// // Host function to invoke. +// HostFunction hostFunction; +// // Per-address authorizations for this host function. +// SorobanAuthorizationEntry auth<>; +// }; + +// =========================================================================== +public class InvokeHostFunctionOp +{ + public HostFunction HostFunction { get; set; } + public SorobanAuthorizationEntry[] Auth { get; set; } + + public static void Encode(XdrDataOutputStream stream, InvokeHostFunctionOp encodedInvokeHostFunctionOp) + { + HostFunction.Encode(stream, encodedInvokeHostFunctionOp.HostFunction); + var authsize = encodedInvokeHostFunctionOp.Auth.Length; + stream.WriteInt(authsize); + for (var i = 0; i < authsize; i++) + SorobanAuthorizationEntry.Encode(stream, encodedInvokeHostFunctionOp.Auth[i]); + } + + public static InvokeHostFunctionOp Decode(XdrDataInputStream stream) + { + var decodedInvokeHostFunctionOp = new InvokeHostFunctionOp(); + decodedInvokeHostFunctionOp.HostFunction = HostFunction.Decode(stream); + var authsize = stream.ReadInt(); + decodedInvokeHostFunctionOp.Auth = new SorobanAuthorizationEntry[authsize]; + for (var i = 0; i < authsize; i++) + decodedInvokeHostFunctionOp.Auth[i] = SorobanAuthorizationEntry.Decode(stream); + return decodedInvokeHostFunctionOp; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionResult.cs b/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionResult.cs new file mode 100644 index 00000000..06a72c7e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionResult.cs @@ -0,0 +1,68 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code) +// { +// case INVOKE_HOST_FUNCTION_SUCCESS: +// Hash success; // sha256(InvokeHostFunctionSuccessPreImage) +// case INVOKE_HOST_FUNCTION_MALFORMED: +// case INVOKE_HOST_FUNCTION_TRAPPED: +// case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: +// case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: +// case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: +// void; +// }; + +// =========================================================================== +public class InvokeHostFunctionResult +{ + public InvokeHostFunctionResultCode Discriminant { get; set; } = new(); + + public Hash Success { get; set; } + + public static void Encode(XdrDataOutputStream stream, InvokeHostFunctionResult encodedInvokeHostFunctionResult) + { + stream.WriteInt((int)encodedInvokeHostFunctionResult.Discriminant.InnerValue); + switch (encodedInvokeHostFunctionResult.Discriminant.InnerValue) + { + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_SUCCESS: + Hash.Encode(stream, encodedInvokeHostFunctionResult.Success); + break; + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_MALFORMED: + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_TRAPPED: + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum + .INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum + .INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: + break; + } + } + + public static InvokeHostFunctionResult Decode(XdrDataInputStream stream) + { + var decodedInvokeHostFunctionResult = new InvokeHostFunctionResult(); + var discriminant = InvokeHostFunctionResultCode.Decode(stream); + decodedInvokeHostFunctionResult.Discriminant = discriminant; + switch (decodedInvokeHostFunctionResult.Discriminant.InnerValue) + { + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_SUCCESS: + decodedInvokeHostFunctionResult.Success = Hash.Decode(stream); + break; + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_MALFORMED: + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_TRAPPED: + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum + .INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: + case InvokeHostFunctionResultCode.InvokeHostFunctionResultCodeEnum + .INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: + break; + } + + return decodedInvokeHostFunctionResult; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionResultCode.cs b/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionResultCode.cs new file mode 100644 index 00000000..ec5dc570 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionResultCode.cs @@ -0,0 +1,66 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum InvokeHostFunctionResultCode +// { +// // 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, +// INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, +// INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, +// INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 +// }; + +// =========================================================================== +public class InvokeHostFunctionResultCode +{ + public enum InvokeHostFunctionResultCodeEnum + { + INVOKE_HOST_FUNCTION_SUCCESS = 0, + INVOKE_HOST_FUNCTION_MALFORMED = -1, + INVOKE_HOST_FUNCTION_TRAPPED = -2, + INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, + INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, + INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 + } + + public InvokeHostFunctionResultCodeEnum InnerValue { get; set; } = default; + + public static InvokeHostFunctionResultCode Create(InvokeHostFunctionResultCodeEnum v) + { + return new InvokeHostFunctionResultCode + { + InnerValue = v + }; + } + + public static InvokeHostFunctionResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_SUCCESS); + case -1: return Create(InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_MALFORMED); + case -2: return Create(InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_TRAPPED); + case -3: return Create(InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED); + case -4: return Create(InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED); + case -5: return Create(InvokeHostFunctionResultCodeEnum.INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, InvokeHostFunctionResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionSuccessPreImage.cs b/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionSuccessPreImage.cs new file mode 100644 index 00000000..f2cc7309 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/InvokeHostFunctionSuccessPreImage.cs @@ -0,0 +1,40 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct InvokeHostFunctionSuccessPreImage +// { +// SCVal returnValue; +// ContractEvent events<>; +// }; + +// =========================================================================== +public class InvokeHostFunctionSuccessPreImage +{ + public SCVal ReturnValue { get; set; } + public ContractEvent[] Events { get; set; } + + public static void Encode(XdrDataOutputStream stream, + InvokeHostFunctionSuccessPreImage encodedInvokeHostFunctionSuccessPreImage) + { + SCVal.Encode(stream, encodedInvokeHostFunctionSuccessPreImage.ReturnValue); + var eventssize = encodedInvokeHostFunctionSuccessPreImage.Events.Length; + stream.WriteInt(eventssize); + for (var i = 0; i < eventssize; i++) + ContractEvent.Encode(stream, encodedInvokeHostFunctionSuccessPreImage.Events[i]); + } + + public static InvokeHostFunctionSuccessPreImage Decode(XdrDataInputStream stream) + { + var decodedInvokeHostFunctionSuccessPreImage = new InvokeHostFunctionSuccessPreImage(); + decodedInvokeHostFunctionSuccessPreImage.ReturnValue = SCVal.Decode(stream); + var eventssize = stream.ReadInt(); + decodedInvokeHostFunctionSuccessPreImage.Events = new ContractEvent[eventssize]; + for (var i = 0; i < eventssize; i++) + decodedInvokeHostFunctionSuccessPreImage.Events[i] = ContractEvent.Decode(stream); + return decodedInvokeHostFunctionSuccessPreImage; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerBounds.cs b/stellar-dotnet-sdk-xdr/generated/LedgerBounds.cs index b2f13539..7a00fb8e 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerBounds.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerBounds.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct LedgerBounds +// { +// uint32 minLedger; +// uint32 maxLedger; // 0 here means no maxLedger +// }; - // struct LedgerBounds - // { - // uint32 minLedger; - // uint32 maxLedger; // 0 here means no maxLedger - // }; +// =========================================================================== +public class LedgerBounds +{ + public Uint32 MinLedger { get; set; } + public Uint32 MaxLedger { get; set; } - // =========================================================================== - public class LedgerBounds + public static void Encode(XdrDataOutputStream stream, LedgerBounds encodedLedgerBounds) { - public LedgerBounds() { } - public Uint32 MinLedger { get; set; } - public Uint32 MaxLedger { get; set; } + Uint32.Encode(stream, encodedLedgerBounds.MinLedger); + Uint32.Encode(stream, encodedLedgerBounds.MaxLedger); + } - public static void Encode(XdrDataOutputStream stream, LedgerBounds encodedLedgerBounds) - { - Uint32.Encode(stream, encodedLedgerBounds.MinLedger); - Uint32.Encode(stream, encodedLedgerBounds.MaxLedger); - } - public static LedgerBounds Decode(XdrDataInputStream stream) - { - LedgerBounds decodedLedgerBounds = new LedgerBounds(); - decodedLedgerBounds.MinLedger = Uint32.Decode(stream); - decodedLedgerBounds.MaxLedger = Uint32.Decode(stream); - return decodedLedgerBounds; - } + public static LedgerBounds Decode(XdrDataInputStream stream) + { + var decodedLedgerBounds = new LedgerBounds(); + decodedLedgerBounds.MinLedger = Uint32.Decode(stream); + decodedLedgerBounds.MaxLedger = Uint32.Decode(stream); + return decodedLedgerBounds; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerCloseMeta.cs b/stellar-dotnet-sdk-xdr/generated/LedgerCloseMeta.cs index 4dd8b54b..212d12d7 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerCloseMeta.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerCloseMeta.cs @@ -1,48 +1,55 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union LedgerCloseMeta switch (int v) - // { - // case 0: - // LedgerCloseMetaV0 v0; - // }; +// union LedgerCloseMeta switch (int v) +// { +// case 0: +// LedgerCloseMetaV0 v0; +// case 1: +// LedgerCloseMetaV1 v1; +// }; - // =========================================================================== - public class LedgerCloseMeta - { - public LedgerCloseMeta() { } +// =========================================================================== +public class LedgerCloseMeta +{ + public int Discriminant { get; set; } - public int Discriminant { get; set; } = new int(); + public LedgerCloseMetaV0 V0 { get; set; } + public LedgerCloseMetaV1 V1 { get; set; } - public LedgerCloseMetaV0 V0 { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerCloseMeta encodedLedgerCloseMeta) + public static void Encode(XdrDataOutputStream stream, LedgerCloseMeta encodedLedgerCloseMeta) + { + stream.WriteInt(encodedLedgerCloseMeta.Discriminant); + switch (encodedLedgerCloseMeta.Discriminant) { - stream.WriteInt((int)encodedLedgerCloseMeta.Discriminant); - switch (encodedLedgerCloseMeta.Discriminant) - { - case 0: - LedgerCloseMetaV0.Encode(stream, encodedLedgerCloseMeta.V0); - break; - } + case 0: + LedgerCloseMetaV0.Encode(stream, encodedLedgerCloseMeta.V0); + break; + case 1: + LedgerCloseMetaV1.Encode(stream, encodedLedgerCloseMeta.V1); + break; } - public static LedgerCloseMeta Decode(XdrDataInputStream stream) + } + + public static LedgerCloseMeta Decode(XdrDataInputStream stream) + { + var decodedLedgerCloseMeta = new LedgerCloseMeta(); + var discriminant = stream.ReadInt(); + decodedLedgerCloseMeta.Discriminant = discriminant; + switch (decodedLedgerCloseMeta.Discriminant) { - LedgerCloseMeta decodedLedgerCloseMeta = new LedgerCloseMeta(); - int discriminant = stream.ReadInt(); - decodedLedgerCloseMeta.Discriminant = discriminant; - switch (decodedLedgerCloseMeta.Discriminant) - { - case 0: - decodedLedgerCloseMeta.V0 = LedgerCloseMetaV0.Decode(stream); - break; - } - return decodedLedgerCloseMeta; + case 0: + decodedLedgerCloseMeta.V0 = LedgerCloseMetaV0.Decode(stream); + break; + case 1: + decodedLedgerCloseMeta.V1 = LedgerCloseMetaV1.Decode(stream); + break; } + + return decodedLedgerCloseMeta; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerCloseMetaV0.cs b/stellar-dotnet-sdk-xdr/generated/LedgerCloseMetaV0.cs index c7235a45..5ca2cc3b 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerCloseMetaV0.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerCloseMetaV0.cs @@ -1,87 +1,70 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct LedgerCloseMetaV0 +// { +// 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<>; +// }; - // struct LedgerCloseMetaV0 - // { - // 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<>; - // }; +// =========================================================================== +public class LedgerCloseMetaV0 +{ + public LedgerHeaderHistoryEntry LedgerHeader { get; set; } + public TransactionSet TxSet { get; set; } + public TransactionResultMeta[] TxProcessing { get; set; } + public UpgradeEntryMeta[] UpgradesProcessing { get; set; } + public SCPHistoryEntry[] ScpInfo { get; set; } - // =========================================================================== - public class LedgerCloseMetaV0 + public static void Encode(XdrDataOutputStream stream, LedgerCloseMetaV0 encodedLedgerCloseMetaV0) { - public LedgerCloseMetaV0() { } - public LedgerHeaderHistoryEntry LedgerHeader { get; set; } - public TransactionSet TxSet { get; set; } - public TransactionResultMeta[] TxProcessing { get; set; } - public UpgradeEntryMeta[] UpgradesProcessing { get; set; } - public SCPHistoryEntry[] ScpInfo { get; set; } + LedgerHeaderHistoryEntry.Encode(stream, encodedLedgerCloseMetaV0.LedgerHeader); + TransactionSet.Encode(stream, encodedLedgerCloseMetaV0.TxSet); + var txProcessingsize = encodedLedgerCloseMetaV0.TxProcessing.Length; + stream.WriteInt(txProcessingsize); + for (var i = 0; i < txProcessingsize; i++) + TransactionResultMeta.Encode(stream, encodedLedgerCloseMetaV0.TxProcessing[i]); + var upgradesProcessingsize = encodedLedgerCloseMetaV0.UpgradesProcessing.Length; + stream.WriteInt(upgradesProcessingsize); + for (var i = 0; i < upgradesProcessingsize; i++) + UpgradeEntryMeta.Encode(stream, encodedLedgerCloseMetaV0.UpgradesProcessing[i]); + var scpInfosize = encodedLedgerCloseMetaV0.ScpInfo.Length; + stream.WriteInt(scpInfosize); + for (var i = 0; i < scpInfosize; i++) SCPHistoryEntry.Encode(stream, encodedLedgerCloseMetaV0.ScpInfo[i]); + } - public static void Encode(XdrDataOutputStream stream, LedgerCloseMetaV0 encodedLedgerCloseMetaV0) - { - LedgerHeaderHistoryEntry.Encode(stream, encodedLedgerCloseMetaV0.LedgerHeader); - TransactionSet.Encode(stream, encodedLedgerCloseMetaV0.TxSet); - int txProcessingsize = encodedLedgerCloseMetaV0.TxProcessing.Length; - stream.WriteInt(txProcessingsize); - for (int i = 0; i < txProcessingsize; i++) - { - TransactionResultMeta.Encode(stream, encodedLedgerCloseMetaV0.TxProcessing[i]); - } - int upgradesProcessingsize = encodedLedgerCloseMetaV0.UpgradesProcessing.Length; - stream.WriteInt(upgradesProcessingsize); - for (int i = 0; i < upgradesProcessingsize; i++) - { - UpgradeEntryMeta.Encode(stream, encodedLedgerCloseMetaV0.UpgradesProcessing[i]); - } - int scpInfosize = encodedLedgerCloseMetaV0.ScpInfo.Length; - stream.WriteInt(scpInfosize); - for (int i = 0; i < scpInfosize; i++) - { - SCPHistoryEntry.Encode(stream, encodedLedgerCloseMetaV0.ScpInfo[i]); - } - } - public static LedgerCloseMetaV0 Decode(XdrDataInputStream stream) - { - LedgerCloseMetaV0 decodedLedgerCloseMetaV0 = new LedgerCloseMetaV0(); - decodedLedgerCloseMetaV0.LedgerHeader = LedgerHeaderHistoryEntry.Decode(stream); - decodedLedgerCloseMetaV0.TxSet = TransactionSet.Decode(stream); - int txProcessingsize = stream.ReadInt(); - decodedLedgerCloseMetaV0.TxProcessing = new TransactionResultMeta[txProcessingsize]; - for (int i = 0; i < txProcessingsize; i++) - { - decodedLedgerCloseMetaV0.TxProcessing[i] = TransactionResultMeta.Decode(stream); - } - int upgradesProcessingsize = stream.ReadInt(); - decodedLedgerCloseMetaV0.UpgradesProcessing = new UpgradeEntryMeta[upgradesProcessingsize]; - for (int i = 0; i < upgradesProcessingsize; i++) - { - decodedLedgerCloseMetaV0.UpgradesProcessing[i] = UpgradeEntryMeta.Decode(stream); - } - int scpInfosize = stream.ReadInt(); - decodedLedgerCloseMetaV0.ScpInfo = new SCPHistoryEntry[scpInfosize]; - for (int i = 0; i < scpInfosize; i++) - { - decodedLedgerCloseMetaV0.ScpInfo[i] = SCPHistoryEntry.Decode(stream); - } - return decodedLedgerCloseMetaV0; - } + public static LedgerCloseMetaV0 Decode(XdrDataInputStream stream) + { + var decodedLedgerCloseMetaV0 = new LedgerCloseMetaV0(); + decodedLedgerCloseMetaV0.LedgerHeader = LedgerHeaderHistoryEntry.Decode(stream); + decodedLedgerCloseMetaV0.TxSet = TransactionSet.Decode(stream); + var txProcessingsize = stream.ReadInt(); + decodedLedgerCloseMetaV0.TxProcessing = new TransactionResultMeta[txProcessingsize]; + for (var i = 0; i < txProcessingsize; i++) + decodedLedgerCloseMetaV0.TxProcessing[i] = TransactionResultMeta.Decode(stream); + var upgradesProcessingsize = stream.ReadInt(); + decodedLedgerCloseMetaV0.UpgradesProcessing = new UpgradeEntryMeta[upgradesProcessingsize]; + for (var i = 0; i < upgradesProcessingsize; i++) + decodedLedgerCloseMetaV0.UpgradesProcessing[i] = UpgradeEntryMeta.Decode(stream); + var scpInfosize = stream.ReadInt(); + decodedLedgerCloseMetaV0.ScpInfo = new SCPHistoryEntry[scpInfosize]; + for (var i = 0; i < scpInfosize; i++) decodedLedgerCloseMetaV0.ScpInfo[i] = SCPHistoryEntry.Decode(stream); + return decodedLedgerCloseMetaV0; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerCloseMetaV1.cs b/stellar-dotnet-sdk-xdr/generated/LedgerCloseMetaV1.cs new file mode 100644 index 00000000..342c10e9 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/LedgerCloseMetaV1.cs @@ -0,0 +1,109 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct LedgerCloseMetaV1 +// { +// // We forgot to add an ExtensionPoint in v0 but at least +// // we can add one now in v1. +// ExtensionPoint 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 BucketList, to support downstream +// // systems calculating storage fees correctly. +// uint64 totalByteSizeOfBucketList; +// +// // Temp keys that are being evicted at this ledger. +// LedgerKey evictedTemporaryLedgerKeys<>; +// +// // Archived restorable ledger entries that are being +// // evicted at this ledger. +// LedgerEntry evictedPersistentLedgerEntries<>; +// }; + +// =========================================================================== +public class LedgerCloseMetaV1 +{ + public ExtensionPoint Ext { get; set; } + public LedgerHeaderHistoryEntry LedgerHeader { get; set; } + public GeneralizedTransactionSet TxSet { get; set; } + public TransactionResultMeta[] TxProcessing { get; set; } + public UpgradeEntryMeta[] UpgradesProcessing { get; set; } + public SCPHistoryEntry[] ScpInfo { get; set; } + public Uint64 TotalByteSizeOfBucketList { get; set; } + public LedgerKey[] EvictedTemporaryLedgerKeys { get; set; } + public LedgerEntry[] EvictedPersistentLedgerEntries { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerCloseMetaV1 encodedLedgerCloseMetaV1) + { + ExtensionPoint.Encode(stream, encodedLedgerCloseMetaV1.Ext); + LedgerHeaderHistoryEntry.Encode(stream, encodedLedgerCloseMetaV1.LedgerHeader); + GeneralizedTransactionSet.Encode(stream, encodedLedgerCloseMetaV1.TxSet); + var txProcessingsize = encodedLedgerCloseMetaV1.TxProcessing.Length; + stream.WriteInt(txProcessingsize); + for (var i = 0; i < txProcessingsize; i++) + TransactionResultMeta.Encode(stream, encodedLedgerCloseMetaV1.TxProcessing[i]); + var upgradesProcessingsize = encodedLedgerCloseMetaV1.UpgradesProcessing.Length; + stream.WriteInt(upgradesProcessingsize); + for (var i = 0; i < upgradesProcessingsize; i++) + UpgradeEntryMeta.Encode(stream, encodedLedgerCloseMetaV1.UpgradesProcessing[i]); + var scpInfosize = encodedLedgerCloseMetaV1.ScpInfo.Length; + stream.WriteInt(scpInfosize); + for (var i = 0; i < scpInfosize; i++) SCPHistoryEntry.Encode(stream, encodedLedgerCloseMetaV1.ScpInfo[i]); + Uint64.Encode(stream, encodedLedgerCloseMetaV1.TotalByteSizeOfBucketList); + var evictedTemporaryLedgerKeyssize = encodedLedgerCloseMetaV1.EvictedTemporaryLedgerKeys.Length; + stream.WriteInt(evictedTemporaryLedgerKeyssize); + for (var i = 0; i < evictedTemporaryLedgerKeyssize; i++) + LedgerKey.Encode(stream, encodedLedgerCloseMetaV1.EvictedTemporaryLedgerKeys[i]); + var evictedPersistentLedgerEntriessize = encodedLedgerCloseMetaV1.EvictedPersistentLedgerEntries.Length; + stream.WriteInt(evictedPersistentLedgerEntriessize); + for (var i = 0; i < evictedPersistentLedgerEntriessize; i++) + LedgerEntry.Encode(stream, encodedLedgerCloseMetaV1.EvictedPersistentLedgerEntries[i]); + } + + public static LedgerCloseMetaV1 Decode(XdrDataInputStream stream) + { + var decodedLedgerCloseMetaV1 = new LedgerCloseMetaV1(); + decodedLedgerCloseMetaV1.Ext = ExtensionPoint.Decode(stream); + decodedLedgerCloseMetaV1.LedgerHeader = LedgerHeaderHistoryEntry.Decode(stream); + decodedLedgerCloseMetaV1.TxSet = GeneralizedTransactionSet.Decode(stream); + var txProcessingsize = stream.ReadInt(); + decodedLedgerCloseMetaV1.TxProcessing = new TransactionResultMeta[txProcessingsize]; + for (var i = 0; i < txProcessingsize; i++) + decodedLedgerCloseMetaV1.TxProcessing[i] = TransactionResultMeta.Decode(stream); + var upgradesProcessingsize = stream.ReadInt(); + decodedLedgerCloseMetaV1.UpgradesProcessing = new UpgradeEntryMeta[upgradesProcessingsize]; + for (var i = 0; i < upgradesProcessingsize; i++) + decodedLedgerCloseMetaV1.UpgradesProcessing[i] = UpgradeEntryMeta.Decode(stream); + var scpInfosize = stream.ReadInt(); + decodedLedgerCloseMetaV1.ScpInfo = new SCPHistoryEntry[scpInfosize]; + for (var i = 0; i < scpInfosize; i++) decodedLedgerCloseMetaV1.ScpInfo[i] = SCPHistoryEntry.Decode(stream); + decodedLedgerCloseMetaV1.TotalByteSizeOfBucketList = Uint64.Decode(stream); + var evictedTemporaryLedgerKeyssize = stream.ReadInt(); + decodedLedgerCloseMetaV1.EvictedTemporaryLedgerKeys = new LedgerKey[evictedTemporaryLedgerKeyssize]; + for (var i = 0; i < evictedTemporaryLedgerKeyssize; i++) + decodedLedgerCloseMetaV1.EvictedTemporaryLedgerKeys[i] = LedgerKey.Decode(stream); + var evictedPersistentLedgerEntriessize = stream.ReadInt(); + decodedLedgerCloseMetaV1.EvictedPersistentLedgerEntries = new LedgerEntry[evictedPersistentLedgerEntriessize]; + for (var i = 0; i < evictedPersistentLedgerEntriessize; i++) + decodedLedgerCloseMetaV1.EvictedPersistentLedgerEntries[i] = LedgerEntry.Decode(stream); + return decodedLedgerCloseMetaV1; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerCloseValueSignature.cs b/stellar-dotnet-sdk-xdr/generated/LedgerCloseValueSignature.cs index 048173b1..d7e87cc6 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerCloseValueSignature.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerCloseValueSignature.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct LedgerCloseValueSignature +// { +// NodeID nodeID; // which node introduced the value +// Signature signature; // nodeID's signature +// }; - // struct LedgerCloseValueSignature - // { - // NodeID nodeID; // which node introduced the value - // Signature signature; // nodeID's signature - // }; +// =========================================================================== +public class LedgerCloseValueSignature +{ + public NodeID NodeID { get; set; } + public Signature Signature { get; set; } - // =========================================================================== - public class LedgerCloseValueSignature + public static void Encode(XdrDataOutputStream stream, LedgerCloseValueSignature encodedLedgerCloseValueSignature) { - public LedgerCloseValueSignature() { } - public NodeID NodeID { get; set; } - public Signature Signature { get; set; } + NodeID.Encode(stream, encodedLedgerCloseValueSignature.NodeID); + Signature.Encode(stream, encodedLedgerCloseValueSignature.Signature); + } - public static void Encode(XdrDataOutputStream stream, LedgerCloseValueSignature encodedLedgerCloseValueSignature) - { - NodeID.Encode(stream, encodedLedgerCloseValueSignature.NodeID); - Signature.Encode(stream, encodedLedgerCloseValueSignature.Signature); - } - public static LedgerCloseValueSignature Decode(XdrDataInputStream stream) - { - LedgerCloseValueSignature decodedLedgerCloseValueSignature = new LedgerCloseValueSignature(); - decodedLedgerCloseValueSignature.NodeID = NodeID.Decode(stream); - decodedLedgerCloseValueSignature.Signature = Signature.Decode(stream); - return decodedLedgerCloseValueSignature; - } + public static LedgerCloseValueSignature Decode(XdrDataInputStream stream) + { + var decodedLedgerCloseValueSignature = new LedgerCloseValueSignature(); + decodedLedgerCloseValueSignature.NodeID = NodeID.Decode(stream); + decodedLedgerCloseValueSignature.Signature = Signature.Decode(stream); + return decodedLedgerCloseValueSignature; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerEntry.cs b/stellar-dotnet-sdk-xdr/generated/LedgerEntry.cs index 4346d84a..622cbab3 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerEntry.cs @@ -1,169 +1,203 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct LedgerEntry +// { +// uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed +// +// union switch (LedgerEntryType type) +// { +// case ACCOUNT: +// AccountEntry account; +// case TRUSTLINE: +// TrustLineEntry trustLine; +// case OFFER: +// OfferEntry offer; +// case DATA: +// DataEntry data; +// case CLAIMABLE_BALANCE: +// ClaimableBalanceEntry claimableBalance; +// case LIQUIDITY_POOL: +// LiquidityPoolEntry liquidityPool; +// case CONTRACT_DATA: +// ContractDataEntry contractData; +// case CONTRACT_CODE: +// ContractCodeEntry contractCode; +// case CONFIG_SETTING: +// ConfigSettingEntry configSetting; +// case TTL: +// TTLEntry ttl; +// } +// data; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// LedgerEntryExtensionV1 v1; +// } +// ext; +// }; + +// =========================================================================== +public class LedgerEntry { + public Uint32 LastModifiedLedgerSeq { get; set; } + public LedgerEntryData Data { get; set; } + public LedgerEntryExt Ext { get; set; } - // === xdr source ============================================================ - - // struct LedgerEntry - // { - // uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed - // - // union switch (LedgerEntryType type) - // { - // case ACCOUNT: - // AccountEntry account; - // case TRUSTLINE: - // TrustLineEntry trustLine; - // case OFFER: - // OfferEntry offer; - // case DATA: - // DataEntry data; - // case CLAIMABLE_BALANCE: - // ClaimableBalanceEntry claimableBalance; - // case LIQUIDITY_POOL: - // LiquidityPoolEntry liquidityPool; - // } - // data; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // case 1: - // LedgerEntryExtensionV1 v1; - // } - // ext; - // }; - - // =========================================================================== - public class LedgerEntry + public static void Encode(XdrDataOutputStream stream, LedgerEntry encodedLedgerEntry) { - public LedgerEntry() { } - public Uint32 LastModifiedLedgerSeq { get; set; } - public LedgerEntryData Data { get; set; } - public LedgerEntryExt Ext { get; set; } + Uint32.Encode(stream, encodedLedgerEntry.LastModifiedLedgerSeq); + LedgerEntryData.Encode(stream, encodedLedgerEntry.Data); + LedgerEntryExt.Encode(stream, encodedLedgerEntry.Ext); + } - public static void Encode(XdrDataOutputStream stream, LedgerEntry encodedLedgerEntry) - { - Uint32.Encode(stream, encodedLedgerEntry.LastModifiedLedgerSeq); - LedgerEntryData.Encode(stream, encodedLedgerEntry.Data); - LedgerEntryExt.Encode(stream, encodedLedgerEntry.Ext); - } - public static LedgerEntry Decode(XdrDataInputStream stream) - { - LedgerEntry decodedLedgerEntry = new LedgerEntry(); - decodedLedgerEntry.LastModifiedLedgerSeq = Uint32.Decode(stream); - decodedLedgerEntry.Data = LedgerEntryData.Decode(stream); - decodedLedgerEntry.Ext = LedgerEntryExt.Decode(stream); - return decodedLedgerEntry; - } + public static LedgerEntry Decode(XdrDataInputStream stream) + { + var decodedLedgerEntry = new LedgerEntry(); + decodedLedgerEntry.LastModifiedLedgerSeq = Uint32.Decode(stream); + decodedLedgerEntry.Data = LedgerEntryData.Decode(stream); + decodedLedgerEntry.Ext = LedgerEntryExt.Decode(stream); + return decodedLedgerEntry; + } - public class LedgerEntryData - { - public LedgerEntryData() { } + public class LedgerEntryData + { + public LedgerEntryType Discriminant { get; set; } = new(); - public LedgerEntryType Discriminant { get; set; } = new LedgerEntryType(); + public AccountEntry Account { get; set; } + public TrustLineEntry TrustLine { get; set; } + public OfferEntry Offer { get; set; } + public DataEntry Data { get; set; } + public ClaimableBalanceEntry ClaimableBalance { get; set; } + public LiquidityPoolEntry LiquidityPool { get; set; } + public ContractDataEntry ContractData { get; set; } + public ContractCodeEntry ContractCode { get; set; } + public ConfigSettingEntry ConfigSetting { get; set; } + public TTLEntry Ttl { get; set; } - public AccountEntry Account { get; set; } - public TrustLineEntry TrustLine { get; set; } - public OfferEntry Offer { get; set; } - public DataEntry Data { get; set; } - public ClaimableBalanceEntry ClaimableBalance { get; set; } - public LiquidityPoolEntry LiquidityPool { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerEntryData encodedLedgerEntryData) + public static void Encode(XdrDataOutputStream stream, LedgerEntryData encodedLedgerEntryData) + { + stream.WriteInt((int)encodedLedgerEntryData.Discriminant.InnerValue); + switch (encodedLedgerEntryData.Discriminant.InnerValue) { - stream.WriteInt((int)encodedLedgerEntryData.Discriminant.InnerValue); - switch (encodedLedgerEntryData.Discriminant.InnerValue) - { - case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: - AccountEntry.Encode(stream, encodedLedgerEntryData.Account); - break; - case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: - TrustLineEntry.Encode(stream, encodedLedgerEntryData.TrustLine); - break; - case LedgerEntryType.LedgerEntryTypeEnum.OFFER: - OfferEntry.Encode(stream, encodedLedgerEntryData.Offer); - break; - case LedgerEntryType.LedgerEntryTypeEnum.DATA: - DataEntry.Encode(stream, encodedLedgerEntryData.Data); - break; - case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE: - ClaimableBalanceEntry.Encode(stream, encodedLedgerEntryData.ClaimableBalance); - break; - case LedgerEntryType.LedgerEntryTypeEnum.LIQUIDITY_POOL: - LiquidityPoolEntry.Encode(stream, encodedLedgerEntryData.LiquidityPool); - break; - } + case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: + AccountEntry.Encode(stream, encodedLedgerEntryData.Account); + break; + case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: + TrustLineEntry.Encode(stream, encodedLedgerEntryData.TrustLine); + break; + case LedgerEntryType.LedgerEntryTypeEnum.OFFER: + OfferEntry.Encode(stream, encodedLedgerEntryData.Offer); + break; + case LedgerEntryType.LedgerEntryTypeEnum.DATA: + DataEntry.Encode(stream, encodedLedgerEntryData.Data); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE: + ClaimableBalanceEntry.Encode(stream, encodedLedgerEntryData.ClaimableBalance); + break; + case LedgerEntryType.LedgerEntryTypeEnum.LIQUIDITY_POOL: + LiquidityPoolEntry.Encode(stream, encodedLedgerEntryData.LiquidityPool); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONTRACT_DATA: + ContractDataEntry.Encode(stream, encodedLedgerEntryData.ContractData); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONTRACT_CODE: + ContractCodeEntry.Encode(stream, encodedLedgerEntryData.ContractCode); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONFIG_SETTING: + ConfigSettingEntry.Encode(stream, encodedLedgerEntryData.ConfigSetting); + break; + case LedgerEntryType.LedgerEntryTypeEnum.TTL: + TTLEntry.Encode(stream, encodedLedgerEntryData.Ttl); + break; } - public static LedgerEntryData Decode(XdrDataInputStream stream) + } + + public static LedgerEntryData Decode(XdrDataInputStream stream) + { + var decodedLedgerEntryData = new LedgerEntryData(); + var discriminant = LedgerEntryType.Decode(stream); + decodedLedgerEntryData.Discriminant = discriminant; + switch (decodedLedgerEntryData.Discriminant.InnerValue) { - LedgerEntryData decodedLedgerEntryData = new LedgerEntryData(); - LedgerEntryType discriminant = LedgerEntryType.Decode(stream); - decodedLedgerEntryData.Discriminant = discriminant; - switch (decodedLedgerEntryData.Discriminant.InnerValue) - { - case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: - decodedLedgerEntryData.Account = AccountEntry.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: - decodedLedgerEntryData.TrustLine = TrustLineEntry.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.OFFER: - decodedLedgerEntryData.Offer = OfferEntry.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.DATA: - decodedLedgerEntryData.Data = DataEntry.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE: - decodedLedgerEntryData.ClaimableBalance = ClaimableBalanceEntry.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.LIQUIDITY_POOL: - decodedLedgerEntryData.LiquidityPool = LiquidityPoolEntry.Decode(stream); - break; - } - return decodedLedgerEntryData; + case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: + decodedLedgerEntryData.Account = AccountEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: + decodedLedgerEntryData.TrustLine = TrustLineEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.OFFER: + decodedLedgerEntryData.Offer = OfferEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.DATA: + decodedLedgerEntryData.Data = DataEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE: + decodedLedgerEntryData.ClaimableBalance = ClaimableBalanceEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.LIQUIDITY_POOL: + decodedLedgerEntryData.LiquidityPool = LiquidityPoolEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONTRACT_DATA: + decodedLedgerEntryData.ContractData = ContractDataEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONTRACT_CODE: + decodedLedgerEntryData.ContractCode = ContractCodeEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONFIG_SETTING: + decodedLedgerEntryData.ConfigSetting = ConfigSettingEntry.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.TTL: + decodedLedgerEntryData.Ttl = TTLEntry.Decode(stream); + break; } + return decodedLedgerEntryData; } - public class LedgerEntryExt - { - public LedgerEntryExt() { } + } - public int Discriminant { get; set; } = new int(); + public class LedgerEntryExt + { + public int Discriminant { get; set; } + + public LedgerEntryExtensionV1 V1 { get; set; } - public LedgerEntryExtensionV1 V1 { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerEntryExt encodedLedgerEntryExt) + public static void Encode(XdrDataOutputStream stream, LedgerEntryExt encodedLedgerEntryExt) + { + stream.WriteInt(encodedLedgerEntryExt.Discriminant); + switch (encodedLedgerEntryExt.Discriminant) { - stream.WriteInt((int)encodedLedgerEntryExt.Discriminant); - switch (encodedLedgerEntryExt.Discriminant) - { - case 0: - break; - case 1: - LedgerEntryExtensionV1.Encode(stream, encodedLedgerEntryExt.V1); - break; - } + case 0: + break; + case 1: + LedgerEntryExtensionV1.Encode(stream, encodedLedgerEntryExt.V1); + break; } - public static LedgerEntryExt Decode(XdrDataInputStream stream) + } + + public static LedgerEntryExt Decode(XdrDataInputStream stream) + { + var decodedLedgerEntryExt = new LedgerEntryExt(); + var discriminant = stream.ReadInt(); + decodedLedgerEntryExt.Discriminant = discriminant; + switch (decodedLedgerEntryExt.Discriminant) { - LedgerEntryExt decodedLedgerEntryExt = new LedgerEntryExt(); - int discriminant = stream.ReadInt(); - decodedLedgerEntryExt.Discriminant = discriminant; - switch (decodedLedgerEntryExt.Discriminant) - { - case 0: - break; - case 1: - decodedLedgerEntryExt.V1 = LedgerEntryExtensionV1.Decode(stream); - break; - } - return decodedLedgerEntryExt; + case 0: + break; + case 1: + decodedLedgerEntryExt.V1 = LedgerEntryExtensionV1.Decode(stream); + break; } + return decodedLedgerEntryExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerEntryChange.cs b/stellar-dotnet-sdk-xdr/generated/LedgerEntryChange.cs index e8b4298f..11ff2b49 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerEntryChange.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerEntryChange.cs @@ -1,75 +1,73 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union LedgerEntryChange switch (LedgerEntryChangeType type) - // { - // case LEDGER_ENTRY_CREATED: - // LedgerEntry created; - // case LEDGER_ENTRY_UPDATED: - // LedgerEntry updated; - // case LEDGER_ENTRY_REMOVED: - // LedgerKey removed; - // case LEDGER_ENTRY_STATE: - // LedgerEntry state; - // }; +// union LedgerEntryChange switch (LedgerEntryChangeType type) +// { +// case LEDGER_ENTRY_CREATED: +// LedgerEntry created; +// case LEDGER_ENTRY_UPDATED: +// LedgerEntry updated; +// case LEDGER_ENTRY_REMOVED: +// LedgerKey removed; +// case LEDGER_ENTRY_STATE: +// LedgerEntry state; +// }; - // =========================================================================== - public class LedgerEntryChange - { - public LedgerEntryChange() { } +// =========================================================================== +public class LedgerEntryChange +{ + public LedgerEntryChangeType Discriminant { get; set; } = new(); - public LedgerEntryChangeType Discriminant { get; set; } = new LedgerEntryChangeType(); + public LedgerEntry Created { get; set; } + public LedgerEntry Updated { get; set; } + public LedgerKey Removed { get; set; } + public LedgerEntry State { get; set; } - public LedgerEntry Created { get; set; } - public LedgerEntry Updated { get; set; } - public LedgerKey Removed { get; set; } - public LedgerEntry State { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerEntryChange encodedLedgerEntryChange) + public static void Encode(XdrDataOutputStream stream, LedgerEntryChange encodedLedgerEntryChange) + { + stream.WriteInt((int)encodedLedgerEntryChange.Discriminant.InnerValue); + switch (encodedLedgerEntryChange.Discriminant.InnerValue) { - stream.WriteInt((int)encodedLedgerEntryChange.Discriminant.InnerValue); - switch (encodedLedgerEntryChange.Discriminant.InnerValue) - { - case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_CREATED: - LedgerEntry.Encode(stream, encodedLedgerEntryChange.Created); - break; - case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_UPDATED: - LedgerEntry.Encode(stream, encodedLedgerEntryChange.Updated); - break; - case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_REMOVED: - LedgerKey.Encode(stream, encodedLedgerEntryChange.Removed); - break; - case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_STATE: - LedgerEntry.Encode(stream, encodedLedgerEntryChange.State); - break; - } + case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_CREATED: + LedgerEntry.Encode(stream, encodedLedgerEntryChange.Created); + break; + case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_UPDATED: + LedgerEntry.Encode(stream, encodedLedgerEntryChange.Updated); + break; + case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_REMOVED: + LedgerKey.Encode(stream, encodedLedgerEntryChange.Removed); + break; + case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_STATE: + LedgerEntry.Encode(stream, encodedLedgerEntryChange.State); + break; } - public static LedgerEntryChange Decode(XdrDataInputStream stream) + } + + public static LedgerEntryChange Decode(XdrDataInputStream stream) + { + var decodedLedgerEntryChange = new LedgerEntryChange(); + var discriminant = LedgerEntryChangeType.Decode(stream); + decodedLedgerEntryChange.Discriminant = discriminant; + switch (decodedLedgerEntryChange.Discriminant.InnerValue) { - LedgerEntryChange decodedLedgerEntryChange = new LedgerEntryChange(); - LedgerEntryChangeType discriminant = LedgerEntryChangeType.Decode(stream); - decodedLedgerEntryChange.Discriminant = discriminant; - switch (decodedLedgerEntryChange.Discriminant.InnerValue) - { - case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_CREATED: - decodedLedgerEntryChange.Created = LedgerEntry.Decode(stream); - break; - case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_UPDATED: - decodedLedgerEntryChange.Updated = LedgerEntry.Decode(stream); - break; - case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_REMOVED: - decodedLedgerEntryChange.Removed = LedgerKey.Decode(stream); - break; - case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_STATE: - decodedLedgerEntryChange.State = LedgerEntry.Decode(stream); - break; - } - return decodedLedgerEntryChange; + case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_CREATED: + decodedLedgerEntryChange.Created = LedgerEntry.Decode(stream); + break; + case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_UPDATED: + decodedLedgerEntryChange.Updated = LedgerEntry.Decode(stream); + break; + case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_REMOVED: + decodedLedgerEntryChange.Removed = LedgerKey.Decode(stream); + break; + case LedgerEntryChangeType.LedgerEntryChangeTypeEnum.LEDGER_ENTRY_STATE: + decodedLedgerEntryChange.State = LedgerEntry.Decode(stream); + break; } + + return decodedLedgerEntryChange; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerEntryChangeType.cs b/stellar-dotnet-sdk-xdr/generated/LedgerEntryChangeType.cs index 2bfc3405..e6db0e66 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerEntryChangeType.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerEntryChangeType.cs @@ -1,57 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum LedgerEntryChangeType - // { - // LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger - // LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger - // LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger - // LEDGER_ENTRY_STATE = 3 // value of the entry - // }; +// enum LedgerEntryChangeType +// { +// LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger +// LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger +// LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger +// LEDGER_ENTRY_STATE = 3 // value of the entry +// }; - // =========================================================================== - public class LedgerEntryChangeType +// =========================================================================== +public class LedgerEntryChangeType +{ + public enum LedgerEntryChangeTypeEnum { - public enum LedgerEntryChangeTypeEnum - { - LEDGER_ENTRY_CREATED = 0, - LEDGER_ENTRY_UPDATED = 1, - LEDGER_ENTRY_REMOVED = 2, - LEDGER_ENTRY_STATE = 3, - } - public LedgerEntryChangeTypeEnum InnerValue { get; set; } = default(LedgerEntryChangeTypeEnum); + LEDGER_ENTRY_CREATED = 0, + LEDGER_ENTRY_UPDATED = 1, + LEDGER_ENTRY_REMOVED = 2, + LEDGER_ENTRY_STATE = 3 + } - public static LedgerEntryChangeType Create(LedgerEntryChangeTypeEnum v) - { - return new LedgerEntryChangeType - { - InnerValue = v - }; - } + public LedgerEntryChangeTypeEnum InnerValue { get; set; } = default; - public static LedgerEntryChangeType Decode(XdrDataInputStream stream) + public static LedgerEntryChangeType Create(LedgerEntryChangeTypeEnum v) + { + return new LedgerEntryChangeType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_CREATED); - case 1: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_UPDATED); - case 2: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_REMOVED); - case 3: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_STATE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, LedgerEntryChangeType value) + public static LedgerEntryChangeType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_CREATED); + case 1: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_UPDATED); + case 2: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_REMOVED); + case 3: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_STATE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, LedgerEntryChangeType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerEntryChanges.cs b/stellar-dotnet-sdk-xdr/generated/LedgerEntryChanges.cs index 5e508daf..b498af76 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerEntryChanges.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerEntryChanges.cs @@ -1,45 +1,41 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef LedgerEntryChange LedgerEntryChanges<>; + +// =========================================================================== +public class LedgerEntryChanges { + public LedgerEntryChanges() + { + } - // === xdr source ============================================================ + public LedgerEntryChanges(LedgerEntryChange[] value) + { + InnerValue = value; + } + + public LedgerEntryChange[] InnerValue { get; set; } = default; - // typedef LedgerEntryChange LedgerEntryChanges<>; + public static void Encode(XdrDataOutputStream stream, LedgerEntryChanges encodedLedgerEntryChanges) + { + var LedgerEntryChangessize = encodedLedgerEntryChanges.InnerValue.Length; + stream.WriteInt(LedgerEntryChangessize); + for (var i = 0; i < LedgerEntryChangessize; i++) + LedgerEntryChange.Encode(stream, encodedLedgerEntryChanges.InnerValue[i]); + } - // =========================================================================== - public class LedgerEntryChanges + public static LedgerEntryChanges Decode(XdrDataInputStream stream) { - public LedgerEntryChange[] InnerValue { get; set; } = default(LedgerEntryChange[]); - - public LedgerEntryChanges() { } - - public LedgerEntryChanges(LedgerEntryChange[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, LedgerEntryChanges encodedLedgerEntryChanges) - { - int LedgerEntryChangessize = encodedLedgerEntryChanges.InnerValue.Length; - stream.WriteInt(LedgerEntryChangessize); - for (int i = 0; i < LedgerEntryChangessize; i++) - { - LedgerEntryChange.Encode(stream, encodedLedgerEntryChanges.InnerValue[i]); - } - } - public static LedgerEntryChanges Decode(XdrDataInputStream stream) - { - LedgerEntryChanges decodedLedgerEntryChanges = new LedgerEntryChanges(); - int LedgerEntryChangessize = stream.ReadInt(); - decodedLedgerEntryChanges.InnerValue = new LedgerEntryChange[LedgerEntryChangessize]; - for (int i = 0; i < LedgerEntryChangessize; i++) - { - decodedLedgerEntryChanges.InnerValue[i] = LedgerEntryChange.Decode(stream); - } - return decodedLedgerEntryChanges; - } + var decodedLedgerEntryChanges = new LedgerEntryChanges(); + var LedgerEntryChangessize = stream.ReadInt(); + decodedLedgerEntryChanges.InnerValue = new LedgerEntryChange[LedgerEntryChangessize]; + for (var i = 0; i < LedgerEntryChangessize; i++) + decodedLedgerEntryChanges.InnerValue[i] = LedgerEntryChange.Decode(stream); + return decodedLedgerEntryChanges; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerEntryExtensionV1.cs b/stellar-dotnet-sdk-xdr/generated/LedgerEntryExtensionV1.cs index 0ba0a432..656d8c2f 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerEntryExtensionV1.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerEntryExtensionV1.cs @@ -1,72 +1,69 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct LedgerEntryExtensionV1 +// { +// SponsorshipDescriptor sponsoringID; +// +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; + +// =========================================================================== +public class LedgerEntryExtensionV1 { + public SponsorshipDescriptor SponsoringID { get; set; } + public LedgerEntryExtensionV1Ext Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, LedgerEntryExtensionV1 encodedLedgerEntryExtensionV1) + { + SponsorshipDescriptor.Encode(stream, encodedLedgerEntryExtensionV1.SponsoringID); + LedgerEntryExtensionV1Ext.Encode(stream, encodedLedgerEntryExtensionV1.Ext); + } - // struct LedgerEntryExtensionV1 - // { - // SponsorshipDescriptor sponsoringID; - // - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static LedgerEntryExtensionV1 Decode(XdrDataInputStream stream) + { + var decodedLedgerEntryExtensionV1 = new LedgerEntryExtensionV1(); + decodedLedgerEntryExtensionV1.SponsoringID = SponsorshipDescriptor.Decode(stream); + decodedLedgerEntryExtensionV1.Ext = LedgerEntryExtensionV1Ext.Decode(stream); + return decodedLedgerEntryExtensionV1; + } - // =========================================================================== - public class LedgerEntryExtensionV1 + public class LedgerEntryExtensionV1Ext { - public LedgerEntryExtensionV1() { } - public SponsorshipDescriptor SponsoringID { get; set; } - public LedgerEntryExtensionV1Ext Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerEntryExtensionV1 encodedLedgerEntryExtensionV1) + public static void Encode(XdrDataOutputStream stream, + LedgerEntryExtensionV1Ext encodedLedgerEntryExtensionV1Ext) { - SponsorshipDescriptor.Encode(stream, encodedLedgerEntryExtensionV1.SponsoringID); - LedgerEntryExtensionV1Ext.Encode(stream, encodedLedgerEntryExtensionV1.Ext); - } - public static LedgerEntryExtensionV1 Decode(XdrDataInputStream stream) - { - LedgerEntryExtensionV1 decodedLedgerEntryExtensionV1 = new LedgerEntryExtensionV1(); - decodedLedgerEntryExtensionV1.SponsoringID = SponsorshipDescriptor.Decode(stream); - decodedLedgerEntryExtensionV1.Ext = LedgerEntryExtensionV1Ext.Decode(stream); - return decodedLedgerEntryExtensionV1; + stream.WriteInt(encodedLedgerEntryExtensionV1Ext.Discriminant); + switch (encodedLedgerEntryExtensionV1Ext.Discriminant) + { + case 0: + break; + } } - public class LedgerEntryExtensionV1Ext + public static LedgerEntryExtensionV1Ext Decode(XdrDataInputStream stream) { - public LedgerEntryExtensionV1Ext() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, LedgerEntryExtensionV1Ext encodedLedgerEntryExtensionV1Ext) - { - stream.WriteInt((int)encodedLedgerEntryExtensionV1Ext.Discriminant); - switch (encodedLedgerEntryExtensionV1Ext.Discriminant) - { - case 0: - break; - } - } - public static LedgerEntryExtensionV1Ext Decode(XdrDataInputStream stream) + var decodedLedgerEntryExtensionV1Ext = new LedgerEntryExtensionV1Ext(); + var discriminant = stream.ReadInt(); + decodedLedgerEntryExtensionV1Ext.Discriminant = discriminant; + switch (decodedLedgerEntryExtensionV1Ext.Discriminant) { - LedgerEntryExtensionV1Ext decodedLedgerEntryExtensionV1Ext = new LedgerEntryExtensionV1Ext(); - int discriminant = stream.ReadInt(); - decodedLedgerEntryExtensionV1Ext.Discriminant = discriminant; - switch (decodedLedgerEntryExtensionV1Ext.Discriminant) - { - case 0: - break; - } - return decodedLedgerEntryExtensionV1Ext; + case 0: + break; } + return decodedLedgerEntryExtensionV1Ext; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerEntryType.cs b/stellar-dotnet-sdk-xdr/generated/LedgerEntryType.cs index 1db555f8..e4918ab4 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerEntryType.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerEntryType.cs @@ -1,63 +1,75 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum LedgerEntryType - // { - // ACCOUNT = 0, - // TRUSTLINE = 1, - // OFFER = 2, - // DATA = 3, - // CLAIMABLE_BALANCE = 4, - // LIQUIDITY_POOL = 5 - // }; +// enum LedgerEntryType +// { +// ACCOUNT = 0, +// TRUSTLINE = 1, +// OFFER = 2, +// DATA = 3, +// CLAIMABLE_BALANCE = 4, +// LIQUIDITY_POOL = 5, +// CONTRACT_DATA = 6, +// CONTRACT_CODE = 7, +// CONFIG_SETTING = 8, +// TTL = 9 +// }; - // =========================================================================== - public class LedgerEntryType +// =========================================================================== +public class LedgerEntryType +{ + public enum LedgerEntryTypeEnum { - public enum LedgerEntryTypeEnum - { - ACCOUNT = 0, - TRUSTLINE = 1, - OFFER = 2, - DATA = 3, - CLAIMABLE_BALANCE = 4, - LIQUIDITY_POOL = 5, - } - public LedgerEntryTypeEnum InnerValue { get; set; } = default(LedgerEntryTypeEnum); + ACCOUNT = 0, + TRUSTLINE = 1, + OFFER = 2, + DATA = 3, + CLAIMABLE_BALANCE = 4, + LIQUIDITY_POOL = 5, + CONTRACT_DATA = 6, + CONTRACT_CODE = 7, + CONFIG_SETTING = 8, + TTL = 9 + } - public static LedgerEntryType Create(LedgerEntryTypeEnum v) - { - return new LedgerEntryType - { - InnerValue = v - }; - } + public LedgerEntryTypeEnum InnerValue { get; set; } = default; - public static LedgerEntryType Decode(XdrDataInputStream stream) + public static LedgerEntryType Create(LedgerEntryTypeEnum v) + { + return new LedgerEntryType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(LedgerEntryTypeEnum.ACCOUNT); - case 1: return Create(LedgerEntryTypeEnum.TRUSTLINE); - case 2: return Create(LedgerEntryTypeEnum.OFFER); - case 3: return Create(LedgerEntryTypeEnum.DATA); - case 4: return Create(LedgerEntryTypeEnum.CLAIMABLE_BALANCE); - case 5: return Create(LedgerEntryTypeEnum.LIQUIDITY_POOL); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, LedgerEntryType value) + public static LedgerEntryType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(LedgerEntryTypeEnum.ACCOUNT); + case 1: return Create(LedgerEntryTypeEnum.TRUSTLINE); + case 2: return Create(LedgerEntryTypeEnum.OFFER); + case 3: return Create(LedgerEntryTypeEnum.DATA); + case 4: return Create(LedgerEntryTypeEnum.CLAIMABLE_BALANCE); + case 5: return Create(LedgerEntryTypeEnum.LIQUIDITY_POOL); + case 6: return Create(LedgerEntryTypeEnum.CONTRACT_DATA); + case 7: return Create(LedgerEntryTypeEnum.CONTRACT_CODE); + case 8: return Create(LedgerEntryTypeEnum.CONFIG_SETTING); + case 9: return Create(LedgerEntryTypeEnum.TTL); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, LedgerEntryType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerFootprint.cs b/stellar-dotnet-sdk-xdr/generated/LedgerFootprint.cs new file mode 100644 index 00000000..c0bdb93a --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/LedgerFootprint.cs @@ -0,0 +1,41 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct LedgerFootprint +// { +// LedgerKey readOnly<>; +// LedgerKey readWrite<>; +// }; + +// =========================================================================== +public class LedgerFootprint +{ + public LedgerKey[] ReadOnly { get; set; } + public LedgerKey[] ReadWrite { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerFootprint encodedLedgerFootprint) + { + var readOnlysize = encodedLedgerFootprint.ReadOnly.Length; + stream.WriteInt(readOnlysize); + for (var i = 0; i < readOnlysize; i++) LedgerKey.Encode(stream, encodedLedgerFootprint.ReadOnly[i]); + var readWritesize = encodedLedgerFootprint.ReadWrite.Length; + stream.WriteInt(readWritesize); + for (var i = 0; i < readWritesize; i++) LedgerKey.Encode(stream, encodedLedgerFootprint.ReadWrite[i]); + } + + public static LedgerFootprint Decode(XdrDataInputStream stream) + { + var decodedLedgerFootprint = new LedgerFootprint(); + var readOnlysize = stream.ReadInt(); + decodedLedgerFootprint.ReadOnly = new LedgerKey[readOnlysize]; + for (var i = 0; i < readOnlysize; i++) decodedLedgerFootprint.ReadOnly[i] = LedgerKey.Decode(stream); + var readWritesize = stream.ReadInt(); + decodedLedgerFootprint.ReadWrite = new LedgerKey[readWritesize]; + for (var i = 0; i < readWritesize; i++) decodedLedgerFootprint.ReadWrite[i] = LedgerKey.Decode(stream); + return decodedLedgerFootprint; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerHeader.cs b/stellar-dotnet-sdk-xdr/generated/LedgerHeader.cs index 81acbd90..dc214cc6 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerHeader.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerHeader.cs @@ -1,155 +1,146 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct LedgerHeader +// { +// uint32 ledgerVersion; // the protocol version of the ledger +// Hash previousLedgerHash; // hash of the previous ledger header +// 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) +// { +// case 0: +// void; +// case 1: +// LedgerHeaderExtensionV1 v1; +// } +// ext; +// }; + +// =========================================================================== +public class LedgerHeader { + public Uint32 LedgerVersion { get; set; } + public Hash PreviousLedgerHash { get; set; } + public StellarValue ScpValue { get; set; } + public Hash TxSetResultHash { get; set; } + public Hash BucketListHash { get; set; } + public Uint32 LedgerSeq { get; set; } + public Int64 TotalCoins { get; set; } + public Int64 FeePool { get; set; } + public Uint32 InflationSeq { get; set; } + public Uint64 IdPool { get; set; } + public Uint32 BaseFee { get; set; } + public Uint32 BaseReserve { get; set; } + public Uint32 MaxTxSetSize { get; set; } + public Hash[] SkipList { get; set; } + public LedgerHeaderExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, LedgerHeader encodedLedgerHeader) + { + Uint32.Encode(stream, encodedLedgerHeader.LedgerVersion); + Hash.Encode(stream, encodedLedgerHeader.PreviousLedgerHash); + StellarValue.Encode(stream, encodedLedgerHeader.ScpValue); + Hash.Encode(stream, encodedLedgerHeader.TxSetResultHash); + Hash.Encode(stream, encodedLedgerHeader.BucketListHash); + Uint32.Encode(stream, encodedLedgerHeader.LedgerSeq); + Int64.Encode(stream, encodedLedgerHeader.TotalCoins); + Int64.Encode(stream, encodedLedgerHeader.FeePool); + Uint32.Encode(stream, encodedLedgerHeader.InflationSeq); + Uint64.Encode(stream, encodedLedgerHeader.IdPool); + Uint32.Encode(stream, encodedLedgerHeader.BaseFee); + Uint32.Encode(stream, encodedLedgerHeader.BaseReserve); + Uint32.Encode(stream, encodedLedgerHeader.MaxTxSetSize); + var skipListsize = encodedLedgerHeader.SkipList.Length; + for (var i = 0; i < skipListsize; i++) Hash.Encode(stream, encodedLedgerHeader.SkipList[i]); + LedgerHeaderExt.Encode(stream, encodedLedgerHeader.Ext); + } - // struct LedgerHeader - // { - // uint32 ledgerVersion; // the protocol version of the ledger - // Hash previousLedgerHash; // hash of the previous ledger header - // 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) - // { - // case 0: - // void; - // case 1: - // LedgerHeaderExtensionV1 v1; - // } - // ext; - // }; + public static LedgerHeader Decode(XdrDataInputStream stream) + { + var decodedLedgerHeader = new LedgerHeader(); + decodedLedgerHeader.LedgerVersion = Uint32.Decode(stream); + decodedLedgerHeader.PreviousLedgerHash = Hash.Decode(stream); + decodedLedgerHeader.ScpValue = StellarValue.Decode(stream); + decodedLedgerHeader.TxSetResultHash = Hash.Decode(stream); + decodedLedgerHeader.BucketListHash = Hash.Decode(stream); + decodedLedgerHeader.LedgerSeq = Uint32.Decode(stream); + decodedLedgerHeader.TotalCoins = Int64.Decode(stream); + decodedLedgerHeader.FeePool = Int64.Decode(stream); + decodedLedgerHeader.InflationSeq = Uint32.Decode(stream); + decodedLedgerHeader.IdPool = Uint64.Decode(stream); + decodedLedgerHeader.BaseFee = Uint32.Decode(stream); + decodedLedgerHeader.BaseReserve = Uint32.Decode(stream); + decodedLedgerHeader.MaxTxSetSize = Uint32.Decode(stream); + var skipListsize = 4; + decodedLedgerHeader.SkipList = new Hash[skipListsize]; + for (var i = 0; i < skipListsize; i++) decodedLedgerHeader.SkipList[i] = Hash.Decode(stream); + decodedLedgerHeader.Ext = LedgerHeaderExt.Decode(stream); + return decodedLedgerHeader; + } - // =========================================================================== - public class LedgerHeader + public class LedgerHeaderExt { - public LedgerHeader() { } - public Uint32 LedgerVersion { get; set; } - public Hash PreviousLedgerHash { get; set; } - public StellarValue ScpValue { get; set; } - public Hash TxSetResultHash { get; set; } - public Hash BucketListHash { get; set; } - public Uint32 LedgerSeq { get; set; } - public Int64 TotalCoins { get; set; } - public Int64 FeePool { get; set; } - public Uint32 InflationSeq { get; set; } - public Uint64 IdPool { get; set; } - public Uint32 BaseFee { get; set; } - public Uint32 BaseReserve { get; set; } - public Uint32 MaxTxSetSize { get; set; } - public Hash[] SkipList { get; set; } - public LedgerHeaderExt Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerHeader encodedLedgerHeader) - { - Uint32.Encode(stream, encodedLedgerHeader.LedgerVersion); - Hash.Encode(stream, encodedLedgerHeader.PreviousLedgerHash); - StellarValue.Encode(stream, encodedLedgerHeader.ScpValue); - Hash.Encode(stream, encodedLedgerHeader.TxSetResultHash); - Hash.Encode(stream, encodedLedgerHeader.BucketListHash); - Uint32.Encode(stream, encodedLedgerHeader.LedgerSeq); - Int64.Encode(stream, encodedLedgerHeader.TotalCoins); - Int64.Encode(stream, encodedLedgerHeader.FeePool); - Uint32.Encode(stream, encodedLedgerHeader.InflationSeq); - Uint64.Encode(stream, encodedLedgerHeader.IdPool); - Uint32.Encode(stream, encodedLedgerHeader.BaseFee); - Uint32.Encode(stream, encodedLedgerHeader.BaseReserve); - Uint32.Encode(stream, encodedLedgerHeader.MaxTxSetSize); - int skipListsize = encodedLedgerHeader.SkipList.Length; - for (int i = 0; i < skipListsize; i++) - { - Hash.Encode(stream, encodedLedgerHeader.SkipList[i]); - } - LedgerHeaderExt.Encode(stream, encodedLedgerHeader.Ext); - } - public static LedgerHeader Decode(XdrDataInputStream stream) + public LedgerHeaderExtensionV1 V1 { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerHeaderExt encodedLedgerHeaderExt) { - LedgerHeader decodedLedgerHeader = new LedgerHeader(); - decodedLedgerHeader.LedgerVersion = Uint32.Decode(stream); - decodedLedgerHeader.PreviousLedgerHash = Hash.Decode(stream); - decodedLedgerHeader.ScpValue = StellarValue.Decode(stream); - decodedLedgerHeader.TxSetResultHash = Hash.Decode(stream); - decodedLedgerHeader.BucketListHash = Hash.Decode(stream); - decodedLedgerHeader.LedgerSeq = Uint32.Decode(stream); - decodedLedgerHeader.TotalCoins = Int64.Decode(stream); - decodedLedgerHeader.FeePool = Int64.Decode(stream); - decodedLedgerHeader.InflationSeq = Uint32.Decode(stream); - decodedLedgerHeader.IdPool = Uint64.Decode(stream); - decodedLedgerHeader.BaseFee = Uint32.Decode(stream); - decodedLedgerHeader.BaseReserve = Uint32.Decode(stream); - decodedLedgerHeader.MaxTxSetSize = Uint32.Decode(stream); - int skipListsize = 4; - decodedLedgerHeader.SkipList = new Hash[skipListsize]; - for (int i = 0; i < skipListsize; i++) + stream.WriteInt(encodedLedgerHeaderExt.Discriminant); + switch (encodedLedgerHeaderExt.Discriminant) { - decodedLedgerHeader.SkipList[i] = Hash.Decode(stream); + case 0: + break; + case 1: + LedgerHeaderExtensionV1.Encode(stream, encodedLedgerHeaderExt.V1); + break; } - decodedLedgerHeader.Ext = LedgerHeaderExt.Decode(stream); - return decodedLedgerHeader; } - public class LedgerHeaderExt + public static LedgerHeaderExt Decode(XdrDataInputStream stream) { - public LedgerHeaderExt() { } - - public int Discriminant { get; set; } = new int(); - - public LedgerHeaderExtensionV1 V1 { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerHeaderExt encodedLedgerHeaderExt) - { - stream.WriteInt((int)encodedLedgerHeaderExt.Discriminant); - switch (encodedLedgerHeaderExt.Discriminant) - { - case 0: - break; - case 1: - LedgerHeaderExtensionV1.Encode(stream, encodedLedgerHeaderExt.V1); - break; - } - } - public static LedgerHeaderExt Decode(XdrDataInputStream stream) + var decodedLedgerHeaderExt = new LedgerHeaderExt(); + var discriminant = stream.ReadInt(); + decodedLedgerHeaderExt.Discriminant = discriminant; + switch (decodedLedgerHeaderExt.Discriminant) { - LedgerHeaderExt decodedLedgerHeaderExt = new LedgerHeaderExt(); - int discriminant = stream.ReadInt(); - decodedLedgerHeaderExt.Discriminant = discriminant; - switch (decodedLedgerHeaderExt.Discriminant) - { - case 0: - break; - case 1: - decodedLedgerHeaderExt.V1 = LedgerHeaderExtensionV1.Decode(stream); - break; - } - return decodedLedgerHeaderExt; + case 0: + break; + case 1: + decodedLedgerHeaderExt.V1 = LedgerHeaderExtensionV1.Decode(stream); + break; } + return decodedLedgerHeaderExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerHeaderExtensionV1.cs b/stellar-dotnet-sdk-xdr/generated/LedgerHeaderExtensionV1.cs index 15b76e0a..d3f51412 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerHeaderExtensionV1.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerHeaderExtensionV1.cs @@ -1,72 +1,69 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct LedgerHeaderExtensionV1 +// { +// uint32 flags; // LedgerHeaderFlags +// +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; + +// =========================================================================== +public class LedgerHeaderExtensionV1 { + public Uint32 Flags { get; set; } + public LedgerHeaderExtensionV1Ext Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, LedgerHeaderExtensionV1 encodedLedgerHeaderExtensionV1) + { + Uint32.Encode(stream, encodedLedgerHeaderExtensionV1.Flags); + LedgerHeaderExtensionV1Ext.Encode(stream, encodedLedgerHeaderExtensionV1.Ext); + } - // struct LedgerHeaderExtensionV1 - // { - // uint32 flags; // LedgerHeaderFlags - // - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static LedgerHeaderExtensionV1 Decode(XdrDataInputStream stream) + { + var decodedLedgerHeaderExtensionV1 = new LedgerHeaderExtensionV1(); + decodedLedgerHeaderExtensionV1.Flags = Uint32.Decode(stream); + decodedLedgerHeaderExtensionV1.Ext = LedgerHeaderExtensionV1Ext.Decode(stream); + return decodedLedgerHeaderExtensionV1; + } - // =========================================================================== - public class LedgerHeaderExtensionV1 + public class LedgerHeaderExtensionV1Ext { - public LedgerHeaderExtensionV1() { } - public Uint32 Flags { get; set; } - public LedgerHeaderExtensionV1Ext Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerHeaderExtensionV1 encodedLedgerHeaderExtensionV1) + public static void Encode(XdrDataOutputStream stream, + LedgerHeaderExtensionV1Ext encodedLedgerHeaderExtensionV1Ext) { - Uint32.Encode(stream, encodedLedgerHeaderExtensionV1.Flags); - LedgerHeaderExtensionV1Ext.Encode(stream, encodedLedgerHeaderExtensionV1.Ext); - } - public static LedgerHeaderExtensionV1 Decode(XdrDataInputStream stream) - { - LedgerHeaderExtensionV1 decodedLedgerHeaderExtensionV1 = new LedgerHeaderExtensionV1(); - decodedLedgerHeaderExtensionV1.Flags = Uint32.Decode(stream); - decodedLedgerHeaderExtensionV1.Ext = LedgerHeaderExtensionV1Ext.Decode(stream); - return decodedLedgerHeaderExtensionV1; + stream.WriteInt(encodedLedgerHeaderExtensionV1Ext.Discriminant); + switch (encodedLedgerHeaderExtensionV1Ext.Discriminant) + { + case 0: + break; + } } - public class LedgerHeaderExtensionV1Ext + public static LedgerHeaderExtensionV1Ext Decode(XdrDataInputStream stream) { - public LedgerHeaderExtensionV1Ext() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, LedgerHeaderExtensionV1Ext encodedLedgerHeaderExtensionV1Ext) - { - stream.WriteInt((int)encodedLedgerHeaderExtensionV1Ext.Discriminant); - switch (encodedLedgerHeaderExtensionV1Ext.Discriminant) - { - case 0: - break; - } - } - public static LedgerHeaderExtensionV1Ext Decode(XdrDataInputStream stream) + var decodedLedgerHeaderExtensionV1Ext = new LedgerHeaderExtensionV1Ext(); + var discriminant = stream.ReadInt(); + decodedLedgerHeaderExtensionV1Ext.Discriminant = discriminant; + switch (decodedLedgerHeaderExtensionV1Ext.Discriminant) { - LedgerHeaderExtensionV1Ext decodedLedgerHeaderExtensionV1Ext = new LedgerHeaderExtensionV1Ext(); - int discriminant = stream.ReadInt(); - decodedLedgerHeaderExtensionV1Ext.Discriminant = discriminant; - switch (decodedLedgerHeaderExtensionV1Ext.Discriminant) - { - case 0: - break; - } - return decodedLedgerHeaderExtensionV1Ext; + case 0: + break; } + return decodedLedgerHeaderExtensionV1Ext; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerHeaderFlags.cs b/stellar-dotnet-sdk-xdr/generated/LedgerHeaderFlags.cs index a9423b28..84466e65 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerHeaderFlags.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerHeaderFlags.cs @@ -1,54 +1,54 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum LedgerHeaderFlags - // { - // DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1, - // DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2, - // DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4 - // }; +// enum LedgerHeaderFlags +// { +// DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1, +// DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2, +// DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4 +// }; - // =========================================================================== - public class LedgerHeaderFlags +// =========================================================================== +public class LedgerHeaderFlags +{ + public enum LedgerHeaderFlagsEnum { - public enum LedgerHeaderFlagsEnum - { - DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 1, - DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 2, - DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 4, - } - public LedgerHeaderFlagsEnum InnerValue { get; set; } = default(LedgerHeaderFlagsEnum); + DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 1, + DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 2, + DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 4 + } - public static LedgerHeaderFlags Create(LedgerHeaderFlagsEnum v) - { - return new LedgerHeaderFlags - { - InnerValue = v - }; - } + public LedgerHeaderFlagsEnum InnerValue { get; set; } = default; - public static LedgerHeaderFlags Decode(XdrDataInputStream stream) + public static LedgerHeaderFlags Create(LedgerHeaderFlagsEnum v) + { + return new LedgerHeaderFlags { - int value = stream.ReadInt(); - switch (value) - { - case 1: return Create(LedgerHeaderFlagsEnum.DISABLE_LIQUIDITY_POOL_TRADING_FLAG); - case 2: return Create(LedgerHeaderFlagsEnum.DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG); - case 4: return Create(LedgerHeaderFlagsEnum.DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, LedgerHeaderFlags value) + public static LedgerHeaderFlags Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 1: return Create(LedgerHeaderFlagsEnum.DISABLE_LIQUIDITY_POOL_TRADING_FLAG); + case 2: return Create(LedgerHeaderFlagsEnum.DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG); + case 4: return Create(LedgerHeaderFlagsEnum.DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, LedgerHeaderFlags value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerHeaderHistoryEntry.cs b/stellar-dotnet-sdk-xdr/generated/LedgerHeaderHistoryEntry.cs index b26928f2..56d2baa8 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerHeaderHistoryEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerHeaderHistoryEntry.cs @@ -1,77 +1,74 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct LedgerHeaderHistoryEntry +// { +// Hash hash; +// LedgerHeader header; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; + +// =========================================================================== +public class LedgerHeaderHistoryEntry { + public Hash Hash { get; set; } + public LedgerHeader Header { get; set; } + public LedgerHeaderHistoryEntryExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, LedgerHeaderHistoryEntry encodedLedgerHeaderHistoryEntry) + { + Hash.Encode(stream, encodedLedgerHeaderHistoryEntry.Hash); + LedgerHeader.Encode(stream, encodedLedgerHeaderHistoryEntry.Header); + LedgerHeaderHistoryEntryExt.Encode(stream, encodedLedgerHeaderHistoryEntry.Ext); + } - // struct LedgerHeaderHistoryEntry - // { - // Hash hash; - // LedgerHeader header; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static LedgerHeaderHistoryEntry Decode(XdrDataInputStream stream) + { + var decodedLedgerHeaderHistoryEntry = new LedgerHeaderHistoryEntry(); + decodedLedgerHeaderHistoryEntry.Hash = Hash.Decode(stream); + decodedLedgerHeaderHistoryEntry.Header = LedgerHeader.Decode(stream); + decodedLedgerHeaderHistoryEntry.Ext = LedgerHeaderHistoryEntryExt.Decode(stream); + return decodedLedgerHeaderHistoryEntry; + } - // =========================================================================== - public class LedgerHeaderHistoryEntry + public class LedgerHeaderHistoryEntryExt { - public LedgerHeaderHistoryEntry() { } - public Hash Hash { get; set; } - public LedgerHeader Header { get; set; } - public LedgerHeaderHistoryEntryExt Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerHeaderHistoryEntry encodedLedgerHeaderHistoryEntry) + public static void Encode(XdrDataOutputStream stream, + LedgerHeaderHistoryEntryExt encodedLedgerHeaderHistoryEntryExt) { - Hash.Encode(stream, encodedLedgerHeaderHistoryEntry.Hash); - LedgerHeader.Encode(stream, encodedLedgerHeaderHistoryEntry.Header); - LedgerHeaderHistoryEntryExt.Encode(stream, encodedLedgerHeaderHistoryEntry.Ext); - } - public static LedgerHeaderHistoryEntry Decode(XdrDataInputStream stream) - { - LedgerHeaderHistoryEntry decodedLedgerHeaderHistoryEntry = new LedgerHeaderHistoryEntry(); - decodedLedgerHeaderHistoryEntry.Hash = Hash.Decode(stream); - decodedLedgerHeaderHistoryEntry.Header = LedgerHeader.Decode(stream); - decodedLedgerHeaderHistoryEntry.Ext = LedgerHeaderHistoryEntryExt.Decode(stream); - return decodedLedgerHeaderHistoryEntry; + stream.WriteInt(encodedLedgerHeaderHistoryEntryExt.Discriminant); + switch (encodedLedgerHeaderHistoryEntryExt.Discriminant) + { + case 0: + break; + } } - public class LedgerHeaderHistoryEntryExt + public static LedgerHeaderHistoryEntryExt Decode(XdrDataInputStream stream) { - public LedgerHeaderHistoryEntryExt() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, LedgerHeaderHistoryEntryExt encodedLedgerHeaderHistoryEntryExt) - { - stream.WriteInt((int)encodedLedgerHeaderHistoryEntryExt.Discriminant); - switch (encodedLedgerHeaderHistoryEntryExt.Discriminant) - { - case 0: - break; - } - } - public static LedgerHeaderHistoryEntryExt Decode(XdrDataInputStream stream) + var decodedLedgerHeaderHistoryEntryExt = new LedgerHeaderHistoryEntryExt(); + var discriminant = stream.ReadInt(); + decodedLedgerHeaderHistoryEntryExt.Discriminant = discriminant; + switch (decodedLedgerHeaderHistoryEntryExt.Discriminant) { - LedgerHeaderHistoryEntryExt decodedLedgerHeaderHistoryEntryExt = new LedgerHeaderHistoryEntryExt(); - int discriminant = stream.ReadInt(); - decodedLedgerHeaderHistoryEntryExt.Discriminant = discriminant; - switch (decodedLedgerHeaderHistoryEntryExt.Discriminant) - { - case 0: - break; - } - return decodedLedgerHeaderHistoryEntryExt; + case 0: + break; } + return decodedLedgerHeaderHistoryEntryExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerKey.cs b/stellar-dotnet-sdk-xdr/generated/LedgerKey.cs index 9ec66ca3..58df3bbc 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerKey.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerKey.cs @@ -1,231 +1,354 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union LedgerKey switch (LedgerEntryType type) +// { +// case ACCOUNT: +// struct +// { +// 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 +// { +// PoolID liquidityPoolID; +// } liquidityPool; +// case CONTRACT_DATA: +// struct +// { +// SCAddress contract; +// SCVal key; +// ContractDataDurability durability; +// } contractData; +// case CONTRACT_CODE: +// struct +// { +// Hash hash; +// } contractCode; +// case CONFIG_SETTING: +// struct +// { +// ConfigSettingID configSettingID; +// } configSetting; +// case TTL: +// struct +// { +// // Hash of the LedgerKey that is associated with this TTLEntry +// Hash keyHash; +// } ttl; +// }; + +// =========================================================================== +public class LedgerKey { + public LedgerEntryType Discriminant { get; set; } = new(); + + public LedgerKeyAccount Account { get; set; } + public LedgerKeyTrustLine TrustLine { get; set; } + public LedgerKeyOffer Offer { get; set; } + public LedgerKeyData Data { get; set; } + public LedgerKeyClaimableBalance ClaimableBalance { get; set; } + public LedgerKeyLiquidityPool LiquidityPool { get; set; } + public LedgerKeyContractData ContractData { get; set; } + public LedgerKeyContractCode ContractCode { get; set; } + public LedgerKeyConfigSetting ConfigSetting { get; set; } + public LedgerKeyTtl Ttl { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKey encodedLedgerKey) + { + stream.WriteInt((int)encodedLedgerKey.Discriminant.InnerValue); + switch (encodedLedgerKey.Discriminant.InnerValue) + { + case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: + LedgerKeyAccount.Encode(stream, encodedLedgerKey.Account); + break; + case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: + LedgerKeyTrustLine.Encode(stream, encodedLedgerKey.TrustLine); + break; + case LedgerEntryType.LedgerEntryTypeEnum.OFFER: + LedgerKeyOffer.Encode(stream, encodedLedgerKey.Offer); + break; + case LedgerEntryType.LedgerEntryTypeEnum.DATA: + LedgerKeyData.Encode(stream, encodedLedgerKey.Data); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE: + LedgerKeyClaimableBalance.Encode(stream, encodedLedgerKey.ClaimableBalance); + break; + case LedgerEntryType.LedgerEntryTypeEnum.LIQUIDITY_POOL: + LedgerKeyLiquidityPool.Encode(stream, encodedLedgerKey.LiquidityPool); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONTRACT_DATA: + LedgerKeyContractData.Encode(stream, encodedLedgerKey.ContractData); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONTRACT_CODE: + LedgerKeyContractCode.Encode(stream, encodedLedgerKey.ContractCode); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONFIG_SETTING: + LedgerKeyConfigSetting.Encode(stream, encodedLedgerKey.ConfigSetting); + break; + case LedgerEntryType.LedgerEntryTypeEnum.TTL: + LedgerKeyTtl.Encode(stream, encodedLedgerKey.Ttl); + break; + } + } + + public static LedgerKey Decode(XdrDataInputStream stream) + { + var decodedLedgerKey = new LedgerKey(); + var discriminant = LedgerEntryType.Decode(stream); + decodedLedgerKey.Discriminant = discriminant; + switch (decodedLedgerKey.Discriminant.InnerValue) + { + case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: + decodedLedgerKey.Account = LedgerKeyAccount.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: + decodedLedgerKey.TrustLine = LedgerKeyTrustLine.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.OFFER: + decodedLedgerKey.Offer = LedgerKeyOffer.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.DATA: + decodedLedgerKey.Data = LedgerKeyData.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE: + decodedLedgerKey.ClaimableBalance = LedgerKeyClaimableBalance.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.LIQUIDITY_POOL: + decodedLedgerKey.LiquidityPool = LedgerKeyLiquidityPool.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONTRACT_DATA: + decodedLedgerKey.ContractData = LedgerKeyContractData.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONTRACT_CODE: + decodedLedgerKey.ContractCode = LedgerKeyContractCode.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.CONFIG_SETTING: + decodedLedgerKey.ConfigSetting = LedgerKeyConfigSetting.Decode(stream); + break; + case LedgerEntryType.LedgerEntryTypeEnum.TTL: + decodedLedgerKey.Ttl = LedgerKeyTtl.Decode(stream); + break; + } + + return decodedLedgerKey; + } + + public class LedgerKeyAccount + { + public AccountID AccountID { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKeyAccount encodedLedgerKeyAccount) + { + AccountID.Encode(stream, encodedLedgerKeyAccount.AccountID); + } + + public static LedgerKeyAccount Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyAccount = new LedgerKeyAccount(); + decodedLedgerKeyAccount.AccountID = AccountID.Decode(stream); + return decodedLedgerKeyAccount; + } + } + + public class LedgerKeyTrustLine + { + public AccountID AccountID { get; set; } + public TrustLineAsset Asset { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKeyTrustLine encodedLedgerKeyTrustLine) + { + AccountID.Encode(stream, encodedLedgerKeyTrustLine.AccountID); + TrustLineAsset.Encode(stream, encodedLedgerKeyTrustLine.Asset); + } + + public static LedgerKeyTrustLine Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyTrustLine = new LedgerKeyTrustLine(); + decodedLedgerKeyTrustLine.AccountID = AccountID.Decode(stream); + decodedLedgerKeyTrustLine.Asset = TrustLineAsset.Decode(stream); + return decodedLedgerKeyTrustLine; + } + } + + public class LedgerKeyOffer + { + public AccountID SellerID { get; set; } + public Int64 OfferID { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKeyOffer encodedLedgerKeyOffer) + { + AccountID.Encode(stream, encodedLedgerKeyOffer.SellerID); + Int64.Encode(stream, encodedLedgerKeyOffer.OfferID); + } + + public static LedgerKeyOffer Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyOffer = new LedgerKeyOffer(); + decodedLedgerKeyOffer.SellerID = AccountID.Decode(stream); + decodedLedgerKeyOffer.OfferID = Int64.Decode(stream); + return decodedLedgerKeyOffer; + } + } + + public class LedgerKeyData + { + public AccountID AccountID { get; set; } + public String64 DataName { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKeyData encodedLedgerKeyData) + { + AccountID.Encode(stream, encodedLedgerKeyData.AccountID); + String64.Encode(stream, encodedLedgerKeyData.DataName); + } + + public static LedgerKeyData Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyData = new LedgerKeyData(); + decodedLedgerKeyData.AccountID = AccountID.Decode(stream); + decodedLedgerKeyData.DataName = String64.Decode(stream); + return decodedLedgerKeyData; + } + } + + public class LedgerKeyClaimableBalance + { + public ClaimableBalanceID BalanceID { get; set; } + + public static void Encode(XdrDataOutputStream stream, + LedgerKeyClaimableBalance encodedLedgerKeyClaimableBalance) + { + ClaimableBalanceID.Encode(stream, encodedLedgerKeyClaimableBalance.BalanceID); + } + + public static LedgerKeyClaimableBalance Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyClaimableBalance = new LedgerKeyClaimableBalance(); + decodedLedgerKeyClaimableBalance.BalanceID = ClaimableBalanceID.Decode(stream); + return decodedLedgerKeyClaimableBalance; + } + } + + public class LedgerKeyLiquidityPool + { + public PoolID LiquidityPoolID { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKeyLiquidityPool encodedLedgerKeyLiquidityPool) + { + PoolID.Encode(stream, encodedLedgerKeyLiquidityPool.LiquidityPoolID); + } + + public static LedgerKeyLiquidityPool Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyLiquidityPool = new LedgerKeyLiquidityPool(); + decodedLedgerKeyLiquidityPool.LiquidityPoolID = PoolID.Decode(stream); + return decodedLedgerKeyLiquidityPool; + } + } + + public class LedgerKeyContractData + { + public SCAddress Contract { get; set; } + public SCVal Key { get; set; } + public ContractDataDurability Durability { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKeyContractData encodedLedgerKeyContractData) + { + SCAddress.Encode(stream, encodedLedgerKeyContractData.Contract); + SCVal.Encode(stream, encodedLedgerKeyContractData.Key); + ContractDataDurability.Encode(stream, encodedLedgerKeyContractData.Durability); + } + + public static LedgerKeyContractData Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyContractData = new LedgerKeyContractData(); + decodedLedgerKeyContractData.Contract = SCAddress.Decode(stream); + decodedLedgerKeyContractData.Key = SCVal.Decode(stream); + decodedLedgerKeyContractData.Durability = ContractDataDurability.Decode(stream); + return decodedLedgerKeyContractData; + } + } - // === xdr source ============================================================ - - // union LedgerKey switch (LedgerEntryType type) - // { - // case ACCOUNT: - // struct - // { - // 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 - // { - // PoolID liquidityPoolID; - // } liquidityPool; - // }; - - // =========================================================================== - public class LedgerKey + public class LedgerKeyContractCode { - public LedgerKey() { } - - public LedgerEntryType Discriminant { get; set; } = new LedgerEntryType(); - - public LedgerKeyAccount Account { get; set; } - public LedgerKeyTrustLine TrustLine { get; set; } - public LedgerKeyOffer Offer { get; set; } - public LedgerKeyData Data { get; set; } - public LedgerKeyClaimableBalance ClaimableBalance { get; set; } - public LedgerKeyLiquidityPool LiquidityPool { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerKey encodedLedgerKey) - { - stream.WriteInt((int)encodedLedgerKey.Discriminant.InnerValue); - switch (encodedLedgerKey.Discriminant.InnerValue) - { - case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: - LedgerKeyAccount.Encode(stream, encodedLedgerKey.Account); - break; - case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: - LedgerKeyTrustLine.Encode(stream, encodedLedgerKey.TrustLine); - break; - case LedgerEntryType.LedgerEntryTypeEnum.OFFER: - LedgerKeyOffer.Encode(stream, encodedLedgerKey.Offer); - break; - case LedgerEntryType.LedgerEntryTypeEnum.DATA: - LedgerKeyData.Encode(stream, encodedLedgerKey.Data); - break; - case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE: - LedgerKeyClaimableBalance.Encode(stream, encodedLedgerKey.ClaimableBalance); - break; - case LedgerEntryType.LedgerEntryTypeEnum.LIQUIDITY_POOL: - LedgerKeyLiquidityPool.Encode(stream, encodedLedgerKey.LiquidityPool); - break; - } - } - public static LedgerKey Decode(XdrDataInputStream stream) - { - LedgerKey decodedLedgerKey = new LedgerKey(); - LedgerEntryType discriminant = LedgerEntryType.Decode(stream); - decodedLedgerKey.Discriminant = discriminant; - switch (decodedLedgerKey.Discriminant.InnerValue) - { - case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: - decodedLedgerKey.Account = LedgerKeyAccount.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: - decodedLedgerKey.TrustLine = LedgerKeyTrustLine.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.OFFER: - decodedLedgerKey.Offer = LedgerKeyOffer.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.DATA: - decodedLedgerKey.Data = LedgerKeyData.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE: - decodedLedgerKey.ClaimableBalance = LedgerKeyClaimableBalance.Decode(stream); - break; - case LedgerEntryType.LedgerEntryTypeEnum.LIQUIDITY_POOL: - decodedLedgerKey.LiquidityPool = LedgerKeyLiquidityPool.Decode(stream); - break; - } - return decodedLedgerKey; - } - - public class LedgerKeyAccount - { - public LedgerKeyAccount() { } - public AccountID AccountID { get; set; } - - public static void Encode(XdrDataOutputStream stream, LedgerKeyAccount encodedLedgerKeyAccount) - { - AccountID.Encode(stream, encodedLedgerKeyAccount.AccountID); - } - public static LedgerKeyAccount Decode(XdrDataInputStream stream) - { - LedgerKeyAccount decodedLedgerKeyAccount = new LedgerKeyAccount(); - decodedLedgerKeyAccount.AccountID = AccountID.Decode(stream); - return decodedLedgerKeyAccount; - } - - } - public class LedgerKeyTrustLine - { - public LedgerKeyTrustLine() { } - public AccountID AccountID { get; set; } - public TrustLineAsset Asset { get; set; } - - public static void Encode(XdrDataOutputStream stream, LedgerKeyTrustLine encodedLedgerKeyTrustLine) - { - AccountID.Encode(stream, encodedLedgerKeyTrustLine.AccountID); - TrustLineAsset.Encode(stream, encodedLedgerKeyTrustLine.Asset); - } - public static LedgerKeyTrustLine Decode(XdrDataInputStream stream) - { - LedgerKeyTrustLine decodedLedgerKeyTrustLine = new LedgerKeyTrustLine(); - decodedLedgerKeyTrustLine.AccountID = AccountID.Decode(stream); - decodedLedgerKeyTrustLine.Asset = TrustLineAsset.Decode(stream); - return decodedLedgerKeyTrustLine; - } - - } - public class LedgerKeyOffer - { - public LedgerKeyOffer() { } - public AccountID SellerID { get; set; } - public Int64 OfferID { get; set; } - - public static void Encode(XdrDataOutputStream stream, LedgerKeyOffer encodedLedgerKeyOffer) - { - AccountID.Encode(stream, encodedLedgerKeyOffer.SellerID); - Int64.Encode(stream, encodedLedgerKeyOffer.OfferID); - } - public static LedgerKeyOffer Decode(XdrDataInputStream stream) - { - LedgerKeyOffer decodedLedgerKeyOffer = new LedgerKeyOffer(); - decodedLedgerKeyOffer.SellerID = AccountID.Decode(stream); - decodedLedgerKeyOffer.OfferID = Int64.Decode(stream); - return decodedLedgerKeyOffer; - } - - } - public class LedgerKeyData - { - public LedgerKeyData() { } - public AccountID AccountID { get; set; } - public String64 DataName { get; set; } - - public static void Encode(XdrDataOutputStream stream, LedgerKeyData encodedLedgerKeyData) - { - AccountID.Encode(stream, encodedLedgerKeyData.AccountID); - String64.Encode(stream, encodedLedgerKeyData.DataName); - } - public static LedgerKeyData Decode(XdrDataInputStream stream) - { - LedgerKeyData decodedLedgerKeyData = new LedgerKeyData(); - decodedLedgerKeyData.AccountID = AccountID.Decode(stream); - decodedLedgerKeyData.DataName = String64.Decode(stream); - return decodedLedgerKeyData; - } - - } - public class LedgerKeyClaimableBalance - { - public LedgerKeyClaimableBalance() { } - public ClaimableBalanceID BalanceID { get; set; } - - public static void Encode(XdrDataOutputStream stream, LedgerKeyClaimableBalance encodedLedgerKeyClaimableBalance) - { - ClaimableBalanceID.Encode(stream, encodedLedgerKeyClaimableBalance.BalanceID); - } - public static LedgerKeyClaimableBalance Decode(XdrDataInputStream stream) - { - LedgerKeyClaimableBalance decodedLedgerKeyClaimableBalance = new LedgerKeyClaimableBalance(); - decodedLedgerKeyClaimableBalance.BalanceID = ClaimableBalanceID.Decode(stream); - return decodedLedgerKeyClaimableBalance; - } - - } - public class LedgerKeyLiquidityPool - { - public LedgerKeyLiquidityPool() { } - public PoolID LiquidityPoolID { get; set; } - - public static void Encode(XdrDataOutputStream stream, LedgerKeyLiquidityPool encodedLedgerKeyLiquidityPool) - { - PoolID.Encode(stream, encodedLedgerKeyLiquidityPool.LiquidityPoolID); - } - public static LedgerKeyLiquidityPool Decode(XdrDataInputStream stream) - { - LedgerKeyLiquidityPool decodedLedgerKeyLiquidityPool = new LedgerKeyLiquidityPool(); - decodedLedgerKeyLiquidityPool.LiquidityPoolID = PoolID.Decode(stream); - return decodedLedgerKeyLiquidityPool; - } + public Hash Hash { get; set; } + public static void Encode(XdrDataOutputStream stream, LedgerKeyContractCode encodedLedgerKeyContractCode) + { + Hash.Encode(stream, encodedLedgerKeyContractCode.Hash); + } + + public static LedgerKeyContractCode Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyContractCode = new LedgerKeyContractCode(); + decodedLedgerKeyContractCode.Hash = Hash.Decode(stream); + return decodedLedgerKeyContractCode; + } + } + + public class LedgerKeyConfigSetting + { + public ConfigSettingID ConfigSettingID { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKeyConfigSetting encodedLedgerKeyConfigSetting) + { + ConfigSettingID.Encode(stream, encodedLedgerKeyConfigSetting.ConfigSettingID); + } + + public static LedgerKeyConfigSetting Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyConfigSetting = new LedgerKeyConfigSetting(); + decodedLedgerKeyConfigSetting.ConfigSettingID = ConfigSettingID.Decode(stream); + return decodedLedgerKeyConfigSetting; + } + } + + public class LedgerKeyTtl + { + public Hash KeyHash { get; set; } + + public static void Encode(XdrDataOutputStream stream, LedgerKeyTtl encodedLedgerKeyTtl) + { + Hash.Encode(stream, encodedLedgerKeyTtl.KeyHash); + } + + public static LedgerKeyTtl Decode(XdrDataInputStream stream) + { + var decodedLedgerKeyTtl = new LedgerKeyTtl(); + decodedLedgerKeyTtl.KeyHash = Hash.Decode(stream); + return decodedLedgerKeyTtl; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerSCPMessages.cs b/stellar-dotnet-sdk-xdr/generated/LedgerSCPMessages.cs index fae9cc97..15d1fbe1 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerSCPMessages.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerSCPMessages.cs @@ -1,46 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct LedgerSCPMessages +// { +// uint32 ledgerSeq; +// SCPEnvelope messages<>; +// }; - // struct LedgerSCPMessages - // { - // uint32 ledgerSeq; - // SCPEnvelope messages<>; - // }; +// =========================================================================== +public class LedgerSCPMessages +{ + public Uint32 LedgerSeq { get; set; } + public SCPEnvelope[] Messages { get; set; } - // =========================================================================== - public class LedgerSCPMessages + public static void Encode(XdrDataOutputStream stream, LedgerSCPMessages encodedLedgerSCPMessages) { - public LedgerSCPMessages() { } - public Uint32 LedgerSeq { get; set; } - public SCPEnvelope[] Messages { get; set; } + Uint32.Encode(stream, encodedLedgerSCPMessages.LedgerSeq); + var messagessize = encodedLedgerSCPMessages.Messages.Length; + stream.WriteInt(messagessize); + for (var i = 0; i < messagessize; i++) SCPEnvelope.Encode(stream, encodedLedgerSCPMessages.Messages[i]); + } - public static void Encode(XdrDataOutputStream stream, LedgerSCPMessages encodedLedgerSCPMessages) - { - Uint32.Encode(stream, encodedLedgerSCPMessages.LedgerSeq); - int messagessize = encodedLedgerSCPMessages.Messages.Length; - stream.WriteInt(messagessize); - for (int i = 0; i < messagessize; i++) - { - SCPEnvelope.Encode(stream, encodedLedgerSCPMessages.Messages[i]); - } - } - public static LedgerSCPMessages Decode(XdrDataInputStream stream) - { - LedgerSCPMessages decodedLedgerSCPMessages = new LedgerSCPMessages(); - decodedLedgerSCPMessages.LedgerSeq = Uint32.Decode(stream); - int messagessize = stream.ReadInt(); - decodedLedgerSCPMessages.Messages = new SCPEnvelope[messagessize]; - for (int i = 0; i < messagessize; i++) - { - decodedLedgerSCPMessages.Messages[i] = SCPEnvelope.Decode(stream); - } - return decodedLedgerSCPMessages; - } + public static LedgerSCPMessages Decode(XdrDataInputStream stream) + { + var decodedLedgerSCPMessages = new LedgerSCPMessages(); + decodedLedgerSCPMessages.LedgerSeq = Uint32.Decode(stream); + var messagessize = stream.ReadInt(); + decodedLedgerSCPMessages.Messages = new SCPEnvelope[messagessize]; + for (var i = 0; i < messagessize; i++) decodedLedgerSCPMessages.Messages[i] = SCPEnvelope.Decode(stream); + return decodedLedgerSCPMessages; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerUpgrade.cs b/stellar-dotnet-sdk-xdr/generated/LedgerUpgrade.cs index f60dde05..4f259d68 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerUpgrade.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerUpgrade.cs @@ -1,84 +1,103 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union LedgerUpgrade switch (LedgerUpgradeType type) - // { - // case LEDGER_UPGRADE_VERSION: - // uint32 newLedgerVersion; // update ledgerVersion - // case LEDGER_UPGRADE_BASE_FEE: - // uint32 newBaseFee; // update baseFee - // case LEDGER_UPGRADE_MAX_TX_SET_SIZE: - // uint32 newMaxTxSetSize; // update maxTxSetSize - // case LEDGER_UPGRADE_BASE_RESERVE: - // uint32 newBaseReserve; // update baseReserve - // case LEDGER_UPGRADE_FLAGS: - // uint32 newFlags; // update flags - // }; +// union LedgerUpgrade switch (LedgerUpgradeType type) +// { +// case LEDGER_UPGRADE_VERSION: +// uint32 newLedgerVersion; // update ledgerVersion +// case LEDGER_UPGRADE_BASE_FEE: +// uint32 newBaseFee; // update baseFee +// case LEDGER_UPGRADE_MAX_TX_SET_SIZE: +// uint32 newMaxTxSetSize; // update maxTxSetSize +// case LEDGER_UPGRADE_BASE_RESERVE: +// uint32 newBaseReserve; // update baseReserve +// case LEDGER_UPGRADE_FLAGS: +// uint32 newFlags; // update flags +// case LEDGER_UPGRADE_CONFIG: +// // Update arbitrary `ConfigSetting` entries identified by the key. +// ConfigUpgradeSetKey newConfig; +// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: +// // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without +// // using `LEDGER_UPGRADE_CONFIG`. +// uint32 newMaxSorobanTxSetSize; +// }; - // =========================================================================== - public class LedgerUpgrade - { - public LedgerUpgrade() { } +// =========================================================================== +public class LedgerUpgrade +{ + public LedgerUpgradeType Discriminant { get; set; } = new(); - public LedgerUpgradeType Discriminant { get; set; } = new LedgerUpgradeType(); + public Uint32 NewLedgerVersion { get; set; } + public Uint32 NewBaseFee { get; set; } + public Uint32 NewMaxTxSetSize { get; set; } + public Uint32 NewBaseReserve { get; set; } + public Uint32 NewFlags { get; set; } + public ConfigUpgradeSetKey NewConfig { get; set; } + public Uint32 NewMaxSorobanTxSetSize { get; set; } - public Uint32 NewLedgerVersion { get; set; } - public Uint32 NewBaseFee { get; set; } - public Uint32 NewMaxTxSetSize { get; set; } - public Uint32 NewBaseReserve { get; set; } - public Uint32 NewFlags { get; set; } - public static void Encode(XdrDataOutputStream stream, LedgerUpgrade encodedLedgerUpgrade) + public static void Encode(XdrDataOutputStream stream, LedgerUpgrade encodedLedgerUpgrade) + { + stream.WriteInt((int)encodedLedgerUpgrade.Discriminant.InnerValue); + switch (encodedLedgerUpgrade.Discriminant.InnerValue) { - stream.WriteInt((int)encodedLedgerUpgrade.Discriminant.InnerValue); - switch (encodedLedgerUpgrade.Discriminant.InnerValue) - { - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION: - Uint32.Encode(stream, encodedLedgerUpgrade.NewLedgerVersion); - break; - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE: - Uint32.Encode(stream, encodedLedgerUpgrade.NewBaseFee); - break; - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE: - Uint32.Encode(stream, encodedLedgerUpgrade.NewMaxTxSetSize); - break; - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_RESERVE: - Uint32.Encode(stream, encodedLedgerUpgrade.NewBaseReserve); - break; - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_FLAGS: - Uint32.Encode(stream, encodedLedgerUpgrade.NewFlags); - break; - } + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION: + Uint32.Encode(stream, encodedLedgerUpgrade.NewLedgerVersion); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE: + Uint32.Encode(stream, encodedLedgerUpgrade.NewBaseFee); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE: + Uint32.Encode(stream, encodedLedgerUpgrade.NewMaxTxSetSize); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_RESERVE: + Uint32.Encode(stream, encodedLedgerUpgrade.NewBaseReserve); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_FLAGS: + Uint32.Encode(stream, encodedLedgerUpgrade.NewFlags); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_CONFIG: + ConfigUpgradeSetKey.Encode(stream, encodedLedgerUpgrade.NewConfig); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + Uint32.Encode(stream, encodedLedgerUpgrade.NewMaxSorobanTxSetSize); + break; } - public static LedgerUpgrade Decode(XdrDataInputStream stream) + } + + public static LedgerUpgrade Decode(XdrDataInputStream stream) + { + var decodedLedgerUpgrade = new LedgerUpgrade(); + var discriminant = LedgerUpgradeType.Decode(stream); + decodedLedgerUpgrade.Discriminant = discriminant; + switch (decodedLedgerUpgrade.Discriminant.InnerValue) { - LedgerUpgrade decodedLedgerUpgrade = new LedgerUpgrade(); - LedgerUpgradeType discriminant = LedgerUpgradeType.Decode(stream); - decodedLedgerUpgrade.Discriminant = discriminant; - switch (decodedLedgerUpgrade.Discriminant.InnerValue) - { - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION: - decodedLedgerUpgrade.NewLedgerVersion = Uint32.Decode(stream); - break; - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE: - decodedLedgerUpgrade.NewBaseFee = Uint32.Decode(stream); - break; - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE: - decodedLedgerUpgrade.NewMaxTxSetSize = Uint32.Decode(stream); - break; - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_RESERVE: - decodedLedgerUpgrade.NewBaseReserve = Uint32.Decode(stream); - break; - case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_FLAGS: - decodedLedgerUpgrade.NewFlags = Uint32.Decode(stream); - break; - } - return decodedLedgerUpgrade; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION: + decodedLedgerUpgrade.NewLedgerVersion = Uint32.Decode(stream); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE: + decodedLedgerUpgrade.NewBaseFee = Uint32.Decode(stream); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE: + decodedLedgerUpgrade.NewMaxTxSetSize = Uint32.Decode(stream); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_RESERVE: + decodedLedgerUpgrade.NewBaseReserve = Uint32.Decode(stream); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_FLAGS: + decodedLedgerUpgrade.NewFlags = Uint32.Decode(stream); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_CONFIG: + decodedLedgerUpgrade.NewConfig = ConfigUpgradeSetKey.Decode(stream); + break; + case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + decodedLedgerUpgrade.NewMaxSorobanTxSetSize = Uint32.Decode(stream); + break; } + + return decodedLedgerUpgrade; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LedgerUpgradeType.cs b/stellar-dotnet-sdk-xdr/generated/LedgerUpgradeType.cs index c1adffed..eff1a1df 100644 --- a/stellar-dotnet-sdk-xdr/generated/LedgerUpgradeType.cs +++ b/stellar-dotnet-sdk-xdr/generated/LedgerUpgradeType.cs @@ -1,60 +1,66 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum LedgerUpgradeType - // { - // LEDGER_UPGRADE_VERSION = 1, - // LEDGER_UPGRADE_BASE_FEE = 2, - // LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, - // LEDGER_UPGRADE_BASE_RESERVE = 4, - // LEDGER_UPGRADE_FLAGS = 5 - // }; +// enum LedgerUpgradeType +// { +// LEDGER_UPGRADE_VERSION = 1, +// LEDGER_UPGRADE_BASE_FEE = 2, +// LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, +// LEDGER_UPGRADE_BASE_RESERVE = 4, +// LEDGER_UPGRADE_FLAGS = 5, +// LEDGER_UPGRADE_CONFIG = 6, +// LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 +// }; - // =========================================================================== - public class LedgerUpgradeType +// =========================================================================== +public class LedgerUpgradeType +{ + public enum LedgerUpgradeTypeEnum { - public enum LedgerUpgradeTypeEnum - { - LEDGER_UPGRADE_VERSION = 1, - LEDGER_UPGRADE_BASE_FEE = 2, - LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, - LEDGER_UPGRADE_BASE_RESERVE = 4, - LEDGER_UPGRADE_FLAGS = 5, - } - public LedgerUpgradeTypeEnum InnerValue { get; set; } = default(LedgerUpgradeTypeEnum); + LEDGER_UPGRADE_VERSION = 1, + LEDGER_UPGRADE_BASE_FEE = 2, + LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, + LEDGER_UPGRADE_BASE_RESERVE = 4, + LEDGER_UPGRADE_FLAGS = 5, + LEDGER_UPGRADE_CONFIG = 6, + LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 + } - public static LedgerUpgradeType Create(LedgerUpgradeTypeEnum v) - { - return new LedgerUpgradeType - { - InnerValue = v - }; - } + public LedgerUpgradeTypeEnum InnerValue { get; set; } = default; - public static LedgerUpgradeType Decode(XdrDataInputStream stream) + public static LedgerUpgradeType Create(LedgerUpgradeTypeEnum v) + { + return new LedgerUpgradeType { - int value = stream.ReadInt(); - switch (value) - { - case 1: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION); - case 2: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE); - case 3: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE); - case 4: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_RESERVE); - case 5: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_FLAGS); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, LedgerUpgradeType value) + public static LedgerUpgradeType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 1: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION); + case 2: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE); + case 3: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE); + case 4: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_RESERVE); + case 5: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_FLAGS); + case 6: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_CONFIG); + case 7: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, LedgerUpgradeType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Liabilities.cs b/stellar-dotnet-sdk-xdr/generated/Liabilities.cs index eea5ac64..9c6bb7de 100644 --- a/stellar-dotnet-sdk-xdr/generated/Liabilities.cs +++ b/stellar-dotnet-sdk-xdr/generated/Liabilities.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct Liabilities +// { +// int64 buying; +// int64 selling; +// }; - // struct Liabilities - // { - // int64 buying; - // int64 selling; - // }; +// =========================================================================== +public class Liabilities +{ + public Int64 Buying { get; set; } + public Int64 Selling { get; set; } - // =========================================================================== - public class Liabilities + public static void Encode(XdrDataOutputStream stream, Liabilities encodedLiabilities) { - public Liabilities() { } - public Int64 Buying { get; set; } - public Int64 Selling { get; set; } + Int64.Encode(stream, encodedLiabilities.Buying); + Int64.Encode(stream, encodedLiabilities.Selling); + } - public static void Encode(XdrDataOutputStream stream, Liabilities encodedLiabilities) - { - Int64.Encode(stream, encodedLiabilities.Buying); - Int64.Encode(stream, encodedLiabilities.Selling); - } - public static Liabilities Decode(XdrDataInputStream stream) - { - Liabilities decodedLiabilities = new Liabilities(); - decodedLiabilities.Buying = Int64.Decode(stream); - decodedLiabilities.Selling = Int64.Decode(stream); - return decodedLiabilities; - } + public static Liabilities Decode(XdrDataInputStream stream) + { + var decodedLiabilities = new Liabilities(); + decodedLiabilities.Buying = Int64.Decode(stream); + decodedLiabilities.Selling = Int64.Decode(stream); + return decodedLiabilities; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolConstantProductParameters.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolConstantProductParameters.cs index b7a46322..75efb381 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolConstantProductParameters.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolConstantProductParameters.cs @@ -1,40 +1,38 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct LiquidityPoolConstantProductParameters +// { +// Asset assetA; // assetA < assetB +// Asset assetB; +// int32 fee; // Fee is in basis points, so the actual rate is (fee/100)% +// }; - // struct LiquidityPoolConstantProductParameters - // { - // Asset assetA; // assetA < assetB - // Asset assetB; - // int32 fee; // Fee is in basis points, so the actual rate is (fee/100)% - // }; +// =========================================================================== +public class LiquidityPoolConstantProductParameters +{ + public Asset AssetA { get; set; } + public Asset AssetB { get; set; } + public Int32 Fee { get; set; } - // =========================================================================== - public class LiquidityPoolConstantProductParameters + public static void Encode(XdrDataOutputStream stream, + LiquidityPoolConstantProductParameters encodedLiquidityPoolConstantProductParameters) { - public LiquidityPoolConstantProductParameters() { } - public Asset AssetA { get; set; } - public Asset AssetB { get; set; } - public Int32 Fee { get; set; } + Asset.Encode(stream, encodedLiquidityPoolConstantProductParameters.AssetA); + Asset.Encode(stream, encodedLiquidityPoolConstantProductParameters.AssetB); + Int32.Encode(stream, encodedLiquidityPoolConstantProductParameters.Fee); + } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolConstantProductParameters encodedLiquidityPoolConstantProductParameters) - { - Asset.Encode(stream, encodedLiquidityPoolConstantProductParameters.AssetA); - Asset.Encode(stream, encodedLiquidityPoolConstantProductParameters.AssetB); - Int32.Encode(stream, encodedLiquidityPoolConstantProductParameters.Fee); - } - public static LiquidityPoolConstantProductParameters Decode(XdrDataInputStream stream) - { - LiquidityPoolConstantProductParameters decodedLiquidityPoolConstantProductParameters = new LiquidityPoolConstantProductParameters(); - decodedLiquidityPoolConstantProductParameters.AssetA = Asset.Decode(stream); - decodedLiquidityPoolConstantProductParameters.AssetB = Asset.Decode(stream); - decodedLiquidityPoolConstantProductParameters.Fee = Int32.Decode(stream); - return decodedLiquidityPoolConstantProductParameters; - } + public static LiquidityPoolConstantProductParameters Decode(XdrDataInputStream stream) + { + var decodedLiquidityPoolConstantProductParameters = new LiquidityPoolConstantProductParameters(); + decodedLiquidityPoolConstantProductParameters.AssetA = Asset.Decode(stream); + decodedLiquidityPoolConstantProductParameters.AssetB = Asset.Decode(stream); + decodedLiquidityPoolConstantProductParameters.Fee = Int32.Decode(stream); + return decodedLiquidityPoolConstantProductParameters; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositOp.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositOp.cs index 8e3d5624..c1b59c39 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositOp.cs @@ -1,48 +1,45 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct LiquidityPoolDepositOp +// { +// PoolID liquidityPoolID; +// int64 maxAmountA; // maximum amount of first asset to deposit +// int64 maxAmountB; // maximum amount of second asset to deposit +// Price minPrice; // minimum depositA/depositB +// Price maxPrice; // maximum depositA/depositB +// }; - // struct LiquidityPoolDepositOp - // { - // PoolID liquidityPoolID; - // int64 maxAmountA; // maximum amount of first asset to deposit - // int64 maxAmountB; // maximum amount of second asset to deposit - // Price minPrice; // minimum depositA/depositB - // Price maxPrice; // maximum depositA/depositB - // }; +// =========================================================================== +public class LiquidityPoolDepositOp +{ + public PoolID LiquidityPoolID { get; set; } + public Int64 MaxAmountA { get; set; } + public Int64 MaxAmountB { get; set; } + public Price MinPrice { get; set; } + public Price MaxPrice { get; set; } - // =========================================================================== - public class LiquidityPoolDepositOp + public static void Encode(XdrDataOutputStream stream, LiquidityPoolDepositOp encodedLiquidityPoolDepositOp) { - public LiquidityPoolDepositOp() { } - public PoolID LiquidityPoolID { get; set; } - public Int64 MaxAmountA { get; set; } - public Int64 MaxAmountB { get; set; } - public Price MinPrice { get; set; } - public Price MaxPrice { get; set; } + PoolID.Encode(stream, encodedLiquidityPoolDepositOp.LiquidityPoolID); + Int64.Encode(stream, encodedLiquidityPoolDepositOp.MaxAmountA); + Int64.Encode(stream, encodedLiquidityPoolDepositOp.MaxAmountB); + Price.Encode(stream, encodedLiquidityPoolDepositOp.MinPrice); + Price.Encode(stream, encodedLiquidityPoolDepositOp.MaxPrice); + } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolDepositOp encodedLiquidityPoolDepositOp) - { - PoolID.Encode(stream, encodedLiquidityPoolDepositOp.LiquidityPoolID); - Int64.Encode(stream, encodedLiquidityPoolDepositOp.MaxAmountA); - Int64.Encode(stream, encodedLiquidityPoolDepositOp.MaxAmountB); - Price.Encode(stream, encodedLiquidityPoolDepositOp.MinPrice); - Price.Encode(stream, encodedLiquidityPoolDepositOp.MaxPrice); - } - public static LiquidityPoolDepositOp Decode(XdrDataInputStream stream) - { - LiquidityPoolDepositOp decodedLiquidityPoolDepositOp = new LiquidityPoolDepositOp(); - decodedLiquidityPoolDepositOp.LiquidityPoolID = PoolID.Decode(stream); - decodedLiquidityPoolDepositOp.MaxAmountA = Int64.Decode(stream); - decodedLiquidityPoolDepositOp.MaxAmountB = Int64.Decode(stream); - decodedLiquidityPoolDepositOp.MinPrice = Price.Decode(stream); - decodedLiquidityPoolDepositOp.MaxPrice = Price.Decode(stream); - return decodedLiquidityPoolDepositOp; - } + public static LiquidityPoolDepositOp Decode(XdrDataInputStream stream) + { + var decodedLiquidityPoolDepositOp = new LiquidityPoolDepositOp(); + decodedLiquidityPoolDepositOp.LiquidityPoolID = PoolID.Decode(stream); + decodedLiquidityPoolDepositOp.MaxAmountA = Int64.Decode(stream); + decodedLiquidityPoolDepositOp.MaxAmountB = Int64.Decode(stream); + decodedLiquidityPoolDepositOp.MinPrice = Price.Decode(stream); + decodedLiquidityPoolDepositOp.MaxPrice = Price.Decode(stream); + return decodedLiquidityPoolDepositOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositResult.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositResult.cs index 45a7562a..96fe5b24 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositResult.cs @@ -1,51 +1,68 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code) - // { - // case LIQUIDITY_POOL_DEPOSIT_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class LiquidityPoolDepositResult - { - public LiquidityPoolDepositResult() { } +// union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code) +// { +// case LIQUIDITY_POOL_DEPOSIT_SUCCESS: +// void; +// case LIQUIDITY_POOL_DEPOSIT_MALFORMED: +// case LIQUIDITY_POOL_DEPOSIT_NO_TRUST: +// case LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED: +// case LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED: +// case LIQUIDITY_POOL_DEPOSIT_LINE_FULL: +// case LIQUIDITY_POOL_DEPOSIT_BAD_PRICE: +// case LIQUIDITY_POOL_DEPOSIT_POOL_FULL: +// void; +// }; - public LiquidityPoolDepositResultCode Discriminant { get; set; } = new LiquidityPoolDepositResultCode(); +// =========================================================================== +public class LiquidityPoolDepositResult +{ + public LiquidityPoolDepositResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, LiquidityPoolDepositResult encodedLiquidityPoolDepositResult) + public static void Encode(XdrDataOutputStream stream, LiquidityPoolDepositResult encodedLiquidityPoolDepositResult) + { + stream.WriteInt((int)encodedLiquidityPoolDepositResult.Discriminant.InnerValue); + switch (encodedLiquidityPoolDepositResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedLiquidityPoolDepositResult.Discriminant.InnerValue); - switch (encodedLiquidityPoolDepositResult.Discriminant.InnerValue) - { - case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_SUCCESS: - break; - default: - break; - } + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_SUCCESS: + break; + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_MALFORMED: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_NO_TRUST: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum + .LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_LINE_FULL: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_BAD_PRICE: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_POOL_FULL: + break; } - public static LiquidityPoolDepositResult Decode(XdrDataInputStream stream) + } + + public static LiquidityPoolDepositResult Decode(XdrDataInputStream stream) + { + var decodedLiquidityPoolDepositResult = new LiquidityPoolDepositResult(); + var discriminant = LiquidityPoolDepositResultCode.Decode(stream); + decodedLiquidityPoolDepositResult.Discriminant = discriminant; + switch (decodedLiquidityPoolDepositResult.Discriminant.InnerValue) { - LiquidityPoolDepositResult decodedLiquidityPoolDepositResult = new LiquidityPoolDepositResult(); - LiquidityPoolDepositResultCode discriminant = LiquidityPoolDepositResultCode.Decode(stream); - decodedLiquidityPoolDepositResult.Discriminant = discriminant; - switch (decodedLiquidityPoolDepositResult.Discriminant.InnerValue) - { - case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_SUCCESS: - break; - default: - break; - } - return decodedLiquidityPoolDepositResult; + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_SUCCESS: + break; + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_MALFORMED: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_NO_TRUST: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum + .LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_LINE_FULL: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_BAD_PRICE: + case LiquidityPoolDepositResultCode.LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_POOL_FULL: + break; } + + return decodedLiquidityPoolDepositResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositResultCode.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositResultCode.cs index 391e5b54..8bcdb03d 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolDepositResultCode.cs @@ -1,76 +1,76 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum LiquidityPoolDepositResultCode - // { - // // 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 - // // assets - // LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED = -3, // not authorized for one of the - // // assets - // LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED = -4, // not enough balance for one of - // // the assets - // LIQUIDITY_POOL_DEPOSIT_LINE_FULL = -5, // pool share trust line doesn't - // // have sufficient limit - // LIQUIDITY_POOL_DEPOSIT_BAD_PRICE = -6, // deposit price outside bounds - // LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7 // pool reserves are full - // }; +// enum LiquidityPoolDepositResultCode +// { +// // 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 +// // assets +// LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED = -3, // not authorized for one of the +// // assets +// LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED = -4, // not enough balance for one of +// // the assets +// LIQUIDITY_POOL_DEPOSIT_LINE_FULL = -5, // pool share trust line doesn't +// // have sufficient limit +// LIQUIDITY_POOL_DEPOSIT_BAD_PRICE = -6, // deposit price outside bounds +// LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7 // pool reserves are full +// }; - // =========================================================================== - public class LiquidityPoolDepositResultCode +// =========================================================================== +public class LiquidityPoolDepositResultCode +{ + public enum LiquidityPoolDepositResultCodeEnum { - public enum LiquidityPoolDepositResultCodeEnum - { - LIQUIDITY_POOL_DEPOSIT_SUCCESS = 0, - LIQUIDITY_POOL_DEPOSIT_MALFORMED = -1, - LIQUIDITY_POOL_DEPOSIT_NO_TRUST = -2, - LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED = -3, - LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED = -4, - LIQUIDITY_POOL_DEPOSIT_LINE_FULL = -5, - LIQUIDITY_POOL_DEPOSIT_BAD_PRICE = -6, - LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7, - } - public LiquidityPoolDepositResultCodeEnum InnerValue { get; set; } = default(LiquidityPoolDepositResultCodeEnum); + LIQUIDITY_POOL_DEPOSIT_SUCCESS = 0, + LIQUIDITY_POOL_DEPOSIT_MALFORMED = -1, + LIQUIDITY_POOL_DEPOSIT_NO_TRUST = -2, + LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED = -3, + LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED = -4, + LIQUIDITY_POOL_DEPOSIT_LINE_FULL = -5, + LIQUIDITY_POOL_DEPOSIT_BAD_PRICE = -6, + LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7 + } - public static LiquidityPoolDepositResultCode Create(LiquidityPoolDepositResultCodeEnum v) - { - return new LiquidityPoolDepositResultCode - { - InnerValue = v - }; - } + public LiquidityPoolDepositResultCodeEnum InnerValue { get; set; } = default; - public static LiquidityPoolDepositResultCode Decode(XdrDataInputStream stream) + public static LiquidityPoolDepositResultCode Create(LiquidityPoolDepositResultCodeEnum v) + { + return new LiquidityPoolDepositResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_SUCCESS); - case -1: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_MALFORMED); - case -2: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_NO_TRUST); - case -3: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED); - case -4: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED); - case -5: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_LINE_FULL); - case -6: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_BAD_PRICE); - case -7: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_POOL_FULL); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolDepositResultCode value) + public static LiquidityPoolDepositResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_SUCCESS); + case -1: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_MALFORMED); + case -2: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_NO_TRUST); + case -3: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED); + case -4: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED); + case -5: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_LINE_FULL); + case -6: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_BAD_PRICE); + case -7: return Create(LiquidityPoolDepositResultCodeEnum.LIQUIDITY_POOL_DEPOSIT_POOL_FULL); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, LiquidityPoolDepositResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolEntry.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolEntry.cs index f2fed0f0..5d8288cf 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolEntry.cs @@ -1,113 +1,111 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// 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 +// int64 poolSharesTrustLineCount; // number of trust lines for the +// // associated pool shares +// } constantProduct; +// } +// body; +// }; + +// =========================================================================== +public class LiquidityPoolEntry { + public PoolID LiquidityPoolID { get; set; } + public LiquidityPoolEntryBody Body { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, LiquidityPoolEntry encodedLiquidityPoolEntry) + { + PoolID.Encode(stream, encodedLiquidityPoolEntry.LiquidityPoolID); + LiquidityPoolEntryBody.Encode(stream, encodedLiquidityPoolEntry.Body); + } - // 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 - // int64 poolSharesTrustLineCount; // number of trust lines for the - // // associated pool shares - // } constantProduct; - // } - // body; - // }; + public static LiquidityPoolEntry Decode(XdrDataInputStream stream) + { + var decodedLiquidityPoolEntry = new LiquidityPoolEntry(); + decodedLiquidityPoolEntry.LiquidityPoolID = PoolID.Decode(stream); + decodedLiquidityPoolEntry.Body = LiquidityPoolEntryBody.Decode(stream); + return decodedLiquidityPoolEntry; + } - // =========================================================================== - public class LiquidityPoolEntry + public class LiquidityPoolEntryBody { - public LiquidityPoolEntry() { } - public PoolID LiquidityPoolID { get; set; } - public LiquidityPoolEntryBody Body { get; set; } + public LiquidityPoolType Discriminant { get; set; } = new(); + + public LiquidityPoolEntryConstantProduct ConstantProduct { get; set; } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolEntry encodedLiquidityPoolEntry) + public static void Encode(XdrDataOutputStream stream, LiquidityPoolEntryBody encodedLiquidityPoolEntryBody) { - PoolID.Encode(stream, encodedLiquidityPoolEntry.LiquidityPoolID); - LiquidityPoolEntryBody.Encode(stream, encodedLiquidityPoolEntry.Body); + stream.WriteInt((int)encodedLiquidityPoolEntryBody.Discriminant.InnerValue); + switch (encodedLiquidityPoolEntryBody.Discriminant.InnerValue) + { + case LiquidityPoolType.LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT: + LiquidityPoolEntryConstantProduct.Encode(stream, encodedLiquidityPoolEntryBody.ConstantProduct); + break; + } } - public static LiquidityPoolEntry Decode(XdrDataInputStream stream) + + public static LiquidityPoolEntryBody Decode(XdrDataInputStream stream) { - LiquidityPoolEntry decodedLiquidityPoolEntry = new LiquidityPoolEntry(); - decodedLiquidityPoolEntry.LiquidityPoolID = PoolID.Decode(stream); - decodedLiquidityPoolEntry.Body = LiquidityPoolEntryBody.Decode(stream); - return decodedLiquidityPoolEntry; + var decodedLiquidityPoolEntryBody = new LiquidityPoolEntryBody(); + var discriminant = LiquidityPoolType.Decode(stream); + decodedLiquidityPoolEntryBody.Discriminant = discriminant; + switch (decodedLiquidityPoolEntryBody.Discriminant.InnerValue) + { + case LiquidityPoolType.LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT: + decodedLiquidityPoolEntryBody.ConstantProduct = LiquidityPoolEntryConstantProduct.Decode(stream); + break; + } + + return decodedLiquidityPoolEntryBody; } - public class LiquidityPoolEntryBody + public class LiquidityPoolEntryConstantProduct { - public LiquidityPoolEntryBody() { } - - public LiquidityPoolType Discriminant { get; set; } = new LiquidityPoolType(); + public LiquidityPoolConstantProductParameters Params { get; set; } + public Int64 ReserveA { get; set; } + public Int64 ReserveB { get; set; } + public Int64 TotalPoolShares { get; set; } + public Int64 PoolSharesTrustLineCount { get; set; } - public LiquidityPoolEntryConstantProduct ConstantProduct { get; set; } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolEntryBody encodedLiquidityPoolEntryBody) + public static void Encode(XdrDataOutputStream stream, + LiquidityPoolEntryConstantProduct encodedLiquidityPoolEntryConstantProduct) { - stream.WriteInt((int)encodedLiquidityPoolEntryBody.Discriminant.InnerValue); - switch (encodedLiquidityPoolEntryBody.Discriminant.InnerValue) - { - case LiquidityPoolType.LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT: - LiquidityPoolEntryConstantProduct.Encode(stream, encodedLiquidityPoolEntryBody.ConstantProduct); - break; - } - } - public static LiquidityPoolEntryBody Decode(XdrDataInputStream stream) - { - LiquidityPoolEntryBody decodedLiquidityPoolEntryBody = new LiquidityPoolEntryBody(); - LiquidityPoolType discriminant = LiquidityPoolType.Decode(stream); - decodedLiquidityPoolEntryBody.Discriminant = discriminant; - switch (decodedLiquidityPoolEntryBody.Discriminant.InnerValue) - { - case LiquidityPoolType.LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT: - decodedLiquidityPoolEntryBody.ConstantProduct = LiquidityPoolEntryConstantProduct.Decode(stream); - break; - } - return decodedLiquidityPoolEntryBody; + LiquidityPoolConstantProductParameters.Encode(stream, encodedLiquidityPoolEntryConstantProduct.Params); + Int64.Encode(stream, encodedLiquidityPoolEntryConstantProduct.ReserveA); + Int64.Encode(stream, encodedLiquidityPoolEntryConstantProduct.ReserveB); + Int64.Encode(stream, encodedLiquidityPoolEntryConstantProduct.TotalPoolShares); + Int64.Encode(stream, encodedLiquidityPoolEntryConstantProduct.PoolSharesTrustLineCount); } - public class LiquidityPoolEntryConstantProduct + public static LiquidityPoolEntryConstantProduct Decode(XdrDataInputStream stream) { - public LiquidityPoolEntryConstantProduct() { } - public LiquidityPoolConstantProductParameters Params { get; set; } - public Int64 ReserveA { get; set; } - public Int64 ReserveB { get; set; } - public Int64 TotalPoolShares { get; set; } - public Int64 PoolSharesTrustLineCount { get; set; } - - public static void Encode(XdrDataOutputStream stream, LiquidityPoolEntryConstantProduct encodedLiquidityPoolEntryConstantProduct) - { - LiquidityPoolConstantProductParameters.Encode(stream, encodedLiquidityPoolEntryConstantProduct.Params); - Int64.Encode(stream, encodedLiquidityPoolEntryConstantProduct.ReserveA); - Int64.Encode(stream, encodedLiquidityPoolEntryConstantProduct.ReserveB); - Int64.Encode(stream, encodedLiquidityPoolEntryConstantProduct.TotalPoolShares); - Int64.Encode(stream, encodedLiquidityPoolEntryConstantProduct.PoolSharesTrustLineCount); - } - public static LiquidityPoolEntryConstantProduct Decode(XdrDataInputStream stream) - { - LiquidityPoolEntryConstantProduct decodedLiquidityPoolEntryConstantProduct = new LiquidityPoolEntryConstantProduct(); - decodedLiquidityPoolEntryConstantProduct.Params = LiquidityPoolConstantProductParameters.Decode(stream); - decodedLiquidityPoolEntryConstantProduct.ReserveA = Int64.Decode(stream); - decodedLiquidityPoolEntryConstantProduct.ReserveB = Int64.Decode(stream); - decodedLiquidityPoolEntryConstantProduct.TotalPoolShares = Int64.Decode(stream); - decodedLiquidityPoolEntryConstantProduct.PoolSharesTrustLineCount = Int64.Decode(stream); - return decodedLiquidityPoolEntryConstantProduct; - } - + var decodedLiquidityPoolEntryConstantProduct = new LiquidityPoolEntryConstantProduct(); + decodedLiquidityPoolEntryConstantProduct.Params = LiquidityPoolConstantProductParameters.Decode(stream); + decodedLiquidityPoolEntryConstantProduct.ReserveA = Int64.Decode(stream); + decodedLiquidityPoolEntryConstantProduct.ReserveB = Int64.Decode(stream); + decodedLiquidityPoolEntryConstantProduct.TotalPoolShares = Int64.Decode(stream); + decodedLiquidityPoolEntryConstantProduct.PoolSharesTrustLineCount = Int64.Decode(stream); + return decodedLiquidityPoolEntryConstantProduct; } } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolParameters.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolParameters.cs index e2fb2092..f43e1001 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolParameters.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolParameters.cs @@ -1,48 +1,46 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union LiquidityPoolParameters switch (LiquidityPoolType type) - // { - // case LIQUIDITY_POOL_CONSTANT_PRODUCT: - // LiquidityPoolConstantProductParameters constantProduct; - // }; +// union LiquidityPoolParameters switch (LiquidityPoolType type) +// { +// case LIQUIDITY_POOL_CONSTANT_PRODUCT: +// LiquidityPoolConstantProductParameters constantProduct; +// }; - // =========================================================================== - public class LiquidityPoolParameters - { - public LiquidityPoolParameters() { } +// =========================================================================== +public class LiquidityPoolParameters +{ + public LiquidityPoolType Discriminant { get; set; } = new(); - public LiquidityPoolType Discriminant { get; set; } = new LiquidityPoolType(); + public LiquidityPoolConstantProductParameters ConstantProduct { get; set; } - public LiquidityPoolConstantProductParameters ConstantProduct { get; set; } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolParameters encodedLiquidityPoolParameters) + public static void Encode(XdrDataOutputStream stream, LiquidityPoolParameters encodedLiquidityPoolParameters) + { + stream.WriteInt((int)encodedLiquidityPoolParameters.Discriminant.InnerValue); + switch (encodedLiquidityPoolParameters.Discriminant.InnerValue) { - stream.WriteInt((int)encodedLiquidityPoolParameters.Discriminant.InnerValue); - switch (encodedLiquidityPoolParameters.Discriminant.InnerValue) - { - case LiquidityPoolType.LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT: - LiquidityPoolConstantProductParameters.Encode(stream, encodedLiquidityPoolParameters.ConstantProduct); - break; - } + case LiquidityPoolType.LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT: + LiquidityPoolConstantProductParameters.Encode(stream, encodedLiquidityPoolParameters.ConstantProduct); + break; } - public static LiquidityPoolParameters Decode(XdrDataInputStream stream) + } + + public static LiquidityPoolParameters Decode(XdrDataInputStream stream) + { + var decodedLiquidityPoolParameters = new LiquidityPoolParameters(); + var discriminant = LiquidityPoolType.Decode(stream); + decodedLiquidityPoolParameters.Discriminant = discriminant; + switch (decodedLiquidityPoolParameters.Discriminant.InnerValue) { - LiquidityPoolParameters decodedLiquidityPoolParameters = new LiquidityPoolParameters(); - LiquidityPoolType discriminant = LiquidityPoolType.Decode(stream); - decodedLiquidityPoolParameters.Discriminant = discriminant; - switch (decodedLiquidityPoolParameters.Discriminant.InnerValue) - { - case LiquidityPoolType.LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT: - decodedLiquidityPoolParameters.ConstantProduct = LiquidityPoolConstantProductParameters.Decode(stream); - break; - } - return decodedLiquidityPoolParameters; + case LiquidityPoolType.LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT: + decodedLiquidityPoolParameters.ConstantProduct = LiquidityPoolConstantProductParameters.Decode(stream); + break; } + + return decodedLiquidityPoolParameters; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolType.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolType.cs index 996d4b41..f20bc547 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolType.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolType.cs @@ -1,48 +1,48 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum LiquidityPoolType - // { - // LIQUIDITY_POOL_CONSTANT_PRODUCT = 0 - // }; +// enum LiquidityPoolType +// { +// LIQUIDITY_POOL_CONSTANT_PRODUCT = 0 +// }; - // =========================================================================== - public class LiquidityPoolType +// =========================================================================== +public class LiquidityPoolType +{ + public enum LiquidityPoolTypeEnum { - public enum LiquidityPoolTypeEnum - { - LIQUIDITY_POOL_CONSTANT_PRODUCT = 0, - } - public LiquidityPoolTypeEnum InnerValue { get; set; } = default(LiquidityPoolTypeEnum); + LIQUIDITY_POOL_CONSTANT_PRODUCT = 0 + } - public static LiquidityPoolType Create(LiquidityPoolTypeEnum v) - { - return new LiquidityPoolType - { - InnerValue = v - }; - } + public LiquidityPoolTypeEnum InnerValue { get; set; } = default; - public static LiquidityPoolType Decode(XdrDataInputStream stream) + public static LiquidityPoolType Create(LiquidityPoolTypeEnum v) + { + return new LiquidityPoolType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolType value) + public static LiquidityPoolType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(LiquidityPoolTypeEnum.LIQUIDITY_POOL_CONSTANT_PRODUCT); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, LiquidityPoolType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawOp.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawOp.cs index 902604a0..ff2a7480 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawOp.cs @@ -1,44 +1,41 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct LiquidityPoolWithdrawOp +// { +// PoolID liquidityPoolID; +// int64 amount; // amount of pool shares to withdraw +// int64 minAmountA; // minimum amount of first asset to withdraw +// int64 minAmountB; // minimum amount of second asset to withdraw +// }; - // struct LiquidityPoolWithdrawOp - // { - // PoolID liquidityPoolID; - // int64 amount; // amount of pool shares to withdraw - // int64 minAmountA; // minimum amount of first asset to withdraw - // int64 minAmountB; // minimum amount of second asset to withdraw - // }; +// =========================================================================== +public class LiquidityPoolWithdrawOp +{ + public PoolID LiquidityPoolID { get; set; } + public Int64 Amount { get; set; } + public Int64 MinAmountA { get; set; } + public Int64 MinAmountB { get; set; } - // =========================================================================== - public class LiquidityPoolWithdrawOp + public static void Encode(XdrDataOutputStream stream, LiquidityPoolWithdrawOp encodedLiquidityPoolWithdrawOp) { - public LiquidityPoolWithdrawOp() { } - public PoolID LiquidityPoolID { get; set; } - public Int64 Amount { get; set; } - public Int64 MinAmountA { get; set; } - public Int64 MinAmountB { get; set; } + PoolID.Encode(stream, encodedLiquidityPoolWithdrawOp.LiquidityPoolID); + Int64.Encode(stream, encodedLiquidityPoolWithdrawOp.Amount); + Int64.Encode(stream, encodedLiquidityPoolWithdrawOp.MinAmountA); + Int64.Encode(stream, encodedLiquidityPoolWithdrawOp.MinAmountB); + } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolWithdrawOp encodedLiquidityPoolWithdrawOp) - { - PoolID.Encode(stream, encodedLiquidityPoolWithdrawOp.LiquidityPoolID); - Int64.Encode(stream, encodedLiquidityPoolWithdrawOp.Amount); - Int64.Encode(stream, encodedLiquidityPoolWithdrawOp.MinAmountA); - Int64.Encode(stream, encodedLiquidityPoolWithdrawOp.MinAmountB); - } - public static LiquidityPoolWithdrawOp Decode(XdrDataInputStream stream) - { - LiquidityPoolWithdrawOp decodedLiquidityPoolWithdrawOp = new LiquidityPoolWithdrawOp(); - decodedLiquidityPoolWithdrawOp.LiquidityPoolID = PoolID.Decode(stream); - decodedLiquidityPoolWithdrawOp.Amount = Int64.Decode(stream); - decodedLiquidityPoolWithdrawOp.MinAmountA = Int64.Decode(stream); - decodedLiquidityPoolWithdrawOp.MinAmountB = Int64.Decode(stream); - return decodedLiquidityPoolWithdrawOp; - } + public static LiquidityPoolWithdrawOp Decode(XdrDataInputStream stream) + { + var decodedLiquidityPoolWithdrawOp = new LiquidityPoolWithdrawOp(); + decodedLiquidityPoolWithdrawOp.LiquidityPoolID = PoolID.Decode(stream); + decodedLiquidityPoolWithdrawOp.Amount = Int64.Decode(stream); + decodedLiquidityPoolWithdrawOp.MinAmountA = Int64.Decode(stream); + decodedLiquidityPoolWithdrawOp.MinAmountB = Int64.Decode(stream); + return decodedLiquidityPoolWithdrawOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawResult.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawResult.cs index fc5b0c73..b32b6b88 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawResult.cs @@ -1,51 +1,65 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code) - // { - // case LIQUIDITY_POOL_WITHDRAW_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class LiquidityPoolWithdrawResult - { - public LiquidityPoolWithdrawResult() { } +// union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code) +// { +// case LIQUIDITY_POOL_WITHDRAW_SUCCESS: +// void; +// case LIQUIDITY_POOL_WITHDRAW_MALFORMED: +// case LIQUIDITY_POOL_WITHDRAW_NO_TRUST: +// case LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED: +// case LIQUIDITY_POOL_WITHDRAW_LINE_FULL: +// case LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM: +// void; +// }; - public LiquidityPoolWithdrawResultCode Discriminant { get; set; } = new LiquidityPoolWithdrawResultCode(); +// =========================================================================== +public class LiquidityPoolWithdrawResult +{ + public LiquidityPoolWithdrawResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, LiquidityPoolWithdrawResult encodedLiquidityPoolWithdrawResult) + public static void Encode(XdrDataOutputStream stream, + LiquidityPoolWithdrawResult encodedLiquidityPoolWithdrawResult) + { + stream.WriteInt((int)encodedLiquidityPoolWithdrawResult.Discriminant.InnerValue); + switch (encodedLiquidityPoolWithdrawResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedLiquidityPoolWithdrawResult.Discriminant.InnerValue); - switch (encodedLiquidityPoolWithdrawResult.Discriminant.InnerValue) - { - case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_SUCCESS: - break; - default: - break; - } + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_SUCCESS: + break; + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_MALFORMED: + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_NO_TRUST: + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum + .LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED: + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_LINE_FULL: + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum + .LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM: + break; } - public static LiquidityPoolWithdrawResult Decode(XdrDataInputStream stream) + } + + public static LiquidityPoolWithdrawResult Decode(XdrDataInputStream stream) + { + var decodedLiquidityPoolWithdrawResult = new LiquidityPoolWithdrawResult(); + var discriminant = LiquidityPoolWithdrawResultCode.Decode(stream); + decodedLiquidityPoolWithdrawResult.Discriminant = discriminant; + switch (decodedLiquidityPoolWithdrawResult.Discriminant.InnerValue) { - LiquidityPoolWithdrawResult decodedLiquidityPoolWithdrawResult = new LiquidityPoolWithdrawResult(); - LiquidityPoolWithdrawResultCode discriminant = LiquidityPoolWithdrawResultCode.Decode(stream); - decodedLiquidityPoolWithdrawResult.Discriminant = discriminant; - switch (decodedLiquidityPoolWithdrawResult.Discriminant.InnerValue) - { - case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_SUCCESS: - break; - default: - break; - } - return decodedLiquidityPoolWithdrawResult; + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_SUCCESS: + break; + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_MALFORMED: + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_NO_TRUST: + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum + .LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED: + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_LINE_FULL: + case LiquidityPoolWithdrawResultCode.LiquidityPoolWithdrawResultCodeEnum + .LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM: + break; } + + return decodedLiquidityPoolWithdrawResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawResultCode.cs b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawResultCode.cs index 408d71f8..2674f3bf 100644 --- a/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/LiquidityPoolWithdrawResultCode.cs @@ -1,69 +1,69 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum LiquidityPoolWithdrawResultCode - // { - // // 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 - // // assets - // LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the - // // pool share - // 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 - // }; +// enum LiquidityPoolWithdrawResultCode +// { +// // 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 +// // assets +// LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the +// // pool share +// 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 +// }; - // =========================================================================== - public class LiquidityPoolWithdrawResultCode +// =========================================================================== +public class LiquidityPoolWithdrawResultCode +{ + public enum LiquidityPoolWithdrawResultCodeEnum { - public enum LiquidityPoolWithdrawResultCodeEnum - { - LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0, - LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, - LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, - LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, - LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, - LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5, - } - public LiquidityPoolWithdrawResultCodeEnum InnerValue { get; set; } = default(LiquidityPoolWithdrawResultCodeEnum); + LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0, + LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, + LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, + LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, + LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, + LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 + } - public static LiquidityPoolWithdrawResultCode Create(LiquidityPoolWithdrawResultCodeEnum v) - { - return new LiquidityPoolWithdrawResultCode - { - InnerValue = v - }; - } + public LiquidityPoolWithdrawResultCodeEnum InnerValue { get; set; } = default; - public static LiquidityPoolWithdrawResultCode Decode(XdrDataInputStream stream) + public static LiquidityPoolWithdrawResultCode Create(LiquidityPoolWithdrawResultCodeEnum v) + { + return new LiquidityPoolWithdrawResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_SUCCESS); - case -1: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_MALFORMED); - case -2: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_NO_TRUST); - case -3: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED); - case -4: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_LINE_FULL); - case -5: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, LiquidityPoolWithdrawResultCode value) + public static LiquidityPoolWithdrawResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_SUCCESS); + case -1: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_MALFORMED); + case -2: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_NO_TRUST); + case -3: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED); + case -4: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_LINE_FULL); + case -5: return Create(LiquidityPoolWithdrawResultCodeEnum.LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, LiquidityPoolWithdrawResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferOp.cs b/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferOp.cs index c06703a2..9dabd2f4 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferOp.cs @@ -1,51 +1,48 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct ManageBuyOfferOp +// { +// Asset selling; +// Asset buying; +// 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; +// }; - // struct ManageBuyOfferOp - // { - // Asset selling; - // Asset buying; - // 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; - // }; +// =========================================================================== +public class ManageBuyOfferOp +{ + public Asset Selling { get; set; } + public Asset Buying { get; set; } + public Int64 BuyAmount { get; set; } + public Price Price { get; set; } + public Int64 OfferID { get; set; } - // =========================================================================== - public class ManageBuyOfferOp + public static void Encode(XdrDataOutputStream stream, ManageBuyOfferOp encodedManageBuyOfferOp) { - public ManageBuyOfferOp() { } - public Asset Selling { get; set; } - public Asset Buying { get; set; } - public Int64 BuyAmount { get; set; } - public Price Price { get; set; } - public Int64 OfferID { get; set; } + Asset.Encode(stream, encodedManageBuyOfferOp.Selling); + Asset.Encode(stream, encodedManageBuyOfferOp.Buying); + Int64.Encode(stream, encodedManageBuyOfferOp.BuyAmount); + Price.Encode(stream, encodedManageBuyOfferOp.Price); + Int64.Encode(stream, encodedManageBuyOfferOp.OfferID); + } - public static void Encode(XdrDataOutputStream stream, ManageBuyOfferOp encodedManageBuyOfferOp) - { - Asset.Encode(stream, encodedManageBuyOfferOp.Selling); - Asset.Encode(stream, encodedManageBuyOfferOp.Buying); - Int64.Encode(stream, encodedManageBuyOfferOp.BuyAmount); - Price.Encode(stream, encodedManageBuyOfferOp.Price); - Int64.Encode(stream, encodedManageBuyOfferOp.OfferID); - } - public static ManageBuyOfferOp Decode(XdrDataInputStream stream) - { - ManageBuyOfferOp decodedManageBuyOfferOp = new ManageBuyOfferOp(); - decodedManageBuyOfferOp.Selling = Asset.Decode(stream); - decodedManageBuyOfferOp.Buying = Asset.Decode(stream); - decodedManageBuyOfferOp.BuyAmount = Int64.Decode(stream); - decodedManageBuyOfferOp.Price = Price.Decode(stream); - decodedManageBuyOfferOp.OfferID = Int64.Decode(stream); - return decodedManageBuyOfferOp; - } + public static ManageBuyOfferOp Decode(XdrDataInputStream stream) + { + var decodedManageBuyOfferOp = new ManageBuyOfferOp(); + decodedManageBuyOfferOp.Selling = Asset.Decode(stream); + decodedManageBuyOfferOp.Buying = Asset.Decode(stream); + decodedManageBuyOfferOp.BuyAmount = Int64.Decode(stream); + decodedManageBuyOfferOp.Price = Price.Decode(stream); + decodedManageBuyOfferOp.OfferID = Int64.Decode(stream); + return decodedManageBuyOfferOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferResult.cs b/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferResult.cs index 8caee935..41a57f82 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferResult.cs @@ -1,54 +1,85 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union ManageBuyOfferResult switch (ManageBuyOfferResultCode code) - // { - // case MANAGE_BUY_OFFER_SUCCESS: - // ManageOfferSuccessResult success; - // default: - // void; - // }; +// union ManageBuyOfferResult switch (ManageBuyOfferResultCode code) +// { +// case MANAGE_BUY_OFFER_SUCCESS: +// ManageOfferSuccessResult success; +// case MANAGE_BUY_OFFER_MALFORMED: +// case MANAGE_BUY_OFFER_SELL_NO_TRUST: +// case MANAGE_BUY_OFFER_BUY_NO_TRUST: +// case MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED: +// case MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED: +// case MANAGE_BUY_OFFER_LINE_FULL: +// case MANAGE_BUY_OFFER_UNDERFUNDED: +// case MANAGE_BUY_OFFER_CROSS_SELF: +// case MANAGE_BUY_OFFER_SELL_NO_ISSUER: +// case MANAGE_BUY_OFFER_BUY_NO_ISSUER: +// case MANAGE_BUY_OFFER_NOT_FOUND: +// case MANAGE_BUY_OFFER_LOW_RESERVE: +// void; +// }; - // =========================================================================== - public class ManageBuyOfferResult - { - public ManageBuyOfferResult() { } +// =========================================================================== +public class ManageBuyOfferResult +{ + public ManageBuyOfferResultCode Discriminant { get; set; } = new(); - public ManageBuyOfferResultCode Discriminant { get; set; } = new ManageBuyOfferResultCode(); + public ManageOfferSuccessResult Success { get; set; } - public ManageOfferSuccessResult Success { get; set; } - public static void Encode(XdrDataOutputStream stream, ManageBuyOfferResult encodedManageBuyOfferResult) + public static void Encode(XdrDataOutputStream stream, ManageBuyOfferResult encodedManageBuyOfferResult) + { + stream.WriteInt((int)encodedManageBuyOfferResult.Discriminant.InnerValue); + switch (encodedManageBuyOfferResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedManageBuyOfferResult.Discriminant.InnerValue); - switch (encodedManageBuyOfferResult.Discriminant.InnerValue) - { - case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SUCCESS: - ManageOfferSuccessResult.Encode(stream, encodedManageBuyOfferResult.Success); - break; - default: - break; - } + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SUCCESS: + ManageOfferSuccessResult.Encode(stream, encodedManageBuyOfferResult.Success); + break; + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_MALFORMED: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NO_TRUST: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NO_TRUST: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_LINE_FULL: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_UNDERFUNDED: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_CROSS_SELF: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NO_ISSUER: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NO_ISSUER: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_NOT_FOUND: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_LOW_RESERVE: + break; } - public static ManageBuyOfferResult Decode(XdrDataInputStream stream) + } + + public static ManageBuyOfferResult Decode(XdrDataInputStream stream) + { + var decodedManageBuyOfferResult = new ManageBuyOfferResult(); + var discriminant = ManageBuyOfferResultCode.Decode(stream); + decodedManageBuyOfferResult.Discriminant = discriminant; + switch (decodedManageBuyOfferResult.Discriminant.InnerValue) { - ManageBuyOfferResult decodedManageBuyOfferResult = new ManageBuyOfferResult(); - ManageBuyOfferResultCode discriminant = ManageBuyOfferResultCode.Decode(stream); - decodedManageBuyOfferResult.Discriminant = discriminant; - switch (decodedManageBuyOfferResult.Discriminant.InnerValue) - { - case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SUCCESS: - decodedManageBuyOfferResult.Success = ManageOfferSuccessResult.Decode(stream); - break; - default: - break; - } - return decodedManageBuyOfferResult; + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SUCCESS: + decodedManageBuyOfferResult.Success = ManageOfferSuccessResult.Decode(stream); + break; + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_MALFORMED: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NO_TRUST: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NO_TRUST: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_LINE_FULL: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_UNDERFUNDED: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_CROSS_SELF: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NO_ISSUER: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NO_ISSUER: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_NOT_FOUND: + case ManageBuyOfferResultCode.ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_LOW_RESERVE: + break; } + + return decodedManageBuyOfferResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferResultCode.cs b/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferResultCode.cs index f09a6170..9ffc5313 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageBuyOfferResultCode.cs @@ -1,91 +1,91 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ManageBuyOfferResultCode - // { - // // 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 - // MANAGE_BUY_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying - // MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell - // MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy - // MANAGE_BUY_OFFER_LINE_FULL = -6, // can't receive more of what it's buying - // MANAGE_BUY_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell - // 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 - // }; +// enum ManageBuyOfferResultCode +// { +// // 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 +// MANAGE_BUY_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying +// MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell +// MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy +// MANAGE_BUY_OFFER_LINE_FULL = -6, // can't receive more of what it's buying +// MANAGE_BUY_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell +// 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 +// }; - // =========================================================================== - public class ManageBuyOfferResultCode +// =========================================================================== +public class ManageBuyOfferResultCode +{ + public enum ManageBuyOfferResultCodeEnum { - public enum ManageBuyOfferResultCodeEnum - { - MANAGE_BUY_OFFER_SUCCESS = 0, - MANAGE_BUY_OFFER_MALFORMED = -1, - MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, - MANAGE_BUY_OFFER_BUY_NO_TRUST = -3, - MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, - MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5, - MANAGE_BUY_OFFER_LINE_FULL = -6, - MANAGE_BUY_OFFER_UNDERFUNDED = -7, - MANAGE_BUY_OFFER_CROSS_SELF = -8, - MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, - MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, - MANAGE_BUY_OFFER_NOT_FOUND = -11, - MANAGE_BUY_OFFER_LOW_RESERVE = -12, - } - public ManageBuyOfferResultCodeEnum InnerValue { get; set; } = default(ManageBuyOfferResultCodeEnum); + MANAGE_BUY_OFFER_SUCCESS = 0, + MANAGE_BUY_OFFER_MALFORMED = -1, + MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, + MANAGE_BUY_OFFER_BUY_NO_TRUST = -3, + MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, + MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5, + MANAGE_BUY_OFFER_LINE_FULL = -6, + MANAGE_BUY_OFFER_UNDERFUNDED = -7, + MANAGE_BUY_OFFER_CROSS_SELF = -8, + MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, + MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, + MANAGE_BUY_OFFER_NOT_FOUND = -11, + MANAGE_BUY_OFFER_LOW_RESERVE = -12 + } - public static ManageBuyOfferResultCode Create(ManageBuyOfferResultCodeEnum v) - { - return new ManageBuyOfferResultCode - { - InnerValue = v - }; - } + public ManageBuyOfferResultCodeEnum InnerValue { get; set; } = default; - public static ManageBuyOfferResultCode Decode(XdrDataInputStream stream) + public static ManageBuyOfferResultCode Create(ManageBuyOfferResultCodeEnum v) + { + return new ManageBuyOfferResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SUCCESS); - case -1: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_MALFORMED); - case -2: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NO_TRUST); - case -3: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NO_TRUST); - case -4: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED); - case -5: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED); - case -6: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_LINE_FULL); - case -7: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_UNDERFUNDED); - case -8: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_CROSS_SELF); - case -9: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NO_ISSUER); - case -10: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NO_ISSUER); - case -11: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_NOT_FOUND); - case -12: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_LOW_RESERVE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ManageBuyOfferResultCode value) + public static ManageBuyOfferResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SUCCESS); + case -1: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_MALFORMED); + case -2: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NO_TRUST); + case -3: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NO_TRUST); + case -4: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED); + case -5: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED); + case -6: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_LINE_FULL); + case -7: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_UNDERFUNDED); + case -8: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_CROSS_SELF); + case -9: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_SELL_NO_ISSUER); + case -10: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_BUY_NO_ISSUER); + case -11: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_NOT_FOUND); + case -12: return Create(ManageBuyOfferResultCodeEnum.MANAGE_BUY_OFFER_LOW_RESERVE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ManageBuyOfferResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageDataOp.cs b/stellar-dotnet-sdk-xdr/generated/ManageDataOp.cs index 579a1ba7..2b01223c 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageDataOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageDataOp.cs @@ -1,48 +1,42 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // struct ManageDataOp - // { - // string64 dataName; - // DataValue* dataValue; // set to null to clear - // }; +// struct ManageDataOp +// { +// string64 dataName; +// DataValue* dataValue; // set to null to clear +// }; - // =========================================================================== - public class ManageDataOp - { - public ManageDataOp() { } - public String64 DataName { get; set; } - public DataValue DataValue { get; set; } +// =========================================================================== +public class ManageDataOp +{ + public String64 DataName { get; set; } + public DataValue DataValue { get; set; } - public static void Encode(XdrDataOutputStream stream, ManageDataOp encodedManageDataOp) + public static void Encode(XdrDataOutputStream stream, ManageDataOp encodedManageDataOp) + { + String64.Encode(stream, encodedManageDataOp.DataName); + if (encodedManageDataOp.DataValue != null) { - String64.Encode(stream, encodedManageDataOp.DataName); - if (encodedManageDataOp.DataValue != null) - { - stream.WriteInt(1); - DataValue.Encode(stream, encodedManageDataOp.DataValue); - } - else - { - stream.WriteInt(0); - } + stream.WriteInt(1); + DataValue.Encode(stream, encodedManageDataOp.DataValue); } - public static ManageDataOp Decode(XdrDataInputStream stream) + else { - ManageDataOp decodedManageDataOp = new ManageDataOp(); - decodedManageDataOp.DataName = String64.Decode(stream); - int DataValuePresent = stream.ReadInt(); - if (DataValuePresent != 0) - { - decodedManageDataOp.DataValue = DataValue.Decode(stream); - } - return decodedManageDataOp; + stream.WriteInt(0); } } -} + + public static ManageDataOp Decode(XdrDataInputStream stream) + { + var decodedManageDataOp = new ManageDataOp(); + decodedManageDataOp.DataName = String64.Decode(stream); + var DataValuePresent = stream.ReadInt(); + if (DataValuePresent != 0) decodedManageDataOp.DataValue = DataValue.Decode(stream); + return decodedManageDataOp; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageDataResult.cs b/stellar-dotnet-sdk-xdr/generated/ManageDataResult.cs index 20442c2c..3f73b75d 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageDataResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageDataResult.cs @@ -1,51 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union ManageDataResult switch (ManageDataResultCode code) - // { - // case MANAGE_DATA_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class ManageDataResult - { - public ManageDataResult() { } +// union ManageDataResult switch (ManageDataResultCode code) +// { +// case MANAGE_DATA_SUCCESS: +// void; +// case MANAGE_DATA_NOT_SUPPORTED_YET: +// case MANAGE_DATA_NAME_NOT_FOUND: +// case MANAGE_DATA_LOW_RESERVE: +// case MANAGE_DATA_INVALID_NAME: +// void; +// }; - public ManageDataResultCode Discriminant { get; set; } = new ManageDataResultCode(); +// =========================================================================== +public class ManageDataResult +{ + public ManageDataResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, ManageDataResult encodedManageDataResult) + public static void Encode(XdrDataOutputStream stream, ManageDataResult encodedManageDataResult) + { + stream.WriteInt((int)encodedManageDataResult.Discriminant.InnerValue); + switch (encodedManageDataResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedManageDataResult.Discriminant.InnerValue); - switch (encodedManageDataResult.Discriminant.InnerValue) - { - case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS: - break; - default: - break; - } + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS: + break; + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_NOT_SUPPORTED_YET: + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_NAME_NOT_FOUND: + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_LOW_RESERVE: + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_INVALID_NAME: + break; } - public static ManageDataResult Decode(XdrDataInputStream stream) + } + + public static ManageDataResult Decode(XdrDataInputStream stream) + { + var decodedManageDataResult = new ManageDataResult(); + var discriminant = ManageDataResultCode.Decode(stream); + decodedManageDataResult.Discriminant = discriminant; + switch (decodedManageDataResult.Discriminant.InnerValue) { - ManageDataResult decodedManageDataResult = new ManageDataResult(); - ManageDataResultCode discriminant = ManageDataResultCode.Decode(stream); - decodedManageDataResult.Discriminant = discriminant; - switch (decodedManageDataResult.Discriminant.InnerValue) - { - case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS: - break; - default: - break; - } - return decodedManageDataResult; + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS: + break; + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_NOT_SUPPORTED_YET: + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_NAME_NOT_FOUND: + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_LOW_RESERVE: + case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_INVALID_NAME: + break; } + + return decodedManageDataResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageDataResultCode.cs b/stellar-dotnet-sdk-xdr/generated/ManageDataResultCode.cs index d8c8d2f8..b13db5ff 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageDataResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageDataResultCode.cs @@ -1,64 +1,64 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ManageDataResultCode - // { - // // codes considered as "success" for the operation - // MANAGE_DATA_SUCCESS = 0, - // // codes considered as "failure" for the operation - // MANAGE_DATA_NOT_SUPPORTED_YET = - // -1, // The network hasn't moved to this protocol change yet - // MANAGE_DATA_NAME_NOT_FOUND = - // -2, // Trying to remove a Data Entry that isn't there - // MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry - // MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string - // }; +// enum ManageDataResultCode +// { +// // codes considered as "success" for the operation +// MANAGE_DATA_SUCCESS = 0, +// // codes considered as "failure" for the operation +// MANAGE_DATA_NOT_SUPPORTED_YET = +// -1, // The network hasn't moved to this protocol change yet +// MANAGE_DATA_NAME_NOT_FOUND = +// -2, // Trying to remove a Data Entry that isn't there +// MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry +// MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string +// }; - // =========================================================================== - public class ManageDataResultCode +// =========================================================================== +public class ManageDataResultCode +{ + public enum ManageDataResultCodeEnum { - public enum ManageDataResultCodeEnum - { - MANAGE_DATA_SUCCESS = 0, - MANAGE_DATA_NOT_SUPPORTED_YET = -1, - MANAGE_DATA_NAME_NOT_FOUND = -2, - MANAGE_DATA_LOW_RESERVE = -3, - MANAGE_DATA_INVALID_NAME = -4, - } - public ManageDataResultCodeEnum InnerValue { get; set; } = default(ManageDataResultCodeEnum); + MANAGE_DATA_SUCCESS = 0, + MANAGE_DATA_NOT_SUPPORTED_YET = -1, + MANAGE_DATA_NAME_NOT_FOUND = -2, + MANAGE_DATA_LOW_RESERVE = -3, + MANAGE_DATA_INVALID_NAME = -4 + } - public static ManageDataResultCode Create(ManageDataResultCodeEnum v) - { - return new ManageDataResultCode - { - InnerValue = v - }; - } + public ManageDataResultCodeEnum InnerValue { get; set; } = default; - public static ManageDataResultCode Decode(XdrDataInputStream stream) + public static ManageDataResultCode Create(ManageDataResultCodeEnum v) + { + return new ManageDataResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS); - case -1: return Create(ManageDataResultCodeEnum.MANAGE_DATA_NOT_SUPPORTED_YET); - case -2: return Create(ManageDataResultCodeEnum.MANAGE_DATA_NAME_NOT_FOUND); - case -3: return Create(ManageDataResultCodeEnum.MANAGE_DATA_LOW_RESERVE); - case -4: return Create(ManageDataResultCodeEnum.MANAGE_DATA_INVALID_NAME); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ManageDataResultCode value) + public static ManageDataResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS); + case -1: return Create(ManageDataResultCodeEnum.MANAGE_DATA_NOT_SUPPORTED_YET); + case -2: return Create(ManageDataResultCodeEnum.MANAGE_DATA_NAME_NOT_FOUND); + case -3: return Create(ManageDataResultCodeEnum.MANAGE_DATA_LOW_RESERVE); + case -4: return Create(ManageDataResultCodeEnum.MANAGE_DATA_INVALID_NAME); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ManageDataResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageOfferEffect.cs b/stellar-dotnet-sdk-xdr/generated/ManageOfferEffect.cs index 26340ea1..7db9a988 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageOfferEffect.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageOfferEffect.cs @@ -1,54 +1,54 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ManageOfferEffect - // { - // MANAGE_OFFER_CREATED = 0, - // MANAGE_OFFER_UPDATED = 1, - // MANAGE_OFFER_DELETED = 2 - // }; +// enum ManageOfferEffect +// { +// MANAGE_OFFER_CREATED = 0, +// MANAGE_OFFER_UPDATED = 1, +// MANAGE_OFFER_DELETED = 2 +// }; - // =========================================================================== - public class ManageOfferEffect +// =========================================================================== +public class ManageOfferEffect +{ + public enum ManageOfferEffectEnum { - public enum ManageOfferEffectEnum - { - MANAGE_OFFER_CREATED = 0, - MANAGE_OFFER_UPDATED = 1, - MANAGE_OFFER_DELETED = 2, - } - public ManageOfferEffectEnum InnerValue { get; set; } = default(ManageOfferEffectEnum); + MANAGE_OFFER_CREATED = 0, + MANAGE_OFFER_UPDATED = 1, + MANAGE_OFFER_DELETED = 2 + } - public static ManageOfferEffect Create(ManageOfferEffectEnum v) - { - return new ManageOfferEffect - { - InnerValue = v - }; - } + public ManageOfferEffectEnum InnerValue { get; set; } = default; - public static ManageOfferEffect Decode(XdrDataInputStream stream) + public static ManageOfferEffect Create(ManageOfferEffectEnum v) + { + return new ManageOfferEffect { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ManageOfferEffectEnum.MANAGE_OFFER_CREATED); - case 1: return Create(ManageOfferEffectEnum.MANAGE_OFFER_UPDATED); - case 2: return Create(ManageOfferEffectEnum.MANAGE_OFFER_DELETED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ManageOfferEffect value) + public static ManageOfferEffect Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ManageOfferEffectEnum.MANAGE_OFFER_CREATED); + case 1: return Create(ManageOfferEffectEnum.MANAGE_OFFER_UPDATED); + case 2: return Create(ManageOfferEffectEnum.MANAGE_OFFER_DELETED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ManageOfferEffect value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageOfferSuccessResult.cs b/stellar-dotnet-sdk-xdr/generated/ManageOfferSuccessResult.cs index c2bb5a52..63c8c061 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageOfferSuccessResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageOfferSuccessResult.cs @@ -1,95 +1,89 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct ManageOfferSuccessResult +// { +// // offers that got claimed while creating this offer +// ClaimAtom offersClaimed<>; +// +// union switch (ManageOfferEffect effect) +// { +// case MANAGE_OFFER_CREATED: +// case MANAGE_OFFER_UPDATED: +// OfferEntry offer; +// case MANAGE_OFFER_DELETED: +// void; +// } +// offer; +// }; + +// =========================================================================== +public class ManageOfferSuccessResult { + public ClaimAtom[] OffersClaimed { get; set; } + public ManageOfferSuccessResultOffer Offer { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, ManageOfferSuccessResult encodedManageOfferSuccessResult) + { + var offersClaimedsize = encodedManageOfferSuccessResult.OffersClaimed.Length; + stream.WriteInt(offersClaimedsize); + for (var i = 0; i < offersClaimedsize; i++) + ClaimAtom.Encode(stream, encodedManageOfferSuccessResult.OffersClaimed[i]); + ManageOfferSuccessResultOffer.Encode(stream, encodedManageOfferSuccessResult.Offer); + } - // struct ManageOfferSuccessResult - // { - // // offers that got claimed while creating this offer - // ClaimAtom offersClaimed<>; - // - // union switch (ManageOfferEffect effect) - // { - // case MANAGE_OFFER_CREATED: - // case MANAGE_OFFER_UPDATED: - // OfferEntry offer; - // default: - // void; - // } - // offer; - // }; + public static ManageOfferSuccessResult Decode(XdrDataInputStream stream) + { + var decodedManageOfferSuccessResult = new ManageOfferSuccessResult(); + var offersClaimedsize = stream.ReadInt(); + decodedManageOfferSuccessResult.OffersClaimed = new ClaimAtom[offersClaimedsize]; + for (var i = 0; i < offersClaimedsize; i++) + decodedManageOfferSuccessResult.OffersClaimed[i] = ClaimAtom.Decode(stream); + decodedManageOfferSuccessResult.Offer = ManageOfferSuccessResultOffer.Decode(stream); + return decodedManageOfferSuccessResult; + } - // =========================================================================== - public class ManageOfferSuccessResult + public class ManageOfferSuccessResultOffer { - public ManageOfferSuccessResult() { } - public ClaimAtom[] OffersClaimed { get; set; } - public ManageOfferSuccessResultOffer Offer { get; set; } + public ManageOfferEffect Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, ManageOfferSuccessResult encodedManageOfferSuccessResult) - { - int offersClaimedsize = encodedManageOfferSuccessResult.OffersClaimed.Length; - stream.WriteInt(offersClaimedsize); - for (int i = 0; i < offersClaimedsize; i++) - { - ClaimAtom.Encode(stream, encodedManageOfferSuccessResult.OffersClaimed[i]); - } - ManageOfferSuccessResultOffer.Encode(stream, encodedManageOfferSuccessResult.Offer); - } - public static ManageOfferSuccessResult Decode(XdrDataInputStream stream) + public OfferEntry Offer { get; set; } + + public static void Encode(XdrDataOutputStream stream, + ManageOfferSuccessResultOffer encodedManageOfferSuccessResultOffer) { - ManageOfferSuccessResult decodedManageOfferSuccessResult = new ManageOfferSuccessResult(); - int offersClaimedsize = stream.ReadInt(); - decodedManageOfferSuccessResult.OffersClaimed = new ClaimAtom[offersClaimedsize]; - for (int i = 0; i < offersClaimedsize; i++) + stream.WriteInt((int)encodedManageOfferSuccessResultOffer.Discriminant.InnerValue); + switch (encodedManageOfferSuccessResultOffer.Discriminant.InnerValue) { - decodedManageOfferSuccessResult.OffersClaimed[i] = ClaimAtom.Decode(stream); + case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_CREATED: + case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_UPDATED: + OfferEntry.Encode(stream, encodedManageOfferSuccessResultOffer.Offer); + break; + case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_DELETED: + break; } - decodedManageOfferSuccessResult.Offer = ManageOfferSuccessResultOffer.Decode(stream); - return decodedManageOfferSuccessResult; } - public class ManageOfferSuccessResultOffer + public static ManageOfferSuccessResultOffer Decode(XdrDataInputStream stream) { - public ManageOfferSuccessResultOffer() { } - - public ManageOfferEffect Discriminant { get; set; } = new ManageOfferEffect(); - - public OfferEntry Offer { get; set; } - public static void Encode(XdrDataOutputStream stream, ManageOfferSuccessResultOffer encodedManageOfferSuccessResultOffer) - { - stream.WriteInt((int)encodedManageOfferSuccessResultOffer.Discriminant.InnerValue); - switch (encodedManageOfferSuccessResultOffer.Discriminant.InnerValue) - { - case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_CREATED: - case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_UPDATED: - OfferEntry.Encode(stream, encodedManageOfferSuccessResultOffer.Offer); - break; - default: - break; - } - } - public static ManageOfferSuccessResultOffer Decode(XdrDataInputStream stream) + var decodedManageOfferSuccessResultOffer = new ManageOfferSuccessResultOffer(); + var discriminant = ManageOfferEffect.Decode(stream); + decodedManageOfferSuccessResultOffer.Discriminant = discriminant; + switch (decodedManageOfferSuccessResultOffer.Discriminant.InnerValue) { - ManageOfferSuccessResultOffer decodedManageOfferSuccessResultOffer = new ManageOfferSuccessResultOffer(); - ManageOfferEffect discriminant = ManageOfferEffect.Decode(stream); - decodedManageOfferSuccessResultOffer.Discriminant = discriminant; - switch (decodedManageOfferSuccessResultOffer.Discriminant.InnerValue) - { - case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_CREATED: - case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_UPDATED: - decodedManageOfferSuccessResultOffer.Offer = OfferEntry.Decode(stream); - break; - default: - break; - } - return decodedManageOfferSuccessResultOffer; + case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_CREATED: + case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_UPDATED: + decodedManageOfferSuccessResultOffer.Offer = OfferEntry.Decode(stream); + break; + case ManageOfferEffect.ManageOfferEffectEnum.MANAGE_OFFER_DELETED: + break; } + return decodedManageOfferSuccessResultOffer; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageSellOfferOp.cs b/stellar-dotnet-sdk-xdr/generated/ManageSellOfferOp.cs index 1456e1ff..3165f806 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageSellOfferOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageSellOfferOp.cs @@ -1,50 +1,47 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct ManageSellOfferOp +// { +// Asset selling; +// 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; +// }; - // struct ManageSellOfferOp - // { - // Asset selling; - // 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; - // }; +// =========================================================================== +public class ManageSellOfferOp +{ + public Asset Selling { get; set; } + public Asset Buying { get; set; } + public Int64 Amount { get; set; } + public Price Price { get; set; } + public Int64 OfferID { get; set; } - // =========================================================================== - public class ManageSellOfferOp + public static void Encode(XdrDataOutputStream stream, ManageSellOfferOp encodedManageSellOfferOp) { - public ManageSellOfferOp() { } - public Asset Selling { get; set; } - public Asset Buying { get; set; } - public Int64 Amount { get; set; } - public Price Price { get; set; } - public Int64 OfferID { get; set; } + Asset.Encode(stream, encodedManageSellOfferOp.Selling); + Asset.Encode(stream, encodedManageSellOfferOp.Buying); + Int64.Encode(stream, encodedManageSellOfferOp.Amount); + Price.Encode(stream, encodedManageSellOfferOp.Price); + Int64.Encode(stream, encodedManageSellOfferOp.OfferID); + } - public static void Encode(XdrDataOutputStream stream, ManageSellOfferOp encodedManageSellOfferOp) - { - Asset.Encode(stream, encodedManageSellOfferOp.Selling); - Asset.Encode(stream, encodedManageSellOfferOp.Buying); - Int64.Encode(stream, encodedManageSellOfferOp.Amount); - Price.Encode(stream, encodedManageSellOfferOp.Price); - Int64.Encode(stream, encodedManageSellOfferOp.OfferID); - } - public static ManageSellOfferOp Decode(XdrDataInputStream stream) - { - ManageSellOfferOp decodedManageSellOfferOp = new ManageSellOfferOp(); - decodedManageSellOfferOp.Selling = Asset.Decode(stream); - decodedManageSellOfferOp.Buying = Asset.Decode(stream); - decodedManageSellOfferOp.Amount = Int64.Decode(stream); - decodedManageSellOfferOp.Price = Price.Decode(stream); - decodedManageSellOfferOp.OfferID = Int64.Decode(stream); - return decodedManageSellOfferOp; - } + public static ManageSellOfferOp Decode(XdrDataInputStream stream) + { + var decodedManageSellOfferOp = new ManageSellOfferOp(); + decodedManageSellOfferOp.Selling = Asset.Decode(stream); + decodedManageSellOfferOp.Buying = Asset.Decode(stream); + decodedManageSellOfferOp.Amount = Int64.Decode(stream); + decodedManageSellOfferOp.Price = Price.Decode(stream); + decodedManageSellOfferOp.OfferID = Int64.Decode(stream); + return decodedManageSellOfferOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageSellOfferResult.cs b/stellar-dotnet-sdk-xdr/generated/ManageSellOfferResult.cs index 72128720..59595115 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageSellOfferResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageSellOfferResult.cs @@ -1,54 +1,85 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union ManageSellOfferResult switch (ManageSellOfferResultCode code) - // { - // case MANAGE_SELL_OFFER_SUCCESS: - // ManageOfferSuccessResult success; - // default: - // void; - // }; +// union ManageSellOfferResult switch (ManageSellOfferResultCode code) +// { +// case MANAGE_SELL_OFFER_SUCCESS: +// ManageOfferSuccessResult success; +// case MANAGE_SELL_OFFER_MALFORMED: +// case MANAGE_SELL_OFFER_SELL_NO_TRUST: +// case MANAGE_SELL_OFFER_BUY_NO_TRUST: +// case MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED: +// case MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED: +// case MANAGE_SELL_OFFER_LINE_FULL: +// case MANAGE_SELL_OFFER_UNDERFUNDED: +// case MANAGE_SELL_OFFER_CROSS_SELF: +// case MANAGE_SELL_OFFER_SELL_NO_ISSUER: +// case MANAGE_SELL_OFFER_BUY_NO_ISSUER: +// case MANAGE_SELL_OFFER_NOT_FOUND: +// case MANAGE_SELL_OFFER_LOW_RESERVE: +// void; +// }; - // =========================================================================== - public class ManageSellOfferResult - { - public ManageSellOfferResult() { } +// =========================================================================== +public class ManageSellOfferResult +{ + public ManageSellOfferResultCode Discriminant { get; set; } = new(); - public ManageSellOfferResultCode Discriminant { get; set; } = new ManageSellOfferResultCode(); + public ManageOfferSuccessResult Success { get; set; } - public ManageOfferSuccessResult Success { get; set; } - public static void Encode(XdrDataOutputStream stream, ManageSellOfferResult encodedManageSellOfferResult) + public static void Encode(XdrDataOutputStream stream, ManageSellOfferResult encodedManageSellOfferResult) + { + stream.WriteInt((int)encodedManageSellOfferResult.Discriminant.InnerValue); + switch (encodedManageSellOfferResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedManageSellOfferResult.Discriminant.InnerValue); - switch (encodedManageSellOfferResult.Discriminant.InnerValue) - { - case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SUCCESS: - ManageOfferSuccessResult.Encode(stream, encodedManageSellOfferResult.Success); - break; - default: - break; - } + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SUCCESS: + ManageOfferSuccessResult.Encode(stream, encodedManageSellOfferResult.Success); + break; + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_MALFORMED: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NO_TRUST: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NO_TRUST: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_LINE_FULL: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_UNDERFUNDED: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_CROSS_SELF: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NO_ISSUER: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NO_ISSUER: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_NOT_FOUND: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_LOW_RESERVE: + break; } - public static ManageSellOfferResult Decode(XdrDataInputStream stream) + } + + public static ManageSellOfferResult Decode(XdrDataInputStream stream) + { + var decodedManageSellOfferResult = new ManageSellOfferResult(); + var discriminant = ManageSellOfferResultCode.Decode(stream); + decodedManageSellOfferResult.Discriminant = discriminant; + switch (decodedManageSellOfferResult.Discriminant.InnerValue) { - ManageSellOfferResult decodedManageSellOfferResult = new ManageSellOfferResult(); - ManageSellOfferResultCode discriminant = ManageSellOfferResultCode.Decode(stream); - decodedManageSellOfferResult.Discriminant = discriminant; - switch (decodedManageSellOfferResult.Discriminant.InnerValue) - { - case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SUCCESS: - decodedManageSellOfferResult.Success = ManageOfferSuccessResult.Decode(stream); - break; - default: - break; - } - return decodedManageSellOfferResult; + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SUCCESS: + decodedManageSellOfferResult.Success = ManageOfferSuccessResult.Decode(stream); + break; + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_MALFORMED: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NO_TRUST: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NO_TRUST: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_LINE_FULL: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_UNDERFUNDED: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_CROSS_SELF: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NO_ISSUER: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NO_ISSUER: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_NOT_FOUND: + case ManageSellOfferResultCode.ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_LOW_RESERVE: + break; } + + return decodedManageSellOfferResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ManageSellOfferResultCode.cs b/stellar-dotnet-sdk-xdr/generated/ManageSellOfferResultCode.cs index 2806da5f..51862334 100644 --- a/stellar-dotnet-sdk-xdr/generated/ManageSellOfferResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/ManageSellOfferResultCode.cs @@ -1,94 +1,94 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ManageSellOfferResultCode - // { - // // 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 = - // -2, // no trust line for what we're selling - // MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying - // MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell - // MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy - // MANAGE_SELL_OFFER_LINE_FULL = -6, // can't receive more of what it's buying - // MANAGE_SELL_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell - // MANAGE_SELL_OFFER_CROSS_SELF = - // -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 - // }; +// enum ManageSellOfferResultCode +// { +// // 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 = +// -2, // no trust line for what we're selling +// MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying +// MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell +// MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy +// MANAGE_SELL_OFFER_LINE_FULL = -6, // can't receive more of what it's buying +// MANAGE_SELL_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell +// MANAGE_SELL_OFFER_CROSS_SELF = +// -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 +// }; - // =========================================================================== - public class ManageSellOfferResultCode +// =========================================================================== +public class ManageSellOfferResultCode +{ + public enum ManageSellOfferResultCodeEnum { - public enum ManageSellOfferResultCodeEnum - { - MANAGE_SELL_OFFER_SUCCESS = 0, - MANAGE_SELL_OFFER_MALFORMED = -1, - MANAGE_SELL_OFFER_SELL_NO_TRUST = -2, - MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, - MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, - MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5, - MANAGE_SELL_OFFER_LINE_FULL = -6, - MANAGE_SELL_OFFER_UNDERFUNDED = -7, - MANAGE_SELL_OFFER_CROSS_SELF = -8, - MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, - MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, - MANAGE_SELL_OFFER_NOT_FOUND = -11, - MANAGE_SELL_OFFER_LOW_RESERVE = -12, - } - public ManageSellOfferResultCodeEnum InnerValue { get; set; } = default(ManageSellOfferResultCodeEnum); + MANAGE_SELL_OFFER_SUCCESS = 0, + MANAGE_SELL_OFFER_MALFORMED = -1, + MANAGE_SELL_OFFER_SELL_NO_TRUST = -2, + MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, + MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, + MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5, + MANAGE_SELL_OFFER_LINE_FULL = -6, + MANAGE_SELL_OFFER_UNDERFUNDED = -7, + MANAGE_SELL_OFFER_CROSS_SELF = -8, + MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, + MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, + MANAGE_SELL_OFFER_NOT_FOUND = -11, + MANAGE_SELL_OFFER_LOW_RESERVE = -12 + } - public static ManageSellOfferResultCode Create(ManageSellOfferResultCodeEnum v) - { - return new ManageSellOfferResultCode - { - InnerValue = v - }; - } + public ManageSellOfferResultCodeEnum InnerValue { get; set; } = default; - public static ManageSellOfferResultCode Decode(XdrDataInputStream stream) + public static ManageSellOfferResultCode Create(ManageSellOfferResultCodeEnum v) + { + return new ManageSellOfferResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SUCCESS); - case -1: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_MALFORMED); - case -2: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NO_TRUST); - case -3: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NO_TRUST); - case -4: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED); - case -5: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED); - case -6: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_LINE_FULL); - case -7: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_UNDERFUNDED); - case -8: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_CROSS_SELF); - case -9: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NO_ISSUER); - case -10: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NO_ISSUER); - case -11: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_NOT_FOUND); - case -12: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_LOW_RESERVE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ManageSellOfferResultCode value) + public static ManageSellOfferResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SUCCESS); + case -1: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_MALFORMED); + case -2: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NO_TRUST); + case -3: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NO_TRUST); + case -4: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED); + case -5: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED); + case -6: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_LINE_FULL); + case -7: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_UNDERFUNDED); + case -8: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_CROSS_SELF); + case -9: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_SELL_NO_ISSUER); + case -10: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_BUY_NO_ISSUER); + case -11: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_NOT_FOUND); + case -12: return Create(ManageSellOfferResultCodeEnum.MANAGE_SELL_OFFER_LOW_RESERVE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ManageSellOfferResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Memo.cs b/stellar-dotnet-sdk-xdr/generated/Memo.cs index f0e25abd..f6c31cfd 100644 --- a/stellar-dotnet-sdk-xdr/generated/Memo.cs +++ b/stellar-dotnet-sdk-xdr/generated/Memo.cs @@ -1,81 +1,79 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union Memo switch (MemoType type) - // { - // case MEMO_NONE: - // void; - // case MEMO_TEXT: - // string text<28>; - // case MEMO_ID: - // uint64 id; - // case MEMO_HASH: - // Hash hash; // the hash of what to pull from the content server - // case MEMO_RETURN: - // Hash retHash; // the hash of the tx you are rejecting - // }; +// union Memo switch (MemoType type) +// { +// case MEMO_NONE: +// void; +// case MEMO_TEXT: +// string text<28>; +// case MEMO_ID: +// uint64 id; +// case MEMO_HASH: +// Hash hash; // the hash of what to pull from the content server +// case MEMO_RETURN: +// Hash retHash; // the hash of the tx you are rejecting +// }; - // =========================================================================== - public class Memo - { - public Memo() { } +// =========================================================================== +public class Memo +{ + public MemoType Discriminant { get; set; } = new(); - public MemoType Discriminant { get; set; } = new MemoType(); + public string Text { get; set; } + public Uint64 Id { get; set; } + public Hash Hash { get; set; } + public Hash RetHash { get; set; } - public String Text { get; set; } - public Uint64 Id { get; set; } - public Hash Hash { get; set; } - public Hash RetHash { get; set; } - public static void Encode(XdrDataOutputStream stream, Memo encodedMemo) + public static void Encode(XdrDataOutputStream stream, Memo encodedMemo) + { + stream.WriteInt((int)encodedMemo.Discriminant.InnerValue); + switch (encodedMemo.Discriminant.InnerValue) { - stream.WriteInt((int)encodedMemo.Discriminant.InnerValue); - switch (encodedMemo.Discriminant.InnerValue) - { - case MemoType.MemoTypeEnum.MEMO_NONE: - break; - case MemoType.MemoTypeEnum.MEMO_TEXT: - stream.WriteString(encodedMemo.Text); - break; - case MemoType.MemoTypeEnum.MEMO_ID: - Uint64.Encode(stream, encodedMemo.Id); - break; - case MemoType.MemoTypeEnum.MEMO_HASH: - Hash.Encode(stream, encodedMemo.Hash); - break; - case MemoType.MemoTypeEnum.MEMO_RETURN: - Hash.Encode(stream, encodedMemo.RetHash); - break; - } + case MemoType.MemoTypeEnum.MEMO_NONE: + break; + case MemoType.MemoTypeEnum.MEMO_TEXT: + stream.WriteString(encodedMemo.Text); + break; + case MemoType.MemoTypeEnum.MEMO_ID: + Uint64.Encode(stream, encodedMemo.Id); + break; + case MemoType.MemoTypeEnum.MEMO_HASH: + Hash.Encode(stream, encodedMemo.Hash); + break; + case MemoType.MemoTypeEnum.MEMO_RETURN: + Hash.Encode(stream, encodedMemo.RetHash); + break; } - public static Memo Decode(XdrDataInputStream stream) + } + + public static Memo Decode(XdrDataInputStream stream) + { + var decodedMemo = new Memo(); + var discriminant = MemoType.Decode(stream); + decodedMemo.Discriminant = discriminant; + switch (decodedMemo.Discriminant.InnerValue) { - Memo decodedMemo = new Memo(); - MemoType discriminant = MemoType.Decode(stream); - decodedMemo.Discriminant = discriminant; - switch (decodedMemo.Discriminant.InnerValue) - { - case MemoType.MemoTypeEnum.MEMO_NONE: - break; - case MemoType.MemoTypeEnum.MEMO_TEXT: - decodedMemo.Text = stream.ReadString(); - break; - case MemoType.MemoTypeEnum.MEMO_ID: - decodedMemo.Id = Uint64.Decode(stream); - break; - case MemoType.MemoTypeEnum.MEMO_HASH: - decodedMemo.Hash = Hash.Decode(stream); - break; - case MemoType.MemoTypeEnum.MEMO_RETURN: - decodedMemo.RetHash = Hash.Decode(stream); - break; - } - return decodedMemo; + case MemoType.MemoTypeEnum.MEMO_NONE: + break; + case MemoType.MemoTypeEnum.MEMO_TEXT: + decodedMemo.Text = stream.ReadString(); + break; + case MemoType.MemoTypeEnum.MEMO_ID: + decodedMemo.Id = Uint64.Decode(stream); + break; + case MemoType.MemoTypeEnum.MEMO_HASH: + decodedMemo.Hash = Hash.Decode(stream); + break; + case MemoType.MemoTypeEnum.MEMO_RETURN: + decodedMemo.RetHash = Hash.Decode(stream); + break; } + + return decodedMemo; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/MemoType.cs b/stellar-dotnet-sdk-xdr/generated/MemoType.cs index d4aa5914..3d46cc68 100644 --- a/stellar-dotnet-sdk-xdr/generated/MemoType.cs +++ b/stellar-dotnet-sdk-xdr/generated/MemoType.cs @@ -1,60 +1,60 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum MemoType - // { - // MEMO_NONE = 0, - // MEMO_TEXT = 1, - // MEMO_ID = 2, - // MEMO_HASH = 3, - // MEMO_RETURN = 4 - // }; +// enum MemoType +// { +// MEMO_NONE = 0, +// MEMO_TEXT = 1, +// MEMO_ID = 2, +// MEMO_HASH = 3, +// MEMO_RETURN = 4 +// }; - // =========================================================================== - public class MemoType +// =========================================================================== +public class MemoType +{ + public enum MemoTypeEnum { - public enum MemoTypeEnum - { - MEMO_NONE = 0, - MEMO_TEXT = 1, - MEMO_ID = 2, - MEMO_HASH = 3, - MEMO_RETURN = 4, - } - public MemoTypeEnum InnerValue { get; set; } = default(MemoTypeEnum); + MEMO_NONE = 0, + MEMO_TEXT = 1, + MEMO_ID = 2, + MEMO_HASH = 3, + MEMO_RETURN = 4 + } - public static MemoType Create(MemoTypeEnum v) - { - return new MemoType - { - InnerValue = v - }; - } + public MemoTypeEnum InnerValue { get; set; } = default; - public static MemoType Decode(XdrDataInputStream stream) + public static MemoType Create(MemoTypeEnum v) + { + return new MemoType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(MemoTypeEnum.MEMO_NONE); - case 1: return Create(MemoTypeEnum.MEMO_TEXT); - case 2: return Create(MemoTypeEnum.MEMO_ID); - case 3: return Create(MemoTypeEnum.MEMO_HASH); - case 4: return Create(MemoTypeEnum.MEMO_RETURN); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, MemoType value) + public static MemoType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(MemoTypeEnum.MEMO_NONE); + case 1: return Create(MemoTypeEnum.MEMO_TEXT); + case 2: return Create(MemoTypeEnum.MEMO_ID); + case 3: return Create(MemoTypeEnum.MEMO_HASH); + case 4: return Create(MemoTypeEnum.MEMO_RETURN); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, MemoType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/MessageType.cs b/stellar-dotnet-sdk-xdr/generated/MessageType.cs index 92b97315..dc7552a5 100644 --- a/stellar-dotnet-sdk-xdr/generated/MessageType.cs +++ b/stellar-dotnet-sdk-xdr/generated/MessageType.cs @@ -1,102 +1,115 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum MessageType - // { - // ERROR_MSG = 0, - // AUTH = 2, - // DONT_HAVE = 3, - // - // GET_PEERS = 4, // gets a list of peers this guy knows about - // PEERS = 5, - // - // GET_TX_SET = 6, // gets a particular txset by hash - // TX_SET = 7, - // - // 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, - // SURVEY_RESPONSE = 15, - // - // SEND_MORE = 16 - // }; +// enum MessageType +// { +// ERROR_MSG = 0, +// AUTH = 2, +// DONT_HAVE = 3, +// +// GET_PEERS = 4, // gets a list of peers this guy knows about +// 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, +// SURVEY_RESPONSE = 15, +// +// SEND_MORE = 16, +// SEND_MORE_EXTENDED = 20, +// +// FLOOD_ADVERT = 18, +// FLOOD_DEMAND = 19 +// }; - // =========================================================================== - public class MessageType +// =========================================================================== +public class MessageType +{ + public enum MessageTypeEnum { - public enum MessageTypeEnum - { - ERROR_MSG = 0, - AUTH = 2, - DONT_HAVE = 3, - GET_PEERS = 4, - PEERS = 5, - GET_TX_SET = 6, - TX_SET = 7, - TRANSACTION = 8, - GET_SCP_QUORUMSET = 9, - SCP_QUORUMSET = 10, - SCP_MESSAGE = 11, - GET_SCP_STATE = 12, - HELLO = 13, - SURVEY_REQUEST = 14, - SURVEY_RESPONSE = 15, - SEND_MORE = 16, - } - public MessageTypeEnum InnerValue { get; set; } = default(MessageTypeEnum); + ERROR_MSG = 0, + AUTH = 2, + DONT_HAVE = 3, + GET_PEERS = 4, + PEERS = 5, + GET_TX_SET = 6, + TX_SET = 7, + GENERALIZED_TX_SET = 17, + TRANSACTION = 8, + GET_SCP_QUORUMSET = 9, + SCP_QUORUMSET = 10, + SCP_MESSAGE = 11, + GET_SCP_STATE = 12, + HELLO = 13, + SURVEY_REQUEST = 14, + SURVEY_RESPONSE = 15, + SEND_MORE = 16, + SEND_MORE_EXTENDED = 20, + FLOOD_ADVERT = 18, + FLOOD_DEMAND = 19 + } - public static MessageType Create(MessageTypeEnum v) - { - return new MessageType - { - InnerValue = v - }; - } + public MessageTypeEnum InnerValue { get; set; } = default; - public static MessageType Decode(XdrDataInputStream stream) + public static MessageType Create(MessageTypeEnum v) + { + return new MessageType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(MessageTypeEnum.ERROR_MSG); - case 2: return Create(MessageTypeEnum.AUTH); - case 3: return Create(MessageTypeEnum.DONT_HAVE); - case 4: return Create(MessageTypeEnum.GET_PEERS); - case 5: return Create(MessageTypeEnum.PEERS); - case 6: return Create(MessageTypeEnum.GET_TX_SET); - case 7: return Create(MessageTypeEnum.TX_SET); - case 8: return Create(MessageTypeEnum.TRANSACTION); - case 9: return Create(MessageTypeEnum.GET_SCP_QUORUMSET); - case 10: return Create(MessageTypeEnum.SCP_QUORUMSET); - case 11: return Create(MessageTypeEnum.SCP_MESSAGE); - case 12: return Create(MessageTypeEnum.GET_SCP_STATE); - case 13: return Create(MessageTypeEnum.HELLO); - case 14: return Create(MessageTypeEnum.SURVEY_REQUEST); - case 15: return Create(MessageTypeEnum.SURVEY_RESPONSE); - case 16: return Create(MessageTypeEnum.SEND_MORE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, MessageType value) + public static MessageType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(MessageTypeEnum.ERROR_MSG); + case 2: return Create(MessageTypeEnum.AUTH); + case 3: return Create(MessageTypeEnum.DONT_HAVE); + case 4: return Create(MessageTypeEnum.GET_PEERS); + case 5: return Create(MessageTypeEnum.PEERS); + case 6: return Create(MessageTypeEnum.GET_TX_SET); + case 7: return Create(MessageTypeEnum.TX_SET); + case 17: return Create(MessageTypeEnum.GENERALIZED_TX_SET); + case 8: return Create(MessageTypeEnum.TRANSACTION); + case 9: return Create(MessageTypeEnum.GET_SCP_QUORUMSET); + case 10: return Create(MessageTypeEnum.SCP_QUORUMSET); + case 11: return Create(MessageTypeEnum.SCP_MESSAGE); + case 12: return Create(MessageTypeEnum.GET_SCP_STATE); + case 13: return Create(MessageTypeEnum.HELLO); + case 14: return Create(MessageTypeEnum.SURVEY_REQUEST); + case 15: return Create(MessageTypeEnum.SURVEY_RESPONSE); + case 16: return Create(MessageTypeEnum.SEND_MORE); + case 20: return Create(MessageTypeEnum.SEND_MORE_EXTENDED); + case 18: return Create(MessageTypeEnum.FLOOD_ADVERT); + case 19: return Create(MessageTypeEnum.FLOOD_DEMAND); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, MessageType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/MuxedAccount.cs b/stellar-dotnet-sdk-xdr/generated/MuxedAccount.cs index 89508f2f..4769de21 100644 --- a/stellar-dotnet-sdk-xdr/generated/MuxedAccount.cs +++ b/stellar-dotnet-sdk-xdr/generated/MuxedAccount.cs @@ -1,82 +1,79 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union MuxedAccount switch (CryptoKeyType type) - // { - // case KEY_TYPE_ED25519: - // uint256 ed25519; - // case KEY_TYPE_MUXED_ED25519: - // struct - // { - // uint64 id; - // uint256 ed25519; - // } med25519; - // }; +// union MuxedAccount switch (CryptoKeyType type) +// { +// case KEY_TYPE_ED25519: +// uint256 ed25519; +// case KEY_TYPE_MUXED_ED25519: +// struct +// { +// uint64 id; +// uint256 ed25519; +// } med25519; +// }; - // =========================================================================== - public class MuxedAccount - { - public MuxedAccount() { } +// =========================================================================== +public class MuxedAccount +{ + public CryptoKeyType Discriminant { get; set; } = new(); - public CryptoKeyType Discriminant { get; set; } = new CryptoKeyType(); + public Uint256 Ed25519 { get; set; } + public MuxedAccountMed25519 Med25519 { get; set; } - public Uint256 Ed25519 { get; set; } - public MuxedAccountMed25519 Med25519 { get; set; } - public static void Encode(XdrDataOutputStream stream, MuxedAccount encodedMuxedAccount) + public static void Encode(XdrDataOutputStream stream, MuxedAccount encodedMuxedAccount) + { + stream.WriteInt((int)encodedMuxedAccount.Discriminant.InnerValue); + switch (encodedMuxedAccount.Discriminant.InnerValue) { - stream.WriteInt((int)encodedMuxedAccount.Discriminant.InnerValue); - switch (encodedMuxedAccount.Discriminant.InnerValue) - { - case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: - Uint256.Encode(stream, encodedMuxedAccount.Ed25519); - break; - case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519: - MuxedAccountMed25519.Encode(stream, encodedMuxedAccount.Med25519); - break; - } + case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: + Uint256.Encode(stream, encodedMuxedAccount.Ed25519); + break; + case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519: + MuxedAccountMed25519.Encode(stream, encodedMuxedAccount.Med25519); + break; } - public static MuxedAccount Decode(XdrDataInputStream stream) + } + + public static MuxedAccount Decode(XdrDataInputStream stream) + { + var decodedMuxedAccount = new MuxedAccount(); + var discriminant = CryptoKeyType.Decode(stream); + decodedMuxedAccount.Discriminant = discriminant; + switch (decodedMuxedAccount.Discriminant.InnerValue) { - MuxedAccount decodedMuxedAccount = new MuxedAccount(); - CryptoKeyType discriminant = CryptoKeyType.Decode(stream); - decodedMuxedAccount.Discriminant = discriminant; - switch (decodedMuxedAccount.Discriminant.InnerValue) - { - case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: - decodedMuxedAccount.Ed25519 = Uint256.Decode(stream); - break; - case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519: - decodedMuxedAccount.Med25519 = MuxedAccountMed25519.Decode(stream); - break; - } - return decodedMuxedAccount; + case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: + decodedMuxedAccount.Ed25519 = Uint256.Decode(stream); + break; + case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519: + decodedMuxedAccount.Med25519 = MuxedAccountMed25519.Decode(stream); + break; } - public class MuxedAccountMed25519 - { - public MuxedAccountMed25519() { } - public Uint64 Id { get; set; } - public Uint256 Ed25519 { get; set; } + return decodedMuxedAccount; + } + + public class MuxedAccountMed25519 + { + public Uint64 Id { get; set; } + public Uint256 Ed25519 { get; set; } - public static void Encode(XdrDataOutputStream stream, MuxedAccountMed25519 encodedMuxedAccountMed25519) - { - Uint64.Encode(stream, encodedMuxedAccountMed25519.Id); - Uint256.Encode(stream, encodedMuxedAccountMed25519.Ed25519); - } - public static MuxedAccountMed25519 Decode(XdrDataInputStream stream) - { - MuxedAccountMed25519 decodedMuxedAccountMed25519 = new MuxedAccountMed25519(); - decodedMuxedAccountMed25519.Id = Uint64.Decode(stream); - decodedMuxedAccountMed25519.Ed25519 = Uint256.Decode(stream); - return decodedMuxedAccountMed25519; - } + public static void Encode(XdrDataOutputStream stream, MuxedAccountMed25519 encodedMuxedAccountMed25519) + { + Uint64.Encode(stream, encodedMuxedAccountMed25519.Id); + Uint256.Encode(stream, encodedMuxedAccountMed25519.Ed25519); + } + public static MuxedAccountMed25519 Decode(XdrDataInputStream stream) + { + var decodedMuxedAccountMed25519 = new MuxedAccountMed25519(); + decodedMuxedAccountMed25519.Id = Uint64.Decode(stream); + decodedMuxedAccountMed25519.Ed25519 = Uint256.Decode(stream); + return decodedMuxedAccountMed25519; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/NodeID.cs b/stellar-dotnet-sdk-xdr/generated/NodeID.cs index a57f418d..a9908142 100644 --- a/stellar-dotnet-sdk-xdr/generated/NodeID.cs +++ b/stellar-dotnet-sdk-xdr/generated/NodeID.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef PublicKey NodeID; + +// =========================================================================== +public class NodeID { + public NodeID() + { + } - // === xdr source ============================================================ + public NodeID(PublicKey value) + { + InnerValue = value; + } + + public PublicKey InnerValue { get; set; } = default; - // typedef PublicKey NodeID; + public static void Encode(XdrDataOutputStream stream, NodeID encodedNodeID) + { + PublicKey.Encode(stream, encodedNodeID.InnerValue); + } - // =========================================================================== - public class NodeID + public static NodeID Decode(XdrDataInputStream stream) { - public PublicKey InnerValue { get; set; } = default(PublicKey); - - public NodeID() { } - - public NodeID(PublicKey value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, NodeID encodedNodeID) - { - PublicKey.Encode(stream, encodedNodeID.InnerValue); - } - public static NodeID Decode(XdrDataInputStream stream) - { - NodeID decodedNodeID = new NodeID(); - decodedNodeID.InnerValue = PublicKey.Decode(stream); - return decodedNodeID; - } + var decodedNodeID = new NodeID(); + decodedNodeID.InnerValue = PublicKey.Decode(stream); + return decodedNodeID; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/OfferEntry.cs b/stellar-dotnet-sdk-xdr/generated/OfferEntry.cs index 20c4adbd..6816e3d6 100644 --- a/stellar-dotnet-sdk-xdr/generated/OfferEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/OfferEntry.cs @@ -1,103 +1,99 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct OfferEntry +// { +// AccountID sellerID; +// int64 offerID; +// 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 +// price is after fees +// */ +// Price price; +// uint32 flags; // see OfferEntryFlags +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; + +// =========================================================================== +public class OfferEntry { + public AccountID SellerID { get; set; } + public Int64 OfferID { get; set; } + public Asset Selling { get; set; } + public Asset Buying { get; set; } + public Int64 Amount { get; set; } + public Price Price { get; set; } + public Uint32 Flags { get; set; } + public OfferEntryExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, OfferEntry encodedOfferEntry) + { + AccountID.Encode(stream, encodedOfferEntry.SellerID); + Int64.Encode(stream, encodedOfferEntry.OfferID); + Asset.Encode(stream, encodedOfferEntry.Selling); + Asset.Encode(stream, encodedOfferEntry.Buying); + Int64.Encode(stream, encodedOfferEntry.Amount); + Price.Encode(stream, encodedOfferEntry.Price); + Uint32.Encode(stream, encodedOfferEntry.Flags); + OfferEntryExt.Encode(stream, encodedOfferEntry.Ext); + } - // struct OfferEntry - // { - // AccountID sellerID; - // int64 offerID; - // 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 - // price is after fees - // */ - // Price price; - // uint32 flags; // see OfferEntryFlags - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static OfferEntry Decode(XdrDataInputStream stream) + { + var decodedOfferEntry = new OfferEntry(); + decodedOfferEntry.SellerID = AccountID.Decode(stream); + decodedOfferEntry.OfferID = Int64.Decode(stream); + decodedOfferEntry.Selling = Asset.Decode(stream); + decodedOfferEntry.Buying = Asset.Decode(stream); + decodedOfferEntry.Amount = Int64.Decode(stream); + decodedOfferEntry.Price = Price.Decode(stream); + decodedOfferEntry.Flags = Uint32.Decode(stream); + decodedOfferEntry.Ext = OfferEntryExt.Decode(stream); + return decodedOfferEntry; + } - // =========================================================================== - public class OfferEntry + public class OfferEntryExt { - public OfferEntry() { } - public AccountID SellerID { get; set; } - public Int64 OfferID { get; set; } - public Asset Selling { get; set; } - public Asset Buying { get; set; } - public Int64 Amount { get; set; } - public Price Price { get; set; } - public Uint32 Flags { get; set; } - public OfferEntryExt Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, OfferEntry encodedOfferEntry) + public static void Encode(XdrDataOutputStream stream, OfferEntryExt encodedOfferEntryExt) { - AccountID.Encode(stream, encodedOfferEntry.SellerID); - Int64.Encode(stream, encodedOfferEntry.OfferID); - Asset.Encode(stream, encodedOfferEntry.Selling); - Asset.Encode(stream, encodedOfferEntry.Buying); - Int64.Encode(stream, encodedOfferEntry.Amount); - Price.Encode(stream, encodedOfferEntry.Price); - Uint32.Encode(stream, encodedOfferEntry.Flags); - OfferEntryExt.Encode(stream, encodedOfferEntry.Ext); - } - public static OfferEntry Decode(XdrDataInputStream stream) - { - OfferEntry decodedOfferEntry = new OfferEntry(); - decodedOfferEntry.SellerID = AccountID.Decode(stream); - decodedOfferEntry.OfferID = Int64.Decode(stream); - decodedOfferEntry.Selling = Asset.Decode(stream); - decodedOfferEntry.Buying = Asset.Decode(stream); - decodedOfferEntry.Amount = Int64.Decode(stream); - decodedOfferEntry.Price = Price.Decode(stream); - decodedOfferEntry.Flags = Uint32.Decode(stream); - decodedOfferEntry.Ext = OfferEntryExt.Decode(stream); - return decodedOfferEntry; + stream.WriteInt(encodedOfferEntryExt.Discriminant); + switch (encodedOfferEntryExt.Discriminant) + { + case 0: + break; + } } - public class OfferEntryExt + public static OfferEntryExt Decode(XdrDataInputStream stream) { - public OfferEntryExt() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, OfferEntryExt encodedOfferEntryExt) - { - stream.WriteInt((int)encodedOfferEntryExt.Discriminant); - switch (encodedOfferEntryExt.Discriminant) - { - case 0: - break; - } - } - public static OfferEntryExt Decode(XdrDataInputStream stream) + var decodedOfferEntryExt = new OfferEntryExt(); + var discriminant = stream.ReadInt(); + decodedOfferEntryExt.Discriminant = discriminant; + switch (decodedOfferEntryExt.Discriminant) { - OfferEntryExt decodedOfferEntryExt = new OfferEntryExt(); - int discriminant = stream.ReadInt(); - decodedOfferEntryExt.Discriminant = discriminant; - switch (decodedOfferEntryExt.Discriminant) - { - case 0: - break; - } - return decodedOfferEntryExt; + case 0: + break; } + return decodedOfferEntryExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/OfferEntryFlags.cs b/stellar-dotnet-sdk-xdr/generated/OfferEntryFlags.cs index 019dd9ef..b57891bf 100644 --- a/stellar-dotnet-sdk-xdr/generated/OfferEntryFlags.cs +++ b/stellar-dotnet-sdk-xdr/generated/OfferEntryFlags.cs @@ -1,50 +1,50 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum OfferEntryFlags - // { - // // an offer with this flag will not act on and take a reverse offer of equal - // // price - // PASSIVE_FLAG = 1 - // }; +// enum OfferEntryFlags +// { +// // an offer with this flag will not act on and take a reverse offer of equal +// // price +// PASSIVE_FLAG = 1 +// }; - // =========================================================================== - public class OfferEntryFlags +// =========================================================================== +public class OfferEntryFlags +{ + public enum OfferEntryFlagsEnum { - public enum OfferEntryFlagsEnum - { - PASSIVE_FLAG = 1, - } - public OfferEntryFlagsEnum InnerValue { get; set; } = default(OfferEntryFlagsEnum); + PASSIVE_FLAG = 1 + } - public static OfferEntryFlags Create(OfferEntryFlagsEnum v) - { - return new OfferEntryFlags - { - InnerValue = v - }; - } + public OfferEntryFlagsEnum InnerValue { get; set; } = default; - public static OfferEntryFlags Decode(XdrDataInputStream stream) + public static OfferEntryFlags Create(OfferEntryFlagsEnum v) + { + return new OfferEntryFlags { - int value = stream.ReadInt(); - switch (value) - { - case 1: return Create(OfferEntryFlagsEnum.PASSIVE_FLAG); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, OfferEntryFlags value) + public static OfferEntryFlags Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 1: return Create(OfferEntryFlagsEnum.PASSIVE_FLAG); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, OfferEntryFlags value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Operation.cs b/stellar-dotnet-sdk-xdr/generated/Operation.cs index d04511b4..bf28de18 100644 --- a/stellar-dotnet-sdk-xdr/generated/Operation.cs +++ b/stellar-dotnet-sdk-xdr/generated/Operation.cs @@ -1,291 +1,315 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // struct Operation - // { - // // sourceAccount is the account used to run the operation - // // if not set, the runtime defaults to "sourceAccount" specified at - // // the transaction level - // MuxedAccount* sourceAccount; - // - // union switch (OperationType type) - // { - // case CREATE_ACCOUNT: - // CreateAccountOp createAccountOp; - // case PAYMENT: - // PaymentOp paymentOp; - // case PATH_PAYMENT_STRICT_RECEIVE: - // PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp; - // case MANAGE_SELL_OFFER: - // ManageSellOfferOp manageSellOfferOp; - // case CREATE_PASSIVE_SELL_OFFER: - // CreatePassiveSellOfferOp createPassiveSellOfferOp; - // case SET_OPTIONS: - // SetOptionsOp setOptionsOp; - // case CHANGE_TRUST: - // ChangeTrustOp changeTrustOp; - // case ALLOW_TRUST: - // AllowTrustOp allowTrustOp; - // case ACCOUNT_MERGE: - // MuxedAccount destination; - // case INFLATION: - // void; - // case MANAGE_DATA: - // ManageDataOp manageDataOp; - // case BUMP_SEQUENCE: - // BumpSequenceOp bumpSequenceOp; - // case MANAGE_BUY_OFFER: - // ManageBuyOfferOp manageBuyOfferOp; - // case PATH_PAYMENT_STRICT_SEND: - // PathPaymentStrictSendOp pathPaymentStrictSendOp; - // case CREATE_CLAIMABLE_BALANCE: - // CreateClaimableBalanceOp createClaimableBalanceOp; - // case CLAIM_CLAIMABLE_BALANCE: - // ClaimClaimableBalanceOp claimClaimableBalanceOp; - // case BEGIN_SPONSORING_FUTURE_RESERVES: - // BeginSponsoringFutureReservesOp beginSponsoringFutureReservesOp; - // case END_SPONSORING_FUTURE_RESERVES: - // void; - // case REVOKE_SPONSORSHIP: - // RevokeSponsorshipOp revokeSponsorshipOp; - // case CLAWBACK: - // ClawbackOp clawbackOp; - // case CLAWBACK_CLAIMABLE_BALANCE: - // ClawbackClaimableBalanceOp clawbackClaimableBalanceOp; - // case SET_TRUST_LINE_FLAGS: - // SetTrustLineFlagsOp setTrustLineFlagsOp; - // case LIQUIDITY_POOL_DEPOSIT: - // LiquidityPoolDepositOp liquidityPoolDepositOp; - // case LIQUIDITY_POOL_WITHDRAW: - // LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; - // } - // body; - // }; +// struct Operation +// { +// // sourceAccount is the account used to run the operation +// // if not set, the runtime defaults to "sourceAccount" specified at +// // the transaction level +// MuxedAccount* sourceAccount; +// +// union switch (OperationType type) +// { +// case CREATE_ACCOUNT: +// CreateAccountOp createAccountOp; +// case PAYMENT: +// PaymentOp paymentOp; +// case PATH_PAYMENT_STRICT_RECEIVE: +// PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp; +// case MANAGE_SELL_OFFER: +// ManageSellOfferOp manageSellOfferOp; +// case CREATE_PASSIVE_SELL_OFFER: +// CreatePassiveSellOfferOp createPassiveSellOfferOp; +// case SET_OPTIONS: +// SetOptionsOp setOptionsOp; +// case CHANGE_TRUST: +// ChangeTrustOp changeTrustOp; +// case ALLOW_TRUST: +// AllowTrustOp allowTrustOp; +// case ACCOUNT_MERGE: +// MuxedAccount destination; +// case INFLATION: +// void; +// case MANAGE_DATA: +// ManageDataOp manageDataOp; +// case BUMP_SEQUENCE: +// BumpSequenceOp bumpSequenceOp; +// case MANAGE_BUY_OFFER: +// ManageBuyOfferOp manageBuyOfferOp; +// case PATH_PAYMENT_STRICT_SEND: +// PathPaymentStrictSendOp pathPaymentStrictSendOp; +// case CREATE_CLAIMABLE_BALANCE: +// CreateClaimableBalanceOp createClaimableBalanceOp; +// case CLAIM_CLAIMABLE_BALANCE: +// ClaimClaimableBalanceOp claimClaimableBalanceOp; +// case BEGIN_SPONSORING_FUTURE_RESERVES: +// BeginSponsoringFutureReservesOp beginSponsoringFutureReservesOp; +// case END_SPONSORING_FUTURE_RESERVES: +// void; +// case REVOKE_SPONSORSHIP: +// RevokeSponsorshipOp revokeSponsorshipOp; +// case CLAWBACK: +// ClawbackOp clawbackOp; +// case CLAWBACK_CLAIMABLE_BALANCE: +// ClawbackClaimableBalanceOp clawbackClaimableBalanceOp; +// case SET_TRUST_LINE_FLAGS: +// SetTrustLineFlagsOp setTrustLineFlagsOp; +// case LIQUIDITY_POOL_DEPOSIT: +// LiquidityPoolDepositOp liquidityPoolDepositOp; +// case LIQUIDITY_POOL_WITHDRAW: +// LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; +// case INVOKE_HOST_FUNCTION: +// InvokeHostFunctionOp invokeHostFunctionOp; +// case EXTEND_FOOTPRINT_TTL: +// ExtendFootprintTTLOp extendFootprintTTLOp; +// case RESTORE_FOOTPRINT: +// RestoreFootprintOp restoreFootprintOp; +// } +// body; +// }; - // =========================================================================== - public class Operation - { - public Operation() { } - public MuxedAccount SourceAccount { get; set; } - public OperationBody Body { get; set; } +// =========================================================================== +public class Operation +{ + public MuxedAccount SourceAccount { get; set; } + public OperationBody Body { get; set; } - public static void Encode(XdrDataOutputStream stream, Operation encodedOperation) + public static void Encode(XdrDataOutputStream stream, Operation encodedOperation) + { + if (encodedOperation.SourceAccount != null) { - if (encodedOperation.SourceAccount != null) - { - stream.WriteInt(1); - MuxedAccount.Encode(stream, encodedOperation.SourceAccount); - } - else - { - stream.WriteInt(0); - } - OperationBody.Encode(stream, encodedOperation.Body); + stream.WriteInt(1); + MuxedAccount.Encode(stream, encodedOperation.SourceAccount); } - public static Operation Decode(XdrDataInputStream stream) + else { - Operation decodedOperation = new Operation(); - int SourceAccountPresent = stream.ReadInt(); - if (SourceAccountPresent != 0) - { - decodedOperation.SourceAccount = MuxedAccount.Decode(stream); - } - decodedOperation.Body = OperationBody.Decode(stream); - return decodedOperation; + stream.WriteInt(0); } - public class OperationBody - { - public OperationBody() { } + OperationBody.Encode(stream, encodedOperation.Body); + } + + public static Operation Decode(XdrDataInputStream stream) + { + var decodedOperation = new Operation(); + var SourceAccountPresent = stream.ReadInt(); + if (SourceAccountPresent != 0) decodedOperation.SourceAccount = MuxedAccount.Decode(stream); + decodedOperation.Body = OperationBody.Decode(stream); + return decodedOperation; + } + + public class OperationBody + { + public OperationType Discriminant { get; set; } = new(); - public OperationType Discriminant { get; set; } = new OperationType(); + public CreateAccountOp CreateAccountOp { get; set; } + public PaymentOp PaymentOp { get; set; } + public PathPaymentStrictReceiveOp PathPaymentStrictReceiveOp { get; set; } + public ManageSellOfferOp ManageSellOfferOp { get; set; } + public CreatePassiveSellOfferOp CreatePassiveSellOfferOp { get; set; } + public SetOptionsOp SetOptionsOp { get; set; } + public ChangeTrustOp ChangeTrustOp { get; set; } + public AllowTrustOp AllowTrustOp { get; set; } + public MuxedAccount Destination { get; set; } + public ManageDataOp ManageDataOp { get; set; } + public BumpSequenceOp BumpSequenceOp { get; set; } + public ManageBuyOfferOp ManageBuyOfferOp { get; set; } + public PathPaymentStrictSendOp PathPaymentStrictSendOp { get; set; } + public CreateClaimableBalanceOp CreateClaimableBalanceOp { get; set; } + public ClaimClaimableBalanceOp ClaimClaimableBalanceOp { get; set; } + public BeginSponsoringFutureReservesOp BeginSponsoringFutureReservesOp { get; set; } + public RevokeSponsorshipOp RevokeSponsorshipOp { get; set; } + public ClawbackOp ClawbackOp { get; set; } + public ClawbackClaimableBalanceOp ClawbackClaimableBalanceOp { get; set; } + public SetTrustLineFlagsOp SetTrustLineFlagsOp { get; set; } + public LiquidityPoolDepositOp LiquidityPoolDepositOp { get; set; } + public LiquidityPoolWithdrawOp LiquidityPoolWithdrawOp { get; set; } + public InvokeHostFunctionOp InvokeHostFunctionOp { get; set; } + public ExtendFootprintTTLOp ExtendFootprintTTLOp { get; set; } + public RestoreFootprintOp RestoreFootprintOp { get; set; } - public CreateAccountOp CreateAccountOp { get; set; } - public PaymentOp PaymentOp { get; set; } - public PathPaymentStrictReceiveOp PathPaymentStrictReceiveOp { get; set; } - public ManageSellOfferOp ManageSellOfferOp { get; set; } - public CreatePassiveSellOfferOp CreatePassiveSellOfferOp { get; set; } - public SetOptionsOp SetOptionsOp { get; set; } - public ChangeTrustOp ChangeTrustOp { get; set; } - public AllowTrustOp AllowTrustOp { get; set; } - public MuxedAccount Destination { get; set; } - public ManageDataOp ManageDataOp { get; set; } - public BumpSequenceOp BumpSequenceOp { get; set; } - public ManageBuyOfferOp ManageBuyOfferOp { get; set; } - public PathPaymentStrictSendOp PathPaymentStrictSendOp { get; set; } - public CreateClaimableBalanceOp CreateClaimableBalanceOp { get; set; } - public ClaimClaimableBalanceOp ClaimClaimableBalanceOp { get; set; } - public BeginSponsoringFutureReservesOp BeginSponsoringFutureReservesOp { get; set; } - public RevokeSponsorshipOp RevokeSponsorshipOp { get; set; } - public ClawbackOp ClawbackOp { get; set; } - public ClawbackClaimableBalanceOp ClawbackClaimableBalanceOp { get; set; } - public SetTrustLineFlagsOp SetTrustLineFlagsOp { get; set; } - public LiquidityPoolDepositOp LiquidityPoolDepositOp { get; set; } - public LiquidityPoolWithdrawOp LiquidityPoolWithdrawOp { get; set; } - public static void Encode(XdrDataOutputStream stream, OperationBody encodedOperationBody) + public static void Encode(XdrDataOutputStream stream, OperationBody encodedOperationBody) + { + stream.WriteInt((int)encodedOperationBody.Discriminant.InnerValue); + switch (encodedOperationBody.Discriminant.InnerValue) { - stream.WriteInt((int)encodedOperationBody.Discriminant.InnerValue); - switch (encodedOperationBody.Discriminant.InnerValue) - { - case OperationType.OperationTypeEnum.CREATE_ACCOUNT: - CreateAccountOp.Encode(stream, encodedOperationBody.CreateAccountOp); - break; - case OperationType.OperationTypeEnum.PAYMENT: - PaymentOp.Encode(stream, encodedOperationBody.PaymentOp); - break; - case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: - PathPaymentStrictReceiveOp.Encode(stream, encodedOperationBody.PathPaymentStrictReceiveOp); - break; - case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: - ManageSellOfferOp.Encode(stream, encodedOperationBody.ManageSellOfferOp); - break; - case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: - CreatePassiveSellOfferOp.Encode(stream, encodedOperationBody.CreatePassiveSellOfferOp); - break; - case OperationType.OperationTypeEnum.SET_OPTIONS: - SetOptionsOp.Encode(stream, encodedOperationBody.SetOptionsOp); - break; - case OperationType.OperationTypeEnum.CHANGE_TRUST: - ChangeTrustOp.Encode(stream, encodedOperationBody.ChangeTrustOp); - break; - case OperationType.OperationTypeEnum.ALLOW_TRUST: - AllowTrustOp.Encode(stream, encodedOperationBody.AllowTrustOp); - break; - case OperationType.OperationTypeEnum.ACCOUNT_MERGE: - MuxedAccount.Encode(stream, encodedOperationBody.Destination); - break; - case OperationType.OperationTypeEnum.INFLATION: - break; - case OperationType.OperationTypeEnum.MANAGE_DATA: - ManageDataOp.Encode(stream, encodedOperationBody.ManageDataOp); - break; - case OperationType.OperationTypeEnum.BUMP_SEQUENCE: - BumpSequenceOp.Encode(stream, encodedOperationBody.BumpSequenceOp); - break; - case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: - ManageBuyOfferOp.Encode(stream, encodedOperationBody.ManageBuyOfferOp); - break; - case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: - PathPaymentStrictSendOp.Encode(stream, encodedOperationBody.PathPaymentStrictSendOp); - break; - case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE: - CreateClaimableBalanceOp.Encode(stream, encodedOperationBody.CreateClaimableBalanceOp); - break; - case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE: - ClaimClaimableBalanceOp.Encode(stream, encodedOperationBody.ClaimClaimableBalanceOp); - break; - case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES: - BeginSponsoringFutureReservesOp.Encode(stream, encodedOperationBody.BeginSponsoringFutureReservesOp); - break; - case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES: - break; - case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP: - RevokeSponsorshipOp.Encode(stream, encodedOperationBody.RevokeSponsorshipOp); - break; - case OperationType.OperationTypeEnum.CLAWBACK: - ClawbackOp.Encode(stream, encodedOperationBody.ClawbackOp); - break; - case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE: - ClawbackClaimableBalanceOp.Encode(stream, encodedOperationBody.ClawbackClaimableBalanceOp); - break; - case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS: - SetTrustLineFlagsOp.Encode(stream, encodedOperationBody.SetTrustLineFlagsOp); - break; - case OperationType.OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT: - LiquidityPoolDepositOp.Encode(stream, encodedOperationBody.LiquidityPoolDepositOp); - break; - case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: - LiquidityPoolWithdrawOp.Encode(stream, encodedOperationBody.LiquidityPoolWithdrawOp); - break; - } + case OperationType.OperationTypeEnum.CREATE_ACCOUNT: + CreateAccountOp.Encode(stream, encodedOperationBody.CreateAccountOp); + break; + case OperationType.OperationTypeEnum.PAYMENT: + PaymentOp.Encode(stream, encodedOperationBody.PaymentOp); + break; + case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: + PathPaymentStrictReceiveOp.Encode(stream, encodedOperationBody.PathPaymentStrictReceiveOp); + break; + case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: + ManageSellOfferOp.Encode(stream, encodedOperationBody.ManageSellOfferOp); + break; + case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: + CreatePassiveSellOfferOp.Encode(stream, encodedOperationBody.CreatePassiveSellOfferOp); + break; + case OperationType.OperationTypeEnum.SET_OPTIONS: + SetOptionsOp.Encode(stream, encodedOperationBody.SetOptionsOp); + break; + case OperationType.OperationTypeEnum.CHANGE_TRUST: + ChangeTrustOp.Encode(stream, encodedOperationBody.ChangeTrustOp); + break; + case OperationType.OperationTypeEnum.ALLOW_TRUST: + AllowTrustOp.Encode(stream, encodedOperationBody.AllowTrustOp); + break; + case OperationType.OperationTypeEnum.ACCOUNT_MERGE: + MuxedAccount.Encode(stream, encodedOperationBody.Destination); + break; + case OperationType.OperationTypeEnum.INFLATION: + break; + case OperationType.OperationTypeEnum.MANAGE_DATA: + ManageDataOp.Encode(stream, encodedOperationBody.ManageDataOp); + break; + case OperationType.OperationTypeEnum.BUMP_SEQUENCE: + BumpSequenceOp.Encode(stream, encodedOperationBody.BumpSequenceOp); + break; + case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: + ManageBuyOfferOp.Encode(stream, encodedOperationBody.ManageBuyOfferOp); + break; + case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: + PathPaymentStrictSendOp.Encode(stream, encodedOperationBody.PathPaymentStrictSendOp); + break; + case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE: + CreateClaimableBalanceOp.Encode(stream, encodedOperationBody.CreateClaimableBalanceOp); + break; + case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE: + ClaimClaimableBalanceOp.Encode(stream, encodedOperationBody.ClaimClaimableBalanceOp); + break; + case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES: + BeginSponsoringFutureReservesOp.Encode(stream, + encodedOperationBody.BeginSponsoringFutureReservesOp); + break; + case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES: + break; + case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP: + RevokeSponsorshipOp.Encode(stream, encodedOperationBody.RevokeSponsorshipOp); + break; + case OperationType.OperationTypeEnum.CLAWBACK: + ClawbackOp.Encode(stream, encodedOperationBody.ClawbackOp); + break; + case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE: + ClawbackClaimableBalanceOp.Encode(stream, encodedOperationBody.ClawbackClaimableBalanceOp); + break; + case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS: + SetTrustLineFlagsOp.Encode(stream, encodedOperationBody.SetTrustLineFlagsOp); + break; + case OperationType.OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT: + LiquidityPoolDepositOp.Encode(stream, encodedOperationBody.LiquidityPoolDepositOp); + break; + case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: + LiquidityPoolWithdrawOp.Encode(stream, encodedOperationBody.LiquidityPoolWithdrawOp); + break; + case OperationType.OperationTypeEnum.INVOKE_HOST_FUNCTION: + InvokeHostFunctionOp.Encode(stream, encodedOperationBody.InvokeHostFunctionOp); + break; + case OperationType.OperationTypeEnum.EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLOp.Encode(stream, encodedOperationBody.ExtendFootprintTTLOp); + break; + case OperationType.OperationTypeEnum.RESTORE_FOOTPRINT: + RestoreFootprintOp.Encode(stream, encodedOperationBody.RestoreFootprintOp); + break; } - public static OperationBody Decode(XdrDataInputStream stream) + } + + public static OperationBody Decode(XdrDataInputStream stream) + { + var decodedOperationBody = new OperationBody(); + var discriminant = OperationType.Decode(stream); + decodedOperationBody.Discriminant = discriminant; + switch (decodedOperationBody.Discriminant.InnerValue) { - OperationBody decodedOperationBody = new OperationBody(); - OperationType discriminant = OperationType.Decode(stream); - decodedOperationBody.Discriminant = discriminant; - switch (decodedOperationBody.Discriminant.InnerValue) - { - case OperationType.OperationTypeEnum.CREATE_ACCOUNT: - decodedOperationBody.CreateAccountOp = CreateAccountOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.PAYMENT: - decodedOperationBody.PaymentOp = PaymentOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: - decodedOperationBody.PathPaymentStrictReceiveOp = PathPaymentStrictReceiveOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: - decodedOperationBody.ManageSellOfferOp = ManageSellOfferOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: - decodedOperationBody.CreatePassiveSellOfferOp = CreatePassiveSellOfferOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.SET_OPTIONS: - decodedOperationBody.SetOptionsOp = SetOptionsOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.CHANGE_TRUST: - decodedOperationBody.ChangeTrustOp = ChangeTrustOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.ALLOW_TRUST: - decodedOperationBody.AllowTrustOp = AllowTrustOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.ACCOUNT_MERGE: - decodedOperationBody.Destination = MuxedAccount.Decode(stream); - break; - case OperationType.OperationTypeEnum.INFLATION: - break; - case OperationType.OperationTypeEnum.MANAGE_DATA: - decodedOperationBody.ManageDataOp = ManageDataOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.BUMP_SEQUENCE: - decodedOperationBody.BumpSequenceOp = BumpSequenceOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: - decodedOperationBody.ManageBuyOfferOp = ManageBuyOfferOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: - decodedOperationBody.PathPaymentStrictSendOp = PathPaymentStrictSendOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE: - decodedOperationBody.CreateClaimableBalanceOp = CreateClaimableBalanceOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE: - decodedOperationBody.ClaimClaimableBalanceOp = ClaimClaimableBalanceOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES: - decodedOperationBody.BeginSponsoringFutureReservesOp = BeginSponsoringFutureReservesOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES: - break; - case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP: - decodedOperationBody.RevokeSponsorshipOp = RevokeSponsorshipOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.CLAWBACK: - decodedOperationBody.ClawbackOp = ClawbackOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE: - decodedOperationBody.ClawbackClaimableBalanceOp = ClawbackClaimableBalanceOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS: - decodedOperationBody.SetTrustLineFlagsOp = SetTrustLineFlagsOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT: - decodedOperationBody.LiquidityPoolDepositOp = LiquidityPoolDepositOp.Decode(stream); - break; - case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: - decodedOperationBody.LiquidityPoolWithdrawOp = LiquidityPoolWithdrawOp.Decode(stream); - break; - } - return decodedOperationBody; + case OperationType.OperationTypeEnum.CREATE_ACCOUNT: + decodedOperationBody.CreateAccountOp = CreateAccountOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.PAYMENT: + decodedOperationBody.PaymentOp = PaymentOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: + decodedOperationBody.PathPaymentStrictReceiveOp = PathPaymentStrictReceiveOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: + decodedOperationBody.ManageSellOfferOp = ManageSellOfferOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: + decodedOperationBody.CreatePassiveSellOfferOp = CreatePassiveSellOfferOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.SET_OPTIONS: + decodedOperationBody.SetOptionsOp = SetOptionsOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.CHANGE_TRUST: + decodedOperationBody.ChangeTrustOp = ChangeTrustOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.ALLOW_TRUST: + decodedOperationBody.AllowTrustOp = AllowTrustOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.ACCOUNT_MERGE: + decodedOperationBody.Destination = MuxedAccount.Decode(stream); + break; + case OperationType.OperationTypeEnum.INFLATION: + break; + case OperationType.OperationTypeEnum.MANAGE_DATA: + decodedOperationBody.ManageDataOp = ManageDataOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.BUMP_SEQUENCE: + decodedOperationBody.BumpSequenceOp = BumpSequenceOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: + decodedOperationBody.ManageBuyOfferOp = ManageBuyOfferOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: + decodedOperationBody.PathPaymentStrictSendOp = PathPaymentStrictSendOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE: + decodedOperationBody.CreateClaimableBalanceOp = CreateClaimableBalanceOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE: + decodedOperationBody.ClaimClaimableBalanceOp = ClaimClaimableBalanceOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES: + decodedOperationBody.BeginSponsoringFutureReservesOp = + BeginSponsoringFutureReservesOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES: + break; + case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP: + decodedOperationBody.RevokeSponsorshipOp = RevokeSponsorshipOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.CLAWBACK: + decodedOperationBody.ClawbackOp = ClawbackOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE: + decodedOperationBody.ClawbackClaimableBalanceOp = ClawbackClaimableBalanceOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS: + decodedOperationBody.SetTrustLineFlagsOp = SetTrustLineFlagsOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT: + decodedOperationBody.LiquidityPoolDepositOp = LiquidityPoolDepositOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: + decodedOperationBody.LiquidityPoolWithdrawOp = LiquidityPoolWithdrawOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.INVOKE_HOST_FUNCTION: + decodedOperationBody.InvokeHostFunctionOp = InvokeHostFunctionOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.EXTEND_FOOTPRINT_TTL: + decodedOperationBody.ExtendFootprintTTLOp = ExtendFootprintTTLOp.Decode(stream); + break; + case OperationType.OperationTypeEnum.RESTORE_FOOTPRINT: + decodedOperationBody.RestoreFootprintOp = RestoreFootprintOp.Decode(stream); + break; } + return decodedOperationBody; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/OperationMeta.cs b/stellar-dotnet-sdk-xdr/generated/OperationMeta.cs index 7593fa24..d6d03b53 100644 --- a/stellar-dotnet-sdk-xdr/generated/OperationMeta.cs +++ b/stellar-dotnet-sdk-xdr/generated/OperationMeta.cs @@ -1,32 +1,29 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct OperationMeta +// { +// LedgerEntryChanges changes; +// }; - // struct OperationMeta - // { - // LedgerEntryChanges changes; - // }; +// =========================================================================== +public class OperationMeta +{ + public LedgerEntryChanges Changes { get; set; } - // =========================================================================== - public class OperationMeta + public static void Encode(XdrDataOutputStream stream, OperationMeta encodedOperationMeta) { - public OperationMeta() { } - public LedgerEntryChanges Changes { get; set; } + LedgerEntryChanges.Encode(stream, encodedOperationMeta.Changes); + } - public static void Encode(XdrDataOutputStream stream, OperationMeta encodedOperationMeta) - { - LedgerEntryChanges.Encode(stream, encodedOperationMeta.Changes); - } - public static OperationMeta Decode(XdrDataInputStream stream) - { - OperationMeta decodedOperationMeta = new OperationMeta(); - decodedOperationMeta.Changes = LedgerEntryChanges.Decode(stream); - return decodedOperationMeta; - } + public static OperationMeta Decode(XdrDataInputStream stream) + { + var decodedOperationMeta = new OperationMeta(); + decodedOperationMeta.Changes = LedgerEntryChanges.Decode(stream); + return decodedOperationMeta; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/OperationResult.cs b/stellar-dotnet-sdk-xdr/generated/OperationResult.cs index 623cb998..f1cc8d2b 100644 --- a/stellar-dotnet-sdk-xdr/generated/OperationResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/OperationResult.cs @@ -1,299 +1,347 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union OperationResult switch (OperationResultCode code) +// { +// case opINNER: +// union switch (OperationType type) +// { +// case CREATE_ACCOUNT: +// CreateAccountResult createAccountResult; +// case PAYMENT: +// PaymentResult paymentResult; +// case PATH_PAYMENT_STRICT_RECEIVE: +// PathPaymentStrictReceiveResult pathPaymentStrictReceiveResult; +// case MANAGE_SELL_OFFER: +// ManageSellOfferResult manageSellOfferResult; +// case CREATE_PASSIVE_SELL_OFFER: +// ManageSellOfferResult createPassiveSellOfferResult; +// case SET_OPTIONS: +// SetOptionsResult setOptionsResult; +// case CHANGE_TRUST: +// ChangeTrustResult changeTrustResult; +// case ALLOW_TRUST: +// AllowTrustResult allowTrustResult; +// case ACCOUNT_MERGE: +// AccountMergeResult accountMergeResult; +// case INFLATION: +// InflationResult inflationResult; +// case MANAGE_DATA: +// ManageDataResult manageDataResult; +// case BUMP_SEQUENCE: +// BumpSequenceResult bumpSeqResult; +// case MANAGE_BUY_OFFER: +// ManageBuyOfferResult manageBuyOfferResult; +// case PATH_PAYMENT_STRICT_SEND: +// PathPaymentStrictSendResult pathPaymentStrictSendResult; +// case CREATE_CLAIMABLE_BALANCE: +// CreateClaimableBalanceResult createClaimableBalanceResult; +// case CLAIM_CLAIMABLE_BALANCE: +// ClaimClaimableBalanceResult claimClaimableBalanceResult; +// case BEGIN_SPONSORING_FUTURE_RESERVES: +// BeginSponsoringFutureReservesResult beginSponsoringFutureReservesResult; +// case END_SPONSORING_FUTURE_RESERVES: +// EndSponsoringFutureReservesResult endSponsoringFutureReservesResult; +// case REVOKE_SPONSORSHIP: +// RevokeSponsorshipResult revokeSponsorshipResult; +// case CLAWBACK: +// ClawbackResult clawbackResult; +// case CLAWBACK_CLAIMABLE_BALANCE: +// ClawbackClaimableBalanceResult clawbackClaimableBalanceResult; +// case SET_TRUST_LINE_FLAGS: +// SetTrustLineFlagsResult setTrustLineFlagsResult; +// case LIQUIDITY_POOL_DEPOSIT: +// LiquidityPoolDepositResult liquidityPoolDepositResult; +// case LIQUIDITY_POOL_WITHDRAW: +// LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; +// case INVOKE_HOST_FUNCTION: +// InvokeHostFunctionResult invokeHostFunctionResult; +// case EXTEND_FOOTPRINT_TTL: +// ExtendFootprintTTLResult extendFootprintTTLResult; +// case RESTORE_FOOTPRINT: +// RestoreFootprintResult restoreFootprintResult; +// } +// tr; +// case opBAD_AUTH: +// case opNO_ACCOUNT: +// case opNOT_SUPPORTED: +// case opTOO_MANY_SUBENTRIES: +// case opEXCEEDED_WORK_LIMIT: +// case opTOO_MANY_SPONSORING: +// void; +// }; + +// =========================================================================== +public class OperationResult { + public OperationResultCode Discriminant { get; set; } = new(); + + public OperationResultTr Tr { get; set; } + + public static void Encode(XdrDataOutputStream stream, OperationResult encodedOperationResult) + { + stream.WriteInt((int)encodedOperationResult.Discriminant.InnerValue); + switch (encodedOperationResult.Discriminant.InnerValue) + { + case OperationResultCode.OperationResultCodeEnum.opINNER: + OperationResultTr.Encode(stream, encodedOperationResult.Tr); + break; + case OperationResultCode.OperationResultCodeEnum.opBAD_AUTH: + case OperationResultCode.OperationResultCodeEnum.opNO_ACCOUNT: + case OperationResultCode.OperationResultCodeEnum.opNOT_SUPPORTED: + case OperationResultCode.OperationResultCodeEnum.opTOO_MANY_SUBENTRIES: + case OperationResultCode.OperationResultCodeEnum.opEXCEEDED_WORK_LIMIT: + case OperationResultCode.OperationResultCodeEnum.opTOO_MANY_SPONSORING: + break; + } + } - // === xdr source ============================================================ + public static OperationResult Decode(XdrDataInputStream stream) + { + var decodedOperationResult = new OperationResult(); + var discriminant = OperationResultCode.Decode(stream); + decodedOperationResult.Discriminant = discriminant; + switch (decodedOperationResult.Discriminant.InnerValue) + { + case OperationResultCode.OperationResultCodeEnum.opINNER: + decodedOperationResult.Tr = OperationResultTr.Decode(stream); + break; + case OperationResultCode.OperationResultCodeEnum.opBAD_AUTH: + case OperationResultCode.OperationResultCodeEnum.opNO_ACCOUNT: + case OperationResultCode.OperationResultCodeEnum.opNOT_SUPPORTED: + case OperationResultCode.OperationResultCodeEnum.opTOO_MANY_SUBENTRIES: + case OperationResultCode.OperationResultCodeEnum.opEXCEEDED_WORK_LIMIT: + case OperationResultCode.OperationResultCodeEnum.opTOO_MANY_SPONSORING: + break; + } - // union OperationResult switch (OperationResultCode code) - // { - // case opINNER: - // union switch (OperationType type) - // { - // case CREATE_ACCOUNT: - // CreateAccountResult createAccountResult; - // case PAYMENT: - // PaymentResult paymentResult; - // case PATH_PAYMENT_STRICT_RECEIVE: - // PathPaymentStrictReceiveResult pathPaymentStrictReceiveResult; - // case MANAGE_SELL_OFFER: - // ManageSellOfferResult manageSellOfferResult; - // case CREATE_PASSIVE_SELL_OFFER: - // ManageSellOfferResult createPassiveSellOfferResult; - // case SET_OPTIONS: - // SetOptionsResult setOptionsResult; - // case CHANGE_TRUST: - // ChangeTrustResult changeTrustResult; - // case ALLOW_TRUST: - // AllowTrustResult allowTrustResult; - // case ACCOUNT_MERGE: - // AccountMergeResult accountMergeResult; - // case INFLATION: - // InflationResult inflationResult; - // case MANAGE_DATA: - // ManageDataResult manageDataResult; - // case BUMP_SEQUENCE: - // BumpSequenceResult bumpSeqResult; - // case MANAGE_BUY_OFFER: - // ManageBuyOfferResult manageBuyOfferResult; - // case PATH_PAYMENT_STRICT_SEND: - // PathPaymentStrictSendResult pathPaymentStrictSendResult; - // case CREATE_CLAIMABLE_BALANCE: - // CreateClaimableBalanceResult createClaimableBalanceResult; - // case CLAIM_CLAIMABLE_BALANCE: - // ClaimClaimableBalanceResult claimClaimableBalanceResult; - // case BEGIN_SPONSORING_FUTURE_RESERVES: - // BeginSponsoringFutureReservesResult beginSponsoringFutureReservesResult; - // case END_SPONSORING_FUTURE_RESERVES: - // EndSponsoringFutureReservesResult endSponsoringFutureReservesResult; - // case REVOKE_SPONSORSHIP: - // RevokeSponsorshipResult revokeSponsorshipResult; - // case CLAWBACK: - // ClawbackResult clawbackResult; - // case CLAWBACK_CLAIMABLE_BALANCE: - // ClawbackClaimableBalanceResult clawbackClaimableBalanceResult; - // case SET_TRUST_LINE_FLAGS: - // SetTrustLineFlagsResult setTrustLineFlagsResult; - // case LIQUIDITY_POOL_DEPOSIT: - // LiquidityPoolDepositResult liquidityPoolDepositResult; - // case LIQUIDITY_POOL_WITHDRAW: - // LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; - // } - // tr; - // default: - // void; - // }; + return decodedOperationResult; + } - // =========================================================================== - public class OperationResult + public class OperationResultTr { - public OperationResult() { } + public OperationType Discriminant { get; set; } = new(); - public OperationResultCode Discriminant { get; set; } = new OperationResultCode(); + public CreateAccountResult CreateAccountResult { get; set; } + public PaymentResult PaymentResult { get; set; } + public PathPaymentStrictReceiveResult PathPaymentStrictReceiveResult { get; set; } + public ManageSellOfferResult ManageSellOfferResult { get; set; } + public ManageSellOfferResult CreatePassiveSellOfferResult { get; set; } + public SetOptionsResult SetOptionsResult { get; set; } + public ChangeTrustResult ChangeTrustResult { get; set; } + public AllowTrustResult AllowTrustResult { get; set; } + public AccountMergeResult AccountMergeResult { get; set; } + public InflationResult InflationResult { get; set; } + public ManageDataResult ManageDataResult { get; set; } + public BumpSequenceResult BumpSeqResult { get; set; } + public ManageBuyOfferResult ManageBuyOfferResult { get; set; } + public PathPaymentStrictSendResult PathPaymentStrictSendResult { get; set; } + public CreateClaimableBalanceResult CreateClaimableBalanceResult { get; set; } + public ClaimClaimableBalanceResult ClaimClaimableBalanceResult { get; set; } + public BeginSponsoringFutureReservesResult BeginSponsoringFutureReservesResult { get; set; } + public EndSponsoringFutureReservesResult EndSponsoringFutureReservesResult { get; set; } + public RevokeSponsorshipResult RevokeSponsorshipResult { get; set; } + public ClawbackResult ClawbackResult { get; set; } + public ClawbackClaimableBalanceResult ClawbackClaimableBalanceResult { get; set; } + public SetTrustLineFlagsResult SetTrustLineFlagsResult { get; set; } + public LiquidityPoolDepositResult LiquidityPoolDepositResult { get; set; } + public LiquidityPoolWithdrawResult LiquidityPoolWithdrawResult { get; set; } + public InvokeHostFunctionResult InvokeHostFunctionResult { get; set; } + public ExtendFootprintTTLResult ExtendFootprintTTLResult { get; set; } + public RestoreFootprintResult RestoreFootprintResult { get; set; } - public OperationResultTr Tr { get; set; } - public static void Encode(XdrDataOutputStream stream, OperationResult encodedOperationResult) + public static void Encode(XdrDataOutputStream stream, OperationResultTr encodedOperationResultTr) { - stream.WriteInt((int)encodedOperationResult.Discriminant.InnerValue); - switch (encodedOperationResult.Discriminant.InnerValue) + stream.WriteInt((int)encodedOperationResultTr.Discriminant.InnerValue); + switch (encodedOperationResultTr.Discriminant.InnerValue) { - case OperationResultCode.OperationResultCodeEnum.opINNER: - OperationResultTr.Encode(stream, encodedOperationResult.Tr); + case OperationType.OperationTypeEnum.CREATE_ACCOUNT: + CreateAccountResult.Encode(stream, encodedOperationResultTr.CreateAccountResult); break; - default: + case OperationType.OperationTypeEnum.PAYMENT: + PaymentResult.Encode(stream, encodedOperationResultTr.PaymentResult); break; - } - } - public static OperationResult Decode(XdrDataInputStream stream) - { - OperationResult decodedOperationResult = new OperationResult(); - OperationResultCode discriminant = OperationResultCode.Decode(stream); - decodedOperationResult.Discriminant = discriminant; - switch (decodedOperationResult.Discriminant.InnerValue) - { - case OperationResultCode.OperationResultCodeEnum.opINNER: - decodedOperationResult.Tr = OperationResultTr.Decode(stream); + case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: + PathPaymentStrictReceiveResult.Encode(stream, + encodedOperationResultTr.PathPaymentStrictReceiveResult); + break; + case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: + ManageSellOfferResult.Encode(stream, encodedOperationResultTr.ManageSellOfferResult); + break; + case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: + ManageSellOfferResult.Encode(stream, encodedOperationResultTr.CreatePassiveSellOfferResult); + break; + case OperationType.OperationTypeEnum.SET_OPTIONS: + SetOptionsResult.Encode(stream, encodedOperationResultTr.SetOptionsResult); + break; + case OperationType.OperationTypeEnum.CHANGE_TRUST: + ChangeTrustResult.Encode(stream, encodedOperationResultTr.ChangeTrustResult); + break; + case OperationType.OperationTypeEnum.ALLOW_TRUST: + AllowTrustResult.Encode(stream, encodedOperationResultTr.AllowTrustResult); + break; + case OperationType.OperationTypeEnum.ACCOUNT_MERGE: + AccountMergeResult.Encode(stream, encodedOperationResultTr.AccountMergeResult); + break; + case OperationType.OperationTypeEnum.INFLATION: + InflationResult.Encode(stream, encodedOperationResultTr.InflationResult); + break; + case OperationType.OperationTypeEnum.MANAGE_DATA: + ManageDataResult.Encode(stream, encodedOperationResultTr.ManageDataResult); + break; + case OperationType.OperationTypeEnum.BUMP_SEQUENCE: + BumpSequenceResult.Encode(stream, encodedOperationResultTr.BumpSeqResult); + break; + case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: + ManageBuyOfferResult.Encode(stream, encodedOperationResultTr.ManageBuyOfferResult); + break; + case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: + PathPaymentStrictSendResult.Encode(stream, encodedOperationResultTr.PathPaymentStrictSendResult); + break; + case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE: + CreateClaimableBalanceResult.Encode(stream, encodedOperationResultTr.CreateClaimableBalanceResult); + break; + case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE: + ClaimClaimableBalanceResult.Encode(stream, encodedOperationResultTr.ClaimClaimableBalanceResult); + break; + case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES: + BeginSponsoringFutureReservesResult.Encode(stream, + encodedOperationResultTr.BeginSponsoringFutureReservesResult); + break; + case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES: + EndSponsoringFutureReservesResult.Encode(stream, + encodedOperationResultTr.EndSponsoringFutureReservesResult); + break; + case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP: + RevokeSponsorshipResult.Encode(stream, encodedOperationResultTr.RevokeSponsorshipResult); + break; + case OperationType.OperationTypeEnum.CLAWBACK: + ClawbackResult.Encode(stream, encodedOperationResultTr.ClawbackResult); + break; + case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE: + ClawbackClaimableBalanceResult.Encode(stream, + encodedOperationResultTr.ClawbackClaimableBalanceResult); + break; + case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS: + SetTrustLineFlagsResult.Encode(stream, encodedOperationResultTr.SetTrustLineFlagsResult); break; - default: + case OperationType.OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT: + LiquidityPoolDepositResult.Encode(stream, encodedOperationResultTr.LiquidityPoolDepositResult); + break; + case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: + LiquidityPoolWithdrawResult.Encode(stream, encodedOperationResultTr.LiquidityPoolWithdrawResult); + break; + case OperationType.OperationTypeEnum.INVOKE_HOST_FUNCTION: + InvokeHostFunctionResult.Encode(stream, encodedOperationResultTr.InvokeHostFunctionResult); + break; + case OperationType.OperationTypeEnum.EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLResult.Encode(stream, encodedOperationResultTr.ExtendFootprintTTLResult); + break; + case OperationType.OperationTypeEnum.RESTORE_FOOTPRINT: + RestoreFootprintResult.Encode(stream, encodedOperationResultTr.RestoreFootprintResult); break; } - return decodedOperationResult; } - public class OperationResultTr + public static OperationResultTr Decode(XdrDataInputStream stream) { - public OperationResultTr() { } - - public OperationType Discriminant { get; set; } = new OperationType(); - - public CreateAccountResult CreateAccountResult { get; set; } - public PaymentResult PaymentResult { get; set; } - public PathPaymentStrictReceiveResult PathPaymentStrictReceiveResult { get; set; } - public ManageSellOfferResult ManageSellOfferResult { get; set; } - public ManageSellOfferResult CreatePassiveSellOfferResult { get; set; } - public SetOptionsResult SetOptionsResult { get; set; } - public ChangeTrustResult ChangeTrustResult { get; set; } - public AllowTrustResult AllowTrustResult { get; set; } - public AccountMergeResult AccountMergeResult { get; set; } - public InflationResult InflationResult { get; set; } - public ManageDataResult ManageDataResult { get; set; } - public BumpSequenceResult BumpSeqResult { get; set; } - public ManageBuyOfferResult ManageBuyOfferResult { get; set; } - public PathPaymentStrictSendResult PathPaymentStrictSendResult { get; set; } - public CreateClaimableBalanceResult CreateClaimableBalanceResult { get; set; } - public ClaimClaimableBalanceResult ClaimClaimableBalanceResult { get; set; } - public BeginSponsoringFutureReservesResult BeginSponsoringFutureReservesResult { get; set; } - public EndSponsoringFutureReservesResult EndSponsoringFutureReservesResult { get; set; } - public RevokeSponsorshipResult RevokeSponsorshipResult { get; set; } - public ClawbackResult ClawbackResult { get; set; } - public ClawbackClaimableBalanceResult ClawbackClaimableBalanceResult { get; set; } - public SetTrustLineFlagsResult SetTrustLineFlagsResult { get; set; } - public LiquidityPoolDepositResult LiquidityPoolDepositResult { get; set; } - public LiquidityPoolWithdrawResult LiquidityPoolWithdrawResult { get; set; } - public static void Encode(XdrDataOutputStream stream, OperationResultTr encodedOperationResultTr) - { - stream.WriteInt((int)encodedOperationResultTr.Discriminant.InnerValue); - switch (encodedOperationResultTr.Discriminant.InnerValue) - { - case OperationType.OperationTypeEnum.CREATE_ACCOUNT: - CreateAccountResult.Encode(stream, encodedOperationResultTr.CreateAccountResult); - break; - case OperationType.OperationTypeEnum.PAYMENT: - PaymentResult.Encode(stream, encodedOperationResultTr.PaymentResult); - break; - case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: - PathPaymentStrictReceiveResult.Encode(stream, encodedOperationResultTr.PathPaymentStrictReceiveResult); - break; - case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: - ManageSellOfferResult.Encode(stream, encodedOperationResultTr.ManageSellOfferResult); - break; - case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: - ManageSellOfferResult.Encode(stream, encodedOperationResultTr.CreatePassiveSellOfferResult); - break; - case OperationType.OperationTypeEnum.SET_OPTIONS: - SetOptionsResult.Encode(stream, encodedOperationResultTr.SetOptionsResult); - break; - case OperationType.OperationTypeEnum.CHANGE_TRUST: - ChangeTrustResult.Encode(stream, encodedOperationResultTr.ChangeTrustResult); - break; - case OperationType.OperationTypeEnum.ALLOW_TRUST: - AllowTrustResult.Encode(stream, encodedOperationResultTr.AllowTrustResult); - break; - case OperationType.OperationTypeEnum.ACCOUNT_MERGE: - AccountMergeResult.Encode(stream, encodedOperationResultTr.AccountMergeResult); - break; - case OperationType.OperationTypeEnum.INFLATION: - InflationResult.Encode(stream, encodedOperationResultTr.InflationResult); - break; - case OperationType.OperationTypeEnum.MANAGE_DATA: - ManageDataResult.Encode(stream, encodedOperationResultTr.ManageDataResult); - break; - case OperationType.OperationTypeEnum.BUMP_SEQUENCE: - BumpSequenceResult.Encode(stream, encodedOperationResultTr.BumpSeqResult); - break; - case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: - ManageBuyOfferResult.Encode(stream, encodedOperationResultTr.ManageBuyOfferResult); - break; - case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: - PathPaymentStrictSendResult.Encode(stream, encodedOperationResultTr.PathPaymentStrictSendResult); - break; - case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE: - CreateClaimableBalanceResult.Encode(stream, encodedOperationResultTr.CreateClaimableBalanceResult); - break; - case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE: - ClaimClaimableBalanceResult.Encode(stream, encodedOperationResultTr.ClaimClaimableBalanceResult); - break; - case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES: - BeginSponsoringFutureReservesResult.Encode(stream, encodedOperationResultTr.BeginSponsoringFutureReservesResult); - break; - case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES: - EndSponsoringFutureReservesResult.Encode(stream, encodedOperationResultTr.EndSponsoringFutureReservesResult); - break; - case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP: - RevokeSponsorshipResult.Encode(stream, encodedOperationResultTr.RevokeSponsorshipResult); - break; - case OperationType.OperationTypeEnum.CLAWBACK: - ClawbackResult.Encode(stream, encodedOperationResultTr.ClawbackResult); - break; - case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE: - ClawbackClaimableBalanceResult.Encode(stream, encodedOperationResultTr.ClawbackClaimableBalanceResult); - break; - case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS: - SetTrustLineFlagsResult.Encode(stream, encodedOperationResultTr.SetTrustLineFlagsResult); - break; - case OperationType.OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT: - LiquidityPoolDepositResult.Encode(stream, encodedOperationResultTr.LiquidityPoolDepositResult); - break; - case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: - LiquidityPoolWithdrawResult.Encode(stream, encodedOperationResultTr.LiquidityPoolWithdrawResult); - break; - } - } - public static OperationResultTr Decode(XdrDataInputStream stream) + var decodedOperationResultTr = new OperationResultTr(); + var discriminant = OperationType.Decode(stream); + decodedOperationResultTr.Discriminant = discriminant; + switch (decodedOperationResultTr.Discriminant.InnerValue) { - OperationResultTr decodedOperationResultTr = new OperationResultTr(); - OperationType discriminant = OperationType.Decode(stream); - decodedOperationResultTr.Discriminant = discriminant; - switch (decodedOperationResultTr.Discriminant.InnerValue) - { - case OperationType.OperationTypeEnum.CREATE_ACCOUNT: - decodedOperationResultTr.CreateAccountResult = CreateAccountResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.PAYMENT: - decodedOperationResultTr.PaymentResult = PaymentResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: - decodedOperationResultTr.PathPaymentStrictReceiveResult = PathPaymentStrictReceiveResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: - decodedOperationResultTr.ManageSellOfferResult = ManageSellOfferResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: - decodedOperationResultTr.CreatePassiveSellOfferResult = ManageSellOfferResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.SET_OPTIONS: - decodedOperationResultTr.SetOptionsResult = SetOptionsResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.CHANGE_TRUST: - decodedOperationResultTr.ChangeTrustResult = ChangeTrustResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.ALLOW_TRUST: - decodedOperationResultTr.AllowTrustResult = AllowTrustResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.ACCOUNT_MERGE: - decodedOperationResultTr.AccountMergeResult = AccountMergeResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.INFLATION: - decodedOperationResultTr.InflationResult = InflationResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.MANAGE_DATA: - decodedOperationResultTr.ManageDataResult = ManageDataResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.BUMP_SEQUENCE: - decodedOperationResultTr.BumpSeqResult = BumpSequenceResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: - decodedOperationResultTr.ManageBuyOfferResult = ManageBuyOfferResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: - decodedOperationResultTr.PathPaymentStrictSendResult = PathPaymentStrictSendResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE: - decodedOperationResultTr.CreateClaimableBalanceResult = CreateClaimableBalanceResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE: - decodedOperationResultTr.ClaimClaimableBalanceResult = ClaimClaimableBalanceResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES: - decodedOperationResultTr.BeginSponsoringFutureReservesResult = BeginSponsoringFutureReservesResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES: - decodedOperationResultTr.EndSponsoringFutureReservesResult = EndSponsoringFutureReservesResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP: - decodedOperationResultTr.RevokeSponsorshipResult = RevokeSponsorshipResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.CLAWBACK: - decodedOperationResultTr.ClawbackResult = ClawbackResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE: - decodedOperationResultTr.ClawbackClaimableBalanceResult = ClawbackClaimableBalanceResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS: - decodedOperationResultTr.SetTrustLineFlagsResult = SetTrustLineFlagsResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT: - decodedOperationResultTr.LiquidityPoolDepositResult = LiquidityPoolDepositResult.Decode(stream); - break; - case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: - decodedOperationResultTr.LiquidityPoolWithdrawResult = LiquidityPoolWithdrawResult.Decode(stream); - break; - } - return decodedOperationResultTr; + case OperationType.OperationTypeEnum.CREATE_ACCOUNT: + decodedOperationResultTr.CreateAccountResult = CreateAccountResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.PAYMENT: + decodedOperationResultTr.PaymentResult = PaymentResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: + decodedOperationResultTr.PathPaymentStrictReceiveResult = + PathPaymentStrictReceiveResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: + decodedOperationResultTr.ManageSellOfferResult = ManageSellOfferResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: + decodedOperationResultTr.CreatePassiveSellOfferResult = ManageSellOfferResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.SET_OPTIONS: + decodedOperationResultTr.SetOptionsResult = SetOptionsResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.CHANGE_TRUST: + decodedOperationResultTr.ChangeTrustResult = ChangeTrustResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.ALLOW_TRUST: + decodedOperationResultTr.AllowTrustResult = AllowTrustResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.ACCOUNT_MERGE: + decodedOperationResultTr.AccountMergeResult = AccountMergeResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.INFLATION: + decodedOperationResultTr.InflationResult = InflationResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.MANAGE_DATA: + decodedOperationResultTr.ManageDataResult = ManageDataResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.BUMP_SEQUENCE: + decodedOperationResultTr.BumpSeqResult = BumpSequenceResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: + decodedOperationResultTr.ManageBuyOfferResult = ManageBuyOfferResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: + decodedOperationResultTr.PathPaymentStrictSendResult = PathPaymentStrictSendResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE: + decodedOperationResultTr.CreateClaimableBalanceResult = CreateClaimableBalanceResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE: + decodedOperationResultTr.ClaimClaimableBalanceResult = ClaimClaimableBalanceResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES: + decodedOperationResultTr.BeginSponsoringFutureReservesResult = + BeginSponsoringFutureReservesResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES: + decodedOperationResultTr.EndSponsoringFutureReservesResult = + EndSponsoringFutureReservesResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP: + decodedOperationResultTr.RevokeSponsorshipResult = RevokeSponsorshipResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.CLAWBACK: + decodedOperationResultTr.ClawbackResult = ClawbackResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE: + decodedOperationResultTr.ClawbackClaimableBalanceResult = + ClawbackClaimableBalanceResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS: + decodedOperationResultTr.SetTrustLineFlagsResult = SetTrustLineFlagsResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT: + decodedOperationResultTr.LiquidityPoolDepositResult = LiquidityPoolDepositResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: + decodedOperationResultTr.LiquidityPoolWithdrawResult = LiquidityPoolWithdrawResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.INVOKE_HOST_FUNCTION: + decodedOperationResultTr.InvokeHostFunctionResult = InvokeHostFunctionResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.EXTEND_FOOTPRINT_TTL: + decodedOperationResultTr.ExtendFootprintTTLResult = ExtendFootprintTTLResult.Decode(stream); + break; + case OperationType.OperationTypeEnum.RESTORE_FOOTPRINT: + decodedOperationResultTr.RestoreFootprintResult = RestoreFootprintResult.Decode(stream); + break; } + return decodedOperationResultTr; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/OperationResultCode.cs b/stellar-dotnet-sdk-xdr/generated/OperationResultCode.cs index 1e9effa0..4ae2bdd4 100644 --- a/stellar-dotnet-sdk-xdr/generated/OperationResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/OperationResultCode.cs @@ -1,67 +1,67 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // 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 - // opTOO_MANY_SUBENTRIES = -4, // max number of subentries already reached - // opEXCEEDED_WORK_LIMIT = -5, // operation did too much work - // opTOO_MANY_SPONSORING = -6 // account is sponsoring too many entries - // }; +// 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 +// opTOO_MANY_SUBENTRIES = -4, // max number of subentries already reached +// opEXCEEDED_WORK_LIMIT = -5, // operation did too much work +// opTOO_MANY_SPONSORING = -6 // account is sponsoring too many entries +// }; - // =========================================================================== - public class OperationResultCode +// =========================================================================== +public class OperationResultCode +{ + public enum OperationResultCodeEnum { - public enum OperationResultCodeEnum - { - opINNER = 0, - opBAD_AUTH = -1, - opNO_ACCOUNT = -2, - opNOT_SUPPORTED = -3, - opTOO_MANY_SUBENTRIES = -4, - opEXCEEDED_WORK_LIMIT = -5, - opTOO_MANY_SPONSORING = -6, - } - public OperationResultCodeEnum InnerValue { get; set; } = default(OperationResultCodeEnum); + opINNER = 0, + opBAD_AUTH = -1, + opNO_ACCOUNT = -2, + opNOT_SUPPORTED = -3, + opTOO_MANY_SUBENTRIES = -4, + opEXCEEDED_WORK_LIMIT = -5, + opTOO_MANY_SPONSORING = -6 + } - public static OperationResultCode Create(OperationResultCodeEnum v) - { - return new OperationResultCode - { - InnerValue = v - }; - } + public OperationResultCodeEnum InnerValue { get; set; } = default; - public static OperationResultCode Decode(XdrDataInputStream stream) + public static OperationResultCode Create(OperationResultCodeEnum v) + { + return new OperationResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(OperationResultCodeEnum.opINNER); - case -1: return Create(OperationResultCodeEnum.opBAD_AUTH); - case -2: return Create(OperationResultCodeEnum.opNO_ACCOUNT); - case -3: return Create(OperationResultCodeEnum.opNOT_SUPPORTED); - case -4: return Create(OperationResultCodeEnum.opTOO_MANY_SUBENTRIES); - case -5: return Create(OperationResultCodeEnum.opEXCEEDED_WORK_LIMIT); - case -6: return Create(OperationResultCodeEnum.opTOO_MANY_SPONSORING); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, OperationResultCode value) + public static OperationResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(OperationResultCodeEnum.opINNER); + case -1: return Create(OperationResultCodeEnum.opBAD_AUTH); + case -2: return Create(OperationResultCodeEnum.opNO_ACCOUNT); + case -3: return Create(OperationResultCodeEnum.opNOT_SUPPORTED); + case -4: return Create(OperationResultCodeEnum.opTOO_MANY_SUBENTRIES); + case -5: return Create(OperationResultCodeEnum.opEXCEEDED_WORK_LIMIT); + case -6: return Create(OperationResultCodeEnum.opTOO_MANY_SPONSORING); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, OperationResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/OperationType.cs b/stellar-dotnet-sdk-xdr/generated/OperationType.cs index 0807dbcb..21721755 100644 --- a/stellar-dotnet-sdk-xdr/generated/OperationType.cs +++ b/stellar-dotnet-sdk-xdr/generated/OperationType.cs @@ -1,117 +1,126 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum OperationType - // { - // CREATE_ACCOUNT = 0, - // PAYMENT = 1, - // PATH_PAYMENT_STRICT_RECEIVE = 2, - // MANAGE_SELL_OFFER = 3, - // CREATE_PASSIVE_SELL_OFFER = 4, - // SET_OPTIONS = 5, - // CHANGE_TRUST = 6, - // ALLOW_TRUST = 7, - // ACCOUNT_MERGE = 8, - // INFLATION = 9, - // MANAGE_DATA = 10, - // BUMP_SEQUENCE = 11, - // MANAGE_BUY_OFFER = 12, - // PATH_PAYMENT_STRICT_SEND = 13, - // CREATE_CLAIMABLE_BALANCE = 14, - // CLAIM_CLAIMABLE_BALANCE = 15, - // BEGIN_SPONSORING_FUTURE_RESERVES = 16, - // END_SPONSORING_FUTURE_RESERVES = 17, - // REVOKE_SPONSORSHIP = 18, - // CLAWBACK = 19, - // CLAWBACK_CLAIMABLE_BALANCE = 20, - // SET_TRUST_LINE_FLAGS = 21, - // LIQUIDITY_POOL_DEPOSIT = 22, - // LIQUIDITY_POOL_WITHDRAW = 23 - // }; +// enum OperationType +// { +// CREATE_ACCOUNT = 0, +// PAYMENT = 1, +// PATH_PAYMENT_STRICT_RECEIVE = 2, +// MANAGE_SELL_OFFER = 3, +// CREATE_PASSIVE_SELL_OFFER = 4, +// SET_OPTIONS = 5, +// CHANGE_TRUST = 6, +// ALLOW_TRUST = 7, +// ACCOUNT_MERGE = 8, +// INFLATION = 9, +// MANAGE_DATA = 10, +// BUMP_SEQUENCE = 11, +// MANAGE_BUY_OFFER = 12, +// PATH_PAYMENT_STRICT_SEND = 13, +// CREATE_CLAIMABLE_BALANCE = 14, +// CLAIM_CLAIMABLE_BALANCE = 15, +// BEGIN_SPONSORING_FUTURE_RESERVES = 16, +// END_SPONSORING_FUTURE_RESERVES = 17, +// REVOKE_SPONSORSHIP = 18, +// CLAWBACK = 19, +// CLAWBACK_CLAIMABLE_BALANCE = 20, +// SET_TRUST_LINE_FLAGS = 21, +// LIQUIDITY_POOL_DEPOSIT = 22, +// LIQUIDITY_POOL_WITHDRAW = 23, +// INVOKE_HOST_FUNCTION = 24, +// EXTEND_FOOTPRINT_TTL = 25, +// RESTORE_FOOTPRINT = 26 +// }; - // =========================================================================== - public class OperationType +// =========================================================================== +public class OperationType +{ + public enum OperationTypeEnum { - public enum OperationTypeEnum - { - CREATE_ACCOUNT = 0, - PAYMENT = 1, - PATH_PAYMENT_STRICT_RECEIVE = 2, - MANAGE_SELL_OFFER = 3, - CREATE_PASSIVE_SELL_OFFER = 4, - SET_OPTIONS = 5, - CHANGE_TRUST = 6, - ALLOW_TRUST = 7, - ACCOUNT_MERGE = 8, - INFLATION = 9, - MANAGE_DATA = 10, - BUMP_SEQUENCE = 11, - MANAGE_BUY_OFFER = 12, - PATH_PAYMENT_STRICT_SEND = 13, - CREATE_CLAIMABLE_BALANCE = 14, - CLAIM_CLAIMABLE_BALANCE = 15, - BEGIN_SPONSORING_FUTURE_RESERVES = 16, - END_SPONSORING_FUTURE_RESERVES = 17, - REVOKE_SPONSORSHIP = 18, - CLAWBACK = 19, - CLAWBACK_CLAIMABLE_BALANCE = 20, - SET_TRUST_LINE_FLAGS = 21, - LIQUIDITY_POOL_DEPOSIT = 22, - LIQUIDITY_POOL_WITHDRAW = 23, - } - public OperationTypeEnum InnerValue { get; set; } = default(OperationTypeEnum); + CREATE_ACCOUNT = 0, + PAYMENT = 1, + PATH_PAYMENT_STRICT_RECEIVE = 2, + MANAGE_SELL_OFFER = 3, + CREATE_PASSIVE_SELL_OFFER = 4, + SET_OPTIONS = 5, + CHANGE_TRUST = 6, + ALLOW_TRUST = 7, + ACCOUNT_MERGE = 8, + INFLATION = 9, + MANAGE_DATA = 10, + BUMP_SEQUENCE = 11, + MANAGE_BUY_OFFER = 12, + PATH_PAYMENT_STRICT_SEND = 13, + CREATE_CLAIMABLE_BALANCE = 14, + CLAIM_CLAIMABLE_BALANCE = 15, + BEGIN_SPONSORING_FUTURE_RESERVES = 16, + END_SPONSORING_FUTURE_RESERVES = 17, + REVOKE_SPONSORSHIP = 18, + CLAWBACK = 19, + CLAWBACK_CLAIMABLE_BALANCE = 20, + SET_TRUST_LINE_FLAGS = 21, + LIQUIDITY_POOL_DEPOSIT = 22, + LIQUIDITY_POOL_WITHDRAW = 23, + INVOKE_HOST_FUNCTION = 24, + EXTEND_FOOTPRINT_TTL = 25, + RESTORE_FOOTPRINT = 26 + } - public static OperationType Create(OperationTypeEnum v) - { - return new OperationType - { - InnerValue = v - }; - } + public OperationTypeEnum InnerValue { get; set; } = default; - public static OperationType Decode(XdrDataInputStream stream) + public static OperationType Create(OperationTypeEnum v) + { + return new OperationType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(OperationTypeEnum.CREATE_ACCOUNT); - case 1: return Create(OperationTypeEnum.PAYMENT); - case 2: return Create(OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE); - case 3: return Create(OperationTypeEnum.MANAGE_SELL_OFFER); - case 4: return Create(OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER); - case 5: return Create(OperationTypeEnum.SET_OPTIONS); - case 6: return Create(OperationTypeEnum.CHANGE_TRUST); - case 7: return Create(OperationTypeEnum.ALLOW_TRUST); - case 8: return Create(OperationTypeEnum.ACCOUNT_MERGE); - case 9: return Create(OperationTypeEnum.INFLATION); - case 10: return Create(OperationTypeEnum.MANAGE_DATA); - case 11: return Create(OperationTypeEnum.BUMP_SEQUENCE); - case 12: return Create(OperationTypeEnum.MANAGE_BUY_OFFER); - case 13: return Create(OperationTypeEnum.PATH_PAYMENT_STRICT_SEND); - case 14: return Create(OperationTypeEnum.CREATE_CLAIMABLE_BALANCE); - case 15: return Create(OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE); - case 16: return Create(OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES); - case 17: return Create(OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES); - case 18: return Create(OperationTypeEnum.REVOKE_SPONSORSHIP); - case 19: return Create(OperationTypeEnum.CLAWBACK); - case 20: return Create(OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE); - case 21: return Create(OperationTypeEnum.SET_TRUST_LINE_FLAGS); - case 22: return Create(OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT); - case 23: return Create(OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, OperationType value) + public static OperationType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(OperationTypeEnum.CREATE_ACCOUNT); + case 1: return Create(OperationTypeEnum.PAYMENT); + case 2: return Create(OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE); + case 3: return Create(OperationTypeEnum.MANAGE_SELL_OFFER); + case 4: return Create(OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER); + case 5: return Create(OperationTypeEnum.SET_OPTIONS); + case 6: return Create(OperationTypeEnum.CHANGE_TRUST); + case 7: return Create(OperationTypeEnum.ALLOW_TRUST); + case 8: return Create(OperationTypeEnum.ACCOUNT_MERGE); + case 9: return Create(OperationTypeEnum.INFLATION); + case 10: return Create(OperationTypeEnum.MANAGE_DATA); + case 11: return Create(OperationTypeEnum.BUMP_SEQUENCE); + case 12: return Create(OperationTypeEnum.MANAGE_BUY_OFFER); + case 13: return Create(OperationTypeEnum.PATH_PAYMENT_STRICT_SEND); + case 14: return Create(OperationTypeEnum.CREATE_CLAIMABLE_BALANCE); + case 15: return Create(OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE); + case 16: return Create(OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES); + case 17: return Create(OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES); + case 18: return Create(OperationTypeEnum.REVOKE_SPONSORSHIP); + case 19: return Create(OperationTypeEnum.CLAWBACK); + case 20: return Create(OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE); + case 21: return Create(OperationTypeEnum.SET_TRUST_LINE_FLAGS); + case 22: return Create(OperationTypeEnum.LIQUIDITY_POOL_DEPOSIT); + case 23: return Create(OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW); + case 24: return Create(OperationTypeEnum.INVOKE_HOST_FUNCTION); + case 25: return Create(OperationTypeEnum.EXTEND_FOOTPRINT_TTL); + case 26: return Create(OperationTypeEnum.RESTORE_FOOTPRINT); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, OperationType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveOp.cs b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveOp.cs index 63b2a07f..65b6bdb9 100644 --- a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveOp.cs @@ -1,66 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct PathPaymentStrictReceiveOp +// { +// Asset sendAsset; // asset we pay with +// 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 +// }; - // struct PathPaymentStrictReceiveOp - // { - // Asset sendAsset; // asset we pay with - // 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 - // }; +// =========================================================================== +public class PathPaymentStrictReceiveOp +{ + public Asset SendAsset { get; set; } + public Int64 SendMax { get; set; } + public MuxedAccount Destination { get; set; } + public Asset DestAsset { get; set; } + public Int64 DestAmount { get; set; } + public Asset[] Path { get; set; } - // =========================================================================== - public class PathPaymentStrictReceiveOp + public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveOp encodedPathPaymentStrictReceiveOp) { - public PathPaymentStrictReceiveOp() { } - public Asset SendAsset { get; set; } - public Int64 SendMax { get; set; } - public MuxedAccount Destination { get; set; } - public Asset DestAsset { get; set; } - public Int64 DestAmount { get; set; } - public Asset[] Path { get; set; } + Asset.Encode(stream, encodedPathPaymentStrictReceiveOp.SendAsset); + Int64.Encode(stream, encodedPathPaymentStrictReceiveOp.SendMax); + MuxedAccount.Encode(stream, encodedPathPaymentStrictReceiveOp.Destination); + Asset.Encode(stream, encodedPathPaymentStrictReceiveOp.DestAsset); + Int64.Encode(stream, encodedPathPaymentStrictReceiveOp.DestAmount); + var pathsize = encodedPathPaymentStrictReceiveOp.Path.Length; + stream.WriteInt(pathsize); + for (var i = 0; i < pathsize; i++) Asset.Encode(stream, encodedPathPaymentStrictReceiveOp.Path[i]); + } - public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveOp encodedPathPaymentStrictReceiveOp) - { - Asset.Encode(stream, encodedPathPaymentStrictReceiveOp.SendAsset); - Int64.Encode(stream, encodedPathPaymentStrictReceiveOp.SendMax); - MuxedAccount.Encode(stream, encodedPathPaymentStrictReceiveOp.Destination); - Asset.Encode(stream, encodedPathPaymentStrictReceiveOp.DestAsset); - Int64.Encode(stream, encodedPathPaymentStrictReceiveOp.DestAmount); - int pathsize = encodedPathPaymentStrictReceiveOp.Path.Length; - stream.WriteInt(pathsize); - for (int i = 0; i < pathsize; i++) - { - Asset.Encode(stream, encodedPathPaymentStrictReceiveOp.Path[i]); - } - } - public static PathPaymentStrictReceiveOp Decode(XdrDataInputStream stream) - { - PathPaymentStrictReceiveOp decodedPathPaymentStrictReceiveOp = new PathPaymentStrictReceiveOp(); - decodedPathPaymentStrictReceiveOp.SendAsset = Asset.Decode(stream); - decodedPathPaymentStrictReceiveOp.SendMax = Int64.Decode(stream); - decodedPathPaymentStrictReceiveOp.Destination = MuxedAccount.Decode(stream); - decodedPathPaymentStrictReceiveOp.DestAsset = Asset.Decode(stream); - decodedPathPaymentStrictReceiveOp.DestAmount = Int64.Decode(stream); - int pathsize = stream.ReadInt(); - decodedPathPaymentStrictReceiveOp.Path = new Asset[pathsize]; - for (int i = 0; i < pathsize; i++) - { - decodedPathPaymentStrictReceiveOp.Path[i] = Asset.Decode(stream); - } - return decodedPathPaymentStrictReceiveOp; - } + public static PathPaymentStrictReceiveOp Decode(XdrDataInputStream stream) + { + var decodedPathPaymentStrictReceiveOp = new PathPaymentStrictReceiveOp(); + decodedPathPaymentStrictReceiveOp.SendAsset = Asset.Decode(stream); + decodedPathPaymentStrictReceiveOp.SendMax = Int64.Decode(stream); + decodedPathPaymentStrictReceiveOp.Destination = MuxedAccount.Decode(stream); + decodedPathPaymentStrictReceiveOp.DestAsset = Asset.Decode(stream); + decodedPathPaymentStrictReceiveOp.DestAmount = Int64.Decode(stream); + var pathsize = stream.ReadInt(); + decodedPathPaymentStrictReceiveOp.Path = new Asset[pathsize]; + for (var i = 0; i < pathsize; i++) decodedPathPaymentStrictReceiveOp.Path[i] = Asset.Decode(stream); + return decodedPathPaymentStrictReceiveOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveResult.cs b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveResult.cs index 5144504f..b3a63049 100644 --- a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveResult.cs @@ -1,99 +1,153 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union PathPaymentStrictReceiveResult switch ( - // PathPaymentStrictReceiveResultCode code) - // { - // case PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: - // struct - // { - // ClaimAtom offers<>; - // SimplePaymentResult last; - // } success; - // case PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: - // Asset noIssuer; // the asset that caused the error - // default: - // void; - // }; +// union PathPaymentStrictReceiveResult switch ( +// PathPaymentStrictReceiveResultCode code) +// { +// case PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: +// struct +// { +// ClaimAtom offers<>; +// SimplePaymentResult last; +// } success; +// case PATH_PAYMENT_STRICT_RECEIVE_MALFORMED: +// case PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED: +// case PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST: +// case PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED: +// case PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION: +// case PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST: +// case PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED: +// case PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL: +// void; +// case PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: +// Asset noIssuer; // the asset that caused the error +// case PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS: +// case PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF: +// case PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX: +// void; +// }; - // =========================================================================== - public class PathPaymentStrictReceiveResult - { - public PathPaymentStrictReceiveResult() { } +// =========================================================================== +public class PathPaymentStrictReceiveResult +{ + public PathPaymentStrictReceiveResultCode Discriminant { get; set; } = new(); - public PathPaymentStrictReceiveResultCode Discriminant { get; set; } = new PathPaymentStrictReceiveResultCode(); + public PathPaymentStrictReceiveResultSuccess Success { get; set; } + public Asset NoIssuer { get; set; } - public PathPaymentStrictReceiveResultSuccess Success { get; set; } - public Asset NoIssuer { get; set; } - public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveResult encodedPathPaymentStrictReceiveResult) + public static void Encode(XdrDataOutputStream stream, + PathPaymentStrictReceiveResult encodedPathPaymentStrictReceiveResult) + { + stream.WriteInt((int)encodedPathPaymentStrictReceiveResult.Discriminant.InnerValue); + switch (encodedPathPaymentStrictReceiveResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedPathPaymentStrictReceiveResult.Discriminant.InnerValue); - switch (encodedPathPaymentStrictReceiveResult.Discriminant.InnerValue) - { - case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: - PathPaymentStrictReceiveResultSuccess.Encode(stream, encodedPathPaymentStrictReceiveResult.Success); - break; - case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: - Asset.Encode(stream, encodedPathPaymentStrictReceiveResult.NoIssuer); - break; - default: - break; - } + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: + PathPaymentStrictReceiveResultSuccess.Encode(stream, encodedPathPaymentStrictReceiveResult.Success); + break; + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_MALFORMED: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL: + break; + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: + Asset.Encode(stream, encodedPathPaymentStrictReceiveResult.NoIssuer); + break; + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX: + break; } - public static PathPaymentStrictReceiveResult Decode(XdrDataInputStream stream) + } + + public static PathPaymentStrictReceiveResult Decode(XdrDataInputStream stream) + { + var decodedPathPaymentStrictReceiveResult = new PathPaymentStrictReceiveResult(); + var discriminant = PathPaymentStrictReceiveResultCode.Decode(stream); + decodedPathPaymentStrictReceiveResult.Discriminant = discriminant; + switch (decodedPathPaymentStrictReceiveResult.Discriminant.InnerValue) { - PathPaymentStrictReceiveResult decodedPathPaymentStrictReceiveResult = new PathPaymentStrictReceiveResult(); - PathPaymentStrictReceiveResultCode discriminant = PathPaymentStrictReceiveResultCode.Decode(stream); - decodedPathPaymentStrictReceiveResult.Discriminant = discriminant; - switch (decodedPathPaymentStrictReceiveResult.Discriminant.InnerValue) - { - case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: - decodedPathPaymentStrictReceiveResult.Success = PathPaymentStrictReceiveResultSuccess.Decode(stream); - break; - case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: - decodedPathPaymentStrictReceiveResult.NoIssuer = Asset.Decode(stream); - break; - default: - break; - } - return decodedPathPaymentStrictReceiveResult; + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_SUCCESS: + decodedPathPaymentStrictReceiveResult.Success = PathPaymentStrictReceiveResultSuccess.Decode(stream); + break; + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_MALFORMED: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL: + break; + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER: + decodedPathPaymentStrictReceiveResult.NoIssuer = Asset.Decode(stream); + break; + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF: + case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum + .PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX: + break; } - public class PathPaymentStrictReceiveResultSuccess - { - public PathPaymentStrictReceiveResultSuccess() { } - public ClaimAtom[] Offers { get; set; } - public SimplePaymentResult Last { get; set; } + return decodedPathPaymentStrictReceiveResult; + } - public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveResultSuccess encodedPathPaymentStrictReceiveResultSuccess) - { - int offerssize = encodedPathPaymentStrictReceiveResultSuccess.Offers.Length; - stream.WriteInt(offerssize); - for (int i = 0; i < offerssize; i++) - { - ClaimAtom.Encode(stream, encodedPathPaymentStrictReceiveResultSuccess.Offers[i]); - } - SimplePaymentResult.Encode(stream, encodedPathPaymentStrictReceiveResultSuccess.Last); - } - public static PathPaymentStrictReceiveResultSuccess Decode(XdrDataInputStream stream) - { - PathPaymentStrictReceiveResultSuccess decodedPathPaymentStrictReceiveResultSuccess = new PathPaymentStrictReceiveResultSuccess(); - int offerssize = stream.ReadInt(); - decodedPathPaymentStrictReceiveResultSuccess.Offers = new ClaimAtom[offerssize]; - for (int i = 0; i < offerssize; i++) - { - decodedPathPaymentStrictReceiveResultSuccess.Offers[i] = ClaimAtom.Decode(stream); - } - decodedPathPaymentStrictReceiveResultSuccess.Last = SimplePaymentResult.Decode(stream); - return decodedPathPaymentStrictReceiveResultSuccess; - } + public class PathPaymentStrictReceiveResultSuccess + { + public ClaimAtom[] Offers { get; set; } + public SimplePaymentResult Last { get; set; } + public static void Encode(XdrDataOutputStream stream, + PathPaymentStrictReceiveResultSuccess encodedPathPaymentStrictReceiveResultSuccess) + { + var offerssize = encodedPathPaymentStrictReceiveResultSuccess.Offers.Length; + stream.WriteInt(offerssize); + for (var i = 0; i < offerssize; i++) + ClaimAtom.Encode(stream, encodedPathPaymentStrictReceiveResultSuccess.Offers[i]); + SimplePaymentResult.Encode(stream, encodedPathPaymentStrictReceiveResultSuccess.Last); + } + + public static PathPaymentStrictReceiveResultSuccess Decode(XdrDataInputStream stream) + { + var decodedPathPaymentStrictReceiveResultSuccess = new PathPaymentStrictReceiveResultSuccess(); + var offerssize = stream.ReadInt(); + decodedPathPaymentStrictReceiveResultSuccess.Offers = new ClaimAtom[offerssize]; + for (var i = 0; i < offerssize; i++) + decodedPathPaymentStrictReceiveResultSuccess.Offers[i] = ClaimAtom.Decode(stream); + decodedPathPaymentStrictReceiveResultSuccess.Last = SimplePaymentResult.Decode(stream); + return decodedPathPaymentStrictReceiveResultSuccess; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveResultCode.cs b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveResultCode.cs index bf4b8f33..ac2a0b12 100644 --- a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictReceiveResultCode.cs @@ -1,96 +1,98 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum PathPaymentStrictReceiveResultCode - // { - // // 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 = - // -2, // not enough funds in source account - // PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST = - // -3, // no trust line on source account - // PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED = - // -4, // source not authorized to transfer - // PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION = - // -5, // destination account does not exist - // PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST = - // -6, // dest missing a trust line for asset - // PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED = - // -7, // dest not authorized to hold asset - // PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL = - // -8, // dest would go above their limit - // PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER = -9, // missing issuer on one asset - // PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS = - // -10, // not enough offers to satisfy path - // PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF = - // -11, // would cross one of its own offers - // PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX = -12 // could not satisfy sendmax - // }; +// enum PathPaymentStrictReceiveResultCode +// { +// // 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 = +// -2, // not enough funds in source account +// PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST = +// -3, // no trust line on source account +// PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED = +// -4, // source not authorized to transfer +// PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION = +// -5, // destination account does not exist +// PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST = +// -6, // dest missing a trust line for asset +// PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED = +// -7, // dest not authorized to hold asset +// PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL = +// -8, // dest would go above their limit +// PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER = -9, // missing issuer on one asset +// PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS = +// -10, // not enough offers to satisfy path +// PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF = +// -11, // would cross one of its own offers +// PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX = -12 // could not satisfy sendmax +// }; - // =========================================================================== - public class PathPaymentStrictReceiveResultCode +// =========================================================================== +public class PathPaymentStrictReceiveResultCode +{ + public enum PathPaymentStrictReceiveResultCodeEnum { - public enum PathPaymentStrictReceiveResultCodeEnum - { - PATH_PAYMENT_STRICT_RECEIVE_SUCCESS = 0, - PATH_PAYMENT_STRICT_RECEIVE_MALFORMED = -1, - PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED = -2, - PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST = -3, - PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED = -4, - PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION = -5, - PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST = -6, - PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED = -7, - PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL = -8, - PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER = -9, - PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS = -10, - PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF = -11, - PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX = -12, - } - public PathPaymentStrictReceiveResultCodeEnum InnerValue { get; set; } = default(PathPaymentStrictReceiveResultCodeEnum); + PATH_PAYMENT_STRICT_RECEIVE_SUCCESS = 0, + PATH_PAYMENT_STRICT_RECEIVE_MALFORMED = -1, + PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED = -2, + PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST = -3, + PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED = -4, + PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION = -5, + PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST = -6, + PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED = -7, + PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL = -8, + PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER = -9, + PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS = -10, + PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF = -11, + PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX = -12 + } - public static PathPaymentStrictReceiveResultCode Create(PathPaymentStrictReceiveResultCodeEnum v) - { - return new PathPaymentStrictReceiveResultCode - { - InnerValue = v - }; - } + public PathPaymentStrictReceiveResultCodeEnum InnerValue { get; set; } = default; - public static PathPaymentStrictReceiveResultCode Decode(XdrDataInputStream stream) + public static PathPaymentStrictReceiveResultCode Create(PathPaymentStrictReceiveResultCodeEnum v) + { + return new PathPaymentStrictReceiveResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SUCCESS); - case -1: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_MALFORMED); - case -2: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED); - case -3: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST); - case -4: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED); - case -5: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION); - case -6: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST); - case -7: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED); - case -8: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL); - case -9: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER); - case -10: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS); - case -11: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF); - case -12: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveResultCode value) + public static PathPaymentStrictReceiveResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SUCCESS); + case -1: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_MALFORMED); + case -2: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED); + case -3: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST); + case -4: + return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED); + case -5: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION); + case -6: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST); + case -7: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED); + case -8: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL); + case -9: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER); + case -10: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS); + case -11: + return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF); + case -12: return Create(PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendOp.cs b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendOp.cs index ca30f53d..4e7328fa 100644 --- a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendOp.cs @@ -1,66 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct PathPaymentStrictSendOp +// { +// 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 +// }; - // struct PathPaymentStrictSendOp - // { - // 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 - // }; +// =========================================================================== +public class PathPaymentStrictSendOp +{ + public Asset SendAsset { get; set; } + public Int64 SendAmount { get; set; } + public MuxedAccount Destination { get; set; } + public Asset DestAsset { get; set; } + public Int64 DestMin { get; set; } + public Asset[] Path { get; set; } - // =========================================================================== - public class PathPaymentStrictSendOp + public static void Encode(XdrDataOutputStream stream, PathPaymentStrictSendOp encodedPathPaymentStrictSendOp) { - public PathPaymentStrictSendOp() { } - public Asset SendAsset { get; set; } - public Int64 SendAmount { get; set; } - public MuxedAccount Destination { get; set; } - public Asset DestAsset { get; set; } - public Int64 DestMin { get; set; } - public Asset[] Path { get; set; } + Asset.Encode(stream, encodedPathPaymentStrictSendOp.SendAsset); + Int64.Encode(stream, encodedPathPaymentStrictSendOp.SendAmount); + MuxedAccount.Encode(stream, encodedPathPaymentStrictSendOp.Destination); + Asset.Encode(stream, encodedPathPaymentStrictSendOp.DestAsset); + Int64.Encode(stream, encodedPathPaymentStrictSendOp.DestMin); + var pathsize = encodedPathPaymentStrictSendOp.Path.Length; + stream.WriteInt(pathsize); + for (var i = 0; i < pathsize; i++) Asset.Encode(stream, encodedPathPaymentStrictSendOp.Path[i]); + } - public static void Encode(XdrDataOutputStream stream, PathPaymentStrictSendOp encodedPathPaymentStrictSendOp) - { - Asset.Encode(stream, encodedPathPaymentStrictSendOp.SendAsset); - Int64.Encode(stream, encodedPathPaymentStrictSendOp.SendAmount); - MuxedAccount.Encode(stream, encodedPathPaymentStrictSendOp.Destination); - Asset.Encode(stream, encodedPathPaymentStrictSendOp.DestAsset); - Int64.Encode(stream, encodedPathPaymentStrictSendOp.DestMin); - int pathsize = encodedPathPaymentStrictSendOp.Path.Length; - stream.WriteInt(pathsize); - for (int i = 0; i < pathsize; i++) - { - Asset.Encode(stream, encodedPathPaymentStrictSendOp.Path[i]); - } - } - public static PathPaymentStrictSendOp Decode(XdrDataInputStream stream) - { - PathPaymentStrictSendOp decodedPathPaymentStrictSendOp = new PathPaymentStrictSendOp(); - decodedPathPaymentStrictSendOp.SendAsset = Asset.Decode(stream); - decodedPathPaymentStrictSendOp.SendAmount = Int64.Decode(stream); - decodedPathPaymentStrictSendOp.Destination = MuxedAccount.Decode(stream); - decodedPathPaymentStrictSendOp.DestAsset = Asset.Decode(stream); - decodedPathPaymentStrictSendOp.DestMin = Int64.Decode(stream); - int pathsize = stream.ReadInt(); - decodedPathPaymentStrictSendOp.Path = new Asset[pathsize]; - for (int i = 0; i < pathsize; i++) - { - decodedPathPaymentStrictSendOp.Path[i] = Asset.Decode(stream); - } - return decodedPathPaymentStrictSendOp; - } + public static PathPaymentStrictSendOp Decode(XdrDataInputStream stream) + { + var decodedPathPaymentStrictSendOp = new PathPaymentStrictSendOp(); + decodedPathPaymentStrictSendOp.SendAsset = Asset.Decode(stream); + decodedPathPaymentStrictSendOp.SendAmount = Int64.Decode(stream); + decodedPathPaymentStrictSendOp.Destination = MuxedAccount.Decode(stream); + decodedPathPaymentStrictSendOp.DestAsset = Asset.Decode(stream); + decodedPathPaymentStrictSendOp.DestMin = Int64.Decode(stream); + var pathsize = stream.ReadInt(); + decodedPathPaymentStrictSendOp.Path = new Asset[pathsize]; + for (var i = 0; i < pathsize; i++) decodedPathPaymentStrictSendOp.Path[i] = Asset.Decode(stream); + return decodedPathPaymentStrictSendOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendResult.cs b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendResult.cs index 10119912..dfb1078d 100644 --- a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendResult.cs @@ -1,98 +1,142 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union PathPaymentStrictSendResult switch (PathPaymentStrictSendResultCode code) - // { - // case PATH_PAYMENT_STRICT_SEND_SUCCESS: - // struct - // { - // ClaimAtom offers<>; - // SimplePaymentResult last; - // } success; - // case PATH_PAYMENT_STRICT_SEND_NO_ISSUER: - // Asset noIssuer; // the asset that caused the error - // default: - // void; - // }; +// union PathPaymentStrictSendResult switch (PathPaymentStrictSendResultCode code) +// { +// case PATH_PAYMENT_STRICT_SEND_SUCCESS: +// struct +// { +// ClaimAtom offers<>; +// SimplePaymentResult last; +// } success; +// case PATH_PAYMENT_STRICT_SEND_MALFORMED: +// case PATH_PAYMENT_STRICT_SEND_UNDERFUNDED: +// case PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST: +// case PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED: +// case PATH_PAYMENT_STRICT_SEND_NO_DESTINATION: +// case PATH_PAYMENT_STRICT_SEND_NO_TRUST: +// case PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED: +// case PATH_PAYMENT_STRICT_SEND_LINE_FULL: +// void; +// case PATH_PAYMENT_STRICT_SEND_NO_ISSUER: +// Asset noIssuer; // the asset that caused the error +// case PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS: +// case PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF: +// case PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN: +// void; +// }; - // =========================================================================== - public class PathPaymentStrictSendResult - { - public PathPaymentStrictSendResult() { } +// =========================================================================== +public class PathPaymentStrictSendResult +{ + public PathPaymentStrictSendResultCode Discriminant { get; set; } = new(); - public PathPaymentStrictSendResultCode Discriminant { get; set; } = new PathPaymentStrictSendResultCode(); + public PathPaymentStrictSendResultSuccess Success { get; set; } + public Asset NoIssuer { get; set; } - public PathPaymentStrictSendResultSuccess Success { get; set; } - public Asset NoIssuer { get; set; } - public static void Encode(XdrDataOutputStream stream, PathPaymentStrictSendResult encodedPathPaymentStrictSendResult) + public static void Encode(XdrDataOutputStream stream, + PathPaymentStrictSendResult encodedPathPaymentStrictSendResult) + { + stream.WriteInt((int)encodedPathPaymentStrictSendResult.Discriminant.InnerValue); + switch (encodedPathPaymentStrictSendResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedPathPaymentStrictSendResult.Discriminant.InnerValue); - switch (encodedPathPaymentStrictSendResult.Discriminant.InnerValue) - { - case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SUCCESS: - PathPaymentStrictSendResultSuccess.Encode(stream, encodedPathPaymentStrictSendResult.Success); - break; - case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_ISSUER: - Asset.Encode(stream, encodedPathPaymentStrictSendResult.NoIssuer); - break; - default: - break; - } + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SUCCESS: + PathPaymentStrictSendResultSuccess.Encode(stream, encodedPathPaymentStrictSendResult.Success); + break; + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_MALFORMED: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_UNDERFUNDED: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_NO_DESTINATION: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_TRUST: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_LINE_FULL: + break; + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_ISSUER: + Asset.Encode(stream, encodedPathPaymentStrictSendResult.NoIssuer); + break; + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN: + break; } - public static PathPaymentStrictSendResult Decode(XdrDataInputStream stream) + } + + public static PathPaymentStrictSendResult Decode(XdrDataInputStream stream) + { + var decodedPathPaymentStrictSendResult = new PathPaymentStrictSendResult(); + var discriminant = PathPaymentStrictSendResultCode.Decode(stream); + decodedPathPaymentStrictSendResult.Discriminant = discriminant; + switch (decodedPathPaymentStrictSendResult.Discriminant.InnerValue) { - PathPaymentStrictSendResult decodedPathPaymentStrictSendResult = new PathPaymentStrictSendResult(); - PathPaymentStrictSendResultCode discriminant = PathPaymentStrictSendResultCode.Decode(stream); - decodedPathPaymentStrictSendResult.Discriminant = discriminant; - switch (decodedPathPaymentStrictSendResult.Discriminant.InnerValue) - { - case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SUCCESS: - decodedPathPaymentStrictSendResult.Success = PathPaymentStrictSendResultSuccess.Decode(stream); - break; - case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_ISSUER: - decodedPathPaymentStrictSendResult.NoIssuer = Asset.Decode(stream); - break; - default: - break; - } - return decodedPathPaymentStrictSendResult; + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SUCCESS: + decodedPathPaymentStrictSendResult.Success = PathPaymentStrictSendResultSuccess.Decode(stream); + break; + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_MALFORMED: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_UNDERFUNDED: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_NO_DESTINATION: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_TRUST: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_LINE_FULL: + break; + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_ISSUER: + decodedPathPaymentStrictSendResult.NoIssuer = Asset.Decode(stream); + break; + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF: + case PathPaymentStrictSendResultCode.PathPaymentStrictSendResultCodeEnum + .PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN: + break; } - public class PathPaymentStrictSendResultSuccess - { - public PathPaymentStrictSendResultSuccess() { } - public ClaimAtom[] Offers { get; set; } - public SimplePaymentResult Last { get; set; } + return decodedPathPaymentStrictSendResult; + } - public static void Encode(XdrDataOutputStream stream, PathPaymentStrictSendResultSuccess encodedPathPaymentStrictSendResultSuccess) - { - int offerssize = encodedPathPaymentStrictSendResultSuccess.Offers.Length; - stream.WriteInt(offerssize); - for (int i = 0; i < offerssize; i++) - { - ClaimAtom.Encode(stream, encodedPathPaymentStrictSendResultSuccess.Offers[i]); - } - SimplePaymentResult.Encode(stream, encodedPathPaymentStrictSendResultSuccess.Last); - } - public static PathPaymentStrictSendResultSuccess Decode(XdrDataInputStream stream) - { - PathPaymentStrictSendResultSuccess decodedPathPaymentStrictSendResultSuccess = new PathPaymentStrictSendResultSuccess(); - int offerssize = stream.ReadInt(); - decodedPathPaymentStrictSendResultSuccess.Offers = new ClaimAtom[offerssize]; - for (int i = 0; i < offerssize; i++) - { - decodedPathPaymentStrictSendResultSuccess.Offers[i] = ClaimAtom.Decode(stream); - } - decodedPathPaymentStrictSendResultSuccess.Last = SimplePaymentResult.Decode(stream); - return decodedPathPaymentStrictSendResultSuccess; - } + public class PathPaymentStrictSendResultSuccess + { + public ClaimAtom[] Offers { get; set; } + public SimplePaymentResult Last { get; set; } + public static void Encode(XdrDataOutputStream stream, + PathPaymentStrictSendResultSuccess encodedPathPaymentStrictSendResultSuccess) + { + var offerssize = encodedPathPaymentStrictSendResultSuccess.Offers.Length; + stream.WriteInt(offerssize); + for (var i = 0; i < offerssize; i++) + ClaimAtom.Encode(stream, encodedPathPaymentStrictSendResultSuccess.Offers[i]); + SimplePaymentResult.Encode(stream, encodedPathPaymentStrictSendResultSuccess.Last); + } + + public static PathPaymentStrictSendResultSuccess Decode(XdrDataInputStream stream) + { + var decodedPathPaymentStrictSendResultSuccess = new PathPaymentStrictSendResultSuccess(); + var offerssize = stream.ReadInt(); + decodedPathPaymentStrictSendResultSuccess.Offers = new ClaimAtom[offerssize]; + for (var i = 0; i < offerssize; i++) + decodedPathPaymentStrictSendResultSuccess.Offers[i] = ClaimAtom.Decode(stream); + decodedPathPaymentStrictSendResultSuccess.Last = SimplePaymentResult.Decode(stream); + return decodedPathPaymentStrictSendResultSuccess; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendResultCode.cs b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendResultCode.cs index 05b97a11..19758146 100644 --- a/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/PathPaymentStrictSendResultCode.cs @@ -1,95 +1,95 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum PathPaymentStrictSendResultCode - // { - // // 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 = - // -2, // not enough funds in source account - // PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST = - // -3, // no trust line on source account - // PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED = - // -4, // source not authorized to transfer - // PATH_PAYMENT_STRICT_SEND_NO_DESTINATION = - // -5, // destination account does not exist - // PATH_PAYMENT_STRICT_SEND_NO_TRUST = - // -6, // dest missing a trust line for asset - // PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED = - // -7, // dest not authorized to hold asset - // PATH_PAYMENT_STRICT_SEND_LINE_FULL = -8, // dest would go above their limit - // PATH_PAYMENT_STRICT_SEND_NO_ISSUER = -9, // missing issuer on one asset - // PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS = - // -10, // not enough offers to satisfy path - // PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF = - // -11, // would cross one of its own offers - // PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN = -12 // could not satisfy destMin - // }; +// enum PathPaymentStrictSendResultCode +// { +// // 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 = +// -2, // not enough funds in source account +// PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST = +// -3, // no trust line on source account +// PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED = +// -4, // source not authorized to transfer +// PATH_PAYMENT_STRICT_SEND_NO_DESTINATION = +// -5, // destination account does not exist +// PATH_PAYMENT_STRICT_SEND_NO_TRUST = +// -6, // dest missing a trust line for asset +// PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED = +// -7, // dest not authorized to hold asset +// PATH_PAYMENT_STRICT_SEND_LINE_FULL = -8, // dest would go above their limit +// PATH_PAYMENT_STRICT_SEND_NO_ISSUER = -9, // missing issuer on one asset +// PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS = +// -10, // not enough offers to satisfy path +// PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF = +// -11, // would cross one of its own offers +// PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN = -12 // could not satisfy destMin +// }; - // =========================================================================== - public class PathPaymentStrictSendResultCode +// =========================================================================== +public class PathPaymentStrictSendResultCode +{ + public enum PathPaymentStrictSendResultCodeEnum { - public enum PathPaymentStrictSendResultCodeEnum - { - PATH_PAYMENT_STRICT_SEND_SUCCESS = 0, - PATH_PAYMENT_STRICT_SEND_MALFORMED = -1, - PATH_PAYMENT_STRICT_SEND_UNDERFUNDED = -2, - PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST = -3, - PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED = -4, - PATH_PAYMENT_STRICT_SEND_NO_DESTINATION = -5, - PATH_PAYMENT_STRICT_SEND_NO_TRUST = -6, - PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED = -7, - PATH_PAYMENT_STRICT_SEND_LINE_FULL = -8, - PATH_PAYMENT_STRICT_SEND_NO_ISSUER = -9, - PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS = -10, - PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF = -11, - PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN = -12, - } - public PathPaymentStrictSendResultCodeEnum InnerValue { get; set; } = default(PathPaymentStrictSendResultCodeEnum); + PATH_PAYMENT_STRICT_SEND_SUCCESS = 0, + PATH_PAYMENT_STRICT_SEND_MALFORMED = -1, + PATH_PAYMENT_STRICT_SEND_UNDERFUNDED = -2, + PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST = -3, + PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED = -4, + PATH_PAYMENT_STRICT_SEND_NO_DESTINATION = -5, + PATH_PAYMENT_STRICT_SEND_NO_TRUST = -6, + PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED = -7, + PATH_PAYMENT_STRICT_SEND_LINE_FULL = -8, + PATH_PAYMENT_STRICT_SEND_NO_ISSUER = -9, + PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS = -10, + PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF = -11, + PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN = -12 + } - public static PathPaymentStrictSendResultCode Create(PathPaymentStrictSendResultCodeEnum v) - { - return new PathPaymentStrictSendResultCode - { - InnerValue = v - }; - } + public PathPaymentStrictSendResultCodeEnum InnerValue { get; set; } = default; - public static PathPaymentStrictSendResultCode Decode(XdrDataInputStream stream) + public static PathPaymentStrictSendResultCode Create(PathPaymentStrictSendResultCodeEnum v) + { + return new PathPaymentStrictSendResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SUCCESS); - case -1: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_MALFORMED); - case -2: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_UNDERFUNDED); - case -3: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST); - case -4: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED); - case -5: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_DESTINATION); - case -6: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_TRUST); - case -7: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED); - case -8: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_LINE_FULL); - case -9: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_ISSUER); - case -10: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS); - case -11: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF); - case -12: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, PathPaymentStrictSendResultCode value) + public static PathPaymentStrictSendResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SUCCESS); + case -1: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_MALFORMED); + case -2: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_UNDERFUNDED); + case -3: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST); + case -4: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED); + case -5: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_DESTINATION); + case -6: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_TRUST); + case -7: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED); + case -8: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_LINE_FULL); + case -9: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_NO_ISSUER); + case -10: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS); + case -11: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF); + case -12: return Create(PathPaymentStrictSendResultCodeEnum.PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, PathPaymentStrictSendResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PaymentOp.cs b/stellar-dotnet-sdk-xdr/generated/PaymentOp.cs index b47acda8..57f4e4f9 100644 --- a/stellar-dotnet-sdk-xdr/generated/PaymentOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/PaymentOp.cs @@ -1,40 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct PaymentOp +// { +// MuxedAccount destination; // recipient of the payment +// Asset asset; // what they end up with +// int64 amount; // amount they end up with +// }; - // struct PaymentOp - // { - // MuxedAccount destination; // recipient of the payment - // Asset asset; // what they end up with - // int64 amount; // amount they end up with - // }; +// =========================================================================== +public class PaymentOp +{ + public MuxedAccount Destination { get; set; } + public Asset Asset { get; set; } + public Int64 Amount { get; set; } - // =========================================================================== - public class PaymentOp + public static void Encode(XdrDataOutputStream stream, PaymentOp encodedPaymentOp) { - public PaymentOp() { } - public MuxedAccount Destination { get; set; } - public Asset Asset { get; set; } - public Int64 Amount { get; set; } + MuxedAccount.Encode(stream, encodedPaymentOp.Destination); + Asset.Encode(stream, encodedPaymentOp.Asset); + Int64.Encode(stream, encodedPaymentOp.Amount); + } - public static void Encode(XdrDataOutputStream stream, PaymentOp encodedPaymentOp) - { - MuxedAccount.Encode(stream, encodedPaymentOp.Destination); - Asset.Encode(stream, encodedPaymentOp.Asset); - Int64.Encode(stream, encodedPaymentOp.Amount); - } - public static PaymentOp Decode(XdrDataInputStream stream) - { - PaymentOp decodedPaymentOp = new PaymentOp(); - decodedPaymentOp.Destination = MuxedAccount.Decode(stream); - decodedPaymentOp.Asset = Asset.Decode(stream); - decodedPaymentOp.Amount = Int64.Decode(stream); - return decodedPaymentOp; - } + public static PaymentOp Decode(XdrDataInputStream stream) + { + var decodedPaymentOp = new PaymentOp(); + decodedPaymentOp.Destination = MuxedAccount.Decode(stream); + decodedPaymentOp.Asset = Asset.Decode(stream); + decodedPaymentOp.Amount = Int64.Decode(stream); + return decodedPaymentOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PaymentResult.cs b/stellar-dotnet-sdk-xdr/generated/PaymentResult.cs index ba076bc1..bf82af05 100644 --- a/stellar-dotnet-sdk-xdr/generated/PaymentResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/PaymentResult.cs @@ -1,51 +1,72 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union PaymentResult switch (PaymentResultCode code) - // { - // case PAYMENT_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class PaymentResult - { - public PaymentResult() { } +// union PaymentResult switch (PaymentResultCode code) +// { +// case PAYMENT_SUCCESS: +// void; +// case PAYMENT_MALFORMED: +// case PAYMENT_UNDERFUNDED: +// case PAYMENT_SRC_NO_TRUST: +// case PAYMENT_SRC_NOT_AUTHORIZED: +// case PAYMENT_NO_DESTINATION: +// case PAYMENT_NO_TRUST: +// case PAYMENT_NOT_AUTHORIZED: +// case PAYMENT_LINE_FULL: +// case PAYMENT_NO_ISSUER: +// void; +// }; - public PaymentResultCode Discriminant { get; set; } = new PaymentResultCode(); +// =========================================================================== +public class PaymentResult +{ + public PaymentResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, PaymentResult encodedPaymentResult) + public static void Encode(XdrDataOutputStream stream, PaymentResult encodedPaymentResult) + { + stream.WriteInt((int)encodedPaymentResult.Discriminant.InnerValue); + switch (encodedPaymentResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedPaymentResult.Discriminant.InnerValue); - switch (encodedPaymentResult.Discriminant.InnerValue) - { - case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SUCCESS: - break; - default: - break; - } + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SUCCESS: + break; + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_MALFORMED: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_UNDERFUNDED: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SRC_NO_TRUST: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SRC_NOT_AUTHORIZED: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_NO_DESTINATION: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_NO_TRUST: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_NOT_AUTHORIZED: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_LINE_FULL: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_NO_ISSUER: + break; } - public static PaymentResult Decode(XdrDataInputStream stream) + } + + public static PaymentResult Decode(XdrDataInputStream stream) + { + var decodedPaymentResult = new PaymentResult(); + var discriminant = PaymentResultCode.Decode(stream); + decodedPaymentResult.Discriminant = discriminant; + switch (decodedPaymentResult.Discriminant.InnerValue) { - PaymentResult decodedPaymentResult = new PaymentResult(); - PaymentResultCode discriminant = PaymentResultCode.Decode(stream); - decodedPaymentResult.Discriminant = discriminant; - switch (decodedPaymentResult.Discriminant.InnerValue) - { - case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SUCCESS: - break; - default: - break; - } - return decodedPaymentResult; + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SUCCESS: + break; + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_MALFORMED: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_UNDERFUNDED: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SRC_NO_TRUST: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SRC_NOT_AUTHORIZED: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_NO_DESTINATION: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_NO_TRUST: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_NOT_AUTHORIZED: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_LINE_FULL: + case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_NO_ISSUER: + break; } + + return decodedPaymentResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PaymentResultCode.cs b/stellar-dotnet-sdk-xdr/generated/PaymentResultCode.cs index 35205551..5192e97a 100644 --- a/stellar-dotnet-sdk-xdr/generated/PaymentResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/PaymentResultCode.cs @@ -1,78 +1,78 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum PaymentResultCode - // { - // // 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 - // PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account - // PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer - // PAYMENT_NO_DESTINATION = -5, // destination account does not exist - // PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset - // PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset - // PAYMENT_LINE_FULL = -8, // destination would go above their limit - // PAYMENT_NO_ISSUER = -9 // missing issuer on asset - // }; +// enum PaymentResultCode +// { +// // 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 +// PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account +// PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer +// PAYMENT_NO_DESTINATION = -5, // destination account does not exist +// PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset +// PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset +// PAYMENT_LINE_FULL = -8, // destination would go above their limit +// PAYMENT_NO_ISSUER = -9 // missing issuer on asset +// }; - // =========================================================================== - public class PaymentResultCode +// =========================================================================== +public class PaymentResultCode +{ + public enum PaymentResultCodeEnum { - public enum PaymentResultCodeEnum - { - PAYMENT_SUCCESS = 0, - PAYMENT_MALFORMED = -1, - PAYMENT_UNDERFUNDED = -2, - PAYMENT_SRC_NO_TRUST = -3, - PAYMENT_SRC_NOT_AUTHORIZED = -4, - PAYMENT_NO_DESTINATION = -5, - PAYMENT_NO_TRUST = -6, - PAYMENT_NOT_AUTHORIZED = -7, - PAYMENT_LINE_FULL = -8, - PAYMENT_NO_ISSUER = -9, - } - public PaymentResultCodeEnum InnerValue { get; set; } = default(PaymentResultCodeEnum); + PAYMENT_SUCCESS = 0, + PAYMENT_MALFORMED = -1, + PAYMENT_UNDERFUNDED = -2, + PAYMENT_SRC_NO_TRUST = -3, + PAYMENT_SRC_NOT_AUTHORIZED = -4, + PAYMENT_NO_DESTINATION = -5, + PAYMENT_NO_TRUST = -6, + PAYMENT_NOT_AUTHORIZED = -7, + PAYMENT_LINE_FULL = -8, + PAYMENT_NO_ISSUER = -9 + } - public static PaymentResultCode Create(PaymentResultCodeEnum v) - { - return new PaymentResultCode - { - InnerValue = v - }; - } + public PaymentResultCodeEnum InnerValue { get; set; } = default; - public static PaymentResultCode Decode(XdrDataInputStream stream) + public static PaymentResultCode Create(PaymentResultCodeEnum v) + { + return new PaymentResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(PaymentResultCodeEnum.PAYMENT_SUCCESS); - case -1: return Create(PaymentResultCodeEnum.PAYMENT_MALFORMED); - case -2: return Create(PaymentResultCodeEnum.PAYMENT_UNDERFUNDED); - case -3: return Create(PaymentResultCodeEnum.PAYMENT_SRC_NO_TRUST); - case -4: return Create(PaymentResultCodeEnum.PAYMENT_SRC_NOT_AUTHORIZED); - case -5: return Create(PaymentResultCodeEnum.PAYMENT_NO_DESTINATION); - case -6: return Create(PaymentResultCodeEnum.PAYMENT_NO_TRUST); - case -7: return Create(PaymentResultCodeEnum.PAYMENT_NOT_AUTHORIZED); - case -8: return Create(PaymentResultCodeEnum.PAYMENT_LINE_FULL); - case -9: return Create(PaymentResultCodeEnum.PAYMENT_NO_ISSUER); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, PaymentResultCode value) + public static PaymentResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(PaymentResultCodeEnum.PAYMENT_SUCCESS); + case -1: return Create(PaymentResultCodeEnum.PAYMENT_MALFORMED); + case -2: return Create(PaymentResultCodeEnum.PAYMENT_UNDERFUNDED); + case -3: return Create(PaymentResultCodeEnum.PAYMENT_SRC_NO_TRUST); + case -4: return Create(PaymentResultCodeEnum.PAYMENT_SRC_NOT_AUTHORIZED); + case -5: return Create(PaymentResultCodeEnum.PAYMENT_NO_DESTINATION); + case -6: return Create(PaymentResultCodeEnum.PAYMENT_NO_TRUST); + case -7: return Create(PaymentResultCodeEnum.PAYMENT_NOT_AUTHORIZED); + case -8: return Create(PaymentResultCodeEnum.PAYMENT_LINE_FULL); + case -9: return Create(PaymentResultCodeEnum.PAYMENT_NO_ISSUER); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, PaymentResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PeerAddress.cs b/stellar-dotnet-sdk-xdr/generated/PeerAddress.cs index 603e32af..9d422036 100644 --- a/stellar-dotnet-sdk-xdr/generated/PeerAddress.cs +++ b/stellar-dotnet-sdk-xdr/generated/PeerAddress.cs @@ -1,93 +1,90 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct PeerAddress +// { +// union switch (IPAddrType type) +// { +// case IPv4: +// opaque ipv4[4]; +// case IPv6: +// opaque ipv6[16]; +// } +// ip; +// uint32 port; +// uint32 numFailures; +// }; - // struct PeerAddress - // { - // union switch (IPAddrType type) - // { - // case IPv4: - // opaque ipv4[4]; - // case IPv6: - // opaque ipv6[16]; - // } - // ip; - // uint32 port; - // uint32 numFailures; - // }; +// =========================================================================== +public class PeerAddress +{ + public PeerAddressIp Ip { get; set; } + public Uint32 Port { get; set; } + public Uint32 NumFailures { get; set; } - // =========================================================================== - public class PeerAddress + public static void Encode(XdrDataOutputStream stream, PeerAddress encodedPeerAddress) { - public PeerAddress() { } - public PeerAddressIp Ip { get; set; } - public Uint32 Port { get; set; } - public Uint32 NumFailures { get; set; } + PeerAddressIp.Encode(stream, encodedPeerAddress.Ip); + Uint32.Encode(stream, encodedPeerAddress.Port); + Uint32.Encode(stream, encodedPeerAddress.NumFailures); + } - public static void Encode(XdrDataOutputStream stream, PeerAddress encodedPeerAddress) - { - PeerAddressIp.Encode(stream, encodedPeerAddress.Ip); - Uint32.Encode(stream, encodedPeerAddress.Port); - Uint32.Encode(stream, encodedPeerAddress.NumFailures); - } - public static PeerAddress Decode(XdrDataInputStream stream) - { - PeerAddress decodedPeerAddress = new PeerAddress(); - decodedPeerAddress.Ip = PeerAddressIp.Decode(stream); - decodedPeerAddress.Port = Uint32.Decode(stream); - decodedPeerAddress.NumFailures = Uint32.Decode(stream); - return decodedPeerAddress; - } + public static PeerAddress Decode(XdrDataInputStream stream) + { + var decodedPeerAddress = new PeerAddress(); + decodedPeerAddress.Ip = PeerAddressIp.Decode(stream); + decodedPeerAddress.Port = Uint32.Decode(stream); + decodedPeerAddress.NumFailures = Uint32.Decode(stream); + return decodedPeerAddress; + } - public class PeerAddressIp - { - public PeerAddressIp() { } + public class PeerAddressIp + { + public IPAddrType Discriminant { get; set; } = new(); - public IPAddrType Discriminant { get; set; } = new IPAddrType(); + public byte[] Ipv4 { get; set; } + public byte[] Ipv6 { get; set; } - public byte[] Ipv4 { get; set; } - public byte[] Ipv6 { get; set; } - public static void Encode(XdrDataOutputStream stream, PeerAddressIp encodedPeerAddressIp) + public static void Encode(XdrDataOutputStream stream, PeerAddressIp encodedPeerAddressIp) + { + stream.WriteInt((int)encodedPeerAddressIp.Discriminant.InnerValue); + switch (encodedPeerAddressIp.Discriminant.InnerValue) { - stream.WriteInt((int)encodedPeerAddressIp.Discriminant.InnerValue); - switch (encodedPeerAddressIp.Discriminant.InnerValue) - { - case IPAddrType.IPAddrTypeEnum.IPv4: - int ipv4size = encodedPeerAddressIp.Ipv4.Length; - stream.Write(encodedPeerAddressIp.Ipv4, 0, ipv4size); - break; - case IPAddrType.IPAddrTypeEnum.IPv6: - int ipv6size = encodedPeerAddressIp.Ipv6.Length; - stream.Write(encodedPeerAddressIp.Ipv6, 0, ipv6size); - break; - } + case IPAddrType.IPAddrTypeEnum.IPv4: + var ipv4size = encodedPeerAddressIp.Ipv4.Length; + stream.Write(encodedPeerAddressIp.Ipv4, 0, ipv4size); + break; + case IPAddrType.IPAddrTypeEnum.IPv6: + var ipv6size = encodedPeerAddressIp.Ipv6.Length; + stream.Write(encodedPeerAddressIp.Ipv6, 0, ipv6size); + break; } - public static PeerAddressIp Decode(XdrDataInputStream stream) + } + + public static PeerAddressIp Decode(XdrDataInputStream stream) + { + var decodedPeerAddressIp = new PeerAddressIp(); + var discriminant = IPAddrType.Decode(stream); + decodedPeerAddressIp.Discriminant = discriminant; + switch (decodedPeerAddressIp.Discriminant.InnerValue) { - PeerAddressIp decodedPeerAddressIp = new PeerAddressIp(); - IPAddrType discriminant = IPAddrType.Decode(stream); - decodedPeerAddressIp.Discriminant = discriminant; - switch (decodedPeerAddressIp.Discriminant.InnerValue) - { - case IPAddrType.IPAddrTypeEnum.IPv4: - int ipv4size = 4; - decodedPeerAddressIp.Ipv4 = new byte[ipv4size]; - stream.Read(decodedPeerAddressIp.Ipv4, 0, ipv4size); - break; - case IPAddrType.IPAddrTypeEnum.IPv6: - int ipv6size = 16; - decodedPeerAddressIp.Ipv6 = new byte[ipv6size]; - stream.Read(decodedPeerAddressIp.Ipv6, 0, ipv6size); - break; - } - return decodedPeerAddressIp; + case IPAddrType.IPAddrTypeEnum.IPv4: + var ipv4size = 4; + decodedPeerAddressIp.Ipv4 = new byte[ipv4size]; + stream.Read(decodedPeerAddressIp.Ipv4, 0, ipv4size); + break; + case IPAddrType.IPAddrTypeEnum.IPv6: + var ipv6size = 16; + decodedPeerAddressIp.Ipv6 = new byte[ipv6size]; + stream.Read(decodedPeerAddressIp.Ipv6, 0, ipv6size); + break; } + return decodedPeerAddressIp; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PeerStatList.cs b/stellar-dotnet-sdk-xdr/generated/PeerStatList.cs index 07cd57dd..3792cf70 100644 --- a/stellar-dotnet-sdk-xdr/generated/PeerStatList.cs +++ b/stellar-dotnet-sdk-xdr/generated/PeerStatList.cs @@ -1,45 +1,39 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef PeerStats PeerStatList<25>; + +// =========================================================================== +public class PeerStatList { + public PeerStatList() + { + } - // === xdr source ============================================================ + public PeerStatList(PeerStats[] value) + { + InnerValue = value; + } + + public PeerStats[] InnerValue { get; set; } = default; - // typedef PeerStats PeerStatList<25>; + public static void Encode(XdrDataOutputStream stream, PeerStatList encodedPeerStatList) + { + var PeerStatListsize = encodedPeerStatList.InnerValue.Length; + stream.WriteInt(PeerStatListsize); + for (var i = 0; i < PeerStatListsize; i++) PeerStats.Encode(stream, encodedPeerStatList.InnerValue[i]); + } - // =========================================================================== - public class PeerStatList + public static PeerStatList Decode(XdrDataInputStream stream) { - public PeerStats[] InnerValue { get; set; } = default(PeerStats[]); - - public PeerStatList() { } - - public PeerStatList(PeerStats[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, PeerStatList encodedPeerStatList) - { - int PeerStatListsize = encodedPeerStatList.InnerValue.Length; - stream.WriteInt(PeerStatListsize); - for (int i = 0; i < PeerStatListsize; i++) - { - PeerStats.Encode(stream, encodedPeerStatList.InnerValue[i]); - } - } - public static PeerStatList Decode(XdrDataInputStream stream) - { - PeerStatList decodedPeerStatList = new PeerStatList(); - int PeerStatListsize = stream.ReadInt(); - decodedPeerStatList.InnerValue = new PeerStats[PeerStatListsize]; - for (int i = 0; i < PeerStatListsize; i++) - { - decodedPeerStatList.InnerValue[i] = PeerStats.Decode(stream); - } - return decodedPeerStatList; - } + var decodedPeerStatList = new PeerStatList(); + var PeerStatListsize = stream.ReadInt(); + decodedPeerStatList.InnerValue = new PeerStats[PeerStatListsize]; + for (var i = 0; i < PeerStatListsize; i++) decodedPeerStatList.InnerValue[i] = PeerStats.Decode(stream); + return decodedPeerStatList; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PeerStats.cs b/stellar-dotnet-sdk-xdr/generated/PeerStats.cs index f79a801a..55104bc3 100644 --- a/stellar-dotnet-sdk-xdr/generated/PeerStats.cs +++ b/stellar-dotnet-sdk-xdr/generated/PeerStats.cs @@ -1,90 +1,87 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct PeerStats +// { +// NodeID id; +// string versionStr<100>; +// uint64 messagesRead; +// uint64 messagesWritten; +// uint64 bytesRead; +// uint64 bytesWritten; +// uint64 secondsConnected; +// +// uint64 uniqueFloodBytesRecv; +// uint64 duplicateFloodBytesRecv; +// uint64 uniqueFetchBytesRecv; +// uint64 duplicateFetchBytesRecv; +// +// uint64 uniqueFloodMessageRecv; +// uint64 duplicateFloodMessageRecv; +// uint64 uniqueFetchMessageRecv; +// uint64 duplicateFetchMessageRecv; +// }; - // struct PeerStats - // { - // NodeID id; - // string versionStr<100>; - // uint64 messagesRead; - // uint64 messagesWritten; - // uint64 bytesRead; - // uint64 bytesWritten; - // uint64 secondsConnected; - // - // uint64 uniqueFloodBytesRecv; - // uint64 duplicateFloodBytesRecv; - // uint64 uniqueFetchBytesRecv; - // uint64 duplicateFetchBytesRecv; - // - // uint64 uniqueFloodMessageRecv; - // uint64 duplicateFloodMessageRecv; - // uint64 uniqueFetchMessageRecv; - // uint64 duplicateFetchMessageRecv; - // }; +// =========================================================================== +public class PeerStats +{ + public NodeID Id { get; set; } + public string VersionStr { get; set; } + public Uint64 MessagesRead { get; set; } + public Uint64 MessagesWritten { get; set; } + public Uint64 BytesRead { get; set; } + public Uint64 BytesWritten { get; set; } + public Uint64 SecondsConnected { get; set; } + public Uint64 UniqueFloodBytesRecv { get; set; } + public Uint64 DuplicateFloodBytesRecv { get; set; } + public Uint64 UniqueFetchBytesRecv { get; set; } + public Uint64 DuplicateFetchBytesRecv { get; set; } + public Uint64 UniqueFloodMessageRecv { get; set; } + public Uint64 DuplicateFloodMessageRecv { get; set; } + public Uint64 UniqueFetchMessageRecv { get; set; } + public Uint64 DuplicateFetchMessageRecv { get; set; } - // =========================================================================== - public class PeerStats + public static void Encode(XdrDataOutputStream stream, PeerStats encodedPeerStats) { - public PeerStats() { } - public NodeID Id { get; set; } - public String VersionStr { get; set; } - public Uint64 MessagesRead { get; set; } - public Uint64 MessagesWritten { get; set; } - public Uint64 BytesRead { get; set; } - public Uint64 BytesWritten { get; set; } - public Uint64 SecondsConnected { get; set; } - public Uint64 UniqueFloodBytesRecv { get; set; } - public Uint64 DuplicateFloodBytesRecv { get; set; } - public Uint64 UniqueFetchBytesRecv { get; set; } - public Uint64 DuplicateFetchBytesRecv { get; set; } - public Uint64 UniqueFloodMessageRecv { get; set; } - public Uint64 DuplicateFloodMessageRecv { get; set; } - public Uint64 UniqueFetchMessageRecv { get; set; } - public Uint64 DuplicateFetchMessageRecv { get; set; } + NodeID.Encode(stream, encodedPeerStats.Id); + stream.WriteString(encodedPeerStats.VersionStr); + Uint64.Encode(stream, encodedPeerStats.MessagesRead); + Uint64.Encode(stream, encodedPeerStats.MessagesWritten); + Uint64.Encode(stream, encodedPeerStats.BytesRead); + Uint64.Encode(stream, encodedPeerStats.BytesWritten); + Uint64.Encode(stream, encodedPeerStats.SecondsConnected); + Uint64.Encode(stream, encodedPeerStats.UniqueFloodBytesRecv); + Uint64.Encode(stream, encodedPeerStats.DuplicateFloodBytesRecv); + Uint64.Encode(stream, encodedPeerStats.UniqueFetchBytesRecv); + Uint64.Encode(stream, encodedPeerStats.DuplicateFetchBytesRecv); + Uint64.Encode(stream, encodedPeerStats.UniqueFloodMessageRecv); + Uint64.Encode(stream, encodedPeerStats.DuplicateFloodMessageRecv); + Uint64.Encode(stream, encodedPeerStats.UniqueFetchMessageRecv); + Uint64.Encode(stream, encodedPeerStats.DuplicateFetchMessageRecv); + } - public static void Encode(XdrDataOutputStream stream, PeerStats encodedPeerStats) - { - NodeID.Encode(stream, encodedPeerStats.Id); - stream.WriteString(encodedPeerStats.VersionStr); - Uint64.Encode(stream, encodedPeerStats.MessagesRead); - Uint64.Encode(stream, encodedPeerStats.MessagesWritten); - Uint64.Encode(stream, encodedPeerStats.BytesRead); - Uint64.Encode(stream, encodedPeerStats.BytesWritten); - Uint64.Encode(stream, encodedPeerStats.SecondsConnected); - Uint64.Encode(stream, encodedPeerStats.UniqueFloodBytesRecv); - Uint64.Encode(stream, encodedPeerStats.DuplicateFloodBytesRecv); - Uint64.Encode(stream, encodedPeerStats.UniqueFetchBytesRecv); - Uint64.Encode(stream, encodedPeerStats.DuplicateFetchBytesRecv); - Uint64.Encode(stream, encodedPeerStats.UniqueFloodMessageRecv); - Uint64.Encode(stream, encodedPeerStats.DuplicateFloodMessageRecv); - Uint64.Encode(stream, encodedPeerStats.UniqueFetchMessageRecv); - Uint64.Encode(stream, encodedPeerStats.DuplicateFetchMessageRecv); - } - public static PeerStats Decode(XdrDataInputStream stream) - { - PeerStats decodedPeerStats = new PeerStats(); - decodedPeerStats.Id = NodeID.Decode(stream); - decodedPeerStats.VersionStr = stream.ReadString(); - decodedPeerStats.MessagesRead = Uint64.Decode(stream); - decodedPeerStats.MessagesWritten = Uint64.Decode(stream); - decodedPeerStats.BytesRead = Uint64.Decode(stream); - decodedPeerStats.BytesWritten = Uint64.Decode(stream); - decodedPeerStats.SecondsConnected = Uint64.Decode(stream); - decodedPeerStats.UniqueFloodBytesRecv = Uint64.Decode(stream); - decodedPeerStats.DuplicateFloodBytesRecv = Uint64.Decode(stream); - decodedPeerStats.UniqueFetchBytesRecv = Uint64.Decode(stream); - decodedPeerStats.DuplicateFetchBytesRecv = Uint64.Decode(stream); - decodedPeerStats.UniqueFloodMessageRecv = Uint64.Decode(stream); - decodedPeerStats.DuplicateFloodMessageRecv = Uint64.Decode(stream); - decodedPeerStats.UniqueFetchMessageRecv = Uint64.Decode(stream); - decodedPeerStats.DuplicateFetchMessageRecv = Uint64.Decode(stream); - return decodedPeerStats; - } + public static PeerStats Decode(XdrDataInputStream stream) + { + var decodedPeerStats = new PeerStats(); + decodedPeerStats.Id = NodeID.Decode(stream); + decodedPeerStats.VersionStr = stream.ReadString(); + decodedPeerStats.MessagesRead = Uint64.Decode(stream); + decodedPeerStats.MessagesWritten = Uint64.Decode(stream); + decodedPeerStats.BytesRead = Uint64.Decode(stream); + decodedPeerStats.BytesWritten = Uint64.Decode(stream); + decodedPeerStats.SecondsConnected = Uint64.Decode(stream); + decodedPeerStats.UniqueFloodBytesRecv = Uint64.Decode(stream); + decodedPeerStats.DuplicateFloodBytesRecv = Uint64.Decode(stream); + decodedPeerStats.UniqueFetchBytesRecv = Uint64.Decode(stream); + decodedPeerStats.DuplicateFetchBytesRecv = Uint64.Decode(stream); + decodedPeerStats.UniqueFloodMessageRecv = Uint64.Decode(stream); + decodedPeerStats.DuplicateFloodMessageRecv = Uint64.Decode(stream); + decodedPeerStats.UniqueFetchMessageRecv = Uint64.Decode(stream); + decodedPeerStats.DuplicateFetchMessageRecv = Uint64.Decode(stream); + return decodedPeerStats; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PersistedSCPState.cs b/stellar-dotnet-sdk-xdr/generated/PersistedSCPState.cs new file mode 100644 index 00000000..0efc4b98 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/PersistedSCPState.cs @@ -0,0 +1,55 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union PersistedSCPState switch (int v) +// { +// case 0: +// PersistedSCPStateV0 v0; +// case 1: +// PersistedSCPStateV1 v1; +// }; + +// =========================================================================== +public class PersistedSCPState +{ + public int Discriminant { get; set; } + + public PersistedSCPStateV0 V0 { get; set; } + public PersistedSCPStateV1 V1 { get; set; } + + public static void Encode(XdrDataOutputStream stream, PersistedSCPState encodedPersistedSCPState) + { + stream.WriteInt(encodedPersistedSCPState.Discriminant); + switch (encodedPersistedSCPState.Discriminant) + { + case 0: + PersistedSCPStateV0.Encode(stream, encodedPersistedSCPState.V0); + break; + case 1: + PersistedSCPStateV1.Encode(stream, encodedPersistedSCPState.V1); + break; + } + } + + public static PersistedSCPState Decode(XdrDataInputStream stream) + { + var decodedPersistedSCPState = new PersistedSCPState(); + var discriminant = stream.ReadInt(); + decodedPersistedSCPState.Discriminant = discriminant; + switch (decodedPersistedSCPState.Discriminant) + { + case 0: + decodedPersistedSCPState.V0 = PersistedSCPStateV0.Decode(stream); + break; + case 1: + decodedPersistedSCPState.V1 = PersistedSCPStateV1.Decode(stream); + break; + } + + return decodedPersistedSCPState; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PersistedSCPStateV0.cs b/stellar-dotnet-sdk-xdr/generated/PersistedSCPStateV0.cs new file mode 100644 index 00000000..50f9031c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/PersistedSCPStateV0.cs @@ -0,0 +1,51 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct PersistedSCPStateV0 +// { +// SCPEnvelope scpEnvelopes<>; +// SCPQuorumSet quorumSets<>; +// StoredTransactionSet txSets<>; +// }; + +// =========================================================================== +public class PersistedSCPStateV0 +{ + public SCPEnvelope[] ScpEnvelopes { get; set; } + public SCPQuorumSet[] QuorumSets { get; set; } + public StoredTransactionSet[] TxSets { get; set; } + + public static void Encode(XdrDataOutputStream stream, PersistedSCPStateV0 encodedPersistedSCPStateV0) + { + var scpEnvelopessize = encodedPersistedSCPStateV0.ScpEnvelopes.Length; + stream.WriteInt(scpEnvelopessize); + for (var i = 0; i < scpEnvelopessize; i++) + SCPEnvelope.Encode(stream, encodedPersistedSCPStateV0.ScpEnvelopes[i]); + var quorumSetssize = encodedPersistedSCPStateV0.QuorumSets.Length; + stream.WriteInt(quorumSetssize); + for (var i = 0; i < quorumSetssize; i++) SCPQuorumSet.Encode(stream, encodedPersistedSCPStateV0.QuorumSets[i]); + var txSetssize = encodedPersistedSCPStateV0.TxSets.Length; + stream.WriteInt(txSetssize); + for (var i = 0; i < txSetssize; i++) StoredTransactionSet.Encode(stream, encodedPersistedSCPStateV0.TxSets[i]); + } + + public static PersistedSCPStateV0 Decode(XdrDataInputStream stream) + { + var decodedPersistedSCPStateV0 = new PersistedSCPStateV0(); + var scpEnvelopessize = stream.ReadInt(); + decodedPersistedSCPStateV0.ScpEnvelopes = new SCPEnvelope[scpEnvelopessize]; + for (var i = 0; i < scpEnvelopessize; i++) + decodedPersistedSCPStateV0.ScpEnvelopes[i] = SCPEnvelope.Decode(stream); + var quorumSetssize = stream.ReadInt(); + decodedPersistedSCPStateV0.QuorumSets = new SCPQuorumSet[quorumSetssize]; + for (var i = 0; i < quorumSetssize; i++) decodedPersistedSCPStateV0.QuorumSets[i] = SCPQuorumSet.Decode(stream); + var txSetssize = stream.ReadInt(); + decodedPersistedSCPStateV0.TxSets = new StoredTransactionSet[txSetssize]; + for (var i = 0; i < txSetssize; i++) decodedPersistedSCPStateV0.TxSets[i] = StoredTransactionSet.Decode(stream); + return decodedPersistedSCPStateV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PersistedSCPStateV1.cs b/stellar-dotnet-sdk-xdr/generated/PersistedSCPStateV1.cs new file mode 100644 index 00000000..c877f8ea --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/PersistedSCPStateV1.cs @@ -0,0 +1,44 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct PersistedSCPStateV1 +// { +// // Tx sets are saved separately +// SCPEnvelope scpEnvelopes<>; +// SCPQuorumSet quorumSets<>; +// }; + +// =========================================================================== +public class PersistedSCPStateV1 +{ + public SCPEnvelope[] ScpEnvelopes { get; set; } + public SCPQuorumSet[] QuorumSets { get; set; } + + public static void Encode(XdrDataOutputStream stream, PersistedSCPStateV1 encodedPersistedSCPStateV1) + { + var scpEnvelopessize = encodedPersistedSCPStateV1.ScpEnvelopes.Length; + stream.WriteInt(scpEnvelopessize); + for (var i = 0; i < scpEnvelopessize; i++) + SCPEnvelope.Encode(stream, encodedPersistedSCPStateV1.ScpEnvelopes[i]); + var quorumSetssize = encodedPersistedSCPStateV1.QuorumSets.Length; + stream.WriteInt(quorumSetssize); + for (var i = 0; i < quorumSetssize; i++) SCPQuorumSet.Encode(stream, encodedPersistedSCPStateV1.QuorumSets[i]); + } + + public static PersistedSCPStateV1 Decode(XdrDataInputStream stream) + { + var decodedPersistedSCPStateV1 = new PersistedSCPStateV1(); + var scpEnvelopessize = stream.ReadInt(); + decodedPersistedSCPStateV1.ScpEnvelopes = new SCPEnvelope[scpEnvelopessize]; + for (var i = 0; i < scpEnvelopessize; i++) + decodedPersistedSCPStateV1.ScpEnvelopes[i] = SCPEnvelope.Decode(stream); + var quorumSetssize = stream.ReadInt(); + decodedPersistedSCPStateV1.QuorumSets = new SCPQuorumSet[quorumSetssize]; + for (var i = 0; i < quorumSetssize; i++) decodedPersistedSCPStateV1.QuorumSets[i] = SCPQuorumSet.Decode(stream); + return decodedPersistedSCPStateV1; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PoolID.cs b/stellar-dotnet-sdk-xdr/generated/PoolID.cs index 0bd11317..146bfe2c 100644 --- a/stellar-dotnet-sdk-xdr/generated/PoolID.cs +++ b/stellar-dotnet-sdk-xdr/generated/PoolID.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef Hash PoolID; + +// =========================================================================== +public class PoolID { + public PoolID() + { + } - // === xdr source ============================================================ + public PoolID(Hash value) + { + InnerValue = value; + } + + public Hash InnerValue { get; set; } = default; - // typedef Hash PoolID; + public static void Encode(XdrDataOutputStream stream, PoolID encodedPoolID) + { + Hash.Encode(stream, encodedPoolID.InnerValue); + } - // =========================================================================== - public class PoolID + public static PoolID Decode(XdrDataInputStream stream) { - public Hash InnerValue { get; set; } = default(Hash); - - public PoolID() { } - - public PoolID(Hash value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, PoolID encodedPoolID) - { - Hash.Encode(stream, encodedPoolID.InnerValue); - } - public static PoolID Decode(XdrDataInputStream stream) - { - PoolID decodedPoolID = new PoolID(); - decodedPoolID.InnerValue = Hash.Decode(stream); - return decodedPoolID; - } + var decodedPoolID = new PoolID(); + decodedPoolID.InnerValue = Hash.Decode(stream); + return decodedPoolID; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PreconditionType.cs b/stellar-dotnet-sdk-xdr/generated/PreconditionType.cs index 00ddc72c..5f7fc5f1 100644 --- a/stellar-dotnet-sdk-xdr/generated/PreconditionType.cs +++ b/stellar-dotnet-sdk-xdr/generated/PreconditionType.cs @@ -1,54 +1,54 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum PreconditionType - // { - // PRECOND_NONE = 0, - // PRECOND_TIME = 1, - // PRECOND_V2 = 2 - // }; +// enum PreconditionType +// { +// PRECOND_NONE = 0, +// PRECOND_TIME = 1, +// PRECOND_V2 = 2 +// }; - // =========================================================================== - public class PreconditionType +// =========================================================================== +public class PreconditionType +{ + public enum PreconditionTypeEnum { - public enum PreconditionTypeEnum - { - PRECOND_NONE = 0, - PRECOND_TIME = 1, - PRECOND_V2 = 2, - } - public PreconditionTypeEnum InnerValue { get; set; } = default(PreconditionTypeEnum); + PRECOND_NONE = 0, + PRECOND_TIME = 1, + PRECOND_V2 = 2 + } - public static PreconditionType Create(PreconditionTypeEnum v) - { - return new PreconditionType - { - InnerValue = v - }; - } + public PreconditionTypeEnum InnerValue { get; set; } = default; - public static PreconditionType Decode(XdrDataInputStream stream) + public static PreconditionType Create(PreconditionTypeEnum v) + { + return new PreconditionType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(PreconditionTypeEnum.PRECOND_NONE); - case 1: return Create(PreconditionTypeEnum.PRECOND_TIME); - case 2: return Create(PreconditionTypeEnum.PRECOND_V2); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, PreconditionType value) + public static PreconditionType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(PreconditionTypeEnum.PRECOND_NONE); + case 1: return Create(PreconditionTypeEnum.PRECOND_TIME); + case 2: return Create(PreconditionTypeEnum.PRECOND_V2); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, PreconditionType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Preconditions.cs b/stellar-dotnet-sdk-xdr/generated/Preconditions.cs index 7c5693b0..596573bf 100644 --- a/stellar-dotnet-sdk-xdr/generated/Preconditions.cs +++ b/stellar-dotnet-sdk-xdr/generated/Preconditions.cs @@ -1,63 +1,61 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union Preconditions switch (PreconditionType type) - // { - // case PRECOND_NONE: - // void; - // case PRECOND_TIME: - // TimeBounds timeBounds; - // case PRECOND_V2: - // PreconditionsV2 v2; - // }; +// union Preconditions switch (PreconditionType type) +// { +// case PRECOND_NONE: +// void; +// case PRECOND_TIME: +// TimeBounds timeBounds; +// case PRECOND_V2: +// PreconditionsV2 v2; +// }; - // =========================================================================== - public class Preconditions - { - public Preconditions() { } +// =========================================================================== +public class Preconditions +{ + public PreconditionType Discriminant { get; set; } = new(); - public PreconditionType Discriminant { get; set; } = new PreconditionType(); + public TimeBounds TimeBounds { get; set; } + public PreconditionsV2 V2 { get; set; } - public TimeBounds TimeBounds { get; set; } - public PreconditionsV2 V2 { get; set; } - public static void Encode(XdrDataOutputStream stream, Preconditions encodedPreconditions) + public static void Encode(XdrDataOutputStream stream, Preconditions encodedPreconditions) + { + stream.WriteInt((int)encodedPreconditions.Discriminant.InnerValue); + switch (encodedPreconditions.Discriminant.InnerValue) { - stream.WriteInt((int)encodedPreconditions.Discriminant.InnerValue); - switch (encodedPreconditions.Discriminant.InnerValue) - { - case PreconditionType.PreconditionTypeEnum.PRECOND_NONE: - break; - case PreconditionType.PreconditionTypeEnum.PRECOND_TIME: - TimeBounds.Encode(stream, encodedPreconditions.TimeBounds); - break; - case PreconditionType.PreconditionTypeEnum.PRECOND_V2: - PreconditionsV2.Encode(stream, encodedPreconditions.V2); - break; - } + case PreconditionType.PreconditionTypeEnum.PRECOND_NONE: + break; + case PreconditionType.PreconditionTypeEnum.PRECOND_TIME: + TimeBounds.Encode(stream, encodedPreconditions.TimeBounds); + break; + case PreconditionType.PreconditionTypeEnum.PRECOND_V2: + PreconditionsV2.Encode(stream, encodedPreconditions.V2); + break; } - public static Preconditions Decode(XdrDataInputStream stream) + } + + public static Preconditions Decode(XdrDataInputStream stream) + { + var decodedPreconditions = new Preconditions(); + var discriminant = PreconditionType.Decode(stream); + decodedPreconditions.Discriminant = discriminant; + switch (decodedPreconditions.Discriminant.InnerValue) { - Preconditions decodedPreconditions = new Preconditions(); - PreconditionType discriminant = PreconditionType.Decode(stream); - decodedPreconditions.Discriminant = discriminant; - switch (decodedPreconditions.Discriminant.InnerValue) - { - case PreconditionType.PreconditionTypeEnum.PRECOND_NONE: - break; - case PreconditionType.PreconditionTypeEnum.PRECOND_TIME: - decodedPreconditions.TimeBounds = TimeBounds.Decode(stream); - break; - case PreconditionType.PreconditionTypeEnum.PRECOND_V2: - decodedPreconditions.V2 = PreconditionsV2.Decode(stream); - break; - } - return decodedPreconditions; + case PreconditionType.PreconditionTypeEnum.PRECOND_NONE: + break; + case PreconditionType.PreconditionTypeEnum.PRECOND_TIME: + decodedPreconditions.TimeBounds = TimeBounds.Decode(stream); + break; + case PreconditionType.PreconditionTypeEnum.PRECOND_V2: + decodedPreconditions.V2 = PreconditionsV2.Decode(stream); + break; } + + return decodedPreconditions; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PreconditionsV2.cs b/stellar-dotnet-sdk-xdr/generated/PreconditionsV2.cs index 67e7d86d..b81d9108 100644 --- a/stellar-dotnet-sdk-xdr/generated/PreconditionsV2.cs +++ b/stellar-dotnet-sdk-xdr/generated/PreconditionsV2.cs @@ -1,121 +1,106 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// 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. +// // Note that after execution the account's sequence number +// // 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 +// // operations. +// SignerKey extraSigners<2>; +// }; - // 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. - // // Note that after execution the account's sequence number - // // 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 - // // operations. - // SignerKey extraSigners<2>; - // }; +// =========================================================================== +public class PreconditionsV2 +{ + public TimeBounds TimeBounds { get; set; } + public LedgerBounds LedgerBounds { get; set; } + public SequenceNumber MinSeqNum { get; set; } + public Duration MinSeqAge { get; set; } + public Uint32 MinSeqLedgerGap { get; set; } + public SignerKey[] ExtraSigners { get; set; } - // =========================================================================== - public class PreconditionsV2 + public static void Encode(XdrDataOutputStream stream, PreconditionsV2 encodedPreconditionsV2) { - public PreconditionsV2() { } - public TimeBounds TimeBounds { get; set; } - public LedgerBounds LedgerBounds { get; set; } - public SequenceNumber MinSeqNum { get; set; } - public Duration MinSeqAge { get; set; } - public Uint32 MinSeqLedgerGap { get; set; } - public SignerKey[] ExtraSigners { get; set; } + if (encodedPreconditionsV2.TimeBounds != null) + { + stream.WriteInt(1); + TimeBounds.Encode(stream, encodedPreconditionsV2.TimeBounds); + } + else + { + stream.WriteInt(0); + } + + if (encodedPreconditionsV2.LedgerBounds != null) + { + stream.WriteInt(1); + LedgerBounds.Encode(stream, encodedPreconditionsV2.LedgerBounds); + } + else + { + stream.WriteInt(0); + } - public static void Encode(XdrDataOutputStream stream, PreconditionsV2 encodedPreconditionsV2) + if (encodedPreconditionsV2.MinSeqNum != null) { - if (encodedPreconditionsV2.TimeBounds != null) - { - stream.WriteInt(1); - TimeBounds.Encode(stream, encodedPreconditionsV2.TimeBounds); - } - else - { - stream.WriteInt(0); - } - if (encodedPreconditionsV2.LedgerBounds != null) - { - stream.WriteInt(1); - LedgerBounds.Encode(stream, encodedPreconditionsV2.LedgerBounds); - } - else - { - stream.WriteInt(0); - } - if (encodedPreconditionsV2.MinSeqNum != null) - { - stream.WriteInt(1); - SequenceNumber.Encode(stream, encodedPreconditionsV2.MinSeqNum); - } - else - { - stream.WriteInt(0); - } - Duration.Encode(stream, encodedPreconditionsV2.MinSeqAge); - Uint32.Encode(stream, encodedPreconditionsV2.MinSeqLedgerGap); - int extraSignerssize = encodedPreconditionsV2.ExtraSigners.Length; - stream.WriteInt(extraSignerssize); - for (int i = 0; i < extraSignerssize; i++) - { - SignerKey.Encode(stream, encodedPreconditionsV2.ExtraSigners[i]); - } + stream.WriteInt(1); + SequenceNumber.Encode(stream, encodedPreconditionsV2.MinSeqNum); } - public static PreconditionsV2 Decode(XdrDataInputStream stream) + else { - PreconditionsV2 decodedPreconditionsV2 = new PreconditionsV2(); - int TimeBoundsPresent = stream.ReadInt(); - if (TimeBoundsPresent != 0) - { - decodedPreconditionsV2.TimeBounds = TimeBounds.Decode(stream); - } - int LedgerBoundsPresent = stream.ReadInt(); - if (LedgerBoundsPresent != 0) - { - decodedPreconditionsV2.LedgerBounds = LedgerBounds.Decode(stream); - } - int MinSeqNumPresent = stream.ReadInt(); - if (MinSeqNumPresent != 0) - { - decodedPreconditionsV2.MinSeqNum = SequenceNumber.Decode(stream); - } - decodedPreconditionsV2.MinSeqAge = Duration.Decode(stream); - decodedPreconditionsV2.MinSeqLedgerGap = Uint32.Decode(stream); - int extraSignerssize = stream.ReadInt(); - decodedPreconditionsV2.ExtraSigners = new SignerKey[extraSignerssize]; - for (int i = 0; i < extraSignerssize; i++) - { - decodedPreconditionsV2.ExtraSigners[i] = SignerKey.Decode(stream); - } - return decodedPreconditionsV2; + stream.WriteInt(0); } + + Duration.Encode(stream, encodedPreconditionsV2.MinSeqAge); + Uint32.Encode(stream, encodedPreconditionsV2.MinSeqLedgerGap); + var extraSignerssize = encodedPreconditionsV2.ExtraSigners.Length; + stream.WriteInt(extraSignerssize); + for (var i = 0; i < extraSignerssize; i++) SignerKey.Encode(stream, encodedPreconditionsV2.ExtraSigners[i]); + } + + public static PreconditionsV2 Decode(XdrDataInputStream stream) + { + var decodedPreconditionsV2 = new PreconditionsV2(); + var TimeBoundsPresent = stream.ReadInt(); + if (TimeBoundsPresent != 0) decodedPreconditionsV2.TimeBounds = TimeBounds.Decode(stream); + var LedgerBoundsPresent = stream.ReadInt(); + if (LedgerBoundsPresent != 0) decodedPreconditionsV2.LedgerBounds = LedgerBounds.Decode(stream); + var MinSeqNumPresent = stream.ReadInt(); + if (MinSeqNumPresent != 0) decodedPreconditionsV2.MinSeqNum = SequenceNumber.Decode(stream); + decodedPreconditionsV2.MinSeqAge = Duration.Decode(stream); + decodedPreconditionsV2.MinSeqLedgerGap = Uint32.Decode(stream); + var extraSignerssize = stream.ReadInt(); + decodedPreconditionsV2.ExtraSigners = new SignerKey[extraSignerssize]; + for (var i = 0; i < extraSignerssize; i++) decodedPreconditionsV2.ExtraSigners[i] = SignerKey.Decode(stream); + return decodedPreconditionsV2; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Price.cs b/stellar-dotnet-sdk-xdr/generated/Price.cs index 58aaaaf8..d13a5dc0 100644 --- a/stellar-dotnet-sdk-xdr/generated/Price.cs +++ b/stellar-dotnet-sdk-xdr/generated/Price.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct Price +// { +// int32 n; // numerator +// int32 d; // denominator +// }; - // struct Price - // { - // int32 n; // numerator - // int32 d; // denominator - // }; +// =========================================================================== +public class Price +{ + public Int32 N { get; set; } + public Int32 D { get; set; } - // =========================================================================== - public class Price + public static void Encode(XdrDataOutputStream stream, Price encodedPrice) { - public Price() { } - public Int32 N { get; set; } - public Int32 D { get; set; } + Int32.Encode(stream, encodedPrice.N); + Int32.Encode(stream, encodedPrice.D); + } - public static void Encode(XdrDataOutputStream stream, Price encodedPrice) - { - Int32.Encode(stream, encodedPrice.N); - Int32.Encode(stream, encodedPrice.D); - } - public static Price Decode(XdrDataInputStream stream) - { - Price decodedPrice = new Price(); - decodedPrice.N = Int32.Decode(stream); - decodedPrice.D = Int32.Decode(stream); - return decodedPrice; - } + public static Price Decode(XdrDataInputStream stream) + { + var decodedPrice = new Price(); + decodedPrice.N = Int32.Decode(stream); + decodedPrice.D = Int32.Decode(stream); + return decodedPrice; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PublicKey.cs b/stellar-dotnet-sdk-xdr/generated/PublicKey.cs index d4062582..fa6cc2a6 100644 --- a/stellar-dotnet-sdk-xdr/generated/PublicKey.cs +++ b/stellar-dotnet-sdk-xdr/generated/PublicKey.cs @@ -1,48 +1,46 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union PublicKey switch (PublicKeyType type) - // { - // case PUBLIC_KEY_TYPE_ED25519: - // uint256 ed25519; - // }; +// union PublicKey switch (PublicKeyType type) +// { +// case PUBLIC_KEY_TYPE_ED25519: +// uint256 ed25519; +// }; - // =========================================================================== - public class PublicKey - { - public PublicKey() { } +// =========================================================================== +public class PublicKey +{ + public PublicKeyType Discriminant { get; set; } = new(); - public PublicKeyType Discriminant { get; set; } = new PublicKeyType(); + public Uint256 Ed25519 { get; set; } - public Uint256 Ed25519 { get; set; } - public static void Encode(XdrDataOutputStream stream, PublicKey encodedPublicKey) + public static void Encode(XdrDataOutputStream stream, PublicKey encodedPublicKey) + { + stream.WriteInt((int)encodedPublicKey.Discriminant.InnerValue); + switch (encodedPublicKey.Discriminant.InnerValue) { - stream.WriteInt((int)encodedPublicKey.Discriminant.InnerValue); - switch (encodedPublicKey.Discriminant.InnerValue) - { - case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519: - Uint256.Encode(stream, encodedPublicKey.Ed25519); - break; - } + case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519: + Uint256.Encode(stream, encodedPublicKey.Ed25519); + break; } - public static PublicKey Decode(XdrDataInputStream stream) + } + + public static PublicKey Decode(XdrDataInputStream stream) + { + var decodedPublicKey = new PublicKey(); + var discriminant = PublicKeyType.Decode(stream); + decodedPublicKey.Discriminant = discriminant; + switch (decodedPublicKey.Discriminant.InnerValue) { - PublicKey decodedPublicKey = new PublicKey(); - PublicKeyType discriminant = PublicKeyType.Decode(stream); - decodedPublicKey.Discriminant = discriminant; - switch (decodedPublicKey.Discriminant.InnerValue) - { - case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519: - decodedPublicKey.Ed25519 = Uint256.Decode(stream); - break; - } - return decodedPublicKey; + case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519: + decodedPublicKey.Ed25519 = Uint256.Decode(stream); + break; } + + return decodedPublicKey; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/PublicKeyType.cs b/stellar-dotnet-sdk-xdr/generated/PublicKeyType.cs index d93a8e5b..a3f3202a 100644 --- a/stellar-dotnet-sdk-xdr/generated/PublicKeyType.cs +++ b/stellar-dotnet-sdk-xdr/generated/PublicKeyType.cs @@ -1,48 +1,48 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum PublicKeyType - // { - // PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519 - // }; +// enum PublicKeyType +// { +// PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519 +// }; - // =========================================================================== - public class PublicKeyType +// =========================================================================== +public class PublicKeyType +{ + public enum PublicKeyTypeEnum { - public enum PublicKeyTypeEnum - { - PUBLIC_KEY_TYPE_ED25519 = 0, - } - public PublicKeyTypeEnum InnerValue { get; set; } = default(PublicKeyTypeEnum); + PUBLIC_KEY_TYPE_ED25519 = 0 + } - public static PublicKeyType Create(PublicKeyTypeEnum v) - { - return new PublicKeyType - { - InnerValue = v - }; - } + public PublicKeyTypeEnum InnerValue { get; set; } = default; - public static PublicKeyType Decode(XdrDataInputStream stream) + public static PublicKeyType Create(PublicKeyTypeEnum v) + { + return new PublicKeyType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, PublicKeyType value) + public static PublicKeyType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, PublicKeyType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/RestoreFootprintOp.cs b/stellar-dotnet-sdk-xdr/generated/RestoreFootprintOp.cs new file mode 100644 index 00000000..dbd25bae --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/RestoreFootprintOp.cs @@ -0,0 +1,29 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct RestoreFootprintOp +// { +// ExtensionPoint ext; +// }; + +// =========================================================================== +public class RestoreFootprintOp +{ + public ExtensionPoint Ext { get; set; } + + public static void Encode(XdrDataOutputStream stream, RestoreFootprintOp encodedRestoreFootprintOp) + { + ExtensionPoint.Encode(stream, encodedRestoreFootprintOp.Ext); + } + + public static RestoreFootprintOp Decode(XdrDataInputStream stream) + { + var decodedRestoreFootprintOp = new RestoreFootprintOp(); + decodedRestoreFootprintOp.Ext = ExtensionPoint.Decode(stream); + return decodedRestoreFootprintOp; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/RestoreFootprintResult.cs b/stellar-dotnet-sdk-xdr/generated/RestoreFootprintResult.cs new file mode 100644 index 00000000..10339337 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/RestoreFootprintResult.cs @@ -0,0 +1,56 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union RestoreFootprintResult switch (RestoreFootprintResultCode code) +// { +// case RESTORE_FOOTPRINT_SUCCESS: +// void; +// case RESTORE_FOOTPRINT_MALFORMED: +// case RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED: +// case RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE: +// void; +// }; + +// =========================================================================== +public class RestoreFootprintResult +{ + public RestoreFootprintResultCode Discriminant { get; set; } = new(); + + public static void Encode(XdrDataOutputStream stream, RestoreFootprintResult encodedRestoreFootprintResult) + { + stream.WriteInt((int)encodedRestoreFootprintResult.Discriminant.InnerValue); + switch (encodedRestoreFootprintResult.Discriminant.InnerValue) + { + case RestoreFootprintResultCode.RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_SUCCESS: + break; + case RestoreFootprintResultCode.RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_MALFORMED: + case RestoreFootprintResultCode.RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED: + case RestoreFootprintResultCode.RestoreFootprintResultCodeEnum + .RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE: + break; + } + } + + public static RestoreFootprintResult Decode(XdrDataInputStream stream) + { + var decodedRestoreFootprintResult = new RestoreFootprintResult(); + var discriminant = RestoreFootprintResultCode.Decode(stream); + decodedRestoreFootprintResult.Discriminant = discriminant; + switch (decodedRestoreFootprintResult.Discriminant.InnerValue) + { + case RestoreFootprintResultCode.RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_SUCCESS: + break; + case RestoreFootprintResultCode.RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_MALFORMED: + case RestoreFootprintResultCode.RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED: + case RestoreFootprintResultCode.RestoreFootprintResultCodeEnum + .RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE: + break; + } + + return decodedRestoreFootprintResult; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/RestoreFootprintResultCode.cs b/stellar-dotnet-sdk-xdr/generated/RestoreFootprintResultCode.cs new file mode 100644 index 00000000..9e3a1741 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/RestoreFootprintResultCode.cs @@ -0,0 +1,60 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum RestoreFootprintResultCode +// { +// // 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, +// RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3 +// }; + +// =========================================================================== +public class RestoreFootprintResultCode +{ + public enum RestoreFootprintResultCodeEnum + { + RESTORE_FOOTPRINT_SUCCESS = 0, + RESTORE_FOOTPRINT_MALFORMED = -1, + RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2, + RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3 + } + + public RestoreFootprintResultCodeEnum InnerValue { get; set; } = default; + + public static RestoreFootprintResultCode Create(RestoreFootprintResultCodeEnum v) + { + return new RestoreFootprintResultCode + { + InnerValue = v + }; + } + + public static RestoreFootprintResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_SUCCESS); + case -1: return Create(RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_MALFORMED); + case -2: return Create(RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED); + case -3: return Create(RestoreFootprintResultCodeEnum.RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, RestoreFootprintResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipOp.cs b/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipOp.cs index 0b0d5c43..e34dca8d 100644 --- a/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipOp.cs @@ -1,82 +1,80 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union RevokeSponsorshipOp switch (RevokeSponsorshipType type) - // { - // case REVOKE_SPONSORSHIP_LEDGER_ENTRY: - // LedgerKey ledgerKey; - // case REVOKE_SPONSORSHIP_SIGNER: - // struct - // { - // AccountID accountID; - // SignerKey signerKey; - // } signer; - // }; +// union RevokeSponsorshipOp switch (RevokeSponsorshipType type) +// { +// case REVOKE_SPONSORSHIP_LEDGER_ENTRY: +// LedgerKey ledgerKey; +// case REVOKE_SPONSORSHIP_SIGNER: +// struct +// { +// AccountID accountID; +// SignerKey signerKey; +// } signer; +// }; - // =========================================================================== - public class RevokeSponsorshipOp - { - public RevokeSponsorshipOp() { } +// =========================================================================== +public class RevokeSponsorshipOp +{ + public RevokeSponsorshipType Discriminant { get; set; } = new(); - public RevokeSponsorshipType Discriminant { get; set; } = new RevokeSponsorshipType(); + public LedgerKey LedgerKey { get; set; } + public RevokeSponsorshipOpSigner Signer { get; set; } - public LedgerKey LedgerKey { get; set; } - public RevokeSponsorshipOpSigner Signer { get; set; } - public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipOp encodedRevokeSponsorshipOp) + public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipOp encodedRevokeSponsorshipOp) + { + stream.WriteInt((int)encodedRevokeSponsorshipOp.Discriminant.InnerValue); + switch (encodedRevokeSponsorshipOp.Discriminant.InnerValue) { - stream.WriteInt((int)encodedRevokeSponsorshipOp.Discriminant.InnerValue); - switch (encodedRevokeSponsorshipOp.Discriminant.InnerValue) - { - case RevokeSponsorshipType.RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_LEDGER_ENTRY: - LedgerKey.Encode(stream, encodedRevokeSponsorshipOp.LedgerKey); - break; - case RevokeSponsorshipType.RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_SIGNER: - RevokeSponsorshipOpSigner.Encode(stream, encodedRevokeSponsorshipOp.Signer); - break; - } + case RevokeSponsorshipType.RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_LEDGER_ENTRY: + LedgerKey.Encode(stream, encodedRevokeSponsorshipOp.LedgerKey); + break; + case RevokeSponsorshipType.RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_SIGNER: + RevokeSponsorshipOpSigner.Encode(stream, encodedRevokeSponsorshipOp.Signer); + break; } - public static RevokeSponsorshipOp Decode(XdrDataInputStream stream) + } + + public static RevokeSponsorshipOp Decode(XdrDataInputStream stream) + { + var decodedRevokeSponsorshipOp = new RevokeSponsorshipOp(); + var discriminant = RevokeSponsorshipType.Decode(stream); + decodedRevokeSponsorshipOp.Discriminant = discriminant; + switch (decodedRevokeSponsorshipOp.Discriminant.InnerValue) { - RevokeSponsorshipOp decodedRevokeSponsorshipOp = new RevokeSponsorshipOp(); - RevokeSponsorshipType discriminant = RevokeSponsorshipType.Decode(stream); - decodedRevokeSponsorshipOp.Discriminant = discriminant; - switch (decodedRevokeSponsorshipOp.Discriminant.InnerValue) - { - case RevokeSponsorshipType.RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_LEDGER_ENTRY: - decodedRevokeSponsorshipOp.LedgerKey = LedgerKey.Decode(stream); - break; - case RevokeSponsorshipType.RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_SIGNER: - decodedRevokeSponsorshipOp.Signer = RevokeSponsorshipOpSigner.Decode(stream); - break; - } - return decodedRevokeSponsorshipOp; + case RevokeSponsorshipType.RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_LEDGER_ENTRY: + decodedRevokeSponsorshipOp.LedgerKey = LedgerKey.Decode(stream); + break; + case RevokeSponsorshipType.RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_SIGNER: + decodedRevokeSponsorshipOp.Signer = RevokeSponsorshipOpSigner.Decode(stream); + break; } - public class RevokeSponsorshipOpSigner - { - public RevokeSponsorshipOpSigner() { } - public AccountID AccountID { get; set; } - public SignerKey SignerKey { get; set; } + return decodedRevokeSponsorshipOp; + } - public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipOpSigner encodedRevokeSponsorshipOpSigner) - { - AccountID.Encode(stream, encodedRevokeSponsorshipOpSigner.AccountID); - SignerKey.Encode(stream, encodedRevokeSponsorshipOpSigner.SignerKey); - } - public static RevokeSponsorshipOpSigner Decode(XdrDataInputStream stream) - { - RevokeSponsorshipOpSigner decodedRevokeSponsorshipOpSigner = new RevokeSponsorshipOpSigner(); - decodedRevokeSponsorshipOpSigner.AccountID = AccountID.Decode(stream); - decodedRevokeSponsorshipOpSigner.SignerKey = SignerKey.Decode(stream); - return decodedRevokeSponsorshipOpSigner; - } + public class RevokeSponsorshipOpSigner + { + public AccountID AccountID { get; set; } + public SignerKey SignerKey { get; set; } + public static void Encode(XdrDataOutputStream stream, + RevokeSponsorshipOpSigner encodedRevokeSponsorshipOpSigner) + { + AccountID.Encode(stream, encodedRevokeSponsorshipOpSigner.AccountID); + SignerKey.Encode(stream, encodedRevokeSponsorshipOpSigner.SignerKey); + } + + public static RevokeSponsorshipOpSigner Decode(XdrDataInputStream stream) + { + var decodedRevokeSponsorshipOpSigner = new RevokeSponsorshipOpSigner(); + decodedRevokeSponsorshipOpSigner.AccountID = AccountID.Decode(stream); + decodedRevokeSponsorshipOpSigner.SignerKey = SignerKey.Decode(stream); + return decodedRevokeSponsorshipOpSigner; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipResult.cs b/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipResult.cs index 4babdfc6..71bb0860 100644 --- a/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipResult.cs @@ -1,51 +1,60 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union RevokeSponsorshipResult switch (RevokeSponsorshipResultCode code) - // { - // case REVOKE_SPONSORSHIP_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class RevokeSponsorshipResult - { - public RevokeSponsorshipResult() { } +// union RevokeSponsorshipResult switch (RevokeSponsorshipResultCode code) +// { +// case REVOKE_SPONSORSHIP_SUCCESS: +// void; +// case REVOKE_SPONSORSHIP_DOES_NOT_EXIST: +// case REVOKE_SPONSORSHIP_NOT_SPONSOR: +// case REVOKE_SPONSORSHIP_LOW_RESERVE: +// case REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE: +// case REVOKE_SPONSORSHIP_MALFORMED: +// void; +// }; - public RevokeSponsorshipResultCode Discriminant { get; set; } = new RevokeSponsorshipResultCode(); +// =========================================================================== +public class RevokeSponsorshipResult +{ + public RevokeSponsorshipResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipResult encodedRevokeSponsorshipResult) + public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipResult encodedRevokeSponsorshipResult) + { + stream.WriteInt((int)encodedRevokeSponsorshipResult.Discriminant.InnerValue); + switch (encodedRevokeSponsorshipResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedRevokeSponsorshipResult.Discriminant.InnerValue); - switch (encodedRevokeSponsorshipResult.Discriminant.InnerValue) - { - case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_SUCCESS: - break; - default: - break; - } + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_SUCCESS: + break; + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_DOES_NOT_EXIST: + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_NOT_SPONSOR: + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_LOW_RESERVE: + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE: + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_MALFORMED: + break; } - public static RevokeSponsorshipResult Decode(XdrDataInputStream stream) + } + + public static RevokeSponsorshipResult Decode(XdrDataInputStream stream) + { + var decodedRevokeSponsorshipResult = new RevokeSponsorshipResult(); + var discriminant = RevokeSponsorshipResultCode.Decode(stream); + decodedRevokeSponsorshipResult.Discriminant = discriminant; + switch (decodedRevokeSponsorshipResult.Discriminant.InnerValue) { - RevokeSponsorshipResult decodedRevokeSponsorshipResult = new RevokeSponsorshipResult(); - RevokeSponsorshipResultCode discriminant = RevokeSponsorshipResultCode.Decode(stream); - decodedRevokeSponsorshipResult.Discriminant = discriminant; - switch (decodedRevokeSponsorshipResult.Discriminant.InnerValue) - { - case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_SUCCESS: - break; - default: - break; - } - return decodedRevokeSponsorshipResult; + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_SUCCESS: + break; + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_DOES_NOT_EXIST: + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_NOT_SPONSOR: + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_LOW_RESERVE: + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE: + case RevokeSponsorshipResultCode.RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_MALFORMED: + break; } + + return decodedRevokeSponsorshipResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipResultCode.cs b/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipResultCode.cs index e73d6c85..476b5f2e 100644 --- a/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipResultCode.cs @@ -1,66 +1,66 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum RevokeSponsorshipResultCode - // { - // // 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, - // REVOKE_SPONSORSHIP_LOW_RESERVE = -3, - // REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE = -4, - // REVOKE_SPONSORSHIP_MALFORMED = -5 - // }; +// enum RevokeSponsorshipResultCode +// { +// // 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, +// REVOKE_SPONSORSHIP_LOW_RESERVE = -3, +// REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE = -4, +// REVOKE_SPONSORSHIP_MALFORMED = -5 +// }; - // =========================================================================== - public class RevokeSponsorshipResultCode +// =========================================================================== +public class RevokeSponsorshipResultCode +{ + public enum RevokeSponsorshipResultCodeEnum { - public enum RevokeSponsorshipResultCodeEnum - { - REVOKE_SPONSORSHIP_SUCCESS = 0, - REVOKE_SPONSORSHIP_DOES_NOT_EXIST = -1, - REVOKE_SPONSORSHIP_NOT_SPONSOR = -2, - REVOKE_SPONSORSHIP_LOW_RESERVE = -3, - REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE = -4, - REVOKE_SPONSORSHIP_MALFORMED = -5, - } - public RevokeSponsorshipResultCodeEnum InnerValue { get; set; } = default(RevokeSponsorshipResultCodeEnum); + REVOKE_SPONSORSHIP_SUCCESS = 0, + REVOKE_SPONSORSHIP_DOES_NOT_EXIST = -1, + REVOKE_SPONSORSHIP_NOT_SPONSOR = -2, + REVOKE_SPONSORSHIP_LOW_RESERVE = -3, + REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE = -4, + REVOKE_SPONSORSHIP_MALFORMED = -5 + } - public static RevokeSponsorshipResultCode Create(RevokeSponsorshipResultCodeEnum v) - { - return new RevokeSponsorshipResultCode - { - InnerValue = v - }; - } + public RevokeSponsorshipResultCodeEnum InnerValue { get; set; } = default; - public static RevokeSponsorshipResultCode Decode(XdrDataInputStream stream) + public static RevokeSponsorshipResultCode Create(RevokeSponsorshipResultCodeEnum v) + { + return new RevokeSponsorshipResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_SUCCESS); - case -1: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_DOES_NOT_EXIST); - case -2: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_NOT_SPONSOR); - case -3: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_LOW_RESERVE); - case -4: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE); - case -5: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_MALFORMED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipResultCode value) + public static RevokeSponsorshipResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_SUCCESS); + case -1: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_DOES_NOT_EXIST); + case -2: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_NOT_SPONSOR); + case -3: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_LOW_RESERVE); + case -4: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE); + case -5: return Create(RevokeSponsorshipResultCodeEnum.REVOKE_SPONSORSHIP_MALFORMED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipType.cs b/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipType.cs index 5a970af5..b10f2f2b 100644 --- a/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipType.cs +++ b/stellar-dotnet-sdk-xdr/generated/RevokeSponsorshipType.cs @@ -1,51 +1,51 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum RevokeSponsorshipType - // { - // REVOKE_SPONSORSHIP_LEDGER_ENTRY = 0, - // REVOKE_SPONSORSHIP_SIGNER = 1 - // }; +// enum RevokeSponsorshipType +// { +// REVOKE_SPONSORSHIP_LEDGER_ENTRY = 0, +// REVOKE_SPONSORSHIP_SIGNER = 1 +// }; - // =========================================================================== - public class RevokeSponsorshipType +// =========================================================================== +public class RevokeSponsorshipType +{ + public enum RevokeSponsorshipTypeEnum { - public enum RevokeSponsorshipTypeEnum - { - REVOKE_SPONSORSHIP_LEDGER_ENTRY = 0, - REVOKE_SPONSORSHIP_SIGNER = 1, - } - public RevokeSponsorshipTypeEnum InnerValue { get; set; } = default(RevokeSponsorshipTypeEnum); + REVOKE_SPONSORSHIP_LEDGER_ENTRY = 0, + REVOKE_SPONSORSHIP_SIGNER = 1 + } - public static RevokeSponsorshipType Create(RevokeSponsorshipTypeEnum v) - { - return new RevokeSponsorshipType - { - InnerValue = v - }; - } + public RevokeSponsorshipTypeEnum InnerValue { get; set; } = default; - public static RevokeSponsorshipType Decode(XdrDataInputStream stream) + public static RevokeSponsorshipType Create(RevokeSponsorshipTypeEnum v) + { + return new RevokeSponsorshipType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_LEDGER_ENTRY); - case 1: return Create(RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_SIGNER); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipType value) + public static RevokeSponsorshipType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_LEDGER_ENTRY); + case 1: return Create(RevokeSponsorshipTypeEnum.REVOKE_SPONSORSHIP_SIGNER); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCAddress.cs b/stellar-dotnet-sdk-xdr/generated/SCAddress.cs new file mode 100644 index 00000000..aa76c088 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCAddress.cs @@ -0,0 +1,55 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SCAddress switch (SCAddressType type) +// { +// case SC_ADDRESS_TYPE_ACCOUNT: +// AccountID accountId; +// case SC_ADDRESS_TYPE_CONTRACT: +// Hash contractId; +// }; + +// =========================================================================== +public class SCAddress +{ + public SCAddressType Discriminant { get; set; } = new(); + + public AccountID AccountId { get; set; } + public Hash ContractId { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCAddress encodedSCAddress) + { + stream.WriteInt((int)encodedSCAddress.Discriminant.InnerValue); + switch (encodedSCAddress.Discriminant.InnerValue) + { + case SCAddressType.SCAddressTypeEnum.SC_ADDRESS_TYPE_ACCOUNT: + AccountID.Encode(stream, encodedSCAddress.AccountId); + break; + case SCAddressType.SCAddressTypeEnum.SC_ADDRESS_TYPE_CONTRACT: + Hash.Encode(stream, encodedSCAddress.ContractId); + break; + } + } + + public static SCAddress Decode(XdrDataInputStream stream) + { + var decodedSCAddress = new SCAddress(); + var discriminant = SCAddressType.Decode(stream); + decodedSCAddress.Discriminant = discriminant; + switch (decodedSCAddress.Discriminant.InnerValue) + { + case SCAddressType.SCAddressTypeEnum.SC_ADDRESS_TYPE_ACCOUNT: + decodedSCAddress.AccountId = AccountID.Decode(stream); + break; + case SCAddressType.SCAddressTypeEnum.SC_ADDRESS_TYPE_CONTRACT: + decodedSCAddress.ContractId = Hash.Decode(stream); + break; + } + + return decodedSCAddress; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCAddressType.cs b/stellar-dotnet-sdk-xdr/generated/SCAddressType.cs new file mode 100644 index 00000000..39697f2c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCAddressType.cs @@ -0,0 +1,51 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCAddressType +// { +// SC_ADDRESS_TYPE_ACCOUNT = 0, +// SC_ADDRESS_TYPE_CONTRACT = 1 +// }; + +// =========================================================================== +public class SCAddressType +{ + public enum SCAddressTypeEnum + { + SC_ADDRESS_TYPE_ACCOUNT = 0, + SC_ADDRESS_TYPE_CONTRACT = 1 + } + + public SCAddressTypeEnum InnerValue { get; set; } = default; + + public static SCAddressType Create(SCAddressTypeEnum v) + { + return new SCAddressType + { + InnerValue = v + }; + } + + public static SCAddressType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCAddressTypeEnum.SC_ADDRESS_TYPE_ACCOUNT); + case 1: return Create(SCAddressTypeEnum.SC_ADDRESS_TYPE_CONTRACT); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCAddressType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCBytes.cs b/stellar-dotnet-sdk-xdr/generated/SCBytes.cs new file mode 100644 index 00000000..b3f3ea3e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCBytes.cs @@ -0,0 +1,39 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque SCBytes<>; + +// =========================================================================== +public class SCBytes +{ + public SCBytes() + { + } + + public SCBytes(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; + + public static void Encode(XdrDataOutputStream stream, SCBytes encodedSCBytes) + { + var SCBytessize = encodedSCBytes.InnerValue.Length; + stream.WriteInt(SCBytessize); + stream.Write(encodedSCBytes.InnerValue, 0, SCBytessize); + } + + public static SCBytes Decode(XdrDataInputStream stream) + { + var decodedSCBytes = new SCBytes(); + var SCBytessize = stream.ReadInt(); + decodedSCBytes.InnerValue = new byte[SCBytessize]; + stream.Read(decodedSCBytes.InnerValue, 0, SCBytessize); + return decodedSCBytes; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCContractInstance.cs b/stellar-dotnet-sdk-xdr/generated/SCContractInstance.cs new file mode 100644 index 00000000..0a3fe9d8 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCContractInstance.cs @@ -0,0 +1,41 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCContractInstance { +// ContractExecutable executable; +// SCMap* storage; +// }; + +// =========================================================================== +public class SCContractInstance +{ + public ContractExecutable Executable { get; set; } + public SCMap Storage { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCContractInstance encodedSCContractInstance) + { + ContractExecutable.Encode(stream, encodedSCContractInstance.Executable); + if (encodedSCContractInstance.Storage != null) + { + stream.WriteInt(1); + SCMap.Encode(stream, encodedSCContractInstance.Storage); + } + else + { + stream.WriteInt(0); + } + } + + public static SCContractInstance Decode(XdrDataInputStream stream) + { + var decodedSCContractInstance = new SCContractInstance(); + decodedSCContractInstance.Executable = ContractExecutable.Decode(stream); + var StoragePresent = stream.ReadInt(); + if (StoragePresent != 0) decodedSCContractInstance.Storage = SCMap.Decode(stream); + return decodedSCContractInstance; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCEnvMetaEntry.cs b/stellar-dotnet-sdk-xdr/generated/SCEnvMetaEntry.cs new file mode 100644 index 00000000..5a21fa7d --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCEnvMetaEntry.cs @@ -0,0 +1,46 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SCEnvMetaEntry switch (SCEnvMetaKind kind) +// { +// case SC_ENV_META_KIND_INTERFACE_VERSION: +// uint64 interfaceVersion; +// }; + +// =========================================================================== +public class SCEnvMetaEntry +{ + public SCEnvMetaKind Discriminant { get; set; } = new(); + + public Uint64 InterfaceVersion { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCEnvMetaEntry encodedSCEnvMetaEntry) + { + stream.WriteInt((int)encodedSCEnvMetaEntry.Discriminant.InnerValue); + switch (encodedSCEnvMetaEntry.Discriminant.InnerValue) + { + case SCEnvMetaKind.SCEnvMetaKindEnum.SC_ENV_META_KIND_INTERFACE_VERSION: + Uint64.Encode(stream, encodedSCEnvMetaEntry.InterfaceVersion); + break; + } + } + + public static SCEnvMetaEntry Decode(XdrDataInputStream stream) + { + var decodedSCEnvMetaEntry = new SCEnvMetaEntry(); + var discriminant = SCEnvMetaKind.Decode(stream); + decodedSCEnvMetaEntry.Discriminant = discriminant; + switch (decodedSCEnvMetaEntry.Discriminant.InnerValue) + { + case SCEnvMetaKind.SCEnvMetaKindEnum.SC_ENV_META_KIND_INTERFACE_VERSION: + decodedSCEnvMetaEntry.InterfaceVersion = Uint64.Decode(stream); + break; + } + + return decodedSCEnvMetaEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCEnvMetaKind.cs b/stellar-dotnet-sdk-xdr/generated/SCEnvMetaKind.cs new file mode 100644 index 00000000..0d571530 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCEnvMetaKind.cs @@ -0,0 +1,48 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCEnvMetaKind +// { +// SC_ENV_META_KIND_INTERFACE_VERSION = 0 +// }; + +// =========================================================================== +public class SCEnvMetaKind +{ + public enum SCEnvMetaKindEnum + { + SC_ENV_META_KIND_INTERFACE_VERSION = 0 + } + + public SCEnvMetaKindEnum InnerValue { get; set; } = default; + + public static SCEnvMetaKind Create(SCEnvMetaKindEnum v) + { + return new SCEnvMetaKind + { + InnerValue = v + }; + } + + public static SCEnvMetaKind Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCEnvMetaKindEnum.SC_ENV_META_KIND_INTERFACE_VERSION); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCEnvMetaKind value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCError.cs b/stellar-dotnet-sdk-xdr/generated/SCError.cs new file mode 100644 index 00000000..af313e82 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCError.cs @@ -0,0 +1,79 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SCError switch (SCErrorType type) +// { +// case SCE_CONTRACT: +// uint32 contractCode; +// case SCE_WASM_VM: +// case SCE_CONTEXT: +// case SCE_STORAGE: +// case SCE_OBJECT: +// case SCE_CRYPTO: +// case SCE_EVENTS: +// case SCE_BUDGET: +// case SCE_VALUE: +// case SCE_AUTH: +// SCErrorCode code; +// }; + +// =========================================================================== +public class SCError +{ + public SCErrorType Discriminant { get; set; } = new(); + + public Uint32 ContractCode { get; set; } + public SCErrorCode Code { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCError encodedSCError) + { + stream.WriteInt((int)encodedSCError.Discriminant.InnerValue); + switch (encodedSCError.Discriminant.InnerValue) + { + case SCErrorType.SCErrorTypeEnum.SCE_CONTRACT: + Uint32.Encode(stream, encodedSCError.ContractCode); + break; + case SCErrorType.SCErrorTypeEnum.SCE_WASM_VM: + case SCErrorType.SCErrorTypeEnum.SCE_CONTEXT: + case SCErrorType.SCErrorTypeEnum.SCE_STORAGE: + case SCErrorType.SCErrorTypeEnum.SCE_OBJECT: + case SCErrorType.SCErrorTypeEnum.SCE_CRYPTO: + case SCErrorType.SCErrorTypeEnum.SCE_EVENTS: + case SCErrorType.SCErrorTypeEnum.SCE_BUDGET: + case SCErrorType.SCErrorTypeEnum.SCE_VALUE: + case SCErrorType.SCErrorTypeEnum.SCE_AUTH: + SCErrorCode.Encode(stream, encodedSCError.Code); + break; + } + } + + public static SCError Decode(XdrDataInputStream stream) + { + var decodedSCError = new SCError(); + var discriminant = SCErrorType.Decode(stream); + decodedSCError.Discriminant = discriminant; + switch (decodedSCError.Discriminant.InnerValue) + { + case SCErrorType.SCErrorTypeEnum.SCE_CONTRACT: + decodedSCError.ContractCode = Uint32.Decode(stream); + break; + case SCErrorType.SCErrorTypeEnum.SCE_WASM_VM: + case SCErrorType.SCErrorTypeEnum.SCE_CONTEXT: + case SCErrorType.SCErrorTypeEnum.SCE_STORAGE: + case SCErrorType.SCErrorTypeEnum.SCE_OBJECT: + case SCErrorType.SCErrorTypeEnum.SCE_CRYPTO: + case SCErrorType.SCErrorTypeEnum.SCE_EVENTS: + case SCErrorType.SCErrorTypeEnum.SCE_BUDGET: + case SCErrorType.SCErrorTypeEnum.SCE_VALUE: + case SCErrorType.SCErrorTypeEnum.SCE_AUTH: + decodedSCError.Code = SCErrorCode.Decode(stream); + break; + } + + return decodedSCError; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCErrorCode.cs b/stellar-dotnet-sdk-xdr/generated/SCErrorCode.cs new file mode 100644 index 00000000..032b1b57 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCErrorCode.cs @@ -0,0 +1,75 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCErrorCode +// { +// SCEC_ARITH_DOMAIN = 0, // Some arithmetic was undefined (overflow, divide-by-zero). +// SCEC_INDEX_BOUNDS = 1, // Something was indexed beyond its bounds. +// SCEC_INVALID_INPUT = 2, // User provided some otherwise-bad data. +// SCEC_MISSING_VALUE = 3, // Some value was required but not provided. +// SCEC_EXISTING_VALUE = 4, // Some value was provided where not allowed. +// SCEC_EXCEEDED_LIMIT = 5, // Some arbitrary limit -- gas or otherwise -- was hit. +// SCEC_INVALID_ACTION = 6, // Data was valid but action requested was not. +// SCEC_INTERNAL_ERROR = 7, // The host detected an error in its own logic. +// SCEC_UNEXPECTED_TYPE = 8, // Some type wasn't as expected. +// SCEC_UNEXPECTED_SIZE = 9 // Something's size wasn't as expected. +// }; + +// =========================================================================== +public class SCErrorCode +{ + public enum SCErrorCodeEnum + { + SCEC_ARITH_DOMAIN = 0, + SCEC_INDEX_BOUNDS = 1, + SCEC_INVALID_INPUT = 2, + SCEC_MISSING_VALUE = 3, + SCEC_EXISTING_VALUE = 4, + SCEC_EXCEEDED_LIMIT = 5, + SCEC_INVALID_ACTION = 6, + SCEC_INTERNAL_ERROR = 7, + SCEC_UNEXPECTED_TYPE = 8, + SCEC_UNEXPECTED_SIZE = 9 + } + + public SCErrorCodeEnum InnerValue { get; set; } = default; + + public static SCErrorCode Create(SCErrorCodeEnum v) + { + return new SCErrorCode + { + InnerValue = v + }; + } + + public static SCErrorCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCErrorCodeEnum.SCEC_ARITH_DOMAIN); + case 1: return Create(SCErrorCodeEnum.SCEC_INDEX_BOUNDS); + case 2: return Create(SCErrorCodeEnum.SCEC_INVALID_INPUT); + case 3: return Create(SCErrorCodeEnum.SCEC_MISSING_VALUE); + case 4: return Create(SCErrorCodeEnum.SCEC_EXISTING_VALUE); + case 5: return Create(SCErrorCodeEnum.SCEC_EXCEEDED_LIMIT); + case 6: return Create(SCErrorCodeEnum.SCEC_INVALID_ACTION); + case 7: return Create(SCErrorCodeEnum.SCEC_INTERNAL_ERROR); + case 8: return Create(SCErrorCodeEnum.SCEC_UNEXPECTED_TYPE); + case 9: return Create(SCErrorCodeEnum.SCEC_UNEXPECTED_SIZE); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCErrorCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCErrorType.cs b/stellar-dotnet-sdk-xdr/generated/SCErrorType.cs new file mode 100644 index 00000000..e6014d6d --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCErrorType.cs @@ -0,0 +1,75 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCErrorType +// { +// SCE_CONTRACT = 0, // Contract-specific, user-defined codes. +// SCE_WASM_VM = 1, // Errors while interpreting WASM bytecode. +// SCE_CONTEXT = 2, // Errors in the contract's host context. +// SCE_STORAGE = 3, // Errors accessing host storage. +// SCE_OBJECT = 4, // Errors working with host objects. +// SCE_CRYPTO = 5, // Errors in cryptographic operations. +// SCE_EVENTS = 6, // Errors while emitting events. +// SCE_BUDGET = 7, // Errors relating to budget limits. +// SCE_VALUE = 8, // Errors working with host values or SCVals. +// SCE_AUTH = 9 // Errors from the authentication subsystem. +// }; + +// =========================================================================== +public class SCErrorType +{ + public enum SCErrorTypeEnum + { + SCE_CONTRACT = 0, + SCE_WASM_VM = 1, + SCE_CONTEXT = 2, + SCE_STORAGE = 3, + SCE_OBJECT = 4, + SCE_CRYPTO = 5, + SCE_EVENTS = 6, + SCE_BUDGET = 7, + SCE_VALUE = 8, + SCE_AUTH = 9 + } + + public SCErrorTypeEnum InnerValue { get; set; } = default; + + public static SCErrorType Create(SCErrorTypeEnum v) + { + return new SCErrorType + { + InnerValue = v + }; + } + + public static SCErrorType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCErrorTypeEnum.SCE_CONTRACT); + case 1: return Create(SCErrorTypeEnum.SCE_WASM_VM); + case 2: return Create(SCErrorTypeEnum.SCE_CONTEXT); + case 3: return Create(SCErrorTypeEnum.SCE_STORAGE); + case 4: return Create(SCErrorTypeEnum.SCE_OBJECT); + case 5: return Create(SCErrorTypeEnum.SCE_CRYPTO); + case 6: return Create(SCErrorTypeEnum.SCE_EVENTS); + case 7: return Create(SCErrorTypeEnum.SCE_BUDGET); + case 8: return Create(SCErrorTypeEnum.SCE_VALUE); + case 9: return Create(SCErrorTypeEnum.SCE_AUTH); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCErrorType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCMap.cs b/stellar-dotnet-sdk-xdr/generated/SCMap.cs new file mode 100644 index 00000000..eb265efb --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCMap.cs @@ -0,0 +1,39 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef SCMapEntry SCMap<>; + +// =========================================================================== +public class SCMap +{ + public SCMap() + { + } + + public SCMap(SCMapEntry[] value) + { + InnerValue = value; + } + + public SCMapEntry[] InnerValue { get; set; } = default; + + public static void Encode(XdrDataOutputStream stream, SCMap encodedSCMap) + { + var SCMapsize = encodedSCMap.InnerValue.Length; + stream.WriteInt(SCMapsize); + for (var i = 0; i < SCMapsize; i++) SCMapEntry.Encode(stream, encodedSCMap.InnerValue[i]); + } + + public static SCMap Decode(XdrDataInputStream stream) + { + var decodedSCMap = new SCMap(); + var SCMapsize = stream.ReadInt(); + decodedSCMap.InnerValue = new SCMapEntry[SCMapsize]; + for (var i = 0; i < SCMapsize; i++) decodedSCMap.InnerValue[i] = SCMapEntry.Decode(stream); + return decodedSCMap; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCMapEntry.cs b/stellar-dotnet-sdk-xdr/generated/SCMapEntry.cs new file mode 100644 index 00000000..244c024e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCMapEntry.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCMapEntry +// { +// SCVal key; +// SCVal val; +// }; + +// =========================================================================== +public class SCMapEntry +{ + public SCVal Key { get; set; } + public SCVal Val { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCMapEntry encodedSCMapEntry) + { + SCVal.Encode(stream, encodedSCMapEntry.Key); + SCVal.Encode(stream, encodedSCMapEntry.Val); + } + + public static SCMapEntry Decode(XdrDataInputStream stream) + { + var decodedSCMapEntry = new SCMapEntry(); + decodedSCMapEntry.Key = SCVal.Decode(stream); + decodedSCMapEntry.Val = SCVal.Decode(stream); + return decodedSCMapEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCMetaEntry.cs b/stellar-dotnet-sdk-xdr/generated/SCMetaEntry.cs new file mode 100644 index 00000000..38d2e5cd --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCMetaEntry.cs @@ -0,0 +1,46 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SCMetaEntry switch (SCMetaKind kind) +// { +// case SC_META_V0: +// SCMetaV0 v0; +// }; + +// =========================================================================== +public class SCMetaEntry +{ + public SCMetaKind Discriminant { get; set; } = new(); + + public SCMetaV0 V0 { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCMetaEntry encodedSCMetaEntry) + { + stream.WriteInt((int)encodedSCMetaEntry.Discriminant.InnerValue); + switch (encodedSCMetaEntry.Discriminant.InnerValue) + { + case SCMetaKind.SCMetaKindEnum.SC_META_V0: + SCMetaV0.Encode(stream, encodedSCMetaEntry.V0); + break; + } + } + + public static SCMetaEntry Decode(XdrDataInputStream stream) + { + var decodedSCMetaEntry = new SCMetaEntry(); + var discriminant = SCMetaKind.Decode(stream); + decodedSCMetaEntry.Discriminant = discriminant; + switch (decodedSCMetaEntry.Discriminant.InnerValue) + { + case SCMetaKind.SCMetaKindEnum.SC_META_V0: + decodedSCMetaEntry.V0 = SCMetaV0.Decode(stream); + break; + } + + return decodedSCMetaEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCMetaKind.cs b/stellar-dotnet-sdk-xdr/generated/SCMetaKind.cs new file mode 100644 index 00000000..5142d8e4 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCMetaKind.cs @@ -0,0 +1,48 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCMetaKind +// { +// SC_META_V0 = 0 +// }; + +// =========================================================================== +public class SCMetaKind +{ + public enum SCMetaKindEnum + { + SC_META_V0 = 0 + } + + public SCMetaKindEnum InnerValue { get; set; } = default; + + public static SCMetaKind Create(SCMetaKindEnum v) + { + return new SCMetaKind + { + InnerValue = v + }; + } + + public static SCMetaKind Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCMetaKindEnum.SC_META_V0); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCMetaKind value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCMetaV0.cs b/stellar-dotnet-sdk-xdr/generated/SCMetaV0.cs new file mode 100644 index 00000000..8453205e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCMetaV0.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCMetaV0 +// { +// string key<>; +// string val<>; +// }; + +// =========================================================================== +public class SCMetaV0 +{ + public string Key { get; set; } + public string Val { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCMetaV0 encodedSCMetaV0) + { + stream.WriteString(encodedSCMetaV0.Key); + stream.WriteString(encodedSCMetaV0.Val); + } + + public static SCMetaV0 Decode(XdrDataInputStream stream) + { + var decodedSCMetaV0 = new SCMetaV0(); + decodedSCMetaV0.Key = stream.ReadString(); + decodedSCMetaV0.Val = stream.ReadString(); + return decodedSCMetaV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCNonceKey.cs b/stellar-dotnet-sdk-xdr/generated/SCNonceKey.cs new file mode 100644 index 00000000..2c10a2e2 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCNonceKey.cs @@ -0,0 +1,28 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCNonceKey { +// int64 nonce; +// }; + +// =========================================================================== +public class SCNonceKey +{ + public Int64 Nonce { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCNonceKey encodedSCNonceKey) + { + Int64.Encode(stream, encodedSCNonceKey.Nonce); + } + + public static SCNonceKey Decode(XdrDataInputStream stream) + { + var decodedSCNonceKey = new SCNonceKey(); + decodedSCNonceKey.Nonce = Int64.Decode(stream); + return decodedSCNonceKey; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCPBallot.cs b/stellar-dotnet-sdk-xdr/generated/SCPBallot.cs index b55d06e7..c4902b6e 100644 --- a/stellar-dotnet-sdk-xdr/generated/SCPBallot.cs +++ b/stellar-dotnet-sdk-xdr/generated/SCPBallot.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SCPBallot +// { +// uint32 counter; // n +// Value value; // x +// }; - // struct SCPBallot - // { - // uint32 counter; // n - // Value value; // x - // }; +// =========================================================================== +public class SCPBallot +{ + public Uint32 Counter { get; set; } + public Value Value { get; set; } - // =========================================================================== - public class SCPBallot + public static void Encode(XdrDataOutputStream stream, SCPBallot encodedSCPBallot) { - public SCPBallot() { } - public Uint32 Counter { get; set; } - public Value Value { get; set; } + Uint32.Encode(stream, encodedSCPBallot.Counter); + Value.Encode(stream, encodedSCPBallot.Value); + } - public static void Encode(XdrDataOutputStream stream, SCPBallot encodedSCPBallot) - { - Uint32.Encode(stream, encodedSCPBallot.Counter); - Value.Encode(stream, encodedSCPBallot.Value); - } - public static SCPBallot Decode(XdrDataInputStream stream) - { - SCPBallot decodedSCPBallot = new SCPBallot(); - decodedSCPBallot.Counter = Uint32.Decode(stream); - decodedSCPBallot.Value = Value.Decode(stream); - return decodedSCPBallot; - } + public static SCPBallot Decode(XdrDataInputStream stream) + { + var decodedSCPBallot = new SCPBallot(); + decodedSCPBallot.Counter = Uint32.Decode(stream); + decodedSCPBallot.Value = Value.Decode(stream); + return decodedSCPBallot; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCPEnvelope.cs b/stellar-dotnet-sdk-xdr/generated/SCPEnvelope.cs index 3be52268..aff9d66f 100644 --- a/stellar-dotnet-sdk-xdr/generated/SCPEnvelope.cs +++ b/stellar-dotnet-sdk-xdr/generated/SCPEnvelope.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SCPEnvelope +// { +// SCPStatement statement; +// Signature signature; +// }; - // struct SCPEnvelope - // { - // SCPStatement statement; - // Signature signature; - // }; +// =========================================================================== +public class SCPEnvelope +{ + public SCPStatement Statement { get; set; } + public Signature Signature { get; set; } - // =========================================================================== - public class SCPEnvelope + public static void Encode(XdrDataOutputStream stream, SCPEnvelope encodedSCPEnvelope) { - public SCPEnvelope() { } - public SCPStatement Statement { get; set; } - public Signature Signature { get; set; } + SCPStatement.Encode(stream, encodedSCPEnvelope.Statement); + Signature.Encode(stream, encodedSCPEnvelope.Signature); + } - public static void Encode(XdrDataOutputStream stream, SCPEnvelope encodedSCPEnvelope) - { - SCPStatement.Encode(stream, encodedSCPEnvelope.Statement); - Signature.Encode(stream, encodedSCPEnvelope.Signature); - } - public static SCPEnvelope Decode(XdrDataInputStream stream) - { - SCPEnvelope decodedSCPEnvelope = new SCPEnvelope(); - decodedSCPEnvelope.Statement = SCPStatement.Decode(stream); - decodedSCPEnvelope.Signature = Signature.Decode(stream); - return decodedSCPEnvelope; - } + public static SCPEnvelope Decode(XdrDataInputStream stream) + { + var decodedSCPEnvelope = new SCPEnvelope(); + decodedSCPEnvelope.Statement = SCPStatement.Decode(stream); + decodedSCPEnvelope.Signature = Signature.Decode(stream); + return decodedSCPEnvelope; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCPHistoryEntry.cs b/stellar-dotnet-sdk-xdr/generated/SCPHistoryEntry.cs index a8133340..afd196ef 100644 --- a/stellar-dotnet-sdk-xdr/generated/SCPHistoryEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/SCPHistoryEntry.cs @@ -1,48 +1,46 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union SCPHistoryEntry switch (int v) - // { - // case 0: - // SCPHistoryEntryV0 v0; - // }; +// union SCPHistoryEntry switch (int v) +// { +// case 0: +// SCPHistoryEntryV0 v0; +// }; - // =========================================================================== - public class SCPHistoryEntry - { - public SCPHistoryEntry() { } +// =========================================================================== +public class SCPHistoryEntry +{ + public int Discriminant { get; set; } - public int Discriminant { get; set; } = new int(); + public SCPHistoryEntryV0 V0 { get; set; } - public SCPHistoryEntryV0 V0 { get; set; } - public static void Encode(XdrDataOutputStream stream, SCPHistoryEntry encodedSCPHistoryEntry) + public static void Encode(XdrDataOutputStream stream, SCPHistoryEntry encodedSCPHistoryEntry) + { + stream.WriteInt(encodedSCPHistoryEntry.Discriminant); + switch (encodedSCPHistoryEntry.Discriminant) { - stream.WriteInt((int)encodedSCPHistoryEntry.Discriminant); - switch (encodedSCPHistoryEntry.Discriminant) - { - case 0: - SCPHistoryEntryV0.Encode(stream, encodedSCPHistoryEntry.V0); - break; - } + case 0: + SCPHistoryEntryV0.Encode(stream, encodedSCPHistoryEntry.V0); + break; } - public static SCPHistoryEntry Decode(XdrDataInputStream stream) + } + + public static SCPHistoryEntry Decode(XdrDataInputStream stream) + { + var decodedSCPHistoryEntry = new SCPHistoryEntry(); + var discriminant = stream.ReadInt(); + decodedSCPHistoryEntry.Discriminant = discriminant; + switch (decodedSCPHistoryEntry.Discriminant) { - SCPHistoryEntry decodedSCPHistoryEntry = new SCPHistoryEntry(); - int discriminant = stream.ReadInt(); - decodedSCPHistoryEntry.Discriminant = discriminant; - switch (decodedSCPHistoryEntry.Discriminant) - { - case 0: - decodedSCPHistoryEntry.V0 = SCPHistoryEntryV0.Decode(stream); - break; - } - return decodedSCPHistoryEntry; + case 0: + decodedSCPHistoryEntry.V0 = SCPHistoryEntryV0.Decode(stream); + break; } + + return decodedSCPHistoryEntry; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCPHistoryEntryV0.cs b/stellar-dotnet-sdk-xdr/generated/SCPHistoryEntryV0.cs index 3001c508..ce44bb04 100644 --- a/stellar-dotnet-sdk-xdr/generated/SCPHistoryEntryV0.cs +++ b/stellar-dotnet-sdk-xdr/generated/SCPHistoryEntryV0.cs @@ -1,46 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SCPHistoryEntryV0 +// { +// SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages +// LedgerSCPMessages ledgerMessages; +// }; - // struct SCPHistoryEntryV0 - // { - // SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages - // LedgerSCPMessages ledgerMessages; - // }; +// =========================================================================== +public class SCPHistoryEntryV0 +{ + public SCPQuorumSet[] QuorumSets { get; set; } + public LedgerSCPMessages LedgerMessages { get; set; } - // =========================================================================== - public class SCPHistoryEntryV0 + public static void Encode(XdrDataOutputStream stream, SCPHistoryEntryV0 encodedSCPHistoryEntryV0) { - public SCPHistoryEntryV0() { } - public SCPQuorumSet[] QuorumSets { get; set; } - public LedgerSCPMessages LedgerMessages { get; set; } + var quorumSetssize = encodedSCPHistoryEntryV0.QuorumSets.Length; + stream.WriteInt(quorumSetssize); + for (var i = 0; i < quorumSetssize; i++) SCPQuorumSet.Encode(stream, encodedSCPHistoryEntryV0.QuorumSets[i]); + LedgerSCPMessages.Encode(stream, encodedSCPHistoryEntryV0.LedgerMessages); + } - public static void Encode(XdrDataOutputStream stream, SCPHistoryEntryV0 encodedSCPHistoryEntryV0) - { - int quorumSetssize = encodedSCPHistoryEntryV0.QuorumSets.Length; - stream.WriteInt(quorumSetssize); - for (int i = 0; i < quorumSetssize; i++) - { - SCPQuorumSet.Encode(stream, encodedSCPHistoryEntryV0.QuorumSets[i]); - } - LedgerSCPMessages.Encode(stream, encodedSCPHistoryEntryV0.LedgerMessages); - } - public static SCPHistoryEntryV0 Decode(XdrDataInputStream stream) - { - SCPHistoryEntryV0 decodedSCPHistoryEntryV0 = new SCPHistoryEntryV0(); - int quorumSetssize = stream.ReadInt(); - decodedSCPHistoryEntryV0.QuorumSets = new SCPQuorumSet[quorumSetssize]; - for (int i = 0; i < quorumSetssize; i++) - { - decodedSCPHistoryEntryV0.QuorumSets[i] = SCPQuorumSet.Decode(stream); - } - decodedSCPHistoryEntryV0.LedgerMessages = LedgerSCPMessages.Decode(stream); - return decodedSCPHistoryEntryV0; - } + public static SCPHistoryEntryV0 Decode(XdrDataInputStream stream) + { + var decodedSCPHistoryEntryV0 = new SCPHistoryEntryV0(); + var quorumSetssize = stream.ReadInt(); + decodedSCPHistoryEntryV0.QuorumSets = new SCPQuorumSet[quorumSetssize]; + for (var i = 0; i < quorumSetssize; i++) decodedSCPHistoryEntryV0.QuorumSets[i] = SCPQuorumSet.Decode(stream); + decodedSCPHistoryEntryV0.LedgerMessages = LedgerSCPMessages.Decode(stream); + return decodedSCPHistoryEntryV0; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCPNomination.cs b/stellar-dotnet-sdk-xdr/generated/SCPNomination.cs index 5536b76c..895f4ee6 100644 --- a/stellar-dotnet-sdk-xdr/generated/SCPNomination.cs +++ b/stellar-dotnet-sdk-xdr/generated/SCPNomination.cs @@ -1,60 +1,45 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SCPNomination +// { +// Hash quorumSetHash; // D +// Value votes<>; // X +// Value accepted<>; // Y +// }; - // struct SCPNomination - // { - // Hash quorumSetHash; // D - // Value votes<>; // X - // Value accepted<>; // Y - // }; +// =========================================================================== +public class SCPNomination +{ + public Hash QuorumSetHash { get; set; } + public Value[] Votes { get; set; } + public Value[] Accepted { get; set; } - // =========================================================================== - public class SCPNomination + public static void Encode(XdrDataOutputStream stream, SCPNomination encodedSCPNomination) { - public SCPNomination() { } - public Hash QuorumSetHash { get; set; } - public Value[] Votes { get; set; } - public Value[] Accepted { get; set; } + Hash.Encode(stream, encodedSCPNomination.QuorumSetHash); + var votessize = encodedSCPNomination.Votes.Length; + stream.WriteInt(votessize); + for (var i = 0; i < votessize; i++) Value.Encode(stream, encodedSCPNomination.Votes[i]); + var acceptedsize = encodedSCPNomination.Accepted.Length; + stream.WriteInt(acceptedsize); + for (var i = 0; i < acceptedsize; i++) Value.Encode(stream, encodedSCPNomination.Accepted[i]); + } - public static void Encode(XdrDataOutputStream stream, SCPNomination encodedSCPNomination) - { - Hash.Encode(stream, encodedSCPNomination.QuorumSetHash); - int votessize = encodedSCPNomination.Votes.Length; - stream.WriteInt(votessize); - for (int i = 0; i < votessize; i++) - { - Value.Encode(stream, encodedSCPNomination.Votes[i]); - } - int acceptedsize = encodedSCPNomination.Accepted.Length; - stream.WriteInt(acceptedsize); - for (int i = 0; i < acceptedsize; i++) - { - Value.Encode(stream, encodedSCPNomination.Accepted[i]); - } - } - public static SCPNomination Decode(XdrDataInputStream stream) - { - SCPNomination decodedSCPNomination = new SCPNomination(); - decodedSCPNomination.QuorumSetHash = Hash.Decode(stream); - int votessize = stream.ReadInt(); - decodedSCPNomination.Votes = new Value[votessize]; - for (int i = 0; i < votessize; i++) - { - decodedSCPNomination.Votes[i] = Value.Decode(stream); - } - int acceptedsize = stream.ReadInt(); - decodedSCPNomination.Accepted = new Value[acceptedsize]; - for (int i = 0; i < acceptedsize; i++) - { - decodedSCPNomination.Accepted[i] = Value.Decode(stream); - } - return decodedSCPNomination; - } + public static SCPNomination Decode(XdrDataInputStream stream) + { + var decodedSCPNomination = new SCPNomination(); + decodedSCPNomination.QuorumSetHash = Hash.Decode(stream); + var votessize = stream.ReadInt(); + decodedSCPNomination.Votes = new Value[votessize]; + for (var i = 0; i < votessize; i++) decodedSCPNomination.Votes[i] = Value.Decode(stream); + var acceptedsize = stream.ReadInt(); + decodedSCPNomination.Accepted = new Value[acceptedsize]; + for (var i = 0; i < acceptedsize; i++) decodedSCPNomination.Accepted[i] = Value.Decode(stream); + return decodedSCPNomination; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCPQuorumSet.cs b/stellar-dotnet-sdk-xdr/generated/SCPQuorumSet.cs index b3b73f23..12cc565a 100644 --- a/stellar-dotnet-sdk-xdr/generated/SCPQuorumSet.cs +++ b/stellar-dotnet-sdk-xdr/generated/SCPQuorumSet.cs @@ -1,60 +1,45 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SCPQuorumSet +// { +// uint32 threshold; +// NodeID validators<>; +// SCPQuorumSet innerSets<>; +// }; - // struct SCPQuorumSet - // { - // uint32 threshold; - // NodeID validators<>; - // SCPQuorumSet innerSets<>; - // }; +// =========================================================================== +public class SCPQuorumSet +{ + public Uint32 Threshold { get; set; } + public NodeID[] Validators { get; set; } + public SCPQuorumSet[] InnerSets { get; set; } - // =========================================================================== - public class SCPQuorumSet + public static void Encode(XdrDataOutputStream stream, SCPQuorumSet encodedSCPQuorumSet) { - public SCPQuorumSet() { } - public Uint32 Threshold { get; set; } - public NodeID[] Validators { get; set; } - public SCPQuorumSet[] InnerSets { get; set; } + Uint32.Encode(stream, encodedSCPQuorumSet.Threshold); + var validatorssize = encodedSCPQuorumSet.Validators.Length; + stream.WriteInt(validatorssize); + for (var i = 0; i < validatorssize; i++) NodeID.Encode(stream, encodedSCPQuorumSet.Validators[i]); + var innerSetssize = encodedSCPQuorumSet.InnerSets.Length; + stream.WriteInt(innerSetssize); + for (var i = 0; i < innerSetssize; i++) Encode(stream, encodedSCPQuorumSet.InnerSets[i]); + } - public static void Encode(XdrDataOutputStream stream, SCPQuorumSet encodedSCPQuorumSet) - { - Uint32.Encode(stream, encodedSCPQuorumSet.Threshold); - int validatorssize = encodedSCPQuorumSet.Validators.Length; - stream.WriteInt(validatorssize); - for (int i = 0; i < validatorssize; i++) - { - NodeID.Encode(stream, encodedSCPQuorumSet.Validators[i]); - } - int innerSetssize = encodedSCPQuorumSet.InnerSets.Length; - stream.WriteInt(innerSetssize); - for (int i = 0; i < innerSetssize; i++) - { - SCPQuorumSet.Encode(stream, encodedSCPQuorumSet.InnerSets[i]); - } - } - public static SCPQuorumSet Decode(XdrDataInputStream stream) - { - SCPQuorumSet decodedSCPQuorumSet = new SCPQuorumSet(); - decodedSCPQuorumSet.Threshold = Uint32.Decode(stream); - int validatorssize = stream.ReadInt(); - decodedSCPQuorumSet.Validators = new NodeID[validatorssize]; - for (int i = 0; i < validatorssize; i++) - { - decodedSCPQuorumSet.Validators[i] = NodeID.Decode(stream); - } - int innerSetssize = stream.ReadInt(); - decodedSCPQuorumSet.InnerSets = new SCPQuorumSet[innerSetssize]; - for (int i = 0; i < innerSetssize; i++) - { - decodedSCPQuorumSet.InnerSets[i] = SCPQuorumSet.Decode(stream); - } - return decodedSCPQuorumSet; - } + public static SCPQuorumSet Decode(XdrDataInputStream stream) + { + var decodedSCPQuorumSet = new SCPQuorumSet(); + decodedSCPQuorumSet.Threshold = Uint32.Decode(stream); + var validatorssize = stream.ReadInt(); + decodedSCPQuorumSet.Validators = new NodeID[validatorssize]; + for (var i = 0; i < validatorssize; i++) decodedSCPQuorumSet.Validators[i] = NodeID.Decode(stream); + var innerSetssize = stream.ReadInt(); + decodedSCPQuorumSet.InnerSets = new SCPQuorumSet[innerSetssize]; + for (var i = 0; i < innerSetssize; i++) decodedSCPQuorumSet.InnerSets[i] = Decode(stream); + return decodedSCPQuorumSet; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCPStatement.cs b/stellar-dotnet-sdk-xdr/generated/SCPStatement.cs index 95bd14c5..b120c6a2 100644 --- a/stellar-dotnet-sdk-xdr/generated/SCPStatement.cs +++ b/stellar-dotnet-sdk-xdr/generated/SCPStatement.cs @@ -1,234 +1,228 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCPStatement +// { +// NodeID nodeID; // v +// uint64 slotIndex; // i +// +// union switch (SCPStatementType type) +// { +// case SCP_ST_PREPARE: +// struct +// { +// Hash quorumSetHash; // D +// SCPBallot ballot; // b +// SCPBallot* prepared; // p +// SCPBallot* preparedPrime; // p' +// uint32 nC; // c.n +// uint32 nH; // h.n +// } prepare; +// case SCP_ST_CONFIRM: +// struct +// { +// SCPBallot ballot; // b +// uint32 nPrepared; // p.n +// uint32 nCommit; // c.n +// uint32 nH; // h.n +// Hash quorumSetHash; // D +// } confirm; +// case SCP_ST_EXTERNALIZE: +// struct +// { +// SCPBallot commit; // c +// uint32 nH; // h.n +// Hash commitQuorumSetHash; // D used before EXTERNALIZE +// } externalize; +// case SCP_ST_NOMINATE: +// SCPNomination nominate; +// } +// pledges; +// }; + +// =========================================================================== +public class SCPStatement { + public NodeID NodeID { get; set; } + public Uint64 SlotIndex { get; set; } + public SCPStatementPledges Pledges { get; set; } - // === xdr source ============================================================ - - // struct SCPStatement - // { - // NodeID nodeID; // v - // uint64 slotIndex; // i - // - // union switch (SCPStatementType type) - // { - // case SCP_ST_PREPARE: - // struct - // { - // Hash quorumSetHash; // D - // SCPBallot ballot; // b - // SCPBallot* prepared; // p - // SCPBallot* preparedPrime; // p' - // uint32 nC; // c.n - // uint32 nH; // h.n - // } prepare; - // case SCP_ST_CONFIRM: - // struct - // { - // SCPBallot ballot; // b - // uint32 nPrepared; // p.n - // uint32 nCommit; // c.n - // uint32 nH; // h.n - // Hash quorumSetHash; // D - // } confirm; - // case SCP_ST_EXTERNALIZE: - // struct - // { - // SCPBallot commit; // c - // uint32 nH; // h.n - // Hash commitQuorumSetHash; // D used before EXTERNALIZE - // } externalize; - // case SCP_ST_NOMINATE: - // SCPNomination nominate; - // } - // pledges; - // }; - - // =========================================================================== - public class SCPStatement + public static void Encode(XdrDataOutputStream stream, SCPStatement encodedSCPStatement) { - public SCPStatement() { } - public NodeID NodeID { get; set; } - public Uint64 SlotIndex { get; set; } - public SCPStatementPledges Pledges { get; set; } + NodeID.Encode(stream, encodedSCPStatement.NodeID); + Uint64.Encode(stream, encodedSCPStatement.SlotIndex); + SCPStatementPledges.Encode(stream, encodedSCPStatement.Pledges); + } - public static void Encode(XdrDataOutputStream stream, SCPStatement encodedSCPStatement) + public static SCPStatement Decode(XdrDataInputStream stream) + { + var decodedSCPStatement = new SCPStatement(); + decodedSCPStatement.NodeID = NodeID.Decode(stream); + decodedSCPStatement.SlotIndex = Uint64.Decode(stream); + decodedSCPStatement.Pledges = SCPStatementPledges.Decode(stream); + return decodedSCPStatement; + } + + public class SCPStatementPledges + { + public SCPStatementType Discriminant { get; set; } = new(); + + public SCPStatementPrepare Prepare { get; set; } + public SCPStatementConfirm Confirm { get; set; } + public SCPStatementExternalize Externalize { get; set; } + public SCPNomination Nominate { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCPStatementPledges encodedSCPStatementPledges) { - NodeID.Encode(stream, encodedSCPStatement.NodeID); - Uint64.Encode(stream, encodedSCPStatement.SlotIndex); - SCPStatementPledges.Encode(stream, encodedSCPStatement.Pledges); + stream.WriteInt((int)encodedSCPStatementPledges.Discriminant.InnerValue); + switch (encodedSCPStatementPledges.Discriminant.InnerValue) + { + case SCPStatementType.SCPStatementTypeEnum.SCP_ST_PREPARE: + SCPStatementPrepare.Encode(stream, encodedSCPStatementPledges.Prepare); + break; + case SCPStatementType.SCPStatementTypeEnum.SCP_ST_CONFIRM: + SCPStatementConfirm.Encode(stream, encodedSCPStatementPledges.Confirm); + break; + case SCPStatementType.SCPStatementTypeEnum.SCP_ST_EXTERNALIZE: + SCPStatementExternalize.Encode(stream, encodedSCPStatementPledges.Externalize); + break; + case SCPStatementType.SCPStatementTypeEnum.SCP_ST_NOMINATE: + SCPNomination.Encode(stream, encodedSCPStatementPledges.Nominate); + break; + } } - public static SCPStatement Decode(XdrDataInputStream stream) + + public static SCPStatementPledges Decode(XdrDataInputStream stream) { - SCPStatement decodedSCPStatement = new SCPStatement(); - decodedSCPStatement.NodeID = NodeID.Decode(stream); - decodedSCPStatement.SlotIndex = Uint64.Decode(stream); - decodedSCPStatement.Pledges = SCPStatementPledges.Decode(stream); - return decodedSCPStatement; + var decodedSCPStatementPledges = new SCPStatementPledges(); + var discriminant = SCPStatementType.Decode(stream); + decodedSCPStatementPledges.Discriminant = discriminant; + switch (decodedSCPStatementPledges.Discriminant.InnerValue) + { + case SCPStatementType.SCPStatementTypeEnum.SCP_ST_PREPARE: + decodedSCPStatementPledges.Prepare = SCPStatementPrepare.Decode(stream); + break; + case SCPStatementType.SCPStatementTypeEnum.SCP_ST_CONFIRM: + decodedSCPStatementPledges.Confirm = SCPStatementConfirm.Decode(stream); + break; + case SCPStatementType.SCPStatementTypeEnum.SCP_ST_EXTERNALIZE: + decodedSCPStatementPledges.Externalize = SCPStatementExternalize.Decode(stream); + break; + case SCPStatementType.SCPStatementTypeEnum.SCP_ST_NOMINATE: + decodedSCPStatementPledges.Nominate = SCPNomination.Decode(stream); + break; + } + + return decodedSCPStatementPledges; } - public class SCPStatementPledges + public class SCPStatementPrepare { - public SCPStatementPledges() { } - - public SCPStatementType Discriminant { get; set; } = new SCPStatementType(); + public Hash QuorumSetHash { get; set; } + public SCPBallot Ballot { get; set; } + public SCPBallot Prepared { get; set; } + public SCPBallot PreparedPrime { get; set; } + public Uint32 NC { get; set; } + public Uint32 NH { get; set; } - public SCPStatementPrepare Prepare { get; set; } - public SCPStatementConfirm Confirm { get; set; } - public SCPStatementExternalize Externalize { get; set; } - public SCPNomination Nominate { get; set; } - public static void Encode(XdrDataOutputStream stream, SCPStatementPledges encodedSCPStatementPledges) + public static void Encode(XdrDataOutputStream stream, SCPStatementPrepare encodedSCPStatementPrepare) { - stream.WriteInt((int)encodedSCPStatementPledges.Discriminant.InnerValue); - switch (encodedSCPStatementPledges.Discriminant.InnerValue) + Hash.Encode(stream, encodedSCPStatementPrepare.QuorumSetHash); + SCPBallot.Encode(stream, encodedSCPStatementPrepare.Ballot); + if (encodedSCPStatementPrepare.Prepared != null) { - case SCPStatementType.SCPStatementTypeEnum.SCP_ST_PREPARE: - SCPStatementPrepare.Encode(stream, encodedSCPStatementPledges.Prepare); - break; - case SCPStatementType.SCPStatementTypeEnum.SCP_ST_CONFIRM: - SCPStatementConfirm.Encode(stream, encodedSCPStatementPledges.Confirm); - break; - case SCPStatementType.SCPStatementTypeEnum.SCP_ST_EXTERNALIZE: - SCPStatementExternalize.Encode(stream, encodedSCPStatementPledges.Externalize); - break; - case SCPStatementType.SCPStatementTypeEnum.SCP_ST_NOMINATE: - SCPNomination.Encode(stream, encodedSCPStatementPledges.Nominate); - break; + stream.WriteInt(1); + SCPBallot.Encode(stream, encodedSCPStatementPrepare.Prepared); } - } - public static SCPStatementPledges Decode(XdrDataInputStream stream) - { - SCPStatementPledges decodedSCPStatementPledges = new SCPStatementPledges(); - SCPStatementType discriminant = SCPStatementType.Decode(stream); - decodedSCPStatementPledges.Discriminant = discriminant; - switch (decodedSCPStatementPledges.Discriminant.InnerValue) + else { - case SCPStatementType.SCPStatementTypeEnum.SCP_ST_PREPARE: - decodedSCPStatementPledges.Prepare = SCPStatementPrepare.Decode(stream); - break; - case SCPStatementType.SCPStatementTypeEnum.SCP_ST_CONFIRM: - decodedSCPStatementPledges.Confirm = SCPStatementConfirm.Decode(stream); - break; - case SCPStatementType.SCPStatementTypeEnum.SCP_ST_EXTERNALIZE: - decodedSCPStatementPledges.Externalize = SCPStatementExternalize.Decode(stream); - break; - case SCPStatementType.SCPStatementTypeEnum.SCP_ST_NOMINATE: - decodedSCPStatementPledges.Nominate = SCPNomination.Decode(stream); - break; + stream.WriteInt(0); } - return decodedSCPStatementPledges; - } - public class SCPStatementPrepare - { - public SCPStatementPrepare() { } - public Hash QuorumSetHash { get; set; } - public SCPBallot Ballot { get; set; } - public SCPBallot Prepared { get; set; } - public SCPBallot PreparedPrime { get; set; } - public Uint32 NC { get; set; } - public Uint32 NH { get; set; } - - public static void Encode(XdrDataOutputStream stream, SCPStatementPrepare encodedSCPStatementPrepare) + if (encodedSCPStatementPrepare.PreparedPrime != null) { - Hash.Encode(stream, encodedSCPStatementPrepare.QuorumSetHash); - SCPBallot.Encode(stream, encodedSCPStatementPrepare.Ballot); - if (encodedSCPStatementPrepare.Prepared != null) - { - stream.WriteInt(1); - SCPBallot.Encode(stream, encodedSCPStatementPrepare.Prepared); - } - else - { - stream.WriteInt(0); - } - if (encodedSCPStatementPrepare.PreparedPrime != null) - { - stream.WriteInt(1); - SCPBallot.Encode(stream, encodedSCPStatementPrepare.PreparedPrime); - } - else - { - stream.WriteInt(0); - } - Uint32.Encode(stream, encodedSCPStatementPrepare.NC); - Uint32.Encode(stream, encodedSCPStatementPrepare.NH); + stream.WriteInt(1); + SCPBallot.Encode(stream, encodedSCPStatementPrepare.PreparedPrime); } - public static SCPStatementPrepare Decode(XdrDataInputStream stream) + else { - SCPStatementPrepare decodedSCPStatementPrepare = new SCPStatementPrepare(); - decodedSCPStatementPrepare.QuorumSetHash = Hash.Decode(stream); - decodedSCPStatementPrepare.Ballot = SCPBallot.Decode(stream); - int PreparedPresent = stream.ReadInt(); - if (PreparedPresent != 0) - { - decodedSCPStatementPrepare.Prepared = SCPBallot.Decode(stream); - } - int PreparedPrimePresent = stream.ReadInt(); - if (PreparedPrimePresent != 0) - { - decodedSCPStatementPrepare.PreparedPrime = SCPBallot.Decode(stream); - } - decodedSCPStatementPrepare.NC = Uint32.Decode(stream); - decodedSCPStatementPrepare.NH = Uint32.Decode(stream); - return decodedSCPStatementPrepare; + stream.WriteInt(0); } + Uint32.Encode(stream, encodedSCPStatementPrepare.NC); + Uint32.Encode(stream, encodedSCPStatementPrepare.NH); } - public class SCPStatementConfirm + + public static SCPStatementPrepare Decode(XdrDataInputStream stream) { - public SCPStatementConfirm() { } - public SCPBallot Ballot { get; set; } - public Uint32 NPrepared { get; set; } - public Uint32 NCommit { get; set; } - public Uint32 NH { get; set; } - public Hash QuorumSetHash { get; set; } - - public static void Encode(XdrDataOutputStream stream, SCPStatementConfirm encodedSCPStatementConfirm) - { - SCPBallot.Encode(stream, encodedSCPStatementConfirm.Ballot); - Uint32.Encode(stream, encodedSCPStatementConfirm.NPrepared); - Uint32.Encode(stream, encodedSCPStatementConfirm.NCommit); - Uint32.Encode(stream, encodedSCPStatementConfirm.NH); - Hash.Encode(stream, encodedSCPStatementConfirm.QuorumSetHash); - } - public static SCPStatementConfirm Decode(XdrDataInputStream stream) - { - SCPStatementConfirm decodedSCPStatementConfirm = new SCPStatementConfirm(); - decodedSCPStatementConfirm.Ballot = SCPBallot.Decode(stream); - decodedSCPStatementConfirm.NPrepared = Uint32.Decode(stream); - decodedSCPStatementConfirm.NCommit = Uint32.Decode(stream); - decodedSCPStatementConfirm.NH = Uint32.Decode(stream); - decodedSCPStatementConfirm.QuorumSetHash = Hash.Decode(stream); - return decodedSCPStatementConfirm; - } + var decodedSCPStatementPrepare = new SCPStatementPrepare(); + decodedSCPStatementPrepare.QuorumSetHash = Hash.Decode(stream); + decodedSCPStatementPrepare.Ballot = SCPBallot.Decode(stream); + var PreparedPresent = stream.ReadInt(); + if (PreparedPresent != 0) decodedSCPStatementPrepare.Prepared = SCPBallot.Decode(stream); + var PreparedPrimePresent = stream.ReadInt(); + if (PreparedPrimePresent != 0) decodedSCPStatementPrepare.PreparedPrime = SCPBallot.Decode(stream); + decodedSCPStatementPrepare.NC = Uint32.Decode(stream); + decodedSCPStatementPrepare.NH = Uint32.Decode(stream); + return decodedSCPStatementPrepare; + } + } + public class SCPStatementConfirm + { + public SCPBallot Ballot { get; set; } + public Uint32 NPrepared { get; set; } + public Uint32 NCommit { get; set; } + public Uint32 NH { get; set; } + public Hash QuorumSetHash { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCPStatementConfirm encodedSCPStatementConfirm) + { + SCPBallot.Encode(stream, encodedSCPStatementConfirm.Ballot); + Uint32.Encode(stream, encodedSCPStatementConfirm.NPrepared); + Uint32.Encode(stream, encodedSCPStatementConfirm.NCommit); + Uint32.Encode(stream, encodedSCPStatementConfirm.NH); + Hash.Encode(stream, encodedSCPStatementConfirm.QuorumSetHash); } - public class SCPStatementExternalize + + public static SCPStatementConfirm Decode(XdrDataInputStream stream) { - public SCPStatementExternalize() { } - public SCPBallot Commit { get; set; } - public Uint32 NH { get; set; } - public Hash CommitQuorumSetHash { get; set; } + var decodedSCPStatementConfirm = new SCPStatementConfirm(); + decodedSCPStatementConfirm.Ballot = SCPBallot.Decode(stream); + decodedSCPStatementConfirm.NPrepared = Uint32.Decode(stream); + decodedSCPStatementConfirm.NCommit = Uint32.Decode(stream); + decodedSCPStatementConfirm.NH = Uint32.Decode(stream); + decodedSCPStatementConfirm.QuorumSetHash = Hash.Decode(stream); + return decodedSCPStatementConfirm; + } + } - public static void Encode(XdrDataOutputStream stream, SCPStatementExternalize encodedSCPStatementExternalize) - { - SCPBallot.Encode(stream, encodedSCPStatementExternalize.Commit); - Uint32.Encode(stream, encodedSCPStatementExternalize.NH); - Hash.Encode(stream, encodedSCPStatementExternalize.CommitQuorumSetHash); - } - public static SCPStatementExternalize Decode(XdrDataInputStream stream) - { - SCPStatementExternalize decodedSCPStatementExternalize = new SCPStatementExternalize(); - decodedSCPStatementExternalize.Commit = SCPBallot.Decode(stream); - decodedSCPStatementExternalize.NH = Uint32.Decode(stream); - decodedSCPStatementExternalize.CommitQuorumSetHash = Hash.Decode(stream); - return decodedSCPStatementExternalize; - } + public class SCPStatementExternalize + { + public SCPBallot Commit { get; set; } + public Uint32 NH { get; set; } + public Hash CommitQuorumSetHash { get; set; } + public static void Encode(XdrDataOutputStream stream, + SCPStatementExternalize encodedSCPStatementExternalize) + { + SCPBallot.Encode(stream, encodedSCPStatementExternalize.Commit); + Uint32.Encode(stream, encodedSCPStatementExternalize.NH); + Hash.Encode(stream, encodedSCPStatementExternalize.CommitQuorumSetHash); + } + + public static SCPStatementExternalize Decode(XdrDataInputStream stream) + { + var decodedSCPStatementExternalize = new SCPStatementExternalize(); + decodedSCPStatementExternalize.Commit = SCPBallot.Decode(stream); + decodedSCPStatementExternalize.NH = Uint32.Decode(stream); + decodedSCPStatementExternalize.CommitQuorumSetHash = Hash.Decode(stream); + return decodedSCPStatementExternalize; } } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCPStatementType.cs b/stellar-dotnet-sdk-xdr/generated/SCPStatementType.cs index a022cb4b..4ba079af 100644 --- a/stellar-dotnet-sdk-xdr/generated/SCPStatementType.cs +++ b/stellar-dotnet-sdk-xdr/generated/SCPStatementType.cs @@ -1,57 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum SCPStatementType - // { - // SCP_ST_PREPARE = 0, - // SCP_ST_CONFIRM = 1, - // SCP_ST_EXTERNALIZE = 2, - // SCP_ST_NOMINATE = 3 - // }; +// enum SCPStatementType +// { +// SCP_ST_PREPARE = 0, +// SCP_ST_CONFIRM = 1, +// SCP_ST_EXTERNALIZE = 2, +// SCP_ST_NOMINATE = 3 +// }; - // =========================================================================== - public class SCPStatementType +// =========================================================================== +public class SCPStatementType +{ + public enum SCPStatementTypeEnum { - public enum SCPStatementTypeEnum - { - SCP_ST_PREPARE = 0, - SCP_ST_CONFIRM = 1, - SCP_ST_EXTERNALIZE = 2, - SCP_ST_NOMINATE = 3, - } - public SCPStatementTypeEnum InnerValue { get; set; } = default(SCPStatementTypeEnum); + SCP_ST_PREPARE = 0, + SCP_ST_CONFIRM = 1, + SCP_ST_EXTERNALIZE = 2, + SCP_ST_NOMINATE = 3 + } - public static SCPStatementType Create(SCPStatementTypeEnum v) - { - return new SCPStatementType - { - InnerValue = v - }; - } + public SCPStatementTypeEnum InnerValue { get; set; } = default; - public static SCPStatementType Decode(XdrDataInputStream stream) + public static SCPStatementType Create(SCPStatementTypeEnum v) + { + return new SCPStatementType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(SCPStatementTypeEnum.SCP_ST_PREPARE); - case 1: return Create(SCPStatementTypeEnum.SCP_ST_CONFIRM); - case 2: return Create(SCPStatementTypeEnum.SCP_ST_EXTERNALIZE); - case 3: return Create(SCPStatementTypeEnum.SCP_ST_NOMINATE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, SCPStatementType value) + public static SCPStatementType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(SCPStatementTypeEnum.SCP_ST_PREPARE); + case 1: return Create(SCPStatementTypeEnum.SCP_ST_CONFIRM); + case 2: return Create(SCPStatementTypeEnum.SCP_ST_EXTERNALIZE); + case 3: return Create(SCPStatementTypeEnum.SCP_ST_NOMINATE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, SCPStatementType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecEntry.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecEntry.cs new file mode 100644 index 00000000..390a9969 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecEntry.cs @@ -0,0 +1,82 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SCSpecEntry switch (SCSpecEntryKind kind) +// { +// case SC_SPEC_ENTRY_FUNCTION_V0: +// SCSpecFunctionV0 functionV0; +// case SC_SPEC_ENTRY_UDT_STRUCT_V0: +// SCSpecUDTStructV0 udtStructV0; +// case SC_SPEC_ENTRY_UDT_UNION_V0: +// SCSpecUDTUnionV0 udtUnionV0; +// case SC_SPEC_ENTRY_UDT_ENUM_V0: +// SCSpecUDTEnumV0 udtEnumV0; +// case SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0: +// SCSpecUDTErrorEnumV0 udtErrorEnumV0; +// }; + +// =========================================================================== +public class SCSpecEntry +{ + public SCSpecEntryKind Discriminant { get; set; } = new(); + + public SCSpecFunctionV0 FunctionV0 { get; set; } + public SCSpecUDTStructV0 UdtStructV0 { get; set; } + public SCSpecUDTUnionV0 UdtUnionV0 { get; set; } + public SCSpecUDTEnumV0 UdtEnumV0 { get; set; } + public SCSpecUDTErrorEnumV0 UdtErrorEnumV0 { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecEntry encodedSCSpecEntry) + { + stream.WriteInt((int)encodedSCSpecEntry.Discriminant.InnerValue); + switch (encodedSCSpecEntry.Discriminant.InnerValue) + { + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_FUNCTION_V0: + SCSpecFunctionV0.Encode(stream, encodedSCSpecEntry.FunctionV0); + break; + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_STRUCT_V0: + SCSpecUDTStructV0.Encode(stream, encodedSCSpecEntry.UdtStructV0); + break; + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_UNION_V0: + SCSpecUDTUnionV0.Encode(stream, encodedSCSpecEntry.UdtUnionV0); + break; + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_ENUM_V0: + SCSpecUDTEnumV0.Encode(stream, encodedSCSpecEntry.UdtEnumV0); + break; + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0: + SCSpecUDTErrorEnumV0.Encode(stream, encodedSCSpecEntry.UdtErrorEnumV0); + break; + } + } + + public static SCSpecEntry Decode(XdrDataInputStream stream) + { + var decodedSCSpecEntry = new SCSpecEntry(); + var discriminant = SCSpecEntryKind.Decode(stream); + decodedSCSpecEntry.Discriminant = discriminant; + switch (decodedSCSpecEntry.Discriminant.InnerValue) + { + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_FUNCTION_V0: + decodedSCSpecEntry.FunctionV0 = SCSpecFunctionV0.Decode(stream); + break; + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_STRUCT_V0: + decodedSCSpecEntry.UdtStructV0 = SCSpecUDTStructV0.Decode(stream); + break; + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_UNION_V0: + decodedSCSpecEntry.UdtUnionV0 = SCSpecUDTUnionV0.Decode(stream); + break; + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_ENUM_V0: + decodedSCSpecEntry.UdtEnumV0 = SCSpecUDTEnumV0.Decode(stream); + break; + case SCSpecEntryKind.SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0: + decodedSCSpecEntry.UdtErrorEnumV0 = SCSpecUDTErrorEnumV0.Decode(stream); + break; + } + + return decodedSCSpecEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecEntryKind.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecEntryKind.cs new file mode 100644 index 00000000..5c6cb343 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecEntryKind.cs @@ -0,0 +1,60 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCSpecEntryKind +// { +// SC_SPEC_ENTRY_FUNCTION_V0 = 0, +// SC_SPEC_ENTRY_UDT_STRUCT_V0 = 1, +// SC_SPEC_ENTRY_UDT_UNION_V0 = 2, +// SC_SPEC_ENTRY_UDT_ENUM_V0 = 3, +// SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0 = 4 +// }; + +// =========================================================================== +public class SCSpecEntryKind +{ + public enum SCSpecEntryKindEnum + { + SC_SPEC_ENTRY_FUNCTION_V0 = 0, + SC_SPEC_ENTRY_UDT_STRUCT_V0 = 1, + SC_SPEC_ENTRY_UDT_UNION_V0 = 2, + SC_SPEC_ENTRY_UDT_ENUM_V0 = 3, + SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0 = 4 + } + + public SCSpecEntryKindEnum InnerValue { get; set; } = default; + + public static SCSpecEntryKind Create(SCSpecEntryKindEnum v) + { + return new SCSpecEntryKind + { + InnerValue = v + }; + } + + public static SCSpecEntryKind Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCSpecEntryKindEnum.SC_SPEC_ENTRY_FUNCTION_V0); + case 1: return Create(SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_STRUCT_V0); + case 2: return Create(SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_UNION_V0); + case 3: return Create(SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_ENUM_V0); + case 4: return Create(SCSpecEntryKindEnum.SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCSpecEntryKind value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecFunctionInputV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecFunctionInputV0.cs new file mode 100644 index 00000000..107716ae --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecFunctionInputV0.cs @@ -0,0 +1,37 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecFunctionInputV0 +// { +// string doc; +// string name<30>; +// SCSpecTypeDef type; +// }; + +// =========================================================================== +public class SCSpecFunctionInputV0 +{ + public string Doc { get; set; } + public string Name { get; set; } + public SCSpecTypeDef Type { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecFunctionInputV0 encodedSCSpecFunctionInputV0) + { + stream.WriteString(encodedSCSpecFunctionInputV0.Doc); + stream.WriteString(encodedSCSpecFunctionInputV0.Name); + SCSpecTypeDef.Encode(stream, encodedSCSpecFunctionInputV0.Type); + } + + public static SCSpecFunctionInputV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecFunctionInputV0 = new SCSpecFunctionInputV0(); + decodedSCSpecFunctionInputV0.Doc = stream.ReadString(); + decodedSCSpecFunctionInputV0.Name = stream.ReadString(); + decodedSCSpecFunctionInputV0.Type = SCSpecTypeDef.Decode(stream); + return decodedSCSpecFunctionInputV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecFunctionV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecFunctionV0.cs new file mode 100644 index 00000000..034cddd2 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecFunctionV0.cs @@ -0,0 +1,49 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecFunctionV0 +// { +// string doc; +// SCSymbol name; +// SCSpecFunctionInputV0 inputs<10>; +// SCSpecTypeDef outputs<1>; +// }; + +// =========================================================================== +public class SCSpecFunctionV0 +{ + public string Doc { get; set; } + public SCSymbol Name { get; set; } + public SCSpecFunctionInputV0[] Inputs { get; set; } + public SCSpecTypeDef[] Outputs { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecFunctionV0 encodedSCSpecFunctionV0) + { + stream.WriteString(encodedSCSpecFunctionV0.Doc); + SCSymbol.Encode(stream, encodedSCSpecFunctionV0.Name); + var inputssize = encodedSCSpecFunctionV0.Inputs.Length; + stream.WriteInt(inputssize); + for (var i = 0; i < inputssize; i++) SCSpecFunctionInputV0.Encode(stream, encodedSCSpecFunctionV0.Inputs[i]); + var outputssize = encodedSCSpecFunctionV0.Outputs.Length; + stream.WriteInt(outputssize); + for (var i = 0; i < outputssize; i++) SCSpecTypeDef.Encode(stream, encodedSCSpecFunctionV0.Outputs[i]); + } + + public static SCSpecFunctionV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecFunctionV0 = new SCSpecFunctionV0(); + decodedSCSpecFunctionV0.Doc = stream.ReadString(); + decodedSCSpecFunctionV0.Name = SCSymbol.Decode(stream); + var inputssize = stream.ReadInt(); + decodedSCSpecFunctionV0.Inputs = new SCSpecFunctionInputV0[inputssize]; + for (var i = 0; i < inputssize; i++) decodedSCSpecFunctionV0.Inputs[i] = SCSpecFunctionInputV0.Decode(stream); + var outputssize = stream.ReadInt(); + decodedSCSpecFunctionV0.Outputs = new SCSpecTypeDef[outputssize]; + for (var i = 0; i < outputssize; i++) decodedSCSpecFunctionV0.Outputs[i] = SCSpecTypeDef.Decode(stream); + return decodedSCSpecFunctionV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecType.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecType.cs new file mode 100644 index 00000000..dd8dbf4b --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecType.cs @@ -0,0 +1,126 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCSpecType +// { +// SC_SPEC_TYPE_VAL = 0, +// +// // Types with no parameters. +// SC_SPEC_TYPE_BOOL = 1, +// SC_SPEC_TYPE_VOID = 2, +// SC_SPEC_TYPE_ERROR = 3, +// SC_SPEC_TYPE_U32 = 4, +// SC_SPEC_TYPE_I32 = 5, +// SC_SPEC_TYPE_U64 = 6, +// SC_SPEC_TYPE_I64 = 7, +// SC_SPEC_TYPE_TIMEPOINT = 8, +// SC_SPEC_TYPE_DURATION = 9, +// SC_SPEC_TYPE_U128 = 10, +// SC_SPEC_TYPE_I128 = 11, +// SC_SPEC_TYPE_U256 = 12, +// SC_SPEC_TYPE_I256 = 13, +// SC_SPEC_TYPE_BYTES = 14, +// SC_SPEC_TYPE_STRING = 16, +// SC_SPEC_TYPE_SYMBOL = 17, +// SC_SPEC_TYPE_ADDRESS = 19, +// +// // Types with parameters. +// SC_SPEC_TYPE_OPTION = 1000, +// SC_SPEC_TYPE_RESULT = 1001, +// SC_SPEC_TYPE_VEC = 1002, +// SC_SPEC_TYPE_MAP = 1004, +// SC_SPEC_TYPE_TUPLE = 1005, +// SC_SPEC_TYPE_BYTES_N = 1006, +// +// // User defined types. +// SC_SPEC_TYPE_UDT = 2000 +// }; + +// =========================================================================== +public class SCSpecType +{ + public enum SCSpecTypeEnum + { + SC_SPEC_TYPE_VAL = 0, + SC_SPEC_TYPE_BOOL = 1, + SC_SPEC_TYPE_VOID = 2, + SC_SPEC_TYPE_ERROR = 3, + SC_SPEC_TYPE_U32 = 4, + SC_SPEC_TYPE_I32 = 5, + SC_SPEC_TYPE_U64 = 6, + SC_SPEC_TYPE_I64 = 7, + SC_SPEC_TYPE_TIMEPOINT = 8, + SC_SPEC_TYPE_DURATION = 9, + SC_SPEC_TYPE_U128 = 10, + SC_SPEC_TYPE_I128 = 11, + SC_SPEC_TYPE_U256 = 12, + SC_SPEC_TYPE_I256 = 13, + SC_SPEC_TYPE_BYTES = 14, + SC_SPEC_TYPE_STRING = 16, + SC_SPEC_TYPE_SYMBOL = 17, + SC_SPEC_TYPE_ADDRESS = 19, + SC_SPEC_TYPE_OPTION = 1000, + SC_SPEC_TYPE_RESULT = 1001, + SC_SPEC_TYPE_VEC = 1002, + SC_SPEC_TYPE_MAP = 1004, + SC_SPEC_TYPE_TUPLE = 1005, + SC_SPEC_TYPE_BYTES_N = 1006, + SC_SPEC_TYPE_UDT = 2000 + } + + public SCSpecTypeEnum InnerValue { get; set; } = default; + + public static SCSpecType Create(SCSpecTypeEnum v) + { + return new SCSpecType + { + InnerValue = v + }; + } + + public static SCSpecType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_VAL); + case 1: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_BOOL); + case 2: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_VOID); + case 3: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_ERROR); + case 4: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_U32); + case 5: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_I32); + case 6: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_U64); + case 7: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_I64); + case 8: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_TIMEPOINT); + case 9: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_DURATION); + case 10: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_U128); + case 11: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_I128); + case 12: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_U256); + case 13: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_I256); + case 14: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_BYTES); + case 16: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_STRING); + case 17: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_SYMBOL); + case 19: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_ADDRESS); + case 1000: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_OPTION); + case 1001: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_RESULT); + case 1002: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_VEC); + case 1004: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_MAP); + case 1005: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_TUPLE); + case 1006: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_BYTES_N); + case 2000: return Create(SCSpecTypeEnum.SC_SPEC_TYPE_UDT); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCSpecType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecTypeBytesN.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeBytesN.cs new file mode 100644 index 00000000..63bdeb26 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeBytesN.cs @@ -0,0 +1,29 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecTypeBytesN +// { +// uint32 n; +// }; + +// =========================================================================== +public class SCSpecTypeBytesN +{ + public Uint32 N { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecTypeBytesN encodedSCSpecTypeBytesN) + { + Uint32.Encode(stream, encodedSCSpecTypeBytesN.N); + } + + public static SCSpecTypeBytesN Decode(XdrDataInputStream stream) + { + var decodedSCSpecTypeBytesN = new SCSpecTypeBytesN(); + decodedSCSpecTypeBytesN.N = Uint32.Decode(stream); + return decodedSCSpecTypeBytesN; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecTypeDef.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeDef.cs new file mode 100644 index 00000000..bc92514b --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeDef.cs @@ -0,0 +1,157 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SCSpecTypeDef switch (SCSpecType type) +// { +// case SC_SPEC_TYPE_VAL: +// case SC_SPEC_TYPE_BOOL: +// case SC_SPEC_TYPE_VOID: +// case SC_SPEC_TYPE_ERROR: +// case SC_SPEC_TYPE_U32: +// case SC_SPEC_TYPE_I32: +// case SC_SPEC_TYPE_U64: +// case SC_SPEC_TYPE_I64: +// case SC_SPEC_TYPE_TIMEPOINT: +// case SC_SPEC_TYPE_DURATION: +// case SC_SPEC_TYPE_U128: +// case SC_SPEC_TYPE_I128: +// case SC_SPEC_TYPE_U256: +// case SC_SPEC_TYPE_I256: +// case SC_SPEC_TYPE_BYTES: +// case SC_SPEC_TYPE_STRING: +// case SC_SPEC_TYPE_SYMBOL: +// case SC_SPEC_TYPE_ADDRESS: +// void; +// case SC_SPEC_TYPE_OPTION: +// SCSpecTypeOption option; +// case SC_SPEC_TYPE_RESULT: +// SCSpecTypeResult result; +// case SC_SPEC_TYPE_VEC: +// SCSpecTypeVec vec; +// case SC_SPEC_TYPE_MAP: +// SCSpecTypeMap map; +// case SC_SPEC_TYPE_TUPLE: +// SCSpecTypeTuple tuple; +// case SC_SPEC_TYPE_BYTES_N: +// SCSpecTypeBytesN bytesN; +// case SC_SPEC_TYPE_UDT: +// SCSpecTypeUDT udt; +// }; + +// =========================================================================== +public class SCSpecTypeDef +{ + public SCSpecType Discriminant { get; set; } = new(); + + public SCSpecTypeOption Option { get; set; } + public SCSpecTypeResult Result { get; set; } + public SCSpecTypeVec Vec { get; set; } + public SCSpecTypeMap Map { get; set; } + public SCSpecTypeTuple Tuple { get; set; } + public SCSpecTypeBytesN BytesN { get; set; } + public SCSpecTypeUDT Udt { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecTypeDef encodedSCSpecTypeDef) + { + stream.WriteInt((int)encodedSCSpecTypeDef.Discriminant.InnerValue); + switch (encodedSCSpecTypeDef.Discriminant.InnerValue) + { + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_VAL: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_BOOL: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_VOID: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_ERROR: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_U32: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_I32: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_U64: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_I64: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_TIMEPOINT: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_DURATION: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_U128: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_I128: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_U256: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_I256: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_BYTES: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_STRING: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_SYMBOL: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_ADDRESS: + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_OPTION: + SCSpecTypeOption.Encode(stream, encodedSCSpecTypeDef.Option); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_RESULT: + SCSpecTypeResult.Encode(stream, encodedSCSpecTypeDef.Result); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_VEC: + SCSpecTypeVec.Encode(stream, encodedSCSpecTypeDef.Vec); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_MAP: + SCSpecTypeMap.Encode(stream, encodedSCSpecTypeDef.Map); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_TUPLE: + SCSpecTypeTuple.Encode(stream, encodedSCSpecTypeDef.Tuple); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_BYTES_N: + SCSpecTypeBytesN.Encode(stream, encodedSCSpecTypeDef.BytesN); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_UDT: + SCSpecTypeUDT.Encode(stream, encodedSCSpecTypeDef.Udt); + break; + } + } + + public static SCSpecTypeDef Decode(XdrDataInputStream stream) + { + var decodedSCSpecTypeDef = new SCSpecTypeDef(); + var discriminant = SCSpecType.Decode(stream); + decodedSCSpecTypeDef.Discriminant = discriminant; + switch (decodedSCSpecTypeDef.Discriminant.InnerValue) + { + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_VAL: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_BOOL: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_VOID: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_ERROR: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_U32: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_I32: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_U64: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_I64: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_TIMEPOINT: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_DURATION: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_U128: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_I128: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_U256: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_I256: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_BYTES: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_STRING: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_SYMBOL: + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_ADDRESS: + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_OPTION: + decodedSCSpecTypeDef.Option = SCSpecTypeOption.Decode(stream); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_RESULT: + decodedSCSpecTypeDef.Result = SCSpecTypeResult.Decode(stream); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_VEC: + decodedSCSpecTypeDef.Vec = SCSpecTypeVec.Decode(stream); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_MAP: + decodedSCSpecTypeDef.Map = SCSpecTypeMap.Decode(stream); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_TUPLE: + decodedSCSpecTypeDef.Tuple = SCSpecTypeTuple.Decode(stream); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_BYTES_N: + decodedSCSpecTypeDef.BytesN = SCSpecTypeBytesN.Decode(stream); + break; + case SCSpecType.SCSpecTypeEnum.SC_SPEC_TYPE_UDT: + decodedSCSpecTypeDef.Udt = SCSpecTypeUDT.Decode(stream); + break; + } + + return decodedSCSpecTypeDef; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecTypeMap.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeMap.cs new file mode 100644 index 00000000..42ea4d48 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeMap.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecTypeMap +// { +// SCSpecTypeDef keyType; +// SCSpecTypeDef valueType; +// }; + +// =========================================================================== +public class SCSpecTypeMap +{ + public SCSpecTypeDef KeyType { get; set; } + public SCSpecTypeDef ValueType { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecTypeMap encodedSCSpecTypeMap) + { + SCSpecTypeDef.Encode(stream, encodedSCSpecTypeMap.KeyType); + SCSpecTypeDef.Encode(stream, encodedSCSpecTypeMap.ValueType); + } + + public static SCSpecTypeMap Decode(XdrDataInputStream stream) + { + var decodedSCSpecTypeMap = new SCSpecTypeMap(); + decodedSCSpecTypeMap.KeyType = SCSpecTypeDef.Decode(stream); + decodedSCSpecTypeMap.ValueType = SCSpecTypeDef.Decode(stream); + return decodedSCSpecTypeMap; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecTypeOption.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeOption.cs new file mode 100644 index 00000000..d317f467 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeOption.cs @@ -0,0 +1,29 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecTypeOption +// { +// SCSpecTypeDef valueType; +// }; + +// =========================================================================== +public class SCSpecTypeOption +{ + public SCSpecTypeDef ValueType { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecTypeOption encodedSCSpecTypeOption) + { + SCSpecTypeDef.Encode(stream, encodedSCSpecTypeOption.ValueType); + } + + public static SCSpecTypeOption Decode(XdrDataInputStream stream) + { + var decodedSCSpecTypeOption = new SCSpecTypeOption(); + decodedSCSpecTypeOption.ValueType = SCSpecTypeDef.Decode(stream); + return decodedSCSpecTypeOption; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecTypeResult.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeResult.cs new file mode 100644 index 00000000..ebd5c7e9 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeResult.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecTypeResult +// { +// SCSpecTypeDef okType; +// SCSpecTypeDef errorType; +// }; + +// =========================================================================== +public class SCSpecTypeResult +{ + public SCSpecTypeDef OkType { get; set; } + public SCSpecTypeDef ErrorType { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecTypeResult encodedSCSpecTypeResult) + { + SCSpecTypeDef.Encode(stream, encodedSCSpecTypeResult.OkType); + SCSpecTypeDef.Encode(stream, encodedSCSpecTypeResult.ErrorType); + } + + public static SCSpecTypeResult Decode(XdrDataInputStream stream) + { + var decodedSCSpecTypeResult = new SCSpecTypeResult(); + decodedSCSpecTypeResult.OkType = SCSpecTypeDef.Decode(stream); + decodedSCSpecTypeResult.ErrorType = SCSpecTypeDef.Decode(stream); + return decodedSCSpecTypeResult; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecTypeTuple.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeTuple.cs new file mode 100644 index 00000000..302ad189 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeTuple.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecTypeTuple +// { +// SCSpecTypeDef valueTypes<12>; +// }; + +// =========================================================================== +public class SCSpecTypeTuple +{ + public SCSpecTypeDef[] ValueTypes { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecTypeTuple encodedSCSpecTypeTuple) + { + var valueTypessize = encodedSCSpecTypeTuple.ValueTypes.Length; + stream.WriteInt(valueTypessize); + for (var i = 0; i < valueTypessize; i++) SCSpecTypeDef.Encode(stream, encodedSCSpecTypeTuple.ValueTypes[i]); + } + + public static SCSpecTypeTuple Decode(XdrDataInputStream stream) + { + var decodedSCSpecTypeTuple = new SCSpecTypeTuple(); + var valueTypessize = stream.ReadInt(); + decodedSCSpecTypeTuple.ValueTypes = new SCSpecTypeDef[valueTypessize]; + for (var i = 0; i < valueTypessize; i++) decodedSCSpecTypeTuple.ValueTypes[i] = SCSpecTypeDef.Decode(stream); + return decodedSCSpecTypeTuple; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecTypeUDT.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeUDT.cs new file mode 100644 index 00000000..415de376 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeUDT.cs @@ -0,0 +1,29 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecTypeUDT +// { +// string name<60>; +// }; + +// =========================================================================== +public class SCSpecTypeUDT +{ + public string Name { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecTypeUDT encodedSCSpecTypeUDT) + { + stream.WriteString(encodedSCSpecTypeUDT.Name); + } + + public static SCSpecTypeUDT Decode(XdrDataInputStream stream) + { + var decodedSCSpecTypeUDT = new SCSpecTypeUDT(); + decodedSCSpecTypeUDT.Name = stream.ReadString(); + return decodedSCSpecTypeUDT; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecTypeVec.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeVec.cs new file mode 100644 index 00000000..0134273d --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecTypeVec.cs @@ -0,0 +1,29 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecTypeVec +// { +// SCSpecTypeDef elementType; +// }; + +// =========================================================================== +public class SCSpecTypeVec +{ + public SCSpecTypeDef ElementType { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecTypeVec encodedSCSpecTypeVec) + { + SCSpecTypeDef.Encode(stream, encodedSCSpecTypeVec.ElementType); + } + + public static SCSpecTypeVec Decode(XdrDataInputStream stream) + { + var decodedSCSpecTypeVec = new SCSpecTypeVec(); + decodedSCSpecTypeVec.ElementType = SCSpecTypeDef.Decode(stream); + return decodedSCSpecTypeVec; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTEnumCaseV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTEnumCaseV0.cs new file mode 100644 index 00000000..d3e6e188 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTEnumCaseV0.cs @@ -0,0 +1,37 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTEnumCaseV0 +// { +// string doc; +// string name<60>; +// uint32 value; +// }; + +// =========================================================================== +public class SCSpecUDTEnumCaseV0 +{ + public string Doc { get; set; } + public string Name { get; set; } + public Uint32 Value { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTEnumCaseV0 encodedSCSpecUDTEnumCaseV0) + { + stream.WriteString(encodedSCSpecUDTEnumCaseV0.Doc); + stream.WriteString(encodedSCSpecUDTEnumCaseV0.Name); + Uint32.Encode(stream, encodedSCSpecUDTEnumCaseV0.Value); + } + + public static SCSpecUDTEnumCaseV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTEnumCaseV0 = new SCSpecUDTEnumCaseV0(); + decodedSCSpecUDTEnumCaseV0.Doc = stream.ReadString(); + decodedSCSpecUDTEnumCaseV0.Name = stream.ReadString(); + decodedSCSpecUDTEnumCaseV0.Value = Uint32.Decode(stream); + return decodedSCSpecUDTEnumCaseV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTEnumV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTEnumV0.cs new file mode 100644 index 00000000..7eb2e34c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTEnumV0.cs @@ -0,0 +1,45 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTEnumV0 +// { +// string doc; +// string lib<80>; +// string name<60>; +// SCSpecUDTEnumCaseV0 cases<50>; +// }; + +// =========================================================================== +public class SCSpecUDTEnumV0 +{ + public string Doc { get; set; } + public string Lib { get; set; } + public string Name { get; set; } + public SCSpecUDTEnumCaseV0[] Cases { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTEnumV0 encodedSCSpecUDTEnumV0) + { + stream.WriteString(encodedSCSpecUDTEnumV0.Doc); + stream.WriteString(encodedSCSpecUDTEnumV0.Lib); + stream.WriteString(encodedSCSpecUDTEnumV0.Name); + var casessize = encodedSCSpecUDTEnumV0.Cases.Length; + stream.WriteInt(casessize); + for (var i = 0; i < casessize; i++) SCSpecUDTEnumCaseV0.Encode(stream, encodedSCSpecUDTEnumV0.Cases[i]); + } + + public static SCSpecUDTEnumV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTEnumV0 = new SCSpecUDTEnumV0(); + decodedSCSpecUDTEnumV0.Doc = stream.ReadString(); + decodedSCSpecUDTEnumV0.Lib = stream.ReadString(); + decodedSCSpecUDTEnumV0.Name = stream.ReadString(); + var casessize = stream.ReadInt(); + decodedSCSpecUDTEnumV0.Cases = new SCSpecUDTEnumCaseV0[casessize]; + for (var i = 0; i < casessize; i++) decodedSCSpecUDTEnumV0.Cases[i] = SCSpecUDTEnumCaseV0.Decode(stream); + return decodedSCSpecUDTEnumV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTErrorEnumCaseV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTErrorEnumCaseV0.cs new file mode 100644 index 00000000..81780e8c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTErrorEnumCaseV0.cs @@ -0,0 +1,37 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTErrorEnumCaseV0 +// { +// string doc; +// string name<60>; +// uint32 value; +// }; + +// =========================================================================== +public class SCSpecUDTErrorEnumCaseV0 +{ + public string Doc { get; set; } + public string Name { get; set; } + public Uint32 Value { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTErrorEnumCaseV0 encodedSCSpecUDTErrorEnumCaseV0) + { + stream.WriteString(encodedSCSpecUDTErrorEnumCaseV0.Doc); + stream.WriteString(encodedSCSpecUDTErrorEnumCaseV0.Name); + Uint32.Encode(stream, encodedSCSpecUDTErrorEnumCaseV0.Value); + } + + public static SCSpecUDTErrorEnumCaseV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTErrorEnumCaseV0 = new SCSpecUDTErrorEnumCaseV0(); + decodedSCSpecUDTErrorEnumCaseV0.Doc = stream.ReadString(); + decodedSCSpecUDTErrorEnumCaseV0.Name = stream.ReadString(); + decodedSCSpecUDTErrorEnumCaseV0.Value = Uint32.Decode(stream); + return decodedSCSpecUDTErrorEnumCaseV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTErrorEnumV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTErrorEnumV0.cs new file mode 100644 index 00000000..c4373534 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTErrorEnumV0.cs @@ -0,0 +1,47 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTErrorEnumV0 +// { +// string doc; +// string lib<80>; +// string name<60>; +// SCSpecUDTErrorEnumCaseV0 cases<50>; +// }; + +// =========================================================================== +public class SCSpecUDTErrorEnumV0 +{ + public string Doc { get; set; } + public string Lib { get; set; } + public string Name { get; set; } + public SCSpecUDTErrorEnumCaseV0[] Cases { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTErrorEnumV0 encodedSCSpecUDTErrorEnumV0) + { + stream.WriteString(encodedSCSpecUDTErrorEnumV0.Doc); + stream.WriteString(encodedSCSpecUDTErrorEnumV0.Lib); + stream.WriteString(encodedSCSpecUDTErrorEnumV0.Name); + var casessize = encodedSCSpecUDTErrorEnumV0.Cases.Length; + stream.WriteInt(casessize); + for (var i = 0; i < casessize; i++) + SCSpecUDTErrorEnumCaseV0.Encode(stream, encodedSCSpecUDTErrorEnumV0.Cases[i]); + } + + public static SCSpecUDTErrorEnumV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTErrorEnumV0 = new SCSpecUDTErrorEnumV0(); + decodedSCSpecUDTErrorEnumV0.Doc = stream.ReadString(); + decodedSCSpecUDTErrorEnumV0.Lib = stream.ReadString(); + decodedSCSpecUDTErrorEnumV0.Name = stream.ReadString(); + var casessize = stream.ReadInt(); + decodedSCSpecUDTErrorEnumV0.Cases = new SCSpecUDTErrorEnumCaseV0[casessize]; + for (var i = 0; i < casessize; i++) + decodedSCSpecUDTErrorEnumV0.Cases[i] = SCSpecUDTErrorEnumCaseV0.Decode(stream); + return decodedSCSpecUDTErrorEnumV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTStructFieldV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTStructFieldV0.cs new file mode 100644 index 00000000..a6e43d51 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTStructFieldV0.cs @@ -0,0 +1,37 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTStructFieldV0 +// { +// string doc; +// string name<30>; +// SCSpecTypeDef type; +// }; + +// =========================================================================== +public class SCSpecUDTStructFieldV0 +{ + public string Doc { get; set; } + public string Name { get; set; } + public SCSpecTypeDef Type { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTStructFieldV0 encodedSCSpecUDTStructFieldV0) + { + stream.WriteString(encodedSCSpecUDTStructFieldV0.Doc); + stream.WriteString(encodedSCSpecUDTStructFieldV0.Name); + SCSpecTypeDef.Encode(stream, encodedSCSpecUDTStructFieldV0.Type); + } + + public static SCSpecUDTStructFieldV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTStructFieldV0 = new SCSpecUDTStructFieldV0(); + decodedSCSpecUDTStructFieldV0.Doc = stream.ReadString(); + decodedSCSpecUDTStructFieldV0.Name = stream.ReadString(); + decodedSCSpecUDTStructFieldV0.Type = SCSpecTypeDef.Decode(stream); + return decodedSCSpecUDTStructFieldV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTStructV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTStructV0.cs new file mode 100644 index 00000000..6bebaac3 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTStructV0.cs @@ -0,0 +1,45 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTStructV0 +// { +// string doc; +// string lib<80>; +// string name<60>; +// SCSpecUDTStructFieldV0 fields<40>; +// }; + +// =========================================================================== +public class SCSpecUDTStructV0 +{ + public string Doc { get; set; } + public string Lib { get; set; } + public string Name { get; set; } + public SCSpecUDTStructFieldV0[] Fields { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTStructV0 encodedSCSpecUDTStructV0) + { + stream.WriteString(encodedSCSpecUDTStructV0.Doc); + stream.WriteString(encodedSCSpecUDTStructV0.Lib); + stream.WriteString(encodedSCSpecUDTStructV0.Name); + var fieldssize = encodedSCSpecUDTStructV0.Fields.Length; + stream.WriteInt(fieldssize); + for (var i = 0; i < fieldssize; i++) SCSpecUDTStructFieldV0.Encode(stream, encodedSCSpecUDTStructV0.Fields[i]); + } + + public static SCSpecUDTStructV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTStructV0 = new SCSpecUDTStructV0(); + decodedSCSpecUDTStructV0.Doc = stream.ReadString(); + decodedSCSpecUDTStructV0.Lib = stream.ReadString(); + decodedSCSpecUDTStructV0.Name = stream.ReadString(); + var fieldssize = stream.ReadInt(); + decodedSCSpecUDTStructV0.Fields = new SCSpecUDTStructFieldV0[fieldssize]; + for (var i = 0; i < fieldssize; i++) decodedSCSpecUDTStructV0.Fields[i] = SCSpecUDTStructFieldV0.Decode(stream); + return decodedSCSpecUDTStructV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseTupleV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseTupleV0.cs new file mode 100644 index 00000000..4b70e561 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseTupleV0.cs @@ -0,0 +1,41 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTUnionCaseTupleV0 +// { +// string doc; +// string name<60>; +// SCSpecTypeDef type<12>; +// }; + +// =========================================================================== +public class SCSpecUDTUnionCaseTupleV0 +{ + public string Doc { get; set; } + public string Name { get; set; } + public SCSpecTypeDef[] Type { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTUnionCaseTupleV0 encodedSCSpecUDTUnionCaseTupleV0) + { + stream.WriteString(encodedSCSpecUDTUnionCaseTupleV0.Doc); + stream.WriteString(encodedSCSpecUDTUnionCaseTupleV0.Name); + var typesize = encodedSCSpecUDTUnionCaseTupleV0.Type.Length; + stream.WriteInt(typesize); + for (var i = 0; i < typesize; i++) SCSpecTypeDef.Encode(stream, encodedSCSpecUDTUnionCaseTupleV0.Type[i]); + } + + public static SCSpecUDTUnionCaseTupleV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTUnionCaseTupleV0 = new SCSpecUDTUnionCaseTupleV0(); + decodedSCSpecUDTUnionCaseTupleV0.Doc = stream.ReadString(); + decodedSCSpecUDTUnionCaseTupleV0.Name = stream.ReadString(); + var typesize = stream.ReadInt(); + decodedSCSpecUDTUnionCaseTupleV0.Type = new SCSpecTypeDef[typesize]; + for (var i = 0; i < typesize; i++) decodedSCSpecUDTUnionCaseTupleV0.Type[i] = SCSpecTypeDef.Decode(stream); + return decodedSCSpecUDTUnionCaseTupleV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseV0.cs new file mode 100644 index 00000000..a904f5fb --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseV0.cs @@ -0,0 +1,55 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SCSpecUDTUnionCaseV0 switch (SCSpecUDTUnionCaseV0Kind kind) +// { +// case SC_SPEC_UDT_UNION_CASE_VOID_V0: +// SCSpecUDTUnionCaseVoidV0 voidCase; +// case SC_SPEC_UDT_UNION_CASE_TUPLE_V0: +// SCSpecUDTUnionCaseTupleV0 tupleCase; +// }; + +// =========================================================================== +public class SCSpecUDTUnionCaseV0 +{ + public SCSpecUDTUnionCaseV0Kind Discriminant { get; set; } = new(); + + public SCSpecUDTUnionCaseVoidV0 VoidCase { get; set; } + public SCSpecUDTUnionCaseTupleV0 TupleCase { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTUnionCaseV0 encodedSCSpecUDTUnionCaseV0) + { + stream.WriteInt((int)encodedSCSpecUDTUnionCaseV0.Discriminant.InnerValue); + switch (encodedSCSpecUDTUnionCaseV0.Discriminant.InnerValue) + { + case SCSpecUDTUnionCaseV0Kind.SCSpecUDTUnionCaseV0KindEnum.SC_SPEC_UDT_UNION_CASE_VOID_V0: + SCSpecUDTUnionCaseVoidV0.Encode(stream, encodedSCSpecUDTUnionCaseV0.VoidCase); + break; + case SCSpecUDTUnionCaseV0Kind.SCSpecUDTUnionCaseV0KindEnum.SC_SPEC_UDT_UNION_CASE_TUPLE_V0: + SCSpecUDTUnionCaseTupleV0.Encode(stream, encodedSCSpecUDTUnionCaseV0.TupleCase); + break; + } + } + + public static SCSpecUDTUnionCaseV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTUnionCaseV0 = new SCSpecUDTUnionCaseV0(); + var discriminant = SCSpecUDTUnionCaseV0Kind.Decode(stream); + decodedSCSpecUDTUnionCaseV0.Discriminant = discriminant; + switch (decodedSCSpecUDTUnionCaseV0.Discriminant.InnerValue) + { + case SCSpecUDTUnionCaseV0Kind.SCSpecUDTUnionCaseV0KindEnum.SC_SPEC_UDT_UNION_CASE_VOID_V0: + decodedSCSpecUDTUnionCaseV0.VoidCase = SCSpecUDTUnionCaseVoidV0.Decode(stream); + break; + case SCSpecUDTUnionCaseV0Kind.SCSpecUDTUnionCaseV0KindEnum.SC_SPEC_UDT_UNION_CASE_TUPLE_V0: + decodedSCSpecUDTUnionCaseV0.TupleCase = SCSpecUDTUnionCaseTupleV0.Decode(stream); + break; + } + + return decodedSCSpecUDTUnionCaseV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseV0Kind.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseV0Kind.cs new file mode 100644 index 00000000..630f6ba4 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseV0Kind.cs @@ -0,0 +1,51 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCSpecUDTUnionCaseV0Kind +// { +// SC_SPEC_UDT_UNION_CASE_VOID_V0 = 0, +// SC_SPEC_UDT_UNION_CASE_TUPLE_V0 = 1 +// }; + +// =========================================================================== +public class SCSpecUDTUnionCaseV0Kind +{ + public enum SCSpecUDTUnionCaseV0KindEnum + { + SC_SPEC_UDT_UNION_CASE_VOID_V0 = 0, + SC_SPEC_UDT_UNION_CASE_TUPLE_V0 = 1 + } + + public SCSpecUDTUnionCaseV0KindEnum InnerValue { get; set; } = default; + + public static SCSpecUDTUnionCaseV0Kind Create(SCSpecUDTUnionCaseV0KindEnum v) + { + return new SCSpecUDTUnionCaseV0Kind + { + InnerValue = v + }; + } + + public static SCSpecUDTUnionCaseV0Kind Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCSpecUDTUnionCaseV0KindEnum.SC_SPEC_UDT_UNION_CASE_VOID_V0); + case 1: return Create(SCSpecUDTUnionCaseV0KindEnum.SC_SPEC_UDT_UNION_CASE_TUPLE_V0); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTUnionCaseV0Kind value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseVoidV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseVoidV0.cs new file mode 100644 index 00000000..2ac94c6a --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionCaseVoidV0.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTUnionCaseVoidV0 +// { +// string doc; +// string name<60>; +// }; + +// =========================================================================== +public class SCSpecUDTUnionCaseVoidV0 +{ + public string Doc { get; set; } + public string Name { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTUnionCaseVoidV0 encodedSCSpecUDTUnionCaseVoidV0) + { + stream.WriteString(encodedSCSpecUDTUnionCaseVoidV0.Doc); + stream.WriteString(encodedSCSpecUDTUnionCaseVoidV0.Name); + } + + public static SCSpecUDTUnionCaseVoidV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTUnionCaseVoidV0 = new SCSpecUDTUnionCaseVoidV0(); + decodedSCSpecUDTUnionCaseVoidV0.Doc = stream.ReadString(); + decodedSCSpecUDTUnionCaseVoidV0.Name = stream.ReadString(); + return decodedSCSpecUDTUnionCaseVoidV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionV0.cs b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionV0.cs new file mode 100644 index 00000000..bef618c6 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSpecUDTUnionV0.cs @@ -0,0 +1,45 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SCSpecUDTUnionV0 +// { +// string doc; +// string lib<80>; +// string name<60>; +// SCSpecUDTUnionCaseV0 cases<50>; +// }; + +// =========================================================================== +public class SCSpecUDTUnionV0 +{ + public string Doc { get; set; } + public string Lib { get; set; } + public string Name { get; set; } + public SCSpecUDTUnionCaseV0[] Cases { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCSpecUDTUnionV0 encodedSCSpecUDTUnionV0) + { + stream.WriteString(encodedSCSpecUDTUnionV0.Doc); + stream.WriteString(encodedSCSpecUDTUnionV0.Lib); + stream.WriteString(encodedSCSpecUDTUnionV0.Name); + var casessize = encodedSCSpecUDTUnionV0.Cases.Length; + stream.WriteInt(casessize); + for (var i = 0; i < casessize; i++) SCSpecUDTUnionCaseV0.Encode(stream, encodedSCSpecUDTUnionV0.Cases[i]); + } + + public static SCSpecUDTUnionV0 Decode(XdrDataInputStream stream) + { + var decodedSCSpecUDTUnionV0 = new SCSpecUDTUnionV0(); + decodedSCSpecUDTUnionV0.Doc = stream.ReadString(); + decodedSCSpecUDTUnionV0.Lib = stream.ReadString(); + decodedSCSpecUDTUnionV0.Name = stream.ReadString(); + var casessize = stream.ReadInt(); + decodedSCSpecUDTUnionV0.Cases = new SCSpecUDTUnionCaseV0[casessize]; + for (var i = 0; i < casessize; i++) decodedSCSpecUDTUnionV0.Cases[i] = SCSpecUDTUnionCaseV0.Decode(stream); + return decodedSCSpecUDTUnionV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCString.cs b/stellar-dotnet-sdk-xdr/generated/SCString.cs new file mode 100644 index 00000000..56bec933 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCString.cs @@ -0,0 +1,35 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef string SCString<>; + +// =========================================================================== +public class SCString +{ + public SCString() + { + } + + public SCString(string value) + { + InnerValue = value; + } + + public string InnerValue { get; set; } = default; + + public static void Encode(XdrDataOutputStream stream, SCString encodedSCString) + { + stream.WriteString(encodedSCString.InnerValue); + } + + public static SCString Decode(XdrDataInputStream stream) + { + var decodedSCString = new SCString(); + decodedSCString.InnerValue = stream.ReadString(); + return decodedSCString; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCSymbol.cs b/stellar-dotnet-sdk-xdr/generated/SCSymbol.cs new file mode 100644 index 00000000..043076af --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCSymbol.cs @@ -0,0 +1,35 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef string SCSymbol; + +// =========================================================================== +public class SCSymbol +{ + public SCSymbol() + { + } + + public SCSymbol(string value) + { + InnerValue = value; + } + + public string InnerValue { get; set; } = default; + + public static void Encode(XdrDataOutputStream stream, SCSymbol encodedSCSymbol) + { + stream.WriteString(encodedSCSymbol.InnerValue); + } + + public static SCSymbol Decode(XdrDataInputStream stream) + { + var decodedSCSymbol = new SCSymbol(); + decodedSCSymbol.InnerValue = stream.ReadString(); + return decodedSCSymbol; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCVal.cs b/stellar-dotnet-sdk-xdr/generated/SCVal.cs new file mode 100644 index 00000000..41470b1c --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCVal.cs @@ -0,0 +1,263 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// 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: +// int64 i64; +// case SCV_TIMEPOINT: +// 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_LEDGER_KEY_CONTRACT_INSTANCE: +// void; +// case SCV_LEDGER_KEY_NONCE: +// SCNonceKey nonce_key; +// +// case SCV_CONTRACT_INSTANCE: +// SCContractInstance instance; +// }; + +// =========================================================================== +public class SCVal +{ + public SCValType Discriminant { get; set; } = new(); + + public bool B { get; set; } + public SCError Error { get; set; } + public Uint32 U32 { get; set; } + public Int32 I32 { get; set; } + public Uint64 U64 { get; set; } + public Int64 I64 { get; set; } + public TimePoint Timepoint { get; set; } + public Duration Duration { get; set; } + public UInt128Parts U128 { get; set; } + public Int128Parts I128 { get; set; } + public UInt256Parts U256 { get; set; } + public Int256Parts I256 { get; set; } + public SCBytes Bytes { get; set; } + public SCString Str { get; set; } + public SCSymbol Sym { get; set; } + public SCVec Vec { get; set; } + public SCMap Map { get; set; } + public SCAddress Address { get; set; } + public SCNonceKey NonceKey { get; set; } + public SCContractInstance Instance { get; set; } + + public static void Encode(XdrDataOutputStream stream, SCVal encodedSCVal) + { + stream.WriteInt((int)encodedSCVal.Discriminant.InnerValue); + switch (encodedSCVal.Discriminant.InnerValue) + { + case SCValType.SCValTypeEnum.SCV_BOOL: + stream.WriteInt(encodedSCVal.B ? 1 : 0); + break; + case SCValType.SCValTypeEnum.SCV_VOID: + break; + case SCValType.SCValTypeEnum.SCV_ERROR: + SCError.Encode(stream, encodedSCVal.Error); + break; + case SCValType.SCValTypeEnum.SCV_U32: + Uint32.Encode(stream, encodedSCVal.U32); + break; + case SCValType.SCValTypeEnum.SCV_I32: + Int32.Encode(stream, encodedSCVal.I32); + break; + case SCValType.SCValTypeEnum.SCV_U64: + Uint64.Encode(stream, encodedSCVal.U64); + break; + case SCValType.SCValTypeEnum.SCV_I64: + Int64.Encode(stream, encodedSCVal.I64); + break; + case SCValType.SCValTypeEnum.SCV_TIMEPOINT: + TimePoint.Encode(stream, encodedSCVal.Timepoint); + break; + case SCValType.SCValTypeEnum.SCV_DURATION: + Duration.Encode(stream, encodedSCVal.Duration); + break; + case SCValType.SCValTypeEnum.SCV_U128: + UInt128Parts.Encode(stream, encodedSCVal.U128); + break; + case SCValType.SCValTypeEnum.SCV_I128: + Int128Parts.Encode(stream, encodedSCVal.I128); + break; + case SCValType.SCValTypeEnum.SCV_U256: + UInt256Parts.Encode(stream, encodedSCVal.U256); + break; + case SCValType.SCValTypeEnum.SCV_I256: + Int256Parts.Encode(stream, encodedSCVal.I256); + break; + case SCValType.SCValTypeEnum.SCV_BYTES: + SCBytes.Encode(stream, encodedSCVal.Bytes); + break; + case SCValType.SCValTypeEnum.SCV_STRING: + SCString.Encode(stream, encodedSCVal.Str); + break; + case SCValType.SCValTypeEnum.SCV_SYMBOL: + SCSymbol.Encode(stream, encodedSCVal.Sym); + break; + case SCValType.SCValTypeEnum.SCV_VEC: + if (encodedSCVal.Vec != null) + { + stream.WriteInt(1); + SCVec.Encode(stream, encodedSCVal.Vec); + } + else + { + stream.WriteInt(0); + } + + break; + case SCValType.SCValTypeEnum.SCV_MAP: + if (encodedSCVal.Map != null) + { + stream.WriteInt(1); + SCMap.Encode(stream, encodedSCVal.Map); + } + else + { + stream.WriteInt(0); + } + + break; + case SCValType.SCValTypeEnum.SCV_ADDRESS: + SCAddress.Encode(stream, encodedSCVal.Address); + break; + case SCValType.SCValTypeEnum.SCV_LEDGER_KEY_CONTRACT_INSTANCE: + break; + case SCValType.SCValTypeEnum.SCV_LEDGER_KEY_NONCE: + SCNonceKey.Encode(stream, encodedSCVal.NonceKey); + break; + case SCValType.SCValTypeEnum.SCV_CONTRACT_INSTANCE: + SCContractInstance.Encode(stream, encodedSCVal.Instance); + break; + } + } + + public static SCVal Decode(XdrDataInputStream stream) + { + var decodedSCVal = new SCVal(); + var discriminant = SCValType.Decode(stream); + decodedSCVal.Discriminant = discriminant; + switch (decodedSCVal.Discriminant.InnerValue) + { + case SCValType.SCValTypeEnum.SCV_BOOL: + decodedSCVal.B = stream.ReadInt() == 1 ? true : false; + break; + case SCValType.SCValTypeEnum.SCV_VOID: + break; + case SCValType.SCValTypeEnum.SCV_ERROR: + decodedSCVal.Error = SCError.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_U32: + decodedSCVal.U32 = Uint32.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_I32: + decodedSCVal.I32 = Int32.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_U64: + decodedSCVal.U64 = Uint64.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_I64: + decodedSCVal.I64 = Int64.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_TIMEPOINT: + decodedSCVal.Timepoint = TimePoint.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_DURATION: + decodedSCVal.Duration = Duration.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_U128: + decodedSCVal.U128 = UInt128Parts.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_I128: + decodedSCVal.I128 = Int128Parts.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_U256: + decodedSCVal.U256 = UInt256Parts.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_I256: + decodedSCVal.I256 = Int256Parts.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_BYTES: + decodedSCVal.Bytes = SCBytes.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_STRING: + decodedSCVal.Str = SCString.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_SYMBOL: + decodedSCVal.Sym = SCSymbol.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_VEC: + var VecPresent = stream.ReadInt(); + if (VecPresent != 0) decodedSCVal.Vec = SCVec.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_MAP: + var MapPresent = stream.ReadInt(); + if (MapPresent != 0) decodedSCVal.Map = SCMap.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_ADDRESS: + decodedSCVal.Address = SCAddress.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_LEDGER_KEY_CONTRACT_INSTANCE: + break; + case SCValType.SCValTypeEnum.SCV_LEDGER_KEY_NONCE: + decodedSCVal.NonceKey = SCNonceKey.Decode(stream); + break; + case SCValType.SCValTypeEnum.SCV_CONTRACT_INSTANCE: + decodedSCVal.Instance = SCContractInstance.Decode(stream); + break; + } + + return decodedSCVal; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCValType.cs b/stellar-dotnet-sdk-xdr/generated/SCValType.cs new file mode 100644 index 00000000..3003315e --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCValType.cs @@ -0,0 +1,140 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SCValType +// { +// 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. +// SCV_CONTRACT_INSTANCE = 19, +// +// // SCV_LEDGER_KEY_CONTRACT_INSTANCE and SCV_LEDGER_KEY_NONCE are unique +// // symbolic SCVals used as the key for ledger entries for a contract's +// // instance and an address' nonce, respectively. +// SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20, +// SCV_LEDGER_KEY_NONCE = 21 +// }; + +// =========================================================================== +public class SCValType +{ + public enum SCValTypeEnum + { + SCV_BOOL = 0, + SCV_VOID = 1, + SCV_ERROR = 2, + SCV_U32 = 3, + SCV_I32 = 4, + SCV_U64 = 5, + SCV_I64 = 6, + SCV_TIMEPOINT = 7, + SCV_DURATION = 8, + SCV_U128 = 9, + SCV_I128 = 10, + SCV_U256 = 11, + SCV_I256 = 12, + SCV_BYTES = 13, + SCV_STRING = 14, + SCV_SYMBOL = 15, + SCV_VEC = 16, + SCV_MAP = 17, + SCV_ADDRESS = 18, + SCV_CONTRACT_INSTANCE = 19, + SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20, + SCV_LEDGER_KEY_NONCE = 21 + } + + public SCValTypeEnum InnerValue { get; set; } = default; + + public static SCValType Create(SCValTypeEnum v) + { + return new SCValType + { + InnerValue = v + }; + } + + public static SCValType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SCValTypeEnum.SCV_BOOL); + case 1: return Create(SCValTypeEnum.SCV_VOID); + case 2: return Create(SCValTypeEnum.SCV_ERROR); + case 3: return Create(SCValTypeEnum.SCV_U32); + case 4: return Create(SCValTypeEnum.SCV_I32); + case 5: return Create(SCValTypeEnum.SCV_U64); + case 6: return Create(SCValTypeEnum.SCV_I64); + case 7: return Create(SCValTypeEnum.SCV_TIMEPOINT); + case 8: return Create(SCValTypeEnum.SCV_DURATION); + case 9: return Create(SCValTypeEnum.SCV_U128); + case 10: return Create(SCValTypeEnum.SCV_I128); + case 11: return Create(SCValTypeEnum.SCV_U256); + case 12: return Create(SCValTypeEnum.SCV_I256); + case 13: return Create(SCValTypeEnum.SCV_BYTES); + case 14: return Create(SCValTypeEnum.SCV_STRING); + case 15: return Create(SCValTypeEnum.SCV_SYMBOL); + case 16: return Create(SCValTypeEnum.SCV_VEC); + case 17: return Create(SCValTypeEnum.SCV_MAP); + case 18: return Create(SCValTypeEnum.SCV_ADDRESS); + case 19: return Create(SCValTypeEnum.SCV_CONTRACT_INSTANCE); + case 20: return Create(SCValTypeEnum.SCV_LEDGER_KEY_CONTRACT_INSTANCE); + case 21: return Create(SCValTypeEnum.SCV_LEDGER_KEY_NONCE); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SCValType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SCVec.cs b/stellar-dotnet-sdk-xdr/generated/SCVec.cs new file mode 100644 index 00000000..344bafae --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SCVec.cs @@ -0,0 +1,39 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef SCVal SCVec<>; + +// =========================================================================== +public class SCVec +{ + public SCVec() + { + } + + public SCVec(SCVal[] value) + { + InnerValue = value; + } + + public SCVal[] InnerValue { get; set; } = default; + + public static void Encode(XdrDataOutputStream stream, SCVec encodedSCVec) + { + var SCVecsize = encodedSCVec.InnerValue.Length; + stream.WriteInt(SCVecsize); + for (var i = 0; i < SCVecsize; i++) SCVal.Encode(stream, encodedSCVec.InnerValue[i]); + } + + public static SCVec Decode(XdrDataInputStream stream) + { + var decodedSCVec = new SCVec(); + var SCVecsize = stream.ReadInt(); + decodedSCVec.InnerValue = new SCVal[SCVecsize]; + for (var i = 0; i < SCVecsize; i++) decodedSCVec.InnerValue[i] = SCVal.Decode(stream); + return decodedSCVec; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SendMore.cs b/stellar-dotnet-sdk-xdr/generated/SendMore.cs index bf426ab8..2af5830c 100644 --- a/stellar-dotnet-sdk-xdr/generated/SendMore.cs +++ b/stellar-dotnet-sdk-xdr/generated/SendMore.cs @@ -1,32 +1,29 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SendMore +// { +// uint32 numMessages; +// }; - // struct SendMore - // { - // uint32 numMessages; - // }; +// =========================================================================== +public class SendMore +{ + public Uint32 NumMessages { get; set; } - // =========================================================================== - public class SendMore + public static void Encode(XdrDataOutputStream stream, SendMore encodedSendMore) { - public SendMore() { } - public Uint32 NumMessages { get; set; } + Uint32.Encode(stream, encodedSendMore.NumMessages); + } - public static void Encode(XdrDataOutputStream stream, SendMore encodedSendMore) - { - Uint32.Encode(stream, encodedSendMore.NumMessages); - } - public static SendMore Decode(XdrDataInputStream stream) - { - SendMore decodedSendMore = new SendMore(); - decodedSendMore.NumMessages = Uint32.Decode(stream); - return decodedSendMore; - } + public static SendMore Decode(XdrDataInputStream stream) + { + var decodedSendMore = new SendMore(); + decodedSendMore.NumMessages = Uint32.Decode(stream); + return decodedSendMore; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SendMoreExtended.cs b/stellar-dotnet-sdk-xdr/generated/SendMoreExtended.cs new file mode 100644 index 00000000..e89ceb74 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SendMoreExtended.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SendMoreExtended +// { +// uint32 numMessages; +// uint32 numBytes; +// }; + +// =========================================================================== +public class SendMoreExtended +{ + public Uint32 NumMessages { get; set; } + public Uint32 NumBytes { get; set; } + + public static void Encode(XdrDataOutputStream stream, SendMoreExtended encodedSendMoreExtended) + { + Uint32.Encode(stream, encodedSendMoreExtended.NumMessages); + Uint32.Encode(stream, encodedSendMoreExtended.NumBytes); + } + + public static SendMoreExtended Decode(XdrDataInputStream stream) + { + var decodedSendMoreExtended = new SendMoreExtended(); + decodedSendMoreExtended.NumMessages = Uint32.Decode(stream); + decodedSendMoreExtended.NumBytes = Uint32.Decode(stream); + return decodedSendMoreExtended; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SequenceNumber.cs b/stellar-dotnet-sdk-xdr/generated/SequenceNumber.cs index da221902..ad6b3e5f 100644 --- a/stellar-dotnet-sdk-xdr/generated/SequenceNumber.cs +++ b/stellar-dotnet-sdk-xdr/generated/SequenceNumber.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef int64 SequenceNumber; + +// =========================================================================== +public class SequenceNumber { + public SequenceNumber() + { + } - // === xdr source ============================================================ + public SequenceNumber(Int64 value) + { + InnerValue = value; + } + + public Int64 InnerValue { get; set; } = default; - // typedef int64 SequenceNumber; + public static void Encode(XdrDataOutputStream stream, SequenceNumber encodedSequenceNumber) + { + Int64.Encode(stream, encodedSequenceNumber.InnerValue); + } - // =========================================================================== - public class SequenceNumber + public static SequenceNumber Decode(XdrDataInputStream stream) { - public Int64 InnerValue { get; set; } = default(Int64); - - public SequenceNumber() { } - - public SequenceNumber(Int64 value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, SequenceNumber encodedSequenceNumber) - { - Int64.Encode(stream, encodedSequenceNumber.InnerValue); - } - public static SequenceNumber Decode(XdrDataInputStream stream) - { - SequenceNumber decodedSequenceNumber = new SequenceNumber(); - decodedSequenceNumber.InnerValue = Int64.Decode(stream); - return decodedSequenceNumber; - } + var decodedSequenceNumber = new SequenceNumber(); + decodedSequenceNumber.InnerValue = Int64.Decode(stream); + return decodedSequenceNumber; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SetOptionsOp.cs b/stellar-dotnet-sdk-xdr/generated/SetOptionsOp.cs index 52dce975..36b224ff 100644 --- a/stellar-dotnet-sdk-xdr/generated/SetOptionsOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/SetOptionsOp.cs @@ -1,179 +1,157 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// 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; +// }; - // 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; - // }; +// =========================================================================== +public class SetOptionsOp +{ + public AccountID InflationDest { get; set; } + public Uint32 ClearFlags { get; set; } + public Uint32 SetFlags { get; set; } + public Uint32 MasterWeight { get; set; } + public Uint32 LowThreshold { get; set; } + public Uint32 MedThreshold { get; set; } + public Uint32 HighThreshold { get; set; } + public String32 HomeDomain { get; set; } + public Signer Signer { get; set; } - // =========================================================================== - public class SetOptionsOp + public static void Encode(XdrDataOutputStream stream, SetOptionsOp encodedSetOptionsOp) { - public SetOptionsOp() { } - public AccountID InflationDest { get; set; } - public Uint32 ClearFlags { get; set; } - public Uint32 SetFlags { get; set; } - public Uint32 MasterWeight { get; set; } - public Uint32 LowThreshold { get; set; } - public Uint32 MedThreshold { get; set; } - public Uint32 HighThreshold { get; set; } - public String32 HomeDomain { get; set; } - public Signer Signer { get; set; } + if (encodedSetOptionsOp.InflationDest != null) + { + stream.WriteInt(1); + AccountID.Encode(stream, encodedSetOptionsOp.InflationDest); + } + else + { + stream.WriteInt(0); + } + + if (encodedSetOptionsOp.ClearFlags != null) + { + stream.WriteInt(1); + Uint32.Encode(stream, encodedSetOptionsOp.ClearFlags); + } + else + { + stream.WriteInt(0); + } + + if (encodedSetOptionsOp.SetFlags != null) + { + stream.WriteInt(1); + Uint32.Encode(stream, encodedSetOptionsOp.SetFlags); + } + else + { + stream.WriteInt(0); + } + + if (encodedSetOptionsOp.MasterWeight != null) + { + stream.WriteInt(1); + Uint32.Encode(stream, encodedSetOptionsOp.MasterWeight); + } + else + { + stream.WriteInt(0); + } + + if (encodedSetOptionsOp.LowThreshold != null) + { + stream.WriteInt(1); + Uint32.Encode(stream, encodedSetOptionsOp.LowThreshold); + } + else + { + stream.WriteInt(0); + } + + if (encodedSetOptionsOp.MedThreshold != null) + { + stream.WriteInt(1); + Uint32.Encode(stream, encodedSetOptionsOp.MedThreshold); + } + else + { + stream.WriteInt(0); + } + + if (encodedSetOptionsOp.HighThreshold != null) + { + stream.WriteInt(1); + Uint32.Encode(stream, encodedSetOptionsOp.HighThreshold); + } + else + { + stream.WriteInt(0); + } + + if (encodedSetOptionsOp.HomeDomain != null) + { + stream.WriteInt(1); + String32.Encode(stream, encodedSetOptionsOp.HomeDomain); + } + else + { + stream.WriteInt(0); + } - public static void Encode(XdrDataOutputStream stream, SetOptionsOp encodedSetOptionsOp) - { - if (encodedSetOptionsOp.InflationDest != null) - { - stream.WriteInt(1); - AccountID.Encode(stream, encodedSetOptionsOp.InflationDest); - } - else - { - stream.WriteInt(0); - } - if (encodedSetOptionsOp.ClearFlags != null) - { - stream.WriteInt(1); - Uint32.Encode(stream, encodedSetOptionsOp.ClearFlags); - } - else - { - stream.WriteInt(0); - } - if (encodedSetOptionsOp.SetFlags != null) - { - stream.WriteInt(1); - Uint32.Encode(stream, encodedSetOptionsOp.SetFlags); - } - else - { - stream.WriteInt(0); - } - if (encodedSetOptionsOp.MasterWeight != null) - { - stream.WriteInt(1); - Uint32.Encode(stream, encodedSetOptionsOp.MasterWeight); - } - else - { - stream.WriteInt(0); - } - if (encodedSetOptionsOp.LowThreshold != null) - { - stream.WriteInt(1); - Uint32.Encode(stream, encodedSetOptionsOp.LowThreshold); - } - else - { - stream.WriteInt(0); - } - if (encodedSetOptionsOp.MedThreshold != null) - { - stream.WriteInt(1); - Uint32.Encode(stream, encodedSetOptionsOp.MedThreshold); - } - else - { - stream.WriteInt(0); - } - if (encodedSetOptionsOp.HighThreshold != null) - { - stream.WriteInt(1); - Uint32.Encode(stream, encodedSetOptionsOp.HighThreshold); - } - else - { - stream.WriteInt(0); - } - if (encodedSetOptionsOp.HomeDomain != null) - { - stream.WriteInt(1); - String32.Encode(stream, encodedSetOptionsOp.HomeDomain); - } - else - { - stream.WriteInt(0); - } - if (encodedSetOptionsOp.Signer != null) - { - stream.WriteInt(1); - Signer.Encode(stream, encodedSetOptionsOp.Signer); - } - else - { - stream.WriteInt(0); - } - } - public static SetOptionsOp Decode(XdrDataInputStream stream) - { - SetOptionsOp decodedSetOptionsOp = new SetOptionsOp(); - int InflationDestPresent = stream.ReadInt(); - if (InflationDestPresent != 0) - { - decodedSetOptionsOp.InflationDest = AccountID.Decode(stream); - } - int ClearFlagsPresent = stream.ReadInt(); - if (ClearFlagsPresent != 0) - { - decodedSetOptionsOp.ClearFlags = Uint32.Decode(stream); - } - int SetFlagsPresent = stream.ReadInt(); - if (SetFlagsPresent != 0) - { - decodedSetOptionsOp.SetFlags = Uint32.Decode(stream); - } - int MasterWeightPresent = stream.ReadInt(); - if (MasterWeightPresent != 0) - { - decodedSetOptionsOp.MasterWeight = Uint32.Decode(stream); - } - int LowThresholdPresent = stream.ReadInt(); - if (LowThresholdPresent != 0) - { - decodedSetOptionsOp.LowThreshold = Uint32.Decode(stream); - } - int MedThresholdPresent = stream.ReadInt(); - if (MedThresholdPresent != 0) - { - decodedSetOptionsOp.MedThreshold = Uint32.Decode(stream); - } - int HighThresholdPresent = stream.ReadInt(); - if (HighThresholdPresent != 0) - { - decodedSetOptionsOp.HighThreshold = Uint32.Decode(stream); - } - int HomeDomainPresent = stream.ReadInt(); - if (HomeDomainPresent != 0) - { - decodedSetOptionsOp.HomeDomain = String32.Decode(stream); - } - int SignerPresent = stream.ReadInt(); - if (SignerPresent != 0) - { - decodedSetOptionsOp.Signer = Signer.Decode(stream); - } - return decodedSetOptionsOp; + if (encodedSetOptionsOp.Signer != null) + { + stream.WriteInt(1); + Signer.Encode(stream, encodedSetOptionsOp.Signer); + } + else + { + stream.WriteInt(0); } } -} + + public static SetOptionsOp Decode(XdrDataInputStream stream) + { + var decodedSetOptionsOp = new SetOptionsOp(); + var InflationDestPresent = stream.ReadInt(); + if (InflationDestPresent != 0) decodedSetOptionsOp.InflationDest = AccountID.Decode(stream); + var ClearFlagsPresent = stream.ReadInt(); + if (ClearFlagsPresent != 0) decodedSetOptionsOp.ClearFlags = Uint32.Decode(stream); + var SetFlagsPresent = stream.ReadInt(); + if (SetFlagsPresent != 0) decodedSetOptionsOp.SetFlags = Uint32.Decode(stream); + var MasterWeightPresent = stream.ReadInt(); + if (MasterWeightPresent != 0) decodedSetOptionsOp.MasterWeight = Uint32.Decode(stream); + var LowThresholdPresent = stream.ReadInt(); + if (LowThresholdPresent != 0) decodedSetOptionsOp.LowThreshold = Uint32.Decode(stream); + var MedThresholdPresent = stream.ReadInt(); + if (MedThresholdPresent != 0) decodedSetOptionsOp.MedThreshold = Uint32.Decode(stream); + var HighThresholdPresent = stream.ReadInt(); + if (HighThresholdPresent != 0) decodedSetOptionsOp.HighThreshold = Uint32.Decode(stream); + var HomeDomainPresent = stream.ReadInt(); + if (HomeDomainPresent != 0) decodedSetOptionsOp.HomeDomain = String32.Decode(stream); + var SignerPresent = stream.ReadInt(); + if (SignerPresent != 0) decodedSetOptionsOp.Signer = Signer.Decode(stream); + return decodedSetOptionsOp; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SetOptionsResult.cs b/stellar-dotnet-sdk-xdr/generated/SetOptionsResult.cs index 575e4af1..14a4360b 100644 --- a/stellar-dotnet-sdk-xdr/generated/SetOptionsResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/SetOptionsResult.cs @@ -1,51 +1,75 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union SetOptionsResult switch (SetOptionsResultCode code) - // { - // case SET_OPTIONS_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class SetOptionsResult - { - public SetOptionsResult() { } +// union SetOptionsResult switch (SetOptionsResultCode code) +// { +// case SET_OPTIONS_SUCCESS: +// void; +// case SET_OPTIONS_LOW_RESERVE: +// case SET_OPTIONS_TOO_MANY_SIGNERS: +// case SET_OPTIONS_BAD_FLAGS: +// case SET_OPTIONS_INVALID_INFLATION: +// case SET_OPTIONS_CANT_CHANGE: +// case SET_OPTIONS_UNKNOWN_FLAG: +// case SET_OPTIONS_THRESHOLD_OUT_OF_RANGE: +// case SET_OPTIONS_BAD_SIGNER: +// case SET_OPTIONS_INVALID_HOME_DOMAIN: +// case SET_OPTIONS_AUTH_REVOCABLE_REQUIRED: +// void; +// }; - public SetOptionsResultCode Discriminant { get; set; } = new SetOptionsResultCode(); +// =========================================================================== +public class SetOptionsResult +{ + public SetOptionsResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, SetOptionsResult encodedSetOptionsResult) + public static void Encode(XdrDataOutputStream stream, SetOptionsResult encodedSetOptionsResult) + { + stream.WriteInt((int)encodedSetOptionsResult.Discriminant.InnerValue); + switch (encodedSetOptionsResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedSetOptionsResult.Discriminant.InnerValue); - switch (encodedSetOptionsResult.Discriminant.InnerValue) - { - case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS: - break; - default: - break; - } + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS: + break; + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_LOW_RESERVE: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_TOO_MANY_SIGNERS: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_BAD_FLAGS: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_INFLATION: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_CANT_CHANGE: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_UNKNOWN_FLAG: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_THRESHOLD_OUT_OF_RANGE: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_BAD_SIGNER: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_HOME_DOMAIN: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_AUTH_REVOCABLE_REQUIRED: + break; } - public static SetOptionsResult Decode(XdrDataInputStream stream) + } + + public static SetOptionsResult Decode(XdrDataInputStream stream) + { + var decodedSetOptionsResult = new SetOptionsResult(); + var discriminant = SetOptionsResultCode.Decode(stream); + decodedSetOptionsResult.Discriminant = discriminant; + switch (decodedSetOptionsResult.Discriminant.InnerValue) { - SetOptionsResult decodedSetOptionsResult = new SetOptionsResult(); - SetOptionsResultCode discriminant = SetOptionsResultCode.Decode(stream); - decodedSetOptionsResult.Discriminant = discriminant; - switch (decodedSetOptionsResult.Discriminant.InnerValue) - { - case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS: - break; - default: - break; - } - return decodedSetOptionsResult; + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS: + break; + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_LOW_RESERVE: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_TOO_MANY_SIGNERS: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_BAD_FLAGS: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_INFLATION: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_CANT_CHANGE: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_UNKNOWN_FLAG: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_THRESHOLD_OUT_OF_RANGE: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_BAD_SIGNER: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_HOME_DOMAIN: + case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_AUTH_REVOCABLE_REQUIRED: + break; } + + return decodedSetOptionsResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SetOptionsResultCode.cs b/stellar-dotnet-sdk-xdr/generated/SetOptionsResultCode.cs index c6994d68..06136aeb 100644 --- a/stellar-dotnet-sdk-xdr/generated/SetOptionsResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/SetOptionsResultCode.cs @@ -1,81 +1,81 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum SetOptionsResultCode - // { - // // codes considered as "success" for the operation - // SET_OPTIONS_SUCCESS = 0, - // // codes considered as "failure" for the operation - // SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer - // SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached - // SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags - // SET_OPTIONS_INVALID_INFLATION = -4, // inflation account does not exist - // SET_OPTIONS_CANT_CHANGE = -5, // can no longer change this option - // SET_OPTIONS_UNKNOWN_FLAG = -6, // can't set an unknown flag - // SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, // bad value for weight/threshold - // SET_OPTIONS_BAD_SIGNER = -8, // signer cannot be masterkey - // SET_OPTIONS_INVALID_HOME_DOMAIN = -9, // malformed home domain - // SET_OPTIONS_AUTH_REVOCABLE_REQUIRED = - // -10 // auth revocable is required for clawback - // }; +// enum SetOptionsResultCode +// { +// // codes considered as "success" for the operation +// SET_OPTIONS_SUCCESS = 0, +// // codes considered as "failure" for the operation +// SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer +// SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached +// SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags +// SET_OPTIONS_INVALID_INFLATION = -4, // inflation account does not exist +// SET_OPTIONS_CANT_CHANGE = -5, // can no longer change this option +// SET_OPTIONS_UNKNOWN_FLAG = -6, // can't set an unknown flag +// SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, // bad value for weight/threshold +// SET_OPTIONS_BAD_SIGNER = -8, // signer cannot be masterkey +// SET_OPTIONS_INVALID_HOME_DOMAIN = -9, // malformed home domain +// SET_OPTIONS_AUTH_REVOCABLE_REQUIRED = +// -10 // auth revocable is required for clawback +// }; - // =========================================================================== - public class SetOptionsResultCode +// =========================================================================== +public class SetOptionsResultCode +{ + public enum SetOptionsResultCodeEnum { - public enum SetOptionsResultCodeEnum - { - SET_OPTIONS_SUCCESS = 0, - SET_OPTIONS_LOW_RESERVE = -1, - SET_OPTIONS_TOO_MANY_SIGNERS = -2, - SET_OPTIONS_BAD_FLAGS = -3, - SET_OPTIONS_INVALID_INFLATION = -4, - SET_OPTIONS_CANT_CHANGE = -5, - SET_OPTIONS_UNKNOWN_FLAG = -6, - SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, - SET_OPTIONS_BAD_SIGNER = -8, - SET_OPTIONS_INVALID_HOME_DOMAIN = -9, - SET_OPTIONS_AUTH_REVOCABLE_REQUIRED = -10, - } - public SetOptionsResultCodeEnum InnerValue { get; set; } = default(SetOptionsResultCodeEnum); + SET_OPTIONS_SUCCESS = 0, + SET_OPTIONS_LOW_RESERVE = -1, + SET_OPTIONS_TOO_MANY_SIGNERS = -2, + SET_OPTIONS_BAD_FLAGS = -3, + SET_OPTIONS_INVALID_INFLATION = -4, + SET_OPTIONS_CANT_CHANGE = -5, + SET_OPTIONS_UNKNOWN_FLAG = -6, + SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, + SET_OPTIONS_BAD_SIGNER = -8, + SET_OPTIONS_INVALID_HOME_DOMAIN = -9, + SET_OPTIONS_AUTH_REVOCABLE_REQUIRED = -10 + } - public static SetOptionsResultCode Create(SetOptionsResultCodeEnum v) - { - return new SetOptionsResultCode - { - InnerValue = v - }; - } + public SetOptionsResultCodeEnum InnerValue { get; set; } = default; - public static SetOptionsResultCode Decode(XdrDataInputStream stream) + public static SetOptionsResultCode Create(SetOptionsResultCodeEnum v) + { + return new SetOptionsResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS); - case -1: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_LOW_RESERVE); - case -2: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_TOO_MANY_SIGNERS); - case -3: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_BAD_FLAGS); - case -4: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_INFLATION); - case -5: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_CANT_CHANGE); - case -6: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_UNKNOWN_FLAG); - case -7: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_THRESHOLD_OUT_OF_RANGE); - case -8: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_BAD_SIGNER); - case -9: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_HOME_DOMAIN); - case -10: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_AUTH_REVOCABLE_REQUIRED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, SetOptionsResultCode value) + public static SetOptionsResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS); + case -1: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_LOW_RESERVE); + case -2: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_TOO_MANY_SIGNERS); + case -3: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_BAD_FLAGS); + case -4: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_INFLATION); + case -5: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_CANT_CHANGE); + case -6: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_UNKNOWN_FLAG); + case -7: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_THRESHOLD_OUT_OF_RANGE); + case -8: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_BAD_SIGNER); + case -9: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_HOME_DOMAIN); + case -10: return Create(SetOptionsResultCodeEnum.SET_OPTIONS_AUTH_REVOCABLE_REQUIRED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, SetOptionsResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsOp.cs b/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsOp.cs index 42d91f85..756b44eb 100644 --- a/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsOp.cs +++ b/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsOp.cs @@ -1,45 +1,42 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SetTrustLineFlagsOp +// { +// AccountID trustor; +// Asset asset; +// +// uint32 clearFlags; // which flags to clear +// uint32 setFlags; // which flags to set +// }; - // struct SetTrustLineFlagsOp - // { - // AccountID trustor; - // Asset asset; - // - // uint32 clearFlags; // which flags to clear - // uint32 setFlags; // which flags to set - // }; +// =========================================================================== +public class SetTrustLineFlagsOp +{ + public AccountID Trustor { get; set; } + public Asset Asset { get; set; } + public Uint32 ClearFlags { get; set; } + public Uint32 SetFlags { get; set; } - // =========================================================================== - public class SetTrustLineFlagsOp + public static void Encode(XdrDataOutputStream stream, SetTrustLineFlagsOp encodedSetTrustLineFlagsOp) { - public SetTrustLineFlagsOp() { } - public AccountID Trustor { get; set; } - public Asset Asset { get; set; } - public Uint32 ClearFlags { get; set; } - public Uint32 SetFlags { get; set; } + AccountID.Encode(stream, encodedSetTrustLineFlagsOp.Trustor); + Asset.Encode(stream, encodedSetTrustLineFlagsOp.Asset); + Uint32.Encode(stream, encodedSetTrustLineFlagsOp.ClearFlags); + Uint32.Encode(stream, encodedSetTrustLineFlagsOp.SetFlags); + } - public static void Encode(XdrDataOutputStream stream, SetTrustLineFlagsOp encodedSetTrustLineFlagsOp) - { - AccountID.Encode(stream, encodedSetTrustLineFlagsOp.Trustor); - Asset.Encode(stream, encodedSetTrustLineFlagsOp.Asset); - Uint32.Encode(stream, encodedSetTrustLineFlagsOp.ClearFlags); - Uint32.Encode(stream, encodedSetTrustLineFlagsOp.SetFlags); - } - public static SetTrustLineFlagsOp Decode(XdrDataInputStream stream) - { - SetTrustLineFlagsOp decodedSetTrustLineFlagsOp = new SetTrustLineFlagsOp(); - decodedSetTrustLineFlagsOp.Trustor = AccountID.Decode(stream); - decodedSetTrustLineFlagsOp.Asset = Asset.Decode(stream); - decodedSetTrustLineFlagsOp.ClearFlags = Uint32.Decode(stream); - decodedSetTrustLineFlagsOp.SetFlags = Uint32.Decode(stream); - return decodedSetTrustLineFlagsOp; - } + public static SetTrustLineFlagsOp Decode(XdrDataInputStream stream) + { + var decodedSetTrustLineFlagsOp = new SetTrustLineFlagsOp(); + decodedSetTrustLineFlagsOp.Trustor = AccountID.Decode(stream); + decodedSetTrustLineFlagsOp.Asset = Asset.Decode(stream); + decodedSetTrustLineFlagsOp.ClearFlags = Uint32.Decode(stream); + decodedSetTrustLineFlagsOp.SetFlags = Uint32.Decode(stream); + return decodedSetTrustLineFlagsOp; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsResult.cs b/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsResult.cs index 6e726f1b..a4c3acc6 100644 --- a/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsResult.cs @@ -1,51 +1,60 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ - - // === xdr source ============================================================ +namespace stellar_dotnet_sdk.xdr; - // union SetTrustLineFlagsResult switch (SetTrustLineFlagsResultCode code) - // { - // case SET_TRUST_LINE_FLAGS_SUCCESS: - // void; - // default: - // void; - // }; +// === xdr source ============================================================ - // =========================================================================== - public class SetTrustLineFlagsResult - { - public SetTrustLineFlagsResult() { } +// union SetTrustLineFlagsResult switch (SetTrustLineFlagsResultCode code) +// { +// case SET_TRUST_LINE_FLAGS_SUCCESS: +// void; +// case SET_TRUST_LINE_FLAGS_MALFORMED: +// case SET_TRUST_LINE_FLAGS_NO_TRUST_LINE: +// case SET_TRUST_LINE_FLAGS_CANT_REVOKE: +// case SET_TRUST_LINE_FLAGS_INVALID_STATE: +// case SET_TRUST_LINE_FLAGS_LOW_RESERVE: +// void; +// }; - public SetTrustLineFlagsResultCode Discriminant { get; set; } = new SetTrustLineFlagsResultCode(); +// =========================================================================== +public class SetTrustLineFlagsResult +{ + public SetTrustLineFlagsResultCode Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, SetTrustLineFlagsResult encodedSetTrustLineFlagsResult) + public static void Encode(XdrDataOutputStream stream, SetTrustLineFlagsResult encodedSetTrustLineFlagsResult) + { + stream.WriteInt((int)encodedSetTrustLineFlagsResult.Discriminant.InnerValue); + switch (encodedSetTrustLineFlagsResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedSetTrustLineFlagsResult.Discriminant.InnerValue); - switch (encodedSetTrustLineFlagsResult.Discriminant.InnerValue) - { - case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_SUCCESS: - break; - default: - break; - } + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_SUCCESS: + break; + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_MALFORMED: + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_NO_TRUST_LINE: + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_CANT_REVOKE: + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_INVALID_STATE: + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_LOW_RESERVE: + break; } - public static SetTrustLineFlagsResult Decode(XdrDataInputStream stream) + } + + public static SetTrustLineFlagsResult Decode(XdrDataInputStream stream) + { + var decodedSetTrustLineFlagsResult = new SetTrustLineFlagsResult(); + var discriminant = SetTrustLineFlagsResultCode.Decode(stream); + decodedSetTrustLineFlagsResult.Discriminant = discriminant; + switch (decodedSetTrustLineFlagsResult.Discriminant.InnerValue) { - SetTrustLineFlagsResult decodedSetTrustLineFlagsResult = new SetTrustLineFlagsResult(); - SetTrustLineFlagsResultCode discriminant = SetTrustLineFlagsResultCode.Decode(stream); - decodedSetTrustLineFlagsResult.Discriminant = discriminant; - switch (decodedSetTrustLineFlagsResult.Discriminant.InnerValue) - { - case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_SUCCESS: - break; - default: - break; - } - return decodedSetTrustLineFlagsResult; + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_SUCCESS: + break; + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_MALFORMED: + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_NO_TRUST_LINE: + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_CANT_REVOKE: + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_INVALID_STATE: + case SetTrustLineFlagsResultCode.SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_LOW_RESERVE: + break; } + + return decodedSetTrustLineFlagsResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsResultCode.cs b/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsResultCode.cs index 0b44127a..9081bc13 100644 --- a/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/SetTrustLineFlagsResultCode.cs @@ -1,67 +1,67 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum SetTrustLineFlagsResultCode - // { - // // 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, - // SET_TRUST_LINE_FLAGS_CANT_REVOKE = -3, - // SET_TRUST_LINE_FLAGS_INVALID_STATE = -4, - // SET_TRUST_LINE_FLAGS_LOW_RESERVE = -5 // claimable balances can't be created - // // on revoke due to low reserves - // }; +// enum SetTrustLineFlagsResultCode +// { +// // 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, +// SET_TRUST_LINE_FLAGS_CANT_REVOKE = -3, +// SET_TRUST_LINE_FLAGS_INVALID_STATE = -4, +// SET_TRUST_LINE_FLAGS_LOW_RESERVE = -5 // claimable balances can't be created +// // on revoke due to low reserves +// }; - // =========================================================================== - public class SetTrustLineFlagsResultCode +// =========================================================================== +public class SetTrustLineFlagsResultCode +{ + public enum SetTrustLineFlagsResultCodeEnum { - public enum SetTrustLineFlagsResultCodeEnum - { - SET_TRUST_LINE_FLAGS_SUCCESS = 0, - SET_TRUST_LINE_FLAGS_MALFORMED = -1, - SET_TRUST_LINE_FLAGS_NO_TRUST_LINE = -2, - SET_TRUST_LINE_FLAGS_CANT_REVOKE = -3, - SET_TRUST_LINE_FLAGS_INVALID_STATE = -4, - SET_TRUST_LINE_FLAGS_LOW_RESERVE = -5, - } - public SetTrustLineFlagsResultCodeEnum InnerValue { get; set; } = default(SetTrustLineFlagsResultCodeEnum); + SET_TRUST_LINE_FLAGS_SUCCESS = 0, + SET_TRUST_LINE_FLAGS_MALFORMED = -1, + SET_TRUST_LINE_FLAGS_NO_TRUST_LINE = -2, + SET_TRUST_LINE_FLAGS_CANT_REVOKE = -3, + SET_TRUST_LINE_FLAGS_INVALID_STATE = -4, + SET_TRUST_LINE_FLAGS_LOW_RESERVE = -5 + } - public static SetTrustLineFlagsResultCode Create(SetTrustLineFlagsResultCodeEnum v) - { - return new SetTrustLineFlagsResultCode - { - InnerValue = v - }; - } + public SetTrustLineFlagsResultCodeEnum InnerValue { get; set; } = default; - public static SetTrustLineFlagsResultCode Decode(XdrDataInputStream stream) + public static SetTrustLineFlagsResultCode Create(SetTrustLineFlagsResultCodeEnum v) + { + return new SetTrustLineFlagsResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_SUCCESS); - case -1: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_MALFORMED); - case -2: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_NO_TRUST_LINE); - case -3: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_CANT_REVOKE); - case -4: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_INVALID_STATE); - case -5: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_LOW_RESERVE); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, SetTrustLineFlagsResultCode value) + public static SetTrustLineFlagsResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_SUCCESS); + case -1: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_MALFORMED); + case -2: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_NO_TRUST_LINE); + case -3: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_CANT_REVOKE); + case -4: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_INVALID_STATE); + case -5: return Create(SetTrustLineFlagsResultCodeEnum.SET_TRUST_LINE_FLAGS_LOW_RESERVE); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, SetTrustLineFlagsResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Signature.cs b/stellar-dotnet-sdk-xdr/generated/Signature.cs index a2713495..7d03e75a 100644 --- a/stellar-dotnet-sdk-xdr/generated/Signature.cs +++ b/stellar-dotnet-sdk-xdr/generated/Signature.cs @@ -1,39 +1,39 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque Signature<64>; + +// =========================================================================== +public class Signature { + public Signature() + { + } - // === xdr source ============================================================ + public Signature(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque Signature<64>; + public static void Encode(XdrDataOutputStream stream, Signature encodedSignature) + { + var Signaturesize = encodedSignature.InnerValue.Length; + stream.WriteInt(Signaturesize); + stream.Write(encodedSignature.InnerValue, 0, Signaturesize); + } - // =========================================================================== - public class Signature + public static Signature Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public Signature() { } - - public Signature(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Signature encodedSignature) - { - int Signaturesize = encodedSignature.InnerValue.Length; - stream.WriteInt(Signaturesize); - stream.Write(encodedSignature.InnerValue, 0, Signaturesize); - } - public static Signature Decode(XdrDataInputStream stream) - { - Signature decodedSignature = new Signature(); - int Signaturesize = stream.ReadInt(); - decodedSignature.InnerValue = new byte[Signaturesize]; - stream.Read(decodedSignature.InnerValue, 0, Signaturesize); - return decodedSignature; - } + var decodedSignature = new Signature(); + var Signaturesize = stream.ReadInt(); + decodedSignature.InnerValue = new byte[Signaturesize]; + stream.Read(decodedSignature.InnerValue, 0, Signaturesize); + return decodedSignature; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SignatureHint.cs b/stellar-dotnet-sdk-xdr/generated/SignatureHint.cs index ebd39aee..065d2794 100644 --- a/stellar-dotnet-sdk-xdr/generated/SignatureHint.cs +++ b/stellar-dotnet-sdk-xdr/generated/SignatureHint.cs @@ -1,38 +1,38 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque SignatureHint[4]; + +// =========================================================================== +public class SignatureHint { + public SignatureHint() + { + } - // === xdr source ============================================================ + public SignatureHint(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque SignatureHint[4]; + public static void Encode(XdrDataOutputStream stream, SignatureHint encodedSignatureHint) + { + var SignatureHintsize = encodedSignatureHint.InnerValue.Length; + stream.Write(encodedSignatureHint.InnerValue, 0, SignatureHintsize); + } - // =========================================================================== - public class SignatureHint + public static SignatureHint Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public SignatureHint() { } - - public SignatureHint(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, SignatureHint encodedSignatureHint) - { - int SignatureHintsize = encodedSignatureHint.InnerValue.Length; - stream.Write(encodedSignatureHint.InnerValue, 0, SignatureHintsize); - } - public static SignatureHint Decode(XdrDataInputStream stream) - { - SignatureHint decodedSignatureHint = new SignatureHint(); - int SignatureHintsize = 4; - decodedSignatureHint.InnerValue = new byte[SignatureHintsize]; - stream.Read(decodedSignatureHint.InnerValue, 0, SignatureHintsize); - return decodedSignatureHint; - } + var decodedSignatureHint = new SignatureHint(); + var SignatureHintsize = 4; + decodedSignatureHint.InnerValue = new byte[SignatureHintsize]; + stream.Read(decodedSignatureHint.InnerValue, 0, SignatureHintsize); + return decodedSignatureHint; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SignedSurveyRequestMessage.cs b/stellar-dotnet-sdk-xdr/generated/SignedSurveyRequestMessage.cs index b9692407..d1c31602 100644 --- a/stellar-dotnet-sdk-xdr/generated/SignedSurveyRequestMessage.cs +++ b/stellar-dotnet-sdk-xdr/generated/SignedSurveyRequestMessage.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SignedSurveyRequestMessage +// { +// Signature requestSignature; +// SurveyRequestMessage request; +// }; - // struct SignedSurveyRequestMessage - // { - // Signature requestSignature; - // SurveyRequestMessage request; - // }; +// =========================================================================== +public class SignedSurveyRequestMessage +{ + public Signature RequestSignature { get; set; } + public SurveyRequestMessage Request { get; set; } - // =========================================================================== - public class SignedSurveyRequestMessage + public static void Encode(XdrDataOutputStream stream, SignedSurveyRequestMessage encodedSignedSurveyRequestMessage) { - public SignedSurveyRequestMessage() { } - public Signature RequestSignature { get; set; } - public SurveyRequestMessage Request { get; set; } + Signature.Encode(stream, encodedSignedSurveyRequestMessage.RequestSignature); + SurveyRequestMessage.Encode(stream, encodedSignedSurveyRequestMessage.Request); + } - public static void Encode(XdrDataOutputStream stream, SignedSurveyRequestMessage encodedSignedSurveyRequestMessage) - { - Signature.Encode(stream, encodedSignedSurveyRequestMessage.RequestSignature); - SurveyRequestMessage.Encode(stream, encodedSignedSurveyRequestMessage.Request); - } - public static SignedSurveyRequestMessage Decode(XdrDataInputStream stream) - { - SignedSurveyRequestMessage decodedSignedSurveyRequestMessage = new SignedSurveyRequestMessage(); - decodedSignedSurveyRequestMessage.RequestSignature = Signature.Decode(stream); - decodedSignedSurveyRequestMessage.Request = SurveyRequestMessage.Decode(stream); - return decodedSignedSurveyRequestMessage; - } + public static SignedSurveyRequestMessage Decode(XdrDataInputStream stream) + { + var decodedSignedSurveyRequestMessage = new SignedSurveyRequestMessage(); + decodedSignedSurveyRequestMessage.RequestSignature = Signature.Decode(stream); + decodedSignedSurveyRequestMessage.Request = SurveyRequestMessage.Decode(stream); + return decodedSignedSurveyRequestMessage; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SignedSurveyResponseMessage.cs b/stellar-dotnet-sdk-xdr/generated/SignedSurveyResponseMessage.cs index 876044ea..db961b6c 100644 --- a/stellar-dotnet-sdk-xdr/generated/SignedSurveyResponseMessage.cs +++ b/stellar-dotnet-sdk-xdr/generated/SignedSurveyResponseMessage.cs @@ -1,36 +1,34 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SignedSurveyResponseMessage +// { +// Signature responseSignature; +// SurveyResponseMessage response; +// }; - // struct SignedSurveyResponseMessage - // { - // Signature responseSignature; - // SurveyResponseMessage response; - // }; +// =========================================================================== +public class SignedSurveyResponseMessage +{ + public Signature ResponseSignature { get; set; } + public SurveyResponseMessage Response { get; set; } - // =========================================================================== - public class SignedSurveyResponseMessage + public static void Encode(XdrDataOutputStream stream, + SignedSurveyResponseMessage encodedSignedSurveyResponseMessage) { - public SignedSurveyResponseMessage() { } - public Signature ResponseSignature { get; set; } - public SurveyResponseMessage Response { get; set; } + Signature.Encode(stream, encodedSignedSurveyResponseMessage.ResponseSignature); + SurveyResponseMessage.Encode(stream, encodedSignedSurveyResponseMessage.Response); + } - public static void Encode(XdrDataOutputStream stream, SignedSurveyResponseMessage encodedSignedSurveyResponseMessage) - { - Signature.Encode(stream, encodedSignedSurveyResponseMessage.ResponseSignature); - SurveyResponseMessage.Encode(stream, encodedSignedSurveyResponseMessage.Response); - } - public static SignedSurveyResponseMessage Decode(XdrDataInputStream stream) - { - SignedSurveyResponseMessage decodedSignedSurveyResponseMessage = new SignedSurveyResponseMessage(); - decodedSignedSurveyResponseMessage.ResponseSignature = Signature.Decode(stream); - decodedSignedSurveyResponseMessage.Response = SurveyResponseMessage.Decode(stream); - return decodedSignedSurveyResponseMessage; - } + public static SignedSurveyResponseMessage Decode(XdrDataInputStream stream) + { + var decodedSignedSurveyResponseMessage = new SignedSurveyResponseMessage(); + decodedSignedSurveyResponseMessage.ResponseSignature = Signature.Decode(stream); + decodedSignedSurveyResponseMessage.Response = SurveyResponseMessage.Decode(stream); + return decodedSignedSurveyResponseMessage; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Signer.cs b/stellar-dotnet-sdk-xdr/generated/Signer.cs index c0195ea0..bf17b2ff 100644 --- a/stellar-dotnet-sdk-xdr/generated/Signer.cs +++ b/stellar-dotnet-sdk-xdr/generated/Signer.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct Signer +// { +// SignerKey key; +// uint32 weight; // really only need 1 byte +// }; - // struct Signer - // { - // SignerKey key; - // uint32 weight; // really only need 1 byte - // }; +// =========================================================================== +public class Signer +{ + public SignerKey Key { get; set; } + public Uint32 Weight { get; set; } - // =========================================================================== - public class Signer + public static void Encode(XdrDataOutputStream stream, Signer encodedSigner) { - public Signer() { } - public SignerKey Key { get; set; } - public Uint32 Weight { get; set; } + SignerKey.Encode(stream, encodedSigner.Key); + Uint32.Encode(stream, encodedSigner.Weight); + } - public static void Encode(XdrDataOutputStream stream, Signer encodedSigner) - { - SignerKey.Encode(stream, encodedSigner.Key); - Uint32.Encode(stream, encodedSigner.Weight); - } - public static Signer Decode(XdrDataInputStream stream) - { - Signer decodedSigner = new Signer(); - decodedSigner.Key = SignerKey.Decode(stream); - decodedSigner.Weight = Uint32.Decode(stream); - return decodedSigner; - } + public static Signer Decode(XdrDataInputStream stream) + { + var decodedSigner = new Signer(); + decodedSigner.Key = SignerKey.Decode(stream); + decodedSigner.Weight = Uint32.Decode(stream); + return decodedSigner; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SignerKey.cs b/stellar-dotnet-sdk-xdr/generated/SignerKey.cs index 8e9b8c62..e1726f65 100644 --- a/stellar-dotnet-sdk-xdr/generated/SignerKey.cs +++ b/stellar-dotnet-sdk-xdr/generated/SignerKey.cs @@ -1,108 +1,106 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union SignerKey switch (SignerKeyType type) - // { - // case SIGNER_KEY_TYPE_ED25519: - // uint256 ed25519; - // case SIGNER_KEY_TYPE_PRE_AUTH_TX: - // /* SHA-256 Hash of TransactionSignaturePayload structure */ - // uint256 preAuthTx; - // case SIGNER_KEY_TYPE_HASH_X: - // /* Hash of random 256 bit preimage X */ - // uint256 hashX; - // case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD: - // struct - // { - // /* Public key that must sign the payload. */ - // uint256 ed25519; - // /* Payload to be raw signed by ed25519. */ - // opaque payload<64>; - // } ed25519SignedPayload; - // }; +// union SignerKey switch (SignerKeyType type) +// { +// case SIGNER_KEY_TYPE_ED25519: +// uint256 ed25519; +// case SIGNER_KEY_TYPE_PRE_AUTH_TX: +// /* SHA-256 Hash of TransactionSignaturePayload structure */ +// uint256 preAuthTx; +// case SIGNER_KEY_TYPE_HASH_X: +// /* Hash of random 256 bit preimage X */ +// uint256 hashX; +// case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD: +// struct +// { +// /* Public key that must sign the payload. */ +// uint256 ed25519; +// /* Payload to be raw signed by ed25519. */ +// opaque payload<64>; +// } ed25519SignedPayload; +// }; - // =========================================================================== - public class SignerKey - { - public SignerKey() { } +// =========================================================================== +public class SignerKey +{ + public SignerKeyType Discriminant { get; set; } = new(); - public SignerKeyType Discriminant { get; set; } = new SignerKeyType(); + public Uint256 Ed25519 { get; set; } + public Uint256 PreAuthTx { get; set; } + public Uint256 HashX { get; set; } + public SignerKeyEd25519SignedPayload Ed25519SignedPayload { get; set; } - public Uint256 Ed25519 { get; set; } - public Uint256 PreAuthTx { get; set; } - public Uint256 HashX { get; set; } - public SignerKeyEd25519SignedPayload Ed25519SignedPayload { get; set; } - public static void Encode(XdrDataOutputStream stream, SignerKey encodedSignerKey) + public static void Encode(XdrDataOutputStream stream, SignerKey encodedSignerKey) + { + stream.WriteInt((int)encodedSignerKey.Discriminant.InnerValue); + switch (encodedSignerKey.Discriminant.InnerValue) { - stream.WriteInt((int)encodedSignerKey.Discriminant.InnerValue); - switch (encodedSignerKey.Discriminant.InnerValue) - { - case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: - Uint256.Encode(stream, encodedSignerKey.Ed25519); - break; - case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: - Uint256.Encode(stream, encodedSignerKey.PreAuthTx); - break; - case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: - Uint256.Encode(stream, encodedSignerKey.HashX); - break; - case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD: - SignerKeyEd25519SignedPayload.Encode(stream, encodedSignerKey.Ed25519SignedPayload); - break; - } + case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: + Uint256.Encode(stream, encodedSignerKey.Ed25519); + break; + case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: + Uint256.Encode(stream, encodedSignerKey.PreAuthTx); + break; + case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: + Uint256.Encode(stream, encodedSignerKey.HashX); + break; + case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD: + SignerKeyEd25519SignedPayload.Encode(stream, encodedSignerKey.Ed25519SignedPayload); + break; } - public static SignerKey Decode(XdrDataInputStream stream) + } + + public static SignerKey Decode(XdrDataInputStream stream) + { + var decodedSignerKey = new SignerKey(); + var discriminant = SignerKeyType.Decode(stream); + decodedSignerKey.Discriminant = discriminant; + switch (decodedSignerKey.Discriminant.InnerValue) { - SignerKey decodedSignerKey = new SignerKey(); - SignerKeyType discriminant = SignerKeyType.Decode(stream); - decodedSignerKey.Discriminant = discriminant; - switch (decodedSignerKey.Discriminant.InnerValue) - { - case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: - decodedSignerKey.Ed25519 = Uint256.Decode(stream); - break; - case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: - decodedSignerKey.PreAuthTx = Uint256.Decode(stream); - break; - case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: - decodedSignerKey.HashX = Uint256.Decode(stream); - break; - case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD: - decodedSignerKey.Ed25519SignedPayload = SignerKeyEd25519SignedPayload.Decode(stream); - break; - } - return decodedSignerKey; + case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: + decodedSignerKey.Ed25519 = Uint256.Decode(stream); + break; + case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: + decodedSignerKey.PreAuthTx = Uint256.Decode(stream); + break; + case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: + decodedSignerKey.HashX = Uint256.Decode(stream); + break; + case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD: + decodedSignerKey.Ed25519SignedPayload = SignerKeyEd25519SignedPayload.Decode(stream); + break; } - public class SignerKeyEd25519SignedPayload - { - public SignerKeyEd25519SignedPayload() { } - public Uint256 Ed25519 { get; set; } - public byte[] Payload { get; set; } + return decodedSignerKey; + } + + public class SignerKeyEd25519SignedPayload + { + public Uint256 Ed25519 { get; set; } + public byte[] Payload { get; set; } - public static void Encode(XdrDataOutputStream stream, SignerKeyEd25519SignedPayload encodedSignerKeyEd25519SignedPayload) - { - Uint256.Encode(stream, encodedSignerKeyEd25519SignedPayload.Ed25519); - int payloadsize = encodedSignerKeyEd25519SignedPayload.Payload.Length; - stream.WriteInt(payloadsize); - stream.Write(encodedSignerKeyEd25519SignedPayload.Payload, 0, payloadsize); - } - public static SignerKeyEd25519SignedPayload Decode(XdrDataInputStream stream) - { - SignerKeyEd25519SignedPayload decodedSignerKeyEd25519SignedPayload = new SignerKeyEd25519SignedPayload(); - decodedSignerKeyEd25519SignedPayload.Ed25519 = Uint256.Decode(stream); - int payloadsize = stream.ReadInt(); - decodedSignerKeyEd25519SignedPayload.Payload = new byte[payloadsize]; - stream.Read(decodedSignerKeyEd25519SignedPayload.Payload, 0, payloadsize); - return decodedSignerKeyEd25519SignedPayload; - } + public static void Encode(XdrDataOutputStream stream, + SignerKeyEd25519SignedPayload encodedSignerKeyEd25519SignedPayload) + { + Uint256.Encode(stream, encodedSignerKeyEd25519SignedPayload.Ed25519); + var payloadsize = encodedSignerKeyEd25519SignedPayload.Payload.Length; + stream.WriteInt(payloadsize); + stream.Write(encodedSignerKeyEd25519SignedPayload.Payload, 0, payloadsize); + } + public static SignerKeyEd25519SignedPayload Decode(XdrDataInputStream stream) + { + var decodedSignerKeyEd25519SignedPayload = new SignerKeyEd25519SignedPayload(); + decodedSignerKeyEd25519SignedPayload.Ed25519 = Uint256.Decode(stream); + var payloadsize = stream.ReadInt(); + decodedSignerKeyEd25519SignedPayload.Payload = new byte[payloadsize]; + stream.Read(decodedSignerKeyEd25519SignedPayload.Payload, 0, payloadsize); + return decodedSignerKeyEd25519SignedPayload; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SignerKeyType.cs b/stellar-dotnet-sdk-xdr/generated/SignerKeyType.cs index 9e9be64f..c5f8f536 100644 --- a/stellar-dotnet-sdk-xdr/generated/SignerKeyType.cs +++ b/stellar-dotnet-sdk-xdr/generated/SignerKeyType.cs @@ -1,57 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum SignerKeyType - // { - // SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519, - // SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX, - // SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X, - // SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD = KEY_TYPE_ED25519_SIGNED_PAYLOAD - // }; +// enum SignerKeyType +// { +// SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519, +// SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX, +// SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X, +// SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD = KEY_TYPE_ED25519_SIGNED_PAYLOAD +// }; - // =========================================================================== - public class SignerKeyType +// =========================================================================== +public class SignerKeyType +{ + public enum SignerKeyTypeEnum { - public enum SignerKeyTypeEnum - { - SIGNER_KEY_TYPE_ED25519 = 0, - SIGNER_KEY_TYPE_PRE_AUTH_TX = 1, - SIGNER_KEY_TYPE_HASH_X = 2, - SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3, - } - public SignerKeyTypeEnum InnerValue { get; set; } = default(SignerKeyTypeEnum); + SIGNER_KEY_TYPE_ED25519 = 0, + SIGNER_KEY_TYPE_PRE_AUTH_TX = 1, + SIGNER_KEY_TYPE_HASH_X = 2, + SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3 + } - public static SignerKeyType Create(SignerKeyTypeEnum v) - { - return new SignerKeyType - { - InnerValue = v - }; - } + public SignerKeyTypeEnum InnerValue { get; set; } = default; - public static SignerKeyType Decode(XdrDataInputStream stream) + public static SignerKeyType Create(SignerKeyTypeEnum v) + { + return new SignerKeyType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519); - case 1: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX); - case 2: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X); - case 3: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, SignerKeyType value) + public static SignerKeyType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519); + case 1: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX); + case 2: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X); + case 3: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, SignerKeyType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SimplePaymentResult.cs b/stellar-dotnet-sdk-xdr/generated/SimplePaymentResult.cs index 5e624c37..7c03ec0f 100644 --- a/stellar-dotnet-sdk-xdr/generated/SimplePaymentResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/SimplePaymentResult.cs @@ -1,40 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SimplePaymentResult +// { +// AccountID destination; +// Asset asset; +// int64 amount; +// }; - // struct SimplePaymentResult - // { - // AccountID destination; - // Asset asset; - // int64 amount; - // }; +// =========================================================================== +public class SimplePaymentResult +{ + public AccountID Destination { get; set; } + public Asset Asset { get; set; } + public Int64 Amount { get; set; } - // =========================================================================== - public class SimplePaymentResult + public static void Encode(XdrDataOutputStream stream, SimplePaymentResult encodedSimplePaymentResult) { - public SimplePaymentResult() { } - public AccountID Destination { get; set; } - public Asset Asset { get; set; } - public Int64 Amount { get; set; } + AccountID.Encode(stream, encodedSimplePaymentResult.Destination); + Asset.Encode(stream, encodedSimplePaymentResult.Asset); + Int64.Encode(stream, encodedSimplePaymentResult.Amount); + } - public static void Encode(XdrDataOutputStream stream, SimplePaymentResult encodedSimplePaymentResult) - { - AccountID.Encode(stream, encodedSimplePaymentResult.Destination); - Asset.Encode(stream, encodedSimplePaymentResult.Asset); - Int64.Encode(stream, encodedSimplePaymentResult.Amount); - } - public static SimplePaymentResult Decode(XdrDataInputStream stream) - { - SimplePaymentResult decodedSimplePaymentResult = new SimplePaymentResult(); - decodedSimplePaymentResult.Destination = AccountID.Decode(stream); - decodedSimplePaymentResult.Asset = Asset.Decode(stream); - decodedSimplePaymentResult.Amount = Int64.Decode(stream); - return decodedSimplePaymentResult; - } + public static SimplePaymentResult Decode(XdrDataInputStream stream) + { + var decodedSimplePaymentResult = new SimplePaymentResult(); + decodedSimplePaymentResult.Destination = AccountID.Decode(stream); + decodedSimplePaymentResult.Asset = Asset.Decode(stream); + decodedSimplePaymentResult.Amount = Int64.Decode(stream); + return decodedSimplePaymentResult; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanAddressCredentials.cs b/stellar-dotnet-sdk-xdr/generated/SorobanAddressCredentials.cs new file mode 100644 index 00000000..6a243747 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanAddressCredentials.cs @@ -0,0 +1,41 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SorobanAddressCredentials +// { +// SCAddress address; +// int64 nonce; +// uint32 signatureExpirationLedger; +// SCVal signature; +// }; + +// =========================================================================== +public class SorobanAddressCredentials +{ + public SCAddress Address { get; set; } + public Int64 Nonce { get; set; } + public Uint32 SignatureExpirationLedger { get; set; } + public SCVal Signature { get; set; } + + public static void Encode(XdrDataOutputStream stream, SorobanAddressCredentials encodedSorobanAddressCredentials) + { + SCAddress.Encode(stream, encodedSorobanAddressCredentials.Address); + Int64.Encode(stream, encodedSorobanAddressCredentials.Nonce); + Uint32.Encode(stream, encodedSorobanAddressCredentials.SignatureExpirationLedger); + SCVal.Encode(stream, encodedSorobanAddressCredentials.Signature); + } + + public static SorobanAddressCredentials Decode(XdrDataInputStream stream) + { + var decodedSorobanAddressCredentials = new SorobanAddressCredentials(); + decodedSorobanAddressCredentials.Address = SCAddress.Decode(stream); + decodedSorobanAddressCredentials.Nonce = Int64.Decode(stream); + decodedSorobanAddressCredentials.SignatureExpirationLedger = Uint32.Decode(stream); + decodedSorobanAddressCredentials.Signature = SCVal.Decode(stream); + return decodedSorobanAddressCredentials; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizationEntry.cs b/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizationEntry.cs new file mode 100644 index 00000000..e09da3c5 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizationEntry.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SorobanAuthorizationEntry +// { +// SorobanCredentials credentials; +// SorobanAuthorizedInvocation rootInvocation; +// }; + +// =========================================================================== +public class SorobanAuthorizationEntry +{ + public SorobanCredentials Credentials { get; set; } + public SorobanAuthorizedInvocation RootInvocation { get; set; } + + public static void Encode(XdrDataOutputStream stream, SorobanAuthorizationEntry encodedSorobanAuthorizationEntry) + { + SorobanCredentials.Encode(stream, encodedSorobanAuthorizationEntry.Credentials); + SorobanAuthorizedInvocation.Encode(stream, encodedSorobanAuthorizationEntry.RootInvocation); + } + + public static SorobanAuthorizationEntry Decode(XdrDataInputStream stream) + { + var decodedSorobanAuthorizationEntry = new SorobanAuthorizationEntry(); + decodedSorobanAuthorizationEntry.Credentials = SorobanCredentials.Decode(stream); + decodedSorobanAuthorizationEntry.RootInvocation = SorobanAuthorizedInvocation.Decode(stream); + return decodedSorobanAuthorizationEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedFunction.cs b/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedFunction.cs new file mode 100644 index 00000000..2e129705 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedFunction.cs @@ -0,0 +1,59 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SorobanAuthorizedFunction switch (SorobanAuthorizedFunctionType type) +// { +// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: +// InvokeContractArgs contractFn; +// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: +// CreateContractArgs createContractHostFn; +// }; + +// =========================================================================== +public class SorobanAuthorizedFunction +{ + public SorobanAuthorizedFunctionType Discriminant { get; set; } = new(); + + public InvokeContractArgs ContractFn { get; set; } + public CreateContractArgs CreateContractHostFn { get; set; } + + public static void Encode(XdrDataOutputStream stream, SorobanAuthorizedFunction encodedSorobanAuthorizedFunction) + { + stream.WriteInt((int)encodedSorobanAuthorizedFunction.Discriminant.InnerValue); + switch (encodedSorobanAuthorizedFunction.Discriminant.InnerValue) + { + case SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum + .SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: + InvokeContractArgs.Encode(stream, encodedSorobanAuthorizedFunction.ContractFn); + break; + case SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum + .SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: + CreateContractArgs.Encode(stream, encodedSorobanAuthorizedFunction.CreateContractHostFn); + break; + } + } + + public static SorobanAuthorizedFunction Decode(XdrDataInputStream stream) + { + var decodedSorobanAuthorizedFunction = new SorobanAuthorizedFunction(); + var discriminant = SorobanAuthorizedFunctionType.Decode(stream); + decodedSorobanAuthorizedFunction.Discriminant = discriminant; + switch (decodedSorobanAuthorizedFunction.Discriminant.InnerValue) + { + case SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum + .SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: + decodedSorobanAuthorizedFunction.ContractFn = InvokeContractArgs.Decode(stream); + break; + case SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum + .SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: + decodedSorobanAuthorizedFunction.CreateContractHostFn = CreateContractArgs.Decode(stream); + break; + } + + return decodedSorobanAuthorizedFunction; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedFunctionType.cs b/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedFunctionType.cs new file mode 100644 index 00000000..24e47afb --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedFunctionType.cs @@ -0,0 +1,53 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SorobanAuthorizedFunctionType +// { +// SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0, +// SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1 +// }; + +// =========================================================================== +public class SorobanAuthorizedFunctionType +{ + public enum SorobanAuthorizedFunctionTypeEnum + { + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0, + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1 + } + + public SorobanAuthorizedFunctionTypeEnum InnerValue { get; set; } = default; + + public static SorobanAuthorizedFunctionType Create(SorobanAuthorizedFunctionTypeEnum v) + { + return new SorobanAuthorizedFunctionType + { + InnerValue = v + }; + } + + public static SorobanAuthorizedFunctionType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SorobanAuthorizedFunctionTypeEnum.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN); + case 1: + return Create( + SorobanAuthorizedFunctionTypeEnum.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SorobanAuthorizedFunctionType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedInvocation.cs b/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedInvocation.cs new file mode 100644 index 00000000..b90028d0 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanAuthorizedInvocation.cs @@ -0,0 +1,40 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SorobanAuthorizedInvocation +// { +// SorobanAuthorizedFunction function; +// SorobanAuthorizedInvocation subInvocations<>; +// }; + +// =========================================================================== +public class SorobanAuthorizedInvocation +{ + public SorobanAuthorizedFunction Function { get; set; } + public SorobanAuthorizedInvocation[] SubInvocations { get; set; } + + public static void Encode(XdrDataOutputStream stream, + SorobanAuthorizedInvocation encodedSorobanAuthorizedInvocation) + { + SorobanAuthorizedFunction.Encode(stream, encodedSorobanAuthorizedInvocation.Function); + var subInvocationssize = encodedSorobanAuthorizedInvocation.SubInvocations.Length; + stream.WriteInt(subInvocationssize); + for (var i = 0; i < subInvocationssize; i++) + Encode(stream, encodedSorobanAuthorizedInvocation.SubInvocations[i]); + } + + public static SorobanAuthorizedInvocation Decode(XdrDataInputStream stream) + { + var decodedSorobanAuthorizedInvocation = new SorobanAuthorizedInvocation(); + decodedSorobanAuthorizedInvocation.Function = SorobanAuthorizedFunction.Decode(stream); + var subInvocationssize = stream.ReadInt(); + decodedSorobanAuthorizedInvocation.SubInvocations = new SorobanAuthorizedInvocation[subInvocationssize]; + for (var i = 0; i < subInvocationssize; i++) + decodedSorobanAuthorizedInvocation.SubInvocations[i] = Decode(stream); + return decodedSorobanAuthorizedInvocation; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanCredentials.cs b/stellar-dotnet-sdk-xdr/generated/SorobanCredentials.cs new file mode 100644 index 00000000..f230ec5b --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanCredentials.cs @@ -0,0 +1,52 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union SorobanCredentials switch (SorobanCredentialsType type) +// { +// case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: +// void; +// case SOROBAN_CREDENTIALS_ADDRESS: +// SorobanAddressCredentials address; +// }; + +// =========================================================================== +public class SorobanCredentials +{ + public SorobanCredentialsType Discriminant { get; set; } = new(); + + public SorobanAddressCredentials Address { get; set; } + + public static void Encode(XdrDataOutputStream stream, SorobanCredentials encodedSorobanCredentials) + { + stream.WriteInt((int)encodedSorobanCredentials.Discriminant.InnerValue); + switch (encodedSorobanCredentials.Discriminant.InnerValue) + { + case SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: + break; + case SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_ADDRESS: + SorobanAddressCredentials.Encode(stream, encodedSorobanCredentials.Address); + break; + } + } + + public static SorobanCredentials Decode(XdrDataInputStream stream) + { + var decodedSorobanCredentials = new SorobanCredentials(); + var discriminant = SorobanCredentialsType.Decode(stream); + decodedSorobanCredentials.Discriminant = discriminant; + switch (decodedSorobanCredentials.Discriminant.InnerValue) + { + case SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: + break; + case SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_ADDRESS: + decodedSorobanCredentials.Address = SorobanAddressCredentials.Decode(stream); + break; + } + + return decodedSorobanCredentials; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanCredentialsType.cs b/stellar-dotnet-sdk-xdr/generated/SorobanCredentialsType.cs new file mode 100644 index 00000000..eb5f3751 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanCredentialsType.cs @@ -0,0 +1,51 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SorobanCredentialsType +// { +// SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0, +// SOROBAN_CREDENTIALS_ADDRESS = 1 +// }; + +// =========================================================================== +public class SorobanCredentialsType +{ + public enum SorobanCredentialsTypeEnum + { + SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0, + SOROBAN_CREDENTIALS_ADDRESS = 1 + } + + public SorobanCredentialsTypeEnum InnerValue { get; set; } = default; + + public static SorobanCredentialsType Create(SorobanCredentialsTypeEnum v) + { + return new SorobanCredentialsType + { + InnerValue = v + }; + } + + public static SorobanCredentialsType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_SOURCE_ACCOUNT); + case 1: return Create(SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_ADDRESS); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SorobanCredentialsType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanResources.cs b/stellar-dotnet-sdk-xdr/generated/SorobanResources.cs new file mode 100644 index 00000000..983dbe78 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanResources.cs @@ -0,0 +1,46 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SorobanResources +// { +// // The ledger footprint of the transaction. +// LedgerFootprint footprint; +// // The maximum number of instructions this transaction can use +// uint32 instructions; +// +// // The maximum number of bytes this transaction can read from ledger +// uint32 readBytes; +// // The maximum number of bytes this transaction can write to ledger +// uint32 writeBytes; +// }; + +// =========================================================================== +public class SorobanResources +{ + public LedgerFootprint Footprint { get; set; } + public Uint32 Instructions { get; set; } + public Uint32 ReadBytes { get; set; } + public Uint32 WriteBytes { get; set; } + + public static void Encode(XdrDataOutputStream stream, SorobanResources encodedSorobanResources) + { + LedgerFootprint.Encode(stream, encodedSorobanResources.Footprint); + Uint32.Encode(stream, encodedSorobanResources.Instructions); + Uint32.Encode(stream, encodedSorobanResources.ReadBytes); + Uint32.Encode(stream, encodedSorobanResources.WriteBytes); + } + + public static SorobanResources Decode(XdrDataInputStream stream) + { + var decodedSorobanResources = new SorobanResources(); + decodedSorobanResources.Footprint = LedgerFootprint.Decode(stream); + decodedSorobanResources.Instructions = Uint32.Decode(stream); + decodedSorobanResources.ReadBytes = Uint32.Decode(stream); + decodedSorobanResources.WriteBytes = Uint32.Decode(stream); + return decodedSorobanResources; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanTransactionData.cs b/stellar-dotnet-sdk-xdr/generated/SorobanTransactionData.cs new file mode 100644 index 00000000..7b1abe21 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanTransactionData.cs @@ -0,0 +1,46 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SorobanTransactionData +// { +// ExtensionPoint ext; +// SorobanResources resources; +// // Amount of the transaction `fee` allocated to the Soroban resource fees. +// // The fraction of `resourceFee` corresponding to `resources` specified +// // above is *not* refundable (i.e. fees for instructions, ledger I/O), as +// // well as fees for the transaction size. +// // The remaining part of the fee is refundable and the charged value is +// // based on the actual consumption of refundable resources (events, ledger +// // rent bumps). +// // The `inclusionFee` used for prioritization of the transaction is defined +// // as `tx.fee - resourceFee`. +// int64 resourceFee; +// }; + +// =========================================================================== +public class SorobanTransactionData +{ + public ExtensionPoint Ext { get; set; } + public SorobanResources Resources { get; set; } + public Int64 ResourceFee { get; set; } + + public static void Encode(XdrDataOutputStream stream, SorobanTransactionData encodedSorobanTransactionData) + { + ExtensionPoint.Encode(stream, encodedSorobanTransactionData.Ext); + SorobanResources.Encode(stream, encodedSorobanTransactionData.Resources); + Int64.Encode(stream, encodedSorobanTransactionData.ResourceFee); + } + + public static SorobanTransactionData Decode(XdrDataInputStream stream) + { + var decodedSorobanTransactionData = new SorobanTransactionData(); + decodedSorobanTransactionData.Ext = ExtensionPoint.Decode(stream); + decodedSorobanTransactionData.Resources = SorobanResources.Decode(stream); + decodedSorobanTransactionData.ResourceFee = Int64.Decode(stream); + return decodedSorobanTransactionData; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SorobanTransactionMeta.cs b/stellar-dotnet-sdk-xdr/generated/SorobanTransactionMeta.cs new file mode 100644 index 00000000..d8c3e36f --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SorobanTransactionMeta.cs @@ -0,0 +1,57 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct SorobanTransactionMeta +// { +// ExtensionPoint 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. +// DiagnosticEvent diagnosticEvents<>; +// }; + +// =========================================================================== +public class SorobanTransactionMeta +{ + public ExtensionPoint Ext { get; set; } + public ContractEvent[] Events { get; set; } + public SCVal ReturnValue { get; set; } + public DiagnosticEvent[] DiagnosticEvents { get; set; } + + public static void Encode(XdrDataOutputStream stream, SorobanTransactionMeta encodedSorobanTransactionMeta) + { + ExtensionPoint.Encode(stream, encodedSorobanTransactionMeta.Ext); + var eventssize = encodedSorobanTransactionMeta.Events.Length; + stream.WriteInt(eventssize); + for (var i = 0; i < eventssize; i++) ContractEvent.Encode(stream, encodedSorobanTransactionMeta.Events[i]); + SCVal.Encode(stream, encodedSorobanTransactionMeta.ReturnValue); + var diagnosticEventssize = encodedSorobanTransactionMeta.DiagnosticEvents.Length; + stream.WriteInt(diagnosticEventssize); + for (var i = 0; i < diagnosticEventssize; i++) + DiagnosticEvent.Encode(stream, encodedSorobanTransactionMeta.DiagnosticEvents[i]); + } + + public static SorobanTransactionMeta Decode(XdrDataInputStream stream) + { + var decodedSorobanTransactionMeta = new SorobanTransactionMeta(); + decodedSorobanTransactionMeta.Ext = ExtensionPoint.Decode(stream); + var eventssize = stream.ReadInt(); + decodedSorobanTransactionMeta.Events = new ContractEvent[eventssize]; + for (var i = 0; i < eventssize; i++) decodedSorobanTransactionMeta.Events[i] = ContractEvent.Decode(stream); + decodedSorobanTransactionMeta.ReturnValue = SCVal.Decode(stream); + var diagnosticEventssize = stream.ReadInt(); + decodedSorobanTransactionMeta.DiagnosticEvents = new DiagnosticEvent[diagnosticEventssize]; + for (var i = 0; i < diagnosticEventssize; i++) + decodedSorobanTransactionMeta.DiagnosticEvents[i] = DiagnosticEvent.Decode(stream); + return decodedSorobanTransactionMeta; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SponsorshipDescriptor.cs b/stellar-dotnet-sdk-xdr/generated/SponsorshipDescriptor.cs index 172d7318..64e95f44 100644 --- a/stellar-dotnet-sdk-xdr/generated/SponsorshipDescriptor.cs +++ b/stellar-dotnet-sdk-xdr/generated/SponsorshipDescriptor.cs @@ -1,47 +1,44 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // typedef AccountID* SponsorshipDescriptor; +// typedef AccountID* SponsorshipDescriptor; - // =========================================================================== - public class SponsorshipDescriptor +// =========================================================================== +public class SponsorshipDescriptor +{ + public SponsorshipDescriptor() { - public AccountID InnerValue { get; set; } = default(AccountID); + } - public SponsorshipDescriptor() { } + public SponsorshipDescriptor(AccountID value) + { + InnerValue = value; + } - public SponsorshipDescriptor(AccountID value) - { - InnerValue = value; - } + public AccountID InnerValue { get; set; } = default; - public static void Encode(XdrDataOutputStream stream, SponsorshipDescriptor encodedSponsorshipDescriptor) + public static void Encode(XdrDataOutputStream stream, SponsorshipDescriptor encodedSponsorshipDescriptor) + { + if (encodedSponsorshipDescriptor.InnerValue != null) { - if (encodedSponsorshipDescriptor.InnerValue != null) - { - stream.WriteInt(1); - AccountID.Encode(stream, encodedSponsorshipDescriptor.InnerValue); - } - else - { - stream.WriteInt(0); - } + stream.WriteInt(1); + AccountID.Encode(stream, encodedSponsorshipDescriptor.InnerValue); } - public static SponsorshipDescriptor Decode(XdrDataInputStream stream) + else { - SponsorshipDescriptor decodedSponsorshipDescriptor = new SponsorshipDescriptor(); - int SponsorshipDescriptorPresent = stream.ReadInt(); - if (SponsorshipDescriptorPresent != 0) - { - decodedSponsorshipDescriptor.InnerValue = AccountID.Decode(stream); - } - return decodedSponsorshipDescriptor; + stream.WriteInt(0); } } -} + + public static SponsorshipDescriptor Decode(XdrDataInputStream stream) + { + var decodedSponsorshipDescriptor = new SponsorshipDescriptor(); + var SponsorshipDescriptorPresent = stream.ReadInt(); + if (SponsorshipDescriptorPresent != 0) decodedSponsorshipDescriptor.InnerValue = AccountID.Decode(stream); + return decodedSponsorshipDescriptor; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/StateArchivalSettings.cs b/stellar-dotnet-sdk-xdr/generated/StateArchivalSettings.cs new file mode 100644 index 00000000..ab2caf8f --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/StateArchivalSettings.cs @@ -0,0 +1,70 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct StateArchivalSettings { +// uint32 maxEntryTTL; +// uint32 minTemporaryTTL; +// uint32 minPersistentTTL; +// +// // rent_fee = wfee_rate_average / rent_rate_denominator_for_type +// int64 persistentRentRateDenominator; +// int64 tempRentRateDenominator; +// +// // max number of entries that emit archival meta in a single ledger +// uint32 maxEntriesToArchive; +// +// // Number of snapshots to use when calculating average BucketList size +// uint32 bucketListSizeWindowSampleSize; +// +// // Maximum number of bytes that we scan for eviction per ledger +// uint64 evictionScanSize; +// +// // Lowest BucketList level to be scanned to evict entries +// uint32 startingEvictionScanLevel; +// }; + +// =========================================================================== +public class StateArchivalSettings +{ + public Uint32 MaxEntryTTL { get; set; } + public Uint32 MinTemporaryTTL { get; set; } + public Uint32 MinPersistentTTL { get; set; } + public Int64 PersistentRentRateDenominator { get; set; } + public Int64 TempRentRateDenominator { get; set; } + public Uint32 MaxEntriesToArchive { get; set; } + public Uint32 BucketListSizeWindowSampleSize { get; set; } + public Uint64 EvictionScanSize { get; set; } + public Uint32 StartingEvictionScanLevel { get; set; } + + public static void Encode(XdrDataOutputStream stream, StateArchivalSettings encodedStateArchivalSettings) + { + Uint32.Encode(stream, encodedStateArchivalSettings.MaxEntryTTL); + Uint32.Encode(stream, encodedStateArchivalSettings.MinTemporaryTTL); + Uint32.Encode(stream, encodedStateArchivalSettings.MinPersistentTTL); + Int64.Encode(stream, encodedStateArchivalSettings.PersistentRentRateDenominator); + Int64.Encode(stream, encodedStateArchivalSettings.TempRentRateDenominator); + Uint32.Encode(stream, encodedStateArchivalSettings.MaxEntriesToArchive); + Uint32.Encode(stream, encodedStateArchivalSettings.BucketListSizeWindowSampleSize); + Uint64.Encode(stream, encodedStateArchivalSettings.EvictionScanSize); + Uint32.Encode(stream, encodedStateArchivalSettings.StartingEvictionScanLevel); + } + + public static StateArchivalSettings Decode(XdrDataInputStream stream) + { + var decodedStateArchivalSettings = new StateArchivalSettings(); + decodedStateArchivalSettings.MaxEntryTTL = Uint32.Decode(stream); + decodedStateArchivalSettings.MinTemporaryTTL = Uint32.Decode(stream); + decodedStateArchivalSettings.MinPersistentTTL = Uint32.Decode(stream); + decodedStateArchivalSettings.PersistentRentRateDenominator = Int64.Decode(stream); + decodedStateArchivalSettings.TempRentRateDenominator = Int64.Decode(stream); + decodedStateArchivalSettings.MaxEntriesToArchive = Uint32.Decode(stream); + decodedStateArchivalSettings.BucketListSizeWindowSampleSize = Uint32.Decode(stream); + decodedStateArchivalSettings.EvictionScanSize = Uint64.Decode(stream); + decodedStateArchivalSettings.StartingEvictionScanLevel = Uint32.Decode(stream); + return decodedStateArchivalSettings; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/StellarMessage.cs b/stellar-dotnet-sdk-xdr/generated/StellarMessage.cs index 8a64a095..85a0d34a 100644 --- a/stellar-dotnet-sdk-xdr/generated/StellarMessage.cs +++ b/stellar-dotnet-sdk-xdr/generated/StellarMessage.cs @@ -1,196 +1,225 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union StellarMessage switch (MessageType type) - // { - // case ERROR_MSG: - // Error error; - // case HELLO: - // Hello hello; - // case AUTH: - // Auth auth; - // case DONT_HAVE: - // DontHave dontHave; - // case GET_PEERS: - // void; - // case PEERS: - // PeerAddress peers<100>; - // - // case GET_TX_SET: - // uint256 txSetHash; - // case TX_SET: - // TransactionSet txSet; - // - // case TRANSACTION: - // TransactionEnvelope transaction; - // - // case SURVEY_REQUEST: - // SignedSurveyRequestMessage signedSurveyRequestMessage; - // - // case SURVEY_RESPONSE: - // SignedSurveyResponseMessage signedSurveyResponseMessage; - // - // // SCP - // case GET_SCP_QUORUMSET: - // uint256 qSetHash; - // case SCP_QUORUMSET: - // SCPQuorumSet qSet; - // case SCP_MESSAGE: - // SCPEnvelope envelope; - // case GET_SCP_STATE: - // uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest - // case SEND_MORE: - // SendMore sendMoreMessage; - // }; +// union StellarMessage switch (MessageType type) +// { +// case ERROR_MSG: +// Error error; +// case HELLO: +// Hello hello; +// case AUTH: +// Auth auth; +// case DONT_HAVE: +// DontHave dontHave; +// case GET_PEERS: +// void; +// 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 SURVEY_REQUEST: +// SignedSurveyRequestMessage signedSurveyRequestMessage; +// +// case SURVEY_RESPONSE: +// SignedSurveyResponseMessage signedSurveyResponseMessage; +// +// // SCP +// case GET_SCP_QUORUMSET: +// uint256 qSetHash; +// case SCP_QUORUMSET: +// SCPQuorumSet qSet; +// case SCP_MESSAGE: +// SCPEnvelope envelope; +// case GET_SCP_STATE: +// uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest +// case SEND_MORE: +// SendMore sendMoreMessage; +// case SEND_MORE_EXTENDED: +// SendMoreExtended sendMoreExtendedMessage; +// // Pull mode +// case FLOOD_ADVERT: +// FloodAdvert floodAdvert; +// case FLOOD_DEMAND: +// FloodDemand floodDemand; +// }; - // =========================================================================== - public class StellarMessage - { - public StellarMessage() { } +// =========================================================================== +public class StellarMessage +{ + public MessageType Discriminant { get; set; } = new(); - public MessageType Discriminant { get; set; } = new MessageType(); + public Error Error { get; set; } + public Hello Hello { get; set; } + public Auth Auth { get; set; } + public DontHave DontHave { get; set; } + public PeerAddress[] Peers { get; set; } + public Uint256 TxSetHash { get; set; } + public TransactionSet TxSet { get; set; } + public GeneralizedTransactionSet GeneralizedTxSet { get; set; } + public TransactionEnvelope Transaction { get; set; } + public SignedSurveyRequestMessage SignedSurveyRequestMessage { get; set; } + public SignedSurveyResponseMessage SignedSurveyResponseMessage { get; set; } + public Uint256 QSetHash { get; set; } + public SCPQuorumSet QSet { get; set; } + public SCPEnvelope Envelope { get; set; } + public Uint32 GetSCPLedgerSeq { get; set; } + public SendMore SendMoreMessage { get; set; } + public SendMoreExtended SendMoreExtendedMessage { get; set; } + public FloodAdvert FloodAdvert { get; set; } + public FloodDemand FloodDemand { get; set; } - public Error Error { get; set; } - public Hello Hello { get; set; } - public Auth Auth { get; set; } - public DontHave DontHave { get; set; } - public PeerAddress[] Peers { get; set; } - public Uint256 TxSetHash { get; set; } - public TransactionSet TxSet { get; set; } - public TransactionEnvelope Transaction { get; set; } - public SignedSurveyRequestMessage SignedSurveyRequestMessage { get; set; } - public SignedSurveyResponseMessage SignedSurveyResponseMessage { get; set; } - public Uint256 QSetHash { get; set; } - public SCPQuorumSet QSet { get; set; } - public SCPEnvelope Envelope { get; set; } - public Uint32 GetSCPLedgerSeq { get; set; } - public SendMore SendMoreMessage { get; set; } - public static void Encode(XdrDataOutputStream stream, StellarMessage encodedStellarMessage) + public static void Encode(XdrDataOutputStream stream, StellarMessage encodedStellarMessage) + { + stream.WriteInt((int)encodedStellarMessage.Discriminant.InnerValue); + switch (encodedStellarMessage.Discriminant.InnerValue) { - stream.WriteInt((int)encodedStellarMessage.Discriminant.InnerValue); - switch (encodedStellarMessage.Discriminant.InnerValue) - { - case MessageType.MessageTypeEnum.ERROR_MSG: - Error.Encode(stream, encodedStellarMessage.Error); - break; - case MessageType.MessageTypeEnum.HELLO: - Hello.Encode(stream, encodedStellarMessage.Hello); - break; - case MessageType.MessageTypeEnum.AUTH: - Auth.Encode(stream, encodedStellarMessage.Auth); - break; - case MessageType.MessageTypeEnum.DONT_HAVE: - DontHave.Encode(stream, encodedStellarMessage.DontHave); - break; - case MessageType.MessageTypeEnum.GET_PEERS: - break; - case MessageType.MessageTypeEnum.PEERS: - int peerssize = encodedStellarMessage.Peers.Length; - stream.WriteInt(peerssize); - for (int i = 0; i < peerssize; i++) - { - PeerAddress.Encode(stream, encodedStellarMessage.Peers[i]); - } - break; - case MessageType.MessageTypeEnum.GET_TX_SET: - Uint256.Encode(stream, encodedStellarMessage.TxSetHash); - break; - case MessageType.MessageTypeEnum.TX_SET: - TransactionSet.Encode(stream, encodedStellarMessage.TxSet); - break; - case MessageType.MessageTypeEnum.TRANSACTION: - TransactionEnvelope.Encode(stream, encodedStellarMessage.Transaction); - break; - case MessageType.MessageTypeEnum.SURVEY_REQUEST: - SignedSurveyRequestMessage.Encode(stream, encodedStellarMessage.SignedSurveyRequestMessage); - break; - case MessageType.MessageTypeEnum.SURVEY_RESPONSE: - SignedSurveyResponseMessage.Encode(stream, encodedStellarMessage.SignedSurveyResponseMessage); - break; - case MessageType.MessageTypeEnum.GET_SCP_QUORUMSET: - Uint256.Encode(stream, encodedStellarMessage.QSetHash); - break; - case MessageType.MessageTypeEnum.SCP_QUORUMSET: - SCPQuorumSet.Encode(stream, encodedStellarMessage.QSet); - break; - case MessageType.MessageTypeEnum.SCP_MESSAGE: - SCPEnvelope.Encode(stream, encodedStellarMessage.Envelope); - break; - case MessageType.MessageTypeEnum.GET_SCP_STATE: - Uint32.Encode(stream, encodedStellarMessage.GetSCPLedgerSeq); - break; - case MessageType.MessageTypeEnum.SEND_MORE: - SendMore.Encode(stream, encodedStellarMessage.SendMoreMessage); - break; - } + case MessageType.MessageTypeEnum.ERROR_MSG: + Error.Encode(stream, encodedStellarMessage.Error); + break; + case MessageType.MessageTypeEnum.HELLO: + Hello.Encode(stream, encodedStellarMessage.Hello); + break; + case MessageType.MessageTypeEnum.AUTH: + Auth.Encode(stream, encodedStellarMessage.Auth); + break; + case MessageType.MessageTypeEnum.DONT_HAVE: + DontHave.Encode(stream, encodedStellarMessage.DontHave); + break; + case MessageType.MessageTypeEnum.GET_PEERS: + break; + case MessageType.MessageTypeEnum.PEERS: + var peerssize = encodedStellarMessage.Peers.Length; + stream.WriteInt(peerssize); + for (var i = 0; i < peerssize; i++) PeerAddress.Encode(stream, encodedStellarMessage.Peers[i]); + break; + case MessageType.MessageTypeEnum.GET_TX_SET: + Uint256.Encode(stream, encodedStellarMessage.TxSetHash); + break; + case MessageType.MessageTypeEnum.TX_SET: + TransactionSet.Encode(stream, encodedStellarMessage.TxSet); + break; + case MessageType.MessageTypeEnum.GENERALIZED_TX_SET: + GeneralizedTransactionSet.Encode(stream, encodedStellarMessage.GeneralizedTxSet); + break; + case MessageType.MessageTypeEnum.TRANSACTION: + TransactionEnvelope.Encode(stream, encodedStellarMessage.Transaction); + break; + case MessageType.MessageTypeEnum.SURVEY_REQUEST: + SignedSurveyRequestMessage.Encode(stream, encodedStellarMessage.SignedSurveyRequestMessage); + break; + case MessageType.MessageTypeEnum.SURVEY_RESPONSE: + SignedSurveyResponseMessage.Encode(stream, encodedStellarMessage.SignedSurveyResponseMessage); + break; + case MessageType.MessageTypeEnum.GET_SCP_QUORUMSET: + Uint256.Encode(stream, encodedStellarMessage.QSetHash); + break; + case MessageType.MessageTypeEnum.SCP_QUORUMSET: + SCPQuorumSet.Encode(stream, encodedStellarMessage.QSet); + break; + case MessageType.MessageTypeEnum.SCP_MESSAGE: + SCPEnvelope.Encode(stream, encodedStellarMessage.Envelope); + break; + case MessageType.MessageTypeEnum.GET_SCP_STATE: + Uint32.Encode(stream, encodedStellarMessage.GetSCPLedgerSeq); + break; + case MessageType.MessageTypeEnum.SEND_MORE: + SendMore.Encode(stream, encodedStellarMessage.SendMoreMessage); + break; + case MessageType.MessageTypeEnum.SEND_MORE_EXTENDED: + SendMoreExtended.Encode(stream, encodedStellarMessage.SendMoreExtendedMessage); + break; + case MessageType.MessageTypeEnum.FLOOD_ADVERT: + FloodAdvert.Encode(stream, encodedStellarMessage.FloodAdvert); + break; + case MessageType.MessageTypeEnum.FLOOD_DEMAND: + FloodDemand.Encode(stream, encodedStellarMessage.FloodDemand); + break; } - public static StellarMessage Decode(XdrDataInputStream stream) + } + + public static StellarMessage Decode(XdrDataInputStream stream) + { + var decodedStellarMessage = new StellarMessage(); + var discriminant = MessageType.Decode(stream); + decodedStellarMessage.Discriminant = discriminant; + switch (decodedStellarMessage.Discriminant.InnerValue) { - StellarMessage decodedStellarMessage = new StellarMessage(); - MessageType discriminant = MessageType.Decode(stream); - decodedStellarMessage.Discriminant = discriminant; - switch (decodedStellarMessage.Discriminant.InnerValue) - { - case MessageType.MessageTypeEnum.ERROR_MSG: - decodedStellarMessage.Error = Error.Decode(stream); - break; - case MessageType.MessageTypeEnum.HELLO: - decodedStellarMessage.Hello = Hello.Decode(stream); - break; - case MessageType.MessageTypeEnum.AUTH: - decodedStellarMessage.Auth = Auth.Decode(stream); - break; - case MessageType.MessageTypeEnum.DONT_HAVE: - decodedStellarMessage.DontHave = DontHave.Decode(stream); - break; - case MessageType.MessageTypeEnum.GET_PEERS: - break; - case MessageType.MessageTypeEnum.PEERS: - int peerssize = stream.ReadInt(); - decodedStellarMessage.Peers = new PeerAddress[peerssize]; - for (int i = 0; i < peerssize; i++) - { - decodedStellarMessage.Peers[i] = PeerAddress.Decode(stream); - } - break; - case MessageType.MessageTypeEnum.GET_TX_SET: - decodedStellarMessage.TxSetHash = Uint256.Decode(stream); - break; - case MessageType.MessageTypeEnum.TX_SET: - decodedStellarMessage.TxSet = TransactionSet.Decode(stream); - break; - case MessageType.MessageTypeEnum.TRANSACTION: - decodedStellarMessage.Transaction = TransactionEnvelope.Decode(stream); - break; - case MessageType.MessageTypeEnum.SURVEY_REQUEST: - decodedStellarMessage.SignedSurveyRequestMessage = SignedSurveyRequestMessage.Decode(stream); - break; - case MessageType.MessageTypeEnum.SURVEY_RESPONSE: - decodedStellarMessage.SignedSurveyResponseMessage = SignedSurveyResponseMessage.Decode(stream); - break; - case MessageType.MessageTypeEnum.GET_SCP_QUORUMSET: - decodedStellarMessage.QSetHash = Uint256.Decode(stream); - break; - case MessageType.MessageTypeEnum.SCP_QUORUMSET: - decodedStellarMessage.QSet = SCPQuorumSet.Decode(stream); - break; - case MessageType.MessageTypeEnum.SCP_MESSAGE: - decodedStellarMessage.Envelope = SCPEnvelope.Decode(stream); - break; - case MessageType.MessageTypeEnum.GET_SCP_STATE: - decodedStellarMessage.GetSCPLedgerSeq = Uint32.Decode(stream); - break; - case MessageType.MessageTypeEnum.SEND_MORE: - decodedStellarMessage.SendMoreMessage = SendMore.Decode(stream); - break; - } - return decodedStellarMessage; + case MessageType.MessageTypeEnum.ERROR_MSG: + decodedStellarMessage.Error = Error.Decode(stream); + break; + case MessageType.MessageTypeEnum.HELLO: + decodedStellarMessage.Hello = Hello.Decode(stream); + break; + case MessageType.MessageTypeEnum.AUTH: + decodedStellarMessage.Auth = Auth.Decode(stream); + break; + case MessageType.MessageTypeEnum.DONT_HAVE: + decodedStellarMessage.DontHave = DontHave.Decode(stream); + break; + case MessageType.MessageTypeEnum.GET_PEERS: + break; + case MessageType.MessageTypeEnum.PEERS: + var peerssize = stream.ReadInt(); + decodedStellarMessage.Peers = new PeerAddress[peerssize]; + for (var i = 0; i < peerssize; i++) decodedStellarMessage.Peers[i] = PeerAddress.Decode(stream); + break; + case MessageType.MessageTypeEnum.GET_TX_SET: + decodedStellarMessage.TxSetHash = Uint256.Decode(stream); + break; + case MessageType.MessageTypeEnum.TX_SET: + decodedStellarMessage.TxSet = TransactionSet.Decode(stream); + break; + case MessageType.MessageTypeEnum.GENERALIZED_TX_SET: + decodedStellarMessage.GeneralizedTxSet = GeneralizedTransactionSet.Decode(stream); + break; + case MessageType.MessageTypeEnum.TRANSACTION: + decodedStellarMessage.Transaction = TransactionEnvelope.Decode(stream); + break; + case MessageType.MessageTypeEnum.SURVEY_REQUEST: + decodedStellarMessage.SignedSurveyRequestMessage = SignedSurveyRequestMessage.Decode(stream); + break; + case MessageType.MessageTypeEnum.SURVEY_RESPONSE: + decodedStellarMessage.SignedSurveyResponseMessage = SignedSurveyResponseMessage.Decode(stream); + break; + case MessageType.MessageTypeEnum.GET_SCP_QUORUMSET: + decodedStellarMessage.QSetHash = Uint256.Decode(stream); + break; + case MessageType.MessageTypeEnum.SCP_QUORUMSET: + decodedStellarMessage.QSet = SCPQuorumSet.Decode(stream); + break; + case MessageType.MessageTypeEnum.SCP_MESSAGE: + decodedStellarMessage.Envelope = SCPEnvelope.Decode(stream); + break; + case MessageType.MessageTypeEnum.GET_SCP_STATE: + decodedStellarMessage.GetSCPLedgerSeq = Uint32.Decode(stream); + break; + case MessageType.MessageTypeEnum.SEND_MORE: + decodedStellarMessage.SendMoreMessage = SendMore.Decode(stream); + break; + case MessageType.MessageTypeEnum.SEND_MORE_EXTENDED: + decodedStellarMessage.SendMoreExtendedMessage = SendMoreExtended.Decode(stream); + break; + case MessageType.MessageTypeEnum.FLOOD_ADVERT: + decodedStellarMessage.FloodAdvert = FloodAdvert.Decode(stream); + break; + case MessageType.MessageTypeEnum.FLOOD_DEMAND: + decodedStellarMessage.FloodDemand = FloodDemand.Decode(stream); + break; } + + return decodedStellarMessage; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/StellarValue.cs b/stellar-dotnet-sdk-xdr/generated/StellarValue.cs index c81ed29d..fe79d0e6 100644 --- a/stellar-dotnet-sdk-xdr/generated/StellarValue.cs +++ b/stellar-dotnet-sdk-xdr/generated/StellarValue.cs @@ -1,106 +1,97 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct StellarValue +// { +// 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) +// { +// case STELLAR_VALUE_BASIC: +// void; +// case STELLAR_VALUE_SIGNED: +// LedgerCloseValueSignature lcValueSignature; +// } +// ext; +// }; + +// =========================================================================== +public class StellarValue { + public Hash TxSetHash { get; set; } + public TimePoint CloseTime { get; set; } + public UpgradeType[] Upgrades { get; set; } + public StellarValueExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, StellarValue encodedStellarValue) + { + Hash.Encode(stream, encodedStellarValue.TxSetHash); + TimePoint.Encode(stream, encodedStellarValue.CloseTime); + var upgradessize = encodedStellarValue.Upgrades.Length; + stream.WriteInt(upgradessize); + for (var i = 0; i < upgradessize; i++) UpgradeType.Encode(stream, encodedStellarValue.Upgrades[i]); + StellarValueExt.Encode(stream, encodedStellarValue.Ext); + } - // struct StellarValue - // { - // 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) - // { - // case STELLAR_VALUE_BASIC: - // void; - // case STELLAR_VALUE_SIGNED: - // LedgerCloseValueSignature lcValueSignature; - // } - // ext; - // }; + public static StellarValue Decode(XdrDataInputStream stream) + { + var decodedStellarValue = new StellarValue(); + decodedStellarValue.TxSetHash = Hash.Decode(stream); + decodedStellarValue.CloseTime = TimePoint.Decode(stream); + var upgradessize = stream.ReadInt(); + decodedStellarValue.Upgrades = new UpgradeType[upgradessize]; + for (var i = 0; i < upgradessize; i++) decodedStellarValue.Upgrades[i] = UpgradeType.Decode(stream); + decodedStellarValue.Ext = StellarValueExt.Decode(stream); + return decodedStellarValue; + } - // =========================================================================== - public class StellarValue + public class StellarValueExt { - public StellarValue() { } - public Hash TxSetHash { get; set; } - public TimePoint CloseTime { get; set; } - public UpgradeType[] Upgrades { get; set; } - public StellarValueExt Ext { get; set; } + public StellarValueType Discriminant { get; set; } = new(); - public static void Encode(XdrDataOutputStream stream, StellarValue encodedStellarValue) - { - Hash.Encode(stream, encodedStellarValue.TxSetHash); - TimePoint.Encode(stream, encodedStellarValue.CloseTime); - int upgradessize = encodedStellarValue.Upgrades.Length; - stream.WriteInt(upgradessize); - for (int i = 0; i < upgradessize; i++) - { - UpgradeType.Encode(stream, encodedStellarValue.Upgrades[i]); - } - StellarValueExt.Encode(stream, encodedStellarValue.Ext); - } - public static StellarValue Decode(XdrDataInputStream stream) + public LedgerCloseValueSignature LcValueSignature { get; set; } + + public static void Encode(XdrDataOutputStream stream, StellarValueExt encodedStellarValueExt) { - StellarValue decodedStellarValue = new StellarValue(); - decodedStellarValue.TxSetHash = Hash.Decode(stream); - decodedStellarValue.CloseTime = TimePoint.Decode(stream); - int upgradessize = stream.ReadInt(); - decodedStellarValue.Upgrades = new UpgradeType[upgradessize]; - for (int i = 0; i < upgradessize; i++) + stream.WriteInt((int)encodedStellarValueExt.Discriminant.InnerValue); + switch (encodedStellarValueExt.Discriminant.InnerValue) { - decodedStellarValue.Upgrades[i] = UpgradeType.Decode(stream); + case StellarValueType.StellarValueTypeEnum.STELLAR_VALUE_BASIC: + break; + case StellarValueType.StellarValueTypeEnum.STELLAR_VALUE_SIGNED: + LedgerCloseValueSignature.Encode(stream, encodedStellarValueExt.LcValueSignature); + break; } - decodedStellarValue.Ext = StellarValueExt.Decode(stream); - return decodedStellarValue; } - public class StellarValueExt + public static StellarValueExt Decode(XdrDataInputStream stream) { - public StellarValueExt() { } - - public StellarValueType Discriminant { get; set; } = new StellarValueType(); - - public LedgerCloseValueSignature LcValueSignature { get; set; } - public static void Encode(XdrDataOutputStream stream, StellarValueExt encodedStellarValueExt) - { - stream.WriteInt((int)encodedStellarValueExt.Discriminant.InnerValue); - switch (encodedStellarValueExt.Discriminant.InnerValue) - { - case StellarValueType.StellarValueTypeEnum.STELLAR_VALUE_BASIC: - break; - case StellarValueType.StellarValueTypeEnum.STELLAR_VALUE_SIGNED: - LedgerCloseValueSignature.Encode(stream, encodedStellarValueExt.LcValueSignature); - break; - } - } - public static StellarValueExt Decode(XdrDataInputStream stream) + var decodedStellarValueExt = new StellarValueExt(); + var discriminant = StellarValueType.Decode(stream); + decodedStellarValueExt.Discriminant = discriminant; + switch (decodedStellarValueExt.Discriminant.InnerValue) { - StellarValueExt decodedStellarValueExt = new StellarValueExt(); - StellarValueType discriminant = StellarValueType.Decode(stream); - decodedStellarValueExt.Discriminant = discriminant; - switch (decodedStellarValueExt.Discriminant.InnerValue) - { - case StellarValueType.StellarValueTypeEnum.STELLAR_VALUE_BASIC: - break; - case StellarValueType.StellarValueTypeEnum.STELLAR_VALUE_SIGNED: - decodedStellarValueExt.LcValueSignature = LedgerCloseValueSignature.Decode(stream); - break; - } - return decodedStellarValueExt; + case StellarValueType.StellarValueTypeEnum.STELLAR_VALUE_BASIC: + break; + case StellarValueType.StellarValueTypeEnum.STELLAR_VALUE_SIGNED: + decodedStellarValueExt.LcValueSignature = LedgerCloseValueSignature.Decode(stream); + break; } + return decodedStellarValueExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/StellarValueType.cs b/stellar-dotnet-sdk-xdr/generated/StellarValueType.cs index 794cebc9..d39b6946 100644 --- a/stellar-dotnet-sdk-xdr/generated/StellarValueType.cs +++ b/stellar-dotnet-sdk-xdr/generated/StellarValueType.cs @@ -1,51 +1,51 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum StellarValueType - // { - // STELLAR_VALUE_BASIC = 0, - // STELLAR_VALUE_SIGNED = 1 - // }; +// enum StellarValueType +// { +// STELLAR_VALUE_BASIC = 0, +// STELLAR_VALUE_SIGNED = 1 +// }; - // =========================================================================== - public class StellarValueType +// =========================================================================== +public class StellarValueType +{ + public enum StellarValueTypeEnum { - public enum StellarValueTypeEnum - { - STELLAR_VALUE_BASIC = 0, - STELLAR_VALUE_SIGNED = 1, - } - public StellarValueTypeEnum InnerValue { get; set; } = default(StellarValueTypeEnum); + STELLAR_VALUE_BASIC = 0, + STELLAR_VALUE_SIGNED = 1 + } - public static StellarValueType Create(StellarValueTypeEnum v) - { - return new StellarValueType - { - InnerValue = v - }; - } + public StellarValueTypeEnum InnerValue { get; set; } = default; - public static StellarValueType Decode(XdrDataInputStream stream) + public static StellarValueType Create(StellarValueTypeEnum v) + { + return new StellarValueType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(StellarValueTypeEnum.STELLAR_VALUE_BASIC); - case 1: return Create(StellarValueTypeEnum.STELLAR_VALUE_SIGNED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, StellarValueType value) + public static StellarValueType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(StellarValueTypeEnum.STELLAR_VALUE_BASIC); + case 1: return Create(StellarValueTypeEnum.STELLAR_VALUE_SIGNED); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, StellarValueType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/StoredDebugTransactionSet.cs b/stellar-dotnet-sdk-xdr/generated/StoredDebugTransactionSet.cs new file mode 100644 index 00000000..64643a16 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/StoredDebugTransactionSet.cs @@ -0,0 +1,37 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct StoredDebugTransactionSet +// { +// StoredTransactionSet txSet; +// uint32 ledgerSeq; +// StellarValue scpValue; +// }; + +// =========================================================================== +public class StoredDebugTransactionSet +{ + public StoredTransactionSet TxSet { get; set; } + public Uint32 LedgerSeq { get; set; } + public StellarValue ScpValue { get; set; } + + public static void Encode(XdrDataOutputStream stream, StoredDebugTransactionSet encodedStoredDebugTransactionSet) + { + StoredTransactionSet.Encode(stream, encodedStoredDebugTransactionSet.TxSet); + Uint32.Encode(stream, encodedStoredDebugTransactionSet.LedgerSeq); + StellarValue.Encode(stream, encodedStoredDebugTransactionSet.ScpValue); + } + + public static StoredDebugTransactionSet Decode(XdrDataInputStream stream) + { + var decodedStoredDebugTransactionSet = new StoredDebugTransactionSet(); + decodedStoredDebugTransactionSet.TxSet = StoredTransactionSet.Decode(stream); + decodedStoredDebugTransactionSet.LedgerSeq = Uint32.Decode(stream); + decodedStoredDebugTransactionSet.ScpValue = StellarValue.Decode(stream); + return decodedStoredDebugTransactionSet; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/StoredTransactionSet.cs b/stellar-dotnet-sdk-xdr/generated/StoredTransactionSet.cs new file mode 100644 index 00000000..ab84a419 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/StoredTransactionSet.cs @@ -0,0 +1,55 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union StoredTransactionSet switch (int v) +// { +// case 0: +// TransactionSet txSet; +// case 1: +// GeneralizedTransactionSet generalizedTxSet; +// }; + +// =========================================================================== +public class StoredTransactionSet +{ + public int Discriminant { get; set; } + + public TransactionSet TxSet { get; set; } + public GeneralizedTransactionSet GeneralizedTxSet { get; set; } + + public static void Encode(XdrDataOutputStream stream, StoredTransactionSet encodedStoredTransactionSet) + { + stream.WriteInt(encodedStoredTransactionSet.Discriminant); + switch (encodedStoredTransactionSet.Discriminant) + { + case 0: + TransactionSet.Encode(stream, encodedStoredTransactionSet.TxSet); + break; + case 1: + GeneralizedTransactionSet.Encode(stream, encodedStoredTransactionSet.GeneralizedTxSet); + break; + } + } + + public static StoredTransactionSet Decode(XdrDataInputStream stream) + { + var decodedStoredTransactionSet = new StoredTransactionSet(); + var discriminant = stream.ReadInt(); + decodedStoredTransactionSet.Discriminant = discriminant; + switch (decodedStoredTransactionSet.Discriminant) + { + case 0: + decodedStoredTransactionSet.TxSet = TransactionSet.Decode(stream); + break; + case 1: + decodedStoredTransactionSet.GeneralizedTxSet = GeneralizedTransactionSet.Decode(stream); + break; + } + + return decodedStoredTransactionSet; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/String32.cs b/stellar-dotnet-sdk-xdr/generated/String32.cs index b70c2656..bbe0e76d 100644 --- a/stellar-dotnet-sdk-xdr/generated/String32.cs +++ b/stellar-dotnet-sdk-xdr/generated/String32.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef string string32<32>; + +// =========================================================================== +public class String32 { + public String32() + { + } - // === xdr source ============================================================ + public String32(string value) + { + InnerValue = value; + } + + public string InnerValue { get; set; } = default; - // typedef string string32<32>; + public static void Encode(XdrDataOutputStream stream, String32 encodedString32) + { + stream.WriteString(encodedString32.InnerValue); + } - // =========================================================================== - public class String32 + public static String32 Decode(XdrDataInputStream stream) { - public String InnerValue { get; set; } = default(String); - - public String32() { } - - public String32(String value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, String32 encodedString32) - { - stream.WriteString(encodedString32.InnerValue); - } - public static String32 Decode(XdrDataInputStream stream) - { - String32 decodedString32 = new String32(); - decodedString32.InnerValue = stream.ReadString(); - return decodedString32; - } + var decodedString32 = new String32(); + decodedString32.InnerValue = stream.ReadString(); + return decodedString32; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/String64.cs b/stellar-dotnet-sdk-xdr/generated/String64.cs index c98e19cf..be5d19a4 100644 --- a/stellar-dotnet-sdk-xdr/generated/String64.cs +++ b/stellar-dotnet-sdk-xdr/generated/String64.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef string string64<64>; + +// =========================================================================== +public class String64 { + public String64() + { + } - // === xdr source ============================================================ + public String64(string value) + { + InnerValue = value; + } + + public string InnerValue { get; set; } = default; - // typedef string string64<64>; + public static void Encode(XdrDataOutputStream stream, String64 encodedString64) + { + stream.WriteString(encodedString64.InnerValue); + } - // =========================================================================== - public class String64 + public static String64 Decode(XdrDataInputStream stream) { - public String InnerValue { get; set; } = default(String); - - public String64() { } - - public String64(String value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, String64 encodedString64) - { - stream.WriteString(encodedString64.InnerValue); - } - public static String64 Decode(XdrDataInputStream stream) - { - String64 decodedString64 = new String64(); - decodedString64.InnerValue = stream.ReadString(); - return decodedString64; - } + var decodedString64 = new String64(); + decodedString64.InnerValue = stream.ReadString(); + return decodedString64; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SurveyMessageCommandType.cs b/stellar-dotnet-sdk-xdr/generated/SurveyMessageCommandType.cs index 2c2a7699..71e72691 100644 --- a/stellar-dotnet-sdk-xdr/generated/SurveyMessageCommandType.cs +++ b/stellar-dotnet-sdk-xdr/generated/SurveyMessageCommandType.cs @@ -1,48 +1,48 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum SurveyMessageCommandType - // { - // SURVEY_TOPOLOGY = 0 - // }; +// enum SurveyMessageCommandType +// { +// SURVEY_TOPOLOGY = 0 +// }; - // =========================================================================== - public class SurveyMessageCommandType +// =========================================================================== +public class SurveyMessageCommandType +{ + public enum SurveyMessageCommandTypeEnum { - public enum SurveyMessageCommandTypeEnum - { - SURVEY_TOPOLOGY = 0, - } - public SurveyMessageCommandTypeEnum InnerValue { get; set; } = default(SurveyMessageCommandTypeEnum); + SURVEY_TOPOLOGY = 0 + } - public static SurveyMessageCommandType Create(SurveyMessageCommandTypeEnum v) - { - return new SurveyMessageCommandType - { - InnerValue = v - }; - } + public SurveyMessageCommandTypeEnum InnerValue { get; set; } = default; - public static SurveyMessageCommandType Decode(XdrDataInputStream stream) + public static SurveyMessageCommandType Create(SurveyMessageCommandTypeEnum v) + { + return new SurveyMessageCommandType { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(SurveyMessageCommandTypeEnum.SURVEY_TOPOLOGY); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, SurveyMessageCommandType value) + public static SurveyMessageCommandType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(SurveyMessageCommandTypeEnum.SURVEY_TOPOLOGY); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, SurveyMessageCommandType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SurveyMessageResponseType.cs b/stellar-dotnet-sdk-xdr/generated/SurveyMessageResponseType.cs new file mode 100644 index 00000000..dfa18e71 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/SurveyMessageResponseType.cs @@ -0,0 +1,51 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum SurveyMessageResponseType +// { +// SURVEY_TOPOLOGY_RESPONSE_V0 = 0, +// SURVEY_TOPOLOGY_RESPONSE_V1 = 1 +// }; + +// =========================================================================== +public class SurveyMessageResponseType +{ + public enum SurveyMessageResponseTypeEnum + { + SURVEY_TOPOLOGY_RESPONSE_V0 = 0, + SURVEY_TOPOLOGY_RESPONSE_V1 = 1 + } + + public SurveyMessageResponseTypeEnum InnerValue { get; set; } = default; + + public static SurveyMessageResponseType Create(SurveyMessageResponseTypeEnum v) + { + return new SurveyMessageResponseType + { + InnerValue = v + }; + } + + public static SurveyMessageResponseType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(SurveyMessageResponseTypeEnum.SURVEY_TOPOLOGY_RESPONSE_V0); + case 1: return Create(SurveyMessageResponseTypeEnum.SURVEY_TOPOLOGY_RESPONSE_V1); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, SurveyMessageResponseType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SurveyRequestMessage.cs b/stellar-dotnet-sdk-xdr/generated/SurveyRequestMessage.cs index 143444a7..ff77fb2c 100644 --- a/stellar-dotnet-sdk-xdr/generated/SurveyRequestMessage.cs +++ b/stellar-dotnet-sdk-xdr/generated/SurveyRequestMessage.cs @@ -1,48 +1,45 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SurveyRequestMessage +// { +// NodeID surveyorPeerID; +// NodeID surveyedPeerID; +// uint32 ledgerNum; +// Curve25519Public encryptionKey; +// SurveyMessageCommandType commandType; +// }; - // struct SurveyRequestMessage - // { - // NodeID surveyorPeerID; - // NodeID surveyedPeerID; - // uint32 ledgerNum; - // Curve25519Public encryptionKey; - // SurveyMessageCommandType commandType; - // }; +// =========================================================================== +public class SurveyRequestMessage +{ + public NodeID SurveyorPeerID { get; set; } + public NodeID SurveyedPeerID { get; set; } + public Uint32 LedgerNum { get; set; } + public Curve25519Public EncryptionKey { get; set; } + public SurveyMessageCommandType CommandType { get; set; } - // =========================================================================== - public class SurveyRequestMessage + public static void Encode(XdrDataOutputStream stream, SurveyRequestMessage encodedSurveyRequestMessage) { - public SurveyRequestMessage() { } - public NodeID SurveyorPeerID { get; set; } - public NodeID SurveyedPeerID { get; set; } - public Uint32 LedgerNum { get; set; } - public Curve25519Public EncryptionKey { get; set; } - public SurveyMessageCommandType CommandType { get; set; } + NodeID.Encode(stream, encodedSurveyRequestMessage.SurveyorPeerID); + NodeID.Encode(stream, encodedSurveyRequestMessage.SurveyedPeerID); + Uint32.Encode(stream, encodedSurveyRequestMessage.LedgerNum); + Curve25519Public.Encode(stream, encodedSurveyRequestMessage.EncryptionKey); + SurveyMessageCommandType.Encode(stream, encodedSurveyRequestMessage.CommandType); + } - public static void Encode(XdrDataOutputStream stream, SurveyRequestMessage encodedSurveyRequestMessage) - { - NodeID.Encode(stream, encodedSurveyRequestMessage.SurveyorPeerID); - NodeID.Encode(stream, encodedSurveyRequestMessage.SurveyedPeerID); - Uint32.Encode(stream, encodedSurveyRequestMessage.LedgerNum); - Curve25519Public.Encode(stream, encodedSurveyRequestMessage.EncryptionKey); - SurveyMessageCommandType.Encode(stream, encodedSurveyRequestMessage.CommandType); - } - public static SurveyRequestMessage Decode(XdrDataInputStream stream) - { - SurveyRequestMessage decodedSurveyRequestMessage = new SurveyRequestMessage(); - decodedSurveyRequestMessage.SurveyorPeerID = NodeID.Decode(stream); - decodedSurveyRequestMessage.SurveyedPeerID = NodeID.Decode(stream); - decodedSurveyRequestMessage.LedgerNum = Uint32.Decode(stream); - decodedSurveyRequestMessage.EncryptionKey = Curve25519Public.Decode(stream); - decodedSurveyRequestMessage.CommandType = SurveyMessageCommandType.Decode(stream); - return decodedSurveyRequestMessage; - } + public static SurveyRequestMessage Decode(XdrDataInputStream stream) + { + var decodedSurveyRequestMessage = new SurveyRequestMessage(); + decodedSurveyRequestMessage.SurveyorPeerID = NodeID.Decode(stream); + decodedSurveyRequestMessage.SurveyedPeerID = NodeID.Decode(stream); + decodedSurveyRequestMessage.LedgerNum = Uint32.Decode(stream); + decodedSurveyRequestMessage.EncryptionKey = Curve25519Public.Decode(stream); + decodedSurveyRequestMessage.CommandType = SurveyMessageCommandType.Decode(stream); + return decodedSurveyRequestMessage; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SurveyResponseBody.cs b/stellar-dotnet-sdk-xdr/generated/SurveyResponseBody.cs index ae51c6c5..68b4031f 100644 --- a/stellar-dotnet-sdk-xdr/generated/SurveyResponseBody.cs +++ b/stellar-dotnet-sdk-xdr/generated/SurveyResponseBody.cs @@ -1,48 +1,55 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union SurveyResponseBody switch (SurveyMessageCommandType type) - // { - // case SURVEY_TOPOLOGY: - // TopologyResponseBody topologyResponseBody; - // }; +// union SurveyResponseBody switch (SurveyMessageResponseType type) +// { +// case SURVEY_TOPOLOGY_RESPONSE_V0: +// TopologyResponseBodyV0 topologyResponseBodyV0; +// case SURVEY_TOPOLOGY_RESPONSE_V1: +// TopologyResponseBodyV1 topologyResponseBodyV1; +// }; - // =========================================================================== - public class SurveyResponseBody - { - public SurveyResponseBody() { } +// =========================================================================== +public class SurveyResponseBody +{ + public SurveyMessageResponseType Discriminant { get; set; } = new(); - public SurveyMessageCommandType Discriminant { get; set; } = new SurveyMessageCommandType(); + public TopologyResponseBodyV0 TopologyResponseBodyV0 { get; set; } + public TopologyResponseBodyV1 TopologyResponseBodyV1 { get; set; } - public TopologyResponseBody TopologyResponseBody { get; set; } - public static void Encode(XdrDataOutputStream stream, SurveyResponseBody encodedSurveyResponseBody) + public static void Encode(XdrDataOutputStream stream, SurveyResponseBody encodedSurveyResponseBody) + { + stream.WriteInt((int)encodedSurveyResponseBody.Discriminant.InnerValue); + switch (encodedSurveyResponseBody.Discriminant.InnerValue) { - stream.WriteInt((int)encodedSurveyResponseBody.Discriminant.InnerValue); - switch (encodedSurveyResponseBody.Discriminant.InnerValue) - { - case SurveyMessageCommandType.SurveyMessageCommandTypeEnum.SURVEY_TOPOLOGY: - TopologyResponseBody.Encode(stream, encodedSurveyResponseBody.TopologyResponseBody); - break; - } + case SurveyMessageResponseType.SurveyMessageResponseTypeEnum.SURVEY_TOPOLOGY_RESPONSE_V0: + TopologyResponseBodyV0.Encode(stream, encodedSurveyResponseBody.TopologyResponseBodyV0); + break; + case SurveyMessageResponseType.SurveyMessageResponseTypeEnum.SURVEY_TOPOLOGY_RESPONSE_V1: + TopologyResponseBodyV1.Encode(stream, encodedSurveyResponseBody.TopologyResponseBodyV1); + break; } - public static SurveyResponseBody Decode(XdrDataInputStream stream) + } + + public static SurveyResponseBody Decode(XdrDataInputStream stream) + { + var decodedSurveyResponseBody = new SurveyResponseBody(); + var discriminant = SurveyMessageResponseType.Decode(stream); + decodedSurveyResponseBody.Discriminant = discriminant; + switch (decodedSurveyResponseBody.Discriminant.InnerValue) { - SurveyResponseBody decodedSurveyResponseBody = new SurveyResponseBody(); - SurveyMessageCommandType discriminant = SurveyMessageCommandType.Decode(stream); - decodedSurveyResponseBody.Discriminant = discriminant; - switch (decodedSurveyResponseBody.Discriminant.InnerValue) - { - case SurveyMessageCommandType.SurveyMessageCommandTypeEnum.SURVEY_TOPOLOGY: - decodedSurveyResponseBody.TopologyResponseBody = TopologyResponseBody.Decode(stream); - break; - } - return decodedSurveyResponseBody; + case SurveyMessageResponseType.SurveyMessageResponseTypeEnum.SURVEY_TOPOLOGY_RESPONSE_V0: + decodedSurveyResponseBody.TopologyResponseBodyV0 = TopologyResponseBodyV0.Decode(stream); + break; + case SurveyMessageResponseType.SurveyMessageResponseTypeEnum.SURVEY_TOPOLOGY_RESPONSE_V1: + decodedSurveyResponseBody.TopologyResponseBodyV1 = TopologyResponseBodyV1.Decode(stream); + break; } + + return decodedSurveyResponseBody; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/SurveyResponseMessage.cs b/stellar-dotnet-sdk-xdr/generated/SurveyResponseMessage.cs index d3db2684..65dcbf65 100644 --- a/stellar-dotnet-sdk-xdr/generated/SurveyResponseMessage.cs +++ b/stellar-dotnet-sdk-xdr/generated/SurveyResponseMessage.cs @@ -1,48 +1,45 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct SurveyResponseMessage +// { +// NodeID surveyorPeerID; +// NodeID surveyedPeerID; +// uint32 ledgerNum; +// SurveyMessageCommandType commandType; +// EncryptedBody encryptedBody; +// }; - // struct SurveyResponseMessage - // { - // NodeID surveyorPeerID; - // NodeID surveyedPeerID; - // uint32 ledgerNum; - // SurveyMessageCommandType commandType; - // EncryptedBody encryptedBody; - // }; +// =========================================================================== +public class SurveyResponseMessage +{ + public NodeID SurveyorPeerID { get; set; } + public NodeID SurveyedPeerID { get; set; } + public Uint32 LedgerNum { get; set; } + public SurveyMessageCommandType CommandType { get; set; } + public EncryptedBody EncryptedBody { get; set; } - // =========================================================================== - public class SurveyResponseMessage + public static void Encode(XdrDataOutputStream stream, SurveyResponseMessage encodedSurveyResponseMessage) { - public SurveyResponseMessage() { } - public NodeID SurveyorPeerID { get; set; } - public NodeID SurveyedPeerID { get; set; } - public Uint32 LedgerNum { get; set; } - public SurveyMessageCommandType CommandType { get; set; } - public EncryptedBody EncryptedBody { get; set; } + NodeID.Encode(stream, encodedSurveyResponseMessage.SurveyorPeerID); + NodeID.Encode(stream, encodedSurveyResponseMessage.SurveyedPeerID); + Uint32.Encode(stream, encodedSurveyResponseMessage.LedgerNum); + SurveyMessageCommandType.Encode(stream, encodedSurveyResponseMessage.CommandType); + EncryptedBody.Encode(stream, encodedSurveyResponseMessage.EncryptedBody); + } - public static void Encode(XdrDataOutputStream stream, SurveyResponseMessage encodedSurveyResponseMessage) - { - NodeID.Encode(stream, encodedSurveyResponseMessage.SurveyorPeerID); - NodeID.Encode(stream, encodedSurveyResponseMessage.SurveyedPeerID); - Uint32.Encode(stream, encodedSurveyResponseMessage.LedgerNum); - SurveyMessageCommandType.Encode(stream, encodedSurveyResponseMessage.CommandType); - EncryptedBody.Encode(stream, encodedSurveyResponseMessage.EncryptedBody); - } - public static SurveyResponseMessage Decode(XdrDataInputStream stream) - { - SurveyResponseMessage decodedSurveyResponseMessage = new SurveyResponseMessage(); - decodedSurveyResponseMessage.SurveyorPeerID = NodeID.Decode(stream); - decodedSurveyResponseMessage.SurveyedPeerID = NodeID.Decode(stream); - decodedSurveyResponseMessage.LedgerNum = Uint32.Decode(stream); - decodedSurveyResponseMessage.CommandType = SurveyMessageCommandType.Decode(stream); - decodedSurveyResponseMessage.EncryptedBody = EncryptedBody.Decode(stream); - return decodedSurveyResponseMessage; - } + public static SurveyResponseMessage Decode(XdrDataInputStream stream) + { + var decodedSurveyResponseMessage = new SurveyResponseMessage(); + decodedSurveyResponseMessage.SurveyorPeerID = NodeID.Decode(stream); + decodedSurveyResponseMessage.SurveyedPeerID = NodeID.Decode(stream); + decodedSurveyResponseMessage.LedgerNum = Uint32.Decode(stream); + decodedSurveyResponseMessage.CommandType = SurveyMessageCommandType.Decode(stream); + decodedSurveyResponseMessage.EncryptedBody = EncryptedBody.Decode(stream); + return decodedSurveyResponseMessage; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TTLEntry.cs b/stellar-dotnet-sdk-xdr/generated/TTLEntry.cs new file mode 100644 index 00000000..0b51cea4 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TTLEntry.cs @@ -0,0 +1,33 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct TTLEntry { +// // Hash of the LedgerKey that is associated with this TTLEntry +// Hash keyHash; +// uint32 liveUntilLedgerSeq; +// }; + +// =========================================================================== +public class TTLEntry +{ + public Hash KeyHash { get; set; } + public Uint32 LiveUntilLedgerSeq { get; set; } + + public static void Encode(XdrDataOutputStream stream, TTLEntry encodedTTLEntry) + { + Hash.Encode(stream, encodedTTLEntry.KeyHash); + Uint32.Encode(stream, encodedTTLEntry.LiveUntilLedgerSeq); + } + + public static TTLEntry Decode(XdrDataInputStream stream) + { + var decodedTTLEntry = new TTLEntry(); + decodedTTLEntry.KeyHash = Hash.Decode(stream); + decodedTTLEntry.LiveUntilLedgerSeq = Uint32.Decode(stream); + return decodedTTLEntry; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/ThresholdIndexes.cs b/stellar-dotnet-sdk-xdr/generated/ThresholdIndexes.cs index b53fbac0..cc879f20 100644 --- a/stellar-dotnet-sdk-xdr/generated/ThresholdIndexes.cs +++ b/stellar-dotnet-sdk-xdr/generated/ThresholdIndexes.cs @@ -1,57 +1,57 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum ThresholdIndexes - // { - // THRESHOLD_MASTER_WEIGHT = 0, - // THRESHOLD_LOW = 1, - // THRESHOLD_MED = 2, - // THRESHOLD_HIGH = 3 - // }; +// enum ThresholdIndexes +// { +// THRESHOLD_MASTER_WEIGHT = 0, +// THRESHOLD_LOW = 1, +// THRESHOLD_MED = 2, +// THRESHOLD_HIGH = 3 +// }; - // =========================================================================== - public class ThresholdIndexes +// =========================================================================== +public class ThresholdIndexes +{ + public enum ThresholdIndexesEnum { - public enum ThresholdIndexesEnum - { - THRESHOLD_MASTER_WEIGHT = 0, - THRESHOLD_LOW = 1, - THRESHOLD_MED = 2, - THRESHOLD_HIGH = 3, - } - public ThresholdIndexesEnum InnerValue { get; set; } = default(ThresholdIndexesEnum); + THRESHOLD_MASTER_WEIGHT = 0, + THRESHOLD_LOW = 1, + THRESHOLD_MED = 2, + THRESHOLD_HIGH = 3 + } - public static ThresholdIndexes Create(ThresholdIndexesEnum v) - { - return new ThresholdIndexes - { - InnerValue = v - }; - } + public ThresholdIndexesEnum InnerValue { get; set; } = default; - public static ThresholdIndexes Decode(XdrDataInputStream stream) + public static ThresholdIndexes Create(ThresholdIndexesEnum v) + { + return new ThresholdIndexes { - int value = stream.ReadInt(); - switch (value) - { - case 0: return Create(ThresholdIndexesEnum.THRESHOLD_MASTER_WEIGHT); - case 1: return Create(ThresholdIndexesEnum.THRESHOLD_LOW); - case 2: return Create(ThresholdIndexesEnum.THRESHOLD_MED); - case 3: return Create(ThresholdIndexesEnum.THRESHOLD_HIGH); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, ThresholdIndexes value) + public static ThresholdIndexes Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 0: return Create(ThresholdIndexesEnum.THRESHOLD_MASTER_WEIGHT); + case 1: return Create(ThresholdIndexesEnum.THRESHOLD_LOW); + case 2: return Create(ThresholdIndexesEnum.THRESHOLD_MED); + case 3: return Create(ThresholdIndexesEnum.THRESHOLD_HIGH); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, ThresholdIndexes value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Thresholds.cs b/stellar-dotnet-sdk-xdr/generated/Thresholds.cs index 24dff7ae..5b74bf5e 100644 --- a/stellar-dotnet-sdk-xdr/generated/Thresholds.cs +++ b/stellar-dotnet-sdk-xdr/generated/Thresholds.cs @@ -1,38 +1,38 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque Thresholds[4]; + +// =========================================================================== +public class Thresholds { + public Thresholds() + { + } - // === xdr source ============================================================ + public Thresholds(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque Thresholds[4]; + public static void Encode(XdrDataOutputStream stream, Thresholds encodedThresholds) + { + var Thresholdssize = encodedThresholds.InnerValue.Length; + stream.Write(encodedThresholds.InnerValue, 0, Thresholdssize); + } - // =========================================================================== - public class Thresholds + public static Thresholds Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public Thresholds() { } - - public Thresholds(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Thresholds encodedThresholds) - { - int Thresholdssize = encodedThresholds.InnerValue.Length; - stream.Write(encodedThresholds.InnerValue, 0, Thresholdssize); - } - public static Thresholds Decode(XdrDataInputStream stream) - { - Thresholds decodedThresholds = new Thresholds(); - int Thresholdssize = 4; - decodedThresholds.InnerValue = new byte[Thresholdssize]; - stream.Read(decodedThresholds.InnerValue, 0, Thresholdssize); - return decodedThresholds; - } + var decodedThresholds = new Thresholds(); + var Thresholdssize = 4; + decodedThresholds.InnerValue = new byte[Thresholdssize]; + stream.Read(decodedThresholds.InnerValue, 0, Thresholdssize); + return decodedThresholds; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TimeBounds.cs b/stellar-dotnet-sdk-xdr/generated/TimeBounds.cs index 401d9e2f..6513b14a 100644 --- a/stellar-dotnet-sdk-xdr/generated/TimeBounds.cs +++ b/stellar-dotnet-sdk-xdr/generated/TimeBounds.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TimeBounds +// { +// TimePoint minTime; +// TimePoint maxTime; // 0 here means no maxTime +// }; - // struct TimeBounds - // { - // TimePoint minTime; - // TimePoint maxTime; // 0 here means no maxTime - // }; +// =========================================================================== +public class TimeBounds +{ + public TimePoint MinTime { get; set; } + public TimePoint MaxTime { get; set; } - // =========================================================================== - public class TimeBounds + public static void Encode(XdrDataOutputStream stream, TimeBounds encodedTimeBounds) { - public TimeBounds() { } - public TimePoint MinTime { get; set; } - public TimePoint MaxTime { get; set; } + TimePoint.Encode(stream, encodedTimeBounds.MinTime); + TimePoint.Encode(stream, encodedTimeBounds.MaxTime); + } - public static void Encode(XdrDataOutputStream stream, TimeBounds encodedTimeBounds) - { - TimePoint.Encode(stream, encodedTimeBounds.MinTime); - TimePoint.Encode(stream, encodedTimeBounds.MaxTime); - } - public static TimeBounds Decode(XdrDataInputStream stream) - { - TimeBounds decodedTimeBounds = new TimeBounds(); - decodedTimeBounds.MinTime = TimePoint.Decode(stream); - decodedTimeBounds.MaxTime = TimePoint.Decode(stream); - return decodedTimeBounds; - } + public static TimeBounds Decode(XdrDataInputStream stream) + { + var decodedTimeBounds = new TimeBounds(); + decodedTimeBounds.MinTime = TimePoint.Decode(stream); + decodedTimeBounds.MaxTime = TimePoint.Decode(stream); + return decodedTimeBounds; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TimePoint.cs b/stellar-dotnet-sdk-xdr/generated/TimePoint.cs index 504323a4..bd9e4efd 100644 --- a/stellar-dotnet-sdk-xdr/generated/TimePoint.cs +++ b/stellar-dotnet-sdk-xdr/generated/TimePoint.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef uint64 TimePoint; + +// =========================================================================== +public class TimePoint { + public TimePoint() + { + } - // === xdr source ============================================================ + public TimePoint(Uint64 value) + { + InnerValue = value; + } + + public Uint64 InnerValue { get; set; } = default; - // typedef uint64 TimePoint; + public static void Encode(XdrDataOutputStream stream, TimePoint encodedTimePoint) + { + Uint64.Encode(stream, encodedTimePoint.InnerValue); + } - // =========================================================================== - public class TimePoint + public static TimePoint Decode(XdrDataInputStream stream) { - public Uint64 InnerValue { get; set; } = default(Uint64); - - public TimePoint() { } - - public TimePoint(Uint64 value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, TimePoint encodedTimePoint) - { - Uint64.Encode(stream, encodedTimePoint.InnerValue); - } - public static TimePoint Decode(XdrDataInputStream stream) - { - TimePoint decodedTimePoint = new TimePoint(); - decodedTimePoint.InnerValue = Uint64.Decode(stream); - return decodedTimePoint; - } + var decodedTimePoint = new TimePoint(); + decodedTimePoint.InnerValue = Uint64.Decode(stream); + return decodedTimePoint; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TopologyResponseBody.cs b/stellar-dotnet-sdk-xdr/generated/TopologyResponseBody.cs index bf6f4104..bf6372d7 100644 --- a/stellar-dotnet-sdk-xdr/generated/TopologyResponseBody.cs +++ b/stellar-dotnet-sdk-xdr/generated/TopologyResponseBody.cs @@ -1,45 +1,42 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TopologyResponseBody +// { +// PeerStatList inboundPeers; +// PeerStatList outboundPeers; +// +// uint32 totalInboundPeerCount; +// uint32 totalOutboundPeerCount; +// }; - // struct TopologyResponseBody - // { - // PeerStatList inboundPeers; - // PeerStatList outboundPeers; - // - // uint32 totalInboundPeerCount; - // uint32 totalOutboundPeerCount; - // }; +// =========================================================================== +public class TopologyResponseBody +{ + public PeerStatList InboundPeers { get; set; } + public PeerStatList OutboundPeers { get; set; } + public Uint32 TotalInboundPeerCount { get; set; } + public Uint32 TotalOutboundPeerCount { get; set; } - // =========================================================================== - public class TopologyResponseBody + public static void Encode(XdrDataOutputStream stream, TopologyResponseBody encodedTopologyResponseBody) { - public TopologyResponseBody() { } - public PeerStatList InboundPeers { get; set; } - public PeerStatList OutboundPeers { get; set; } - public Uint32 TotalInboundPeerCount { get; set; } - public Uint32 TotalOutboundPeerCount { get; set; } + PeerStatList.Encode(stream, encodedTopologyResponseBody.InboundPeers); + PeerStatList.Encode(stream, encodedTopologyResponseBody.OutboundPeers); + Uint32.Encode(stream, encodedTopologyResponseBody.TotalInboundPeerCount); + Uint32.Encode(stream, encodedTopologyResponseBody.TotalOutboundPeerCount); + } - public static void Encode(XdrDataOutputStream stream, TopologyResponseBody encodedTopologyResponseBody) - { - PeerStatList.Encode(stream, encodedTopologyResponseBody.InboundPeers); - PeerStatList.Encode(stream, encodedTopologyResponseBody.OutboundPeers); - Uint32.Encode(stream, encodedTopologyResponseBody.TotalInboundPeerCount); - Uint32.Encode(stream, encodedTopologyResponseBody.TotalOutboundPeerCount); - } - public static TopologyResponseBody Decode(XdrDataInputStream stream) - { - TopologyResponseBody decodedTopologyResponseBody = new TopologyResponseBody(); - decodedTopologyResponseBody.InboundPeers = PeerStatList.Decode(stream); - decodedTopologyResponseBody.OutboundPeers = PeerStatList.Decode(stream); - decodedTopologyResponseBody.TotalInboundPeerCount = Uint32.Decode(stream); - decodedTopologyResponseBody.TotalOutboundPeerCount = Uint32.Decode(stream); - return decodedTopologyResponseBody; - } + public static TopologyResponseBody Decode(XdrDataInputStream stream) + { + var decodedTopologyResponseBody = new TopologyResponseBody(); + decodedTopologyResponseBody.InboundPeers = PeerStatList.Decode(stream); + decodedTopologyResponseBody.OutboundPeers = PeerStatList.Decode(stream); + decodedTopologyResponseBody.TotalInboundPeerCount = Uint32.Decode(stream); + decodedTopologyResponseBody.TotalOutboundPeerCount = Uint32.Decode(stream); + return decodedTopologyResponseBody; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TopologyResponseBodyV0.cs b/stellar-dotnet-sdk-xdr/generated/TopologyResponseBodyV0.cs new file mode 100644 index 00000000..7ec09d46 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TopologyResponseBodyV0.cs @@ -0,0 +1,42 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct TopologyResponseBodyV0 +// { +// PeerStatList inboundPeers; +// PeerStatList outboundPeers; +// +// uint32 totalInboundPeerCount; +// uint32 totalOutboundPeerCount; +// }; + +// =========================================================================== +public class TopologyResponseBodyV0 +{ + public PeerStatList InboundPeers { get; set; } + public PeerStatList OutboundPeers { get; set; } + public Uint32 TotalInboundPeerCount { get; set; } + public Uint32 TotalOutboundPeerCount { get; set; } + + public static void Encode(XdrDataOutputStream stream, TopologyResponseBodyV0 encodedTopologyResponseBodyV0) + { + PeerStatList.Encode(stream, encodedTopologyResponseBodyV0.InboundPeers); + PeerStatList.Encode(stream, encodedTopologyResponseBodyV0.OutboundPeers); + Uint32.Encode(stream, encodedTopologyResponseBodyV0.TotalInboundPeerCount); + Uint32.Encode(stream, encodedTopologyResponseBodyV0.TotalOutboundPeerCount); + } + + public static TopologyResponseBodyV0 Decode(XdrDataInputStream stream) + { + var decodedTopologyResponseBodyV0 = new TopologyResponseBodyV0(); + decodedTopologyResponseBodyV0.InboundPeers = PeerStatList.Decode(stream); + decodedTopologyResponseBodyV0.OutboundPeers = PeerStatList.Decode(stream); + decodedTopologyResponseBodyV0.TotalInboundPeerCount = Uint32.Decode(stream); + decodedTopologyResponseBodyV0.TotalOutboundPeerCount = Uint32.Decode(stream); + return decodedTopologyResponseBodyV0; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TopologyResponseBodyV1.cs b/stellar-dotnet-sdk-xdr/generated/TopologyResponseBodyV1.cs new file mode 100644 index 00000000..ba51bc70 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TopologyResponseBodyV1.cs @@ -0,0 +1,51 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct TopologyResponseBodyV1 +// { +// PeerStatList inboundPeers; +// PeerStatList outboundPeers; +// +// uint32 totalInboundPeerCount; +// uint32 totalOutboundPeerCount; +// +// uint32 maxInboundPeerCount; +// uint32 maxOutboundPeerCount; +// }; + +// =========================================================================== +public class TopologyResponseBodyV1 +{ + public PeerStatList InboundPeers { get; set; } + public PeerStatList OutboundPeers { get; set; } + public Uint32 TotalInboundPeerCount { get; set; } + public Uint32 TotalOutboundPeerCount { get; set; } + public Uint32 MaxInboundPeerCount { get; set; } + public Uint32 MaxOutboundPeerCount { get; set; } + + public static void Encode(XdrDataOutputStream stream, TopologyResponseBodyV1 encodedTopologyResponseBodyV1) + { + PeerStatList.Encode(stream, encodedTopologyResponseBodyV1.InboundPeers); + PeerStatList.Encode(stream, encodedTopologyResponseBodyV1.OutboundPeers); + Uint32.Encode(stream, encodedTopologyResponseBodyV1.TotalInboundPeerCount); + Uint32.Encode(stream, encodedTopologyResponseBodyV1.TotalOutboundPeerCount); + Uint32.Encode(stream, encodedTopologyResponseBodyV1.MaxInboundPeerCount); + Uint32.Encode(stream, encodedTopologyResponseBodyV1.MaxOutboundPeerCount); + } + + public static TopologyResponseBodyV1 Decode(XdrDataInputStream stream) + { + var decodedTopologyResponseBodyV1 = new TopologyResponseBodyV1(); + decodedTopologyResponseBodyV1.InboundPeers = PeerStatList.Decode(stream); + decodedTopologyResponseBodyV1.OutboundPeers = PeerStatList.Decode(stream); + decodedTopologyResponseBodyV1.TotalInboundPeerCount = Uint32.Decode(stream); + decodedTopologyResponseBodyV1.TotalOutboundPeerCount = Uint32.Decode(stream); + decodedTopologyResponseBodyV1.MaxInboundPeerCount = Uint32.Decode(stream); + decodedTopologyResponseBodyV1.MaxOutboundPeerCount = Uint32.Decode(stream); + return decodedTopologyResponseBodyV1; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Transaction.cs b/stellar-dotnet-sdk-xdr/generated/Transaction.cs index d7f837fc..f614fbd7 100644 --- a/stellar-dotnet-sdk-xdr/generated/Transaction.cs +++ b/stellar-dotnet-sdk-xdr/generated/Transaction.cs @@ -1,112 +1,112 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct Transaction +// { +// // 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; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// SorobanTransactionData sorobanData; +// } +// ext; +// }; + +// =========================================================================== +public class Transaction { + public MuxedAccount SourceAccount { get; set; } + public Uint32 Fee { get; set; } + public SequenceNumber SeqNum { get; set; } + public Preconditions Cond { get; set; } + public Memo Memo { get; set; } + public Operation[] Operations { get; set; } + public TransactionExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, Transaction encodedTransaction) + { + MuxedAccount.Encode(stream, encodedTransaction.SourceAccount); + Uint32.Encode(stream, encodedTransaction.Fee); + SequenceNumber.Encode(stream, encodedTransaction.SeqNum); + Preconditions.Encode(stream, encodedTransaction.Cond); + Memo.Encode(stream, encodedTransaction.Memo); + var operationssize = encodedTransaction.Operations.Length; + stream.WriteInt(operationssize); + for (var i = 0; i < operationssize; i++) Operation.Encode(stream, encodedTransaction.Operations[i]); + TransactionExt.Encode(stream, encodedTransaction.Ext); + } - // struct Transaction - // { - // // 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; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static Transaction Decode(XdrDataInputStream stream) + { + var decodedTransaction = new Transaction(); + decodedTransaction.SourceAccount = MuxedAccount.Decode(stream); + decodedTransaction.Fee = Uint32.Decode(stream); + decodedTransaction.SeqNum = SequenceNumber.Decode(stream); + decodedTransaction.Cond = Preconditions.Decode(stream); + decodedTransaction.Memo = Memo.Decode(stream); + var operationssize = stream.ReadInt(); + decodedTransaction.Operations = new Operation[operationssize]; + for (var i = 0; i < operationssize; i++) decodedTransaction.Operations[i] = Operation.Decode(stream); + decodedTransaction.Ext = TransactionExt.Decode(stream); + return decodedTransaction; + } - // =========================================================================== - public class Transaction + public class TransactionExt { - public Transaction() { } - public MuxedAccount SourceAccount { get; set; } - public Uint32 Fee { get; set; } - public SequenceNumber SeqNum { get; set; } - public Preconditions Cond { get; set; } - public Memo Memo { get; set; } - public Operation[] Operations { get; set; } - public TransactionExt Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, Transaction encodedTransaction) - { - MuxedAccount.Encode(stream, encodedTransaction.SourceAccount); - Uint32.Encode(stream, encodedTransaction.Fee); - SequenceNumber.Encode(stream, encodedTransaction.SeqNum); - Preconditions.Encode(stream, encodedTransaction.Cond); - Memo.Encode(stream, encodedTransaction.Memo); - int operationssize = encodedTransaction.Operations.Length; - stream.WriteInt(operationssize); - for (int i = 0; i < operationssize; i++) - { - Operation.Encode(stream, encodedTransaction.Operations[i]); - } - TransactionExt.Encode(stream, encodedTransaction.Ext); - } - public static Transaction Decode(XdrDataInputStream stream) + public SorobanTransactionData SorobanData { get; set; } + + public static void Encode(XdrDataOutputStream stream, TransactionExt encodedTransactionExt) { - Transaction decodedTransaction = new Transaction(); - decodedTransaction.SourceAccount = MuxedAccount.Decode(stream); - decodedTransaction.Fee = Uint32.Decode(stream); - decodedTransaction.SeqNum = SequenceNumber.Decode(stream); - decodedTransaction.Cond = Preconditions.Decode(stream); - decodedTransaction.Memo = Memo.Decode(stream); - int operationssize = stream.ReadInt(); - decodedTransaction.Operations = new Operation[operationssize]; - for (int i = 0; i < operationssize; i++) + stream.WriteInt(encodedTransactionExt.Discriminant); + switch (encodedTransactionExt.Discriminant) { - decodedTransaction.Operations[i] = Operation.Decode(stream); + case 0: + break; + case 1: + SorobanTransactionData.Encode(stream, encodedTransactionExt.SorobanData); + break; } - decodedTransaction.Ext = TransactionExt.Decode(stream); - return decodedTransaction; } - public class TransactionExt + public static TransactionExt Decode(XdrDataInputStream stream) { - public TransactionExt() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, TransactionExt encodedTransactionExt) - { - stream.WriteInt((int)encodedTransactionExt.Discriminant); - switch (encodedTransactionExt.Discriminant) - { - case 0: - break; - } - } - public static TransactionExt Decode(XdrDataInputStream stream) + var decodedTransactionExt = new TransactionExt(); + var discriminant = stream.ReadInt(); + decodedTransactionExt.Discriminant = discriminant; + switch (decodedTransactionExt.Discriminant) { - TransactionExt decodedTransactionExt = new TransactionExt(); - int discriminant = stream.ReadInt(); - decodedTransactionExt.Discriminant = discriminant; - switch (decodedTransactionExt.Discriminant) - { - case 0: - break; - } - return decodedTransactionExt; + case 0: + break; + case 1: + decodedTransactionExt.SorobanData = SorobanTransactionData.Decode(stream); + break; } + return decodedTransactionExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionEnvelope.cs b/stellar-dotnet-sdk-xdr/generated/TransactionEnvelope.cs index 62d4519e..e6e585db 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionEnvelope.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionEnvelope.cs @@ -1,66 +1,64 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union TransactionEnvelope switch (EnvelopeType type) - // { - // case ENVELOPE_TYPE_TX_V0: - // TransactionV0Envelope v0; - // case ENVELOPE_TYPE_TX: - // TransactionV1Envelope v1; - // case ENVELOPE_TYPE_TX_FEE_BUMP: - // FeeBumpTransactionEnvelope feeBump; - // }; +// union TransactionEnvelope switch (EnvelopeType type) +// { +// case ENVELOPE_TYPE_TX_V0: +// TransactionV0Envelope v0; +// case ENVELOPE_TYPE_TX: +// TransactionV1Envelope v1; +// case ENVELOPE_TYPE_TX_FEE_BUMP: +// FeeBumpTransactionEnvelope feeBump; +// }; - // =========================================================================== - public class TransactionEnvelope - { - public TransactionEnvelope() { } +// =========================================================================== +public class TransactionEnvelope +{ + public EnvelopeType Discriminant { get; set; } = new(); - public EnvelopeType Discriminant { get; set; } = new EnvelopeType(); + public TransactionV0Envelope V0 { get; set; } + public TransactionV1Envelope V1 { get; set; } + public FeeBumpTransactionEnvelope FeeBump { get; set; } - public TransactionV0Envelope V0 { get; set; } - public TransactionV1Envelope V1 { get; set; } - public FeeBumpTransactionEnvelope FeeBump { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionEnvelope encodedTransactionEnvelope) + public static void Encode(XdrDataOutputStream stream, TransactionEnvelope encodedTransactionEnvelope) + { + stream.WriteInt((int)encodedTransactionEnvelope.Discriminant.InnerValue); + switch (encodedTransactionEnvelope.Discriminant.InnerValue) { - stream.WriteInt((int)encodedTransactionEnvelope.Discriminant.InnerValue); - switch (encodedTransactionEnvelope.Discriminant.InnerValue) - { - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_V0: - TransactionV0Envelope.Encode(stream, encodedTransactionEnvelope.V0); - break; - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: - TransactionV1Envelope.Encode(stream, encodedTransactionEnvelope.V1); - break; - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP: - FeeBumpTransactionEnvelope.Encode(stream, encodedTransactionEnvelope.FeeBump); - break; - } + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_V0: + TransactionV0Envelope.Encode(stream, encodedTransactionEnvelope.V0); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: + TransactionV1Envelope.Encode(stream, encodedTransactionEnvelope.V1); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP: + FeeBumpTransactionEnvelope.Encode(stream, encodedTransactionEnvelope.FeeBump); + break; } - public static TransactionEnvelope Decode(XdrDataInputStream stream) + } + + public static TransactionEnvelope Decode(XdrDataInputStream stream) + { + var decodedTransactionEnvelope = new TransactionEnvelope(); + var discriminant = EnvelopeType.Decode(stream); + decodedTransactionEnvelope.Discriminant = discriminant; + switch (decodedTransactionEnvelope.Discriminant.InnerValue) { - TransactionEnvelope decodedTransactionEnvelope = new TransactionEnvelope(); - EnvelopeType discriminant = EnvelopeType.Decode(stream); - decodedTransactionEnvelope.Discriminant = discriminant; - switch (decodedTransactionEnvelope.Discriminant.InnerValue) - { - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_V0: - decodedTransactionEnvelope.V0 = TransactionV0Envelope.Decode(stream); - break; - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: - decodedTransactionEnvelope.V1 = TransactionV1Envelope.Decode(stream); - break; - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP: - decodedTransactionEnvelope.FeeBump = FeeBumpTransactionEnvelope.Decode(stream); - break; - } - return decodedTransactionEnvelope; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_V0: + decodedTransactionEnvelope.V0 = TransactionV0Envelope.Decode(stream); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: + decodedTransactionEnvelope.V1 = TransactionV1Envelope.Decode(stream); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP: + decodedTransactionEnvelope.FeeBump = FeeBumpTransactionEnvelope.Decode(stream); + break; } + + return decodedTransactionEnvelope; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionHistoryEntry.cs b/stellar-dotnet-sdk-xdr/generated/TransactionHistoryEntry.cs index cf05268c..ce86639a 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionHistoryEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionHistoryEntry.cs @@ -1,77 +1,84 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionHistoryEntry +// { +// uint32 ledgerSeq; +// TransactionSet txSet; +// +// // when v != 0, txSet must be empty +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// GeneralizedTransactionSet generalizedTxSet; +// } +// ext; +// }; - // struct TransactionHistoryEntry - // { - // uint32 ledgerSeq; - // TransactionSet txSet; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; +// =========================================================================== +public class TransactionHistoryEntry +{ + public Uint32 LedgerSeq { get; set; } + public TransactionSet TxSet { get; set; } + public TransactionHistoryEntryExt Ext { get; set; } - // =========================================================================== - public class TransactionHistoryEntry + public static void Encode(XdrDataOutputStream stream, TransactionHistoryEntry encodedTransactionHistoryEntry) { - public TransactionHistoryEntry() { } - public Uint32 LedgerSeq { get; set; } - public TransactionSet TxSet { get; set; } - public TransactionHistoryEntryExt Ext { get; set; } + Uint32.Encode(stream, encodedTransactionHistoryEntry.LedgerSeq); + TransactionSet.Encode(stream, encodedTransactionHistoryEntry.TxSet); + TransactionHistoryEntryExt.Encode(stream, encodedTransactionHistoryEntry.Ext); + } - public static void Encode(XdrDataOutputStream stream, TransactionHistoryEntry encodedTransactionHistoryEntry) - { - Uint32.Encode(stream, encodedTransactionHistoryEntry.LedgerSeq); - TransactionSet.Encode(stream, encodedTransactionHistoryEntry.TxSet); - TransactionHistoryEntryExt.Encode(stream, encodedTransactionHistoryEntry.Ext); - } - public static TransactionHistoryEntry Decode(XdrDataInputStream stream) - { - TransactionHistoryEntry decodedTransactionHistoryEntry = new TransactionHistoryEntry(); - decodedTransactionHistoryEntry.LedgerSeq = Uint32.Decode(stream); - decodedTransactionHistoryEntry.TxSet = TransactionSet.Decode(stream); - decodedTransactionHistoryEntry.Ext = TransactionHistoryEntryExt.Decode(stream); - return decodedTransactionHistoryEntry; - } + public static TransactionHistoryEntry Decode(XdrDataInputStream stream) + { + var decodedTransactionHistoryEntry = new TransactionHistoryEntry(); + decodedTransactionHistoryEntry.LedgerSeq = Uint32.Decode(stream); + decodedTransactionHistoryEntry.TxSet = TransactionSet.Decode(stream); + decodedTransactionHistoryEntry.Ext = TransactionHistoryEntryExt.Decode(stream); + return decodedTransactionHistoryEntry; + } - public class TransactionHistoryEntryExt - { - public TransactionHistoryEntryExt() { } + public class TransactionHistoryEntryExt + { + public int Discriminant { get; set; } - public int Discriminant { get; set; } = new int(); + public GeneralizedTransactionSet GeneralizedTxSet { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionHistoryEntryExt encodedTransactionHistoryEntryExt) + public static void Encode(XdrDataOutputStream stream, + TransactionHistoryEntryExt encodedTransactionHistoryEntryExt) + { + stream.WriteInt(encodedTransactionHistoryEntryExt.Discriminant); + switch (encodedTransactionHistoryEntryExt.Discriminant) { - stream.WriteInt((int)encodedTransactionHistoryEntryExt.Discriminant); - switch (encodedTransactionHistoryEntryExt.Discriminant) - { - case 0: - break; - } + case 0: + break; + case 1: + GeneralizedTransactionSet.Encode(stream, encodedTransactionHistoryEntryExt.GeneralizedTxSet); + break; } - public static TransactionHistoryEntryExt Decode(XdrDataInputStream stream) + } + + public static TransactionHistoryEntryExt Decode(XdrDataInputStream stream) + { + var decodedTransactionHistoryEntryExt = new TransactionHistoryEntryExt(); + var discriminant = stream.ReadInt(); + decodedTransactionHistoryEntryExt.Discriminant = discriminant; + switch (decodedTransactionHistoryEntryExt.Discriminant) { - TransactionHistoryEntryExt decodedTransactionHistoryEntryExt = new TransactionHistoryEntryExt(); - int discriminant = stream.ReadInt(); - decodedTransactionHistoryEntryExt.Discriminant = discriminant; - switch (decodedTransactionHistoryEntryExt.Discriminant) - { - case 0: - break; - } - return decodedTransactionHistoryEntryExt; + case 0: + break; + case 1: + decodedTransactionHistoryEntryExt.GeneralizedTxSet = GeneralizedTransactionSet.Decode(stream); + break; } + return decodedTransactionHistoryEntryExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionHistoryResultEntry.cs b/stellar-dotnet-sdk-xdr/generated/TransactionHistoryResultEntry.cs index db4d2d26..9ca74316 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionHistoryResultEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionHistoryResultEntry.cs @@ -1,77 +1,75 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct TransactionHistoryResultEntry +// { +// uint32 ledgerSeq; +// TransactionResultSet txResultSet; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; + +// =========================================================================== +public class TransactionHistoryResultEntry { + public Uint32 LedgerSeq { get; set; } + public TransactionResultSet TxResultSet { get; set; } + public TransactionHistoryResultEntryExt Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, + TransactionHistoryResultEntry encodedTransactionHistoryResultEntry) + { + Uint32.Encode(stream, encodedTransactionHistoryResultEntry.LedgerSeq); + TransactionResultSet.Encode(stream, encodedTransactionHistoryResultEntry.TxResultSet); + TransactionHistoryResultEntryExt.Encode(stream, encodedTransactionHistoryResultEntry.Ext); + } - // struct TransactionHistoryResultEntry - // { - // uint32 ledgerSeq; - // TransactionResultSet txResultSet; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static TransactionHistoryResultEntry Decode(XdrDataInputStream stream) + { + var decodedTransactionHistoryResultEntry = new TransactionHistoryResultEntry(); + decodedTransactionHistoryResultEntry.LedgerSeq = Uint32.Decode(stream); + decodedTransactionHistoryResultEntry.TxResultSet = TransactionResultSet.Decode(stream); + decodedTransactionHistoryResultEntry.Ext = TransactionHistoryResultEntryExt.Decode(stream); + return decodedTransactionHistoryResultEntry; + } - // =========================================================================== - public class TransactionHistoryResultEntry + public class TransactionHistoryResultEntryExt { - public TransactionHistoryResultEntry() { } - public Uint32 LedgerSeq { get; set; } - public TransactionResultSet TxResultSet { get; set; } - public TransactionHistoryResultEntryExt Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionHistoryResultEntry encodedTransactionHistoryResultEntry) + public static void Encode(XdrDataOutputStream stream, + TransactionHistoryResultEntryExt encodedTransactionHistoryResultEntryExt) { - Uint32.Encode(stream, encodedTransactionHistoryResultEntry.LedgerSeq); - TransactionResultSet.Encode(stream, encodedTransactionHistoryResultEntry.TxResultSet); - TransactionHistoryResultEntryExt.Encode(stream, encodedTransactionHistoryResultEntry.Ext); - } - public static TransactionHistoryResultEntry Decode(XdrDataInputStream stream) - { - TransactionHistoryResultEntry decodedTransactionHistoryResultEntry = new TransactionHistoryResultEntry(); - decodedTransactionHistoryResultEntry.LedgerSeq = Uint32.Decode(stream); - decodedTransactionHistoryResultEntry.TxResultSet = TransactionResultSet.Decode(stream); - decodedTransactionHistoryResultEntry.Ext = TransactionHistoryResultEntryExt.Decode(stream); - return decodedTransactionHistoryResultEntry; + stream.WriteInt(encodedTransactionHistoryResultEntryExt.Discriminant); + switch (encodedTransactionHistoryResultEntryExt.Discriminant) + { + case 0: + break; + } } - public class TransactionHistoryResultEntryExt + public static TransactionHistoryResultEntryExt Decode(XdrDataInputStream stream) { - public TransactionHistoryResultEntryExt() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, TransactionHistoryResultEntryExt encodedTransactionHistoryResultEntryExt) - { - stream.WriteInt((int)encodedTransactionHistoryResultEntryExt.Discriminant); - switch (encodedTransactionHistoryResultEntryExt.Discriminant) - { - case 0: - break; - } - } - public static TransactionHistoryResultEntryExt Decode(XdrDataInputStream stream) + var decodedTransactionHistoryResultEntryExt = new TransactionHistoryResultEntryExt(); + var discriminant = stream.ReadInt(); + decodedTransactionHistoryResultEntryExt.Discriminant = discriminant; + switch (decodedTransactionHistoryResultEntryExt.Discriminant) { - TransactionHistoryResultEntryExt decodedTransactionHistoryResultEntryExt = new TransactionHistoryResultEntryExt(); - int discriminant = stream.ReadInt(); - decodedTransactionHistoryResultEntryExt.Discriminant = discriminant; - switch (decodedTransactionHistoryResultEntryExt.Discriminant) - { - case 0: - break; - } - return decodedTransactionHistoryResultEntryExt; + case 0: + break; } + return decodedTransactionHistoryResultEntryExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionMeta.cs b/stellar-dotnet-sdk-xdr/generated/TransactionMeta.cs index 467caf97..bb39b320 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionMeta.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionMeta.cs @@ -1,76 +1,79 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union TransactionMeta switch (int v) - // { - // case 0: - // OperationMeta operations<>; - // case 1: - // TransactionMetaV1 v1; - // case 2: - // TransactionMetaV2 v2; - // }; +// union TransactionMeta switch (int v) +// { +// case 0: +// OperationMeta operations<>; +// case 1: +// TransactionMetaV1 v1; +// case 2: +// TransactionMetaV2 v2; +// case 3: +// TransactionMetaV3 v3; +// }; - // =========================================================================== - public class TransactionMeta - { - public TransactionMeta() { } +// =========================================================================== +public class TransactionMeta +{ + public int Discriminant { get; set; } - public int Discriminant { get; set; } = new int(); + public OperationMeta[] Operations { get; set; } + public TransactionMetaV1 V1 { get; set; } + public TransactionMetaV2 V2 { get; set; } + public TransactionMetaV3 V3 { get; set; } - public OperationMeta[] Operations { get; set; } - public TransactionMetaV1 V1 { get; set; } - public TransactionMetaV2 V2 { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionMeta encodedTransactionMeta) + public static void Encode(XdrDataOutputStream stream, TransactionMeta encodedTransactionMeta) + { + stream.WriteInt(encodedTransactionMeta.Discriminant); + switch (encodedTransactionMeta.Discriminant) { - stream.WriteInt((int)encodedTransactionMeta.Discriminant); - switch (encodedTransactionMeta.Discriminant) - { - case 0: - int operationssize = encodedTransactionMeta.Operations.Length; - stream.WriteInt(operationssize); - for (int i = 0; i < operationssize; i++) - { - OperationMeta.Encode(stream, encodedTransactionMeta.Operations[i]); - } - break; - case 1: - TransactionMetaV1.Encode(stream, encodedTransactionMeta.V1); - break; - case 2: - TransactionMetaV2.Encode(stream, encodedTransactionMeta.V2); - break; - } + case 0: + var operationssize = encodedTransactionMeta.Operations.Length; + stream.WriteInt(operationssize); + for (var i = 0; i < operationssize; i++) + OperationMeta.Encode(stream, encodedTransactionMeta.Operations[i]); + break; + case 1: + TransactionMetaV1.Encode(stream, encodedTransactionMeta.V1); + break; + case 2: + TransactionMetaV2.Encode(stream, encodedTransactionMeta.V2); + break; + case 3: + TransactionMetaV3.Encode(stream, encodedTransactionMeta.V3); + break; } - public static TransactionMeta Decode(XdrDataInputStream stream) + } + + public static TransactionMeta Decode(XdrDataInputStream stream) + { + var decodedTransactionMeta = new TransactionMeta(); + var discriminant = stream.ReadInt(); + decodedTransactionMeta.Discriminant = discriminant; + switch (decodedTransactionMeta.Discriminant) { - TransactionMeta decodedTransactionMeta = new TransactionMeta(); - int discriminant = stream.ReadInt(); - decodedTransactionMeta.Discriminant = discriminant; - switch (decodedTransactionMeta.Discriminant) - { - case 0: - int operationssize = stream.ReadInt(); - decodedTransactionMeta.Operations = new OperationMeta[operationssize]; - for (int i = 0; i < operationssize; i++) - { - decodedTransactionMeta.Operations[i] = OperationMeta.Decode(stream); - } - break; - case 1: - decodedTransactionMeta.V1 = TransactionMetaV1.Decode(stream); - break; - case 2: - decodedTransactionMeta.V2 = TransactionMetaV2.Decode(stream); - break; - } - return decodedTransactionMeta; + case 0: + var operationssize = stream.ReadInt(); + decodedTransactionMeta.Operations = new OperationMeta[operationssize]; + for (var i = 0; i < operationssize; i++) + decodedTransactionMeta.Operations[i] = OperationMeta.Decode(stream); + break; + case 1: + decodedTransactionMeta.V1 = TransactionMetaV1.Decode(stream); + break; + case 2: + decodedTransactionMeta.V2 = TransactionMetaV2.Decode(stream); + break; + case 3: + decodedTransactionMeta.V3 = TransactionMetaV3.Decode(stream); + break; } + + return decodedTransactionMeta; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionMetaV1.cs b/stellar-dotnet-sdk-xdr/generated/TransactionMetaV1.cs index 7995ef93..498a4663 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionMetaV1.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionMetaV1.cs @@ -1,46 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionMetaV1 +// { +// LedgerEntryChanges txChanges; // tx level changes if any +// OperationMeta operations<>; // meta for each operation +// }; - // struct TransactionMetaV1 - // { - // LedgerEntryChanges txChanges; // tx level changes if any - // OperationMeta operations<>; // meta for each operation - // }; +// =========================================================================== +public class TransactionMetaV1 +{ + public LedgerEntryChanges TxChanges { get; set; } + public OperationMeta[] Operations { get; set; } - // =========================================================================== - public class TransactionMetaV1 + public static void Encode(XdrDataOutputStream stream, TransactionMetaV1 encodedTransactionMetaV1) { - public TransactionMetaV1() { } - public LedgerEntryChanges TxChanges { get; set; } - public OperationMeta[] Operations { get; set; } + LedgerEntryChanges.Encode(stream, encodedTransactionMetaV1.TxChanges); + var operationssize = encodedTransactionMetaV1.Operations.Length; + stream.WriteInt(operationssize); + for (var i = 0; i < operationssize; i++) OperationMeta.Encode(stream, encodedTransactionMetaV1.Operations[i]); + } - public static void Encode(XdrDataOutputStream stream, TransactionMetaV1 encodedTransactionMetaV1) - { - LedgerEntryChanges.Encode(stream, encodedTransactionMetaV1.TxChanges); - int operationssize = encodedTransactionMetaV1.Operations.Length; - stream.WriteInt(operationssize); - for (int i = 0; i < operationssize; i++) - { - OperationMeta.Encode(stream, encodedTransactionMetaV1.Operations[i]); - } - } - public static TransactionMetaV1 Decode(XdrDataInputStream stream) - { - TransactionMetaV1 decodedTransactionMetaV1 = new TransactionMetaV1(); - decodedTransactionMetaV1.TxChanges = LedgerEntryChanges.Decode(stream); - int operationssize = stream.ReadInt(); - decodedTransactionMetaV1.Operations = new OperationMeta[operationssize]; - for (int i = 0; i < operationssize; i++) - { - decodedTransactionMetaV1.Operations[i] = OperationMeta.Decode(stream); - } - return decodedTransactionMetaV1; - } + public static TransactionMetaV1 Decode(XdrDataInputStream stream) + { + var decodedTransactionMetaV1 = new TransactionMetaV1(); + decodedTransactionMetaV1.TxChanges = LedgerEntryChanges.Decode(stream); + var operationssize = stream.ReadInt(); + decodedTransactionMetaV1.Operations = new OperationMeta[operationssize]; + for (var i = 0; i < operationssize; i++) decodedTransactionMetaV1.Operations[i] = OperationMeta.Decode(stream); + return decodedTransactionMetaV1; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionMetaV2.cs b/stellar-dotnet-sdk-xdr/generated/TransactionMetaV2.cs index 5e8c0c1c..e5909530 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionMetaV2.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionMetaV2.cs @@ -1,52 +1,43 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionMetaV2 +// { +// 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 +// }; - // struct TransactionMetaV2 - // { - // 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 - // }; +// =========================================================================== +public class TransactionMetaV2 +{ + public LedgerEntryChanges TxChangesBefore { get; set; } + public OperationMeta[] Operations { get; set; } + public LedgerEntryChanges TxChangesAfter { get; set; } - // =========================================================================== - public class TransactionMetaV2 + public static void Encode(XdrDataOutputStream stream, TransactionMetaV2 encodedTransactionMetaV2) { - public TransactionMetaV2() { } - public LedgerEntryChanges TxChangesBefore { get; set; } - public OperationMeta[] Operations { get; set; } - public LedgerEntryChanges TxChangesAfter { get; set; } + LedgerEntryChanges.Encode(stream, encodedTransactionMetaV2.TxChangesBefore); + var operationssize = encodedTransactionMetaV2.Operations.Length; + stream.WriteInt(operationssize); + for (var i = 0; i < operationssize; i++) OperationMeta.Encode(stream, encodedTransactionMetaV2.Operations[i]); + LedgerEntryChanges.Encode(stream, encodedTransactionMetaV2.TxChangesAfter); + } - public static void Encode(XdrDataOutputStream stream, TransactionMetaV2 encodedTransactionMetaV2) - { - LedgerEntryChanges.Encode(stream, encodedTransactionMetaV2.TxChangesBefore); - int operationssize = encodedTransactionMetaV2.Operations.Length; - stream.WriteInt(operationssize); - for (int i = 0; i < operationssize; i++) - { - OperationMeta.Encode(stream, encodedTransactionMetaV2.Operations[i]); - } - LedgerEntryChanges.Encode(stream, encodedTransactionMetaV2.TxChangesAfter); - } - public static TransactionMetaV2 Decode(XdrDataInputStream stream) - { - TransactionMetaV2 decodedTransactionMetaV2 = new TransactionMetaV2(); - decodedTransactionMetaV2.TxChangesBefore = LedgerEntryChanges.Decode(stream); - int operationssize = stream.ReadInt(); - decodedTransactionMetaV2.Operations = new OperationMeta[operationssize]; - for (int i = 0; i < operationssize; i++) - { - decodedTransactionMetaV2.Operations[i] = OperationMeta.Decode(stream); - } - decodedTransactionMetaV2.TxChangesAfter = LedgerEntryChanges.Decode(stream); - return decodedTransactionMetaV2; - } + public static TransactionMetaV2 Decode(XdrDataInputStream stream) + { + var decodedTransactionMetaV2 = new TransactionMetaV2(); + decodedTransactionMetaV2.TxChangesBefore = LedgerEntryChanges.Decode(stream); + var operationssize = stream.ReadInt(); + decodedTransactionMetaV2.Operations = new OperationMeta[operationssize]; + for (var i = 0; i < operationssize; i++) decodedTransactionMetaV2.Operations[i] = OperationMeta.Decode(stream); + decodedTransactionMetaV2.TxChangesAfter = LedgerEntryChanges.Decode(stream); + return decodedTransactionMetaV2; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionMetaV3.cs b/stellar-dotnet-sdk-xdr/generated/TransactionMetaV3.cs new file mode 100644 index 00000000..2cada8bd --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TransactionMetaV3.cs @@ -0,0 +1,62 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// 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 +// // Soroban transactions). +// }; + +// =========================================================================== +public class TransactionMetaV3 +{ + public ExtensionPoint Ext { get; set; } + public LedgerEntryChanges TxChangesBefore { get; set; } + public OperationMeta[] Operations { get; set; } + public LedgerEntryChanges TxChangesAfter { get; set; } + public SorobanTransactionMeta SorobanMeta { get; set; } + + public static void Encode(XdrDataOutputStream stream, TransactionMetaV3 encodedTransactionMetaV3) + { + ExtensionPoint.Encode(stream, encodedTransactionMetaV3.Ext); + LedgerEntryChanges.Encode(stream, encodedTransactionMetaV3.TxChangesBefore); + var operationssize = encodedTransactionMetaV3.Operations.Length; + stream.WriteInt(operationssize); + for (var i = 0; i < operationssize; i++) OperationMeta.Encode(stream, encodedTransactionMetaV3.Operations[i]); + LedgerEntryChanges.Encode(stream, encodedTransactionMetaV3.TxChangesAfter); + if (encodedTransactionMetaV3.SorobanMeta != null) + { + stream.WriteInt(1); + SorobanTransactionMeta.Encode(stream, encodedTransactionMetaV3.SorobanMeta); + } + else + { + stream.WriteInt(0); + } + } + + public static TransactionMetaV3 Decode(XdrDataInputStream stream) + { + var decodedTransactionMetaV3 = new TransactionMetaV3(); + decodedTransactionMetaV3.Ext = ExtensionPoint.Decode(stream); + decodedTransactionMetaV3.TxChangesBefore = LedgerEntryChanges.Decode(stream); + var operationssize = stream.ReadInt(); + decodedTransactionMetaV3.Operations = new OperationMeta[operationssize]; + for (var i = 0; i < operationssize; i++) decodedTransactionMetaV3.Operations[i] = OperationMeta.Decode(stream); + decodedTransactionMetaV3.TxChangesAfter = LedgerEntryChanges.Decode(stream); + var SorobanMetaPresent = stream.ReadInt(); + if (SorobanMetaPresent != 0) decodedTransactionMetaV3.SorobanMeta = SorobanTransactionMeta.Decode(stream); + return decodedTransactionMetaV3; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionPhase.cs b/stellar-dotnet-sdk-xdr/generated/TransactionPhase.cs new file mode 100644 index 00000000..d420d8df --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TransactionPhase.cs @@ -0,0 +1,52 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union TransactionPhase switch (int v) +// { +// case 0: +// TxSetComponent v0Components<>; +// }; + +// =========================================================================== +public class TransactionPhase +{ + public int Discriminant { get; set; } + + public TxSetComponent[] V0Components { get; set; } + + public static void Encode(XdrDataOutputStream stream, TransactionPhase encodedTransactionPhase) + { + stream.WriteInt(encodedTransactionPhase.Discriminant); + switch (encodedTransactionPhase.Discriminant) + { + case 0: + var v0Componentssize = encodedTransactionPhase.V0Components.Length; + stream.WriteInt(v0Componentssize); + for (var i = 0; i < v0Componentssize; i++) + TxSetComponent.Encode(stream, encodedTransactionPhase.V0Components[i]); + break; + } + } + + public static TransactionPhase Decode(XdrDataInputStream stream) + { + var decodedTransactionPhase = new TransactionPhase(); + var discriminant = stream.ReadInt(); + decodedTransactionPhase.Discriminant = discriminant; + switch (decodedTransactionPhase.Discriminant) + { + case 0: + var v0Componentssize = stream.ReadInt(); + decodedTransactionPhase.V0Components = new TxSetComponent[v0Componentssize]; + for (var i = 0; i < v0Componentssize; i++) + decodedTransactionPhase.V0Components[i] = TxSetComponent.Decode(stream); + break; + } + + return decodedTransactionPhase; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionResult.cs b/stellar-dotnet-sdk-xdr/generated/TransactionResult.cs index 1d40299f..aedd105e 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionResult.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionResult.cs @@ -1,146 +1,182 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionResult +// { +// int64 feeCharged; // actual fee charged for the transaction +// +// union switch (TransactionResultCode code) +// { +// case txFEE_BUMP_INNER_SUCCESS: +// case txFEE_BUMP_INNER_FAILED: +// InnerTransactionResultPair innerResultPair; +// case txSUCCESS: +// case txFAILED: +// OperationResult results<>; +// case txTOO_EARLY: +// case txTOO_LATE: +// case txMISSING_OPERATION: +// case txBAD_SEQ: +// case txBAD_AUTH: +// case txINSUFFICIENT_BALANCE: +// case txNO_ACCOUNT: +// case txINSUFFICIENT_FEE: +// case txBAD_AUTH_EXTRA: +// case txINTERNAL_ERROR: +// case txNOT_SUPPORTED: +// // case txFEE_BUMP_INNER_FAILED: handled above +// case txBAD_SPONSORSHIP: +// case txBAD_MIN_SEQ_AGE_OR_GAP: +// case txMALFORMED: +// case txSOROBAN_INVALID: +// void; +// } +// result; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; - // struct TransactionResult - // { - // int64 feeCharged; // actual fee charged for the transaction - // - // union switch (TransactionResultCode code) - // { - // case txFEE_BUMP_INNER_SUCCESS: - // case txFEE_BUMP_INNER_FAILED: - // InnerTransactionResultPair innerResultPair; - // case txSUCCESS: - // case txFAILED: - // OperationResult results<>; - // default: - // void; - // } - // result; - // - // // reserved for future use - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; +// =========================================================================== +public class TransactionResult +{ + public Int64 FeeCharged { get; set; } + public TransactionResultResult Result { get; set; } + public TransactionResultExt Ext { get; set; } - // =========================================================================== - public class TransactionResult + public static void Encode(XdrDataOutputStream stream, TransactionResult encodedTransactionResult) { - public TransactionResult() { } - public Int64 FeeCharged { get; set; } - public TransactionResultResult Result { get; set; } - public TransactionResultExt Ext { get; set; } + Int64.Encode(stream, encodedTransactionResult.FeeCharged); + TransactionResultResult.Encode(stream, encodedTransactionResult.Result); + TransactionResultExt.Encode(stream, encodedTransactionResult.Ext); + } - public static void Encode(XdrDataOutputStream stream, TransactionResult encodedTransactionResult) - { - Int64.Encode(stream, encodedTransactionResult.FeeCharged); - TransactionResultResult.Encode(stream, encodedTransactionResult.Result); - TransactionResultExt.Encode(stream, encodedTransactionResult.Ext); - } - public static TransactionResult Decode(XdrDataInputStream stream) - { - TransactionResult decodedTransactionResult = new TransactionResult(); - decodedTransactionResult.FeeCharged = Int64.Decode(stream); - decodedTransactionResult.Result = TransactionResultResult.Decode(stream); - decodedTransactionResult.Ext = TransactionResultExt.Decode(stream); - return decodedTransactionResult; - } + public static TransactionResult Decode(XdrDataInputStream stream) + { + var decodedTransactionResult = new TransactionResult(); + decodedTransactionResult.FeeCharged = Int64.Decode(stream); + decodedTransactionResult.Result = TransactionResultResult.Decode(stream); + decodedTransactionResult.Ext = TransactionResultExt.Decode(stream); + return decodedTransactionResult; + } - public class TransactionResultResult - { - public TransactionResultResult() { } + public class TransactionResultResult + { + public TransactionResultCode Discriminant { get; set; } = new(); - public TransactionResultCode Discriminant { get; set; } = new TransactionResultCode(); + public InnerTransactionResultPair InnerResultPair { get; set; } + public OperationResult[] Results { get; set; } - public InnerTransactionResultPair InnerResultPair { get; set; } - public OperationResult[] Results { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionResultResult encodedTransactionResultResult) + public static void Encode(XdrDataOutputStream stream, TransactionResultResult encodedTransactionResultResult) + { + stream.WriteInt((int)encodedTransactionResultResult.Discriminant.InnerValue); + switch (encodedTransactionResultResult.Discriminant.InnerValue) { - stream.WriteInt((int)encodedTransactionResultResult.Discriminant.InnerValue); - switch (encodedTransactionResultResult.Discriminant.InnerValue) - { - case TransactionResultCode.TransactionResultCodeEnum.txFEE_BUMP_INNER_SUCCESS: - case TransactionResultCode.TransactionResultCodeEnum.txFEE_BUMP_INNER_FAILED: - InnerTransactionResultPair.Encode(stream, encodedTransactionResultResult.InnerResultPair); - break; - case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS: - case TransactionResultCode.TransactionResultCodeEnum.txFAILED: - int resultssize = encodedTransactionResultResult.Results.Length; - stream.WriteInt(resultssize); - for (int i = 0; i < resultssize; i++) - { - OperationResult.Encode(stream, encodedTransactionResultResult.Results[i]); - } - break; - default: - break; - } + case TransactionResultCode.TransactionResultCodeEnum.txFEE_BUMP_INNER_SUCCESS: + case TransactionResultCode.TransactionResultCodeEnum.txFEE_BUMP_INNER_FAILED: + InnerTransactionResultPair.Encode(stream, encodedTransactionResultResult.InnerResultPair); + break; + case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS: + case TransactionResultCode.TransactionResultCodeEnum.txFAILED: + var resultssize = encodedTransactionResultResult.Results.Length; + stream.WriteInt(resultssize); + for (var i = 0; i < resultssize; i++) + OperationResult.Encode(stream, encodedTransactionResultResult.Results[i]); + break; + case TransactionResultCode.TransactionResultCodeEnum.txTOO_EARLY: + case TransactionResultCode.TransactionResultCodeEnum.txTOO_LATE: + case TransactionResultCode.TransactionResultCodeEnum.txMISSING_OPERATION: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_SEQ: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH: + case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_BALANCE: + case TransactionResultCode.TransactionResultCodeEnum.txNO_ACCOUNT: + case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_FEE: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH_EXTRA: + case TransactionResultCode.TransactionResultCodeEnum.txINTERNAL_ERROR: + case TransactionResultCode.TransactionResultCodeEnum.txNOT_SUPPORTED: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_SPONSORSHIP: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_MIN_SEQ_AGE_OR_GAP: + case TransactionResultCode.TransactionResultCodeEnum.txMALFORMED: + case TransactionResultCode.TransactionResultCodeEnum.txSOROBAN_INVALID: + break; } - public static TransactionResultResult Decode(XdrDataInputStream stream) + } + + public static TransactionResultResult Decode(XdrDataInputStream stream) + { + var decodedTransactionResultResult = new TransactionResultResult(); + var discriminant = TransactionResultCode.Decode(stream); + decodedTransactionResultResult.Discriminant = discriminant; + switch (decodedTransactionResultResult.Discriminant.InnerValue) { - TransactionResultResult decodedTransactionResultResult = new TransactionResultResult(); - TransactionResultCode discriminant = TransactionResultCode.Decode(stream); - decodedTransactionResultResult.Discriminant = discriminant; - switch (decodedTransactionResultResult.Discriminant.InnerValue) - { - case TransactionResultCode.TransactionResultCodeEnum.txFEE_BUMP_INNER_SUCCESS: - case TransactionResultCode.TransactionResultCodeEnum.txFEE_BUMP_INNER_FAILED: - decodedTransactionResultResult.InnerResultPair = InnerTransactionResultPair.Decode(stream); - break; - case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS: - case TransactionResultCode.TransactionResultCodeEnum.txFAILED: - int resultssize = stream.ReadInt(); - decodedTransactionResultResult.Results = new OperationResult[resultssize]; - for (int i = 0; i < resultssize; i++) - { - decodedTransactionResultResult.Results[i] = OperationResult.Decode(stream); - } - break; - default: - break; - } - return decodedTransactionResultResult; + case TransactionResultCode.TransactionResultCodeEnum.txFEE_BUMP_INNER_SUCCESS: + case TransactionResultCode.TransactionResultCodeEnum.txFEE_BUMP_INNER_FAILED: + decodedTransactionResultResult.InnerResultPair = InnerTransactionResultPair.Decode(stream); + break; + case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS: + case TransactionResultCode.TransactionResultCodeEnum.txFAILED: + var resultssize = stream.ReadInt(); + decodedTransactionResultResult.Results = new OperationResult[resultssize]; + for (var i = 0; i < resultssize; i++) + decodedTransactionResultResult.Results[i] = OperationResult.Decode(stream); + break; + case TransactionResultCode.TransactionResultCodeEnum.txTOO_EARLY: + case TransactionResultCode.TransactionResultCodeEnum.txTOO_LATE: + case TransactionResultCode.TransactionResultCodeEnum.txMISSING_OPERATION: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_SEQ: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH: + case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_BALANCE: + case TransactionResultCode.TransactionResultCodeEnum.txNO_ACCOUNT: + case TransactionResultCode.TransactionResultCodeEnum.txINSUFFICIENT_FEE: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_AUTH_EXTRA: + case TransactionResultCode.TransactionResultCodeEnum.txINTERNAL_ERROR: + case TransactionResultCode.TransactionResultCodeEnum.txNOT_SUPPORTED: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_SPONSORSHIP: + case TransactionResultCode.TransactionResultCodeEnum.txBAD_MIN_SEQ_AGE_OR_GAP: + case TransactionResultCode.TransactionResultCodeEnum.txMALFORMED: + case TransactionResultCode.TransactionResultCodeEnum.txSOROBAN_INVALID: + break; } + return decodedTransactionResultResult; } - public class TransactionResultExt - { - public TransactionResultExt() { } + } - public int Discriminant { get; set; } = new int(); + public class TransactionResultExt + { + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionResultExt encodedTransactionResultExt) + public static void Encode(XdrDataOutputStream stream, TransactionResultExt encodedTransactionResultExt) + { + stream.WriteInt(encodedTransactionResultExt.Discriminant); + switch (encodedTransactionResultExt.Discriminant) { - stream.WriteInt((int)encodedTransactionResultExt.Discriminant); - switch (encodedTransactionResultExt.Discriminant) - { - case 0: - break; - } + case 0: + break; } - public static TransactionResultExt Decode(XdrDataInputStream stream) + } + + public static TransactionResultExt Decode(XdrDataInputStream stream) + { + var decodedTransactionResultExt = new TransactionResultExt(); + var discriminant = stream.ReadInt(); + decodedTransactionResultExt.Discriminant = discriminant; + switch (decodedTransactionResultExt.Discriminant) { - TransactionResultExt decodedTransactionResultExt = new TransactionResultExt(); - int discriminant = stream.ReadInt(); - decodedTransactionResultExt.Discriminant = discriminant; - switch (decodedTransactionResultExt.Discriminant) - { - case 0: - break; - } - return decodedTransactionResultExt; + case 0: + break; } + return decodedTransactionResultExt; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionResultCode.cs b/stellar-dotnet-sdk-xdr/generated/TransactionResultCode.cs index 2e618f9a..c8e87d12 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionResultCode.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionResultCode.cs @@ -1,104 +1,106 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // enum TransactionResultCode - // { - // 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 - // txBAD_MIN_SEQ_AGE_OR_GAP = - // -15, // minSeqAge or minSeqLedgerGap conditions not met - // txMALFORMED = -16 // precondition is invalid - // }; +// enum TransactionResultCode +// { +// 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 +// txBAD_MIN_SEQ_AGE_OR_GAP = -15, // minSeqAge or minSeqLedgerGap conditions not met +// txMALFORMED = -16, // precondition is invalid +// txSOROBAN_INVALID = -17 // soroban-specific preconditions were not met +// }; - // =========================================================================== - public class TransactionResultCode +// =========================================================================== +public class TransactionResultCode +{ + public enum TransactionResultCodeEnum { - public enum TransactionResultCodeEnum - { - txFEE_BUMP_INNER_SUCCESS = 1, - txSUCCESS = 0, - txFAILED = -1, - txTOO_EARLY = -2, - txTOO_LATE = -3, - txMISSING_OPERATION = -4, - txBAD_SEQ = -5, - txBAD_AUTH = -6, - txINSUFFICIENT_BALANCE = -7, - txNO_ACCOUNT = -8, - txINSUFFICIENT_FEE = -9, - txBAD_AUTH_EXTRA = -10, - txINTERNAL_ERROR = -11, - txNOT_SUPPORTED = -12, - txFEE_BUMP_INNER_FAILED = -13, - txBAD_SPONSORSHIP = -14, - txBAD_MIN_SEQ_AGE_OR_GAP = -15, - txMALFORMED = -16, - } - public TransactionResultCodeEnum InnerValue { get; set; } = default(TransactionResultCodeEnum); + txFEE_BUMP_INNER_SUCCESS = 1, + txSUCCESS = 0, + txFAILED = -1, + txTOO_EARLY = -2, + txTOO_LATE = -3, + txMISSING_OPERATION = -4, + txBAD_SEQ = -5, + txBAD_AUTH = -6, + txINSUFFICIENT_BALANCE = -7, + txNO_ACCOUNT = -8, + txINSUFFICIENT_FEE = -9, + txBAD_AUTH_EXTRA = -10, + txINTERNAL_ERROR = -11, + txNOT_SUPPORTED = -12, + txFEE_BUMP_INNER_FAILED = -13, + txBAD_SPONSORSHIP = -14, + txBAD_MIN_SEQ_AGE_OR_GAP = -15, + txMALFORMED = -16, + txSOROBAN_INVALID = -17 + } - public static TransactionResultCode Create(TransactionResultCodeEnum v) - { - return new TransactionResultCode - { - InnerValue = v - }; - } + public TransactionResultCodeEnum InnerValue { get; set; } = default; - public static TransactionResultCode Decode(XdrDataInputStream stream) + public static TransactionResultCode Create(TransactionResultCodeEnum v) + { + return new TransactionResultCode { - int value = stream.ReadInt(); - switch (value) - { - case 1: return Create(TransactionResultCodeEnum.txFEE_BUMP_INNER_SUCCESS); - case 0: return Create(TransactionResultCodeEnum.txSUCCESS); - case -1: return Create(TransactionResultCodeEnum.txFAILED); - case -2: return Create(TransactionResultCodeEnum.txTOO_EARLY); - case -3: return Create(TransactionResultCodeEnum.txTOO_LATE); - case -4: return Create(TransactionResultCodeEnum.txMISSING_OPERATION); - case -5: return Create(TransactionResultCodeEnum.txBAD_SEQ); - case -6: return Create(TransactionResultCodeEnum.txBAD_AUTH); - case -7: return Create(TransactionResultCodeEnum.txINSUFFICIENT_BALANCE); - case -8: return Create(TransactionResultCodeEnum.txNO_ACCOUNT); - case -9: return Create(TransactionResultCodeEnum.txINSUFFICIENT_FEE); - case -10: return Create(TransactionResultCodeEnum.txBAD_AUTH_EXTRA); - case -11: return Create(TransactionResultCodeEnum.txINTERNAL_ERROR); - case -12: return Create(TransactionResultCodeEnum.txNOT_SUPPORTED); - case -13: return Create(TransactionResultCodeEnum.txFEE_BUMP_INNER_FAILED); - case -14: return Create(TransactionResultCodeEnum.txBAD_SPONSORSHIP); - case -15: return Create(TransactionResultCodeEnum.txBAD_MIN_SEQ_AGE_OR_GAP); - case -16: return Create(TransactionResultCodeEnum.txMALFORMED); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, TransactionResultCode value) + public static TransactionResultCode Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 1: return Create(TransactionResultCodeEnum.txFEE_BUMP_INNER_SUCCESS); + case 0: return Create(TransactionResultCodeEnum.txSUCCESS); + case -1: return Create(TransactionResultCodeEnum.txFAILED); + case -2: return Create(TransactionResultCodeEnum.txTOO_EARLY); + case -3: return Create(TransactionResultCodeEnum.txTOO_LATE); + case -4: return Create(TransactionResultCodeEnum.txMISSING_OPERATION); + case -5: return Create(TransactionResultCodeEnum.txBAD_SEQ); + case -6: return Create(TransactionResultCodeEnum.txBAD_AUTH); + case -7: return Create(TransactionResultCodeEnum.txINSUFFICIENT_BALANCE); + case -8: return Create(TransactionResultCodeEnum.txNO_ACCOUNT); + case -9: return Create(TransactionResultCodeEnum.txINSUFFICIENT_FEE); + case -10: return Create(TransactionResultCodeEnum.txBAD_AUTH_EXTRA); + case -11: return Create(TransactionResultCodeEnum.txINTERNAL_ERROR); + case -12: return Create(TransactionResultCodeEnum.txNOT_SUPPORTED); + case -13: return Create(TransactionResultCodeEnum.txFEE_BUMP_INNER_FAILED); + case -14: return Create(TransactionResultCodeEnum.txBAD_SPONSORSHIP); + case -15: return Create(TransactionResultCodeEnum.txBAD_MIN_SEQ_AGE_OR_GAP); + case -16: return Create(TransactionResultCodeEnum.txMALFORMED); + case -17: return Create(TransactionResultCodeEnum.txSOROBAN_INVALID); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, TransactionResultCode value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionResultMeta.cs b/stellar-dotnet-sdk-xdr/generated/TransactionResultMeta.cs index a1ee5636..d9a3134e 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionResultMeta.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionResultMeta.cs @@ -1,40 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionResultMeta +// { +// TransactionResultPair result; +// LedgerEntryChanges feeProcessing; +// TransactionMeta txApplyProcessing; +// }; - // struct TransactionResultMeta - // { - // TransactionResultPair result; - // LedgerEntryChanges feeProcessing; - // TransactionMeta txApplyProcessing; - // }; +// =========================================================================== +public class TransactionResultMeta +{ + public TransactionResultPair Result { get; set; } + public LedgerEntryChanges FeeProcessing { get; set; } + public TransactionMeta TxApplyProcessing { get; set; } - // =========================================================================== - public class TransactionResultMeta + public static void Encode(XdrDataOutputStream stream, TransactionResultMeta encodedTransactionResultMeta) { - public TransactionResultMeta() { } - public TransactionResultPair Result { get; set; } - public LedgerEntryChanges FeeProcessing { get; set; } - public TransactionMeta TxApplyProcessing { get; set; } + TransactionResultPair.Encode(stream, encodedTransactionResultMeta.Result); + LedgerEntryChanges.Encode(stream, encodedTransactionResultMeta.FeeProcessing); + TransactionMeta.Encode(stream, encodedTransactionResultMeta.TxApplyProcessing); + } - public static void Encode(XdrDataOutputStream stream, TransactionResultMeta encodedTransactionResultMeta) - { - TransactionResultPair.Encode(stream, encodedTransactionResultMeta.Result); - LedgerEntryChanges.Encode(stream, encodedTransactionResultMeta.FeeProcessing); - TransactionMeta.Encode(stream, encodedTransactionResultMeta.TxApplyProcessing); - } - public static TransactionResultMeta Decode(XdrDataInputStream stream) - { - TransactionResultMeta decodedTransactionResultMeta = new TransactionResultMeta(); - decodedTransactionResultMeta.Result = TransactionResultPair.Decode(stream); - decodedTransactionResultMeta.FeeProcessing = LedgerEntryChanges.Decode(stream); - decodedTransactionResultMeta.TxApplyProcessing = TransactionMeta.Decode(stream); - return decodedTransactionResultMeta; - } + public static TransactionResultMeta Decode(XdrDataInputStream stream) + { + var decodedTransactionResultMeta = new TransactionResultMeta(); + decodedTransactionResultMeta.Result = TransactionResultPair.Decode(stream); + decodedTransactionResultMeta.FeeProcessing = LedgerEntryChanges.Decode(stream); + decodedTransactionResultMeta.TxApplyProcessing = TransactionMeta.Decode(stream); + return decodedTransactionResultMeta; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionResultPair.cs b/stellar-dotnet-sdk-xdr/generated/TransactionResultPair.cs index 30b6a52e..ed79f5d9 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionResultPair.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionResultPair.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionResultPair +// { +// Hash transactionHash; +// TransactionResult result; // result for the transaction +// }; - // struct TransactionResultPair - // { - // Hash transactionHash; - // TransactionResult result; // result for the transaction - // }; +// =========================================================================== +public class TransactionResultPair +{ + public Hash TransactionHash { get; set; } + public TransactionResult Result { get; set; } - // =========================================================================== - public class TransactionResultPair + public static void Encode(XdrDataOutputStream stream, TransactionResultPair encodedTransactionResultPair) { - public TransactionResultPair() { } - public Hash TransactionHash { get; set; } - public TransactionResult Result { get; set; } + Hash.Encode(stream, encodedTransactionResultPair.TransactionHash); + TransactionResult.Encode(stream, encodedTransactionResultPair.Result); + } - public static void Encode(XdrDataOutputStream stream, TransactionResultPair encodedTransactionResultPair) - { - Hash.Encode(stream, encodedTransactionResultPair.TransactionHash); - TransactionResult.Encode(stream, encodedTransactionResultPair.Result); - } - public static TransactionResultPair Decode(XdrDataInputStream stream) - { - TransactionResultPair decodedTransactionResultPair = new TransactionResultPair(); - decodedTransactionResultPair.TransactionHash = Hash.Decode(stream); - decodedTransactionResultPair.Result = TransactionResult.Decode(stream); - return decodedTransactionResultPair; - } + public static TransactionResultPair Decode(XdrDataInputStream stream) + { + var decodedTransactionResultPair = new TransactionResultPair(); + decodedTransactionResultPair.TransactionHash = Hash.Decode(stream); + decodedTransactionResultPair.Result = TransactionResult.Decode(stream); + return decodedTransactionResultPair; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionResultSet.cs b/stellar-dotnet-sdk-xdr/generated/TransactionResultSet.cs index 142bb21b..e941be66 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionResultSet.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionResultSet.cs @@ -1,42 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionResultSet +// { +// TransactionResultPair results<>; +// }; - // struct TransactionResultSet - // { - // TransactionResultPair results<>; - // }; +// =========================================================================== +public class TransactionResultSet +{ + public TransactionResultPair[] Results { get; set; } - // =========================================================================== - public class TransactionResultSet + public static void Encode(XdrDataOutputStream stream, TransactionResultSet encodedTransactionResultSet) { - public TransactionResultSet() { } - public TransactionResultPair[] Results { get; set; } + var resultssize = encodedTransactionResultSet.Results.Length; + stream.WriteInt(resultssize); + for (var i = 0; i < resultssize; i++) + TransactionResultPair.Encode(stream, encodedTransactionResultSet.Results[i]); + } - public static void Encode(XdrDataOutputStream stream, TransactionResultSet encodedTransactionResultSet) - { - int resultssize = encodedTransactionResultSet.Results.Length; - stream.WriteInt(resultssize); - for (int i = 0; i < resultssize; i++) - { - TransactionResultPair.Encode(stream, encodedTransactionResultSet.Results[i]); - } - } - public static TransactionResultSet Decode(XdrDataInputStream stream) - { - TransactionResultSet decodedTransactionResultSet = new TransactionResultSet(); - int resultssize = stream.ReadInt(); - decodedTransactionResultSet.Results = new TransactionResultPair[resultssize]; - for (int i = 0; i < resultssize; i++) - { - decodedTransactionResultSet.Results[i] = TransactionResultPair.Decode(stream); - } - return decodedTransactionResultSet; - } + public static TransactionResultSet Decode(XdrDataInputStream stream) + { + var decodedTransactionResultSet = new TransactionResultSet(); + var resultssize = stream.ReadInt(); + decodedTransactionResultSet.Results = new TransactionResultPair[resultssize]; + for (var i = 0; i < resultssize; i++) + decodedTransactionResultSet.Results[i] = TransactionResultPair.Decode(stream); + return decodedTransactionResultSet; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionSet.cs b/stellar-dotnet-sdk-xdr/generated/TransactionSet.cs index 82ebb300..745e8680 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionSet.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionSet.cs @@ -1,46 +1,37 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionSet +// { +// Hash previousLedgerHash; +// TransactionEnvelope txs<>; +// }; - // struct TransactionSet - // { - // Hash previousLedgerHash; - // TransactionEnvelope txs<>; - // }; +// =========================================================================== +public class TransactionSet +{ + public Hash PreviousLedgerHash { get; set; } + public TransactionEnvelope[] Txs { get; set; } - // =========================================================================== - public class TransactionSet + public static void Encode(XdrDataOutputStream stream, TransactionSet encodedTransactionSet) { - public TransactionSet() { } - public Hash PreviousLedgerHash { get; set; } - public TransactionEnvelope[] Txs { get; set; } + Hash.Encode(stream, encodedTransactionSet.PreviousLedgerHash); + var txssize = encodedTransactionSet.Txs.Length; + stream.WriteInt(txssize); + for (var i = 0; i < txssize; i++) TransactionEnvelope.Encode(stream, encodedTransactionSet.Txs[i]); + } - public static void Encode(XdrDataOutputStream stream, TransactionSet encodedTransactionSet) - { - Hash.Encode(stream, encodedTransactionSet.PreviousLedgerHash); - int txssize = encodedTransactionSet.Txs.Length; - stream.WriteInt(txssize); - for (int i = 0; i < txssize; i++) - { - TransactionEnvelope.Encode(stream, encodedTransactionSet.Txs[i]); - } - } - public static TransactionSet Decode(XdrDataInputStream stream) - { - TransactionSet decodedTransactionSet = new TransactionSet(); - decodedTransactionSet.PreviousLedgerHash = Hash.Decode(stream); - int txssize = stream.ReadInt(); - decodedTransactionSet.Txs = new TransactionEnvelope[txssize]; - for (int i = 0; i < txssize; i++) - { - decodedTransactionSet.Txs[i] = TransactionEnvelope.Decode(stream); - } - return decodedTransactionSet; - } + public static TransactionSet Decode(XdrDataInputStream stream) + { + var decodedTransactionSet = new TransactionSet(); + decodedTransactionSet.PreviousLedgerHash = Hash.Decode(stream); + var txssize = stream.ReadInt(); + decodedTransactionSet.Txs = new TransactionEnvelope[txssize]; + for (var i = 0; i < txssize; i++) decodedTransactionSet.Txs[i] = TransactionEnvelope.Decode(stream); + return decodedTransactionSet; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionSetV1.cs b/stellar-dotnet-sdk-xdr/generated/TransactionSetV1.cs new file mode 100644 index 00000000..4109ad70 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TransactionSetV1.cs @@ -0,0 +1,37 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct TransactionSetV1 +// { +// Hash previousLedgerHash; +// TransactionPhase phases<>; +// }; + +// =========================================================================== +public class TransactionSetV1 +{ + public Hash PreviousLedgerHash { get; set; } + public TransactionPhase[] Phases { get; set; } + + public static void Encode(XdrDataOutputStream stream, TransactionSetV1 encodedTransactionSetV1) + { + Hash.Encode(stream, encodedTransactionSetV1.PreviousLedgerHash); + var phasessize = encodedTransactionSetV1.Phases.Length; + stream.WriteInt(phasessize); + for (var i = 0; i < phasessize; i++) TransactionPhase.Encode(stream, encodedTransactionSetV1.Phases[i]); + } + + public static TransactionSetV1 Decode(XdrDataInputStream stream) + { + var decodedTransactionSetV1 = new TransactionSetV1(); + decodedTransactionSetV1.PreviousLedgerHash = Hash.Decode(stream); + var phasessize = stream.ReadInt(); + decodedTransactionSetV1.Phases = new TransactionPhase[phasessize]; + for (var i = 0; i < phasessize; i++) decodedTransactionSetV1.Phases[i] = TransactionPhase.Decode(stream); + return decodedTransactionSetV1; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionSignaturePayload.cs b/stellar-dotnet-sdk-xdr/generated/TransactionSignaturePayload.cs index 2126e684..9dc052eb 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionSignaturePayload.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionSignaturePayload.cs @@ -1,84 +1,86 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionSignaturePayload +// { +// Hash networkId; +// union switch (EnvelopeType type) +// { +// // Backwards Compatibility: Use ENVELOPE_TYPE_TX to sign ENVELOPE_TYPE_TX_V0 +// case ENVELOPE_TYPE_TX: +// Transaction tx; +// case ENVELOPE_TYPE_TX_FEE_BUMP: +// FeeBumpTransaction feeBump; +// } +// taggedTransaction; +// }; - // struct TransactionSignaturePayload - // { - // Hash networkId; - // union switch (EnvelopeType type) - // { - // // Backwards Compatibility: Use ENVELOPE_TYPE_TX to sign ENVELOPE_TYPE_TX_V0 - // case ENVELOPE_TYPE_TX: - // Transaction tx; - // case ENVELOPE_TYPE_TX_FEE_BUMP: - // FeeBumpTransaction feeBump; - // } - // taggedTransaction; - // }; +// =========================================================================== +public class TransactionSignaturePayload +{ + public Hash NetworkId { get; set; } + public TransactionSignaturePayloadTaggedTransaction TaggedTransaction { get; set; } - // =========================================================================== - public class TransactionSignaturePayload + public static void Encode(XdrDataOutputStream stream, + TransactionSignaturePayload encodedTransactionSignaturePayload) { - public TransactionSignaturePayload() { } - public Hash NetworkId { get; set; } - public TransactionSignaturePayloadTaggedTransaction TaggedTransaction { get; set; } + Hash.Encode(stream, encodedTransactionSignaturePayload.NetworkId); + TransactionSignaturePayloadTaggedTransaction.Encode(stream, + encodedTransactionSignaturePayload.TaggedTransaction); + } - public static void Encode(XdrDataOutputStream stream, TransactionSignaturePayload encodedTransactionSignaturePayload) - { - Hash.Encode(stream, encodedTransactionSignaturePayload.NetworkId); - TransactionSignaturePayloadTaggedTransaction.Encode(stream, encodedTransactionSignaturePayload.TaggedTransaction); - } - public static TransactionSignaturePayload Decode(XdrDataInputStream stream) - { - TransactionSignaturePayload decodedTransactionSignaturePayload = new TransactionSignaturePayload(); - decodedTransactionSignaturePayload.NetworkId = Hash.Decode(stream); - decodedTransactionSignaturePayload.TaggedTransaction = TransactionSignaturePayloadTaggedTransaction.Decode(stream); - return decodedTransactionSignaturePayload; - } + public static TransactionSignaturePayload Decode(XdrDataInputStream stream) + { + var decodedTransactionSignaturePayload = new TransactionSignaturePayload(); + decodedTransactionSignaturePayload.NetworkId = Hash.Decode(stream); + decodedTransactionSignaturePayload.TaggedTransaction = + TransactionSignaturePayloadTaggedTransaction.Decode(stream); + return decodedTransactionSignaturePayload; + } - public class TransactionSignaturePayloadTaggedTransaction - { - public TransactionSignaturePayloadTaggedTransaction() { } + public class TransactionSignaturePayloadTaggedTransaction + { + public EnvelopeType Discriminant { get; set; } = new(); - public EnvelopeType Discriminant { get; set; } = new EnvelopeType(); + public Transaction Tx { get; set; } + public FeeBumpTransaction FeeBump { get; set; } - public Transaction Tx { get; set; } - public FeeBumpTransaction FeeBump { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionSignaturePayloadTaggedTransaction encodedTransactionSignaturePayloadTaggedTransaction) + public static void Encode(XdrDataOutputStream stream, + TransactionSignaturePayloadTaggedTransaction encodedTransactionSignaturePayloadTaggedTransaction) + { + stream.WriteInt((int)encodedTransactionSignaturePayloadTaggedTransaction.Discriminant.InnerValue); + switch (encodedTransactionSignaturePayloadTaggedTransaction.Discriminant.InnerValue) { - stream.WriteInt((int)encodedTransactionSignaturePayloadTaggedTransaction.Discriminant.InnerValue); - switch (encodedTransactionSignaturePayloadTaggedTransaction.Discriminant.InnerValue) - { - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: - Transaction.Encode(stream, encodedTransactionSignaturePayloadTaggedTransaction.Tx); - break; - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP: - FeeBumpTransaction.Encode(stream, encodedTransactionSignaturePayloadTaggedTransaction.FeeBump); - break; - } + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: + Transaction.Encode(stream, encodedTransactionSignaturePayloadTaggedTransaction.Tx); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP: + FeeBumpTransaction.Encode(stream, encodedTransactionSignaturePayloadTaggedTransaction.FeeBump); + break; } - public static TransactionSignaturePayloadTaggedTransaction Decode(XdrDataInputStream stream) + } + + public static TransactionSignaturePayloadTaggedTransaction Decode(XdrDataInputStream stream) + { + var decodedTransactionSignaturePayloadTaggedTransaction = + new TransactionSignaturePayloadTaggedTransaction(); + var discriminant = EnvelopeType.Decode(stream); + decodedTransactionSignaturePayloadTaggedTransaction.Discriminant = discriminant; + switch (decodedTransactionSignaturePayloadTaggedTransaction.Discriminant.InnerValue) { - TransactionSignaturePayloadTaggedTransaction decodedTransactionSignaturePayloadTaggedTransaction = new TransactionSignaturePayloadTaggedTransaction(); - EnvelopeType discriminant = EnvelopeType.Decode(stream); - decodedTransactionSignaturePayloadTaggedTransaction.Discriminant = discriminant; - switch (decodedTransactionSignaturePayloadTaggedTransaction.Discriminant.InnerValue) - { - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: - decodedTransactionSignaturePayloadTaggedTransaction.Tx = Transaction.Decode(stream); - break; - case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP: - decodedTransactionSignaturePayloadTaggedTransaction.FeeBump = FeeBumpTransaction.Decode(stream); - break; - } - return decodedTransactionSignaturePayloadTaggedTransaction; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX: + decodedTransactionSignaturePayloadTaggedTransaction.Tx = Transaction.Decode(stream); + break; + case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP: + decodedTransactionSignaturePayloadTaggedTransaction.FeeBump = FeeBumpTransaction.Decode(stream); + break; } + return decodedTransactionSignaturePayloadTaggedTransaction; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionV0.cs b/stellar-dotnet-sdk-xdr/generated/TransactionV0.cs index 91596c85..e64f9a8f 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionV0.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionV0.cs @@ -1,113 +1,101 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // struct TransactionV0 - // { - // uint256 sourceAccountEd25519; - // uint32 fee; - // SequenceNumber seqNum; - // TimeBounds* timeBounds; - // Memo memo; - // Operation operations; - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; +// struct TransactionV0 +// { +// uint256 sourceAccountEd25519; +// uint32 fee; +// SequenceNumber seqNum; +// TimeBounds* timeBounds; +// Memo memo; +// Operation operations; +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; - // =========================================================================== - public class TransactionV0 - { - public TransactionV0() { } - public Uint256 SourceAccountEd25519 { get; set; } - public Uint32 Fee { get; set; } - public SequenceNumber SeqNum { get; set; } - public TimeBounds TimeBounds { get; set; } - public Memo Memo { get; set; } - public Operation[] Operations { get; set; } - public TransactionV0Ext Ext { get; set; } +// =========================================================================== +public class TransactionV0 +{ + public Uint256 SourceAccountEd25519 { get; set; } + public Uint32 Fee { get; set; } + public SequenceNumber SeqNum { get; set; } + public TimeBounds TimeBounds { get; set; } + public Memo Memo { get; set; } + public Operation[] Operations { get; set; } + public TransactionV0Ext Ext { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionV0 encodedTransactionV0) + public static void Encode(XdrDataOutputStream stream, TransactionV0 encodedTransactionV0) + { + Uint256.Encode(stream, encodedTransactionV0.SourceAccountEd25519); + Uint32.Encode(stream, encodedTransactionV0.Fee); + SequenceNumber.Encode(stream, encodedTransactionV0.SeqNum); + if (encodedTransactionV0.TimeBounds != null) { - Uint256.Encode(stream, encodedTransactionV0.SourceAccountEd25519); - Uint32.Encode(stream, encodedTransactionV0.Fee); - SequenceNumber.Encode(stream, encodedTransactionV0.SeqNum); - if (encodedTransactionV0.TimeBounds != null) - { - stream.WriteInt(1); - TimeBounds.Encode(stream, encodedTransactionV0.TimeBounds); - } - else - { - stream.WriteInt(0); - } - Memo.Encode(stream, encodedTransactionV0.Memo); - int operationssize = encodedTransactionV0.Operations.Length; - stream.WriteInt(operationssize); - for (int i = 0; i < operationssize; i++) - { - Operation.Encode(stream, encodedTransactionV0.Operations[i]); - } - TransactionV0Ext.Encode(stream, encodedTransactionV0.Ext); + stream.WriteInt(1); + TimeBounds.Encode(stream, encodedTransactionV0.TimeBounds); } - public static TransactionV0 Decode(XdrDataInputStream stream) + else { - TransactionV0 decodedTransactionV0 = new TransactionV0(); - decodedTransactionV0.SourceAccountEd25519 = Uint256.Decode(stream); - decodedTransactionV0.Fee = Uint32.Decode(stream); - decodedTransactionV0.SeqNum = SequenceNumber.Decode(stream); - int TimeBoundsPresent = stream.ReadInt(); - if (TimeBoundsPresent != 0) - { - decodedTransactionV0.TimeBounds = TimeBounds.Decode(stream); - } - decodedTransactionV0.Memo = Memo.Decode(stream); - int operationssize = stream.ReadInt(); - decodedTransactionV0.Operations = new Operation[operationssize]; - for (int i = 0; i < operationssize; i++) - { - decodedTransactionV0.Operations[i] = Operation.Decode(stream); - } - decodedTransactionV0.Ext = TransactionV0Ext.Decode(stream); - return decodedTransactionV0; + stream.WriteInt(0); } - public class TransactionV0Ext - { - public TransactionV0Ext() { } + Memo.Encode(stream, encodedTransactionV0.Memo); + var operationssize = encodedTransactionV0.Operations.Length; + stream.WriteInt(operationssize); + for (var i = 0; i < operationssize; i++) Operation.Encode(stream, encodedTransactionV0.Operations[i]); + TransactionV0Ext.Encode(stream, encodedTransactionV0.Ext); + } + + public static TransactionV0 Decode(XdrDataInputStream stream) + { + var decodedTransactionV0 = new TransactionV0(); + decodedTransactionV0.SourceAccountEd25519 = Uint256.Decode(stream); + decodedTransactionV0.Fee = Uint32.Decode(stream); + decodedTransactionV0.SeqNum = SequenceNumber.Decode(stream); + var TimeBoundsPresent = stream.ReadInt(); + if (TimeBoundsPresent != 0) decodedTransactionV0.TimeBounds = TimeBounds.Decode(stream); + decodedTransactionV0.Memo = Memo.Decode(stream); + var operationssize = stream.ReadInt(); + decodedTransactionV0.Operations = new Operation[operationssize]; + for (var i = 0; i < operationssize; i++) decodedTransactionV0.Operations[i] = Operation.Decode(stream); + decodedTransactionV0.Ext = TransactionV0Ext.Decode(stream); + return decodedTransactionV0; + } - public int Discriminant { get; set; } = new int(); + public class TransactionV0Ext + { + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, TransactionV0Ext encodedTransactionV0Ext) + public static void Encode(XdrDataOutputStream stream, TransactionV0Ext encodedTransactionV0Ext) + { + stream.WriteInt(encodedTransactionV0Ext.Discriminant); + switch (encodedTransactionV0Ext.Discriminant) { - stream.WriteInt((int)encodedTransactionV0Ext.Discriminant); - switch (encodedTransactionV0Ext.Discriminant) - { - case 0: - break; - } + case 0: + break; } - public static TransactionV0Ext Decode(XdrDataInputStream stream) + } + + public static TransactionV0Ext Decode(XdrDataInputStream stream) + { + var decodedTransactionV0Ext = new TransactionV0Ext(); + var discriminant = stream.ReadInt(); + decodedTransactionV0Ext.Discriminant = discriminant; + switch (decodedTransactionV0Ext.Discriminant) { - TransactionV0Ext decodedTransactionV0Ext = new TransactionV0Ext(); - int discriminant = stream.ReadInt(); - decodedTransactionV0Ext.Discriminant = discriminant; - switch (decodedTransactionV0Ext.Discriminant) - { - case 0: - break; - } - return decodedTransactionV0Ext; + case 0: + break; } + return decodedTransactionV0Ext; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionV0Envelope.cs b/stellar-dotnet-sdk-xdr/generated/TransactionV0Envelope.cs index 007a2e26..c73b8230 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionV0Envelope.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionV0Envelope.cs @@ -1,48 +1,41 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionV0Envelope +// { +// TransactionV0 tx; +// /* Each decorated signature is a signature over the SHA256 hash of +// * a TransactionSignaturePayload */ +// DecoratedSignature signatures<20>; +// }; - // struct TransactionV0Envelope - // { - // TransactionV0 tx; - // /* Each decorated signature is a signature over the SHA256 hash of - // * a TransactionSignaturePayload */ - // DecoratedSignature signatures<20>; - // }; +// =========================================================================== +public class TransactionV0Envelope +{ + public TransactionV0 Tx { get; set; } + public DecoratedSignature[] Signatures { get; set; } - // =========================================================================== - public class TransactionV0Envelope + public static void Encode(XdrDataOutputStream stream, TransactionV0Envelope encodedTransactionV0Envelope) { - public TransactionV0Envelope() { } - public TransactionV0 Tx { get; set; } - public DecoratedSignature[] Signatures { get; set; } + TransactionV0.Encode(stream, encodedTransactionV0Envelope.Tx); + var signaturessize = encodedTransactionV0Envelope.Signatures.Length; + stream.WriteInt(signaturessize); + for (var i = 0; i < signaturessize; i++) + DecoratedSignature.Encode(stream, encodedTransactionV0Envelope.Signatures[i]); + } - public static void Encode(XdrDataOutputStream stream, TransactionV0Envelope encodedTransactionV0Envelope) - { - TransactionV0.Encode(stream, encodedTransactionV0Envelope.Tx); - int signaturessize = encodedTransactionV0Envelope.Signatures.Length; - stream.WriteInt(signaturessize); - for (int i = 0; i < signaturessize; i++) - { - DecoratedSignature.Encode(stream, encodedTransactionV0Envelope.Signatures[i]); - } - } - public static TransactionV0Envelope Decode(XdrDataInputStream stream) - { - TransactionV0Envelope decodedTransactionV0Envelope = new TransactionV0Envelope(); - decodedTransactionV0Envelope.Tx = TransactionV0.Decode(stream); - int signaturessize = stream.ReadInt(); - decodedTransactionV0Envelope.Signatures = new DecoratedSignature[signaturessize]; - for (int i = 0; i < signaturessize; i++) - { - decodedTransactionV0Envelope.Signatures[i] = DecoratedSignature.Decode(stream); - } - return decodedTransactionV0Envelope; - } + public static TransactionV0Envelope Decode(XdrDataInputStream stream) + { + var decodedTransactionV0Envelope = new TransactionV0Envelope(); + decodedTransactionV0Envelope.Tx = TransactionV0.Decode(stream); + var signaturessize = stream.ReadInt(); + decodedTransactionV0Envelope.Signatures = new DecoratedSignature[signaturessize]; + for (var i = 0; i < signaturessize; i++) + decodedTransactionV0Envelope.Signatures[i] = DecoratedSignature.Decode(stream); + return decodedTransactionV0Envelope; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TransactionV1Envelope.cs b/stellar-dotnet-sdk-xdr/generated/TransactionV1Envelope.cs index 895d115b..fe0af36b 100644 --- a/stellar-dotnet-sdk-xdr/generated/TransactionV1Envelope.cs +++ b/stellar-dotnet-sdk-xdr/generated/TransactionV1Envelope.cs @@ -1,48 +1,41 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct TransactionV1Envelope +// { +// Transaction tx; +// /* Each decorated signature is a signature over the SHA256 hash of +// * a TransactionSignaturePayload */ +// DecoratedSignature signatures<20>; +// }; - // struct TransactionV1Envelope - // { - // Transaction tx; - // /* Each decorated signature is a signature over the SHA256 hash of - // * a TransactionSignaturePayload */ - // DecoratedSignature signatures<20>; - // }; +// =========================================================================== +public class TransactionV1Envelope +{ + public Transaction Tx { get; set; } + public DecoratedSignature[] Signatures { get; set; } - // =========================================================================== - public class TransactionV1Envelope + public static void Encode(XdrDataOutputStream stream, TransactionV1Envelope encodedTransactionV1Envelope) { - public TransactionV1Envelope() { } - public Transaction Tx { get; set; } - public DecoratedSignature[] Signatures { get; set; } + Transaction.Encode(stream, encodedTransactionV1Envelope.Tx); + var signaturessize = encodedTransactionV1Envelope.Signatures.Length; + stream.WriteInt(signaturessize); + for (var i = 0; i < signaturessize; i++) + DecoratedSignature.Encode(stream, encodedTransactionV1Envelope.Signatures[i]); + } - public static void Encode(XdrDataOutputStream stream, TransactionV1Envelope encodedTransactionV1Envelope) - { - Transaction.Encode(stream, encodedTransactionV1Envelope.Tx); - int signaturessize = encodedTransactionV1Envelope.Signatures.Length; - stream.WriteInt(signaturessize); - for (int i = 0; i < signaturessize; i++) - { - DecoratedSignature.Encode(stream, encodedTransactionV1Envelope.Signatures[i]); - } - } - public static TransactionV1Envelope Decode(XdrDataInputStream stream) - { - TransactionV1Envelope decodedTransactionV1Envelope = new TransactionV1Envelope(); - decodedTransactionV1Envelope.Tx = Transaction.Decode(stream); - int signaturessize = stream.ReadInt(); - decodedTransactionV1Envelope.Signatures = new DecoratedSignature[signaturessize]; - for (int i = 0; i < signaturessize; i++) - { - decodedTransactionV1Envelope.Signatures[i] = DecoratedSignature.Decode(stream); - } - return decodedTransactionV1Envelope; - } + public static TransactionV1Envelope Decode(XdrDataInputStream stream) + { + var decodedTransactionV1Envelope = new TransactionV1Envelope(); + decodedTransactionV1Envelope.Tx = Transaction.Decode(stream); + var signaturessize = stream.ReadInt(); + decodedTransactionV1Envelope.Signatures = new DecoratedSignature[signaturessize]; + for (var i = 0; i < signaturessize; i++) + decodedTransactionV1Envelope.Signatures[i] = DecoratedSignature.Decode(stream); + return decodedTransactionV1Envelope; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TrustLineAsset.cs b/stellar-dotnet-sdk-xdr/generated/TrustLineAsset.cs index f8ad0320..5fac1bea 100644 --- a/stellar-dotnet-sdk-xdr/generated/TrustLineAsset.cs +++ b/stellar-dotnet-sdk-xdr/generated/TrustLineAsset.cs @@ -1,77 +1,75 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; - // === xdr source ============================================================ +// === xdr source ============================================================ - // union TrustLineAsset switch (AssetType type) - // { - // 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 - // }; +// union TrustLineAsset switch (AssetType type) +// { +// 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 +// }; - // =========================================================================== - public class TrustLineAsset - { - public TrustLineAsset() { } +// =========================================================================== +public class TrustLineAsset +{ + public AssetType Discriminant { get; set; } = new(); - public AssetType Discriminant { get; set; } = new AssetType(); + public AlphaNum4 AlphaNum4 { get; set; } + public AlphaNum12 AlphaNum12 { get; set; } + public PoolID LiquidityPoolID { get; set; } - public AlphaNum4 AlphaNum4 { get; set; } - public AlphaNum12 AlphaNum12 { get; set; } - public PoolID LiquidityPoolID { get; set; } - public static void Encode(XdrDataOutputStream stream, TrustLineAsset encodedTrustLineAsset) + public static void Encode(XdrDataOutputStream stream, TrustLineAsset encodedTrustLineAsset) + { + stream.WriteInt((int)encodedTrustLineAsset.Discriminant.InnerValue); + switch (encodedTrustLineAsset.Discriminant.InnerValue) { - stream.WriteInt((int)encodedTrustLineAsset.Discriminant.InnerValue); - switch (encodedTrustLineAsset.Discriminant.InnerValue) - { - case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: - AlphaNum4.Encode(stream, encodedTrustLineAsset.AlphaNum4); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: - AlphaNum12.Encode(stream, encodedTrustLineAsset.AlphaNum12); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_POOL_SHARE: - PoolID.Encode(stream, encodedTrustLineAsset.LiquidityPoolID); - break; - } + case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: + AlphaNum4.Encode(stream, encodedTrustLineAsset.AlphaNum4); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: + AlphaNum12.Encode(stream, encodedTrustLineAsset.AlphaNum12); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_POOL_SHARE: + PoolID.Encode(stream, encodedTrustLineAsset.LiquidityPoolID); + break; } - public static TrustLineAsset Decode(XdrDataInputStream stream) + } + + public static TrustLineAsset Decode(XdrDataInputStream stream) + { + var decodedTrustLineAsset = new TrustLineAsset(); + var discriminant = AssetType.Decode(stream); + decodedTrustLineAsset.Discriminant = discriminant; + switch (decodedTrustLineAsset.Discriminant.InnerValue) { - TrustLineAsset decodedTrustLineAsset = new TrustLineAsset(); - AssetType discriminant = AssetType.Decode(stream); - decodedTrustLineAsset.Discriminant = discriminant; - switch (decodedTrustLineAsset.Discriminant.InnerValue) - { - case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: - decodedTrustLineAsset.AlphaNum4 = AlphaNum4.Decode(stream); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: - decodedTrustLineAsset.AlphaNum12 = AlphaNum12.Decode(stream); - break; - case AssetType.AssetTypeEnum.ASSET_TYPE_POOL_SHARE: - decodedTrustLineAsset.LiquidityPoolID = PoolID.Decode(stream); - break; - } - return decodedTrustLineAsset; + case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE: + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4: + decodedTrustLineAsset.AlphaNum4 = AlphaNum4.Decode(stream); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12: + decodedTrustLineAsset.AlphaNum12 = AlphaNum12.Decode(stream); + break; + case AssetType.AssetTypeEnum.ASSET_TYPE_POOL_SHARE: + decodedTrustLineAsset.LiquidityPoolID = PoolID.Decode(stream); + break; } + + return decodedTrustLineAsset; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TrustLineEntry.cs b/stellar-dotnet-sdk-xdr/generated/TrustLineEntry.cs index 2103576a..ad0bb825 100644 --- a/stellar-dotnet-sdk-xdr/generated/TrustLineEntry.cs +++ b/stellar-dotnet-sdk-xdr/generated/TrustLineEntry.cs @@ -1,168 +1,166 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct TrustLineEntry +// { +// AccountID accountID; // account this trustline belongs to +// 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) +// { +// case 0: +// void; +// case 1: +// struct +// { +// Liabilities liabilities; +// +// union switch (int v) +// { +// case 0: +// void; +// case 2: +// TrustLineEntryExtensionV2 v2; +// } +// ext; +// } v1; +// } +// ext; +// }; + +// =========================================================================== +public class TrustLineEntry { + public AccountID AccountID { get; set; } + public TrustLineAsset Asset { get; set; } + public Int64 Balance { get; set; } + public Int64 Limit { get; set; } + public Uint32 Flags { get; set; } + public TrustLineEntryExt Ext { get; set; } + + public static void Encode(XdrDataOutputStream stream, TrustLineEntry encodedTrustLineEntry) + { + AccountID.Encode(stream, encodedTrustLineEntry.AccountID); + TrustLineAsset.Encode(stream, encodedTrustLineEntry.Asset); + Int64.Encode(stream, encodedTrustLineEntry.Balance); + Int64.Encode(stream, encodedTrustLineEntry.Limit); + Uint32.Encode(stream, encodedTrustLineEntry.Flags); + TrustLineEntryExt.Encode(stream, encodedTrustLineEntry.Ext); + } + + public static TrustLineEntry Decode(XdrDataInputStream stream) + { + var decodedTrustLineEntry = new TrustLineEntry(); + decodedTrustLineEntry.AccountID = AccountID.Decode(stream); + decodedTrustLineEntry.Asset = TrustLineAsset.Decode(stream); + decodedTrustLineEntry.Balance = Int64.Decode(stream); + decodedTrustLineEntry.Limit = Int64.Decode(stream); + decodedTrustLineEntry.Flags = Uint32.Decode(stream); + decodedTrustLineEntry.Ext = TrustLineEntryExt.Decode(stream); + return decodedTrustLineEntry; + } - // === xdr source ============================================================ - - // struct TrustLineEntry - // { - // AccountID accountID; // account this trustline belongs to - // 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) - // { - // case 0: - // void; - // case 1: - // struct - // { - // Liabilities liabilities; - // - // union switch (int v) - // { - // case 0: - // void; - // case 2: - // TrustLineEntryExtensionV2 v2; - // } - // ext; - // } v1; - // } - // ext; - // }; - - // =========================================================================== - public class TrustLineEntry + public class TrustLineEntryExt { - public TrustLineEntry() { } - public AccountID AccountID { get; set; } - public TrustLineAsset Asset { get; set; } - public Int64 Balance { get; set; } - public Int64 Limit { get; set; } - public Uint32 Flags { get; set; } - public TrustLineEntryExt Ext { get; set; } - - public static void Encode(XdrDataOutputStream stream, TrustLineEntry encodedTrustLineEntry) + public int Discriminant { get; set; } + + public TrustLineEntryV1 V1 { get; set; } + + public static void Encode(XdrDataOutputStream stream, TrustLineEntryExt encodedTrustLineEntryExt) { - AccountID.Encode(stream, encodedTrustLineEntry.AccountID); - TrustLineAsset.Encode(stream, encodedTrustLineEntry.Asset); - Int64.Encode(stream, encodedTrustLineEntry.Balance); - Int64.Encode(stream, encodedTrustLineEntry.Limit); - Uint32.Encode(stream, encodedTrustLineEntry.Flags); - TrustLineEntryExt.Encode(stream, encodedTrustLineEntry.Ext); + stream.WriteInt(encodedTrustLineEntryExt.Discriminant); + switch (encodedTrustLineEntryExt.Discriminant) + { + case 0: + break; + case 1: + TrustLineEntryV1.Encode(stream, encodedTrustLineEntryExt.V1); + break; + } } - public static TrustLineEntry Decode(XdrDataInputStream stream) + + public static TrustLineEntryExt Decode(XdrDataInputStream stream) { - TrustLineEntry decodedTrustLineEntry = new TrustLineEntry(); - decodedTrustLineEntry.AccountID = AccountID.Decode(stream); - decodedTrustLineEntry.Asset = TrustLineAsset.Decode(stream); - decodedTrustLineEntry.Balance = Int64.Decode(stream); - decodedTrustLineEntry.Limit = Int64.Decode(stream); - decodedTrustLineEntry.Flags = Uint32.Decode(stream); - decodedTrustLineEntry.Ext = TrustLineEntryExt.Decode(stream); - return decodedTrustLineEntry; + var decodedTrustLineEntryExt = new TrustLineEntryExt(); + var discriminant = stream.ReadInt(); + decodedTrustLineEntryExt.Discriminant = discriminant; + switch (decodedTrustLineEntryExt.Discriminant) + { + case 0: + break; + case 1: + decodedTrustLineEntryExt.V1 = TrustLineEntryV1.Decode(stream); + break; + } + + return decodedTrustLineEntryExt; } - public class TrustLineEntryExt + public class TrustLineEntryV1 { - public TrustLineEntryExt() { } - - public int Discriminant { get; set; } = new int(); + public Liabilities Liabilities { get; set; } + public TrustLineEntryV1Ext Ext { get; set; } - public TrustLineEntryV1 V1 { get; set; } - public static void Encode(XdrDataOutputStream stream, TrustLineEntryExt encodedTrustLineEntryExt) + public static void Encode(XdrDataOutputStream stream, TrustLineEntryV1 encodedTrustLineEntryV1) { - stream.WriteInt((int)encodedTrustLineEntryExt.Discriminant); - switch (encodedTrustLineEntryExt.Discriminant) - { - case 0: - break; - case 1: - TrustLineEntryV1.Encode(stream, encodedTrustLineEntryExt.V1); - break; - } + Liabilities.Encode(stream, encodedTrustLineEntryV1.Liabilities); + TrustLineEntryV1Ext.Encode(stream, encodedTrustLineEntryV1.Ext); } - public static TrustLineEntryExt Decode(XdrDataInputStream stream) + + public static TrustLineEntryV1 Decode(XdrDataInputStream stream) { - TrustLineEntryExt decodedTrustLineEntryExt = new TrustLineEntryExt(); - int discriminant = stream.ReadInt(); - decodedTrustLineEntryExt.Discriminant = discriminant; - switch (decodedTrustLineEntryExt.Discriminant) - { - case 0: - break; - case 1: - decodedTrustLineEntryExt.V1 = TrustLineEntryV1.Decode(stream); - break; - } - return decodedTrustLineEntryExt; + var decodedTrustLineEntryV1 = new TrustLineEntryV1(); + decodedTrustLineEntryV1.Liabilities = Liabilities.Decode(stream); + decodedTrustLineEntryV1.Ext = TrustLineEntryV1Ext.Decode(stream); + return decodedTrustLineEntryV1; } - public class TrustLineEntryV1 + public class TrustLineEntryV1Ext { - public TrustLineEntryV1() { } - public Liabilities Liabilities { get; set; } - public TrustLineEntryV1Ext Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, TrustLineEntryV1 encodedTrustLineEntryV1) - { - Liabilities.Encode(stream, encodedTrustLineEntryV1.Liabilities); - TrustLineEntryV1Ext.Encode(stream, encodedTrustLineEntryV1.Ext); - } - public static TrustLineEntryV1 Decode(XdrDataInputStream stream) - { - TrustLineEntryV1 decodedTrustLineEntryV1 = new TrustLineEntryV1(); - decodedTrustLineEntryV1.Liabilities = Liabilities.Decode(stream); - decodedTrustLineEntryV1.Ext = TrustLineEntryV1Ext.Decode(stream); - return decodedTrustLineEntryV1; - } + public TrustLineEntryExtensionV2 V2 { get; set; } - public class TrustLineEntryV1Ext + public static void Encode(XdrDataOutputStream stream, TrustLineEntryV1Ext encodedTrustLineEntryV1Ext) { - public TrustLineEntryV1Ext() { } - - public int Discriminant { get; set; } = new int(); - - public TrustLineEntryExtensionV2 V2 { get; set; } - public static void Encode(XdrDataOutputStream stream, TrustLineEntryV1Ext encodedTrustLineEntryV1Ext) + stream.WriteInt(encodedTrustLineEntryV1Ext.Discriminant); + switch (encodedTrustLineEntryV1Ext.Discriminant) { - stream.WriteInt((int)encodedTrustLineEntryV1Ext.Discriminant); - switch (encodedTrustLineEntryV1Ext.Discriminant) - { - case 0: - break; - case 2: - TrustLineEntryExtensionV2.Encode(stream, encodedTrustLineEntryV1Ext.V2); - break; - } + case 0: + break; + case 2: + TrustLineEntryExtensionV2.Encode(stream, encodedTrustLineEntryV1Ext.V2); + break; } - public static TrustLineEntryV1Ext Decode(XdrDataInputStream stream) + } + + public static TrustLineEntryV1Ext Decode(XdrDataInputStream stream) + { + var decodedTrustLineEntryV1Ext = new TrustLineEntryV1Ext(); + var discriminant = stream.ReadInt(); + decodedTrustLineEntryV1Ext.Discriminant = discriminant; + switch (decodedTrustLineEntryV1Ext.Discriminant) { - TrustLineEntryV1Ext decodedTrustLineEntryV1Ext = new TrustLineEntryV1Ext(); - int discriminant = stream.ReadInt(); - decodedTrustLineEntryV1Ext.Discriminant = discriminant; - switch (decodedTrustLineEntryV1Ext.Discriminant) - { - case 0: - break; - case 2: - decodedTrustLineEntryV1Ext.V2 = TrustLineEntryExtensionV2.Decode(stream); - break; - } - return decodedTrustLineEntryV1Ext; + case 0: + break; + case 2: + decodedTrustLineEntryV1Ext.V2 = TrustLineEntryExtensionV2.Decode(stream); + break; } + return decodedTrustLineEntryV1Ext; } } } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TrustLineEntryExtensionV2.cs b/stellar-dotnet-sdk-xdr/generated/TrustLineEntryExtensionV2.cs index a3bc5de7..243dc952 100644 --- a/stellar-dotnet-sdk-xdr/generated/TrustLineEntryExtensionV2.cs +++ b/stellar-dotnet-sdk-xdr/generated/TrustLineEntryExtensionV2.cs @@ -1,72 +1,69 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct TrustLineEntryExtensionV2 +// { +// int32 liquidityPoolUseCount; +// +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; + +// =========================================================================== +public class TrustLineEntryExtensionV2 { + public Int32 LiquidityPoolUseCount { get; set; } + public TrustLineEntryExtensionV2Ext Ext { get; set; } - // === xdr source ============================================================ + public static void Encode(XdrDataOutputStream stream, TrustLineEntryExtensionV2 encodedTrustLineEntryExtensionV2) + { + Int32.Encode(stream, encodedTrustLineEntryExtensionV2.LiquidityPoolUseCount); + TrustLineEntryExtensionV2Ext.Encode(stream, encodedTrustLineEntryExtensionV2.Ext); + } - // struct TrustLineEntryExtensionV2 - // { - // int32 liquidityPoolUseCount; - // - // union switch (int v) - // { - // case 0: - // void; - // } - // ext; - // }; + public static TrustLineEntryExtensionV2 Decode(XdrDataInputStream stream) + { + var decodedTrustLineEntryExtensionV2 = new TrustLineEntryExtensionV2(); + decodedTrustLineEntryExtensionV2.LiquidityPoolUseCount = Int32.Decode(stream); + decodedTrustLineEntryExtensionV2.Ext = TrustLineEntryExtensionV2Ext.Decode(stream); + return decodedTrustLineEntryExtensionV2; + } - // =========================================================================== - public class TrustLineEntryExtensionV2 + public class TrustLineEntryExtensionV2Ext { - public TrustLineEntryExtensionV2() { } - public Int32 LiquidityPoolUseCount { get; set; } - public TrustLineEntryExtensionV2Ext Ext { get; set; } + public int Discriminant { get; set; } - public static void Encode(XdrDataOutputStream stream, TrustLineEntryExtensionV2 encodedTrustLineEntryExtensionV2) + public static void Encode(XdrDataOutputStream stream, + TrustLineEntryExtensionV2Ext encodedTrustLineEntryExtensionV2Ext) { - Int32.Encode(stream, encodedTrustLineEntryExtensionV2.LiquidityPoolUseCount); - TrustLineEntryExtensionV2Ext.Encode(stream, encodedTrustLineEntryExtensionV2.Ext); - } - public static TrustLineEntryExtensionV2 Decode(XdrDataInputStream stream) - { - TrustLineEntryExtensionV2 decodedTrustLineEntryExtensionV2 = new TrustLineEntryExtensionV2(); - decodedTrustLineEntryExtensionV2.LiquidityPoolUseCount = Int32.Decode(stream); - decodedTrustLineEntryExtensionV2.Ext = TrustLineEntryExtensionV2Ext.Decode(stream); - return decodedTrustLineEntryExtensionV2; + stream.WriteInt(encodedTrustLineEntryExtensionV2Ext.Discriminant); + switch (encodedTrustLineEntryExtensionV2Ext.Discriminant) + { + case 0: + break; + } } - public class TrustLineEntryExtensionV2Ext + public static TrustLineEntryExtensionV2Ext Decode(XdrDataInputStream stream) { - public TrustLineEntryExtensionV2Ext() { } - - public int Discriminant { get; set; } = new int(); - - public static void Encode(XdrDataOutputStream stream, TrustLineEntryExtensionV2Ext encodedTrustLineEntryExtensionV2Ext) - { - stream.WriteInt((int)encodedTrustLineEntryExtensionV2Ext.Discriminant); - switch (encodedTrustLineEntryExtensionV2Ext.Discriminant) - { - case 0: - break; - } - } - public static TrustLineEntryExtensionV2Ext Decode(XdrDataInputStream stream) + var decodedTrustLineEntryExtensionV2Ext = new TrustLineEntryExtensionV2Ext(); + var discriminant = stream.ReadInt(); + decodedTrustLineEntryExtensionV2Ext.Discriminant = discriminant; + switch (decodedTrustLineEntryExtensionV2Ext.Discriminant) { - TrustLineEntryExtensionV2Ext decodedTrustLineEntryExtensionV2Ext = new TrustLineEntryExtensionV2Ext(); - int discriminant = stream.ReadInt(); - decodedTrustLineEntryExtensionV2Ext.Discriminant = discriminant; - switch (decodedTrustLineEntryExtensionV2Ext.Discriminant) - { - case 0: - break; - } - return decodedTrustLineEntryExtensionV2Ext; + case 0: + break; } + return decodedTrustLineEntryExtensionV2Ext; } } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TrustLineFlags.cs b/stellar-dotnet-sdk-xdr/generated/TrustLineFlags.cs index fe734c72..fc6019f1 100644 --- a/stellar-dotnet-sdk-xdr/generated/TrustLineFlags.cs +++ b/stellar-dotnet-sdk-xdr/generated/TrustLineFlags.cs @@ -1,59 +1,59 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten + using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ - - // enum TrustLineFlags - // { - // // issuer has authorized account to perform transactions with its credit - // AUTHORIZED_FLAG = 1, - // // issuer has authorized account to maintain and reduce liabilities for its - // // credit - // AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = 2, - // // issuer has specified that it may clawback its credit, and that claimable - // // balances created with its credit may also be clawed back - // TRUSTLINE_CLAWBACK_ENABLED_FLAG = 4 - // }; - - // =========================================================================== - public class TrustLineFlags +// enum TrustLineFlags +// { +// // issuer has authorized account to perform transactions with its credit +// AUTHORIZED_FLAG = 1, +// // issuer has authorized account to maintain and reduce liabilities for its +// // credit +// AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = 2, +// // issuer has specified that it may clawback its credit, and that claimable +// // balances created with its credit may also be clawed back +// TRUSTLINE_CLAWBACK_ENABLED_FLAG = 4 +// }; + +// =========================================================================== +public class TrustLineFlags +{ + public enum TrustLineFlagsEnum { - public enum TrustLineFlagsEnum - { - AUTHORIZED_FLAG = 1, - AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = 2, - TRUSTLINE_CLAWBACK_ENABLED_FLAG = 4, - } - public TrustLineFlagsEnum InnerValue { get; set; } = default(TrustLineFlagsEnum); + AUTHORIZED_FLAG = 1, + AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = 2, + TRUSTLINE_CLAWBACK_ENABLED_FLAG = 4 + } - public static TrustLineFlags Create(TrustLineFlagsEnum v) - { - return new TrustLineFlags - { - InnerValue = v - }; - } + public TrustLineFlagsEnum InnerValue { get; set; } = default; - public static TrustLineFlags Decode(XdrDataInputStream stream) + public static TrustLineFlags Create(TrustLineFlagsEnum v) + { + return new TrustLineFlags { - int value = stream.ReadInt(); - switch (value) - { - case 1: return Create(TrustLineFlagsEnum.AUTHORIZED_FLAG); - case 2: return Create(TrustLineFlagsEnum.AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG); - case 4: return Create(TrustLineFlagsEnum.TRUSTLINE_CLAWBACK_ENABLED_FLAG); - default: - throw new Exception("Unknown enum value: " + value); - } - } + InnerValue = v + }; + } - public static void Encode(XdrDataOutputStream stream, TrustLineFlags value) + public static TrustLineFlags Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) { - stream.WriteInt((int)value.InnerValue); + case 1: return Create(TrustLineFlagsEnum.AUTHORIZED_FLAG); + case 2: return Create(TrustLineFlagsEnum.AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG); + case 4: return Create(TrustLineFlagsEnum.TRUSTLINE_CLAWBACK_ENABLED_FLAG); + default: + throw new Exception("Unknown enum value: " + value); } } -} + + public static void Encode(XdrDataOutputStream stream, TrustLineFlags value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TxAdvertVector.cs b/stellar-dotnet-sdk-xdr/generated/TxAdvertVector.cs new file mode 100644 index 00000000..d7ec68c5 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TxAdvertVector.cs @@ -0,0 +1,39 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef Hash TxAdvertVector; + +// =========================================================================== +public class TxAdvertVector +{ + public TxAdvertVector() + { + } + + public TxAdvertVector(Hash[] value) + { + InnerValue = value; + } + + public Hash[] InnerValue { get; set; } = default; + + public static void Encode(XdrDataOutputStream stream, TxAdvertVector encodedTxAdvertVector) + { + var TxAdvertVectorsize = encodedTxAdvertVector.InnerValue.Length; + stream.WriteInt(TxAdvertVectorsize); + for (var i = 0; i < TxAdvertVectorsize; i++) Hash.Encode(stream, encodedTxAdvertVector.InnerValue[i]); + } + + public static TxAdvertVector Decode(XdrDataInputStream stream) + { + var decodedTxAdvertVector = new TxAdvertVector(); + var TxAdvertVectorsize = stream.ReadInt(); + decodedTxAdvertVector.InnerValue = new Hash[TxAdvertVectorsize]; + for (var i = 0; i < TxAdvertVectorsize; i++) decodedTxAdvertVector.InnerValue[i] = Hash.Decode(stream); + return decodedTxAdvertVector; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TxDemandVector.cs b/stellar-dotnet-sdk-xdr/generated/TxDemandVector.cs new file mode 100644 index 00000000..9de8eb1a --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TxDemandVector.cs @@ -0,0 +1,39 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef Hash TxDemandVector; + +// =========================================================================== +public class TxDemandVector +{ + public TxDemandVector() + { + } + + public TxDemandVector(Hash[] value) + { + InnerValue = value; + } + + public Hash[] InnerValue { get; set; } = default; + + public static void Encode(XdrDataOutputStream stream, TxDemandVector encodedTxDemandVector) + { + var TxDemandVectorsize = encodedTxDemandVector.InnerValue.Length; + stream.WriteInt(TxDemandVectorsize); + for (var i = 0; i < TxDemandVectorsize; i++) Hash.Encode(stream, encodedTxDemandVector.InnerValue[i]); + } + + public static TxDemandVector Decode(XdrDataInputStream stream) + { + var decodedTxDemandVector = new TxDemandVector(); + var TxDemandVectorsize = stream.ReadInt(); + decodedTxDemandVector.InnerValue = new Hash[TxDemandVectorsize]; + for (var i = 0; i < TxDemandVectorsize; i++) decodedTxDemandVector.InnerValue[i] = Hash.Decode(stream); + return decodedTxDemandVector; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TxSetComponent.cs b/stellar-dotnet-sdk-xdr/generated/TxSetComponent.cs new file mode 100644 index 00000000..febb22be --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TxSetComponent.cs @@ -0,0 +1,87 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// union TxSetComponent switch (TxSetComponentType type) +// { +// case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: +// struct +// { +// int64* baseFee; +// TransactionEnvelope txs<>; +// } txsMaybeDiscountedFee; +// }; + +// =========================================================================== +public class TxSetComponent +{ + public TxSetComponentType Discriminant { get; set; } = new(); + + public TxSetComponentTxsMaybeDiscountedFee TxsMaybeDiscountedFee { get; set; } + + public static void Encode(XdrDataOutputStream stream, TxSetComponent encodedTxSetComponent) + { + stream.WriteInt((int)encodedTxSetComponent.Discriminant.InnerValue); + switch (encodedTxSetComponent.Discriminant.InnerValue) + { + case TxSetComponentType.TxSetComponentTypeEnum.TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: + TxSetComponentTxsMaybeDiscountedFee.Encode(stream, encodedTxSetComponent.TxsMaybeDiscountedFee); + break; + } + } + + public static TxSetComponent Decode(XdrDataInputStream stream) + { + var decodedTxSetComponent = new TxSetComponent(); + var discriminant = TxSetComponentType.Decode(stream); + decodedTxSetComponent.Discriminant = discriminant; + switch (decodedTxSetComponent.Discriminant.InnerValue) + { + case TxSetComponentType.TxSetComponentTypeEnum.TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: + decodedTxSetComponent.TxsMaybeDiscountedFee = TxSetComponentTxsMaybeDiscountedFee.Decode(stream); + break; + } + + return decodedTxSetComponent; + } + + public class TxSetComponentTxsMaybeDiscountedFee + { + public Int64 BaseFee { get; set; } + public TransactionEnvelope[] Txs { get; set; } + + public static void Encode(XdrDataOutputStream stream, + TxSetComponentTxsMaybeDiscountedFee encodedTxSetComponentTxsMaybeDiscountedFee) + { + if (encodedTxSetComponentTxsMaybeDiscountedFee.BaseFee != null) + { + stream.WriteInt(1); + Int64.Encode(stream, encodedTxSetComponentTxsMaybeDiscountedFee.BaseFee); + } + else + { + stream.WriteInt(0); + } + + var txssize = encodedTxSetComponentTxsMaybeDiscountedFee.Txs.Length; + stream.WriteInt(txssize); + for (var i = 0; i < txssize; i++) + TransactionEnvelope.Encode(stream, encodedTxSetComponentTxsMaybeDiscountedFee.Txs[i]); + } + + public static TxSetComponentTxsMaybeDiscountedFee Decode(XdrDataInputStream stream) + { + var decodedTxSetComponentTxsMaybeDiscountedFee = new TxSetComponentTxsMaybeDiscountedFee(); + var BaseFeePresent = stream.ReadInt(); + if (BaseFeePresent != 0) decodedTxSetComponentTxsMaybeDiscountedFee.BaseFee = Int64.Decode(stream); + var txssize = stream.ReadInt(); + decodedTxSetComponentTxsMaybeDiscountedFee.Txs = new TransactionEnvelope[txssize]; + for (var i = 0; i < txssize; i++) + decodedTxSetComponentTxsMaybeDiscountedFee.Txs[i] = TransactionEnvelope.Decode(stream); + return decodedTxSetComponentTxsMaybeDiscountedFee; + } + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/TxSetComponentType.cs b/stellar-dotnet-sdk-xdr/generated/TxSetComponentType.cs new file mode 100644 index 00000000..1058a21b --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/TxSetComponentType.cs @@ -0,0 +1,50 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +using System; + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// enum TxSetComponentType +// { +// // txs with effective fee <= bid derived from a base fee (if any). +// // If base fee is not specified, no discount is applied. +// TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE = 0 +// }; + +// =========================================================================== +public class TxSetComponentType +{ + public enum TxSetComponentTypeEnum + { + TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE = 0 + } + + public TxSetComponentTypeEnum InnerValue { get; set; } = default; + + public static TxSetComponentType Create(TxSetComponentTypeEnum v) + { + return new TxSetComponentType + { + InnerValue = v + }; + } + + public static TxSetComponentType Decode(XdrDataInputStream stream) + { + var value = stream.ReadInt(); + switch (value) + { + case 0: return Create(TxSetComponentTypeEnum.TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE); + default: + throw new Exception("Unknown enum value: " + value); + } + } + + public static void Encode(XdrDataOutputStream stream, TxSetComponentType value) + { + stream.WriteInt((int)value.InnerValue); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/UInt128Parts.cs b/stellar-dotnet-sdk-xdr/generated/UInt128Parts.cs new file mode 100644 index 00000000..85eab004 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/UInt128Parts.cs @@ -0,0 +1,32 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct UInt128Parts { +// uint64 hi; +// uint64 lo; +// }; + +// =========================================================================== +public class UInt128Parts +{ + public Uint64 Hi { get; set; } + public Uint64 Lo { get; set; } + + public static void Encode(XdrDataOutputStream stream, UInt128Parts encodedUInt128Parts) + { + Uint64.Encode(stream, encodedUInt128Parts.Hi); + Uint64.Encode(stream, encodedUInt128Parts.Lo); + } + + public static UInt128Parts Decode(XdrDataInputStream stream) + { + var decodedUInt128Parts = new UInt128Parts(); + decodedUInt128Parts.Hi = Uint64.Decode(stream); + decodedUInt128Parts.Lo = Uint64.Decode(stream); + return decodedUInt128Parts; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/UInt256Parts.cs b/stellar-dotnet-sdk-xdr/generated/UInt256Parts.cs new file mode 100644 index 00000000..a89c7d73 --- /dev/null +++ b/stellar-dotnet-sdk-xdr/generated/UInt256Parts.cs @@ -0,0 +1,40 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// struct UInt256Parts { +// uint64 hi_hi; +// uint64 hi_lo; +// uint64 lo_hi; +// uint64 lo_lo; +// }; + +// =========================================================================== +public class UInt256Parts +{ + public Uint64 HiHi { get; set; } + public Uint64 HiLo { get; set; } + public Uint64 LoHi { get; set; } + public Uint64 LoLo { get; set; } + + public static void Encode(XdrDataOutputStream stream, UInt256Parts encodedUInt256Parts) + { + Uint64.Encode(stream, encodedUInt256Parts.HiHi); + Uint64.Encode(stream, encodedUInt256Parts.HiLo); + Uint64.Encode(stream, encodedUInt256Parts.LoHi); + Uint64.Encode(stream, encodedUInt256Parts.LoLo); + } + + public static UInt256Parts Decode(XdrDataInputStream stream) + { + var decodedUInt256Parts = new UInt256Parts(); + decodedUInt256Parts.HiHi = Uint64.Decode(stream); + decodedUInt256Parts.HiLo = Uint64.Decode(stream); + decodedUInt256Parts.LoHi = Uint64.Decode(stream); + decodedUInt256Parts.LoLo = Uint64.Decode(stream); + return decodedUInt256Parts; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Uint256.cs b/stellar-dotnet-sdk-xdr/generated/Uint256.cs index 5ee5b1f2..f83fdf73 100644 --- a/stellar-dotnet-sdk-xdr/generated/Uint256.cs +++ b/stellar-dotnet-sdk-xdr/generated/Uint256.cs @@ -1,38 +1,38 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque uint256[32]; + +// =========================================================================== +public class Uint256 { + public Uint256() + { + } - // === xdr source ============================================================ + public Uint256(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque uint256[32]; + public static void Encode(XdrDataOutputStream stream, Uint256 encodedUint256) + { + var uint256size = encodedUint256.InnerValue.Length; + stream.Write(encodedUint256.InnerValue, 0, uint256size); + } - // =========================================================================== - public class Uint256 + public static Uint256 Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public Uint256() { } - - public Uint256(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Uint256 encodedUint256) - { - int uint256size = encodedUint256.InnerValue.Length; - stream.Write(encodedUint256.InnerValue, 0, uint256size); - } - public static Uint256 Decode(XdrDataInputStream stream) - { - Uint256 decodedUint256 = new Uint256(); - int uint256size = 32; - decodedUint256.InnerValue = new byte[uint256size]; - stream.Read(decodedUint256.InnerValue, 0, uint256size); - return decodedUint256; - } + var decodedUint256 = new Uint256(); + var uint256size = 32; + decodedUint256.InnerValue = new byte[uint256size]; + stream.Read(decodedUint256.InnerValue, 0, uint256size); + return decodedUint256; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Uint32.cs b/stellar-dotnet-sdk-xdr/generated/Uint32.cs index 5cfc4f72..50faa1e7 100644 --- a/stellar-dotnet-sdk-xdr/generated/Uint32.cs +++ b/stellar-dotnet-sdk-xdr/generated/Uint32.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef unsigned int uint32; + +// =========================================================================== +public class Uint32 { + public Uint32() + { + } - // === xdr source ============================================================ + public Uint32(uint value) + { + InnerValue = value; + } + + public uint InnerValue { get; set; } = default; - // typedef unsigned int uint32; + public static void Encode(XdrDataOutputStream stream, Uint32 encodedUint32) + { + stream.WriteUInt(encodedUint32.InnerValue); + } - // =========================================================================== - public class Uint32 + public static Uint32 Decode(XdrDataInputStream stream) { - public uint InnerValue { get; set; } = default(uint); - - public Uint32() { } - - public Uint32(uint value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Uint32 encodedUint32) - { - stream.WriteUInt(encodedUint32.InnerValue); - } - public static Uint32 Decode(XdrDataInputStream stream) - { - Uint32 decodedUint32 = new Uint32(); - decodedUint32.InnerValue = stream.ReadUInt(); - return decodedUint32; - } + var decodedUint32 = new Uint32(); + decodedUint32.InnerValue = stream.ReadUInt(); + return decodedUint32; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Uint64.cs b/stellar-dotnet-sdk-xdr/generated/Uint64.cs index 46a0b209..21ee4083 100644 --- a/stellar-dotnet-sdk-xdr/generated/Uint64.cs +++ b/stellar-dotnet-sdk-xdr/generated/Uint64.cs @@ -1,35 +1,35 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef unsigned hyper uint64; + +// =========================================================================== +public class Uint64 { + public Uint64() + { + } - // === xdr source ============================================================ + public Uint64(ulong value) + { + InnerValue = value; + } + + public ulong InnerValue { get; set; } = default; - // typedef unsigned hyper uint64; + public static void Encode(XdrDataOutputStream stream, Uint64 encodedUint64) + { + stream.WriteULong(encodedUint64.InnerValue); + } - // =========================================================================== - public class Uint64 + public static Uint64 Decode(XdrDataInputStream stream) { - public ulong InnerValue { get; set; } = default(ulong); - - public Uint64() { } - - public Uint64(ulong value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Uint64 encodedUint64) - { - stream.WriteULong(encodedUint64.InnerValue); - } - public static Uint64 Decode(XdrDataInputStream stream) - { - Uint64 decodedUint64 = new Uint64(); - decodedUint64.InnerValue = stream.ReadULong(); - return decodedUint64; - } + var decodedUint64 = new Uint64(); + decodedUint64.InnerValue = stream.ReadULong(); + return decodedUint64; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/UpgradeEntryMeta.cs b/stellar-dotnet-sdk-xdr/generated/UpgradeEntryMeta.cs index 5b9cbefe..34b07806 100644 --- a/stellar-dotnet-sdk-xdr/generated/UpgradeEntryMeta.cs +++ b/stellar-dotnet-sdk-xdr/generated/UpgradeEntryMeta.cs @@ -1,36 +1,33 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr -{ +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ - // === xdr source ============================================================ +// struct UpgradeEntryMeta +// { +// LedgerUpgrade upgrade; +// LedgerEntryChanges changes; +// }; - // struct UpgradeEntryMeta - // { - // LedgerUpgrade upgrade; - // LedgerEntryChanges changes; - // }; +// =========================================================================== +public class UpgradeEntryMeta +{ + public LedgerUpgrade Upgrade { get; set; } + public LedgerEntryChanges Changes { get; set; } - // =========================================================================== - public class UpgradeEntryMeta + public static void Encode(XdrDataOutputStream stream, UpgradeEntryMeta encodedUpgradeEntryMeta) { - public UpgradeEntryMeta() { } - public LedgerUpgrade Upgrade { get; set; } - public LedgerEntryChanges Changes { get; set; } + LedgerUpgrade.Encode(stream, encodedUpgradeEntryMeta.Upgrade); + LedgerEntryChanges.Encode(stream, encodedUpgradeEntryMeta.Changes); + } - public static void Encode(XdrDataOutputStream stream, UpgradeEntryMeta encodedUpgradeEntryMeta) - { - LedgerUpgrade.Encode(stream, encodedUpgradeEntryMeta.Upgrade); - LedgerEntryChanges.Encode(stream, encodedUpgradeEntryMeta.Changes); - } - public static UpgradeEntryMeta Decode(XdrDataInputStream stream) - { - UpgradeEntryMeta decodedUpgradeEntryMeta = new UpgradeEntryMeta(); - decodedUpgradeEntryMeta.Upgrade = LedgerUpgrade.Decode(stream); - decodedUpgradeEntryMeta.Changes = LedgerEntryChanges.Decode(stream); - return decodedUpgradeEntryMeta; - } + public static UpgradeEntryMeta Decode(XdrDataInputStream stream) + { + var decodedUpgradeEntryMeta = new UpgradeEntryMeta(); + decodedUpgradeEntryMeta.Upgrade = LedgerUpgrade.Decode(stream); + decodedUpgradeEntryMeta.Changes = LedgerEntryChanges.Decode(stream); + return decodedUpgradeEntryMeta; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/UpgradeType.cs b/stellar-dotnet-sdk-xdr/generated/UpgradeType.cs index 05e361d7..71c57c7f 100644 --- a/stellar-dotnet-sdk-xdr/generated/UpgradeType.cs +++ b/stellar-dotnet-sdk-xdr/generated/UpgradeType.cs @@ -1,39 +1,39 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque UpgradeType<128>; + +// =========================================================================== +public class UpgradeType { + public UpgradeType() + { + } - // === xdr source ============================================================ + public UpgradeType(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque UpgradeType<128>; + public static void Encode(XdrDataOutputStream stream, UpgradeType encodedUpgradeType) + { + var UpgradeTypesize = encodedUpgradeType.InnerValue.Length; + stream.WriteInt(UpgradeTypesize); + stream.Write(encodedUpgradeType.InnerValue, 0, UpgradeTypesize); + } - // =========================================================================== - public class UpgradeType + public static UpgradeType Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public UpgradeType() { } - - public UpgradeType(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, UpgradeType encodedUpgradeType) - { - int UpgradeTypesize = encodedUpgradeType.InnerValue.Length; - stream.WriteInt(UpgradeTypesize); - stream.Write(encodedUpgradeType.InnerValue, 0, UpgradeTypesize); - } - public static UpgradeType Decode(XdrDataInputStream stream) - { - UpgradeType decodedUpgradeType = new UpgradeType(); - int UpgradeTypesize = stream.ReadInt(); - decodedUpgradeType.InnerValue = new byte[UpgradeTypesize]; - stream.Read(decodedUpgradeType.InnerValue, 0, UpgradeTypesize); - return decodedUpgradeType; - } + var decodedUpgradeType = new UpgradeType(); + var UpgradeTypesize = stream.ReadInt(); + decodedUpgradeType.InnerValue = new byte[UpgradeTypesize]; + stream.Read(decodedUpgradeType.InnerValue, 0, UpgradeTypesize); + return decodedUpgradeType; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk-xdr/generated/Value.cs b/stellar-dotnet-sdk-xdr/generated/Value.cs index 8b401034..578325b4 100644 --- a/stellar-dotnet-sdk-xdr/generated/Value.cs +++ b/stellar-dotnet-sdk-xdr/generated/Value.cs @@ -1,39 +1,39 @@ // Automatically generated by xdrgen // DO NOT EDIT or your changes may be overwritten -using System; -namespace stellar_dotnet_sdk.xdr +namespace stellar_dotnet_sdk.xdr; + +// === xdr source ============================================================ + +// typedef opaque Value<>; + +// =========================================================================== +public class Value { + public Value() + { + } - // === xdr source ============================================================ + public Value(byte[] value) + { + InnerValue = value; + } + + public byte[] InnerValue { get; set; } = default; - // typedef opaque Value<>; + public static void Encode(XdrDataOutputStream stream, Value encodedValue) + { + var Valuesize = encodedValue.InnerValue.Length; + stream.WriteInt(Valuesize); + stream.Write(encodedValue.InnerValue, 0, Valuesize); + } - // =========================================================================== - public class Value + public static Value Decode(XdrDataInputStream stream) { - public byte[] InnerValue { get; set; } = default(byte[]); - - public Value() { } - - public Value(byte[] value) - { - InnerValue = value; - } - - public static void Encode(XdrDataOutputStream stream, Value encodedValue) - { - int Valuesize = encodedValue.InnerValue.Length; - stream.WriteInt(Valuesize); - stream.Write(encodedValue.InnerValue, 0, Valuesize); - } - public static Value Decode(XdrDataInputStream stream) - { - Value decodedValue = new Value(); - int Valuesize = stream.ReadInt(); - decodedValue.InnerValue = new byte[Valuesize]; - stream.Read(decodedValue.InnerValue, 0, Valuesize); - return decodedValue; - } + var decodedValue = new Value(); + var Valuesize = stream.ReadInt(); + decodedValue.InnerValue = new byte[Valuesize]; + stream.Read(decodedValue.InnerValue, 0, Valuesize); + return decodedValue; } -} +} \ No newline at end of file diff --git a/stellar-dotnet-sdk/ExtendFootprintOperation.cs b/stellar-dotnet-sdk/ExtendFootprintOperation.cs new file mode 100644 index 00000000..adea5c7f --- /dev/null +++ b/stellar-dotnet-sdk/ExtendFootprintOperation.cs @@ -0,0 +1,116 @@ +using System; +using stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk; + +/// +/// Operation that extends footprint TTL +/// +public class ExtendFootprintOperation : Operation +{ + public uint ExtendTo { get; set; } + + public ExtensionPoint ExtensionPoint { get; set; } + + /// + /// Creates a new ExtendFootprintOperation object from the given base64-encoded XDR Operation. + /// + /// + /// ExtendFootprintOperation object + /// Thrown when the base64-encoded XDR value is invalid. + public static ExtendFootprintOperation FromOperationXdrBase64(string xdrBase64) + { + var operation = FromXdrBase64(xdrBase64); + if (operation == null) + throw new InvalidOperationException("Operation XDR is invalid"); + + if (operation is not ExtendFootprintOperation extendFootprintOperation) + throw new InvalidOperationException("Operation is not ExtendFootprintOperation"); + return extendFootprintOperation; + } + + public static ExtendFootprintOperation FromExtendFootprintTTLOperationXdr(ExtendFootprintTTLOp xdrExtendFootprintTTLOp) + { + return new ExtendFootprintOperation + { + ExtendTo = xdrExtendFootprintTTLOp.ExtendTo.InnerValue, + ExtensionPoint = ExtensionPoint.FromXdr(xdrExtendFootprintTTLOp.Ext) + }; + } + + public ExtendFootprintTTLOp ToExtendFootprintTTLOperationXdr() + { + return new ExtendFootprintTTLOp + { + Ext = ExtensionPoint.ToXdr(), + ExtendTo = new Uint32(ExtendTo) + }; + } + + public override xdr.Operation.OperationBody ToOperationBody() + { + var body = new xdr.Operation.OperationBody + { + Discriminant = new xdr.OperationType + { + InnerValue = xdr.OperationType.OperationTypeEnum.EXTEND_FOOTPRINT_TTL + }, + ExtendFootprintTTLOp = ToExtendFootprintTTLOperationXdr() + }; + return body; + } + + public class Builder + { + private uint? _extendTo; + private ExtensionPoint _extensionPoint; + + private KeyPair? _sourceAccount; + + public Builder() + { + } + + public Builder(ExtendFootprintTTLOp operationXdr) + { + _extendTo = operationXdr.ExtendTo.InnerValue; + _extensionPoint = ExtensionPoint.FromXdr(operationXdr.Ext); + } + + public Builder SetSourceAccount(KeyPair sourceAccount) + { + _sourceAccount = sourceAccount; + return this; + } + + public Builder SetExtensionPoint(ExtensionPoint ext) + { + _extensionPoint = ext; + return this; + } + + public Builder SetExtendTo(uint extendTo) + { + _extendTo = extendTo; + return this; + } + + public ExtendFootprintOperation Build() + { + if (_extensionPoint == null) + throw new InvalidOperationException("Extension point cannot be null"); + if (_extendTo == null) + throw new InvalidOperationException("Extend to cannot be null"); + var operation = new ExtendFootprintOperation() + { + ExtensionPoint = _extensionPoint, + ExtendTo = _extendTo.Value + }; + if (_sourceAccount != null) + { + operation.SourceAccount = _sourceAccount; + } + return operation; + } + } +} diff --git a/stellar-dotnet-sdk/ExtensionPoint.cs b/stellar-dotnet-sdk/ExtensionPoint.cs new file mode 100644 index 00000000..1188ac1e --- /dev/null +++ b/stellar-dotnet-sdk/ExtensionPoint.cs @@ -0,0 +1,75 @@ +using System; +using stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk; + +public abstract class ExtensionPoint +{ + public xdr.ExtensionPoint ToXdr() + { + return this switch + { + ExtensionPointZero extensionPointZero => extensionPointZero.ToExtensionPointXdr(), + _ => throw new InvalidOperationException("Unknown ExtensionPoint type") + }; + } + + public static ExtensionPoint FromXdr(xdr.ExtensionPoint xdr) + { + return xdr.Discriminant switch + { + 0 => ExtensionPointZero.FromExtensionPointXdr(xdr), + _ => throw new InvalidOperationException("Unknown ExtensionPoint type") + }; + } + + /// + /// Creates a new ExtensionPoint object from the given ExtensionPoint XDR base64 string. + /// + /// + /// ExtensionPoint object + public static ExtensionPoint FromXdrBase64(string xdrBase64) + { + var bytes = Convert.FromBase64String(xdrBase64); + var reader = new XdrDataInputStream(bytes); + var thisXdr = xdr.ExtensionPoint.Decode(reader); + return FromXdr(thisXdr); + } + + /// + /// Returns base64-encoded ExtensionPoint XDR object. + /// + public string ToXdrBase64() + { + var xdrValue = ToXdr(); + var writer = new XdrDataOutputStream(); + xdr.ExtensionPoint.Encode(writer, xdrValue); + return Convert.ToBase64String(writer.ToArray()); + } +} + +public class ExtensionPointZero : ExtensionPoint +{ + public new void ToXdr() {} + + public xdr.ExtensionPoint ToExtensionPointXdr() + { + return new xdr.ExtensionPoint + { + Discriminant = 0 + }; + } + + public static ExtensionPointZero FromExtensionPointXdr(xdr.ExtensionPoint xdrExtensionPoint) + { + if (xdrExtensionPoint.Discriminant != 0) + throw new ArgumentException("Not an ExtensionPointZero", nameof(xdrExtensionPoint)); + + return FromXdr(); + } + + public static ExtensionPointZero FromXdr() + { + return new ExtensionPointZero(); + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk/HostFunction.cs b/stellar-dotnet-sdk/HostFunction.cs new file mode 100644 index 00000000..26fc2ed2 --- /dev/null +++ b/stellar-dotnet-sdk/HostFunction.cs @@ -0,0 +1,4 @@ +using System.Linq; +using stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk; diff --git a/stellar-dotnet-sdk/InvokeHostFunctionOperation.cs b/stellar-dotnet-sdk/InvokeHostFunctionOperation.cs new file mode 100644 index 00000000..70c7ae83 --- /dev/null +++ b/stellar-dotnet-sdk/InvokeHostFunctionOperation.cs @@ -0,0 +1,1088 @@ +using System; +using System.Linq; +using stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk; + +/// +/// Base class for operations that invoke host functions. +/// +public abstract class InvokeHostFunctionOperation : Operation { } + +/// +/// Operation that invokes a Soroban host function to invoke a contract +/// +public class InvokeContractOperation : InvokeHostFunctionOperation +{ + public InvokeContractOperation(InvokeContractHostFunction hostFunction) + { + HostFunction = hostFunction; + Auth = Array.Empty(); + } + + public InvokeContractHostFunction HostFunction { get; } + public SorobanAuthorizationEntry[] Auth { get; private set; } + + /// + /// Creates a new InvokeContractOperation object from the given base64-encoded XDR Operation. + /// + /// + /// InvokeContractOperation object + /// Thrown when the base64-encoded XDR value is invalid. + public static InvokeContractOperation FromOperationXdrBase64(string xdrBase64) + { + var operation = FromXdrBase64(xdrBase64); + if (operation == null) + throw new InvalidOperationException("Operation XDR is invalid"); + + if (operation is not InvokeContractOperation invokeHostFunctionOperation) + throw new InvalidOperationException("Operation is not InvokeHostFunctionOperation"); + return invokeHostFunctionOperation; + } + + public static InvokeContractOperation FromInvokeHostFunctionOperationXdr(xdr.InvokeHostFunctionOp xdrInvokeHostFunctionOp) + { + if (xdrInvokeHostFunctionOp.HostFunction.Discriminant.InnerValue != xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT) + throw new InvalidOperationException("Invalid HostFunction type"); + + return new InvokeContractOperation( + hostFunction: InvokeContractHostFunction.FromHostFunctionXdr(xdrInvokeHostFunctionOp.HostFunction) + ) + { + Auth = xdrInvokeHostFunctionOp.Auth.Select(SorobanAuthorizationEntry.FromXdr).ToArray() + }; + } + + public xdr.InvokeHostFunctionOp ToInvokeHostFunctionOperationXdr() + { + return new xdr.InvokeHostFunctionOp + { + HostFunction = new xdr.HostFunction + { + Discriminant = new xdr.HostFunctionType + { + InnerValue = xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT + }, + InvokeContract = HostFunction.ToXdr(), + }, + Auth = Auth.Select(a => a.ToXdr()).ToArray() + }; + } + + public override xdr.Operation.OperationBody ToOperationBody() + { + var body = new xdr.Operation.OperationBody + { + Discriminant = new xdr.OperationType + { + InnerValue = xdr.OperationType.OperationTypeEnum.INVOKE_HOST_FUNCTION + }, + InvokeHostFunctionOp = ToInvokeHostFunctionOperationXdr() + }; + return body; + } + + public class Builder + { + private SCAddress? _contractAddress; + private SCSymbol? _functionName; + private SCVal[]? _args; + private SorobanAuthorizationEntry[]? _auth; + + private KeyPair? _sourceAccount; + + public Builder() + { + } + + public Builder(xdr.InvokeHostFunctionOp operationXdr) + { + _contractAddress = SCAddress.FromXdr(operationXdr.HostFunction.InvokeContract.ContractAddress); + _functionName = SCSymbol.FromXdr(operationXdr.HostFunction.InvokeContract.FunctionName); + _args = operationXdr.HostFunction.InvokeContract.Args.Select(SCVal.FromXdr).ToArray(); + _auth = operationXdr.Auth.Select(SorobanAuthorizationEntry.FromXdr).ToArray(); + } + + public Builder( + InvokeContractHostFunction hostFunction, + SorobanAuthorizationEntry[]? auth = null) + { + _contractAddress = hostFunction.ContractAddress; + _functionName = hostFunction.FunctionName; + _args = hostFunction.Args; + _auth = auth; + } + + public Builder( + SCAddress contractAddress, + SCSymbol functionName, + SCVal[] args, + SorobanAuthorizationEntry[]? auth = null) + { + _contractAddress = contractAddress; + _functionName = functionName; + _args = args; + _auth = auth; + } + + public Builder SetContractAddress(SCAddress contractAddress) + { + _contractAddress = contractAddress; + return this; + } + + public Builder SetFunctionName(SCSymbol functionName) + { + _functionName = functionName; + return this; + } + + public Builder SetArgs(SCVal[] args) + { + _args = args; + return this; + } + + public Builder SetAuth(SorobanAuthorizationEntry[] auth) + { + _auth = auth; + return this; + } + + public Builder AddAuth(SorobanAuthorizationEntry auth) + { + _auth ??= Array.Empty(); + _auth = _auth.Append(auth).ToArray(); + return this; + } + + public Builder RemoveAuth(SorobanAuthorizationEntry auth) + { + if (_auth == null) + return this; + + _auth = _auth.Where(a => !a.Equals(auth)).ToArray(); + return this; + } + + public Builder SetSourceAccount(KeyPair sourceAccount) + { + _sourceAccount = sourceAccount; + return this; + } + + public InvokeContractOperation Build() + { + if (_contractAddress == null) + throw new InvalidOperationException("Contract address cannot be null"); + if (_functionName == null) + throw new InvalidOperationException("Function name cannot be null"); + + var operation = new InvokeContractOperation( + hostFunction: new InvokeContractHostFunction( + contractAddress: _contractAddress, + functionName: _functionName, + args: _args ?? Array.Empty())) + { + Auth = _auth ?? Array.Empty(), + }; + if (_sourceAccount != null) + { + operation.SourceAccount = _sourceAccount; + } + return operation; + } + } +} + +public class CreateContractOperation : InvokeHostFunctionOperation +{ + public CreateContractOperation(CreateContractHostFunction hostFunction) + { + HostFunction = hostFunction; + Auth = Array.Empty(); + } + + public CreateContractHostFunction HostFunction { get; } + public SorobanAuthorizationEntry[] Auth { get; private set; } + + /// + /// Creates a new CreateContractOperation object from the given base64-encoded XDR Operation. + /// + /// + /// CreateContractOperation object + /// Thrown when the base64-encoded XDR value is invalid. + public static CreateContractOperation FromOperationXdrBase64(string xdrBase64) + { + var operation = FromXdrBase64(xdrBase64); + if (operation == null) + throw new InvalidOperationException("Operation XDR is invalid"); + + if (operation is not CreateContractOperation invokeHostFunctionOperation) + throw new InvalidOperationException("Operation is not InvokeHostFunctionOperation"); + + return invokeHostFunctionOperation; + } + + public static CreateContractOperation FromInvokeHostFunctionOperationXdr(xdr.InvokeHostFunctionOp xdrInvokeHostFunctionOp) + { + if (xdrInvokeHostFunctionOp.HostFunction.Discriminant.InnerValue != xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT) + throw new InvalidOperationException("Invalid HostFunction type"); + + return new CreateContractOperation( + hostFunction: CreateContractHostFunction.FromHostFunctionXdr(xdrInvokeHostFunctionOp.HostFunction) + ) + { + Auth = xdrInvokeHostFunctionOp.Auth.Select(SorobanAuthorizationEntry.FromXdr).ToArray() + }; + } + + public xdr.InvokeHostFunctionOp ToInvokeHostFunctionOperationXdr() + { + return new xdr.InvokeHostFunctionOp + { + HostFunction = new xdr.HostFunction + { + Discriminant = new xdr.HostFunctionType + { + InnerValue = xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT + }, + CreateContract = HostFunction.ToXdr(), + }, + Auth = Auth.Select(a => a.ToXdr()).ToArray() + }; + } + + public override xdr.Operation.OperationBody ToOperationBody() + { + var body = new xdr.Operation.OperationBody + { + Discriminant = new xdr.OperationType + { + InnerValue = xdr.OperationType.OperationTypeEnum.INVOKE_HOST_FUNCTION + }, + InvokeHostFunctionOp = ToInvokeHostFunctionOperationXdr() + }; + return body; + } + + public class Builder + { + private ContractIDPreimage? _contractIDPreimage; + private ContractExecutable? _executable; + private SorobanAuthorizationEntry[]? _auth; + + private KeyPair? _sourceAccount; + + public Builder() + { + } + + public Builder(xdr.InvokeHostFunctionOp operationXdr) + { + _contractIDPreimage = + ContractIDPreimage.FromXdr(operationXdr.HostFunction.CreateContract.ContractIDPreimage); + _executable = ContractExecutable.FromXdr(operationXdr.HostFunction.CreateContract.Executable); + _auth = operationXdr.Auth.Select(SorobanAuthorizationEntry.FromXdr).ToArray(); + } + + public Builder( + CreateContractHostFunction hostFunction, + SorobanAuthorizationEntry[]? auth = null) + { + _contractIDPreimage = hostFunction.ContractIDPreimage; + _executable = hostFunction.Executable; + _auth = auth; + } + + public Builder( + ContractIDPreimage contractIDPreimage, + ContractExecutable executable, + SorobanAuthorizationEntry[]? auth = null) + { + _contractIDPreimage = contractIDPreimage; + _executable = executable; + _auth = auth; + } + + public Builder SetContractIDPreimage(ContractIDPreimage contractIDPreimage) + { + _contractIDPreimage = contractIDPreimage; + return this; + } + + public Builder SetExecutable(ContractExecutable executable) + { + _executable = executable; + return this; + } + + public Builder SetAuth(SorobanAuthorizationEntry[] auth) + { + _auth = auth; + return this; + } + + public Builder AddAuth(SorobanAuthorizationEntry auth) + { + _auth ??= Array.Empty(); + _auth = _auth.Append(auth).ToArray(); + return this; + } + + public Builder RemoveAuth(SorobanAuthorizationEntry auth) + { + if (_auth == null) + return this; + + _auth = _auth.Where(a => !a.Equals(auth)).ToArray(); + return this; + } + + public Builder SetSourceAccount(KeyPair sourceAccount) + { + _sourceAccount = sourceAccount; + return this; + } + + public CreateContractOperation Build() + { + if (_contractIDPreimage == null) + throw new InvalidOperationException("Contract ID preimage cannot be null"); + if (_executable == null) + throw new InvalidOperationException("Executable cannot be null"); + + var operation = new CreateContractOperation( + hostFunction: new CreateContractHostFunction( + contractIDPreimage: _contractIDPreimage, + executable: _executable)) + { + Auth = _auth ?? Array.Empty(), + }; + if (_sourceAccount != null) + { + operation.SourceAccount = _sourceAccount; + } + return operation; + } + } +} + +public class UploadContractOperation : InvokeHostFunctionOperation +{ + public UploadContractOperation(UploadContractHostFunction hostFunction) + { + HostFunction = hostFunction; + Auth = Array.Empty(); + } + + public UploadContractHostFunction HostFunction { get; } + public SorobanAuthorizationEntry[] Auth { get; private set; } + + /// + /// Creates a new UploadContractOperation object from the given base64-encoded XDR Operation. + /// + /// + /// UploadContractOperation object + /// Thrown when the base64-encoded XDR value is invalid. + public static UploadContractOperation FromOperationXdrBase64(string xdrBase64) + { + var operation = Operation.FromXdrBase64(xdrBase64); + if (operation == null) + throw new InvalidOperationException("Operation XDR is invalid"); + + if (operation is not UploadContractOperation invokeHostFunctionOperation) + throw new InvalidOperationException("Operation is not InvokeHostFunctionOperation"); + + return invokeHostFunctionOperation; + } + + public static UploadContractOperation FromInvokeHostFunctionOperationXdr(xdr.InvokeHostFunctionOp xdrInvokeHostFunctionOp) + { + if (xdrInvokeHostFunctionOp.HostFunction.Discriminant.InnerValue != xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM) + throw new InvalidOperationException("Invalid HostFunction type"); + + return new UploadContractOperation( + hostFunction: UploadContractHostFunction.FromHostFunctionXdr(xdrInvokeHostFunctionOp.HostFunction) + ) + { + Auth = xdrInvokeHostFunctionOp.Auth.Select(SorobanAuthorizationEntry.FromXdr).ToArray() + }; + } + + public xdr.InvokeHostFunctionOp ToInvokeHostFunctionOperationXdr() + { + return new xdr.InvokeHostFunctionOp + { + HostFunction = new xdr.HostFunction + { + Discriminant = new xdr.HostFunctionType + { + InnerValue = xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM + }, + Wasm = HostFunction.ToXdr(), + }, + Auth = Auth.Select(a => a.ToXdr()).ToArray() + }; + } + + public override xdr.Operation.OperationBody ToOperationBody() + { + var body = new xdr.Operation.OperationBody + { + Discriminant = new xdr.OperationType + { + InnerValue = xdr.OperationType.OperationTypeEnum.INVOKE_HOST_FUNCTION + }, + InvokeHostFunctionOp = ToInvokeHostFunctionOperationXdr() + }; + return body; + } + + public class Builder + { + private byte[]? _wasm; + private SorobanAuthorizationEntry[]? _auth; + + private KeyPair? _sourceAccount; + + public Builder() + { + } + + public Builder(xdr.InvokeHostFunctionOp operationXdr) + { + _wasm = operationXdr.HostFunction.Wasm; + _auth = operationXdr.Auth.Select(SorobanAuthorizationEntry.FromXdr).ToArray(); + } + + public Builder( + UploadContractHostFunction hostFunction, + SorobanAuthorizationEntry[]? auth = null) + { + _wasm = hostFunction.Wasm; + _auth = auth; + } + + public Builder( + byte[] wasm, + SorobanAuthorizationEntry[]? auth = null) + { + _wasm = wasm; + _auth = auth; + } + + public Builder SetWasm(byte[] wasm) + { + _wasm = wasm; + return this; + } + + public Builder SetAuth(SorobanAuthorizationEntry[] auth) + { + _auth = auth; + return this; + } + + public Builder AddAuth(SorobanAuthorizationEntry auth) + { + _auth ??= Array.Empty(); + _auth = _auth.Append(auth).ToArray(); + return this; + } + + public Builder RemoveAuth(SorobanAuthorizationEntry auth) + { + if (_auth == null) + return this; + + _auth = _auth.Where(a => !a.Equals(auth)).ToArray(); + return this; + } + + public Builder SetSourceAccount(KeyPair sourceAccount) + { + _sourceAccount = sourceAccount; + return this; + } + + public UploadContractOperation Build() + { + if (_wasm == null) + throw new InvalidOperationException("Wasm cannot be null"); + + var operation = new UploadContractOperation( + hostFunction: new UploadContractHostFunction( + wasm: _wasm)) + { + Auth = _auth ?? Array.Empty(), + }; + if (_sourceAccount != null) + { + operation.SourceAccount = _sourceAccount; + } + return operation; + } + } +} + +public abstract class HostFunction +{ + public xdr.HostFunction ToXdr() + { + return this switch + { + InvokeContractHostFunction invokeContractArgs => invokeContractArgs.ToHostFunctionXdr(), + CreateContractHostFunction createContractArgs => createContractArgs.ToHostFunctionXdr(), + UploadContractHostFunction uploadContractArgs => uploadContractArgs.ToHostFunctionXdr(), + _ => throw new InvalidOperationException("Unknown HostFunction type") + }; + } + + public static HostFunction FromXdr(xdr.HostFunction xdrHostFunction) + { + return xdrHostFunction.Discriminant.InnerValue switch + { + xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT => InvokeContractHostFunction.FromHostFunctionXdr(xdrHostFunction), + xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT => CreateContractHostFunction.FromHostFunctionXdr(xdrHostFunction), + xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM => UploadContractHostFunction.FromHostFunctionXdr(xdrHostFunction), + _ => throw new InvalidOperationException("Unknown HostFunction type") + }; + } +} + +public class InvokeContractHostFunction : HostFunction +{ + public InvokeContractHostFunction( + SCAddress contractAddress, + SCSymbol functionName, + SCVal[] args) + { + ContractAddress = contractAddress; + FunctionName = functionName; + Args = args; + } + + public SCAddress ContractAddress { get; } + public SCSymbol FunctionName { get; } + public SCVal[] Args { get; } + + public static InvokeContractHostFunction FromXdr(xdr.InvokeContractArgs xdrInvokeContractArgs) + { + return new InvokeContractHostFunction( + contractAddress: SCAddress.FromXdr(xdrInvokeContractArgs.ContractAddress), + functionName: SCSymbol.FromXdr(xdrInvokeContractArgs.FunctionName), + args: xdrInvokeContractArgs.Args.Select(SCVal.FromXdr).ToArray() + ); + } + + public static InvokeContractHostFunction FromHostFunctionXdr(xdr.HostFunction xdrHostFunction) + { + if (xdrHostFunction.Discriminant.InnerValue != xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT) + throw new InvalidOperationException("Invalid HostFunction type"); + + return FromXdr(xdrHostFunction.InvokeContract); + } + + public xdr.InvokeContractArgs ToXdr() + { + return new xdr.InvokeContractArgs + { + ContractAddress = ContractAddress.ToXdr(), + FunctionName = FunctionName.ToXdr(), + Args = Args.Select(a => a.ToXdr()).ToArray(), + }; + } + + public xdr.HostFunction ToHostFunctionXdr() + { + return new xdr.HostFunction + { + Discriminant = new xdr.HostFunctionType + { + InnerValue = xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT + }, + InvokeContract = ToXdr(), + }; + } + + /// + /// Returns base64-encoded InvokeContractArgs XDR object. + /// + public string ToXdrBase64() + { + var xdrValue = ToXdr(); + var writer = new XdrDataOutputStream(); + xdr.InvokeContractArgs.Encode(writer, xdrValue); + return Convert.ToBase64String(writer.ToArray()); + } +} + +public class CreateContractHostFunction : HostFunction +{ + public CreateContractHostFunction( + ContractIDPreimage contractIDPreimage, + ContractExecutable executable) + { + ContractIDPreimage = contractIDPreimage; + Executable = executable; + } + + public ContractIDPreimage ContractIDPreimage { get; } + public ContractExecutable Executable { get; } + + public static CreateContractHostFunction FromXdr(xdr.CreateContractArgs xdrCreateContractArgs) + { + return new CreateContractHostFunction( + contractIDPreimage: ContractIDPreimage.FromXdr(xdrCreateContractArgs.ContractIDPreimage), + executable: ContractExecutable.FromXdr(xdrCreateContractArgs.Executable) + ); + } + + public static CreateContractHostFunction FromHostFunctionXdr(xdr.HostFunction xdrHostFunction) + { + if (xdrHostFunction.Discriminant.InnerValue != xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT) + throw new InvalidOperationException("Invalid HostFunction type"); + + return new CreateContractHostFunction( + contractIDPreimage: ContractIDPreimage.FromXdr(xdrHostFunction.CreateContract.ContractIDPreimage), + executable: ContractExecutable.FromXdr(xdrHostFunction.CreateContract.Executable) + ); + } + + public xdr.CreateContractArgs ToXdr() + { + return new xdr.CreateContractArgs + { + ContractIDPreimage = ContractIDPreimage.ToXdr(), + Executable = Executable.ToXdr() + }; + } + + public xdr.HostFunction ToHostFunctionXdr() + { + return new xdr.HostFunction + { + Discriminant = new xdr.HostFunctionType + { + InnerValue = xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT + }, + CreateContract = ToXdr(), + }; + } + + /// + /// Returns base64-encoded CreateContractArgs XDR object. + /// + public string ToXdrBase64() + { + var xdrValue = ToXdr(); + var writer = new XdrDataOutputStream(); + xdr.CreateContractArgs.Encode(writer, xdrValue); + return Convert.ToBase64String(writer.ToArray()); + } +} + +public class UploadContractHostFunction : HostFunction +{ + public UploadContractHostFunction(byte[] wasm) + { + Wasm = wasm; + } + + public byte[] Wasm { get; } + + public static UploadContractHostFunction FromHostFunctionXdr(xdr.HostFunction xdrHostFunction) + { + if (xdrHostFunction.Discriminant.InnerValue != xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM) + throw new InvalidOperationException("Invalid HostFunction type"); + + return new UploadContractHostFunction( + wasm: xdrHostFunction.Wasm + ); + } + + public byte[] ToXdr() + { + return Wasm; + } + + public xdr.HostFunction ToHostFunctionXdr() + { + return new xdr.HostFunction + { + Discriminant = new xdr.HostFunctionType + { + InnerValue = xdr.HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM + }, + Wasm = ToXdr(), + }; + } +} + +public class SorobanAuthorizationEntry +{ + public SorobanCredentials Credentials { get; set; } + public SorobanAuthorizedInvocation RootInvocation { get; set; } + + public xdr.SorobanAuthorizationEntry ToXdr() + { + return new xdr.SorobanAuthorizationEntry + { + Credentials = Credentials.ToXdr(), + RootInvocation = RootInvocation.ToXdr() + }; + } + + public static SorobanAuthorizationEntry FromXdr(xdr.SorobanAuthorizationEntry xdr) + { + return new SorobanAuthorizationEntry + { + Credentials = SorobanCredentials.FromXdr(xdr.Credentials), + RootInvocation = SorobanAuthorizedInvocation.FromXdr(xdr.RootInvocation) + }; + } + + /// + /// Creates a new SorobanAuthorizationEntry object from the given SorobanAuthorizationEntry XDR base64 string. + /// + /// + /// SorobanAuthorizationEntry object + public static SorobanAuthorizationEntry FromXdrBase64(string xdrBase64) + { + var bytes = Convert.FromBase64String(xdrBase64); + var reader = new XdrDataInputStream(bytes); + var thisXdr = xdr.SorobanAuthorizationEntry.Decode(reader); + return FromXdr(thisXdr); + } + + /// + /// Returns base64-encoded SorobanAuthorizationEntry XDR object. + /// + public string ToXdrBase64() + { + var xdrValue = ToXdr(); + var writer = new XdrDataOutputStream(); + xdr.SorobanAuthorizationEntry.Encode(writer, xdrValue); + return Convert.ToBase64String(writer.ToArray()); + } +} + +public abstract class SorobanCredentials +{ + public xdr.SorobanCredentials ToXdr() + { + return this switch + { + SorobanSourceAccountCredentials sourceAccount => sourceAccount.ToSorobanCredentialsXdr(), + SorobanAddressCredentials address => address.ToSorobanCredentialsXdr(), + _ => throw new InvalidOperationException("Unknown SorobanCredentials type") + }; + } + + public static SorobanCredentials FromXdr(xdr.SorobanCredentials xdrSorobanCredentials) + { + return xdrSorobanCredentials.Discriminant.InnerValue switch + { + xdr.SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_SOURCE_ACCOUNT => SorobanSourceAccountCredentials.FromSorobanCredentialsXdr(xdrSorobanCredentials), + xdr.SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_ADDRESS => SorobanAddressCredentials.FromSorobanCredentialsXdr(xdrSorobanCredentials), + _ => throw new InvalidOperationException("Unknown SorobanCredentials type") + }; + } + + /// + /// Creates a new SorobanCredentials object from the given SorobanCredentials XDR base64 string. + /// + /// + /// SorobanCredentials object + public static SorobanCredentials FromXdrBase64(string xdrBase64) + { + var bytes = Convert.FromBase64String(xdrBase64); + var reader = new XdrDataInputStream(bytes); + var thisXdr = xdr.SorobanCredentials.Decode(reader); + return FromXdr(thisXdr); + } + + /// + /// Returns base64-encoded SorobanCredentials XDR object. + /// + public string ToXdrBase64() + { + var xdrValue = ToXdr(); + var writer = new XdrDataOutputStream(); + xdr.SorobanCredentials.Encode(writer, xdrValue); + return Convert.ToBase64String(writer.ToArray()); + } +} + +public class SorobanSourceAccountCredentials : SorobanCredentials +{ + public static SorobanSourceAccountCredentials FromSorobanCredentialsXdr(xdr.SorobanCredentials xdrSorobanCredentials) + { + if (xdrSorobanCredentials.Discriminant.InnerValue != xdr.SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_SOURCE_ACCOUNT) + throw new InvalidOperationException("Invalid SorobanCredentials type"); + + return new SorobanSourceAccountCredentials(); + } + + public xdr.SorobanCredentials ToSorobanCredentialsXdr() + { + return new xdr.SorobanCredentials + { + Discriminant = new xdr.SorobanCredentialsType + { + InnerValue = xdr.SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_SOURCE_ACCOUNT + }, + }; + } +} + +public class SorobanAddressCredentials : SorobanCredentials +{ + public SCAddress Address { get; set; } + public long Nonce { get; set; } + public uint SignatureExpirationLedger { get; set; } + public SCVal Signature { get; set; } + + public static SorobanAddressCredentials FromSorobanCredentialsXdr(xdr.SorobanCredentials xdrSorobanCredentials) + { + if (xdrSorobanCredentials.Discriminant.InnerValue != xdr.SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_ADDRESS) + throw new InvalidOperationException("Invalid SorobanCredentials type"); + + return new SorobanAddressCredentials + { + Address = SCAddress.FromXdr(xdrSorobanCredentials.Address.Address), + Nonce = xdrSorobanCredentials.Address.Nonce.InnerValue, + SignatureExpirationLedger = xdrSorobanCredentials.Address.SignatureExpirationLedger.InnerValue, + Signature = SCVal.FromXdr(xdrSorobanCredentials.Address.Signature) + }; + } + + public xdr.SorobanCredentials ToSorobanCredentialsXdr() + { + if (Address == null) + { + throw new InvalidOperationException("Address cannot be null"); + } + if (Nonce == null) + { + throw new InvalidOperationException("Nonce cannot be null"); + } + if (SignatureExpirationLedger == null) + { + throw new InvalidOperationException("SignatureExpirationLedger cannot be null"); + } + if (Signature == null) + { + throw new InvalidOperationException("Signature cannot be null"); + } + return new xdr.SorobanCredentials + { + Discriminant = new xdr.SorobanCredentialsType + { + InnerValue = xdr.SorobanCredentialsType.SorobanCredentialsTypeEnum.SOROBAN_CREDENTIALS_ADDRESS + }, + Address = new xdr.SorobanAddressCredentials + { + Address = Address.ToXdr(), + Nonce = new xdr.Int64 + { + InnerValue = Nonce + }, + SignatureExpirationLedger = new xdr.Uint32 + { + InnerValue = SignatureExpirationLedger + }, + Signature = Signature.ToXdr() + } + }; + } +} + +public class SorobanAuthorizedInvocation +{ + public SorobanAuthorizedFunction Function { get; set; } + public SorobanAuthorizedInvocation[] SubInvocations { get; set; } + + public xdr.SorobanAuthorizedInvocation ToXdr() + { + return new xdr.SorobanAuthorizedInvocation + { + Function = Function.ToXdr(), + SubInvocations = SubInvocations.Select(i => i.ToXdr()).ToArray() + }; + } + + public static SorobanAuthorizedInvocation FromXdr(xdr.SorobanAuthorizedInvocation xdr) + { + return new SorobanAuthorizedInvocation + { + Function = SorobanAuthorizedFunction.FromXdr(xdr.Function), + SubInvocations = xdr.SubInvocations.Select(FromXdr).ToArray() + }; + } +} + +public abstract class SorobanAuthorizedFunction +{ + public xdr.SorobanAuthorizedFunction ToXdr() + { + return this switch + { + SorobanAuthorizedContractFunction contractFn => contractFn.ToSorobanAuthorizedFunctionXdr(), + SorobanAuthorizedCreateContractFunction createContractHostFn => createContractHostFn.ToSorobanAuthorizedFunctionXdr(), + _ => throw new InvalidOperationException("Unknown SorobanAuthorizedFunction type") + }; + } + + public static SorobanAuthorizedFunction FromXdr(xdr.SorobanAuthorizedFunction xdrSorobanAuthorizedFunction) + { + return xdrSorobanAuthorizedFunction.Discriminant.InnerValue switch + { + xdr.SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN => SorobanAuthorizedContractFunction.FromSorobanAuthorizedFunctionXdr(xdrSorobanAuthorizedFunction), + xdr.SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN => SorobanAuthorizedCreateContractFunction.FromSorobanAuthorizedFunctionXdr(xdrSorobanAuthorizedFunction), + _ => throw new InvalidOperationException("Unknown SorobanAuthorizedFunction type") + }; + } +} + +public class SorobanAuthorizedContractFunction : SorobanAuthorizedFunction +{ + public InvokeContractHostFunction HostFunction { get; set; } + + public static SorobanAuthorizedFunction FromSorobanAuthorizedFunctionXdr(xdr.SorobanAuthorizedFunction xdrSorobanAuthorizedFunction) + { + if (xdrSorobanAuthorizedFunction.Discriminant.InnerValue != xdr.SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN) + throw new InvalidOperationException("Invalid SorobanAuthorizedFunction type"); + + return new SorobanAuthorizedContractFunction + { + HostFunction = InvokeContractHostFunction.FromXdr(xdrSorobanAuthorizedFunction.ContractFn) + }; + } + + public xdr.SorobanAuthorizedFunction ToSorobanAuthorizedFunctionXdr() + { + return new xdr.SorobanAuthorizedFunction + { + Discriminant = new xdr.SorobanAuthorizedFunctionType + { + InnerValue = xdr.SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN + }, + ContractFn = HostFunction.ToXdr(), + }; + } +} + +public class SorobanAuthorizedCreateContractFunction : SorobanAuthorizedFunction +{ + public CreateContractHostFunction HostFunction { get; set; } + + public static SorobanAuthorizedFunction FromSorobanAuthorizedFunctionXdr(xdr.SorobanAuthorizedFunction xdrSorobanAuthorizedFunction) + { + if (xdrSorobanAuthorizedFunction.Discriminant.InnerValue != xdr.SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN) + throw new InvalidOperationException("Invalid SorobanAuthorizedFunction type"); + + return new SorobanAuthorizedCreateContractFunction + { + HostFunction = CreateContractHostFunction.FromXdr(xdrSorobanAuthorizedFunction.CreateContractHostFn) + }; + } + + public xdr.SorobanAuthorizedFunction ToSorobanAuthorizedFunctionXdr() + { + return new xdr.SorobanAuthorizedFunction + { + Discriminant = new xdr.SorobanAuthorizedFunctionType + { + InnerValue = xdr.SorobanAuthorizedFunctionType.SorobanAuthorizedFunctionTypeEnum.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN + }, + CreateContractHostFn = HostFunction.ToXdr(), + }; + } +} + +public abstract class ContractIDPreimage +{ + public xdr.ContractIDPreimage ToXdr() + { + return this switch + { + ContractIDAddressPreimage fromAddress => fromAddress.ToContractIDPreimageXdr(), + ContractIDAssetPreimage fromAsset => fromAsset.ToContractIDPreimageXdr(), + _ => throw new InvalidOperationException("Unknown ContractIDPreimage type") + }; + } + + public static ContractIDPreimage FromXdr(xdr.ContractIDPreimage xdrContractIDPreimage) + { + return xdrContractIDPreimage.Discriminant.InnerValue switch + { + xdr.ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ADDRESS => ContractIDAddressPreimage.FromContractIDPreimageXdr(xdrContractIDPreimage), + xdr.ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ASSET => ContractIDAssetPreimage.FromContractIDPreimageXdr(xdrContractIDPreimage), + _ => throw new InvalidOperationException("Unknown ContractIDPreimage type") + }; + } +} + +public class ContractIDAddressPreimage : ContractIDPreimage +{ + public SCAddress Address { get; set; } + public Uint256 Salt { get; set; } + + public static ContractIDPreimage FromContractIDPreimageXdr(xdr.ContractIDPreimage xdrContractIDPreimage) + { + if (xdrContractIDPreimage.Discriminant.InnerValue != xdr.ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ADDRESS) + throw new InvalidOperationException("Invalid ContractIDPreimage type"); + + return new ContractIDAddressPreimage + { + Address = SCAddress.FromXdr(xdrContractIDPreimage.FromAddress.Address), + Salt = xdrContractIDPreimage.FromAddress.Salt, + }; + } + + public xdr.ContractIDPreimage ToContractIDPreimageXdr() + { + return new xdr.ContractIDPreimage + { + Discriminant = new xdr.ContractIDPreimageType + { + InnerValue = xdr.ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ADDRESS + }, + FromAddress = new xdr.ContractIDPreimage.ContractIDPreimageFromAddress + { + Address = Address.ToXdr(), + Salt = Salt, + } + }; + } +} + +public class ContractIDAssetPreimage : ContractIDPreimage +{ + public Asset Asset { get; set; } + + public static ContractIDPreimage FromContractIDPreimageXdr(xdr.ContractIDPreimage xdrContractIDPreimage) + { + if (xdrContractIDPreimage.Discriminant.InnerValue != xdr.ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ASSET) + throw new InvalidOperationException("Invalid ContractIDPreimage type"); + + return new ContractIDAssetPreimage + { + Asset = Asset.FromXdr(xdrContractIDPreimage.FromAsset) + }; + } + + public xdr.ContractIDPreimage ToContractIDPreimageXdr() + { + return new xdr.ContractIDPreimage + { + Discriminant = new xdr.ContractIDPreimageType + { + InnerValue = xdr.ContractIDPreimageType.ContractIDPreimageTypeEnum.CONTRACT_ID_PREIMAGE_FROM_ASSET + }, + FromAsset = Asset.ToXdr() + }; + } +} \ No newline at end of file diff --git a/stellar-dotnet-sdk/MuxedAccount.cs b/stellar-dotnet-sdk/MuxedAccount.cs index f3d4c312..a215305d 100644 --- a/stellar-dotnet-sdk/MuxedAccount.cs +++ b/stellar-dotnet-sdk/MuxedAccount.cs @@ -7,16 +7,14 @@ public static class MuxedAccount { public static IAccountId FromXdrMuxedAccount(xdr.MuxedAccount muxedAccount) { - switch (muxedAccount.Discriminant.InnerValue) + return muxedAccount.Discriminant.InnerValue switch { - case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: - return KeyPair.FromPublicKey(muxedAccount.Ed25519.InnerValue); - case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519: - return MuxedAccountMed25519.FromMuxedAccountXdr(muxedAccount.Med25519); - default: - throw new InvalidOperationException("Invalid MuxedAccount type"); - } - + CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519 => KeyPair.FromPublicKey( + muxedAccount.Ed25519.InnerValue), + CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519 => MuxedAccountMed25519.FromMuxedAccountXdr( + muxedAccount.Med25519), + _ => throw new InvalidOperationException("Invalid MuxedAccount type") + }; } } } \ No newline at end of file diff --git a/stellar-dotnet-sdk/Operation.cs b/stellar-dotnet-sdk/Operation.cs index ebab77d6..a71cb7c8 100644 --- a/stellar-dotnet-sdk/Operation.cs +++ b/stellar-dotnet-sdk/Operation.cs @@ -34,6 +34,19 @@ public static string FromXdrAmount(long value) { return Amount.FromXdr(value); } + + /// + /// Creates a new Operation object from the given Operation XDR base64 string. + /// + /// + /// Operation object + public static Operation FromXdrBase64(string xdrBase64) + { + var bytes = Convert.FromBase64String(xdrBase64); + var reader = new XdrDataInputStream(bytes); + var thisXdr = xdr.Operation.Decode(reader); + return FromXdr(thisXdr); + } /// /// Generates Operation XDR object. @@ -83,9 +96,6 @@ public static Operation FromXdr(xdr.Operation thisXdr) case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER: operation = new ManageSellOfferOperation.Builder(body.ManageSellOfferOp).Build(); break; - case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: - operation = new ManageBuyOfferOperation.Builder(body.ManageBuyOfferOp).Build(); - break; case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER: operation = new CreatePassiveSellOfferOperation.Builder(body.CreatePassiveSellOfferOp).Build(); break; @@ -101,14 +111,17 @@ public static Operation FromXdr(xdr.Operation thisXdr) case OperationType.OperationTypeEnum.ACCOUNT_MERGE: operation = new AccountMergeOperation.Builder(body).Build(); break; + case OperationType.OperationTypeEnum.INFLATION: + operation = new InflationOperation.Builder().Build(); + break; case OperationType.OperationTypeEnum.MANAGE_DATA: operation = new ManageDataOperation.Builder(body.ManageDataOp).Build(); break; case OperationType.OperationTypeEnum.BUMP_SEQUENCE: operation = new BumpSequenceOperation.Builder(body.BumpSequenceOp).Build(); break; - case OperationType.OperationTypeEnum.INFLATION: - operation = new InflationOperation.Builder().Build(); + case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER: + operation = new ManageBuyOfferOperation.Builder(body.ManageBuyOfferOp).Build(); break; case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: operation = new PathPaymentStrictSendOperation.Builder(body.PathPaymentStrictSendOp).Build(); @@ -143,6 +156,23 @@ public static Operation FromXdr(xdr.Operation thisXdr) case OperationType.OperationTypeEnum.LIQUIDITY_POOL_WITHDRAW: operation = new LiquidityPoolWithdrawOperation.Builder(body.LiquidityPoolWithdrawOp).Build(); break; + case OperationType.OperationTypeEnum.INVOKE_HOST_FUNCTION: + operation = body.InvokeHostFunctionOp.HostFunction.Discriminant.InnerValue switch + { + HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_INVOKE_CONTRACT => + new InvokeContractOperation.Builder(body.InvokeHostFunctionOp).Build(), + HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_CREATE_CONTRACT => + new CreateContractOperation.Builder(body.InvokeHostFunctionOp).Build(), + HostFunctionType.HostFunctionTypeEnum.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM => + new UploadContractOperation.Builder(body.InvokeHostFunctionOp).Build(), + }; + break; + case OperationType.OperationTypeEnum.EXTEND_FOOTPRINT_TTL: + operation = new ExtendFootprintOperation.Builder(body.ExtendFootprintTTLOp).Build(); + break; + case OperationType.OperationTypeEnum.RESTORE_FOOTPRINT: + operation = new RestoreFootprintOperation.Builder(body.RestoreFootprintOp).Build(); + break; default: throw new Exception("Unknown operation body " + body.Discriminant.InnerValue); } diff --git a/stellar-dotnet-sdk/RestoreFootprintOperation.cs b/stellar-dotnet-sdk/RestoreFootprintOperation.cs new file mode 100644 index 00000000..fa31aab9 --- /dev/null +++ b/stellar-dotnet-sdk/RestoreFootprintOperation.cs @@ -0,0 +1,101 @@ +using System; +using stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk; + +/// +/// Operation that restores a footprint +/// +public class RestoreFootprintOperation : Operation +{ + public ExtensionPoint ExtensionPoint { get; set; } + + /// + /// Creates a new RestoreFootprintOperation object from the given base64-encoded XDR Operation. + /// + /// + /// RestoreFootprintOperation object + /// Thrown when the base64-encoded XDR value is invalid. + public static RestoreFootprintOperation FromOperationXdrBase64(string xdrBase64) + { + var operation = FromXdrBase64(xdrBase64); + if (operation == null) + throw new InvalidOperationException("Operation XDR is invalid"); + + if (operation is not RestoreFootprintOperation restoreFootprintOperation) + throw new InvalidOperationException("Operation is not RestoreFootprintOperation"); + return restoreFootprintOperation; + } + + public static RestoreFootprintOperation FromRestoreFootprintOperationXdr(RestoreFootprintOp xdrRestoreFootprintOp) + { + return new RestoreFootprintOperation + { + ExtensionPoint = ExtensionPoint.FromXdr(xdrRestoreFootprintOp.Ext), + }; + } + + public RestoreFootprintOp ToRestoreFootprintOperationXdr() + { + return new RestoreFootprintOp + { + Ext = ExtensionPoint.ToXdr() + }; + } + + public override xdr.Operation.OperationBody ToOperationBody() + { + var body = new xdr.Operation.OperationBody + { + Discriminant = new xdr.OperationType + { + InnerValue = xdr.OperationType.OperationTypeEnum.RESTORE_FOOTPRINT + }, + RestoreFootprintOp = ToRestoreFootprintOperationXdr() + }; + return body; + } + + public class Builder + { + private ExtensionPoint _extensionPoint; + + private KeyPair? _sourceAccount; + + public Builder() + { + } + + public Builder(RestoreFootprintOp operationXdr) + { + _extensionPoint = ExtensionPoint.FromXdr(operationXdr.Ext); + } + + public Builder SetSourceAccount(KeyPair sourceAccount) + { + _sourceAccount = sourceAccount; + return this; + } + + public Builder SetExtensionPoint(ExtensionPoint ext) + { + _extensionPoint = ext; + return this; + } + + public RestoreFootprintOperation Build() + { + if (_extensionPoint == null) + throw new InvalidOperationException("Extension point cannot be null"); + var operation = new RestoreFootprintOperation() + { + ExtensionPoint = _extensionPoint + }; + if (_sourceAccount != null) + { + operation.SourceAccount = _sourceAccount; + } + return operation; + } + } +} diff --git a/stellar-dotnet-sdk/SCVal.cs b/stellar-dotnet-sdk/SCVal.cs new file mode 100644 index 00000000..714faca9 --- /dev/null +++ b/stellar-dotnet-sdk/SCVal.cs @@ -0,0 +1,1390 @@ +using System; +using System.Linq; +using System.Text; +using System.Xml.Schema; +using stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk; + +public abstract class SCVal +{ + public xdr.SCVal ToXdr() + { + return this switch + { + SCBool scBool => scBool.ToSCValXdr(), + SCVoid scVoid => scVoid.ToSCValXdr(), + SCError scError => scError.ToSCValXdr(), + SCUint32 scUint32 => scUint32.ToSCValXdr(), + SCInt32 scInt32 => scInt32.ToSCValXdr(), + SCUint64 scUint64 => scUint64.ToSCValXdr(), + SCInt64 scInt64 => scInt64.ToSCValXdr(), + SCTimePoint scTimePoint => scTimePoint.ToSCValXdr(), + SCDuration scDuration => scDuration.ToSCValXdr(), + SCUint128 scUint128 => scUint128.ToSCValXdr(), + SCInt128 scInt128 => scInt128.ToSCValXdr(), + SCUint256 scUint256 => scUint256.ToSCValXdr(), + SCInt256 scInt256 => scInt256.ToSCValXdr(), + SCBytes scBytes => scBytes.ToSCValXdr(), + SCString scString => scString.ToSCValXdr(), + SCSymbol scSymbol => scSymbol.ToSCValXdr(), + SCVec scVec => scVec.ToSCValXdr(), + SCMap scMap => scMap.ToSCValXdr(), + SCAddress scAddress => scAddress.ToSCValXdr(), + SCContractInstance scContractInstance => scContractInstance.ToSCValXdr(), + SCLedgerKeyContractInstance scLedgerKeyContractInstance => scLedgerKeyContractInstance.ToSCValXdr(), + SCNonceKey scNonceKey => scNonceKey.ToSCValXdr(), + _ => throw new InvalidOperationException("Unknown SCVal type") + }; + } + + public static SCVal FromXdr(xdr.SCVal xdrVal) + { + return xdrVal.Discriminant.InnerValue switch + { + SCValType.SCValTypeEnum.SCV_BOOL => SCBool.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_VOID => SCVoid.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_ERROR => SCError.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_U32 => SCUint32.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_I32 => SCInt32.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_U64 => SCUint64.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_I64 => SCInt64.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_TIMEPOINT => SCTimePoint.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_DURATION => SCDuration.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_U128 => SCUint128.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_I128 => SCInt128.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_U256 => SCUint256.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_I256 => SCInt256.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_BYTES => SCBytes.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_STRING => SCString.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_SYMBOL => SCSymbol.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_VEC => SCVec.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_MAP => SCMap.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_ADDRESS => SCAddress.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_CONTRACT_INSTANCE => SCContractInstance.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_LEDGER_KEY_CONTRACT_INSTANCE => SCLedgerKeyContractInstance.FromSCValXdr(xdrVal), + SCValType.SCValTypeEnum.SCV_LEDGER_KEY_NONCE => SCNonceKey.FromSCValXdr(xdrVal), + _ => throw new InvalidOperationException("Unknown SCVal type") + }; + } + + /// + /// Creates a new SCVal object from the given SCVal XDR base64 string. + /// + /// + /// SCVal object + public static SCVal FromXdrBase64(string xdrBase64) + { + var bytes = Convert.FromBase64String(xdrBase64); + var reader = new XdrDataInputStream(bytes); + var thisXdr = xdr.SCVal.Decode(reader); + return FromXdr(thisXdr); + } + + /// + /// Returns base64-encoded SCVal XDR object. + /// + public string ToXdrBase64() + { + var xdrValue = ToXdr(); + var writer = new XdrDataOutputStream(); + xdr.SCVal.Encode(writer, xdrValue); + return Convert.ToBase64String(writer.ToArray()); + } +} + +public class SCBool : SCVal +{ + public SCBool(bool value) + { + InnerValue = value; + } + public bool InnerValue { get; set; } + + public new bool ToXdr() + { + return InnerValue; + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_BOOL, + }, + B = ToXdr(), + }; + } + + public static SCBool FromXdr(bool xdrBool) + { + return new SCBool(xdrBool); + } + + public static SCBool FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_BOOL) + throw new ArgumentException("Not an SCBool", nameof(xdrVal)); + + return FromXdr(xdrVal.B); + } +} + +public class SCVoid : SCVal +{ + public new void ToXdr() { } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_VOID, + }, + }; + } + + public static SCVoid FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_VOID) + throw new ArgumentException("Not an SCVoid", nameof(xdrVal)); + + return FromXdr(); + } + + public static SCVoid FromXdr() + { + return new SCVoid(); + } +} + +public abstract class SCError : SCVal +{ + public SCErrorCode.SCErrorCodeEnum Code { get; set; } + public xdr.SCError ToXdr() + { + return this switch + { + SCContractError scContractError => scContractError.ToSCErrorXdr(), + SCWasmVmError scWasmVmError => scWasmVmError.ToSCErrorXdr(), + SCContextError scContextError => scContextError.ToSCErrorXdr(), + SCStorageError scStorageError => scStorageError.ToSCErrorXdr(), + SCObjectError scObjectError => scObjectError.ToSCErrorXdr(), + SCCryptoError scCryptoError => scCryptoError.ToSCErrorXdr(), + SCEventsError scEventsError => scEventsError.ToSCErrorXdr(), + SCBudgetError scBudgetError => scBudgetError.ToSCErrorXdr(), + SCValueError scValueError => scValueError.ToSCErrorXdr(), + SCAuthError scAuthError => scAuthError.ToSCErrorXdr(), + _ => throw new InvalidOperationException("Unknown SCVal type") + }; + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_ERROR, + }, + Error = ToXdr(), + }; + } + + public static SCError FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_ERROR) + throw new ArgumentException("Not an SCError", nameof(xdrVal)); + + return FromXdr(xdrVal.Error); + } + + public static SCError FromXdr(xdr.SCError xdrSCError) + { + return xdrSCError.Discriminant.InnerValue switch + { + SCErrorType.SCErrorTypeEnum.SCE_CONTRACT => SCContractError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_WASM_VM => SCWasmVmError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_CONTEXT => SCContextError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_STORAGE => SCStorageError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_OBJECT => SCObjectError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_CRYPTO => SCCryptoError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_EVENTS => SCEventsError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_BUDGET => SCBudgetError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_VALUE => SCValueError.FromSCErrorXdr(xdrSCError), + SCErrorType.SCErrorTypeEnum.SCE_AUTH => SCAuthError.FromSCErrorXdr(xdrSCError), + _ => throw new InvalidOperationException("Unknown SCError type") + }; + } +} + +public class SCContractError : SCError +{ + public SCContractError(uint value) + { + ContractCode = value; + } + public uint ContractCode { get; set; } + + public static SCContractError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCContractError(xdrSCError.ContractCode.InnerValue); + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_CONTRACT, + }, + ContractCode = new xdr.Uint32(ContractCode), + }; + } +} + +public class SCWasmVmError : SCError +{ + public static SCWasmVmError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCWasmVmError() + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_WASM_VM, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCContextError : SCError +{ + public static SCContextError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCContextError() + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_CONTEXT, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCStorageError : SCError +{ + public static SCStorageError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCStorageError() + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_STORAGE, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCObjectError : SCError +{ + public static SCObjectError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCObjectError + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_OBJECT, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCCryptoError : SCError +{ + public static SCCryptoError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCCryptoError + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_CRYPTO, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCEventsError : SCError +{ + public static SCEventsError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCEventsError + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_EVENTS, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCBudgetError : SCError +{ + public static SCBudgetError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCBudgetError + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_BUDGET, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCValueError : SCError +{ + public static SCValueError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCValueError() + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_VALUE, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCAuthError : SCError +{ + public static SCAuthError FromSCErrorXdr(xdr.SCError xdrSCError) + { + return new SCAuthError + { + Code = xdrSCError.Code.InnerValue + }; + } + + public xdr.SCError ToSCErrorXdr() + { + return new xdr.SCError + { + Discriminant = new xdr.SCErrorType + { + InnerValue = xdr.SCErrorType.SCErrorTypeEnum.SCE_AUTH, + }, + Code = SCErrorCode.Create(Code) + }; + } +} + +public class SCUint32 : SCVal +{ + public SCUint32(uint value) + { + InnerValue = value; + } + + public uint InnerValue { get; set; } + + public xdr.Uint32 ToXdr() + { + return new Uint32(InnerValue); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_U32, + }, + U32 = ToXdr(), + }; + } + + public static SCUint32 FromXdr(xdr.Uint32 xdrUint32) + { + return new SCUint32(xdrUint32.InnerValue); + } + + public static SCUint32 FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_U32) + throw new ArgumentException("Not an SCUint32", nameof(xdrVal)); + + return FromXdr(xdrVal.U32); + } +} + +public class SCInt32 : SCVal +{ + public SCInt32(int value) + { + InnerValue = value; + } + + public int InnerValue { get; set; } + + public xdr.Int32 ToXdr() + { + return new xdr.Int32(InnerValue); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_I32, + }, + I32 = ToXdr(), + }; + } + + public static SCInt32 FromXdr(xdr.Int32 xdrInt32) + { + return new SCInt32(xdrInt32.InnerValue); + } + + public static SCInt32 FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_I32) + throw new ArgumentException("Not an SCInt32", nameof(xdrVal)); + + return FromXdr(xdrVal.I32); + } +} + +public class SCUint64 : SCVal +{ + public ulong InnerValue { get; set; } + + public xdr.Uint64 ToXdr() + { + return new xdr.Uint64(InnerValue); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_U64, + }, + U64 = ToXdr(), + }; + } + + public static SCUint64 FromXdr(xdr.Uint64 xdrUint64) + { + return new SCUint64 + { + InnerValue = xdrUint64.InnerValue, + }; + } + + public static SCUint64 FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_U64) + throw new ArgumentException("Not an SCUint64", nameof(xdrVal)); + + return FromXdr(xdrVal.U64); + } +} + +public class SCInt64 : SCVal +{ + public SCInt64(long value) + { + InnerValue = value; + } + + public long InnerValue { get; set; } + + public xdr.Int64 ToXdr() + { + return new xdr.Int64(InnerValue); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_I64, + }, + I64 = ToXdr(), + }; + } + + public static SCInt64 FromXdr(xdr.Int64 xdrInt64) + { + return new SCInt64(xdrInt64.InnerValue); + } + + public static SCInt64 FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_I64) + throw new ArgumentException("Not an SCInt64", nameof(xdrVal)); + + return FromXdr(xdrVal.I64); + } +} + +public class SCTimePoint : SCVal +{ + public SCTimePoint(ulong value) + { + InnerValue = value; + } + + public ulong InnerValue { get; set; } + + public xdr.TimePoint ToXdr() + { + return new xdr.TimePoint(new xdr.Uint64(InnerValue)); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_TIMEPOINT, + }, + Timepoint = ToXdr(), + }; + } + + public static SCTimePoint FromXdr(xdr.TimePoint xdrTimePoint) + { + return new SCTimePoint(xdrTimePoint.InnerValue.InnerValue); + } + + public static SCTimePoint FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_TIMEPOINT) + throw new ArgumentException("Not an SCTimePoint", nameof(xdrVal)); + + return FromXdr(xdrVal.Timepoint); + } +} + +public class SCDuration : SCVal +{ + public SCDuration(ulong value) + { + InnerValue = value; + } + + public ulong InnerValue { get; set; } + + public xdr.Duration ToXdr() + { + return new xdr.Duration(new xdr.Uint64(InnerValue)); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_DURATION, + }, + Duration = ToXdr(), + }; + } + + public static SCDuration FromXdr(xdr.Duration xdrDuration) + { + return new SCDuration(xdrDuration.InnerValue.InnerValue); + } + + public static SCDuration FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_DURATION) + throw new ArgumentException("Not an SCDuration", nameof(xdrVal)); + + return FromXdr(xdrVal.Duration); + } +} + +public class SCUint128 : SCVal +{ + public ulong Lo { get; set; } + public ulong Hi { get; set; } + + public xdr.UInt128Parts ToXdr() + { + return new xdr.UInt128Parts + { + Lo = new xdr.Uint64(Lo), + Hi = new xdr.Uint64(Hi), + }; + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_U128, + }, + U128 = ToXdr(), + }; + } + + public static SCUint128 FromXdr(xdr.UInt128Parts xdrUInt128Parts) + { + return new SCUint128 + { + Lo = xdrUInt128Parts.Lo.InnerValue, + Hi = xdrUInt128Parts.Hi.InnerValue, + }; + } + + public static SCUint128 FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_U128) + throw new ArgumentException("Not an SCUint128", nameof(xdrVal)); + + return FromXdr(xdrVal.U128); + } +} + +public class SCInt128 : SCVal +{ + public ulong Lo { get; set; } + public long Hi { get; set; } + + public xdr.Int128Parts ToXdr() + { + return new xdr.Int128Parts + { + Lo = new xdr.Uint64(Lo), + Hi = new xdr.Int64(Hi), + }; + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_I128, + }, + I128 = new xdr.Int128Parts + { + Hi = new xdr.Int64(Hi), + Lo = new xdr.Uint64(Lo), + }, + }; + } + + public static SCInt128 FromXdr(xdr.Int128Parts xdrInt128Parts) + { + return new SCInt128 + { + Lo = xdrInt128Parts.Lo.InnerValue, + Hi = xdrInt128Parts.Hi.InnerValue, + }; + } + + public static SCInt128 FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_I128) + throw new ArgumentException("Not an SCInt128", nameof(xdrVal)); + + return new SCInt128 + { + Hi = xdrVal.I128.Hi.InnerValue, + Lo = xdrVal.I128.Lo.InnerValue, + }; + } +} + +public class SCUint256 : SCVal +{ + public ulong HiHi { get; set; } + public ulong HiLo { get; set; } + public ulong LoHi { get; set; } + public ulong LoLo { get; set; } + + public xdr.UInt256Parts ToXdr() + { + return new xdr.UInt256Parts + { + HiHi = new xdr.Uint64(HiHi), + HiLo = new xdr.Uint64(HiLo), + LoHi = new xdr.Uint64(LoHi), + LoLo = new xdr.Uint64(LoLo), + }; + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_U256, + }, + U256 = ToXdr(), + }; + } + + public static SCUint256 FromXdr(xdr.UInt256Parts xdrUInt256Parts) + { + return new SCUint256 + { + HiHi = xdrUInt256Parts.HiHi.InnerValue, + HiLo = xdrUInt256Parts.HiLo.InnerValue, + LoHi = xdrUInt256Parts.LoHi.InnerValue, + LoLo = xdrUInt256Parts.LoLo.InnerValue, + }; + } + + public static SCUint256 FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_U256) + throw new ArgumentException("Not an SCUint256", nameof(xdrVal)); + + return FromXdr(xdrVal.U256); + } +} + +public class SCInt256 : SCVal +{ + public long HiHi { get; set; } + public ulong HiLo { get; set; } + public ulong LoHi { get; set; } + public ulong LoLo { get; set; } + + public xdr.Int256Parts ToXdr() + { + return new xdr.Int256Parts + { + HiHi = new xdr.Int64(HiHi), + HiLo = new xdr.Uint64(HiLo), + LoHi = new xdr.Uint64(LoHi), + LoLo = new xdr.Uint64(LoLo), + }; + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_I256, + }, + I256 = ToXdr(), + }; + } + + public static SCInt256 FromXdr(xdr.Int256Parts xdrInt256Parts) + { + return new SCInt256 + { + HiHi = xdrInt256Parts.HiHi.InnerValue, + HiLo = xdrInt256Parts.HiLo.InnerValue, + LoHi = xdrInt256Parts.LoHi.InnerValue, + LoLo = xdrInt256Parts.LoLo.InnerValue, + }; + } + + public static SCInt256 FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_I256) + throw new ArgumentException("Not an SCInt256", nameof(xdrVal)); + + return FromXdr(xdrVal.I256); + } +} + +public class SCBytes : SCVal +{ + public SCBytes(byte[] value) + { + InnerValue = value; + } + public byte[] InnerValue { get; set; } + + public xdr.SCBytes ToXdr() + { + return new xdr.SCBytes(InnerValue); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_BYTES, + }, + Bytes = ToXdr(), + }; + } + + public static SCBytes FromXdr(xdr.SCBytes xdrSCBytes) + { + return new SCBytes(xdrSCBytes.InnerValue); + } + + public static SCBytes FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_BYTES) + throw new ArgumentException("Not an SCBytes", nameof(xdrVal)); + + return FromXdr(xdrVal.Bytes); + } +} + +public class SCString : SCVal +{ + public SCString(string value) + { + InnerValue = value; + } + + public string InnerValue { get; set; } + + public xdr.SCString ToXdr() + { + return new xdr.SCString(InnerValue); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_STRING, + }, + Str = ToXdr(), + }; + } + + public static SCString FromXdr(xdr.SCString xdrSCString) + { + return new SCString(xdrSCString.InnerValue); + } + + public static SCString FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_STRING) + throw new ArgumentException("Not an SCString", nameof(xdrVal)); + + return FromXdr(xdrVal.Str); + } +} + +public class SCSymbol : SCVal +{ + public SCSymbol(string innerValue) + { + InnerValue = innerValue; + } + + public string InnerValue { get; set; } + + public xdr.SCSymbol ToXdr() + { + return new xdr.SCSymbol(InnerValue); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_SYMBOL, + }, + Sym = ToXdr(), + }; + } + + public static SCSymbol FromXdr(xdr.SCSymbol xdrSCSymbol) + { + return new SCSymbol(xdrSCSymbol.InnerValue); + } + + public static SCSymbol FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_SYMBOL) + throw new ArgumentException("Not an SCSymbol", nameof(xdrVal)); + + return FromXdr(xdrVal.Sym); + } +} + +public class SCVec : SCVal +{ + public SCVec(SCVal[] value) + { + InnerValue = value; + } + + public SCVal[] InnerValue { get; set; } + + public xdr.SCVec ToXdr() + { + return new xdr.SCVec(InnerValue.Select(a => a.ToXdr()).ToArray()); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_VEC, + }, + Vec = ToXdr(), + }; + } + + public static SCVec FromXdr(xdr.SCVec xdrSCVec) + { + return new SCVec(xdrSCVec.InnerValue.Select(SCVal.FromXdr).ToArray()); + } + + public static SCVec FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_VEC) + throw new ArgumentException("Not an SCVec", nameof(xdrVal)); + + return FromXdr(xdrVal.Vec); + } +} + +public class SCMap : SCVal +{ + public SCMapEntry[] Entries { get; set; } = Array.Empty(); + + public xdr.SCMap ToXdr() + { + return Entries.Length == 0 ? new xdr.SCMap { InnerValue = Array.Empty() } : new xdr.SCMap(Entries.Select(a => a.ToXdr()).ToArray()); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_MAP, + }, + Map = ToXdr(), + }; + } + + public static SCMap FromXdr(xdr.SCMap xdrSCMap) + { + if (xdrSCMap == null) return new SCMap(); + return new SCMap + { + Entries = xdrSCMap.InnerValue.Select(SCMapEntry.FromXdr).ToArray(), + }; + } + + public static SCMap FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_MAP) + throw new ArgumentException("Not an SCMap", nameof(xdrVal)); + + return FromXdr(xdrVal.Map); + } +} + +public class SCMapEntry +{ + public SCVal Key { get; set; } + public SCVal Value { get; set; } + + public static SCMapEntry FromXdr(xdr.SCMapEntry xdr) + { + return new SCMapEntry + { + Key = SCVal.FromXdr(xdr.Key), + Value = SCVal.FromXdr(xdr.Val), + }; + } + + public xdr.SCMapEntry ToXdr() + { + return new xdr.SCMapEntry + { + Key = Key.ToXdr(), + Val = Value.ToXdr(), + }; + } +} + +public abstract class SCAddress : SCVal +{ + public static SCAddress FromXdr(xdr.SCAddress xdrSCAddress) + { + return xdrSCAddress.Discriminant.InnerValue switch + { + SCAddressType.SCAddressTypeEnum.SC_ADDRESS_TYPE_ACCOUNT => SCAccountId.FromXdr(xdrSCAddress), + SCAddressType.SCAddressTypeEnum.SC_ADDRESS_TYPE_CONTRACT => SCContractId.FromXdr(xdrSCAddress), + }; + } + + public static SCAddress FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_ADDRESS) + throw new ArgumentException("Not an SCAddress", nameof(xdrVal)); + + return FromXdr(xdrVal.Address); + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_ADDRESS, + }, + Address = ToXdr(), + }; + } + + public abstract xdr.SCAddress ToXdr(); +} + + +public class SCAccountId : SCAddress +{ + public SCAccountId(string value) + { + if (!StrKey.IsValidEd25519PublicKey(value)) + throw new ArgumentException("Invalid account id", nameof(value)); + + InnerValue = value; + } + + public string InnerValue { get; set; } + + public static SCAccountId FromXdr(xdr.SCAddress xdr) + { + return new SCAccountId( + KeyPair.FromXdrPublicKey(xdr.AccountId.InnerValue).AccountId); + } + + public override xdr.SCAddress ToXdr() + { + return new xdr.SCAddress + { + Discriminant = new xdr.SCAddressType + { + InnerValue = xdr.SCAddressType.SCAddressTypeEnum.SC_ADDRESS_TYPE_ACCOUNT, + }, + AccountId = new xdr.AccountID(KeyPair.FromAccountId(InnerValue).XdrPublicKey), + }; + } +} + +public class SCContractId : SCAddress +{ + public SCContractId(string value) + { + if (!StrKey.IsValidContractId(value)) + throw new ArgumentException("Invalid contract id", nameof(value)); + + InnerValue = value; + } + + public string InnerValue { get; } + + public static SCContractId FromXdr(xdr.SCAddress xdr) + { + var value = StrKey.EncodeContractId(xdr.ContractId.InnerValue); + + if (!StrKey.IsValidContractId(value)) + throw new InvalidOperationException("Invalid contract id"); + + return new SCContractId(value); + } + + public override xdr.SCAddress ToXdr() + { + if (!StrKey.IsValidContractId(InnerValue)) + throw new InvalidOperationException("Invalid contract id"); + + return new xdr.SCAddress + { + Discriminant = new xdr.SCAddressType + { + InnerValue = xdr.SCAddressType.SCAddressTypeEnum.SC_ADDRESS_TYPE_CONTRACT, + }, + ContractId = new xdr.Hash(StrKey.DecodeContractId(InnerValue)) + }; + } +} + +public class SCLedgerKeyContractInstance : SCVal +{ + public void ToXdr() { } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_LEDGER_KEY_CONTRACT_INSTANCE, + }, + }; + } + + public static SCLedgerKeyContractInstance FromXdr() + { + return new SCLedgerKeyContractInstance(); + } + + public static SCLedgerKeyContractInstance FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_LEDGER_KEY_CONTRACT_INSTANCE) + throw new ArgumentException("Not an SCLedgerKeyContractInstance", nameof(xdrVal)); + + return FromXdr(); + } +} + +public class SCContractInstance : SCVal +{ + public ContractExecutable Executable { get; set; } + public SCMap Storage { get; set; } = new(); + + public static SCContractInstance FromXdr(xdr.SCContractInstance xdr) + { + return new SCContractInstance + { + Executable = ContractExecutable.FromXdr(xdr.Executable), + Storage = SCMap.FromXdr(xdr.Storage), + }; + } + + public static SCContractInstance FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_CONTRACT_INSTANCE) + throw new ArgumentException("Not an SCContractInstance", nameof(xdrVal)); + + return FromXdr(xdrVal.Instance); + } + + public xdr.SCContractInstance ToXdr() + { + return new xdr.SCContractInstance + { + Executable = Executable.ToXdr(), + Storage = Storage.ToXdr(), + }; + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_CONTRACT_INSTANCE, + }, + Instance = ToXdr(), + }; + } +} + +public abstract class ContractExecutable +{ + public static ContractExecutable FromXdr(xdr.ContractExecutable xdrContractExecutable) + { + return xdrContractExecutable.Discriminant.InnerValue switch + { + ContractExecutableType.ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_WASM => ContractExecutableWasm.FromXdr(xdrContractExecutable), + ContractExecutableType.ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_STELLAR_ASSET => ContractExecutableStellarAsset.FromXdr(xdrContractExecutable) + }; + } + public abstract xdr.ContractExecutable ToXdr(); +} + +public class ContractExecutableWasm : ContractExecutable +{ + public string WasmHash { get; set; } + + public ContractExecutableWasm(string value) + { + WasmHash = value; + } + + public static ContractExecutableWasm FromXdr(xdr.ContractExecutable xdr) + { + return new ContractExecutableWasm(Convert.ToBase64String(xdr.WasmHash.InnerValue)); + } + + public override xdr.ContractExecutable ToXdr() + { + return new xdr.ContractExecutable + { + Discriminant = new xdr.ContractExecutableType() + { + InnerValue = xdr.ContractExecutableType.ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_WASM, + }, + WasmHash = new Hash(Convert.FromBase64String(WasmHash)), + }; + } +} + +public class ContractExecutableStellarAsset : ContractExecutable +{ + public static ContractExecutableStellarAsset FromXdr(xdr.ContractExecutable xdr) + { + return new ContractExecutableStellarAsset(); + } + + public override xdr.ContractExecutable ToXdr() + { + return new xdr.ContractExecutable + { + Discriminant = new xdr.ContractExecutableType() + { + InnerValue = xdr.ContractExecutableType.ContractExecutableTypeEnum.CONTRACT_EXECUTABLE_STELLAR_ASSET, + } + }; + } +} + +public class SCNonceKey : SCVal +{ + public SCNonceKey(long value) + { + Nonce = value; + } + + public long Nonce { get; set; } + + public xdr.SCNonceKey ToXdr() + { + return new xdr.SCNonceKey + { + Nonce = new xdr.Int64(Nonce), + }; + } + + public xdr.SCVal ToSCValXdr() + { + return new xdr.SCVal + { + Discriminant = new xdr.SCValType + { + InnerValue = xdr.SCValType.SCValTypeEnum.SCV_LEDGER_KEY_NONCE, + }, + NonceKey = ToXdr(), + }; + } + + public static SCNonceKey FromXdr(xdr.SCNonceKey xdr) + { + return new SCNonceKey(xdr.Nonce.InnerValue); + } + + public static SCNonceKey FromSCValXdr(xdr.SCVal xdrVal) + { + if (xdrVal.Discriminant.InnerValue != SCValType.SCValTypeEnum.SCV_LEDGER_KEY_NONCE) + throw new ArgumentException("Not an SCNonceKey", nameof(xdrVal)); + + return FromXdr(xdrVal.NonceKey); + } +} diff --git a/stellar-dotnet-sdk/SetOptionsOperation.cs b/stellar-dotnet-sdk/SetOptionsOperation.cs index ff22691d..012b5b16 100644 --- a/stellar-dotnet-sdk/SetOptionsOperation.cs +++ b/stellar-dotnet-sdk/SetOptionsOperation.cs @@ -53,6 +53,24 @@ public override OperationThreshold Threshold get => OperationThreshold.High; } + /// + /// Creates a new SetOptionsOperation object from the given base64-encoded XDR Operation. + /// + /// + /// SetOptionsOperation object + /// Thrown when the base64-encoded XDR value is invalid. + public static SetOptionsOperation FromOperationXdrBase64(string xdrBase64) + { + var operation = Operation.FromXdrBase64(xdrBase64); + if (operation == null) + throw new InvalidOperationException("Operation XDR is invalid"); + + if (operation is not SetOptionsOperation setOptionsOperation) + throw new InvalidOperationException("Operation is not SetOptionsOperation"); + + return setOptionsOperation; + } + public override sdkxdr.Operation.OperationBody ToOperationBody() { var op = new sdkxdr.SetOptionsOp(); diff --git a/stellar-dotnet-sdk/SorobanAuthorizationEntry.cs b/stellar-dotnet-sdk/SorobanAuthorizationEntry.cs new file mode 100644 index 00000000..5704239e --- /dev/null +++ b/stellar-dotnet-sdk/SorobanAuthorizationEntry.cs @@ -0,0 +1,3 @@ +using stellar_dotnet_sdk.xdr; + +namespace stellar_dotnet_sdk; diff --git a/stellar-dotnet-sdk/StrKey.cs b/stellar-dotnet-sdk/StrKey.cs index d260ee00..c85a582c 100644 --- a/stellar-dotnet-sdk/StrKey.cs +++ b/stellar-dotnet-sdk/StrKey.cs @@ -14,7 +14,8 @@ public enum VersionByte : byte SEED = 18 << 3, PRE_AUTH_TX = 19 << 3, SHA256_HASH = 23 << 3, - SIGNED_PAYLOAD = 15 << 3 + SIGNED_PAYLOAD = 15 << 3, + CONTRACT = 2 << 3, } public static string EncodeStellarAccountId(byte[] data) @@ -61,6 +62,11 @@ public static string EncodeStellarSecretSeed(byte[] data) { return EncodeCheck(VersionByte.SEED, data); } + + public static string EncodeContractId(byte[] data) + { + return EncodeCheck(VersionByte.CONTRACT, data); + } public static byte[] DecodeStellarAccountId(string data) { @@ -133,6 +139,11 @@ public static byte[] DecodeStellarSecretSeed(string data) { return DecodeCheck(VersionByte.SEED, data); } + + public static byte[] DecodeContractId(string data) + { + return DecodeCheck(VersionByte.CONTRACT, data); + } public static VersionByte DecodeVersionByte(string encoded) { @@ -246,6 +257,11 @@ public static bool IsValidEd25519SecretSeed(string seed) { return IsValid(VersionByte.SEED, seed); } + + public static bool IsValidContractId(string contract) + { + return IsValid(VersionByte.CONTRACT, contract); + } private static byte[] CheckedBase32Decode(string encoded) { diff --git a/stellar-dotnet-sdk/stellar-dotnet-sdk.csproj b/stellar-dotnet-sdk/stellar-dotnet-sdk.csproj index d03f70cc..e9d2ddb8 100644 --- a/stellar-dotnet-sdk/stellar-dotnet-sdk.csproj +++ b/stellar-dotnet-sdk/stellar-dotnet-sdk.csproj @@ -34,7 +34,7 @@ - + @@ -47,5 +47,6 @@ +