Add RpcClient::get_multiple_accounts_with_config()
This commit is contained in:
parent
f7a5c0301a
commit
ae43ca3bfb
|
@ -2965,11 +2965,25 @@ impl RpcClient {
|
|||
&self,
|
||||
pubkeys: &[Pubkey],
|
||||
commitment_config: CommitmentConfig,
|
||||
) -> RpcResult<Vec<Option<Account>>> {
|
||||
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],
|
||||
config: RpcAccountInfoConfig,
|
||||
) -> RpcResult<Vec<Option<Account>>> {
|
||||
let config = RpcAccountInfoConfig {
|
||||
encoding: Some(UiAccountEncoding::Base64Zstd),
|
||||
commitment: Some(self.maybe_map_commitment(commitment_config)?),
|
||||
data_slice: None,
|
||||
commitment: config.commitment.or_else(|| Some(self.commitment())),
|
||||
..config
|
||||
};
|
||||
let pubkeys: Vec<_> = pubkeys.iter().map(|pubkey| pubkey.to_string()).collect();
|
||||
let response = self.send(RpcRequest::GetMultipleAccounts, json!([pubkeys, config]))?;
|
||||
|
|
Loading…
Reference in New Issue