Skip to content

Commit

Permalink
add async_rpc method
Browse files Browse the repository at this point in the history
  • Loading branch information
cavemanloverboy committed Dec 18, 2022
1 parent 4bef8c4 commit 48b9346
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 48b9346

Please sign in to comment.