public async Task SignAggregateTransactionComplete()
        {
            var signerKey =
                KeyPair.CreateFromPrivateKey(Config.PrivateKeyMain);

            var account = new Account(Config.PrivateKeySecond,
                                      NetworkType.Types.MIJIN_TEST);

            var aggregateTransaction = AggregateTransaction.CreateComplete(
                NetworkType.Types.MIJIN_TEST,
                Deadline.CreateHours(2),
                new List <Transaction>
            {
                TransferTransactionTests.CreateInnerTransferTransaction("nem:xem")
                .ToAggregate(PublicAccount.CreateFromPublicKey(signerKey.PublicKeyString, NetworkType.Types.MIJIN_TEST)),
                TransferTransactionTests.CreateInnerTransferTransaction("nem:xem")
                .ToAggregate(PublicAccount.CreateFromPublicKey(account.PublicKey, NetworkType.Types.MIJIN_TEST))
            })
                                       .SignWithAggregateCosigners(signerKey, new List <Account>()
            {
                Account.CreateFromPrivateKey(Config.PrivateKeySecond,
                                             NetworkType.Types.MIJIN_TEST)
            }
                                                                   );

            WatchForFailure(aggregateTransaction);

            await new TransactionHttp(host).Announce(aggregateTransaction);

            var status = await listener.ConfirmedTransactionsGiven(Address.CreateFromPublicKey(account.PublicKey, NetworkType.Types.MIJIN_TEST)).Where(e => e.TransactionInfo.Hash == aggregateTransaction.Hash).Take(1);

            Assert.AreEqual(signerKey.PublicKeyString, status.Signer.PublicKey);
        }
        public async Task PartialTransactionWithMissingCosigner()
        {
            var keyPair = KeyPair.CreateFromPrivateKey(Config.PrivateKeyMain);

            var keyPair2 = KeyPair.CreateFromPrivateKey("14A239D2ADB96753CFC160BB262F27B01BCCC8C74599F51771BC6BD39980F4E7");

            var aggregateBonded = AggregateTransaction.CreateBonded(
                NetworkType.Types.MIJIN_TEST,
                Deadline.CreateHours(2),
                new List <Transaction>
            {
                TransferTransactionTests.CreateInnerTransferTransaction(
                    "nem:xem").ToAggregate(PublicAccount.CreateFromPublicKey(keyPair2.PublicKeyString, NetworkType.Types.MIJIN_TEST)),
                TransferTransactionTests.CreateInnerTransferTransaction(
                    "nem:xem").ToAggregate(PublicAccount.CreateFromPublicKey(keyPair2.PublicKeyString, NetworkType.Types.MIJIN_TEST)),
            },
                null)
                                  .SignWith(keyPair);

            WatchForFailure(aggregateBonded);

            var hashLock = LockFundsTransaction.Create(
                NetworkType.Types.MIJIN_TEST,
                Deadline.CreateHours(2),
                0,
                new Mosaic(new MosaicId("nem:xem"), 10000000),
                10000,
                aggregateBonded
                )
                           .SignWith(KeyPair.CreateFromPrivateKey(Config.PrivateKeyMain));

            WatchForFailure(hashLock);

            await new TransactionHttp(host).Announce(hashLock);

            var status = await listener.ConfirmedTransactionsGiven(Address.CreateFromPublicKey(hashLock.Signer, NetworkType.Types.MIJIN_TEST)).Where(e => e.TransactionInfo.Hash == hashLock.Hash).Take(1);

            Assert.AreEqual(keyPair.PublicKeyString, status.Signer.PublicKey);

            await new TransactionHttp(host).AnnounceAggregateBonded(aggregateBonded);

            var status2 = await listener.AggregateBondedAdded(Address.CreateFromPublicKey(aggregateBonded.Signer, NetworkType.Types.MIJIN_TEST)).Where(e => e.TransactionInfo.Hash == aggregateBonded.Hash).Take(1);

            Assert.AreEqual(keyPair.PublicKeyString, status2.Signer.PublicKey);
        }
        public async Task AggregateTransactionWithOnlyInitiator()
        {
            var keyPair = KeyPair.CreateFromPrivateKey(Config.PrivateKeyMain);

            var aggregateTransaction = AggregateTransaction.CreateComplete(
                NetworkType.Types.MIJIN_TEST,
                Deadline.CreateHours(2),
                new List <Transaction>
            {
                TransferTransactionTests.CreateInnerTransferTransaction("nem:xem")
                .ToAggregate(PublicAccount.CreateFromPublicKey("B974668ABED344BE9C35EE257ACC246117EFFED939EAF42391AE995912F985FE", NetworkType.Types.MIJIN_TEST)),
            }
                ).SignWith(keyPair);

            await new TransactionHttp(host).Announce(aggregateTransaction);

            var status2 = await listener.ConfirmedTransactionsGiven(Address.CreateFromPublicKey(aggregateTransaction.Signer, NetworkType.Types.MIJIN_TEST)).Where(e => e.TransactionInfo.Hash == aggregateTransaction.Hash).Take(1);

            Assert.AreEqual(keyPair.PublicKeyString, status2.Signer.PublicKey);
        }
        public async Task LockFundsTransactionTest()
        {
            var signer = KeyPair.CreateFromPrivateKey(Config.PrivateKeyMain);

            var aggregateTransaction = AggregateTransaction.CreateBonded(
                NetworkType.Types.MIJIN_TEST,
                Deadline.CreateHours(2),
                new List <Transaction>
            {
                TransferTransactionTests.CreateInnerTransferTransaction(
                    "nem:xem").ToAggregate(PublicAccount.CreateFromPublicKey("10CC07742437C205D9A0BC0434DC5B4879E002114753DE70CDC4C4BD0D93A64A", NetworkType.Types.MIJIN_TEST)),
                TransferTransactionTests.CreateInnerTransferTransaction(
                    "nem:xem").ToAggregate(PublicAccount.CreateFromPublicKey("A8FCF4371B9C4B26CE19A407BA803D3813647608D57ABC1550925A54AEE2C9EA", NetworkType.Types.MIJIN_TEST))
            },
                null)
                                       .SignWith(signer);

            var hashLock = LockFundsTransaction.Create(
                NetworkType.Types.MIJIN_TEST,
                Deadline.CreateHours(2),
                0,
                new Mosaic(new MosaicId("nem:xem"), 10000000),
                10000,
                aggregateTransaction)
                           .SignWith(KeyPair.CreateFromPrivateKey(Config.PrivateKeyMain));

            WatchForFailure(hashLock);

            await new TransactionHttp(host).Announce(hashLock);

            var status = await listener.ConfirmedTransactionsGiven(Address.CreateFromPublicKey(hashLock.Signer, NetworkType.Types.MIJIN_TEST)).Where(e => e.TransactionInfo.Hash == hashLock.Hash).Take(1);

            Assert.AreEqual(signer.PublicKeyString, status.Signer.PublicKey);

            await new TransactionHttp(host).AnnounceAggregateBonded(aggregateTransaction);

            var status2 = await listener.AggregateBondedAdded(Address.CreateFromPublicKey(aggregateTransaction.Signer, NetworkType.Types.MIJIN_TEST)).Where(e => e.TransactionInfo.Hash == aggregateTransaction.Hash).Take(1);

            Assert.AreEqual(signer.PublicKeyString, status2.Signer.PublicKey);
        }
        public async Task AggregateTransactionWithMissingCosignatures()
        {
            var keyPair = KeyPair.CreateFromPrivateKey(Config.PrivateKeyMain);

            var keyPair2 = KeyPair.CreateFromPrivateKey(Config.PrivateKeySecond);

            var aggregateTransaction = AggregateTransaction.CreateBonded(
                NetworkType.Types.MIJIN_TEST,
                Deadline.CreateHours(2),
                new List <Transaction>
            {
                RegisterNamespaceTransaction.CreateRootNamespace(NetworkType.Types.MIJIN_TEST, Deadline.CreateHours(2), "happy23", 10000)
                .ToAggregate(PublicAccount.CreateFromPublicKey(keyPair.PublicKeyString, NetworkType.Types.MIJIN_TEST)),
                TransferTransactionTests.CreateInnerTransferTransaction("nem:xem")
                .ToAggregate(PublicAccount.CreateFromPublicKey(keyPair2.PublicKeyString, NetworkType.Types.MIJIN_TEST)),
            },
                null
                ).SignWith(keyPair);

            WatchForFailure(aggregateTransaction);

            var hashLock = LockFundsTransaction.Create(NetworkType.Types.MIJIN_TEST, Deadline.CreateHours(2), 0, new Mosaic(new MosaicId("nem:xem"), 10000000), 10000, aggregateTransaction)
                           .SignWith(KeyPair.CreateFromPrivateKey(Config.PrivateKeyMain));

            WatchForFailure(hashLock);

            await new TransactionHttp(host).Announce(hashLock);

            var status = await listener.ConfirmedTransactionsGiven(Address.CreateFromPublicKey(hashLock.Signer, NetworkType.Types.MIJIN_TEST)).Where(e => e.TransactionInfo.Hash == hashLock.Hash).Take(1);

            Assert.AreEqual(keyPair.PublicKeyString, status.Signer.PublicKey);

            await new TransactionHttp(host).AnnounceAggregateBonded(aggregateTransaction);

            var status2 = await listener.AggregateBondedAdded(Address.CreateFromPublicKey(aggregateTransaction.Signer, NetworkType.Types.MIJIN_TEST)).Where(e => e.TransactionInfo.Hash == aggregateTransaction.Hash).Take(1);

            Assert.AreEqual(keyPair.PublicKeyString, status2.Signer.PublicKey);
        }