From 48b93463181bf94f0a0540c55dc3cf0aec693f13 Mon Sep 17 00:00:00 2001 From: cavemanloverboy Date: Sun, 18 Dec 2022 04:04:54 +0000 Subject: [PATCH 1/2] add async_rpc method --- client/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/lib.rs b/client/src/lib.rs index eac5799d5f..99d5210917 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -10,6 +10,7 @@ use anchor_lang::{AccountDeserialize, Discriminator, InstructionData, ToAccountM use regex::Regex; use solana_account_decoder::UiAccountEncoding; use solana_client::client_error::ClientError as SolanaClientError; +use solana_client::nonblocking::rpc_client::RpcClient as AsyncRpcClient; use solana_client::pubsub_client::{PubsubClient, PubsubClientError, PubsubClientSubscription}; use solana_client::rpc_client::RpcClient; use solana_client::rpc_config::{ @@ -187,6 +188,13 @@ impl Program { ) } + pub fn async_rpc(&self) -> AsyncRpcClient { + AsyncRpcClient::new_with_commitment( + self.cfg.cluster.url().to_string(), + self.cfg.options.unwrap_or_default(), + ) + } + pub fn id(&self) -> Pubkey { self.program_id } From 48e28de9627abdf9dbe422da7d14527614772efc Mon Sep 17 00:00:00 2001 From: Henry-E Date: Mon, 6 Feb 2023 12:17:35 +0000 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9073e7dc9b..93b546f2dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The minor version will be incremented upon a breaking change and the patch versi ## [Unreleased] +### Features + +- client: Add `async_rpc` a method which returns a nonblocking solana rpc client ([2322](https://github.com/coral-xyz/anchor/pull/2322)). + ## [0.26.0] - 2022-12-15 ### Features