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); }
public async Task <ListPageUnspentOM> ListPageUnspent(long minConfirmations, int currentPage, int pageSize, long maxConfirmations = 9999999, long minAmount = 1, long maxAmount = long.MaxValue, bool isDesc = false) { AuthenticationHeaderValue authHeaderValue = null; RpcClient client = new RpcClient(new Uri(WalletNetwork.NetWork), authHeaderValue, null, null, "application/json"); RpcRequest request = RpcRequest.WithParameterList("ListPageUnspent", new List <object> { minConfirmations, currentPage, pageSize, maxConfirmations, minAmount, maxAmount, isDesc }, 1); RpcResponse response = await client.SendRequestAsync(request); if (response.HasError) { throw new ApiCustomException(response.Error.Code, response.Error.Message); } ListPageUnspentOM responseValue = response.GetResult <ListPageUnspentOM>(); return(responseValue); }