Beispiel #1
0
        private static void RunSend(RepositoryConfiguration repositoryConfig)
        {
            var repoFactory = new VakapayRepositoryMysqlPersistenceFactory(repositoryConfig);

            var bitcoinBusiness = new BitcoinBusiness.BitcoinBusiness(repoFactory);
            var connection      = repoFactory.GetOldConnection() ?? repoFactory.GetDbConnection();

            try
            {
                while (true)
                {
                    Console.WriteLine("Start Send Bitcoin....");
                    var rpc = new BitcoinRpc(AppSettingHelper.GetBitcoinNode(),
                                             AppSettingHelper.GetBitcoinRpcAuthentication());

                    using (var bitcoinRepo = repoFactory.GetBitcoinWithdrawTransactionRepository(connection))
                    {
                        var resultSend = bitcoinBusiness.SendTransactionAsync(bitcoinRepo, rpc);
                        Console.WriteLine(JsonHelper.SerializeObject(resultSend.Result));

                        Console.WriteLine("Send Bitcoin End...");
                        Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception e)
            {
                connection.Close();
                _logger.Error(e, "Send Bitcoin");
                Console.WriteLine(e.ToString());
            }
        }