/// <summary> /// Broadcast signed transaction asynchronously /// </summary> /// <param name="signedTx"></param> /// <returns></returns> public Task <IRestResponse> BroadcastAsync(SignedTx signedTx) { var client = new RestClient(Network.lcdUrl); var request = new RestRequest("/txs", Method.POST); string jsonToSend = JsonConvert.SerializeObject(signedTx); request.AddParameter("application/json; charset=utf-8", jsonToSend, ParameterType.RequestBody); request.RequestFormat = DataFormat.Json; return(client.ExecuteAsync(request)); }
/// <summary> /// Broadcast signed transaction and wait for response /// </summary> /// <param name="signedTx"></param> /// <returns></returns> public BroadcastResponse Broadcast(SignedTx signedTx) { Task <IRestResponse> task = Task.Run(async() => await BroadcastAsync(signedTx)); return(JObject.Parse(task.Result.Content).ToObject <BroadcastResponse>()); }
/// <summary> /// Broadcasts a signed transaction using the provided wallet asynchronously /// </summary> /// <param name="signedTx"></param> /// <param name="wallet"></param> /// <returns></returns> public static Task <IRestResponse> BroadcastAsync(this SignedTx signedTx, Wallet wallet) { return(wallet.BroadcastAsync(signedTx)); }
/// <summary> /// Broadcasts a signed transaction using the provided wallet and waits for response /// </summary> /// <param name="signedTx"></param> /// <param name="wallet"></param> /// <returns></returns> public static BroadcastResponse Broadcast(this SignedTx signedTx, Wallet wallet) { return(wallet.Broadcast(signedTx)); }