public async Task <BlockchainScripthashGetHistoryResponse> GetBlockchainScripthashGetHistory(string scripthash) { var request = new BlockchainScripthashGetHistoryRequest(); request.Parameters = new string[] { scripthash }; var requestData = request.GetRequestData <BlockchainScripthashGetHistoryRequest>(); await this.Connect(); string response = await SendMessage(requestData); this.Disconnect(); return(BlockchainScripthashGetHistoryResponse.FromJson(response)); }
public async Task <List <BlockchainScripthashGetHistoryResult> > GetHistory(IDestination address) { if (address == null) { return(new List <BlockchainScripthashGetHistoryResult>()); } var scriptHash = GetScriptHash(address); var requestData = new BlockchainScripthashGetHistoryRequest(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 <BlockchainScripthashGetHistoryResponse>(buff) : null; if (response?.Error != null) { OnError?.Invoke(this, response.Error.Code, response.Error.Message); } return(response != null?response.GetResultModel() : new List <BlockchainScripthashGetHistoryResult>()); }