├── .gitattributes ├── .gitignore ├── .travis.yml ├── Chaos.NaCl ├── .editorconfig ├── .gitignore ├── Chaos.NaCl.Benchmark │ ├── BenchmarkProgram.cs │ ├── Chaos.NaCl.Benchmark.csproj │ ├── Cpu.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Chaos.NaCl.Benchmark32 │ ├── App.config │ ├── Chaos.NaCl.Benchmark32.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Chaos.NaCl.Tests │ ├── ArrayTests.cs │ ├── Chaos.NaCl.Tests.csproj │ ├── CryptoBytesTest.cs │ ├── Ed25519TestVectors.cs │ ├── Ed25519Tests.cs │ ├── InternalAssertTests.cs │ ├── MontgomeryCurve25519TestVectors.cs │ ├── MontgomeryCurve25519Tests.cs │ ├── Poly1305Tests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SalsaCoreTests.cs │ ├── Sha512Tests.cs │ ├── TestHelpers.cs │ └── XSalsa20Poly1305Tests.cs ├── Chaos.NaCl.sln ├── Chaos.NaCl │ ├── Chaos.NaCl-Portable.csproj │ ├── Chaos.NaCl.csproj │ ├── CryptoBytes.cs │ ├── Ed25519.cs │ ├── Internal │ │ ├── Array16.cs │ │ ├── Array8.cs │ │ ├── ByteIntegerConverter.cs │ │ ├── Ed25519Ref10 │ │ │ ├── FieldElement.cs │ │ │ ├── GroupElement.cs │ │ │ ├── base.cs │ │ │ ├── base2.cs │ │ │ ├── d.cs │ │ │ ├── d2.cs │ │ │ ├── fe_0.cs │ │ │ ├── fe_1.cs │ │ │ ├── fe_add.cs │ │ │ ├── fe_cmov.cs │ │ │ ├── fe_cswap.cs │ │ │ ├── fe_frombytes.cs │ │ │ ├── fe_invert.cs │ │ │ ├── fe_isnegative.cs │ │ │ ├── fe_isnonzero.cs │ │ │ ├── fe_mul.cs │ │ │ ├── fe_mul121666.cs │ │ │ ├── fe_neg.cs │ │ │ ├── fe_pow22523.cs │ │ │ ├── fe_sq.cs │ │ │ ├── fe_sq2.cs │ │ │ ├── fe_sub.cs │ │ │ ├── fe_tobytes.cs │ │ │ ├── ge_add.cs │ │ │ ├── ge_double_scalarmult.cs │ │ │ ├── ge_frombytes.cs │ │ │ ├── ge_madd.cs │ │ │ ├── ge_msub.cs │ │ │ ├── ge_p1p1_to_p2.cs │ │ │ ├── ge_p1p1_to_p3.cs │ │ │ ├── ge_p2_0.cs │ │ │ ├── ge_p2_dbl.cs │ │ │ ├── ge_p3_0.cs │ │ │ ├── ge_p3_dbl.cs │ │ │ ├── ge_p3_to_cached.cs │ │ │ ├── ge_p3_to_p2.cs │ │ │ ├── ge_p3_tobytes.cs │ │ │ ├── ge_precomp_0.cs │ │ │ ├── ge_scalarmult_base.cs │ │ │ ├── ge_sub.cs │ │ │ ├── ge_tobytes.cs │ │ │ ├── keypair.cs │ │ │ ├── open.cs │ │ │ ├── sc_clamp.cs │ │ │ ├── sc_mul_add.cs │ │ │ ├── sc_reduce.cs │ │ │ ├── scalarmult.cs │ │ │ ├── sign.cs │ │ │ └── sqrtm1.cs │ │ ├── InternalAssert.cs │ │ ├── Poly1305Donna.cs │ │ ├── Salsa │ │ │ ├── Salsa20.cs │ │ │ ├── SalsaCore.cs │ │ │ └── replace regex.txt │ │ └── Sha512Internal.cs │ ├── MontgomeryCurve25519.cs │ ├── OneTimeAuth.cs │ ├── Poly1305.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── AssemblyInfoFull.cs │ ├── Sha512.cs │ └── XSalsa20Poly1305.cs ├── License.txt └── readme.md ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README.md ├── Rakefile ├── csharp-stellar-base.sln ├── src ├── Examples │ ├── App.config │ ├── Examples.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── csharp-stellar-base │ ├── Account.cs │ ├── ArrayExtensions.cs │ ├── Asset.cs │ ├── Base32Encoding.cs │ ├── ChangeTrustOperation.cs │ ├── CreateAccountOperation.cs │ ├── KeyPair.cs │ ├── Memo.cs │ ├── Network.cs │ ├── NotEnoughSignaturesException.cs │ ├── One.cs │ ├── Operation.cs │ ├── PaymentOperation.cs │ ├── Preconditions.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── StrKey.cs │ ├── Transaction.cs │ ├── TransactionBuilderAccount.cs │ ├── Utilities.cs │ ├── csharp-stellar-base.csproj │ └── packages.config └── generated │ ├── AccountEntry.cs │ ├── AccountFlags.cs │ ├── AccountID.cs │ ├── AccountMergeResult.cs │ ├── AccountMergeResultCode.cs │ ├── AllowTrustOp.cs │ ├── AllowTrustResult.cs │ ├── AllowTrustResultCode.cs │ ├── Asset.cs │ ├── AssetType.cs │ ├── Auth.cs │ ├── AuthCert.cs │ ├── AuthenticatedMessage.cs │ ├── BucketEntry.cs │ ├── BucketEntryType.cs │ ├── ByteReader.cs │ ├── ByteWriter.cs │ ├── ChangeTrustOp.cs │ ├── ChangeTrustResult.cs │ ├── ChangeTrustResultCode.cs │ ├── ClaimOfferAtom.cs │ ├── CreateAccountOp.cs │ ├── CreateAccountResult.cs │ ├── CreateAccountResultCode.cs │ ├── CreatePassiveOfferOp.cs │ ├── CryptoKeyType.cs │ ├── Curve25519Public.cs │ ├── Curve25519Secret.cs │ ├── DataEntry.cs │ ├── DataValue.cs │ ├── DecoratedSignature.cs │ ├── DontHave.cs │ ├── EnvelopeType.cs │ ├── Error.cs │ ├── ErrorCode.cs │ ├── Hash.cs │ ├── Hello.cs │ ├── HmacSha256Key.cs │ ├── HmacSha256Mac.cs │ ├── IByteReader.cs │ ├── IByteWriter.cs │ ├── IPAddrType.cs │ ├── InflationPayout.cs │ ├── InflationResult.cs │ ├── InflationResultCode.cs │ ├── Int32.cs │ ├── Int64.cs │ ├── LedgerEntry.cs │ ├── LedgerEntryChange.cs │ ├── LedgerEntryChangeType.cs │ ├── LedgerEntryChanges.cs │ ├── LedgerEntryType.cs │ ├── LedgerHeader.cs │ ├── LedgerHeaderHistoryEntry.cs │ ├── LedgerKey.cs │ ├── LedgerSCPMessages.cs │ ├── LedgerUpgrade.cs │ ├── LedgerUpgradeType.cs │ ├── ManageDataOp.cs │ ├── ManageDataResult.cs │ ├── ManageDataResultCode.cs │ ├── ManageOfferEffect.cs │ ├── ManageOfferOp.cs │ ├── ManageOfferResult.cs │ ├── ManageOfferResultCode.cs │ ├── ManageOfferSuccessResult.cs │ ├── Memo.cs │ ├── MemoType.cs │ ├── MessageType.cs │ ├── NodeID.cs │ ├── OfferEntry.cs │ ├── OfferEntryFlags.cs │ ├── Operation.cs │ ├── OperationMeta.cs │ ├── OperationResult.cs │ ├── OperationResultCode.cs │ ├── OperationType.cs │ ├── PathPaymentOp.cs │ ├── PathPaymentResult.cs │ ├── PathPaymentResultCode.cs │ ├── PaymentOp.cs │ ├── PaymentResult.cs │ ├── PaymentResultCode.cs │ ├── PeerAddress.cs │ ├── Price.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── PublicKey.cs │ ├── PublicKeyType.cs │ ├── SCPBallot.cs │ ├── SCPEnvelope.cs │ ├── SCPHistoryEntry.cs │ ├── SCPHistoryEntryV0.cs │ ├── SCPNomination.cs │ ├── SCPQuorumSet.cs │ ├── SCPStatement.cs │ ├── SCPStatementType.cs │ ├── SequenceNumber.cs │ ├── SetOptionsOp.cs │ ├── SetOptionsResult.cs │ ├── SetOptionsResultCode.cs │ ├── Signature.cs │ ├── SignatureHint.cs │ ├── Signer.cs │ ├── SignerKey.cs │ ├── SignerKeyType.cs │ ├── SimplePaymentResult.cs │ ├── StellarMessage.cs │ ├── StellarValue.cs │ ├── String32.cs │ ├── String64.cs │ ├── ThresholdIndexes.cs │ ├── Thresholds.cs │ ├── TimeBounds.cs │ ├── Transaction.cs │ ├── TransactionEnvelope.cs │ ├── TransactionHistoryEntry.cs │ ├── TransactionHistoryResultEntry.cs │ ├── TransactionMeta.cs │ ├── TransactionResult.cs │ ├── TransactionResultCode.cs │ ├── TransactionResultPair.cs │ ├── TransactionResultSet.cs │ ├── TransactionSet.cs │ ├── TransactionSignaturePayload.cs │ ├── TrustLineEntry.cs │ ├── TrustLineFlags.cs │ ├── Uint256.cs │ ├── Uint32.cs │ ├── Uint64.cs │ ├── UpgradeType.cs │ ├── Value.cs │ ├── XdrEncoding.cs │ └── generated.csproj ├── tasks └── xdr.rake ├── tests └── csharp-stellar-base.Tests │ ├── AssetTests.cs │ ├── ConversionTests.cs │ ├── KeyPairTests.cs │ ├── MemoTests.cs │ ├── NetworkTests.cs │ ├── OperationTests.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── StrKeyTests.cs │ ├── TransactionTests.cs │ ├── csharp-stellar-base.Tests.csproj │ └── packages.config └── xdr ├── Stellar-SCP.x ├── Stellar-ledger-entries.x ├── Stellar-ledger.x ├── Stellar-overlay.x ├── Stellar-transaction.x └── Stellar-types.x /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | solution: csharp-stellar-base.sln 3 | install: 4 | - nuget restore csharp-stellar-base.sln 5 | - nuget install NUnit.ConsoleRunner -Version 3.7.0 -OutputDirectory testrunner 6 | script: 7 | - xbuild /p:Configuration=Release csharp-stellar-base.sln 8 | - mono ./testrunner/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe ./tests/csharp-stellar-base.Tests/bin/Release/csharp-stellar-base.Tests.dll -------------------------------------------------------------------------------- /Chaos.NaCl/.editorconfig: -------------------------------------------------------------------------------- 1 | ; Top-most EditorConfig file 2 | root = true 3 | 4 | ; 4-column space indentation 5 | [*.cs] 6 | indent_style = space 7 | indent_size = 4 -------------------------------------------------------------------------------- /Chaos.NaCl/.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.user 3 | *.ncb 4 | *.vsp 5 | .svn/ 6 | bin/ 7 | obj/ 8 | Debug/ 9 | Release/ 10 | TestResults/ -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Benchmark/Cpu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Management; 6 | using System.Text; 7 | 8 | namespace Chaos.NaCl.Benchmark 9 | { 10 | class Cpu 11 | { 12 | public static uint CpuFreq = GetMaxCpuFreq(); 13 | 14 | private const uint CpuFreqFallback = 2901; 15 | 16 | public static void Setup() 17 | { 18 | Process.GetCurrentProcess().ProcessorAffinity = (IntPtr)1; 19 | Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime; 20 | } 21 | 22 | private static uint GetCpuFreq(string name) 23 | { 24 | try 25 | { 26 | using (ManagementBaseObject mo = new ManagementObject("Win32_Processor.DeviceID='CPU0'")) 27 | { 28 | return (uint)(mo[name]); 29 | } 30 | } 31 | catch (Exception) 32 | { 33 | Console.WriteLine("Could not get CPU Frequency"); 34 | return CpuFreqFallback; 35 | } 36 | } 37 | 38 | static uint GetCurrentCpuFreq() 39 | { 40 | return GetCpuFreq("CurrentClockSpeed"); 41 | } 42 | 43 | public static uint GetMaxCpuFreq() 44 | { 45 | return GetCpuFreq("MaxClockSpeed"); 46 | } 47 | 48 | public static void CheckCurrentCpuFreq() 49 | { 50 | var currentFreq = GetCurrentCpuFreq(); 51 | if (currentFreq != CpuFreq) 52 | Console.WriteLine("Current CPU-Frequency: {0} MHz differs from max", currentFreq); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Benchmark/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Chaos.NaCl.Benchmark")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Chaos.NaCl.Benchmark")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d34889e9-87b3-4220-9c2a-a0e5ceb4415d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Benchmark32/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Benchmark32/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Chaos.NaCl.Benchmark; 5 | 6 | namespace Chaos.NaCl.Benchmark32 7 | { 8 | class Program 9 | { 10 | static void Main() 11 | { 12 | BenchmarkProgram.Main(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Benchmark32/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Chaos.NaCl.Benchmark32")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Chaos.NaCl.Benchmark32")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b0982b05-63bc-42d9-8c9b-497c283b28fb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Tests/ArrayTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Chaos.NaCl.Internal; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | 7 | namespace Chaos.NaCl.Tests 8 | { 9 | [TestClass] 10 | public class ArrayTests 11 | { 12 | private static readonly byte[] _testInput = Enumerable.Repeat((byte)0xFF, 100).Concat(Enumerable.Range(1, 250).Select(i => (byte)i)).ToArray(); 13 | 14 | /*[TestMethod] 15 | public void Array8FromBytesLittleEndian() 16 | { 17 | for (int len = 1; len <= 32; len++) 18 | { 19 | Array8 arr; 20 | ByteIntegerConverter.Array8LoadLittleEndian32(out arr, _testInput, 100, len); 21 | byte[] output = new byte[32]; 22 | ByteIntegerConverter.Array8StoreLittleEndian32(output, 0, ref arr); 23 | byte[] expectedOutput = Enumerable.Range(1, len).Select(i => (byte)i).Concat(Enumerable.Repeat((byte)0x00, 32 - len)).ToArray(); 24 | TestHelpers.AssertEqualBytes(expectedOutput, output)); 25 | } 26 | }*/ 27 | 28 | /*[TestMethod] 29 | public void Array16FromBytesLittleEndian() 30 | { 31 | for (int len = 1; len <= 64; len++) 32 | { 33 | Array16 arr; 34 | ByteIntegerConverter.Array16LoadLittleEndian32(out arr, _testInput, 100, len); 35 | byte[] output = new byte[64]; 36 | ByteIntegerConverter.Array16StoreLittleEndian32(output, 0, ref arr); 37 | byte[] expectedOutput = Enumerable.Range(1, len).Select(i => (byte)i).Concat(Enumerable.Repeat((byte)0x00, 64 - len)).ToArray(); 38 | TestHelpers.AssertEqualBytes(expectedOutput, output)); 39 | } 40 | }*/ 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Tests/InternalAssertTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Chaos.NaCl.Internal; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | 7 | namespace Chaos.NaCl.Tests 8 | { 9 | [TestClass] 10 | public class InternalAssertTests 11 | { 12 | [TestMethod] 13 | public void AssertSuccess() 14 | { 15 | InternalAssert.Assert(true, "a"); 16 | } 17 | 18 | [TestMethod] 19 | [ExpectedException(typeof(InvalidOperationException))] 20 | public void AssertFail() 21 | { 22 | InternalAssert.Assert(false, "a"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Tests/Poly1305Tests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace Chaos.NaCl.Tests 7 | { 8 | [TestClass] 9 | class Poly1305Tests 10 | { 11 | [TestMethod] 12 | public void KeySizeIs32() 13 | { 14 | Assert.AreEqual(32, OneTimeAuth.Poly1305.KeySizeInBytes); 15 | } 16 | 17 | [TestMethod] 18 | public void SignatureSizeIs16() 19 | { 20 | Assert.AreEqual(32, OneTimeAuth.Poly1305.SignatureSizeInBytes); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Chaos.NaCl.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Chaos.NaCl.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f7aaf8d7-ad24-45b6-884b-8e1afeed405f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chaos.NaCl", "Chaos.NaCl\Chaos.NaCl.csproj", "{AE28FD14-7985-4707-A963-C94B8597AE50}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chaos.NaCl.Benchmark", "Chaos.NaCl.Benchmark\Chaos.NaCl.Benchmark.csproj", "{28321BA8-C416-4F81-BE4C-1546CD62118B}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chaos.NaCl.Tests", "Chaos.NaCl.Tests\Chaos.NaCl.Tests.csproj", "{433DF668-E178-4F13-A500-4D3609F450B9}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chaos.NaCl.Benchmark32", "Chaos.NaCl.Benchmark32\Chaos.NaCl.Benchmark32.csproj", "{414429EE-D02E-485B-BE58-52DF33CF56AA}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {AE28FD14-7985-4707-A963-C94B8597AE50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {AE28FD14-7985-4707-A963-C94B8597AE50}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {AE28FD14-7985-4707-A963-C94B8597AE50}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {AE28FD14-7985-4707-A963-C94B8597AE50}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {28321BA8-C416-4F81-BE4C-1546CD62118B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {28321BA8-C416-4F81-BE4C-1546CD62118B}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {28321BA8-C416-4F81-BE4C-1546CD62118B}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {28321BA8-C416-4F81-BE4C-1546CD62118B}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {433DF668-E178-4F13-A500-4D3609F450B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {433DF668-E178-4F13-A500-4D3609F450B9}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {433DF668-E178-4F13-A500-4D3609F450B9}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {433DF668-E178-4F13-A500-4D3609F450B9}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {414429EE-D02E-485B-BE58-52DF33CF56AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {414429EE-D02E-485B-BE58-52DF33CF56AA}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {414429EE-D02E-485B-BE58-52DF33CF56AA}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {414429EE-D02E-485B-BE58-52DF33CF56AA}.Release|Any CPU.Build.0 = Release|Any CPU 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Array16.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Chaos.NaCl.Internal 5 | { 6 | // Array16 Salsa20 state 7 | // Array16 SHA-512 block 8 | internal struct Array16 9 | { 10 | public T x0; 11 | public T x1; 12 | public T x2; 13 | public T x3; 14 | public T x4; 15 | public T x5; 16 | public T x6; 17 | public T x7; 18 | public T x8; 19 | public T x9; 20 | public T x10; 21 | public T x11; 22 | public T x12; 23 | public T x13; 24 | public T x14; 25 | public T x15; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Array8.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal 4 | { 5 | // Array8 Poly1305 key 6 | // Array8 SHA-512 state/output 7 | internal struct Array8 8 | { 9 | public T x0; 10 | public T x1; 11 | public T x2; 12 | public T x3; 13 | public T x4; 14 | public T x5; 15 | public T x6; 16 | public T x7; 17 | } 18 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/FieldElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal struct FieldElement 6 | { 7 | internal int x0; 8 | internal int x1; 9 | internal int x2; 10 | internal int x3; 11 | internal int x4; 12 | internal int x5; 13 | internal int x6; 14 | internal int x7; 15 | internal int x8; 16 | internal int x9; 17 | 18 | //public static readonly FieldElement Zero = new FieldElement(); 19 | //public static readonly FieldElement One = new FieldElement() { x0 = 1 }; 20 | 21 | internal FieldElement(params int[] elements) 22 | { 23 | InternalAssert.Assert(elements.Length == 10, "elements.Length != 10"); 24 | x0 = elements[0]; 25 | x1 = elements[1]; 26 | x2 = elements[2]; 27 | x3 = elements[3]; 28 | x4 = elements[4]; 29 | x5 = elements[5]; 30 | x6 = elements[6]; 31 | x7 = elements[7]; 32 | x8 = elements[8]; 33 | x9 = elements[9]; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/GroupElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | /* 6 | ge means group element. 7 | 8 | Here the group is the set of pairs (x,y) of field elements (see fe.h) 9 | satisfying -x^2 + y^2 = 1 + d x^2y^2 10 | where d = -121665/121666. 11 | 12 | Representations: 13 | ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z 14 | ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT 15 | ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T 16 | ge_precomp (Duif): (y+x,y-x,2dxy) 17 | */ 18 | 19 | internal struct GroupElementP2 20 | { 21 | public FieldElement X; 22 | public FieldElement Y; 23 | public FieldElement Z; 24 | } ; 25 | 26 | internal struct GroupElementP3 27 | { 28 | public FieldElement X; 29 | public FieldElement Y; 30 | public FieldElement Z; 31 | public FieldElement T; 32 | } ; 33 | 34 | internal struct GroupElementP1P1 35 | { 36 | public FieldElement X; 37 | public FieldElement Y; 38 | public FieldElement Z; 39 | public FieldElement T; 40 | } ; 41 | 42 | internal struct GroupElementPreComp 43 | { 44 | public FieldElement yplusx; 45 | public FieldElement yminusx; 46 | public FieldElement xy2d; 47 | 48 | public GroupElementPreComp(FieldElement yplusx, FieldElement yminusx, FieldElement xy2d) 49 | { 50 | this.yplusx = yplusx; 51 | this.yminusx = yminusx; 52 | this.xy2d = xy2d; 53 | } 54 | } ; 55 | 56 | internal struct GroupElementCached 57 | { 58 | public FieldElement YplusX; 59 | public FieldElement YminusX; 60 | public FieldElement Z; 61 | public FieldElement T2d; 62 | } ; 63 | } 64 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/d.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class LookupTables 6 | { 7 | internal static FieldElement d = new FieldElement(-10913610, 13857413, -15372611, 6949391, 114729, -8787816, -6275908, -3247719, -18696448, -12055116); 8 | } 9 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/d2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class LookupTables 6 | { 7 | internal static FieldElement d2 = new FieldElement(-21827239, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199); 8 | } 9 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_0.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | public static void fe_0(out FieldElement h) 8 | { 9 | h = default(FieldElement); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | public static void fe_1(out FieldElement h) 8 | { 9 | h = default(FieldElement); 10 | h.x0 = 1; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_add.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | /* 8 | h = f + g 9 | Can overlap h with f or g. 10 | 11 | Preconditions: 12 | |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. 13 | |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. 14 | 15 | Postconditions: 16 | |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. 17 | */ 18 | //void fe_add(fe h,const fe f,const fe g) 19 | internal static void fe_add(out FieldElement h, ref FieldElement f, ref FieldElement g) 20 | { 21 | Int32 f0 = f.x0; 22 | Int32 f1 = f.x1; 23 | Int32 f2 = f.x2; 24 | Int32 f3 = f.x3; 25 | Int32 f4 = f.x4; 26 | Int32 f5 = f.x5; 27 | Int32 f6 = f.x6; 28 | Int32 f7 = f.x7; 29 | Int32 f8 = f.x8; 30 | Int32 f9 = f.x9; 31 | Int32 g0 = g.x0; 32 | Int32 g1 = g.x1; 33 | Int32 g2 = g.x2; 34 | Int32 g3 = g.x3; 35 | Int32 g4 = g.x4; 36 | Int32 g5 = g.x5; 37 | Int32 g6 = g.x6; 38 | Int32 g7 = g.x7; 39 | Int32 g8 = g.x8; 40 | Int32 g9 = g.x9; 41 | Int32 h0 = f0 + g0; 42 | Int32 h1 = f1 + g1; 43 | Int32 h2 = f2 + g2; 44 | Int32 h3 = f3 + g3; 45 | Int32 h4 = f4 + g4; 46 | Int32 h5 = f5 + g5; 47 | Int32 h6 = f6 + g6; 48 | Int32 h7 = f7 + g7; 49 | Int32 h8 = f8 + g8; 50 | Int32 h9 = f9 + g9; 51 | h.x0 = h0; 52 | h.x1 = h1; 53 | h.x2 = h2; 54 | h.x3 = h3; 55 | h.x4 = h4; 56 | h.x5 = h5; 57 | h.x6 = h6; 58 | h.x7 = h7; 59 | h.x8 = h8; 60 | h.x9 = h9; 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_cmov.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | /* 8 | Replace (f,g) with (g,g) if b == 1; 9 | replace (f,g) with (f,g) if b == 0. 10 | 11 | Preconditions: b in {0,1}. 12 | */ 13 | 14 | //void fe_cmov(fe f,const fe g,unsigned int b) 15 | internal static void fe_cmov(ref FieldElement f, ref FieldElement g, int b) 16 | { 17 | Int32 f0 = f.x0; 18 | Int32 f1 = f.x1; 19 | Int32 f2 = f.x2; 20 | Int32 f3 = f.x3; 21 | Int32 f4 = f.x4; 22 | Int32 f5 = f.x5; 23 | Int32 f6 = f.x6; 24 | Int32 f7 = f.x7; 25 | Int32 f8 = f.x8; 26 | Int32 f9 = f.x9; 27 | Int32 g0 = g.x0; 28 | Int32 g1 = g.x1; 29 | Int32 g2 = g.x2; 30 | Int32 g3 = g.x3; 31 | Int32 g4 = g.x4; 32 | Int32 g5 = g.x5; 33 | Int32 g6 = g.x6; 34 | Int32 g7 = g.x7; 35 | Int32 g8 = g.x8; 36 | Int32 g9 = g.x9; 37 | Int32 x0 = f0 ^ g0; 38 | Int32 x1 = f1 ^ g1; 39 | Int32 x2 = f2 ^ g2; 40 | Int32 x3 = f3 ^ g3; 41 | Int32 x4 = f4 ^ g4; 42 | Int32 x5 = f5 ^ g5; 43 | Int32 x6 = f6 ^ g6; 44 | Int32 x7 = f7 ^ g7; 45 | Int32 x8 = f8 ^ g8; 46 | Int32 x9 = f9 ^ g9; 47 | b = -b; 48 | x0 &= b; 49 | x1 &= b; 50 | x2 &= b; 51 | x3 &= b; 52 | x4 &= b; 53 | x5 &= b; 54 | x6 &= b; 55 | x7 &= b; 56 | x8 &= b; 57 | x9 &= b; 58 | f.x0 = f0 ^ x0; 59 | f.x1 = f1 ^ x1; 60 | f.x2 = f2 ^ x2; 61 | f.x3 = f3 ^ x3; 62 | f.x4 = f4 ^ x4; 63 | f.x5 = f5 ^ x5; 64 | f.x6 = f6 ^ x6; 65 | f.x7 = f7 ^ x7; 66 | f.x8 = f8 ^ x8; 67 | f.x9 = f9 ^ x9; 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_cswap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | /* 8 | Replace (f,g) with (g,f) if b == 1; 9 | replace (f,g) with (f,g) if b == 0. 10 | 11 | Preconditions: b in {0,1}. 12 | */ 13 | public static void fe_cswap(ref FieldElement f, ref FieldElement g, uint b) 14 | { 15 | Int32 f0 = f.x0; 16 | Int32 f1 = f.x1; 17 | Int32 f2 = f.x2; 18 | Int32 f3 = f.x3; 19 | Int32 f4 = f.x4; 20 | Int32 f5 = f.x5; 21 | Int32 f6 = f.x6; 22 | Int32 f7 = f.x7; 23 | Int32 f8 = f.x8; 24 | Int32 f9 = f.x9; 25 | Int32 g0 = g.x0; 26 | Int32 g1 = g.x1; 27 | Int32 g2 = g.x2; 28 | Int32 g3 = g.x3; 29 | Int32 g4 = g.x4; 30 | Int32 g5 = g.x5; 31 | Int32 g6 = g.x6; 32 | Int32 g7 = g.x7; 33 | Int32 g8 = g.x8; 34 | Int32 g9 = g.x9; 35 | Int32 x0 = f0 ^ g0; 36 | Int32 x1 = f1 ^ g1; 37 | Int32 x2 = f2 ^ g2; 38 | Int32 x3 = f3 ^ g3; 39 | Int32 x4 = f4 ^ g4; 40 | Int32 x5 = f5 ^ g5; 41 | Int32 x6 = f6 ^ g6; 42 | Int32 x7 = f7 ^ g7; 43 | Int32 x8 = f8 ^ g8; 44 | Int32 x9 = f9 ^ g9; 45 | int negb = unchecked((int)-b); 46 | x0 &= negb; 47 | x1 &= negb; 48 | x2 &= negb; 49 | x3 &= negb; 50 | x4 &= negb; 51 | x5 &= negb; 52 | x6 &= negb; 53 | x7 &= negb; 54 | x8 &= negb; 55 | x9 &= negb; 56 | f.x0 = f0 ^ x0; 57 | f.x1 = f1 ^ x1; 58 | f.x2 = f2 ^ x2; 59 | f.x3 = f3 ^ x3; 60 | f.x4 = f4 ^ x4; 61 | f.x5 = f5 ^ x5; 62 | f.x6 = f6 ^ x6; 63 | f.x7 = f7 ^ x7; 64 | f.x8 = f8 ^ x8; 65 | f.x9 = f9 ^ x9; 66 | g.x0 = g0 ^ x0; 67 | g.x1 = g1 ^ x1; 68 | g.x2 = g2 ^ x2; 69 | g.x3 = g3 ^ x3; 70 | g.x4 = g4 ^ x4; 71 | g.x5 = g5 ^ x5; 72 | g.x6 = g6 ^ x6; 73 | g.x7 = g7 ^ x7; 74 | g.x8 = g8 ^ x8; 75 | g.x9 = g9 ^ x9; 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_isnegative.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | /* 8 | return 1 if f is in {1,3,5,...,q-2} 9 | return 0 if f is in {0,2,4,...,q-1} 10 | 11 | Preconditions: 12 | |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. 13 | */ 14 | //int fe_isnegative(const fe f) 15 | public static int fe_isnegative(ref FieldElement f) 16 | { 17 | FieldElement fr; 18 | fe_reduce(out fr, ref f); 19 | return fr.x0 & 1; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_isnonzero.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | /* 8 | return 1 if f == 0 9 | return 0 if f != 0 10 | 11 | Preconditions: 12 | |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. 13 | */ 14 | // Todo: Discuss this with upstream 15 | // Above comment is from the original code. But I believe the original code returned 16 | // 0 if f == 0 17 | // -1 if f != 0 18 | // This code actually returns 0 if f==0 and 1 if f != 0 19 | internal static int fe_isnonzero(ref FieldElement f) 20 | { 21 | FieldElement fr; 22 | fe_reduce(out fr, ref f); 23 | int differentBits = 0; 24 | differentBits |= fr.x0; 25 | differentBits |= fr.x1; 26 | differentBits |= fr.x2; 27 | differentBits |= fr.x3; 28 | differentBits |= fr.x4; 29 | differentBits |= fr.x5; 30 | differentBits |= fr.x6; 31 | differentBits |= fr.x7; 32 | differentBits |= fr.x8; 33 | differentBits |= fr.x9; 34 | return (int)((unchecked((uint)differentBits - 1) >> 31) ^ 1); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_mul121666.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | 8 | /* 9 | h = f * 121666 10 | Can overlap h with f. 11 | 12 | Preconditions: 13 | |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. 14 | 15 | Postconditions: 16 | |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. 17 | */ 18 | 19 | public static void fe_mul121666(out FieldElement h, ref FieldElement f) 20 | { 21 | Int32 f0 = f.x0; 22 | Int32 f1 = f.x1; 23 | Int32 f2 = f.x2; 24 | Int32 f3 = f.x3; 25 | Int32 f4 = f.x4; 26 | Int32 f5 = f.x5; 27 | Int32 f6 = f.x6; 28 | Int32 f7 = f.x7; 29 | Int32 f8 = f.x8; 30 | Int32 f9 = f.x9; 31 | Int64 h0 = f0 * (Int64)121666; 32 | Int64 h1 = f1 * (Int64)121666; 33 | Int64 h2 = f2 * (Int64)121666; 34 | Int64 h3 = f3 * (Int64)121666; 35 | Int64 h4 = f4 * (Int64)121666; 36 | Int64 h5 = f5 * (Int64)121666; 37 | Int64 h6 = f6 * (Int64)121666; 38 | Int64 h7 = f7 * (Int64)121666; 39 | Int64 h8 = f8 * (Int64)121666; 40 | Int64 h9 = f9 * (Int64)121666; 41 | Int64 carry0; 42 | Int64 carry1; 43 | Int64 carry2; 44 | Int64 carry3; 45 | Int64 carry4; 46 | Int64 carry5; 47 | Int64 carry6; 48 | Int64 carry7; 49 | Int64 carry8; 50 | Int64 carry9; 51 | 52 | carry9 = (h9 + (Int64)(1 << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25; 53 | carry1 = (h1 + (Int64)(1 << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25; 54 | carry3 = (h3 + (Int64)(1 << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25; 55 | carry5 = (h5 + (Int64)(1 << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25; 56 | carry7 = (h7 + (Int64)(1 << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25; 57 | 58 | carry0 = (h0 + (Int64)(1 << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26; 59 | carry2 = (h2 + (Int64)(1 << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26; 60 | carry4 = (h4 + (Int64)(1 << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26; 61 | carry6 = (h6 + (Int64)(1 << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26; 62 | carry8 = (h8 + (Int64)(1 << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26; 63 | 64 | h.x0 = (int)h0; 65 | h.x1 = (int)h1; 66 | h.x2 = (int)h2; 67 | h.x3 = (int)h3; 68 | h.x4 = (int)h4; 69 | h.x5 = (int)h5; 70 | h.x6 = (int)h6; 71 | h.x7 = (int)h7; 72 | h.x8 = (int)h8; 73 | h.x9 = (int)h9; 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_neg.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | /* 8 | h = -f 9 | 10 | Preconditions: 11 | |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. 12 | 13 | Postconditions: 14 | |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. 15 | */ 16 | internal static void fe_neg(out FieldElement h, ref FieldElement f) 17 | { 18 | Int32 f0 = f.x0; 19 | Int32 f1 = f.x1; 20 | Int32 f2 = f.x2; 21 | Int32 f3 = f.x3; 22 | Int32 f4 = f.x4; 23 | Int32 f5 = f.x5; 24 | Int32 f6 = f.x6; 25 | Int32 f7 = f.x7; 26 | Int32 f8 = f.x8; 27 | Int32 f9 = f.x9; 28 | Int32 h0 = -f0; 29 | Int32 h1 = -f1; 30 | Int32 h2 = -f2; 31 | Int32 h3 = -f3; 32 | Int32 h4 = -f4; 33 | Int32 h5 = -f5; 34 | Int32 h6 = -f6; 35 | Int32 h7 = -f7; 36 | Int32 h8 = -f8; 37 | Int32 h9 = -f9; 38 | h.x0 = h0; 39 | h.x1 = h1; 40 | h.x2 = h2; 41 | h.x3 = h3; 42 | h.x4 = h4; 43 | h.x5 = h5; 44 | h.x6 = h6; 45 | h.x7 = h7; 46 | h.x8 = h8; 47 | h.x9 = h9; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/fe_sub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class FieldOperations 6 | { 7 | /* 8 | h = f - g 9 | Can overlap h with f or g. 10 | 11 | Preconditions: 12 | |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. 13 | |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. 14 | 15 | Postconditions: 16 | |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. 17 | */ 18 | 19 | internal static void fe_sub(out FieldElement h, ref FieldElement f, ref FieldElement g) 20 | { 21 | Int32 f0 = f.x0; 22 | Int32 f1 = f.x1; 23 | Int32 f2 = f.x2; 24 | Int32 f3 = f.x3; 25 | Int32 f4 = f.x4; 26 | Int32 f5 = f.x5; 27 | Int32 f6 = f.x6; 28 | Int32 f7 = f.x7; 29 | Int32 f8 = f.x8; 30 | Int32 f9 = f.x9; 31 | Int32 g0 = g.x0; 32 | Int32 g1 = g.x1; 33 | Int32 g2 = g.x2; 34 | Int32 g3 = g.x3; 35 | Int32 g4 = g.x4; 36 | Int32 g5 = g.x5; 37 | Int32 g6 = g.x6; 38 | Int32 g7 = g.x7; 39 | Int32 g8 = g.x8; 40 | Int32 g9 = g.x9; 41 | Int32 h0 = f0 - g0; 42 | Int32 h1 = f1 - g1; 43 | Int32 h2 = f2 - g2; 44 | Int32 h3 = f3 - g3; 45 | Int32 h4 = f4 - g4; 46 | Int32 h5 = f5 - g5; 47 | Int32 h6 = f6 - g6; 48 | Int32 h7 = f7 - g7; 49 | Int32 h8 = f8 - g8; 50 | Int32 h9 = f9 - g9; 51 | h.x0 = h0; 52 | h.x1 = h1; 53 | h.x2 = h2; 54 | h.x3 = h3; 55 | h.x4 = h4; 56 | h.x5 = h5; 57 | h.x6 = h6; 58 | h.x7 = h7; 59 | h.x8 = h8; 60 | h.x9 = h9; 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/ge_frombytes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class GroupOperations 6 | { 7 | public static int ge_frombytes_negate_vartime(out GroupElementP3 h, byte[] data, int offset) 8 | { 9 | FieldElement u; 10 | FieldElement v; 11 | FieldElement v3; 12 | FieldElement vxx; 13 | FieldElement check; 14 | 15 | FieldOperations.fe_frombytes(out h.Y, data, offset); 16 | FieldOperations.fe_1(out h.Z); 17 | FieldOperations.fe_sq(out u, ref h.Y); 18 | FieldOperations.fe_mul(out v, ref u, ref LookupTables.d); 19 | FieldOperations.fe_sub(out u, ref u, ref h.Z); /* u = y^2-1 */ 20 | FieldOperations.fe_add(out v, ref v, ref h.Z); /* v = dy^2+1 */ 21 | 22 | FieldOperations.fe_sq(out v3, ref v); 23 | FieldOperations.fe_mul(out v3, ref v3, ref v); /* v3 = v^3 */ 24 | FieldOperations.fe_sq(out h.X, ref v3); 25 | FieldOperations.fe_mul(out h.X, ref h.X, ref v); 26 | FieldOperations.fe_mul(out h.X, ref h.X, ref u); /* x = uv^7 */ 27 | 28 | FieldOperations.fe_pow22523(out h.X, ref h.X); /* x = (uv^7)^((q-5)/8) */ 29 | FieldOperations.fe_mul(out h.X, ref h.X, ref v3); 30 | FieldOperations.fe_mul(out h.X, ref h.X, ref u); /* x = uv^3(uv^7)^((q-5)/8) */ 31 | 32 | FieldOperations.fe_sq(out vxx, ref h.X); 33 | FieldOperations.fe_mul(out vxx, ref vxx, ref v); 34 | FieldOperations.fe_sub(out check, ref vxx, ref u); /* vx^2-u */ 35 | if (FieldOperations.fe_isnonzero(ref check) != 0) 36 | { 37 | FieldOperations.fe_add(out check, ref vxx, ref u); /* vx^2+u */ 38 | if (FieldOperations.fe_isnonzero(ref check) != 0) 39 | { 40 | h = default(GroupElementP3); 41 | return -1; 42 | } 43 | FieldOperations.fe_mul(out h.X, ref h.X, ref LookupTables.sqrtm1); 44 | } 45 | 46 | if (FieldOperations.fe_isnegative(ref h.X) == (data[offset + 31] >> 7)) 47 | FieldOperations.fe_neg(out h.X, ref h.X); 48 | 49 | FieldOperations.fe_mul(out h.T, ref h.X, ref h.Y); 50 | return 0; 51 | } 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/ge_p1p1_to_p2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class GroupOperations 6 | { 7 | /* 8 | r = p 9 | */ 10 | public static void ge_p1p1_to_p2(out GroupElementP2 r, ref GroupElementP1P1 p) 11 | { 12 | FieldOperations.fe_mul(out r.X, ref p.X, ref p.T); 13 | FieldOperations.fe_mul(out r.Y, ref p.Y, ref p.Z); 14 | FieldOperations.fe_mul(out r.Z, ref p.Z, ref p.T); 15 | } 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/ge_p1p1_to_p3.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class GroupOperations 6 | { 7 | /* 8 | r = p 9 | */ 10 | public static void ge_p1p1_to_p3(out GroupElementP3 r, ref GroupElementP1P1 p) 11 | { 12 | FieldOperations.fe_mul(out r.X, ref p.X, ref p.T); 13 | FieldOperations.fe_mul(out r.Y, ref p.Y, ref p.Z); 14 | FieldOperations.fe_mul(out r.Z, ref p.Z, ref p.T); 15 | FieldOperations.fe_mul(out r.T, ref p.X, ref p.Y); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/ge_p2_0.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class GroupOperations 6 | { 7 | public static void ge_p2_0(out GroupElementP2 h) 8 | { 9 | FieldOperations.fe_0(out h.X); 10 | FieldOperations.fe_1(out h.Y); 11 | FieldOperations.fe_1(out h.Z); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Internal/Ed25519Ref10/ge_p2_dbl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl.Internal.Ed25519Ref10 4 | { 5 | internal static partial class GroupOperations 6 | { 7 | /* 8 | r = 2 * p 9 | */ 10 | 11 | public static void ge_p2_dbl(out GroupElementP1P1 r, ref GroupElementP2 p) 12 | { 13 | FieldElement t0; 14 | 15 | /* qhasm: enter ge_p2_dbl */ 16 | 17 | /* qhasm: fe X1 */ 18 | 19 | /* qhasm: fe Y1 */ 20 | 21 | /* qhasm: fe Z1 */ 22 | 23 | /* qhasm: fe A */ 24 | 25 | /* qhasm: fe AA */ 26 | 27 | /* qhasm: fe XX */ 28 | 29 | /* qhasm: fe YY */ 30 | 31 | /* qhasm: fe B */ 32 | 33 | /* qhasm: fe X3 */ 34 | 35 | /* qhasm: fe Y3 */ 36 | 37 | /* qhasm: fe Z3 */ 38 | 39 | /* qhasm: fe T3 */ 40 | 41 | /* qhasm: XX=X1^2 */ 42 | /* asm 1: fe_sq(>XX=fe#1,XX=r.X,YY=fe#3,YY=r.Z,B=fe#4,B=r.T,A=fe#2,A=r.Y,AA=fe#5,AA=t0,Y3=fe#2,Y3=r.Y,Z3=fe#3,Z3=r.Z,X3=fe#1,X3=r.X,T3=fe#4,T3=r.T,> (32 - \3)); -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/OneTimeAuth.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Chaos.NaCl 4 | { 5 | public abstract class OneTimeAuth 6 | { 7 | private static readonly Poly1305 _poly1305 = new Poly1305(); 8 | 9 | public abstract int KeySizeInBytes { get; } 10 | public abstract int SignatureSizeInBytes { get; } 11 | 12 | public abstract byte[] Sign(byte[] message, byte[] key); 13 | public abstract void Sign(ArraySegment signature, ArraySegment message, ArraySegment key); 14 | public abstract bool Verify(byte[] signature, byte[] message, byte[] key); 15 | public abstract bool Verify(ArraySegment signature, ArraySegment message, ArraySegment key); 16 | 17 | public static OneTimeAuth Poly1305 { get { return _poly1305; } } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Chaos.NaCl")] 8 | [assembly: AssemblyDescription("C# port of the NaCl cryptography library")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("CodesInChaos")] 11 | [assembly: AssemblyProduct("Chaos.NaCl cryptography library")] 12 | [assembly: AssemblyCopyright("public domain")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Version information for an assembly consists of the following four values: 17 | // 18 | // Major Version 19 | // Minor Version 20 | // Build Number 21 | // Revision 22 | // 23 | // You can specify all the values or you can default the Build and Revision Numbers 24 | // by using the '*' as shown below: 25 | // [assembly: AssemblyVersion("1.0.*")] 26 | [assembly: AssemblyVersion("0.1.0.0")] 27 | [assembly: AssemblyFileVersion("0.1.0.0")] 28 | 29 | [assembly: InternalsVisibleTo("Chaos.NaCl.Tests")] 30 | [assembly: InternalsVisibleTo("Chaos.NaCl.Benchmark")] -------------------------------------------------------------------------------- /Chaos.NaCl/Chaos.NaCl/Properties/AssemblyInfoFull.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | // Setting ComVisible to false makes the types in this assembly not visible 4 | // to COM components. If you need to access a type in this assembly from 5 | // COM, set the ComVisible attribute to true on that type. 6 | [assembly: ComVisible(false)] 7 | 8 | // The following GUID is for the ID of the typelib if this project is exposed to COM 9 | [assembly: Guid("f07e7dd1-d31c-4994-8948-e42de7ef16ec")] -------------------------------------------------------------------------------- /Chaos.NaCl/License.txt: -------------------------------------------------------------------------------- 1 | Public domain 2 | 3 | C# port + code by Christian Winnerlein (CodesInChaos) 4 | 5 | Poly1305 in c 6 | written by Andrew M. (floodyberry) 7 | original license: MIT or PUBLIC DOMAIN 8 | https://github.com/floodyberry/poly1305-donna/blob/master/poly1305-donna-unrolled.c 9 | 10 | Curve25519 and Ed25519 in c 11 | written by Dan Bernstein (djb) 12 | public domain 13 | from Ref10 in SUPERCOP http://bench.cr.yp.to/supercop.html 14 | 15 | (H)Salsa20 in c 16 | written by Dan Bernstein (djb) 17 | public domain 18 | from SUPERCOP http://bench.cr.yp.to/supercop.html 19 | 20 | SHA512 21 | written by Christian Winnerlein (CodesInChaos) 22 | public domain 23 | directly from the specification -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :development do 4 | gem "xdrgen", git: "https://github.com/QuantozTechnology/xdrgen.git", branch: "14632af" 5 | end 6 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: https://github.com/QuantozTechnology/xdrgen.git 3 | revision: 14632afdb3751d1c86f1373540496a907b335995 4 | branch: 14632af 5 | specs: 6 | xdrgen (0.0.1) 7 | activesupport (~> 5) 8 | memoist (~> 0.11.0) 9 | slop (~> 3.4) 10 | treetop (~> 1.5.3) 11 | 12 | GEM 13 | remote: https://rubygems.org/ 14 | specs: 15 | activesupport (5.1.4) 16 | concurrent-ruby (~> 1.0, >= 1.0.2) 17 | i18n (~> 0.7) 18 | minitest (~> 5.1) 19 | tzinfo (~> 1.1) 20 | concurrent-ruby (1.0.5) 21 | i18n (0.9.1) 22 | concurrent-ruby (~> 1.0) 23 | memoist (0.11.0) 24 | minitest (5.10.3) 25 | polyglot (0.3.5) 26 | slop (3.6.0) 27 | thread_safe (0.3.6) 28 | treetop (1.5.3) 29 | polyglot (~> 0.3) 30 | tzinfo (1.2.4) 31 | thread_safe (~> 0.1) 32 | 33 | PLATFORMS 34 | ruby 35 | 36 | DEPENDENCIES 37 | xdrgen! 38 | 39 | BUNDLED WITH 40 | 1.15.4 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ** Deprecated ** 2 | This SDK does not support Horizon 0.17.0 3 | A more actively maintained SDK for .NET Core can be found here: https://github.com/elucidsoft/dotnet-stellar-sdk 4 | 5 | 6 | ## csharp-stellar-base 7 | Quick and dirty library to create, encode and decode Stellar transactions 8 | 9 | 10 | ## Dependencies 11 | - .NET 2.0 12 | 13 | ## Usage 14 | - Open in project Visual Studio (tested in VS 2015) 15 | - Build Solution 16 | 17 | ## Tests 18 | - Run self tests using [TEST] -> Run -> All tests 19 | - or [Ctrl+R], A 20 | 21 | ## Generate code (LINUX commandline) 22 | use ruby > 2.2.6 23 | run: 24 | ``` 25 | bundle 26 | rake xdr:generate 27 | ``` 28 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | Bundler.setup 2 | 3 | Dir["tasks/**/*.rake"].each{|f| load f} 4 | -------------------------------------------------------------------------------- /src/Examples/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Examples/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Examples")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Examples")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("712fa40b-c1e6-43ae-83da-3bea5d6851d8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Examples/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/Account.cs: -------------------------------------------------------------------------------- 1 | using static Stellar.Preconditions; 2 | 3 | namespace Stellar 4 | { 5 | public class Account : ITransactionBuilderAccount 6 | { 7 | public KeyPair KeyPair 8 | { 9 | get; 10 | private set; 11 | } 12 | 13 | public long SequenceNumber 14 | { 15 | get; 16 | private set; 17 | } 18 | 19 | public Account(KeyPair keyPair, long sequenceNumber) 20 | { 21 | this.KeyPair = CheckNotNull(keyPair, "keyPair cannot be null."); 22 | this.SequenceNumber = sequenceNumber; 23 | } 24 | 25 | public void IncrementSequenceNumber() 26 | { 27 | SequenceNumber++; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/ArrayExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Stellar 8 | { 9 | public static class ArrayExtensions 10 | { 11 | public static bool IsIdentical(this byte[] a1, byte[] a2) 12 | { 13 | if (a1.Length != a2.Length) 14 | { 15 | return false; 16 | } 17 | 18 | for (int i = 0; i < a1.Length; i++) 19 | { 20 | if (a1[i] != a2[i]) 21 | { 22 | return false; 23 | } 24 | } 25 | return true; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/Network.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Cryptography; 2 | using System.Text; 3 | 4 | namespace Stellar 5 | { 6 | public static class Network 7 | { 8 | public static string CurrentNetwork { get; set; } = ""; 9 | public static byte[] CurrentNetworkId 10 | { 11 | get 12 | { 13 | SHA256 mySHA256 = SHA256Managed.Create(); 14 | byte[] bytes = Encoding.Default.GetBytes(CurrentNetwork); 15 | return mySHA256.ComputeHash(bytes); 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/csharp-stellar-base/NotEnoughSignaturesException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stellar 4 | { 5 | public class NotEnoughSignaturesException : Exception 6 | { 7 | public NotEnoughSignaturesException() 8 | : base() 9 | { 10 | 11 | } 12 | 13 | public NotEnoughSignaturesException(string message) 14 | : base(message) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/One.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Stellar 8 | { 9 | public class One 10 | { 11 | public static readonly int Value = 10000000; 12 | 13 | public static implicit operator double(One d) 14 | { 15 | return 1.0; 16 | } 17 | 18 | public static implicit operator long(One d) 19 | { 20 | return Value; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/Preconditions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stellar 4 | { 5 | public static class Preconditions 6 | { 7 | /// 8 | /// Ensures that an object reference passed as a parameter to the calling method is not null. 9 | /// 10 | /// an object reference 11 | /// the exception message to use if the check fails 12 | /// the non-null reference that was validated 13 | /// if reference is null 14 | public static T CheckNotNull(T reference, string errorMessage) 15 | { 16 | if (reference == null) 17 | { 18 | throw new NullReferenceException(errorMessage); 19 | } 20 | 21 | return reference; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("csharp-stellar-core")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("csharp-stellar-core")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("4be09292-f507-4ee2-8ad3-c5983f72a734")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/TransactionBuilderAccount.cs: -------------------------------------------------------------------------------- 1 | namespace Stellar 2 | { 3 | public interface ITransactionBuilderAccount 4 | { 5 | KeyPair KeyPair { get; } 6 | 7 | long SequenceNumber { get; } 8 | 9 | void IncrementSequenceNumber(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Cryptography; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Stellar 9 | { 10 | public static class Utilities 11 | { 12 | public static byte[] Hash(byte[] data) 13 | { 14 | SHA256 mySHA256 = SHA256Managed.Create(); 15 | byte[] hash = mySHA256.ComputeHash(data); 16 | return hash; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/csharp-stellar-base/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/generated/AccountFlags.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum AccountFlags 10 | // { // masks for each flag 11 | // 12 | // // Flags set on issuer accounts 13 | // // TrustLines are created with authorized set to "false" requiring 14 | // // the issuer to set it for each TrustLine 15 | // AUTH_REQUIRED_FLAG = 0x1, 16 | // // If set, the authorized flag in TrustLines can be cleared 17 | // // otherwise, authorization cannot be revoked 18 | // AUTH_REVOCABLE_FLAG = 0x2, 19 | // // Once set, causes all AUTH_* flags to be read-only 20 | // AUTH_IMMUTABLE_FLAG = 0x4 21 | // }; 22 | // =========================================================================== 23 | public class AccountFlags { 24 | public enum AccountFlagsEnum 25 | { 26 | AUTH_REQUIRED_FLAG = 1, 27 | AUTH_REVOCABLE_FLAG = 2, 28 | AUTH_IMMUTABLE_FLAG = 4, 29 | } 30 | 31 | public AccountFlagsEnum InnerValue { get; set; } = default(AccountFlagsEnum); 32 | 33 | public static AccountFlags Create(AccountFlagsEnum v) 34 | { 35 | return new AccountFlags { 36 | InnerValue = v 37 | }; 38 | } 39 | 40 | public static AccountFlags Decode(IByteReader stream) { 41 | int value = XdrEncoding.DecodeInt32(stream); 42 | switch (value) { 43 | case 1: return Create(AccountFlagsEnum.AUTH_REQUIRED_FLAG); 44 | case 2: return Create(AccountFlagsEnum.AUTH_REVOCABLE_FLAG); 45 | case 4: return Create(AccountFlagsEnum.AUTH_IMMUTABLE_FLAG); 46 | default: 47 | throw new System.Exception("Unknown enum value: " + value); 48 | } 49 | } 50 | 51 | public static void Encode(IByteWriter stream, AccountFlags value) { 52 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/generated/AccountID.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef PublicKey AccountID; 10 | // =========================================================================== 11 | public class AccountID { 12 | public PublicKey InnerValue { get; set; } = default(PublicKey); 13 | 14 | public AccountID() { } 15 | public AccountID(PublicKey AccountID) 16 | { 17 | InnerValue = AccountID; 18 | } 19 | public static void Encode(IByteWriter stream, AccountID encodedAccountID) { 20 | PublicKey.Encode(stream, encodedAccountID.InnerValue); 21 | } 22 | public static AccountID Decode(IByteReader stream) { 23 | AccountID decodedAccountID = new AccountID(); 24 | decodedAccountID.InnerValue = PublicKey.Decode(stream); 25 | return decodedAccountID; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/AccountMergeResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union AccountMergeResult switch (AccountMergeResultCode code) 10 | // { 11 | // case ACCOUNT_MERGE_SUCCESS: 12 | // int64 sourceAccountBalance; // how much got transfered from source account 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class AccountMergeResult { 18 | public AccountMergeResult () {} 19 | public AccountMergeResultCode Discriminant { get; set; } = new AccountMergeResultCode(); 20 | public Int64 SourceAccountBalance { get; set; } = default(Int64); 21 | public static void Encode(IByteWriter stream, AccountMergeResult encodedAccountMergeResult) { 22 | XdrEncoding.EncodeInt32((int)encodedAccountMergeResult.Discriminant.InnerValue, stream); 23 | switch (encodedAccountMergeResult.Discriminant.InnerValue) { 24 | case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS: 25 | Int64.Encode(stream, encodedAccountMergeResult.SourceAccountBalance); 26 | break; 27 | default: 28 | break; 29 | } 30 | } 31 | public static AccountMergeResult Decode(IByteReader stream) { 32 | AccountMergeResult decodedAccountMergeResult = new AccountMergeResult(); 33 | decodedAccountMergeResult.Discriminant = AccountMergeResultCode.Decode(stream); 34 | switch (decodedAccountMergeResult.Discriminant.InnerValue) { 35 | case AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS: 36 | decodedAccountMergeResult.SourceAccountBalance = Int64.Decode(stream); 37 | break; 38 | default: 39 | break; 40 | } 41 | return decodedAccountMergeResult; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/generated/AccountMergeResultCode.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum AccountMergeResultCode 10 | // { 11 | // // codes considered as "success" for the operation 12 | // ACCOUNT_MERGE_SUCCESS = 0, 13 | // // codes considered as "failure" for the operation 14 | // ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself 15 | // ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist 16 | // ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set 17 | // ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4 // account has trust lines/offers 18 | // }; 19 | // =========================================================================== 20 | public class AccountMergeResultCode { 21 | public enum AccountMergeResultCodeEnum 22 | { 23 | ACCOUNT_MERGE_SUCCESS = 0, 24 | ACCOUNT_MERGE_MALFORMED = -1, 25 | ACCOUNT_MERGE_NO_ACCOUNT = -2, 26 | ACCOUNT_MERGE_IMMUTABLE_SET = -3, 27 | ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, 28 | } 29 | 30 | public AccountMergeResultCodeEnum InnerValue { get; set; } = default(AccountMergeResultCodeEnum); 31 | 32 | public static AccountMergeResultCode Create(AccountMergeResultCodeEnum v) 33 | { 34 | return new AccountMergeResultCode { 35 | InnerValue = v 36 | }; 37 | } 38 | 39 | public static AccountMergeResultCode Decode(IByteReader stream) { 40 | int value = XdrEncoding.DecodeInt32(stream); 41 | switch (value) { 42 | case 0: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS); 43 | case -1: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_MALFORMED); 44 | case -2: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_NO_ACCOUNT); 45 | case -3: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_IMMUTABLE_SET); 46 | case -4: return Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_HAS_SUB_ENTRIES); 47 | default: 48 | throw new System.Exception("Unknown enum value: " + value); 49 | } 50 | } 51 | 52 | public static void Encode(IByteWriter stream, AccountMergeResultCode value) { 53 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/generated/AllowTrustResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union AllowTrustResult switch (AllowTrustResultCode code) 10 | // { 11 | // case ALLOW_TRUST_SUCCESS: 12 | // void; 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class AllowTrustResult { 18 | public AllowTrustResult () {} 19 | public AllowTrustResultCode Discriminant { get; set; } = new AllowTrustResultCode(); 20 | public static void Encode(IByteWriter stream, AllowTrustResult encodedAllowTrustResult) { 21 | XdrEncoding.EncodeInt32((int)encodedAllowTrustResult.Discriminant.InnerValue, stream); 22 | switch (encodedAllowTrustResult.Discriminant.InnerValue) { 23 | case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS: 24 | break; 25 | default: 26 | break; 27 | } 28 | } 29 | public static AllowTrustResult Decode(IByteReader stream) { 30 | AllowTrustResult decodedAllowTrustResult = new AllowTrustResult(); 31 | decodedAllowTrustResult.Discriminant = AllowTrustResultCode.Decode(stream); 32 | switch (decodedAllowTrustResult.Discriminant.InnerValue) { 33 | case AllowTrustResultCode.AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS: 34 | break; 35 | default: 36 | break; 37 | } 38 | return decodedAllowTrustResult; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/generated/AssetType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum AssetType 10 | // { 11 | // ASSET_TYPE_NATIVE = 0, 12 | // ASSET_TYPE_CREDIT_ALPHANUM4 = 1, 13 | // ASSET_TYPE_CREDIT_ALPHANUM12 = 2 14 | // }; 15 | // =========================================================================== 16 | public class AssetType { 17 | public enum AssetTypeEnum 18 | { 19 | ASSET_TYPE_NATIVE = 0, 20 | ASSET_TYPE_CREDIT_ALPHANUM4 = 1, 21 | ASSET_TYPE_CREDIT_ALPHANUM12 = 2, 22 | } 23 | 24 | public AssetTypeEnum InnerValue { get; set; } = default(AssetTypeEnum); 25 | 26 | public static AssetType Create(AssetTypeEnum v) 27 | { 28 | return new AssetType { 29 | InnerValue = v 30 | }; 31 | } 32 | 33 | public static AssetType Decode(IByteReader stream) { 34 | int value = XdrEncoding.DecodeInt32(stream); 35 | switch (value) { 36 | case 0: return Create(AssetTypeEnum.ASSET_TYPE_NATIVE); 37 | case 1: return Create(AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4); 38 | case 2: return Create(AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12); 39 | default: 40 | throw new System.Exception("Unknown enum value: " + value); 41 | } 42 | } 43 | 44 | public static void Encode(IByteWriter stream, AssetType value) { 45 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/generated/Auth.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct Auth 10 | // { 11 | // // Empty message, just to confirm 12 | // // establishment of MAC keys. 13 | // int unused; 14 | // }; 15 | // =========================================================================== 16 | public class Auth { 17 | public Auth () {} 18 | public int Unused { get; set; } 19 | public static void Encode(IByteWriter stream, Auth encodedAuth) { 20 | XdrEncoding.EncodeInt32(encodedAuth.Unused, stream); 21 | } 22 | public static Auth Decode(IByteReader stream) { 23 | Auth decodedAuth = new Auth(); 24 | decodedAuth.Unused = XdrEncoding.DecodeInt32(stream); 25 | return decodedAuth; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/AuthCert.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct AuthCert 10 | // { 11 | // Curve25519Public pubkey; 12 | // uint64 expiration; 13 | // Signature sig; 14 | // }; 15 | // =========================================================================== 16 | public class AuthCert { 17 | public AuthCert () {} 18 | public Curve25519Public Pubkey { get; set; } 19 | public Uint64 Expiration { get; set; } 20 | public Signature Sig { get; set; } 21 | public static void Encode(IByteWriter stream, AuthCert encodedAuthCert) { 22 | Curve25519Public.Encode(stream, encodedAuthCert.Pubkey); 23 | Uint64.Encode(stream, encodedAuthCert.Expiration); 24 | Signature.Encode(stream, encodedAuthCert.Sig); 25 | } 26 | public static AuthCert Decode(IByteReader stream) { 27 | AuthCert decodedAuthCert = new AuthCert(); 28 | decodedAuthCert.Pubkey = Curve25519Public.Decode(stream); 29 | decodedAuthCert.Expiration = Uint64.Decode(stream); 30 | decodedAuthCert.Sig = Signature.Decode(stream); 31 | return decodedAuthCert; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/generated/BucketEntry.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union BucketEntry switch (BucketEntryType type) 10 | // { 11 | // case LIVEENTRY: 12 | // LedgerEntry liveEntry; 13 | // 14 | // case DEADENTRY: 15 | // LedgerKey deadEntry; 16 | // }; 17 | // =========================================================================== 18 | public class BucketEntry { 19 | public BucketEntry () {} 20 | public BucketEntryType Discriminant { get; set; } = new BucketEntryType(); 21 | public LedgerEntry LiveEntry { get; set; } = default(LedgerEntry); 22 | public LedgerKey DeadEntry { get; set; } = default(LedgerKey); 23 | public static void Encode(IByteWriter stream, BucketEntry encodedBucketEntry) { 24 | XdrEncoding.EncodeInt32((int)encodedBucketEntry.Discriminant.InnerValue, stream); 25 | switch (encodedBucketEntry.Discriminant.InnerValue) { 26 | case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY: 27 | LedgerEntry.Encode(stream, encodedBucketEntry.LiveEntry); 28 | break; 29 | case BucketEntryType.BucketEntryTypeEnum.DEADENTRY: 30 | LedgerKey.Encode(stream, encodedBucketEntry.DeadEntry); 31 | break; 32 | } 33 | } 34 | public static BucketEntry Decode(IByteReader stream) { 35 | BucketEntry decodedBucketEntry = new BucketEntry(); 36 | decodedBucketEntry.Discriminant = BucketEntryType.Decode(stream); 37 | switch (decodedBucketEntry.Discriminant.InnerValue) { 38 | case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY: 39 | decodedBucketEntry.LiveEntry = LedgerEntry.Decode(stream); 40 | break; 41 | case BucketEntryType.BucketEntryTypeEnum.DEADENTRY: 42 | decodedBucketEntry.DeadEntry = LedgerKey.Decode(stream); 43 | break; 44 | } 45 | return decodedBucketEntry; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/generated/BucketEntryType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum BucketEntryType 10 | // { 11 | // LIVEENTRY = 0, 12 | // DEADENTRY = 1 13 | // }; 14 | // =========================================================================== 15 | public class BucketEntryType { 16 | public enum BucketEntryTypeEnum 17 | { 18 | LIVEENTRY = 0, 19 | DEADENTRY = 1, 20 | } 21 | 22 | public BucketEntryTypeEnum InnerValue { get; set; } = default(BucketEntryTypeEnum); 23 | 24 | public static BucketEntryType Create(BucketEntryTypeEnum v) 25 | { 26 | return new BucketEntryType { 27 | InnerValue = v 28 | }; 29 | } 30 | 31 | public static BucketEntryType Decode(IByteReader stream) { 32 | int value = XdrEncoding.DecodeInt32(stream); 33 | switch (value) { 34 | case 0: return Create(BucketEntryTypeEnum.LIVEENTRY); 35 | case 1: return Create(BucketEntryTypeEnum.DEADENTRY); 36 | default: 37 | throw new System.Exception("Unknown enum value: " + value); 38 | } 39 | } 40 | 41 | public static void Encode(IByteWriter stream, BucketEntryType value) { 42 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/generated/ByteReader.cs: -------------------------------------------------------------------------------- 1 | // Copyright ExM 2 | // Licensed as LGPL 3 | // Source at git://github.com/ExM/OncRpc.git 4 | 5 | using System; 6 | using System.IO; 7 | 8 | namespace Stellar.Generated 9 | { 10 | public class ByteReader: IByteReader 11 | { 12 | private int _pos = 0; 13 | private byte[] _bytes; 14 | 15 | public ByteReader(params byte[] bytes) 16 | { 17 | _bytes = bytes; 18 | } 19 | 20 | public int Position 21 | { 22 | get 23 | { 24 | return _pos; 25 | } 26 | } 27 | 28 | public byte[] Read(uint count) 29 | { 30 | byte[] result = new byte[count]; 31 | Array.Copy(_bytes, _pos, result, 0, count); 32 | _pos += (int)count; 33 | return result; 34 | } 35 | 36 | public byte Read() 37 | { 38 | byte result = _bytes[_pos]; 39 | _pos++; 40 | return result; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/generated/ByteWriter.cs: -------------------------------------------------------------------------------- 1 | // Copyright ExM 2 | // Licensed as LGPL 3 | // Source at git://github.com/ExM/OncRpc.git 4 | 5 | using System; 6 | using System.IO; 7 | using System.Collections.Generic; 8 | 9 | namespace Stellar.Generated 10 | { 11 | public class ByteWriter: IByteWriter 12 | { 13 | private List _bytes; 14 | 15 | public ByteWriter() 16 | { 17 | _bytes = new List(); 18 | } 19 | 20 | public byte[] ToArray() 21 | { 22 | return _bytes.ToArray(); 23 | } 24 | 25 | public void Write(byte[] buffer) 26 | { 27 | _bytes.AddRange(buffer); 28 | } 29 | 30 | public void Write(byte b) 31 | { 32 | _bytes.Add(b); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/generated/ChangeTrustOp.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct ChangeTrustOp 10 | // { 11 | // Asset line; 12 | // 13 | // // if limit is set to 0, deletes the trust line 14 | // int64 limit; 15 | // }; 16 | // =========================================================================== 17 | public class ChangeTrustOp { 18 | public ChangeTrustOp () {} 19 | public Asset Line { get; set; } 20 | public Int64 Limit { get; set; } 21 | public static void Encode(IByteWriter stream, ChangeTrustOp encodedChangeTrustOp) { 22 | Asset.Encode(stream, encodedChangeTrustOp.Line); 23 | Int64.Encode(stream, encodedChangeTrustOp.Limit); 24 | } 25 | public static ChangeTrustOp Decode(IByteReader stream) { 26 | ChangeTrustOp decodedChangeTrustOp = new ChangeTrustOp(); 27 | decodedChangeTrustOp.Line = Asset.Decode(stream); 28 | decodedChangeTrustOp.Limit = Int64.Decode(stream); 29 | return decodedChangeTrustOp; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/generated/ChangeTrustResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union ChangeTrustResult switch (ChangeTrustResultCode code) 10 | // { 11 | // case CHANGE_TRUST_SUCCESS: 12 | // void; 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class ChangeTrustResult { 18 | public ChangeTrustResult () {} 19 | public ChangeTrustResultCode Discriminant { get; set; } = new ChangeTrustResultCode(); 20 | public static void Encode(IByteWriter stream, ChangeTrustResult encodedChangeTrustResult) { 21 | XdrEncoding.EncodeInt32((int)encodedChangeTrustResult.Discriminant.InnerValue, stream); 22 | switch (encodedChangeTrustResult.Discriminant.InnerValue) { 23 | case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS: 24 | break; 25 | default: 26 | break; 27 | } 28 | } 29 | public static ChangeTrustResult Decode(IByteReader stream) { 30 | ChangeTrustResult decodedChangeTrustResult = new ChangeTrustResult(); 31 | decodedChangeTrustResult.Discriminant = ChangeTrustResultCode.Decode(stream); 32 | switch (decodedChangeTrustResult.Discriminant.InnerValue) { 33 | case ChangeTrustResultCode.ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS: 34 | break; 35 | default: 36 | break; 37 | } 38 | return decodedChangeTrustResult; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/generated/ClaimOfferAtom.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct ClaimOfferAtom 10 | // { 11 | // // emitted to identify the offer 12 | // AccountID sellerID; // Account that owns the offer 13 | // uint64 offerID; 14 | // 15 | // // amount and asset taken from the owner 16 | // Asset assetSold; 17 | // int64 amountSold; 18 | // 19 | // // amount and asset sent to the owner 20 | // Asset assetBought; 21 | // int64 amountBought; 22 | // }; 23 | // =========================================================================== 24 | public class ClaimOfferAtom { 25 | public ClaimOfferAtom () {} 26 | public AccountID SellerID { get; set; } 27 | public Uint64 OfferID { get; set; } 28 | public Asset AssetSold { get; set; } 29 | public Int64 AmountSold { get; set; } 30 | public Asset AssetBought { get; set; } 31 | public Int64 AmountBought { get; set; } 32 | public static void Encode(IByteWriter stream, ClaimOfferAtom encodedClaimOfferAtom) { 33 | AccountID.Encode(stream, encodedClaimOfferAtom.SellerID); 34 | Uint64.Encode(stream, encodedClaimOfferAtom.OfferID); 35 | Asset.Encode(stream, encodedClaimOfferAtom.AssetSold); 36 | Int64.Encode(stream, encodedClaimOfferAtom.AmountSold); 37 | Asset.Encode(stream, encodedClaimOfferAtom.AssetBought); 38 | Int64.Encode(stream, encodedClaimOfferAtom.AmountBought); 39 | } 40 | public static ClaimOfferAtom Decode(IByteReader stream) { 41 | ClaimOfferAtom decodedClaimOfferAtom = new ClaimOfferAtom(); 42 | decodedClaimOfferAtom.SellerID = AccountID.Decode(stream); 43 | decodedClaimOfferAtom.OfferID = Uint64.Decode(stream); 44 | decodedClaimOfferAtom.AssetSold = Asset.Decode(stream); 45 | decodedClaimOfferAtom.AmountSold = Int64.Decode(stream); 46 | decodedClaimOfferAtom.AssetBought = Asset.Decode(stream); 47 | decodedClaimOfferAtom.AmountBought = Int64.Decode(stream); 48 | return decodedClaimOfferAtom; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/generated/CreateAccountOp.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct CreateAccountOp 10 | // { 11 | // AccountID destination; // account to create 12 | // int64 startingBalance; // amount they end up with 13 | // }; 14 | // =========================================================================== 15 | public class CreateAccountOp { 16 | public CreateAccountOp () {} 17 | public AccountID Destination { get; set; } 18 | public Int64 StartingBalance { get; set; } 19 | public static void Encode(IByteWriter stream, CreateAccountOp encodedCreateAccountOp) { 20 | AccountID.Encode(stream, encodedCreateAccountOp.Destination); 21 | Int64.Encode(stream, encodedCreateAccountOp.StartingBalance); 22 | } 23 | public static CreateAccountOp Decode(IByteReader stream) { 24 | CreateAccountOp decodedCreateAccountOp = new CreateAccountOp(); 25 | decodedCreateAccountOp.Destination = AccountID.Decode(stream); 26 | decodedCreateAccountOp.StartingBalance = Int64.Decode(stream); 27 | return decodedCreateAccountOp; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/CreateAccountResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union CreateAccountResult switch (CreateAccountResultCode code) 10 | // { 11 | // case CREATE_ACCOUNT_SUCCESS: 12 | // void; 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class CreateAccountResult { 18 | public CreateAccountResult () {} 19 | public CreateAccountResultCode Discriminant { get; set; } = new CreateAccountResultCode(); 20 | public static void Encode(IByteWriter stream, CreateAccountResult encodedCreateAccountResult) { 21 | XdrEncoding.EncodeInt32((int)encodedCreateAccountResult.Discriminant.InnerValue, stream); 22 | switch (encodedCreateAccountResult.Discriminant.InnerValue) { 23 | case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS: 24 | break; 25 | default: 26 | break; 27 | } 28 | } 29 | public static CreateAccountResult Decode(IByteReader stream) { 30 | CreateAccountResult decodedCreateAccountResult = new CreateAccountResult(); 31 | decodedCreateAccountResult.Discriminant = CreateAccountResultCode.Decode(stream); 32 | switch (decodedCreateAccountResult.Discriminant.InnerValue) { 33 | case CreateAccountResultCode.CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS: 34 | break; 35 | default: 36 | break; 37 | } 38 | return decodedCreateAccountResult; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/generated/CreateAccountResultCode.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum CreateAccountResultCode 10 | // { 11 | // // codes considered as "success" for the operation 12 | // CREATE_ACCOUNT_SUCCESS = 0, // account was created 13 | // 14 | // // codes considered as "failure" for the operation 15 | // CREATE_ACCOUNT_MALFORMED = -1, // invalid destination 16 | // CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account 17 | // CREATE_ACCOUNT_LOW_RESERVE = 18 | // -3, // would create an account below the min reserve 19 | // CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists 20 | // }; 21 | // =========================================================================== 22 | public class CreateAccountResultCode { 23 | public enum CreateAccountResultCodeEnum 24 | { 25 | CREATE_ACCOUNT_SUCCESS = 0, 26 | CREATE_ACCOUNT_MALFORMED = -1, 27 | CREATE_ACCOUNT_UNDERFUNDED = -2, 28 | CREATE_ACCOUNT_LOW_RESERVE = -3, 29 | CREATE_ACCOUNT_ALREADY_EXIST = -4, 30 | } 31 | 32 | public CreateAccountResultCodeEnum InnerValue { get; set; } = default(CreateAccountResultCodeEnum); 33 | 34 | public static CreateAccountResultCode Create(CreateAccountResultCodeEnum v) 35 | { 36 | return new CreateAccountResultCode { 37 | InnerValue = v 38 | }; 39 | } 40 | 41 | public static CreateAccountResultCode Decode(IByteReader stream) { 42 | int value = XdrEncoding.DecodeInt32(stream); 43 | switch (value) { 44 | case 0: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS); 45 | case -1: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_MALFORMED); 46 | case -2: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_UNDERFUNDED); 47 | case -3: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_LOW_RESERVE); 48 | case -4: return Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_ALREADY_EXIST); 49 | default: 50 | throw new System.Exception("Unknown enum value: " + value); 51 | } 52 | } 53 | 54 | public static void Encode(IByteWriter stream, CreateAccountResultCode value) { 55 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/generated/CreatePassiveOfferOp.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct CreatePassiveOfferOp 10 | // { 11 | // Asset selling; // A 12 | // Asset buying; // B 13 | // int64 amount; // amount taker gets. if set to 0, delete the offer 14 | // Price price; // cost of A in terms of B 15 | // }; 16 | // =========================================================================== 17 | public class CreatePassiveOfferOp { 18 | public CreatePassiveOfferOp () {} 19 | public Asset Selling { get; set; } 20 | public Asset Buying { get; set; } 21 | public Int64 Amount { get; set; } 22 | public Price Price { get; set; } 23 | public static void Encode(IByteWriter stream, CreatePassiveOfferOp encodedCreatePassiveOfferOp) { 24 | Asset.Encode(stream, encodedCreatePassiveOfferOp.Selling); 25 | Asset.Encode(stream, encodedCreatePassiveOfferOp.Buying); 26 | Int64.Encode(stream, encodedCreatePassiveOfferOp.Amount); 27 | Price.Encode(stream, encodedCreatePassiveOfferOp.Price); 28 | } 29 | public static CreatePassiveOfferOp Decode(IByteReader stream) { 30 | CreatePassiveOfferOp decodedCreatePassiveOfferOp = new CreatePassiveOfferOp(); 31 | decodedCreatePassiveOfferOp.Selling = Asset.Decode(stream); 32 | decodedCreatePassiveOfferOp.Buying = Asset.Decode(stream); 33 | decodedCreatePassiveOfferOp.Amount = Int64.Decode(stream); 34 | decodedCreatePassiveOfferOp.Price = Price.Decode(stream); 35 | return decodedCreatePassiveOfferOp; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/generated/CryptoKeyType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum CryptoKeyType 10 | // { 11 | // KEY_TYPE_ED25519 = 0, 12 | // KEY_TYPE_PRE_AUTH_TX = 1, 13 | // KEY_TYPE_HASH_X = 2 14 | // }; 15 | // =========================================================================== 16 | public class CryptoKeyType { 17 | public enum CryptoKeyTypeEnum 18 | { 19 | KEY_TYPE_ED25519 = 0, 20 | KEY_TYPE_PRE_AUTH_TX = 1, 21 | KEY_TYPE_HASH_X = 2, 22 | } 23 | 24 | public CryptoKeyTypeEnum InnerValue { get; set; } = default(CryptoKeyTypeEnum); 25 | 26 | public static CryptoKeyType Create(CryptoKeyTypeEnum v) 27 | { 28 | return new CryptoKeyType { 29 | InnerValue = v 30 | }; 31 | } 32 | 33 | public static CryptoKeyType Decode(IByteReader stream) { 34 | int value = XdrEncoding.DecodeInt32(stream); 35 | switch (value) { 36 | case 0: return Create(CryptoKeyTypeEnum.KEY_TYPE_ED25519); 37 | case 1: return Create(CryptoKeyTypeEnum.KEY_TYPE_PRE_AUTH_TX); 38 | case 2: return Create(CryptoKeyTypeEnum.KEY_TYPE_HASH_X); 39 | default: 40 | throw new System.Exception("Unknown enum value: " + value); 41 | } 42 | } 43 | 44 | public static void Encode(IByteWriter stream, CryptoKeyType value) { 45 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/generated/Curve25519Public.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct Curve25519Public 10 | // { 11 | // opaque key[32]; 12 | // }; 13 | // =========================================================================== 14 | public class Curve25519Public { 15 | public Curve25519Public () {} 16 | public byte[] Key { get; set; } 17 | public static void Encode(IByteWriter stream, Curve25519Public encodedCurve25519Public) { 18 | int keysize = encodedCurve25519Public.Key.Length; 19 | XdrEncoding.WriteFixOpaque(stream, (uint)keysize, encodedCurve25519Public.Key); 20 | } 21 | public static Curve25519Public Decode(IByteReader stream) { 22 | Curve25519Public decodedCurve25519Public = new Curve25519Public(); 23 | int keysize = 32; 24 | decodedCurve25519Public.Key = XdrEncoding.ReadFixOpaque(stream, (uint)keysize); 25 | return decodedCurve25519Public; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/Curve25519Secret.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct Curve25519Secret 10 | // { 11 | // opaque key[32]; 12 | // }; 13 | // =========================================================================== 14 | public class Curve25519Secret { 15 | public Curve25519Secret () {} 16 | public byte[] Key { get; set; } 17 | public static void Encode(IByteWriter stream, Curve25519Secret encodedCurve25519Secret) { 18 | int keysize = encodedCurve25519Secret.Key.Length; 19 | XdrEncoding.WriteFixOpaque(stream, (uint)keysize, encodedCurve25519Secret.Key); 20 | } 21 | public static Curve25519Secret Decode(IByteReader stream) { 22 | Curve25519Secret decodedCurve25519Secret = new Curve25519Secret(); 23 | int keysize = 32; 24 | decodedCurve25519Secret.Key = XdrEncoding.ReadFixOpaque(stream, (uint)keysize); 25 | return decodedCurve25519Secret; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/DataEntry.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct DataEntry 10 | // { 11 | // AccountID accountID; // account this data belongs to 12 | // string64 dataName; 13 | // DataValue dataValue; 14 | // 15 | // // reserved for future use 16 | // union switch (int v) 17 | // { 18 | // case 0: 19 | // void; 20 | // } 21 | // ext; 22 | // }; 23 | // =========================================================================== 24 | public class DataEntry { 25 | public DataEntry () {} 26 | public AccountID AccountID { get; set; } 27 | public String64 DataName { get; set; } 28 | public DataValue DataValue { get; set; } 29 | public DataEntryExt Ext { get; set; } 30 | public static void Encode(IByteWriter stream, DataEntry encodedDataEntry) { 31 | AccountID.Encode(stream, encodedDataEntry.AccountID); 32 | String64.Encode(stream, encodedDataEntry.DataName); 33 | DataValue.Encode(stream, encodedDataEntry.DataValue); 34 | DataEntryExt.Encode(stream, encodedDataEntry.Ext); 35 | } 36 | public static DataEntry Decode(IByteReader stream) { 37 | DataEntry decodedDataEntry = new DataEntry(); 38 | decodedDataEntry.AccountID = AccountID.Decode(stream); 39 | decodedDataEntry.DataName = String64.Decode(stream); 40 | decodedDataEntry.DataValue = DataValue.Decode(stream); 41 | decodedDataEntry.Ext = DataEntryExt.Decode(stream); 42 | return decodedDataEntry; 43 | } 44 | 45 | public class DataEntryExt { 46 | public DataEntryExt () {} 47 | public int Discriminant { get; set; } = new int(); 48 | public static void Encode(IByteWriter stream, DataEntryExt encodedDataEntryExt) { 49 | XdrEncoding.EncodeInt32(encodedDataEntryExt.Discriminant, stream); 50 | switch (encodedDataEntryExt.Discriminant) { 51 | case 0: 52 | break; 53 | } 54 | } 55 | public static DataEntryExt Decode(IByteReader stream) { 56 | DataEntryExt decodedDataEntryExt = new DataEntryExt(); 57 | decodedDataEntryExt.Discriminant = XdrEncoding.DecodeInt32(stream); 58 | switch (decodedDataEntryExt.Discriminant) { 59 | case 0: 60 | break; 61 | } 62 | return decodedDataEntryExt; 63 | } 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/generated/DataValue.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef opaque DataValue<64>; 10 | // =========================================================================== 11 | public class DataValue { 12 | public byte[] InnerValue { get; set; } = default(byte[]); 13 | 14 | public DataValue() { } 15 | public DataValue(byte[] DataValue) 16 | { 17 | InnerValue = DataValue; 18 | } 19 | public static void Encode(IByteWriter stream, DataValue encodedDataValue) { 20 | int DataValueSize = encodedDataValue.InnerValue.Length; 21 | XdrEncoding.EncodeInt32(DataValueSize, stream); 22 | XdrEncoding.WriteFixOpaque(stream, (uint)DataValueSize, encodedDataValue.InnerValue); 23 | } 24 | public static DataValue Decode(IByteReader stream) { 25 | DataValue decodedDataValue = new DataValue(); 26 | int DataValuesize = XdrEncoding.DecodeInt32(stream); 27 | decodedDataValue.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)DataValuesize); 28 | return decodedDataValue; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/generated/DecoratedSignature.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct DecoratedSignature 10 | // { 11 | // SignatureHint hint; // last 4 bytes of the public key, used as a hint 12 | // Signature signature; // actual signature 13 | // }; 14 | // =========================================================================== 15 | public class DecoratedSignature { 16 | public DecoratedSignature () {} 17 | public SignatureHint Hint { get; set; } 18 | public Signature Signature { get; set; } 19 | public static void Encode(IByteWriter stream, DecoratedSignature encodedDecoratedSignature) { 20 | SignatureHint.Encode(stream, encodedDecoratedSignature.Hint); 21 | Signature.Encode(stream, encodedDecoratedSignature.Signature); 22 | } 23 | public static DecoratedSignature Decode(IByteReader stream) { 24 | DecoratedSignature decodedDecoratedSignature = new DecoratedSignature(); 25 | decodedDecoratedSignature.Hint = SignatureHint.Decode(stream); 26 | decodedDecoratedSignature.Signature = Signature.Decode(stream); 27 | return decodedDecoratedSignature; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/DontHave.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct DontHave 10 | // { 11 | // MessageType type; 12 | // uint256 reqHash; 13 | // }; 14 | // =========================================================================== 15 | public class DontHave { 16 | public DontHave () {} 17 | public MessageType Type { get; set; } 18 | public Uint256 ReqHash { get; set; } 19 | public static void Encode(IByteWriter stream, DontHave encodedDontHave) { 20 | MessageType.Encode(stream, encodedDontHave.Type); 21 | Uint256.Encode(stream, encodedDontHave.ReqHash); 22 | } 23 | public static DontHave Decode(IByteReader stream) { 24 | DontHave decodedDontHave = new DontHave(); 25 | decodedDontHave.Type = MessageType.Decode(stream); 26 | decodedDontHave.ReqHash = Uint256.Decode(stream); 27 | return decodedDontHave; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/EnvelopeType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum EnvelopeType 10 | // { 11 | // ENVELOPE_TYPE_SCP = 1, 12 | // ENVELOPE_TYPE_TX = 2, 13 | // ENVELOPE_TYPE_AUTH = 3 14 | // }; 15 | // =========================================================================== 16 | public class EnvelopeType { 17 | public enum EnvelopeTypeEnum 18 | { 19 | ENVELOPE_TYPE_SCP = 1, 20 | ENVELOPE_TYPE_TX = 2, 21 | ENVELOPE_TYPE_AUTH = 3, 22 | } 23 | 24 | public EnvelopeTypeEnum InnerValue { get; set; } = default(EnvelopeTypeEnum); 25 | 26 | public static EnvelopeType Create(EnvelopeTypeEnum v) 27 | { 28 | return new EnvelopeType { 29 | InnerValue = v 30 | }; 31 | } 32 | 33 | public static EnvelopeType Decode(IByteReader stream) { 34 | int value = XdrEncoding.DecodeInt32(stream); 35 | switch (value) { 36 | case 1: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_SCP); 37 | case 2: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_TX); 38 | case 3: return Create(EnvelopeTypeEnum.ENVELOPE_TYPE_AUTH); 39 | default: 40 | throw new System.Exception("Unknown enum value: " + value); 41 | } 42 | } 43 | 44 | public static void Encode(IByteWriter stream, EnvelopeType value) { 45 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/generated/Error.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct Error 10 | // { 11 | // ErrorCode code; 12 | // string msg<100>; 13 | // }; 14 | // =========================================================================== 15 | public class Error { 16 | public Error () {} 17 | public ErrorCode Code { get; set; } 18 | public string Msg { get; set; } 19 | public static void Encode(IByteWriter stream, Error encodedError) { 20 | ErrorCode.Encode(stream, encodedError.Code); 21 | XdrEncoding.WriteString(stream, encodedError.Msg); 22 | } 23 | public static Error Decode(IByteReader stream) { 24 | Error decodedError = new Error(); 25 | decodedError.Code = ErrorCode.Decode(stream); 26 | decodedError.Msg = XdrEncoding.ReadString(stream); 27 | return decodedError; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/ErrorCode.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum ErrorCode 10 | // { 11 | // ERR_MISC = 0, // Unspecific error 12 | // ERR_DATA = 1, // Malformed data 13 | // ERR_CONF = 2, // Misconfiguration error 14 | // ERR_AUTH = 3, // Authentication failure 15 | // ERR_LOAD = 4 // System overloaded 16 | // }; 17 | // =========================================================================== 18 | public class ErrorCode { 19 | public enum ErrorCodeEnum 20 | { 21 | ERR_MISC = 0, 22 | ERR_DATA = 1, 23 | ERR_CONF = 2, 24 | ERR_AUTH = 3, 25 | ERR_LOAD = 4, 26 | } 27 | 28 | public ErrorCodeEnum InnerValue { get; set; } = default(ErrorCodeEnum); 29 | 30 | public static ErrorCode Create(ErrorCodeEnum v) 31 | { 32 | return new ErrorCode { 33 | InnerValue = v 34 | }; 35 | } 36 | 37 | public static ErrorCode Decode(IByteReader stream) { 38 | int value = XdrEncoding.DecodeInt32(stream); 39 | switch (value) { 40 | case 0: return Create(ErrorCodeEnum.ERR_MISC); 41 | case 1: return Create(ErrorCodeEnum.ERR_DATA); 42 | case 2: return Create(ErrorCodeEnum.ERR_CONF); 43 | case 3: return Create(ErrorCodeEnum.ERR_AUTH); 44 | case 4: return Create(ErrorCodeEnum.ERR_LOAD); 45 | default: 46 | throw new System.Exception("Unknown enum value: " + value); 47 | } 48 | } 49 | 50 | public static void Encode(IByteWriter stream, ErrorCode value) { 51 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/generated/Hash.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef opaque Hash[32]; 10 | // =========================================================================== 11 | public class Hash { 12 | public byte[] InnerValue { get; set; } = default(byte[]); 13 | 14 | public Hash() { } 15 | public Hash(byte[] Hash) 16 | { 17 | InnerValue = Hash; 18 | } 19 | public static void Encode(IByteWriter stream, Hash encodedHash) { 20 | int HashSize = encodedHash.InnerValue.Length; 21 | XdrEncoding.WriteFixOpaque(stream, (uint)HashSize, encodedHash.InnerValue); 22 | } 23 | public static Hash Decode(IByteReader stream) { 24 | Hash decodedHash = new Hash(); 25 | int Hashsize = 32; 26 | decodedHash.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Hashsize); 27 | return decodedHash; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/Hello.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct Hello 10 | // { 11 | // uint32 ledgerVersion; 12 | // uint32 overlayVersion; 13 | // uint32 overlayMinVersion; 14 | // Hash networkID; 15 | // string versionStr<100>; 16 | // int listeningPort; 17 | // NodeID peerID; 18 | // AuthCert cert; 19 | // uint256 nonce; 20 | // }; 21 | // =========================================================================== 22 | public class Hello { 23 | public Hello () {} 24 | public Uint32 LedgerVersion { get; set; } 25 | public Uint32 OverlayVersion { get; set; } 26 | public Uint32 OverlayMinVersion { get; set; } 27 | public Hash NetworkID { get; set; } 28 | public string VersionStr { get; set; } 29 | public int ListeningPort { get; set; } 30 | public NodeID PeerID { get; set; } 31 | public AuthCert Cert { get; set; } 32 | public Uint256 Nonce { get; set; } 33 | public static void Encode(IByteWriter stream, Hello encodedHello) { 34 | Uint32.Encode(stream, encodedHello.LedgerVersion); 35 | Uint32.Encode(stream, encodedHello.OverlayVersion); 36 | Uint32.Encode(stream, encodedHello.OverlayMinVersion); 37 | Hash.Encode(stream, encodedHello.NetworkID); 38 | XdrEncoding.WriteString(stream, encodedHello.VersionStr); 39 | XdrEncoding.EncodeInt32(encodedHello.ListeningPort, stream); 40 | NodeID.Encode(stream, encodedHello.PeerID); 41 | AuthCert.Encode(stream, encodedHello.Cert); 42 | Uint256.Encode(stream, encodedHello.Nonce); 43 | } 44 | public static Hello Decode(IByteReader stream) { 45 | Hello decodedHello = new Hello(); 46 | decodedHello.LedgerVersion = Uint32.Decode(stream); 47 | decodedHello.OverlayVersion = Uint32.Decode(stream); 48 | decodedHello.OverlayMinVersion = Uint32.Decode(stream); 49 | decodedHello.NetworkID = Hash.Decode(stream); 50 | decodedHello.VersionStr = XdrEncoding.ReadString(stream); 51 | decodedHello.ListeningPort = XdrEncoding.DecodeInt32(stream); 52 | decodedHello.PeerID = NodeID.Decode(stream); 53 | decodedHello.Cert = AuthCert.Decode(stream); 54 | decodedHello.Nonce = Uint256.Decode(stream); 55 | return decodedHello; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/generated/HmacSha256Key.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct HmacSha256Key 10 | // { 11 | // opaque key[32]; 12 | // }; 13 | // =========================================================================== 14 | public class HmacSha256Key { 15 | public HmacSha256Key () {} 16 | public byte[] Key { get; set; } 17 | public static void Encode(IByteWriter stream, HmacSha256Key encodedHmacSha256Key) { 18 | int keysize = encodedHmacSha256Key.Key.Length; 19 | XdrEncoding.WriteFixOpaque(stream, (uint)keysize, encodedHmacSha256Key.Key); 20 | } 21 | public static HmacSha256Key Decode(IByteReader stream) { 22 | HmacSha256Key decodedHmacSha256Key = new HmacSha256Key(); 23 | int keysize = 32; 24 | decodedHmacSha256Key.Key = XdrEncoding.ReadFixOpaque(stream, (uint)keysize); 25 | return decodedHmacSha256Key; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/HmacSha256Mac.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct HmacSha256Mac 10 | // { 11 | // opaque mac[32]; 12 | // }; 13 | // =========================================================================== 14 | public class HmacSha256Mac { 15 | public HmacSha256Mac () {} 16 | public byte[] Mac { get; set; } 17 | public static void Encode(IByteWriter stream, HmacSha256Mac encodedHmacSha256Mac) { 18 | int macsize = encodedHmacSha256Mac.Mac.Length; 19 | XdrEncoding.WriteFixOpaque(stream, (uint)macsize, encodedHmacSha256Mac.Mac); 20 | } 21 | public static HmacSha256Mac Decode(IByteReader stream) { 22 | HmacSha256Mac decodedHmacSha256Mac = new HmacSha256Mac(); 23 | int macsize = 32; 24 | decodedHmacSha256Mac.Mac = XdrEncoding.ReadFixOpaque(stream, (uint)macsize); 25 | return decodedHmacSha256Mac; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/IByteReader.cs: -------------------------------------------------------------------------------- 1 | // Copyright ExM 2 | // Licensed as LGPL 3 | // Source at git://github.com/ExM/OncRpc.git 4 | 5 | using System; 6 | 7 | namespace Stellar.Generated 8 | { 9 | public interface IByteReader 10 | { 11 | byte[] Read(uint count); 12 | byte Read(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/generated/IByteWriter.cs: -------------------------------------------------------------------------------- 1 | // Copyright ExM 2 | // Licensed as LGPL 3 | // Source at git://github.com/ExM/OncRpc.git 4 | 5 | using System; 6 | 7 | namespace Stellar.Generated 8 | { 9 | public interface IByteWriter 10 | { 11 | void Write(byte[] buffer); 12 | void Write(byte b); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/generated/IPAddrType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum IPAddrType 10 | // { 11 | // IPv4 = 0, 12 | // IPv6 = 1 13 | // }; 14 | // =========================================================================== 15 | public class IPAddrType { 16 | public enum IPAddrTypeEnum 17 | { 18 | IPv4 = 0, 19 | IPv6 = 1, 20 | } 21 | 22 | public IPAddrTypeEnum InnerValue { get; set; } = default(IPAddrTypeEnum); 23 | 24 | public static IPAddrType Create(IPAddrTypeEnum v) 25 | { 26 | return new IPAddrType { 27 | InnerValue = v 28 | }; 29 | } 30 | 31 | public static IPAddrType Decode(IByteReader stream) { 32 | int value = XdrEncoding.DecodeInt32(stream); 33 | switch (value) { 34 | case 0: return Create(IPAddrTypeEnum.IPv4); 35 | case 1: return Create(IPAddrTypeEnum.IPv6); 36 | default: 37 | throw new System.Exception("Unknown enum value: " + value); 38 | } 39 | } 40 | 41 | public static void Encode(IByteWriter stream, IPAddrType value) { 42 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/generated/InflationPayout.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct InflationPayout // or use PaymentResultAtom to limit types? 10 | // { 11 | // AccountID destination; 12 | // int64 amount; 13 | // }; 14 | // =========================================================================== 15 | public class InflationPayout { 16 | public InflationPayout () {} 17 | public AccountID Destination { get; set; } 18 | public Int64 Amount { get; set; } 19 | public static void Encode(IByteWriter stream, InflationPayout encodedInflationPayout) { 20 | AccountID.Encode(stream, encodedInflationPayout.Destination); 21 | Int64.Encode(stream, encodedInflationPayout.Amount); 22 | } 23 | public static InflationPayout Decode(IByteReader stream) { 24 | InflationPayout decodedInflationPayout = new InflationPayout(); 25 | decodedInflationPayout.Destination = AccountID.Decode(stream); 26 | decodedInflationPayout.Amount = Int64.Decode(stream); 27 | return decodedInflationPayout; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/InflationResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union InflationResult switch (InflationResultCode code) 10 | // { 11 | // case INFLATION_SUCCESS: 12 | // InflationPayout payouts<>; 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class InflationResult { 18 | public InflationResult () {} 19 | public InflationResultCode Discriminant { get; set; } = new InflationResultCode(); 20 | public InflationPayout[] Payouts { get; set; } = default(InflationPayout[]); 21 | public static void Encode(IByteWriter stream, InflationResult encodedInflationResult) { 22 | XdrEncoding.EncodeInt32((int)encodedInflationResult.Discriminant.InnerValue, stream); 23 | switch (encodedInflationResult.Discriminant.InnerValue) { 24 | case InflationResultCode.InflationResultCodeEnum.INFLATION_SUCCESS: 25 | int payoutssize = encodedInflationResult.Payouts.Length; 26 | XdrEncoding.EncodeInt32(payoutssize, stream); 27 | for (int i = 0; i < payoutssize; i++) { 28 | InflationPayout.Encode(stream, encodedInflationResult.Payouts[i]); 29 | } 30 | break; 31 | default: 32 | break; 33 | } 34 | } 35 | public static InflationResult Decode(IByteReader stream) { 36 | InflationResult decodedInflationResult = new InflationResult(); 37 | decodedInflationResult.Discriminant = InflationResultCode.Decode(stream); 38 | switch (decodedInflationResult.Discriminant.InnerValue) { 39 | case InflationResultCode.InflationResultCodeEnum.INFLATION_SUCCESS: 40 | int payoutssize = XdrEncoding.DecodeInt32(stream); 41 | decodedInflationResult.Payouts = new InflationPayout[payoutssize]; 42 | for (int i = 0; i < payoutssize; i++) { 43 | decodedInflationResult.Payouts[i] = InflationPayout.Decode(stream); 44 | } 45 | break; 46 | default: 47 | break; 48 | } 49 | return decodedInflationResult; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/generated/InflationResultCode.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum InflationResultCode 10 | // { 11 | // // codes considered as "success" for the operation 12 | // INFLATION_SUCCESS = 0, 13 | // // codes considered as "failure" for the operation 14 | // INFLATION_NOT_TIME = -1 15 | // }; 16 | // =========================================================================== 17 | public class InflationResultCode { 18 | public enum InflationResultCodeEnum 19 | { 20 | INFLATION_SUCCESS = 0, 21 | INFLATION_NOT_TIME = -1, 22 | } 23 | 24 | public InflationResultCodeEnum InnerValue { get; set; } = default(InflationResultCodeEnum); 25 | 26 | public static InflationResultCode Create(InflationResultCodeEnum v) 27 | { 28 | return new InflationResultCode { 29 | InnerValue = v 30 | }; 31 | } 32 | 33 | public static InflationResultCode Decode(IByteReader stream) { 34 | int value = XdrEncoding.DecodeInt32(stream); 35 | switch (value) { 36 | case 0: return Create(InflationResultCodeEnum.INFLATION_SUCCESS); 37 | case -1: return Create(InflationResultCodeEnum.INFLATION_NOT_TIME); 38 | default: 39 | throw new System.Exception("Unknown enum value: " + value); 40 | } 41 | } 42 | 43 | public static void Encode(IByteWriter stream, InflationResultCode value) { 44 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/generated/Int32.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef int int32; 10 | // =========================================================================== 11 | public class Int32 { 12 | public int InnerValue { get; set; } = default(int); 13 | 14 | public Int32() { } 15 | public Int32(int Int32) 16 | { 17 | InnerValue = Int32; 18 | } 19 | public static void Encode(IByteWriter stream, Int32 encodedInt32) { 20 | XdrEncoding.EncodeInt32(encodedInt32.InnerValue, stream); 21 | } 22 | public static Int32 Decode(IByteReader stream) { 23 | Int32 decodedInt32 = new Int32(); 24 | decodedInt32.InnerValue = XdrEncoding.DecodeInt32(stream); 25 | return decodedInt32; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/Int64.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef hyper int64; 10 | // =========================================================================== 11 | public class Int64 { 12 | public long InnerValue { get; set; } = default(long); 13 | 14 | public Int64() { } 15 | public Int64(long Int64) 16 | { 17 | InnerValue = Int64; 18 | } 19 | public static void Encode(IByteWriter stream, Int64 encodedInt64) { 20 | XdrEncoding.EncodeInt64(encodedInt64.InnerValue, stream); 21 | } 22 | public static Int64 Decode(IByteReader stream) { 23 | Int64 decodedInt64 = new Int64(); 24 | decodedInt64.InnerValue = XdrEncoding.DecodeInt64(stream); 25 | return decodedInt64; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/LedgerEntryChangeType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum LedgerEntryChangeType 10 | // { 11 | // LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger 12 | // LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger 13 | // LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger 14 | // LEDGER_ENTRY_STATE = 3 // value of the entry 15 | // }; 16 | // =========================================================================== 17 | public class LedgerEntryChangeType { 18 | public enum LedgerEntryChangeTypeEnum 19 | { 20 | LEDGER_ENTRY_CREATED = 0, 21 | LEDGER_ENTRY_UPDATED = 1, 22 | LEDGER_ENTRY_REMOVED = 2, 23 | LEDGER_ENTRY_STATE = 3, 24 | } 25 | 26 | public LedgerEntryChangeTypeEnum InnerValue { get; set; } = default(LedgerEntryChangeTypeEnum); 27 | 28 | public static LedgerEntryChangeType Create(LedgerEntryChangeTypeEnum v) 29 | { 30 | return new LedgerEntryChangeType { 31 | InnerValue = v 32 | }; 33 | } 34 | 35 | public static LedgerEntryChangeType Decode(IByteReader stream) { 36 | int value = XdrEncoding.DecodeInt32(stream); 37 | switch (value) { 38 | case 0: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_CREATED); 39 | case 1: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_UPDATED); 40 | case 2: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_REMOVED); 41 | case 3: return Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_STATE); 42 | default: 43 | throw new System.Exception("Unknown enum value: " + value); 44 | } 45 | } 46 | 47 | public static void Encode(IByteWriter stream, LedgerEntryChangeType value) { 48 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/generated/LedgerEntryChanges.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef LedgerEntryChange LedgerEntryChanges<>; 10 | // =========================================================================== 11 | public class LedgerEntryChanges { 12 | public LedgerEntryChange[] InnerValue { get; set; } = default(LedgerEntryChange[]); 13 | 14 | public LedgerEntryChanges() { } 15 | public LedgerEntryChanges(LedgerEntryChange[] LedgerEntryChanges) 16 | { 17 | InnerValue = LedgerEntryChanges; 18 | } 19 | public static void Encode(IByteWriter stream, LedgerEntryChanges encodedLedgerEntryChanges) { 20 | int LedgerEntryChangesSize = encodedLedgerEntryChanges.InnerValue.Length; 21 | XdrEncoding.EncodeInt32(LedgerEntryChangesSize, stream); 22 | for (int i = 0; i < LedgerEntryChangesSize; i++) { 23 | LedgerEntryChange.Encode(stream, encodedLedgerEntryChanges.InnerValue[i]); 24 | } 25 | } 26 | public static LedgerEntryChanges Decode(IByteReader stream) { 27 | LedgerEntryChanges decodedLedgerEntryChanges = new LedgerEntryChanges(); 28 | int LedgerEntryChangessize = XdrEncoding.DecodeInt32(stream); 29 | decodedLedgerEntryChanges.InnerValue = new LedgerEntryChange[LedgerEntryChangessize]; 30 | for (int i = 0; i < LedgerEntryChangessize; i++) { 31 | decodedLedgerEntryChanges.InnerValue[i] = LedgerEntryChange.Decode(stream); 32 | } 33 | return decodedLedgerEntryChanges; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/generated/LedgerEntryType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum LedgerEntryType 10 | // { 11 | // ACCOUNT = 0, 12 | // TRUSTLINE = 1, 13 | // OFFER = 2, 14 | // DATA = 3 15 | // }; 16 | // =========================================================================== 17 | public class LedgerEntryType { 18 | public enum LedgerEntryTypeEnum 19 | { 20 | ACCOUNT = 0, 21 | TRUSTLINE = 1, 22 | OFFER = 2, 23 | DATA = 3, 24 | } 25 | 26 | public LedgerEntryTypeEnum InnerValue { get; set; } = default(LedgerEntryTypeEnum); 27 | 28 | public static LedgerEntryType Create(LedgerEntryTypeEnum v) 29 | { 30 | return new LedgerEntryType { 31 | InnerValue = v 32 | }; 33 | } 34 | 35 | public static LedgerEntryType Decode(IByteReader stream) { 36 | int value = XdrEncoding.DecodeInt32(stream); 37 | switch (value) { 38 | case 0: return Create(LedgerEntryTypeEnum.ACCOUNT); 39 | case 1: return Create(LedgerEntryTypeEnum.TRUSTLINE); 40 | case 2: return Create(LedgerEntryTypeEnum.OFFER); 41 | case 3: return Create(LedgerEntryTypeEnum.DATA); 42 | default: 43 | throw new System.Exception("Unknown enum value: " + value); 44 | } 45 | } 46 | 47 | public static void Encode(IByteWriter stream, LedgerEntryType value) { 48 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/generated/LedgerSCPMessages.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct LedgerSCPMessages 10 | // { 11 | // uint32 ledgerSeq; 12 | // SCPEnvelope messages<>; 13 | // }; 14 | // =========================================================================== 15 | public class LedgerSCPMessages { 16 | public LedgerSCPMessages () {} 17 | public Uint32 LedgerSeq { get; set; } 18 | public SCPEnvelope[] Messages { get; set; } 19 | public static void Encode(IByteWriter stream, LedgerSCPMessages encodedLedgerSCPMessages) { 20 | Uint32.Encode(stream, encodedLedgerSCPMessages.LedgerSeq); 21 | int messagessize = encodedLedgerSCPMessages.Messages.Length; 22 | XdrEncoding.EncodeInt32(messagessize, stream); 23 | for (int i = 0; i < messagessize; i++) { 24 | SCPEnvelope.Encode(stream, encodedLedgerSCPMessages.Messages[i]); 25 | } 26 | } 27 | public static LedgerSCPMessages Decode(IByteReader stream) { 28 | LedgerSCPMessages decodedLedgerSCPMessages = new LedgerSCPMessages(); 29 | decodedLedgerSCPMessages.LedgerSeq = Uint32.Decode(stream); 30 | int messagessize = XdrEncoding.DecodeInt32(stream); 31 | decodedLedgerSCPMessages.Messages = new SCPEnvelope[messagessize]; 32 | for (int i = 0; i < messagessize; i++) { 33 | decodedLedgerSCPMessages.Messages[i] = SCPEnvelope.Decode(stream); 34 | } 35 | return decodedLedgerSCPMessages; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/generated/LedgerUpgradeType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum LedgerUpgradeType 10 | // { 11 | // LEDGER_UPGRADE_VERSION = 1, 12 | // LEDGER_UPGRADE_BASE_FEE = 2, 13 | // LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3 14 | // }; 15 | // =========================================================================== 16 | public class LedgerUpgradeType { 17 | public enum LedgerUpgradeTypeEnum 18 | { 19 | LEDGER_UPGRADE_VERSION = 1, 20 | LEDGER_UPGRADE_BASE_FEE = 2, 21 | LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, 22 | } 23 | 24 | public LedgerUpgradeTypeEnum InnerValue { get; set; } = default(LedgerUpgradeTypeEnum); 25 | 26 | public static LedgerUpgradeType Create(LedgerUpgradeTypeEnum v) 27 | { 28 | return new LedgerUpgradeType { 29 | InnerValue = v 30 | }; 31 | } 32 | 33 | public static LedgerUpgradeType Decode(IByteReader stream) { 34 | int value = XdrEncoding.DecodeInt32(stream); 35 | switch (value) { 36 | case 1: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION); 37 | case 2: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE); 38 | case 3: return Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE); 39 | default: 40 | throw new System.Exception("Unknown enum value: " + value); 41 | } 42 | } 43 | 44 | public static void Encode(IByteWriter stream, LedgerUpgradeType value) { 45 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/generated/ManageDataOp.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct ManageDataOp 10 | // { 11 | // string64 dataName; 12 | // DataValue* dataValue; // set to null to clear 13 | // }; 14 | // =========================================================================== 15 | public class ManageDataOp { 16 | public ManageDataOp () {} 17 | public String64 DataName { get; set; } 18 | public DataValue DataValue { get; set; } 19 | public static void Encode(IByteWriter stream, ManageDataOp encodedManageDataOp) { 20 | String64.Encode(stream, encodedManageDataOp.DataName); 21 | if (encodedManageDataOp.DataValue != null) { 22 | XdrEncoding.EncodeInt32(1, stream); 23 | DataValue.Encode(stream, encodedManageDataOp.DataValue); 24 | } else { 25 | XdrEncoding.EncodeInt32(0, stream); 26 | } 27 | } 28 | public static ManageDataOp Decode(IByteReader stream) { 29 | ManageDataOp decodedManageDataOp = new ManageDataOp(); 30 | decodedManageDataOp.DataName = String64.Decode(stream); 31 | int dataValuePresent = XdrEncoding.DecodeInt32(stream); 32 | if (dataValuePresent != 0) { 33 | decodedManageDataOp.DataValue = DataValue.Decode(stream); 34 | } 35 | return decodedManageDataOp; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/generated/ManageDataResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union ManageDataResult switch (ManageDataResultCode code) 10 | // { 11 | // case MANAGE_DATA_SUCCESS: 12 | // void; 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class ManageDataResult { 18 | public ManageDataResult () {} 19 | public ManageDataResultCode Discriminant { get; set; } = new ManageDataResultCode(); 20 | public static void Encode(IByteWriter stream, ManageDataResult encodedManageDataResult) { 21 | XdrEncoding.EncodeInt32((int)encodedManageDataResult.Discriminant.InnerValue, stream); 22 | switch (encodedManageDataResult.Discriminant.InnerValue) { 23 | case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS: 24 | break; 25 | default: 26 | break; 27 | } 28 | } 29 | public static ManageDataResult Decode(IByteReader stream) { 30 | ManageDataResult decodedManageDataResult = new ManageDataResult(); 31 | decodedManageDataResult.Discriminant = ManageDataResultCode.Decode(stream); 32 | switch (decodedManageDataResult.Discriminant.InnerValue) { 33 | case ManageDataResultCode.ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS: 34 | break; 35 | default: 36 | break; 37 | } 38 | return decodedManageDataResult; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/generated/ManageDataResultCode.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum ManageDataResultCode 10 | // { 11 | // // codes considered as "success" for the operation 12 | // MANAGE_DATA_SUCCESS = 0, 13 | // // codes considered as "failure" for the operation 14 | // MANAGE_DATA_NOT_SUPPORTED_YET = -1, // The network hasn't moved to this protocol change yet 15 | // MANAGE_DATA_NAME_NOT_FOUND = -2, // Trying to remove a Data Entry that isn't there 16 | // MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry 17 | // MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string 18 | // }; 19 | // =========================================================================== 20 | public class ManageDataResultCode { 21 | public enum ManageDataResultCodeEnum 22 | { 23 | MANAGE_DATA_SUCCESS = 0, 24 | MANAGE_DATA_NOT_SUPPORTED_YET = -1, 25 | MANAGE_DATA_NAME_NOT_FOUND = -2, 26 | MANAGE_DATA_LOW_RESERVE = -3, 27 | MANAGE_DATA_INVALID_NAME = -4, 28 | } 29 | 30 | public ManageDataResultCodeEnum InnerValue { get; set; } = default(ManageDataResultCodeEnum); 31 | 32 | public static ManageDataResultCode Create(ManageDataResultCodeEnum v) 33 | { 34 | return new ManageDataResultCode { 35 | InnerValue = v 36 | }; 37 | } 38 | 39 | public static ManageDataResultCode Decode(IByteReader stream) { 40 | int value = XdrEncoding.DecodeInt32(stream); 41 | switch (value) { 42 | case 0: return Create(ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS); 43 | case -1: return Create(ManageDataResultCodeEnum.MANAGE_DATA_NOT_SUPPORTED_YET); 44 | case -2: return Create(ManageDataResultCodeEnum.MANAGE_DATA_NAME_NOT_FOUND); 45 | case -3: return Create(ManageDataResultCodeEnum.MANAGE_DATA_LOW_RESERVE); 46 | case -4: return Create(ManageDataResultCodeEnum.MANAGE_DATA_INVALID_NAME); 47 | default: 48 | throw new System.Exception("Unknown enum value: " + value); 49 | } 50 | } 51 | 52 | public static void Encode(IByteWriter stream, ManageDataResultCode value) { 53 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/generated/ManageOfferEffect.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum ManageOfferEffect 10 | // { 11 | // MANAGE_OFFER_CREATED = 0, 12 | // MANAGE_OFFER_UPDATED = 1, 13 | // MANAGE_OFFER_DELETED = 2 14 | // }; 15 | // =========================================================================== 16 | public class ManageOfferEffect { 17 | public enum ManageOfferEffectEnum 18 | { 19 | MANAGE_OFFER_CREATED = 0, 20 | MANAGE_OFFER_UPDATED = 1, 21 | MANAGE_OFFER_DELETED = 2, 22 | } 23 | 24 | public ManageOfferEffectEnum InnerValue { get; set; } = default(ManageOfferEffectEnum); 25 | 26 | public static ManageOfferEffect Create(ManageOfferEffectEnum v) 27 | { 28 | return new ManageOfferEffect { 29 | InnerValue = v 30 | }; 31 | } 32 | 33 | public static ManageOfferEffect Decode(IByteReader stream) { 34 | int value = XdrEncoding.DecodeInt32(stream); 35 | switch (value) { 36 | case 0: return Create(ManageOfferEffectEnum.MANAGE_OFFER_CREATED); 37 | case 1: return Create(ManageOfferEffectEnum.MANAGE_OFFER_UPDATED); 38 | case 2: return Create(ManageOfferEffectEnum.MANAGE_OFFER_DELETED); 39 | default: 40 | throw new System.Exception("Unknown enum value: " + value); 41 | } 42 | } 43 | 44 | public static void Encode(IByteWriter stream, ManageOfferEffect value) { 45 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/generated/ManageOfferOp.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct ManageOfferOp 10 | // { 11 | // Asset selling; 12 | // Asset buying; 13 | // int64 amount; // amount being sold. if set to 0, delete the offer 14 | // Price price; // price of thing being sold in terms of what you are buying 15 | // 16 | // // 0=create a new offer, otherwise edit an existing offer 17 | // uint64 offerID; 18 | // }; 19 | // =========================================================================== 20 | public class ManageOfferOp { 21 | public ManageOfferOp () {} 22 | public Asset Selling { get; set; } 23 | public Asset Buying { get; set; } 24 | public Int64 Amount { get; set; } 25 | public Price Price { get; set; } 26 | public Uint64 OfferID { get; set; } 27 | public static void Encode(IByteWriter stream, ManageOfferOp encodedManageOfferOp) { 28 | Asset.Encode(stream, encodedManageOfferOp.Selling); 29 | Asset.Encode(stream, encodedManageOfferOp.Buying); 30 | Int64.Encode(stream, encodedManageOfferOp.Amount); 31 | Price.Encode(stream, encodedManageOfferOp.Price); 32 | Uint64.Encode(stream, encodedManageOfferOp.OfferID); 33 | } 34 | public static ManageOfferOp Decode(IByteReader stream) { 35 | ManageOfferOp decodedManageOfferOp = new ManageOfferOp(); 36 | decodedManageOfferOp.Selling = Asset.Decode(stream); 37 | decodedManageOfferOp.Buying = Asset.Decode(stream); 38 | decodedManageOfferOp.Amount = Int64.Decode(stream); 39 | decodedManageOfferOp.Price = Price.Decode(stream); 40 | decodedManageOfferOp.OfferID = Uint64.Decode(stream); 41 | return decodedManageOfferOp; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/generated/ManageOfferResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union ManageOfferResult switch (ManageOfferResultCode code) 10 | // { 11 | // case MANAGE_OFFER_SUCCESS: 12 | // ManageOfferSuccessResult success; 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class ManageOfferResult { 18 | public ManageOfferResult () {} 19 | public ManageOfferResultCode Discriminant { get; set; } = new ManageOfferResultCode(); 20 | public ManageOfferSuccessResult Success { get; set; } = default(ManageOfferSuccessResult); 21 | public static void Encode(IByteWriter stream, ManageOfferResult encodedManageOfferResult) { 22 | XdrEncoding.EncodeInt32((int)encodedManageOfferResult.Discriminant.InnerValue, stream); 23 | switch (encodedManageOfferResult.Discriminant.InnerValue) { 24 | case ManageOfferResultCode.ManageOfferResultCodeEnum.MANAGE_OFFER_SUCCESS: 25 | ManageOfferSuccessResult.Encode(stream, encodedManageOfferResult.Success); 26 | break; 27 | default: 28 | break; 29 | } 30 | } 31 | public static ManageOfferResult Decode(IByteReader stream) { 32 | ManageOfferResult decodedManageOfferResult = new ManageOfferResult(); 33 | decodedManageOfferResult.Discriminant = ManageOfferResultCode.Decode(stream); 34 | switch (decodedManageOfferResult.Discriminant.InnerValue) { 35 | case ManageOfferResultCode.ManageOfferResultCodeEnum.MANAGE_OFFER_SUCCESS: 36 | decodedManageOfferResult.Success = ManageOfferSuccessResult.Decode(stream); 37 | break; 38 | default: 39 | break; 40 | } 41 | return decodedManageOfferResult; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/generated/Memo.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union Memo switch (MemoType type) 10 | // { 11 | // case MEMO_NONE: 12 | // void; 13 | // case MEMO_TEXT: 14 | // string text<28>; 15 | // case MEMO_ID: 16 | // uint64 id; 17 | // case MEMO_HASH: 18 | // Hash hash; // the hash of what to pull from the content server 19 | // case MEMO_RETURN: 20 | // Hash retHash; // the hash of the tx you are rejecting 21 | // }; 22 | // =========================================================================== 23 | public class Memo { 24 | public Memo () {} 25 | public MemoType Discriminant { get; set; } = new MemoType(); 26 | public string Text { get; set; } = default(string); 27 | public Uint64 Id { get; set; } = default(Uint64); 28 | public Hash Hash { get; set; } = default(Hash); 29 | public Hash RetHash { get; set; } = default(Hash); 30 | public static void Encode(IByteWriter stream, Memo encodedMemo) { 31 | XdrEncoding.EncodeInt32((int)encodedMemo.Discriminant.InnerValue, stream); 32 | switch (encodedMemo.Discriminant.InnerValue) { 33 | case MemoType.MemoTypeEnum.MEMO_NONE: 34 | break; 35 | case MemoType.MemoTypeEnum.MEMO_TEXT: 36 | XdrEncoding.WriteString(stream, encodedMemo.Text); 37 | break; 38 | case MemoType.MemoTypeEnum.MEMO_ID: 39 | Uint64.Encode(stream, encodedMemo.Id); 40 | break; 41 | case MemoType.MemoTypeEnum.MEMO_HASH: 42 | Hash.Encode(stream, encodedMemo.Hash); 43 | break; 44 | case MemoType.MemoTypeEnum.MEMO_RETURN: 45 | Hash.Encode(stream, encodedMemo.RetHash); 46 | break; 47 | } 48 | } 49 | public static Memo Decode(IByteReader stream) { 50 | Memo decodedMemo = new Memo(); 51 | decodedMemo.Discriminant = MemoType.Decode(stream); 52 | switch (decodedMemo.Discriminant.InnerValue) { 53 | case MemoType.MemoTypeEnum.MEMO_NONE: 54 | break; 55 | case MemoType.MemoTypeEnum.MEMO_TEXT: 56 | decodedMemo.Text = XdrEncoding.ReadString(stream); 57 | break; 58 | case MemoType.MemoTypeEnum.MEMO_ID: 59 | decodedMemo.Id = Uint64.Decode(stream); 60 | break; 61 | case MemoType.MemoTypeEnum.MEMO_HASH: 62 | decodedMemo.Hash = Hash.Decode(stream); 63 | break; 64 | case MemoType.MemoTypeEnum.MEMO_RETURN: 65 | decodedMemo.RetHash = Hash.Decode(stream); 66 | break; 67 | } 68 | return decodedMemo; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/generated/MemoType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum MemoType 10 | // { 11 | // MEMO_NONE = 0, 12 | // MEMO_TEXT = 1, 13 | // MEMO_ID = 2, 14 | // MEMO_HASH = 3, 15 | // MEMO_RETURN = 4 16 | // }; 17 | // =========================================================================== 18 | public class MemoType { 19 | public enum MemoTypeEnum 20 | { 21 | MEMO_NONE = 0, 22 | MEMO_TEXT = 1, 23 | MEMO_ID = 2, 24 | MEMO_HASH = 3, 25 | MEMO_RETURN = 4, 26 | } 27 | 28 | public MemoTypeEnum InnerValue { get; set; } = default(MemoTypeEnum); 29 | 30 | public static MemoType Create(MemoTypeEnum v) 31 | { 32 | return new MemoType { 33 | InnerValue = v 34 | }; 35 | } 36 | 37 | public static MemoType Decode(IByteReader stream) { 38 | int value = XdrEncoding.DecodeInt32(stream); 39 | switch (value) { 40 | case 0: return Create(MemoTypeEnum.MEMO_NONE); 41 | case 1: return Create(MemoTypeEnum.MEMO_TEXT); 42 | case 2: return Create(MemoTypeEnum.MEMO_ID); 43 | case 3: return Create(MemoTypeEnum.MEMO_HASH); 44 | case 4: return Create(MemoTypeEnum.MEMO_RETURN); 45 | default: 46 | throw new System.Exception("Unknown enum value: " + value); 47 | } 48 | } 49 | 50 | public static void Encode(IByteWriter stream, MemoType value) { 51 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/generated/NodeID.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef PublicKey NodeID; 10 | // =========================================================================== 11 | public class NodeID { 12 | public PublicKey InnerValue { get; set; } = default(PublicKey); 13 | 14 | public NodeID() { } 15 | public NodeID(PublicKey NodeID) 16 | { 17 | InnerValue = NodeID; 18 | } 19 | public static void Encode(IByteWriter stream, NodeID encodedNodeID) { 20 | PublicKey.Encode(stream, encodedNodeID.InnerValue); 21 | } 22 | public static NodeID Decode(IByteReader stream) { 23 | NodeID decodedNodeID = new NodeID(); 24 | decodedNodeID.InnerValue = PublicKey.Decode(stream); 25 | return decodedNodeID; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/OfferEntryFlags.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum OfferEntryFlags 10 | // { 11 | // // issuer has authorized account to perform transactions with its credit 12 | // PASSIVE_FLAG = 1 13 | // }; 14 | // =========================================================================== 15 | public class OfferEntryFlags { 16 | public enum OfferEntryFlagsEnum 17 | { 18 | PASSIVE_FLAG = 1, 19 | } 20 | 21 | public OfferEntryFlagsEnum InnerValue { get; set; } = default(OfferEntryFlagsEnum); 22 | 23 | public static OfferEntryFlags Create(OfferEntryFlagsEnum v) 24 | { 25 | return new OfferEntryFlags { 26 | InnerValue = v 27 | }; 28 | } 29 | 30 | public static OfferEntryFlags Decode(IByteReader stream) { 31 | int value = XdrEncoding.DecodeInt32(stream); 32 | switch (value) { 33 | case 1: return Create(OfferEntryFlagsEnum.PASSIVE_FLAG); 34 | default: 35 | throw new System.Exception("Unknown enum value: " + value); 36 | } 37 | } 38 | 39 | public static void Encode(IByteWriter stream, OfferEntryFlags value) { 40 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/generated/OperationMeta.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct OperationMeta 10 | // { 11 | // LedgerEntryChanges changes; 12 | // }; 13 | // =========================================================================== 14 | public class OperationMeta { 15 | public OperationMeta () {} 16 | public LedgerEntryChanges Changes { get; set; } 17 | public static void Encode(IByteWriter stream, OperationMeta encodedOperationMeta) { 18 | LedgerEntryChanges.Encode(stream, encodedOperationMeta.Changes); 19 | } 20 | public static OperationMeta Decode(IByteReader stream) { 21 | OperationMeta decodedOperationMeta = new OperationMeta(); 22 | decodedOperationMeta.Changes = LedgerEntryChanges.Decode(stream); 23 | return decodedOperationMeta; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/generated/OperationResultCode.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum OperationResultCode 10 | // { 11 | // opINNER = 0, // inner object result is valid 12 | // 13 | // opBAD_AUTH = -1, // too few valid signatures / wrong network 14 | // opNO_ACCOUNT = -2 // source account was not found 15 | // }; 16 | // =========================================================================== 17 | public class OperationResultCode { 18 | public enum OperationResultCodeEnum 19 | { 20 | opINNER = 0, 21 | opBAD_AUTH = -1, 22 | opNO_ACCOUNT = -2, 23 | } 24 | 25 | public OperationResultCodeEnum InnerValue { get; set; } = default(OperationResultCodeEnum); 26 | 27 | public static OperationResultCode Create(OperationResultCodeEnum v) 28 | { 29 | return new OperationResultCode { 30 | InnerValue = v 31 | }; 32 | } 33 | 34 | public static OperationResultCode Decode(IByteReader stream) { 35 | int value = XdrEncoding.DecodeInt32(stream); 36 | switch (value) { 37 | case 0: return Create(OperationResultCodeEnum.opINNER); 38 | case -1: return Create(OperationResultCodeEnum.opBAD_AUTH); 39 | case -2: return Create(OperationResultCodeEnum.opNO_ACCOUNT); 40 | default: 41 | throw new System.Exception("Unknown enum value: " + value); 42 | } 43 | } 44 | 45 | public static void Encode(IByteWriter stream, OperationResultCode value) { 46 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/generated/OperationType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum OperationType 10 | // { 11 | // CREATE_ACCOUNT = 0, 12 | // PAYMENT = 1, 13 | // PATH_PAYMENT = 2, 14 | // MANAGE_OFFER = 3, 15 | // CREATE_PASSIVE_OFFER = 4, 16 | // SET_OPTIONS = 5, 17 | // CHANGE_TRUST = 6, 18 | // ALLOW_TRUST = 7, 19 | // ACCOUNT_MERGE = 8, 20 | // INFLATION = 9, 21 | // MANAGE_DATA = 10 22 | // }; 23 | // =========================================================================== 24 | public class OperationType { 25 | public enum OperationTypeEnum 26 | { 27 | CREATE_ACCOUNT = 0, 28 | PAYMENT = 1, 29 | PATH_PAYMENT = 2, 30 | MANAGE_OFFER = 3, 31 | CREATE_PASSIVE_OFFER = 4, 32 | SET_OPTIONS = 5, 33 | CHANGE_TRUST = 6, 34 | ALLOW_TRUST = 7, 35 | ACCOUNT_MERGE = 8, 36 | INFLATION = 9, 37 | MANAGE_DATA = 10, 38 | } 39 | 40 | public OperationTypeEnum InnerValue { get; set; } = default(OperationTypeEnum); 41 | 42 | public static OperationType Create(OperationTypeEnum v) 43 | { 44 | return new OperationType { 45 | InnerValue = v 46 | }; 47 | } 48 | 49 | public static OperationType Decode(IByteReader stream) { 50 | int value = XdrEncoding.DecodeInt32(stream); 51 | switch (value) { 52 | case 0: return Create(OperationTypeEnum.CREATE_ACCOUNT); 53 | case 1: return Create(OperationTypeEnum.PAYMENT); 54 | case 2: return Create(OperationTypeEnum.PATH_PAYMENT); 55 | case 3: return Create(OperationTypeEnum.MANAGE_OFFER); 56 | case 4: return Create(OperationTypeEnum.CREATE_PASSIVE_OFFER); 57 | case 5: return Create(OperationTypeEnum.SET_OPTIONS); 58 | case 6: return Create(OperationTypeEnum.CHANGE_TRUST); 59 | case 7: return Create(OperationTypeEnum.ALLOW_TRUST); 60 | case 8: return Create(OperationTypeEnum.ACCOUNT_MERGE); 61 | case 9: return Create(OperationTypeEnum.INFLATION); 62 | case 10: return Create(OperationTypeEnum.MANAGE_DATA); 63 | default: 64 | throw new System.Exception("Unknown enum value: " + value); 65 | } 66 | } 67 | 68 | public static void Encode(IByteWriter stream, OperationType value) { 69 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/generated/PaymentOp.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct PaymentOp 10 | // { 11 | // AccountID destination; // recipient of the payment 12 | // Asset asset; // what they end up with 13 | // int64 amount; // amount they end up with 14 | // }; 15 | // =========================================================================== 16 | public class PaymentOp { 17 | public PaymentOp () {} 18 | public AccountID Destination { get; set; } 19 | public Asset Asset { get; set; } 20 | public Int64 Amount { get; set; } 21 | public static void Encode(IByteWriter stream, PaymentOp encodedPaymentOp) { 22 | AccountID.Encode(stream, encodedPaymentOp.Destination); 23 | Asset.Encode(stream, encodedPaymentOp.Asset); 24 | Int64.Encode(stream, encodedPaymentOp.Amount); 25 | } 26 | public static PaymentOp Decode(IByteReader stream) { 27 | PaymentOp decodedPaymentOp = new PaymentOp(); 28 | decodedPaymentOp.Destination = AccountID.Decode(stream); 29 | decodedPaymentOp.Asset = Asset.Decode(stream); 30 | decodedPaymentOp.Amount = Int64.Decode(stream); 31 | return decodedPaymentOp; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/generated/PaymentResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union PaymentResult switch (PaymentResultCode code) 10 | // { 11 | // case PAYMENT_SUCCESS: 12 | // void; 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class PaymentResult { 18 | public PaymentResult () {} 19 | public PaymentResultCode Discriminant { get; set; } = new PaymentResultCode(); 20 | public static void Encode(IByteWriter stream, PaymentResult encodedPaymentResult) { 21 | XdrEncoding.EncodeInt32((int)encodedPaymentResult.Discriminant.InnerValue, stream); 22 | switch (encodedPaymentResult.Discriminant.InnerValue) { 23 | case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SUCCESS: 24 | break; 25 | default: 26 | break; 27 | } 28 | } 29 | public static PaymentResult Decode(IByteReader stream) { 30 | PaymentResult decodedPaymentResult = new PaymentResult(); 31 | decodedPaymentResult.Discriminant = PaymentResultCode.Decode(stream); 32 | switch (decodedPaymentResult.Discriminant.InnerValue) { 33 | case PaymentResultCode.PaymentResultCodeEnum.PAYMENT_SUCCESS: 34 | break; 35 | default: 36 | break; 37 | } 38 | return decodedPaymentResult; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/generated/Price.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct Price 10 | // { 11 | // int32 n; // numerator 12 | // int32 d; // denominator 13 | // }; 14 | // =========================================================================== 15 | public class Price { 16 | public Price () {} 17 | public Int32 N { get; set; } 18 | public Int32 D { get; set; } 19 | public static void Encode(IByteWriter stream, Price encodedPrice) { 20 | Int32.Encode(stream, encodedPrice.N); 21 | Int32.Encode(stream, encodedPrice.D); 22 | } 23 | public static Price Decode(IByteReader stream) { 24 | Price decodedPrice = new Price(); 25 | decodedPrice.N = Int32.Decode(stream); 26 | decodedPrice.D = Int32.Decode(stream); 27 | return decodedPrice; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("generated")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("generated")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0fa7289e-a8bc-4d10-8eb0-520880ab9eda")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/generated/PublicKey.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union PublicKey switch (PublicKeyType type) 10 | // { 11 | // case PUBLIC_KEY_TYPE_ED25519: 12 | // uint256 ed25519; 13 | // }; 14 | // =========================================================================== 15 | public class PublicKey { 16 | public PublicKey () {} 17 | public PublicKeyType Discriminant { get; set; } = new PublicKeyType(); 18 | public Uint256 Ed25519 { get; set; } = default(Uint256); 19 | public static void Encode(IByteWriter stream, PublicKey encodedPublicKey) { 20 | XdrEncoding.EncodeInt32((int)encodedPublicKey.Discriminant.InnerValue, stream); 21 | switch (encodedPublicKey.Discriminant.InnerValue) { 22 | case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519: 23 | Uint256.Encode(stream, encodedPublicKey.Ed25519); 24 | break; 25 | } 26 | } 27 | public static PublicKey Decode(IByteReader stream) { 28 | PublicKey decodedPublicKey = new PublicKey(); 29 | decodedPublicKey.Discriminant = PublicKeyType.Decode(stream); 30 | switch (decodedPublicKey.Discriminant.InnerValue) { 31 | case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519: 32 | decodedPublicKey.Ed25519 = Uint256.Decode(stream); 33 | break; 34 | } 35 | return decodedPublicKey; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/generated/PublicKeyType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum PublicKeyType 10 | // { 11 | // PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519 12 | // }; 13 | // =========================================================================== 14 | public class PublicKeyType { 15 | public enum PublicKeyTypeEnum 16 | { 17 | PUBLIC_KEY_TYPE_ED25519 = 0, 18 | } 19 | 20 | public PublicKeyTypeEnum InnerValue { get; set; } = default(PublicKeyTypeEnum); 21 | 22 | public static PublicKeyType Create(PublicKeyTypeEnum v) 23 | { 24 | return new PublicKeyType { 25 | InnerValue = v 26 | }; 27 | } 28 | 29 | public static PublicKeyType Decode(IByteReader stream) { 30 | int value = XdrEncoding.DecodeInt32(stream); 31 | switch (value) { 32 | case 0: return Create(PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519); 33 | default: 34 | throw new System.Exception("Unknown enum value: " + value); 35 | } 36 | } 37 | 38 | public static void Encode(IByteWriter stream, PublicKeyType value) { 39 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/generated/SCPBallot.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct SCPBallot 10 | // { 11 | // uint32 counter; // n 12 | // Value value; // x 13 | // }; 14 | // =========================================================================== 15 | public class SCPBallot { 16 | public SCPBallot () {} 17 | public Uint32 Counter { get; set; } 18 | public Value Value { get; set; } 19 | public static void Encode(IByteWriter stream, SCPBallot encodedSCPBallot) { 20 | Uint32.Encode(stream, encodedSCPBallot.Counter); 21 | Value.Encode(stream, encodedSCPBallot.Value); 22 | } 23 | public static SCPBallot Decode(IByteReader stream) { 24 | SCPBallot decodedSCPBallot = new SCPBallot(); 25 | decodedSCPBallot.Counter = Uint32.Decode(stream); 26 | decodedSCPBallot.Value = Value.Decode(stream); 27 | return decodedSCPBallot; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/SCPEnvelope.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct SCPEnvelope 10 | // { 11 | // SCPStatement statement; 12 | // Signature signature; 13 | // }; 14 | // =========================================================================== 15 | public class SCPEnvelope { 16 | public SCPEnvelope () {} 17 | public SCPStatement Statement { get; set; } 18 | public Signature Signature { get; set; } 19 | public static void Encode(IByteWriter stream, SCPEnvelope encodedSCPEnvelope) { 20 | SCPStatement.Encode(stream, encodedSCPEnvelope.Statement); 21 | Signature.Encode(stream, encodedSCPEnvelope.Signature); 22 | } 23 | public static SCPEnvelope Decode(IByteReader stream) { 24 | SCPEnvelope decodedSCPEnvelope = new SCPEnvelope(); 25 | decodedSCPEnvelope.Statement = SCPStatement.Decode(stream); 26 | decodedSCPEnvelope.Signature = Signature.Decode(stream); 27 | return decodedSCPEnvelope; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/SCPHistoryEntry.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union SCPHistoryEntry switch (int v) 10 | // { 11 | // case 0: 12 | // SCPHistoryEntryV0 v0; 13 | // }; 14 | // =========================================================================== 15 | public class SCPHistoryEntry { 16 | public SCPHistoryEntry () {} 17 | public int Discriminant { get; set; } = new int(); 18 | public SCPHistoryEntryV0 V0 { get; set; } = default(SCPHistoryEntryV0); 19 | public static void Encode(IByteWriter stream, SCPHistoryEntry encodedSCPHistoryEntry) { 20 | XdrEncoding.EncodeInt32(encodedSCPHistoryEntry.Discriminant, stream); 21 | switch (encodedSCPHistoryEntry.Discriminant) { 22 | case 0: 23 | SCPHistoryEntryV0.Encode(stream, encodedSCPHistoryEntry.V0); 24 | break; 25 | } 26 | } 27 | public static SCPHistoryEntry Decode(IByteReader stream) { 28 | SCPHistoryEntry decodedSCPHistoryEntry = new SCPHistoryEntry(); 29 | decodedSCPHistoryEntry.Discriminant = XdrEncoding.DecodeInt32(stream); 30 | switch (decodedSCPHistoryEntry.Discriminant) { 31 | case 0: 32 | decodedSCPHistoryEntry.V0 = SCPHistoryEntryV0.Decode(stream); 33 | break; 34 | } 35 | return decodedSCPHistoryEntry; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/generated/SCPHistoryEntryV0.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct SCPHistoryEntryV0 10 | // { 11 | // SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages 12 | // LedgerSCPMessages ledgerMessages; 13 | // }; 14 | // =========================================================================== 15 | public class SCPHistoryEntryV0 { 16 | public SCPHistoryEntryV0 () {} 17 | public SCPQuorumSet[] QuorumSets { get; set; } 18 | public LedgerSCPMessages LedgerMessages { get; set; } 19 | public static void Encode(IByteWriter stream, SCPHistoryEntryV0 encodedSCPHistoryEntryV0) { 20 | int quorumSetssize = encodedSCPHistoryEntryV0.QuorumSets.Length; 21 | XdrEncoding.EncodeInt32(quorumSetssize, stream); 22 | for (int i = 0; i < quorumSetssize; i++) { 23 | SCPQuorumSet.Encode(stream, encodedSCPHistoryEntryV0.QuorumSets[i]); 24 | } 25 | LedgerSCPMessages.Encode(stream, encodedSCPHistoryEntryV0.LedgerMessages); 26 | } 27 | public static SCPHistoryEntryV0 Decode(IByteReader stream) { 28 | SCPHistoryEntryV0 decodedSCPHistoryEntryV0 = new SCPHistoryEntryV0(); 29 | int quorumSetssize = XdrEncoding.DecodeInt32(stream); 30 | decodedSCPHistoryEntryV0.QuorumSets = new SCPQuorumSet[quorumSetssize]; 31 | for (int i = 0; i < quorumSetssize; i++) { 32 | decodedSCPHistoryEntryV0.QuorumSets[i] = SCPQuorumSet.Decode(stream); 33 | } 34 | decodedSCPHistoryEntryV0.LedgerMessages = LedgerSCPMessages.Decode(stream); 35 | return decodedSCPHistoryEntryV0; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/generated/SCPNomination.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct SCPNomination 10 | // { 11 | // Hash quorumSetHash; // D 12 | // Value votes<>; // X 13 | // Value accepted<>; // Y 14 | // }; 15 | // =========================================================================== 16 | public class SCPNomination { 17 | public SCPNomination () {} 18 | public Hash QuorumSetHash { get; set; } 19 | public Value[] Votes { get; set; } 20 | public Value[] Accepted { get; set; } 21 | public static void Encode(IByteWriter stream, SCPNomination encodedSCPNomination) { 22 | Hash.Encode(stream, encodedSCPNomination.QuorumSetHash); 23 | int votessize = encodedSCPNomination.Votes.Length; 24 | XdrEncoding.EncodeInt32(votessize, stream); 25 | for (int i = 0; i < votessize; i++) { 26 | Value.Encode(stream, encodedSCPNomination.Votes[i]); 27 | } 28 | int acceptedsize = encodedSCPNomination.Accepted.Length; 29 | XdrEncoding.EncodeInt32(acceptedsize, stream); 30 | for (int i = 0; i < acceptedsize; i++) { 31 | Value.Encode(stream, encodedSCPNomination.Accepted[i]); 32 | } 33 | } 34 | public static SCPNomination Decode(IByteReader stream) { 35 | SCPNomination decodedSCPNomination = new SCPNomination(); 36 | decodedSCPNomination.QuorumSetHash = Hash.Decode(stream); 37 | int votessize = XdrEncoding.DecodeInt32(stream); 38 | decodedSCPNomination.Votes = new Value[votessize]; 39 | for (int i = 0; i < votessize; i++) { 40 | decodedSCPNomination.Votes[i] = Value.Decode(stream); 41 | } 42 | int acceptedsize = XdrEncoding.DecodeInt32(stream); 43 | decodedSCPNomination.Accepted = new Value[acceptedsize]; 44 | for (int i = 0; i < acceptedsize; i++) { 45 | decodedSCPNomination.Accepted[i] = Value.Decode(stream); 46 | } 47 | return decodedSCPNomination; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/generated/SCPQuorumSet.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct SCPQuorumSet 10 | // { 11 | // uint32 threshold; 12 | // PublicKey validators<>; 13 | // SCPQuorumSet innerSets<>; 14 | // }; 15 | // =========================================================================== 16 | public class SCPQuorumSet { 17 | public SCPQuorumSet () {} 18 | public Uint32 Threshold { get; set; } 19 | public PublicKey[] Validators { get; set; } 20 | public SCPQuorumSet[] InnerSets { get; set; } 21 | public static void Encode(IByteWriter stream, SCPQuorumSet encodedSCPQuorumSet) { 22 | Uint32.Encode(stream, encodedSCPQuorumSet.Threshold); 23 | int validatorssize = encodedSCPQuorumSet.Validators.Length; 24 | XdrEncoding.EncodeInt32(validatorssize, stream); 25 | for (int i = 0; i < validatorssize; i++) { 26 | PublicKey.Encode(stream, encodedSCPQuorumSet.Validators[i]); 27 | } 28 | int innerSetssize = encodedSCPQuorumSet.InnerSets.Length; 29 | XdrEncoding.EncodeInt32(innerSetssize, stream); 30 | for (int i = 0; i < innerSetssize; i++) { 31 | SCPQuorumSet.Encode(stream, encodedSCPQuorumSet.InnerSets[i]); 32 | } 33 | } 34 | public static SCPQuorumSet Decode(IByteReader stream) { 35 | SCPQuorumSet decodedSCPQuorumSet = new SCPQuorumSet(); 36 | decodedSCPQuorumSet.Threshold = Uint32.Decode(stream); 37 | int validatorssize = XdrEncoding.DecodeInt32(stream); 38 | decodedSCPQuorumSet.Validators = new PublicKey[validatorssize]; 39 | for (int i = 0; i < validatorssize; i++) { 40 | decodedSCPQuorumSet.Validators[i] = PublicKey.Decode(stream); 41 | } 42 | int innerSetssize = XdrEncoding.DecodeInt32(stream); 43 | decodedSCPQuorumSet.InnerSets = new SCPQuorumSet[innerSetssize]; 44 | for (int i = 0; i < innerSetssize; i++) { 45 | decodedSCPQuorumSet.InnerSets[i] = SCPQuorumSet.Decode(stream); 46 | } 47 | return decodedSCPQuorumSet; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/generated/SCPStatementType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum SCPStatementType 10 | // { 11 | // SCP_ST_PREPARE = 0, 12 | // SCP_ST_CONFIRM = 1, 13 | // SCP_ST_EXTERNALIZE = 2, 14 | // SCP_ST_NOMINATE = 3 15 | // }; 16 | // =========================================================================== 17 | public class SCPStatementType { 18 | public enum SCPStatementTypeEnum 19 | { 20 | SCP_ST_PREPARE = 0, 21 | SCP_ST_CONFIRM = 1, 22 | SCP_ST_EXTERNALIZE = 2, 23 | SCP_ST_NOMINATE = 3, 24 | } 25 | 26 | public SCPStatementTypeEnum InnerValue { get; set; } = default(SCPStatementTypeEnum); 27 | 28 | public static SCPStatementType Create(SCPStatementTypeEnum v) 29 | { 30 | return new SCPStatementType { 31 | InnerValue = v 32 | }; 33 | } 34 | 35 | public static SCPStatementType Decode(IByteReader stream) { 36 | int value = XdrEncoding.DecodeInt32(stream); 37 | switch (value) { 38 | case 0: return Create(SCPStatementTypeEnum.SCP_ST_PREPARE); 39 | case 1: return Create(SCPStatementTypeEnum.SCP_ST_CONFIRM); 40 | case 2: return Create(SCPStatementTypeEnum.SCP_ST_EXTERNALIZE); 41 | case 3: return Create(SCPStatementTypeEnum.SCP_ST_NOMINATE); 42 | default: 43 | throw new System.Exception("Unknown enum value: " + value); 44 | } 45 | } 46 | 47 | public static void Encode(IByteWriter stream, SCPStatementType value) { 48 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/generated/SequenceNumber.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef uint64 SequenceNumber; 10 | // =========================================================================== 11 | public class SequenceNumber { 12 | public Uint64 InnerValue { get; set; } = default(Uint64); 13 | 14 | public SequenceNumber() { } 15 | public SequenceNumber(Uint64 SequenceNumber) 16 | { 17 | InnerValue = SequenceNumber; 18 | } 19 | public static void Encode(IByteWriter stream, SequenceNumber encodedSequenceNumber) { 20 | Uint64.Encode(stream, encodedSequenceNumber.InnerValue); 21 | } 22 | public static SequenceNumber Decode(IByteReader stream) { 23 | SequenceNumber decodedSequenceNumber = new SequenceNumber(); 24 | decodedSequenceNumber.InnerValue = Uint64.Decode(stream); 25 | return decodedSequenceNumber; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/SetOptionsResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union SetOptionsResult switch (SetOptionsResultCode code) 10 | // { 11 | // case SET_OPTIONS_SUCCESS: 12 | // void; 13 | // default: 14 | // void; 15 | // }; 16 | // =========================================================================== 17 | public class SetOptionsResult { 18 | public SetOptionsResult () {} 19 | public SetOptionsResultCode Discriminant { get; set; } = new SetOptionsResultCode(); 20 | public static void Encode(IByteWriter stream, SetOptionsResult encodedSetOptionsResult) { 21 | XdrEncoding.EncodeInt32((int)encodedSetOptionsResult.Discriminant.InnerValue, stream); 22 | switch (encodedSetOptionsResult.Discriminant.InnerValue) { 23 | case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS: 24 | break; 25 | default: 26 | break; 27 | } 28 | } 29 | public static SetOptionsResult Decode(IByteReader stream) { 30 | SetOptionsResult decodedSetOptionsResult = new SetOptionsResult(); 31 | decodedSetOptionsResult.Discriminant = SetOptionsResultCode.Decode(stream); 32 | switch (decodedSetOptionsResult.Discriminant.InnerValue) { 33 | case SetOptionsResultCode.SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS: 34 | break; 35 | default: 36 | break; 37 | } 38 | return decodedSetOptionsResult; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/generated/Signature.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef opaque Signature<64>; 10 | // =========================================================================== 11 | public class Signature { 12 | public byte[] InnerValue { get; set; } = default(byte[]); 13 | 14 | public Signature() { } 15 | public Signature(byte[] Signature) 16 | { 17 | InnerValue = Signature; 18 | } 19 | public static void Encode(IByteWriter stream, Signature encodedSignature) { 20 | int SignatureSize = encodedSignature.InnerValue.Length; 21 | XdrEncoding.EncodeInt32(SignatureSize, stream); 22 | XdrEncoding.WriteFixOpaque(stream, (uint)SignatureSize, encodedSignature.InnerValue); 23 | } 24 | public static Signature Decode(IByteReader stream) { 25 | Signature decodedSignature = new Signature(); 26 | int Signaturesize = XdrEncoding.DecodeInt32(stream); 27 | decodedSignature.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Signaturesize); 28 | return decodedSignature; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/generated/SignatureHint.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef opaque SignatureHint[4]; 10 | // =========================================================================== 11 | public class SignatureHint { 12 | public byte[] InnerValue { get; set; } = default(byte[]); 13 | 14 | public SignatureHint() { } 15 | public SignatureHint(byte[] SignatureHint) 16 | { 17 | InnerValue = SignatureHint; 18 | } 19 | public static void Encode(IByteWriter stream, SignatureHint encodedSignatureHint) { 20 | int SignatureHintSize = encodedSignatureHint.InnerValue.Length; 21 | XdrEncoding.WriteFixOpaque(stream, (uint)SignatureHintSize, encodedSignatureHint.InnerValue); 22 | } 23 | public static SignatureHint Decode(IByteReader stream) { 24 | SignatureHint decodedSignatureHint = new SignatureHint(); 25 | int SignatureHintsize = 4; 26 | decodedSignatureHint.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)SignatureHintsize); 27 | return decodedSignatureHint; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/Signer.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct Signer 10 | // { 11 | // SignerKey key; 12 | // uint32 weight; // really only need 1byte 13 | // }; 14 | // =========================================================================== 15 | public class Signer { 16 | public Signer () {} 17 | public SignerKey Key { get; set; } 18 | public Uint32 Weight { get; set; } 19 | public static void Encode(IByteWriter stream, Signer encodedSigner) { 20 | SignerKey.Encode(stream, encodedSigner.Key); 21 | Uint32.Encode(stream, encodedSigner.Weight); 22 | } 23 | public static Signer Decode(IByteReader stream) { 24 | Signer decodedSigner = new Signer(); 25 | decodedSigner.Key = SignerKey.Decode(stream); 26 | decodedSigner.Weight = Uint32.Decode(stream); 27 | return decodedSigner; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/SignerKey.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union SignerKey switch (SignerKeyType type) 10 | // { 11 | // case SIGNER_KEY_TYPE_ED25519: 12 | // uint256 ed25519; 13 | // case SIGNER_KEY_TYPE_PRE_AUTH_TX: 14 | // /* Hash of Transaction structure */ 15 | // uint256 preAuthTx; 16 | // case SIGNER_KEY_TYPE_HASH_X: 17 | // /* Hash of random 256 bit preimage X */ 18 | // uint256 hashX; 19 | // }; 20 | // =========================================================================== 21 | public class SignerKey { 22 | public SignerKey () {} 23 | public SignerKeyType Discriminant { get; set; } = new SignerKeyType(); 24 | public Uint256 Ed25519 { get; set; } = default(Uint256); 25 | public Uint256 PreAuthTx { get; set; } = default(Uint256); 26 | public Uint256 HashX { get; set; } = default(Uint256); 27 | public static void Encode(IByteWriter stream, SignerKey encodedSignerKey) { 28 | XdrEncoding.EncodeInt32((int)encodedSignerKey.Discriminant.InnerValue, stream); 29 | switch (encodedSignerKey.Discriminant.InnerValue) { 30 | case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: 31 | Uint256.Encode(stream, encodedSignerKey.Ed25519); 32 | break; 33 | case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: 34 | Uint256.Encode(stream, encodedSignerKey.PreAuthTx); 35 | break; 36 | case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: 37 | Uint256.Encode(stream, encodedSignerKey.HashX); 38 | break; 39 | } 40 | } 41 | public static SignerKey Decode(IByteReader stream) { 42 | SignerKey decodedSignerKey = new SignerKey(); 43 | decodedSignerKey.Discriminant = SignerKeyType.Decode(stream); 44 | switch (decodedSignerKey.Discriminant.InnerValue) { 45 | case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: 46 | decodedSignerKey.Ed25519 = Uint256.Decode(stream); 47 | break; 48 | case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: 49 | decodedSignerKey.PreAuthTx = Uint256.Decode(stream); 50 | break; 51 | case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: 52 | decodedSignerKey.HashX = Uint256.Decode(stream); 53 | break; 54 | } 55 | return decodedSignerKey; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/generated/SignerKeyType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum SignerKeyType 10 | // { 11 | // SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519, 12 | // SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX, 13 | // SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X 14 | // }; 15 | // =========================================================================== 16 | public class SignerKeyType { 17 | public enum SignerKeyTypeEnum 18 | { 19 | SIGNER_KEY_TYPE_ED25519 = 0, 20 | SIGNER_KEY_TYPE_PRE_AUTH_TX = 1, 21 | SIGNER_KEY_TYPE_HASH_X = 2, 22 | } 23 | 24 | public SignerKeyTypeEnum InnerValue { get; set; } = default(SignerKeyTypeEnum); 25 | 26 | public static SignerKeyType Create(SignerKeyTypeEnum v) 27 | { 28 | return new SignerKeyType { 29 | InnerValue = v 30 | }; 31 | } 32 | 33 | public static SignerKeyType Decode(IByteReader stream) { 34 | int value = XdrEncoding.DecodeInt32(stream); 35 | switch (value) { 36 | case 0: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519); 37 | case 1: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX); 38 | case 2: return Create(SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X); 39 | default: 40 | throw new System.Exception("Unknown enum value: " + value); 41 | } 42 | } 43 | 44 | public static void Encode(IByteWriter stream, SignerKeyType value) { 45 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/generated/SimplePaymentResult.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct SimplePaymentResult 10 | // { 11 | // AccountID destination; 12 | // Asset asset; 13 | // int64 amount; 14 | // }; 15 | // =========================================================================== 16 | public class SimplePaymentResult { 17 | public SimplePaymentResult () {} 18 | public AccountID Destination { get; set; } 19 | public Asset Asset { get; set; } 20 | public Int64 Amount { get; set; } 21 | public static void Encode(IByteWriter stream, SimplePaymentResult encodedSimplePaymentResult) { 22 | AccountID.Encode(stream, encodedSimplePaymentResult.Destination); 23 | Asset.Encode(stream, encodedSimplePaymentResult.Asset); 24 | Int64.Encode(stream, encodedSimplePaymentResult.Amount); 25 | } 26 | public static SimplePaymentResult Decode(IByteReader stream) { 27 | SimplePaymentResult decodedSimplePaymentResult = new SimplePaymentResult(); 28 | decodedSimplePaymentResult.Destination = AccountID.Decode(stream); 29 | decodedSimplePaymentResult.Asset = Asset.Decode(stream); 30 | decodedSimplePaymentResult.Amount = Int64.Decode(stream); 31 | return decodedSimplePaymentResult; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/generated/String32.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef string string32<32>; 10 | // =========================================================================== 11 | public class String32 { 12 | public string InnerValue { get; set; } = default(string); 13 | 14 | public String32() { } 15 | public String32(string String32) 16 | { 17 | InnerValue = String32; 18 | } 19 | public static void Encode(IByteWriter stream, String32 encodedString32) { 20 | XdrEncoding.WriteString(stream, encodedString32.InnerValue); 21 | } 22 | public static String32 Decode(IByteReader stream) { 23 | String32 decodedString32 = new String32(); 24 | decodedString32.InnerValue = XdrEncoding.ReadString(stream); 25 | return decodedString32; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/String64.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef string string64<64>; 10 | // =========================================================================== 11 | public class String64 { 12 | public string InnerValue { get; set; } = default(string); 13 | 14 | public String64() { } 15 | public String64(string String64) 16 | { 17 | InnerValue = String64; 18 | } 19 | public static void Encode(IByteWriter stream, String64 encodedString64) { 20 | XdrEncoding.WriteString(stream, encodedString64.InnerValue); 21 | } 22 | public static String64 Decode(IByteReader stream) { 23 | String64 decodedString64 = new String64(); 24 | decodedString64.InnerValue = XdrEncoding.ReadString(stream); 25 | return decodedString64; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/ThresholdIndexes.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum ThresholdIndexes 10 | // { 11 | // THRESHOLD_MASTER_WEIGHT = 0, 12 | // THRESHOLD_LOW = 1, 13 | // THRESHOLD_MED = 2, 14 | // THRESHOLD_HIGH = 3 15 | // }; 16 | // =========================================================================== 17 | public class ThresholdIndexes { 18 | public enum ThresholdIndexesEnum 19 | { 20 | THRESHOLD_MASTER_WEIGHT = 0, 21 | THRESHOLD_LOW = 1, 22 | THRESHOLD_MED = 2, 23 | THRESHOLD_HIGH = 3, 24 | } 25 | 26 | public ThresholdIndexesEnum InnerValue { get; set; } = default(ThresholdIndexesEnum); 27 | 28 | public static ThresholdIndexes Create(ThresholdIndexesEnum v) 29 | { 30 | return new ThresholdIndexes { 31 | InnerValue = v 32 | }; 33 | } 34 | 35 | public static ThresholdIndexes Decode(IByteReader stream) { 36 | int value = XdrEncoding.DecodeInt32(stream); 37 | switch (value) { 38 | case 0: return Create(ThresholdIndexesEnum.THRESHOLD_MASTER_WEIGHT); 39 | case 1: return Create(ThresholdIndexesEnum.THRESHOLD_LOW); 40 | case 2: return Create(ThresholdIndexesEnum.THRESHOLD_MED); 41 | case 3: return Create(ThresholdIndexesEnum.THRESHOLD_HIGH); 42 | default: 43 | throw new System.Exception("Unknown enum value: " + value); 44 | } 45 | } 46 | 47 | public static void Encode(IByteWriter stream, ThresholdIndexes value) { 48 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/generated/Thresholds.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef opaque Thresholds[4]; 10 | // =========================================================================== 11 | public class Thresholds { 12 | public byte[] InnerValue { get; set; } = default(byte[]); 13 | 14 | public Thresholds() { } 15 | public Thresholds(byte[] Thresholds) 16 | { 17 | InnerValue = Thresholds; 18 | } 19 | public static void Encode(IByteWriter stream, Thresholds encodedThresholds) { 20 | int ThresholdsSize = encodedThresholds.InnerValue.Length; 21 | XdrEncoding.WriteFixOpaque(stream, (uint)ThresholdsSize, encodedThresholds.InnerValue); 22 | } 23 | public static Thresholds Decode(IByteReader stream) { 24 | Thresholds decodedThresholds = new Thresholds(); 25 | int Thresholdssize = 4; 26 | decodedThresholds.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Thresholdssize); 27 | return decodedThresholds; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/TimeBounds.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct TimeBounds 10 | // { 11 | // uint64 minTime; 12 | // uint64 maxTime; // 0 here means no maxTime 13 | // }; 14 | // =========================================================================== 15 | public class TimeBounds { 16 | public TimeBounds () {} 17 | public Uint64 MinTime { get; set; } 18 | public Uint64 MaxTime { get; set; } 19 | public static void Encode(IByteWriter stream, TimeBounds encodedTimeBounds) { 20 | Uint64.Encode(stream, encodedTimeBounds.MinTime); 21 | Uint64.Encode(stream, encodedTimeBounds.MaxTime); 22 | } 23 | public static TimeBounds Decode(IByteReader stream) { 24 | TimeBounds decodedTimeBounds = new TimeBounds(); 25 | decodedTimeBounds.MinTime = Uint64.Decode(stream); 26 | decodedTimeBounds.MaxTime = Uint64.Decode(stream); 27 | return decodedTimeBounds; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/TransactionEnvelope.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct TransactionEnvelope 10 | // { 11 | // Transaction tx; 12 | // /* Each decorated signature is a signature over the SHA256 hash of 13 | // * a TransactionSignaturePayload */ 14 | // DecoratedSignature 15 | // signatures<20>; 16 | // }; 17 | // =========================================================================== 18 | public class TransactionEnvelope { 19 | public TransactionEnvelope () {} 20 | public Transaction Tx { get; set; } 21 | public DecoratedSignature[] Signatures { get; set; } 22 | public static void Encode(IByteWriter stream, TransactionEnvelope encodedTransactionEnvelope) { 23 | Transaction.Encode(stream, encodedTransactionEnvelope.Tx); 24 | int signaturessize = encodedTransactionEnvelope.Signatures.Length; 25 | XdrEncoding.EncodeInt32(signaturessize, stream); 26 | for (int i = 0; i < signaturessize; i++) { 27 | DecoratedSignature.Encode(stream, encodedTransactionEnvelope.Signatures[i]); 28 | } 29 | } 30 | public static TransactionEnvelope Decode(IByteReader stream) { 31 | TransactionEnvelope decodedTransactionEnvelope = new TransactionEnvelope(); 32 | decodedTransactionEnvelope.Tx = Transaction.Decode(stream); 33 | int signaturessize = XdrEncoding.DecodeInt32(stream); 34 | decodedTransactionEnvelope.Signatures = new DecoratedSignature[signaturessize]; 35 | for (int i = 0; i < signaturessize; i++) { 36 | decodedTransactionEnvelope.Signatures[i] = DecoratedSignature.Decode(stream); 37 | } 38 | return decodedTransactionEnvelope; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/generated/TransactionMeta.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // union TransactionMeta switch (int v) 10 | // { 11 | // case 0: 12 | // OperationMeta operations<>; 13 | // }; 14 | // =========================================================================== 15 | public class TransactionMeta { 16 | public TransactionMeta () {} 17 | public int Discriminant { get; set; } = new int(); 18 | public OperationMeta[] Operations { get; set; } = default(OperationMeta[]); 19 | public static void Encode(IByteWriter stream, TransactionMeta encodedTransactionMeta) { 20 | XdrEncoding.EncodeInt32(encodedTransactionMeta.Discriminant, stream); 21 | switch (encodedTransactionMeta.Discriminant) { 22 | case 0: 23 | int operationssize = encodedTransactionMeta.Operations.Length; 24 | XdrEncoding.EncodeInt32(operationssize, stream); 25 | for (int i = 0; i < operationssize; i++) { 26 | OperationMeta.Encode(stream, encodedTransactionMeta.Operations[i]); 27 | } 28 | break; 29 | } 30 | } 31 | public static TransactionMeta Decode(IByteReader stream) { 32 | TransactionMeta decodedTransactionMeta = new TransactionMeta(); 33 | decodedTransactionMeta.Discriminant = XdrEncoding.DecodeInt32(stream); 34 | switch (decodedTransactionMeta.Discriminant) { 35 | case 0: 36 | int operationssize = XdrEncoding.DecodeInt32(stream); 37 | decodedTransactionMeta.Operations = new OperationMeta[operationssize]; 38 | for (int i = 0; i < operationssize; i++) { 39 | decodedTransactionMeta.Operations[i] = OperationMeta.Decode(stream); 40 | } 41 | break; 42 | } 43 | return decodedTransactionMeta; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/generated/TransactionResultPair.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct TransactionResultPair 10 | // { 11 | // Hash transactionHash; 12 | // TransactionResult result; // result for the transaction 13 | // }; 14 | // =========================================================================== 15 | public class TransactionResultPair { 16 | public TransactionResultPair () {} 17 | public Hash TransactionHash { get; set; } 18 | public TransactionResult Result { get; set; } 19 | public static void Encode(IByteWriter stream, TransactionResultPair encodedTransactionResultPair) { 20 | Hash.Encode(stream, encodedTransactionResultPair.TransactionHash); 21 | TransactionResult.Encode(stream, encodedTransactionResultPair.Result); 22 | } 23 | public static TransactionResultPair Decode(IByteReader stream) { 24 | TransactionResultPair decodedTransactionResultPair = new TransactionResultPair(); 25 | decodedTransactionResultPair.TransactionHash = Hash.Decode(stream); 26 | decodedTransactionResultPair.Result = TransactionResult.Decode(stream); 27 | return decodedTransactionResultPair; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/TransactionResultSet.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct TransactionResultSet 10 | // { 11 | // TransactionResultPair results<>; 12 | // }; 13 | // =========================================================================== 14 | public class TransactionResultSet { 15 | public TransactionResultSet () {} 16 | public TransactionResultPair[] Results { get; set; } 17 | public static void Encode(IByteWriter stream, TransactionResultSet encodedTransactionResultSet) { 18 | int resultssize = encodedTransactionResultSet.Results.Length; 19 | XdrEncoding.EncodeInt32(resultssize, stream); 20 | for (int i = 0; i < resultssize; i++) { 21 | TransactionResultPair.Encode(stream, encodedTransactionResultSet.Results[i]); 22 | } 23 | } 24 | public static TransactionResultSet Decode(IByteReader stream) { 25 | TransactionResultSet decodedTransactionResultSet = new TransactionResultSet(); 26 | int resultssize = XdrEncoding.DecodeInt32(stream); 27 | decodedTransactionResultSet.Results = new TransactionResultPair[resultssize]; 28 | for (int i = 0; i < resultssize; i++) { 29 | decodedTransactionResultSet.Results[i] = TransactionResultPair.Decode(stream); 30 | } 31 | return decodedTransactionResultSet; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/generated/TransactionSet.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // struct TransactionSet 10 | // { 11 | // Hash previousLedgerHash; 12 | // TransactionEnvelope txs<>; 13 | // }; 14 | // =========================================================================== 15 | public class TransactionSet { 16 | public TransactionSet () {} 17 | public Hash PreviousLedgerHash { get; set; } 18 | public TransactionEnvelope[] Txs { get; set; } 19 | public static void Encode(IByteWriter stream, TransactionSet encodedTransactionSet) { 20 | Hash.Encode(stream, encodedTransactionSet.PreviousLedgerHash); 21 | int txssize = encodedTransactionSet.Txs.Length; 22 | XdrEncoding.EncodeInt32(txssize, stream); 23 | for (int i = 0; i < txssize; i++) { 24 | TransactionEnvelope.Encode(stream, encodedTransactionSet.Txs[i]); 25 | } 26 | } 27 | public static TransactionSet Decode(IByteReader stream) { 28 | TransactionSet decodedTransactionSet = new TransactionSet(); 29 | decodedTransactionSet.PreviousLedgerHash = Hash.Decode(stream); 30 | int txssize = XdrEncoding.DecodeInt32(stream); 31 | decodedTransactionSet.Txs = new TransactionEnvelope[txssize]; 32 | for (int i = 0; i < txssize; i++) { 33 | decodedTransactionSet.Txs[i] = TransactionEnvelope.Decode(stream); 34 | } 35 | return decodedTransactionSet; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/generated/TrustLineFlags.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // enum TrustLineFlags 10 | // { 11 | // // issuer has authorized account to perform transactions with its credit 12 | // AUTHORIZED_FLAG = 1 13 | // }; 14 | // =========================================================================== 15 | public class TrustLineFlags { 16 | public enum TrustLineFlagsEnum 17 | { 18 | AUTHORIZED_FLAG = 1, 19 | } 20 | 21 | public TrustLineFlagsEnum InnerValue { get; set; } = default(TrustLineFlagsEnum); 22 | 23 | public static TrustLineFlags Create(TrustLineFlagsEnum v) 24 | { 25 | return new TrustLineFlags { 26 | InnerValue = v 27 | }; 28 | } 29 | 30 | public static TrustLineFlags Decode(IByteReader stream) { 31 | int value = XdrEncoding.DecodeInt32(stream); 32 | switch (value) { 33 | case 1: return Create(TrustLineFlagsEnum.AUTHORIZED_FLAG); 34 | default: 35 | throw new System.Exception("Unknown enum value: " + value); 36 | } 37 | } 38 | 39 | public static void Encode(IByteWriter stream, TrustLineFlags value) { 40 | XdrEncoding.EncodeInt32((int)value.InnerValue, stream); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/generated/Uint256.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef opaque uint256[32]; 10 | // =========================================================================== 11 | public class Uint256 { 12 | public byte[] InnerValue { get; set; } = default(byte[]); 13 | 14 | public Uint256() { } 15 | public Uint256(byte[] Uint256) 16 | { 17 | InnerValue = Uint256; 18 | } 19 | public static void Encode(IByteWriter stream, Uint256 encodedUint256) { 20 | int uint256Size = encodedUint256.InnerValue.Length; 21 | XdrEncoding.WriteFixOpaque(stream, (uint)uint256Size, encodedUint256.InnerValue); 22 | } 23 | public static Uint256 Decode(IByteReader stream) { 24 | Uint256 decodedUint256 = new Uint256(); 25 | int uint256size = 32; 26 | decodedUint256.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)uint256size); 27 | return decodedUint256; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/Uint32.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef unsigned int uint32; 10 | // =========================================================================== 11 | public class Uint32 { 12 | public uint InnerValue { get; set; } = default(uint); 13 | 14 | public Uint32() { } 15 | public Uint32(uint Uint32) 16 | { 17 | InnerValue = Uint32; 18 | } 19 | public static void Encode(IByteWriter stream, Uint32 encodedUint32) { 20 | XdrEncoding.EncodeUInt32(encodedUint32.InnerValue, stream); 21 | } 22 | public static Uint32 Decode(IByteReader stream) { 23 | Uint32 decodedUint32 = new Uint32(); 24 | decodedUint32.InnerValue = XdrEncoding.DecodeUInt32(stream); 25 | return decodedUint32; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/Uint64.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef unsigned hyper uint64; 10 | // =========================================================================== 11 | public class Uint64 { 12 | public ulong InnerValue { get; set; } = default(ulong); 13 | 14 | public Uint64() { } 15 | public Uint64(ulong Uint64) 16 | { 17 | InnerValue = Uint64; 18 | } 19 | public static void Encode(IByteWriter stream, Uint64 encodedUint64) { 20 | XdrEncoding.EncodeUInt64(encodedUint64.InnerValue, stream); 21 | } 22 | public static Uint64 Decode(IByteReader stream) { 23 | Uint64 decodedUint64 = new Uint64(); 24 | decodedUint64.InnerValue = XdrEncoding.DecodeUInt64(stream); 25 | return decodedUint64; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/generated/UpgradeType.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef opaque UpgradeType<128>; 10 | // =========================================================================== 11 | public class UpgradeType { 12 | public byte[] InnerValue { get; set; } = default(byte[]); 13 | 14 | public UpgradeType() { } 15 | public UpgradeType(byte[] UpgradeType) 16 | { 17 | InnerValue = UpgradeType; 18 | } 19 | public static void Encode(IByteWriter stream, UpgradeType encodedUpgradeType) { 20 | int UpgradeTypeSize = encodedUpgradeType.InnerValue.Length; 21 | XdrEncoding.EncodeInt32(UpgradeTypeSize, stream); 22 | XdrEncoding.WriteFixOpaque(stream, (uint)UpgradeTypeSize, encodedUpgradeType.InnerValue); 23 | } 24 | public static UpgradeType Decode(IByteReader stream) { 25 | UpgradeType decodedUpgradeType = new UpgradeType(); 26 | int UpgradeTypesize = XdrEncoding.DecodeInt32(stream); 27 | decodedUpgradeType.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)UpgradeTypesize); 28 | return decodedUpgradeType; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/generated/Value.cs: -------------------------------------------------------------------------------- 1 | // Automatically generated by xdrgen 2 | // DO NOT EDIT or your changes may be overwritten 3 | 4 | namespace Stellar.Generated 5 | { 6 | 7 | 8 | // === xdr source ============================================================ 9 | // typedef opaque Value<>; 10 | // =========================================================================== 11 | public class Value { 12 | public byte[] InnerValue { get; set; } = default(byte[]); 13 | 14 | public Value() { } 15 | public Value(byte[] Value) 16 | { 17 | InnerValue = Value; 18 | } 19 | public static void Encode(IByteWriter stream, Value encodedValue) { 20 | int ValueSize = encodedValue.InnerValue.Length; 21 | XdrEncoding.EncodeInt32(ValueSize, stream); 22 | XdrEncoding.WriteFixOpaque(stream, (uint)ValueSize, encodedValue.InnerValue); 23 | } 24 | public static Value Decode(IByteReader stream) { 25 | Value decodedValue = new Value(); 26 | int Valuesize = XdrEncoding.DecodeInt32(stream); 27 | decodedValue.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Valuesize); 28 | return decodedValue; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tasks/xdr.rake: -------------------------------------------------------------------------------- 1 | namespace :xdr do 2 | 3 | # As Hayashi adds more .x files, we'll need to update this array 4 | # Prior to launch, we should be separating our .x files into a separate 5 | # repo, and should be able to improve this integration. 6 | HAYASHI_XDR = [ 7 | "xdr/Stellar-types.x", 8 | "xdr/Stellar-ledger-entries.x", 9 | "xdr/Stellar-transaction.x", 10 | "xdr/Stellar-ledger.x", 11 | "xdr/Stellar-overlay.x", 12 | "xdr/Stellar-SCP.x", 13 | ] 14 | 15 | LOCAL_XDR_PATHS = HAYASHI_XDR.map{ |src| "xdr/" + File.basename(src) } 16 | 17 | task :update => [:generate] 18 | 19 | task :generate do 20 | require "pathname" 21 | require "xdrgen" 22 | require "fileutils" 23 | FileUtils.rm_rf "generated" 24 | 25 | compilation = Xdrgen::Compilation.new( 26 | LOCAL_XDR_PATHS, 27 | output_dir: "src/generated", 28 | namespace: "Stellar.Generated", 29 | language: :Dotnet 30 | ) 31 | compilation.compile 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /tests/csharp-stellar-base.Tests/NetworkTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace csharp_stellar_base.Tests 4 | { 5 | [TestFixture] 6 | public class NetworkTests 7 | { 8 | [Test] 9 | public void NetworkId() 10 | { 11 | Stellar.Network.CurrentNetwork = "ProjectQ"; 12 | 13 | string hexed = Chaos.NaCl.CryptoBytes.ToHexStringLower(Stellar.Network.CurrentNetworkId); 14 | 15 | Assert.AreEqual(hexed, "89046661f1e50483904e55469c7131b76bcaca59d0db74e9c0c188b35c67b49a"); 16 | } 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /tests/csharp-stellar-base.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("csharp-stellar-base.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("csharp-stellar-base.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("509f9307-5022-4ad6-a073-a7ab1e31e2ce")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /tests/csharp-stellar-base.Tests/StrKeyTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Stellar; 3 | using System; 4 | 5 | namespace csharp_stellar_base.Tests 6 | { 7 | [TestFixture] 8 | public class StrKeyTests 9 | { 10 | [Test] 11 | public void TestDecodeEncode() 12 | { 13 | String seed = "SDJHRQF4GCMIIKAAAQ6IHY42X73FQFLHUULAPSKKD4DFDM7UXWWCRHBE"; 14 | byte[] secret = StrKey.DecodeCheck(VersionByte.ed25519SecretSeed, seed); 15 | String encoded = StrKey.EncodeCheck(VersionByte.ed25519SecretSeed, secret); 16 | Assert.AreEqual(seed, encoded); 17 | } 18 | 19 | [Test] 20 | public void TestDecodeInvalidVersionByte() 21 | { 22 | String accountId = "GCZHXL5HXQX5ABDM26LHYRCQZ5OJFHLOPLZX47WEBP3V2PF5AVFK2A5D"; 23 | var ex = Assert.Throws(() => StrKey.DecodeCheck(VersionByte.ed25519SecretSeed, accountId)); 24 | } 25 | 26 | [Test] 27 | public void TestDecodeInvalidSeed() 28 | { 29 | String seed = "SAA6NXOBOXP3RXGAXBW6PGFI5BPK4ODVAWITS4VDOMN5C2M4B66ZML"; 30 | var ex = Assert.Throws(() => StrKey.DecodeCheck(VersionByte.ed25519SecretSeed, seed)); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/csharp-stellar-base.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /xdr/Stellar-SCP.x: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Stellar Development Foundation and contributors. Licensed 2 | // under the Apache License, Version 2.0. See the COPYING file at the root 3 | // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | %#include "xdr/Stellar-types.h" 6 | 7 | namespace stellar 8 | { 9 | 10 | typedef opaque Value<>; 11 | 12 | struct SCPBallot 13 | { 14 | uint32 counter; // n 15 | Value value; // x 16 | }; 17 | 18 | enum SCPStatementType 19 | { 20 | SCP_ST_PREPARE = 0, 21 | SCP_ST_CONFIRM = 1, 22 | SCP_ST_EXTERNALIZE = 2, 23 | SCP_ST_NOMINATE = 3 24 | }; 25 | 26 | struct SCPNomination 27 | { 28 | Hash quorumSetHash; // D 29 | Value votes<>; // X 30 | Value accepted<>; // Y 31 | }; 32 | 33 | struct SCPStatement 34 | { 35 | NodeID nodeID; // v 36 | uint64 slotIndex; // i 37 | 38 | union switch (SCPStatementType type) 39 | { 40 | case SCP_ST_PREPARE: 41 | struct 42 | { 43 | Hash quorumSetHash; // D 44 | SCPBallot ballot; // b 45 | SCPBallot* prepared; // p 46 | SCPBallot* preparedPrime; // p' 47 | uint32 nC; // c.n 48 | uint32 nH; // h.n 49 | } prepare; 50 | case SCP_ST_CONFIRM: 51 | struct 52 | { 53 | SCPBallot ballot; // b 54 | uint32 nPrepared; // p.n 55 | uint32 nCommit; // c.n 56 | uint32 nH; // h.n 57 | Hash quorumSetHash; // D 58 | } confirm; 59 | case SCP_ST_EXTERNALIZE: 60 | struct 61 | { 62 | SCPBallot commit; // c 63 | uint32 nH; // h.n 64 | Hash commitQuorumSetHash; // D used before EXTERNALIZE 65 | } externalize; 66 | case SCP_ST_NOMINATE: 67 | SCPNomination nominate; 68 | } 69 | pledges; 70 | }; 71 | 72 | struct SCPEnvelope 73 | { 74 | SCPStatement statement; 75 | Signature signature; 76 | }; 77 | 78 | // supports things like: A,B,C,(D,E,F),(G,H,(I,J,K,L)) 79 | // only allows 2 levels of nesting 80 | struct SCPQuorumSet 81 | { 82 | uint32 threshold; 83 | PublicKey validators<>; 84 | SCPQuorumSet innerSets<>; 85 | }; 86 | } 87 | -------------------------------------------------------------------------------- /xdr/Stellar-types.x: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Stellar Development Foundation and contributors. Licensed 2 | // under the Apache License, Version 2.0. See the COPYING file at the root 3 | // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | namespace stellar 6 | { 7 | 8 | typedef opaque Hash[32]; 9 | typedef opaque uint256[32]; 10 | 11 | typedef unsigned int uint32; 12 | typedef int int32; 13 | 14 | typedef unsigned hyper uint64; 15 | typedef hyper int64; 16 | 17 | enum CryptoKeyType 18 | { 19 | KEY_TYPE_ED25519 = 0, 20 | KEY_TYPE_PRE_AUTH_TX = 1, 21 | KEY_TYPE_HASH_X = 2 22 | }; 23 | 24 | enum PublicKeyType 25 | { 26 | PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519 27 | }; 28 | 29 | enum SignerKeyType 30 | { 31 | SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519, 32 | SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX, 33 | SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X 34 | }; 35 | 36 | union PublicKey switch (PublicKeyType type) 37 | { 38 | case PUBLIC_KEY_TYPE_ED25519: 39 | uint256 ed25519; 40 | }; 41 | 42 | union SignerKey switch (SignerKeyType type) 43 | { 44 | case SIGNER_KEY_TYPE_ED25519: 45 | uint256 ed25519; 46 | case SIGNER_KEY_TYPE_PRE_AUTH_TX: 47 | /* Hash of Transaction structure */ 48 | uint256 preAuthTx; 49 | case SIGNER_KEY_TYPE_HASH_X: 50 | /* Hash of random 256 bit preimage X */ 51 | uint256 hashX; 52 | }; 53 | 54 | // variable size as the size depends on the signature scheme used 55 | typedef opaque Signature<64>; 56 | 57 | typedef opaque SignatureHint[4]; 58 | 59 | typedef PublicKey NodeID; 60 | 61 | struct Curve25519Secret 62 | { 63 | opaque key[32]; 64 | }; 65 | 66 | struct Curve25519Public 67 | { 68 | opaque key[32]; 69 | }; 70 | 71 | struct HmacSha256Key 72 | { 73 | opaque key[32]; 74 | }; 75 | 76 | struct HmacSha256Mac 77 | { 78 | opaque mac[32]; 79 | }; 80 | 81 | } 82 | --------------------------------------------------------------------------------