Exemple #1
0
        public static string GetTag(this PageUnspent unspentUtxo)
        {
            var amount    = StaticConverters.LongToDoubleConverter.Convert(unspentUtxo.Amount, typeof(object), null, StaticConverters.CultureInfo);
            var amountStr = amount == null ? "Null" : amount.ToString();
            var result    = string.Format("{0}({1})", unspentUtxo.Address, amountStr);

            return(result);
        }
Exemple #2
0
        public void Choose(PageUnspent output)
        {
            if (output == null)
            {
                return;
            }

            _msgData.CallBackParams = output;
            _msgData.CallBack();
        }
Exemple #3
0
        public static async Task <ApiResponse> ListPageUnspent(long minConfirmations, int currentPage, int pageSize, long maxConfirmations = 9999999, long minAmount = 1, long maxAmount = long.MaxValue, bool isDesc = false)
        {
            ApiResponse response = new ApiResponse();

            try
            {
                UTXO              utxo    = new UTXO();
                ListPageUnspent   unspent = new ListPageUnspent();
                ListPageUnspentOM result  = await utxo.ListPageUnspent(minConfirmations, currentPage, pageSize, maxConfirmations, minAmount, maxAmount, isDesc);

                if (result != null)
                {
                    foreach (var item in result.UnspentOMList)
                    {
                        PageUnspent output = new PageUnspent();
                        output.Account       = item.account;
                        output.Address       = item.address;
                        output.Amount        = item.amount;
                        output.Confirmations = item.confirmations;
                        output.RedeemScript  = item.redeemScript;
                        output.ScriptPubKey  = item.scriptPubKey;
                        output.Solvable      = item.solvable;
                        output.Spendable     = item.spendable;
                        output.Txid          = item.txid;
                        output.Vout          = item.vout;
                        unspent.UnspentList.Add(output);
                    }
                    unspent.Count   = result.Count;
                    response.Result = Newtonsoft.Json.Linq.JToken.FromObject(unspent);
                }
                else
                {
                    response.Result = null;
                }
            }
            catch (ApiCustomException ex)
            {
                Logger.Singleton.Error(ex.ToString());
                response.Error = new ApiError(ex.ErrorCode, ex.ToString());
            }
            catch (Exception ex)
            {
                Logger.Singleton.Error(ex.ToString());
                response.Error = new ApiError(ex.HResult, ex.ToString());
            }
            return(response);
        }
 void RemoveUtxo(PageUnspent utxo)
 {
     Setting.UTXO.Remove((PageUnspent)utxo);
 }