public async Task <List <BlockchainScripthashListunspentResult> > GetListUnspent(string scriptHash)
        {
            var requestData = new BlockchainScripthashListunspentRequest(scriptHash).GetRequestData();
            var buff        = "";

            try
            {
                if (UseSsl)
                {
                    await ConnectWithSsl();

                    buff = await SendMessageWithSsl(requestData);
                }
                else
                {
                    await ConnectNoSsl();

                    buff = await SendMessageNoSsl(requestData);
                }
            }
            catch
            {
                // ignored
            }
            var response = !string.IsNullOrEmpty(buff) ? JsonConvert.DeserializeObject <BlockchainScripthashListunspentResponse>(buff) : null;

            if (response?.Error != null)
            {
                OnError?.Invoke(this, response.Error.Code, response.Error.Message);
            }
            return(response != null?response.GetResultModel() : new List <BlockchainScripthashListunspentResult>());
        }
Example #2
0
        public async Task <BlockchainScripthashListunspentResponse> GetBlockchainListunspent(string scripthash)
        {
            var request = new BlockchainScripthashListunspentRequest();

            request.Parameters = new string[] { scripthash };
            var requestData = request.GetRequestData <BlockchainScripthashListunspentRequest>();

            await this.Connect();

            string response = await SendMessage(requestData);

            this.Disconnect();
            return(BlockchainScripthashListunspentResponse.FromJson(response));
        }