private bool CanMakeTx() { if (SendAddressList.Count == 0 || SelectedUTXOs.Count == 0 || ReceiveList.Count == 0) { return(false); } if (SendAddressList.Select(x => x.HasErrors).Contains(true) || ReceiveList.Select(x => x.HasErrors).Contains(true)) { return(false); } if (Fee < 0) { return(false); } return(true); }
private async void GetUTXO() { Status = "Receiving Unspent Transaction Outputs..."; Errors = string.Empty; IsReceiving = true; TransactionApi api; switch (SelectedApi) { case TxApiNames.BlockchainInfo: api = new Services.TransactionServices.BlockchainInfo(); break; case TxApiNames.BlockCypher: api = new Services.TransactionServices.BlockCypher(); break; default: api = new Services.TransactionServices.BlockchainInfo(); break; } Response <List <UTXO> > resp = await api.GetUTXO(SendAddressList.ToList()); if (!resp.Errors.Any()) { UtxoList = new BindingList <UTXO>(resp.Result); foreach (var addr in SendAddressList) { addr.BalanceSatoshi = 0; UtxoList.ToList().ForEach(x => addr.BalanceSatoshi += (x.Address == addr.Address) ? x.Amount : 0); RaisePropertyChanged(nameof(TotalBalance)); } Status = "Finished successfully."; } else { Status = "Encountered an error!"; Errors = resp.Errors.GetErrors(); } IsReceiving = false; }
private async Task GetUTXO() { IApiService api; switch (SelectedApi) { case ApiNames.BlockchainInfo: api = new BlockchainInfoApi(); break; case ApiNames.BlockrIO: api = new BlockrApi(); break; default: api = new BlockchainInfoApi(); break; } UtxoList = new BindingList <UTXO>(await api.GetUTXO(SendAddressList.ToList())); }