public void CanGetListAddressGroupings() { var wallets = _bitcoindClient.GetListWalletsAsync().Result; //_dataContext.Database.EnsureCreated(); //var walls = _dataContext.HotWallets.ToList(); //_dataContext.BulkInsertOrUpdate(parsedAddresses); //var newwalls = _dataContext.HotWallets.ToList(); }
public async Task <IEnumerable <Transaction> > PullTransactionsAsync(int maxGetTransactions = 20, int updateTransactionsWithConfirmationLessThan = 6) { var newTransactions = new List <Transaction>(); var wallets = await _bitcoindClient.GetListWalletsAsync(); foreach (var wallet in wallets) { var transactionsDto = await _bitcoindClient.GetListTransactionsAsync(wallet, maxGetTransactions); var transactionsDb = Mapper.Map <List <Transaction> >(transactionsDto); foreach (var transaction in transactionsDb) { if (transaction.Category == Category.Unknown) { continue; } var tran = await _dataContext.Transactions .FirstOrDefaultAsync(x => x.Txid == transaction.Txid && x.Category == transaction.Category); if (tran == null) { transaction.Wallet = wallet; _dataContext.Transactions.Add(transaction); newTransactions.Add(transaction); } else if (tran.Confirmations <= updateTransactionsWithConfirmationLessThan) { tran.Confirmations = transaction.Confirmations; } } } await _dataContext.SaveChangesAsync(); return(newTransactions); }
public async Task <List <HotWallet> > GetWalletsAsync() { var balances = new List <HotWallet>(); var wallets = await _bitcoindClient.GetListWalletsAsync(); foreach (var wallet in wallets) { var balance = await _bitcoindClient.GetBalanceAsync(wallet); balances.Add(new HotWallet { Address = wallet, Balance = balance }); } return(balances); }