Add config param to specify offset/length for single and program account info (#11515)

* Add config param to specify dataSlice for account info and program accounts

* Use match instead of if
This commit is contained in:
Tyera Eulberg
2020-08-10 16:35:29 -06:00
committed by GitHub
parent da210ddd51
commit 88ca04dbdb
12 changed files with 210 additions and 26 deletions

View File

@@ -265,7 +265,7 @@ fn filter_account_result(
} else {
return (
Box::new(iter::once(UiAccount::encode(
pubkey, account, encoding, None,
pubkey, account, encoding, None, None,
))),
fork,
);
@@ -316,7 +316,7 @@ fn filter_program_results(
Box::new(
keyed_accounts.map(move |(pubkey, account)| RpcKeyedAccount {
pubkey: pubkey.to_string(),
account: UiAccount::encode(&pubkey, account, encoding.clone(), None),
account: UiAccount::encode(&pubkey, account, encoding.clone(), None, None),
}),
)
};
@@ -1033,6 +1033,7 @@ pub(crate) mod tests {
Some(RpcAccountInfoConfig {
commitment: Some(CommitmentConfig::recent()),
encoding: None,
data_slice: None,
}),
sub_id.clone(),
subscriber,
@@ -1517,6 +1518,7 @@ pub(crate) mod tests {
Some(RpcAccountInfoConfig {
commitment: Some(CommitmentConfig::single_gossip()),
encoding: None,
data_slice: None,
}),
sub_id0.clone(),
subscriber0,
@@ -1585,6 +1587,7 @@ pub(crate) mod tests {
Some(RpcAccountInfoConfig {
commitment: Some(CommitmentConfig::single_gossip()),
encoding: None,
data_slice: None,
}),
sub_id1.clone(),
subscriber1,