public void TestSetOptionsOperationSignerSha256()
        {
            // GC5SIC4E3V56VOHJ3OZAX5SJDTWY52JYI2AFK6PUGSXFVRJQYQXXZBZF
            var source = KeyPair.FromSecretSeed("SC4CGETADVYTCR5HEAVZRB3DZQY5Y4J7RFNJTRA6ESMHIPEZUSTE2QDK");

            var preimage = Encoding.UTF8.GetBytes("stellar.org");
            var hash     = Util.Hash(preimage);

            var operation = new SetOptionsOperation.Builder()
                            .SetSigner(Signer.Sha256Hash(hash), 10)
                            .SetSourceAccount(source)
                            .Build();

            var xdr             = operation.ToXdr();
            var parsedOperation = (SetOptionsOperation)Operation.FromXdr(xdr);

            Assert.AreEqual(null, parsedOperation.InflationDestination);
            Assert.AreEqual(null, parsedOperation.ClearFlags);
            Assert.AreEqual(null, parsedOperation.SetFlags);
            Assert.AreEqual(null, parsedOperation.MasterKeyWeight);
            Assert.AreEqual(null, parsedOperation.LowThreshold);
            Assert.AreEqual(null, parsedOperation.MediumThreshold);
            Assert.AreEqual(null, parsedOperation.HighThreshold);
            Assert.AreEqual(null, parsedOperation.HomeDomain);
            Assert.IsTrue(hash.SequenceEqual(parsedOperation.Signer.HashX.InnerValue));
            Assert.AreEqual(10, parsedOperation.SignerWeight);
            Assert.AreEqual(source.AccountId, parsedOperation.SourceAccount.AccountId);

            Assert.AreEqual(
                "AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAACbpRqMkaQAfCYSk/n3xIl4fCoHfKqxF34ht2iuvSYEJQAAAAK",
                operation.ToXdrBase64());
        }
        public void TestSetOptionsOperation()
        {
            // GC5SIC4E3V56VOHJ3OZAX5SJDTWY52JYI2AFK6PUGSXFVRJQYQXXZBZF
            var source = KeyPair.FromSecretSeed("SC4CGETADVYTCR5HEAVZRB3DZQY5Y4J7RFNJTRA6ESMHIPEZUSTE2QDK");
            // GDW6AUTBXTOC7FIKUO5BOO3OGLK4SF7ZPOBLMQHMZDI45J2Z6VXRB5NR
            var inflationDestination = KeyPair.FromSecretSeed("SDHZGHURAYXKU2KMVHPOXI6JG2Q4BSQUQCEOY72O3QQTCLR2T455PMII");
            // GBCP5W2VS7AEWV2HFRN7YYC623LTSV7VSTGIHFXDEJU7S5BAGVCSETRR
            var signer = Signer.Ed25519PublicKey(KeyPair.FromSecretSeed("SA64U7C5C7BS5IHWEPA7YWFN3Z6FE5L6KAMYUIT4AQ7KVTVLD23C6HEZ"));

            var clearFlags      = 1;
            var setFlags        = 1;
            var masterKeyWeight = 1;
            var lowThreshold    = 2;
            var mediumThreshold = 3;
            var highThreshold   = 4;
            var homeDomain      = "stellar.org";
            var signerWeight    = 1;

            var operation = new SetOptionsOperation.Builder()
                            .SetInflationDestination(inflationDestination)
                            .SetClearFlags(clearFlags)
                            .SetSetFlags(setFlags)
                            .SetMasterKeyWeight(masterKeyWeight)
                            .SetLowThreshold(lowThreshold)
                            .SetMediumThreshold(mediumThreshold)
                            .SetHighThreshold(highThreshold)
                            .SetHomeDomain(homeDomain)
                            .SetSigner(signer, signerWeight)
                            .SetSourceAccount(source)
                            .Build();

            var xdr             = operation.ToXdr();
            var parsedOperation = (SetOptionsOperation)Operation.FromXdr(xdr);

            Assert.AreEqual(inflationDestination.AccountId, parsedOperation.InflationDestination.AccountId);
            Assert.AreEqual(clearFlags, parsedOperation.ClearFlags);
            Assert.AreEqual(setFlags, parsedOperation.SetFlags);
            Assert.AreEqual(masterKeyWeight, parsedOperation.MasterKeyWeight);
            Assert.AreEqual(lowThreshold, parsedOperation.LowThreshold);
            Assert.AreEqual(mediumThreshold, parsedOperation.MediumThreshold);
            Assert.AreEqual(highThreshold, parsedOperation.HighThreshold);
            Assert.AreEqual(homeDomain, parsedOperation.HomeDomain);
            Assert.AreEqual(signer.Discriminant.InnerValue, parsedOperation.Signer.Discriminant.InnerValue);
            Assert.AreEqual(signer.Ed25519.InnerValue, parsedOperation.Signer.Ed25519.InnerValue);
            Assert.AreEqual(signerWeight, parsedOperation.SignerWeight);
            Assert.AreEqual(source.AccountId, parsedOperation.SourceAccount.AccountId);

            Assert.AreEqual(
                "AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAUAAAABAAAAAO3gUmG83C+VCqO6FztuMtXJF/l7grZA7MjRzqdZ9W8QAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAIAAAABAAAAAwAAAAEAAAAEAAAAAQAAAAtzdGVsbGFyLm9yZwAAAAABAAAAAET+21WXwEtXRyxb/GBe1tc5V/WUzIOW4yJp+XQgNUUiAAAAAQ==",
                operation.ToXdrBase64());
        }
        public void TestSetOptionsOperationPreAuthTxSigner()
        {
            Network.UseTestNetwork();

            // GBPMKIRA2OQW2XZZQUCQILI5TMVZ6JNRKM423BSAISDM7ZFWQ6KWEBC4
            var source      = KeyPair.FromSecretSeed("SCH27VUZZ6UAKB67BDNF6FA42YMBMQCBKXWGMFD5TZ6S5ZZCZFLRXKHS");
            var destination = KeyPair.FromAccountId("GDW6AUTBXTOC7FIKUO5BOO3OGLK4SF7ZPOBLMQHMZDI45J2Z6VXRB5NR");

            var sequenceNumber = 2908908335136768L;
            var account        = new Account(source, sequenceNumber);
            var transaction    = new Transaction.Builder(account)
                                 .AddOperation(new CreateAccountOperation.Builder(destination, "2000").Build())
                                 .Build();

            // GC5SIC4E3V56VOHJ3OZAX5SJDTWY52JYI2AFK6PUGSXFVRJQYQXXZBZF
            var opSource = KeyPair.FromSecretSeed("SC4CGETADVYTCR5HEAVZRB3DZQY5Y4J7RFNJTRA6ESMHIPEZUSTE2QDK");

            var operation = new SetOptionsOperation.Builder()
                            .SetSigner(Signer.PreAuthTx(transaction), 10)
                            .SetSourceAccount(opSource)
                            .Build();

            var xdr             = operation.ToXdr();
            var parsedOperation = (SetOptionsOperation)Operation.FromXdr(xdr);

            Assert.AreEqual(null, parsedOperation.InflationDestination);
            Assert.AreEqual(null, parsedOperation.ClearFlags);
            Assert.AreEqual(null, parsedOperation.SetFlags);
            Assert.AreEqual(null, parsedOperation.MasterKeyWeight);
            Assert.AreEqual(null, parsedOperation.LowThreshold);
            Assert.AreEqual(null, parsedOperation.MediumThreshold);
            Assert.AreEqual(null, parsedOperation.HighThreshold);
            Assert.AreEqual(null, parsedOperation.HomeDomain);
            Assert.IsTrue(transaction.Hash().SequenceEqual(parsedOperation.Signer.PreAuthTx.InnerValue));
            Assert.AreEqual(10, parsedOperation.SignerWeight);
            Assert.AreEqual(opSource.AccountId, parsedOperation.SourceAccount.AccountId);

            Assert.AreEqual(
                "AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAB1vRBIRC3w7ZH5rQa17hIBKUwZTvBP4kNmSP7jVyw1fQAAAAK",
                operation.ToXdrBase64());
        }