Skip to content

Commit

Permalink
Add RpcClient::get_multiple_accounts_with_config()
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Sep 3, 2021
1 parent 2efc519 commit 601a2ea
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions client/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2966,11 +2966,22 @@ impl RpcClient {
pubkeys: &[Pubkey],
commitment_config: CommitmentConfig,
) -> RpcResult<Vec<Option<Account>>> {
let config = RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64Zstd),
commitment: Some(self.maybe_map_commitment(commitment_config)?),
data_slice: None,
};
self.get_multiple_accounts_with_config(
pubkeys,
RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64Zstd),
commitment: Some(self.maybe_map_commitment(commitment_config)?),
data_slice: None,
},
)
}

pub fn get_multiple_accounts_with_config(
&self,
pubkeys: &[Pubkey],
mut config: RpcAccountInfoConfig,
) -> RpcResult<Vec<Option<Account>>> {
config.commitment = config.commitment.or_else(|| Some(self.commitment()));
let pubkeys: Vec<_> = pubkeys.iter().map(|pubkey| pubkey.to_string()).collect();
let response = self.send(RpcRequest::GetMultipleAccounts, json!([pubkeys, config]))?;
let Response {
Expand Down

0 comments on commit 601a2ea

Please sign in to comment.