Skip to content

Commit

Permalink
Switch get_program_accounts to use base64 (#12558)
Browse files Browse the repository at this point in the history
(cherry picked from commit 182552c)

Co-authored-by: Michael Vines <[email protected]>
  • Loading branch information
mergify[bot] and mvines authored Sep 29, 2020
1 parent af91768 commit 2794856
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions client/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,16 @@ impl RpcClient {
}

pub fn get_program_accounts(&self, pubkey: &Pubkey) -> ClientResult<Vec<(Pubkey, Account)>> {
let accounts: Vec<RpcKeyedAccount> =
self.send(RpcRequest::GetProgramAccounts, json!([pubkey.to_string()]))?;
let config = RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64),
commitment: None,
data_slice: None,
};

let accounts: Vec<RpcKeyedAccount> = self.send(
RpcRequest::GetProgramAccounts,
json!([pubkey.to_string(), config]),
)?;
parse_keyed_accounts(accounts, RpcRequest::GetProgramAccounts)
}

Expand Down

0 comments on commit 2794856

Please sign in to comment.