private void NewAddrWif() { if (netTypeCombo != null && seedTb != null && newAddrTypeCombo != null && addrTb != null && newAddrTb != null && newWifTb != null) { if (string.IsNullOrEmpty(seedTb.Text)) { newAddrTb.Text = ""; newWifTb.Text = ""; return; } var seed = seedTb.Text + indexTb.Text; var net = netTypeCombo.SelectedIndex == 0 ? "main" : "test3"; var addrtype = newAddrTypeCombo.SelectedIndex; var aw = WalletTools.NewWifAddr(seed, net, addrtype); newAddrTb.Text = aw.address; newWifTb.Text = aw.wif; addrTb.Text = aw.address; addrFromTb.Text = aw.address; wifTb.Text = aw.wif; } }
private async void SendBtc_Click(object sender, RoutedEventArgs e) { decimal value = 0, fee = 0.0001m; var pv = decimal.TryParse(valueTb.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out value); var pf = decimal.TryParse(feeTb.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out fee); if (pv) { var t = WalletTools.Sendbtc2One(wifTb.Text, addrFromTb.Text, addrToTb.Text, value, fee); if (t.tx == null) { return; } var m = $"you send to:\n"; foreach (var p in t.toList) { m += $"{p.Key} : {p.Value}\n"; } var trw = new NewTransactionWindow(m); var sendAprove = await trw.ShowDialog <bool>(this); // var prove = MessageBox.Show(m, "Send Transaction!", MessageBoxButton.YesNo); if (sendAprove) { var res = WalletTools.PushTx2Bc(t.note, t.tx, (bool)useTorCh.IsChecked); // var res = PushTx2Ninja(netStr, transaction,client); if (res.suc && res.hash.Length > 5) { TxTb.Text = res.hash; txLabel.IsVisible = true; TxTb.IsVisible = true; await Task.Run(() => { Thread.Sleep(1000); var h = t.tx.GetHash(); Tech.OpenBrowser($"https://live.blockcypher.com/btc-testnet/tx/{h}"); }); } } } }
private void GetBallance_Click(object sender, RoutedEventArgs e) { string net = "test3"; var a = addrTb.Text; if (a == null) { return; } var c0 = a[0]; if (c0 == '3' || c0 == '1' || c0 == 'b') { net = "main"; } var b = WalletTools.GetBallance(a, net); ballLabel.Content = b; }