예제 #1
0
        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}");
                        });
                    }
                }
            }
        }