示例#1
0
        /// <summary>
        ///
        /// </summary>
        private void makeChangeTxs()
        {
            lblStatus.Content = string.Format("makeChangeTxs");

            foreach (Transaction ticketTx in getTransactionOfType(Type.Ticket).Where(t => t.ChildTx == null))
            {
                //Transaction ticketTx = getTransactionOfType(Type.Ticket).Where(t => t.ChildTx == null).FirstOrDefault();

                if (ticketTx == null)
                {
                    return;
                }

                double networkFeeTx   = networkFee;
                double amountToKeepTx = ticketCost;

                string rawTransaction;
                if (btc.CreateZeroConfirmationTransaction(ticketTx.TxId, amountToKeepTx, networkFeeTx, btc.GetAddressesByAccount("Pot"), out rawTransaction))
                {
                    AddLine("rawTransaction[{0}]: {1}", smallHashTag(ticketTx.TxId), true);
                    SignedRawTransaction signrawtransaction = btc.SignRawTransaction(rawTransaction);
                    AddLine("signedRawTransaction[{0}]: {1}", smallHashTag(ticketTx.TxId), signrawtransaction.Complete);

                    if (!signrawtransaction.Complete)
                    {
                        AddLine("signedRawTransaction[{0}]: {1}", smallHashTag(ticketTx.TxId), "not completed!");
                    }

                    // TODO ... need to check if it was successful !!!
                    string changeTxId = btc.SendRawTransaction(signrawtransaction.Hex);

                    AddLine("changeTxId[{0}]: {1}", smallHashTag(ticketTx.TxId), smallHashTag(changeTxId));
                }
            }
        }
示例#2
0
        /// <inheritdoc />
        public async Task <SignedRawTransaction> SignRawTransactionAsync(SignRawTransaction rawTransaction)
        {
            string hex = rawTransaction.RawTransactionHex;
            List <SignRawTransactionInput> inputs = rawTransaction.Inputs.Any() ? rawTransaction.Inputs : null;
            List <string> privateKeys             = rawTransaction.PrivateKeys.Any() ? rawTransaction.PrivateKeys : null;

            SignedRawTransaction res = await CallAsync <SignedRawTransaction>("signrawtransaction", hex, inputs, privateKeys);

            return(res);
        }