示例#1
0
 public void ResetCache()
 {
     ReceiveList.Clear();
     SendList.Clear();
     SendCount    = 0;
     ReceiveCount = 0;
 }
        private void MakeTx(object param)
        {
            // param is of type System.Windows.Controls.SelectedItemCollection
            IList utxo = (IList)param;

            RawTx = Transaction.CreateRawTx(utxo.Cast <UTXO>().ToList(), ReceiveList.ToList(), LockTime, SelectedWalletType);
        }
 private bool CanMakeTx()
 {
     if (BTx == null || ReceiveList.Select(x => x.HasErrors).Contains(true))
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
        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 void MakeTx()
        {
            List <UTXO> uList = new List <UTXO>();

            foreach (var item in TxInList)
            {
                UTXO u = new UTXO();
                u.TxHash   = item.TxId;
                u.OutIndex = item.OutIndex;
                if (BTx.Status == BitcoinTransaction.TxStatus.Signed)
                {
                    int    pubKeyLength = 65;
                    string pubKey       = item.ScriptSig.Substring((item.ScriptSigLength * 2) - (pubKeyLength + 1));
                    u.Address        = BitcoinConversions.PubKeyToBase58(pubKey);
                    u.AddressHash160 = BitcoinConversions.ByteArrayToHex(BitcoinConversions.PubKeyToHash160(pubKey));
                }
                else
                {
                    var addr = GetAddressFromScript(item.ScriptSig);
                    if (string.IsNullOrEmpty(addr))
                    {
                        u.Address        = string.Empty;
                        u.AddressHash160 = string.Empty;
                    }
                    else
                    {
                        u.Address        = addr;
                        u.AddressHash160 = BitcoinConversions.Base58ToHash160(addr);
                    }
                }

                uList.Add(u);
            }

            try
            {
                UInt32 lockTime = 0;
                RawTx = Transaction.CreateRawTx(uList, ReceiveList.ToList(), lockTime, SelectedWalletType);
            }
            catch (Exception ex)
            {
                RawTx = string.Empty;
                MessageBox.Show(ex.Message);
            }
        }
示例#6
0
 public void AddReceive(ReceiveTransferItemData data)
 {
     ReceiveList.Add(data);
 }
示例#7
0
 public ReceiveTransferItemData FindReceive(string id)
 {
     return(ReceiveList.Find(t => (t.ID == id)));
 }
        private void ServerReceiveEvent(object sender, ByteArrayEventArgs e)
        {
            string decodedString = Encoding.UTF8.GetString(e.BufferBytes, e.Offset, e.Length);

            Application.Current.Dispatcher.BeginInvoke(((Action)(() => ReceiveList.Add(decodedString))));
        }