Skip to content

Commit

Permalink
Revert "Merge pull request #367 from near/develop"
Browse files Browse the repository at this point in the history
This reverts commit 23a570d, reversing
changes made to 9d6d10c.
  • Loading branch information
kobayurii committed Oct 31, 2024
1 parent 08b0bc9 commit fae67d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion rpc-server/src/modules/state/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub async fn view_state_paginated(
block.block_height,
request_data.next_page_token,
)
.await?;
.await;

Ok(crate::modules::state::RpcViewStatePaginatedResponse {
values: state_values.values,
Expand Down
35 changes: 16 additions & 19 deletions rpc-server/src/modules/state/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,28 @@ pub async fn get_state_from_db_paginated(
account_id: &near_primitives::types::AccountId,
block_height: near_primitives::types::BlockHeight,
page_token: database::PageToken,
) -> Result<crate::modules::state::PageStateValues, near_jsonrpc::primitives::errors::RpcError> {
) -> crate::modules::state::PageStateValues {
tracing::debug!(
"`get_state_from_db_paginated` call. AccountId {}, block {}, page_token {:?}",
account_id,
block_height,
page_token,
);

let (values, next_page_token) = db_manager
if let Ok((values, next_page_token)) = db_manager
.get_state_by_page(account_id, block_height, page_token, "view_state_paginated")
.await
.map_err(|err| {
near_jsonrpc::primitives::errors::RpcError::new_internal_error(
Some(serde_json::Value::String(err.to_string())),
"Failed to get page state from DB. Please try again!".to_string(),
)
})?;
Ok(crate::modules::state::PageStateValues {
values: values
.into_iter()
.map(|(k, v)| near_primitives::views::StateItem {
key: k.into(),
value: v.into(),
})
.collect(),
next_page_token,
})
{
crate::modules::state::PageStateValues {
values: values
.into_iter()
.map(|(k, v)| near_primitives::views::StateItem {
key: k.into(),
value: v.into(),
})
.collect(),
next_page_token,
}
} else {
crate::modules::state::PageStateValues::default()
}
}

0 comments on commit fae67d5

Please sign in to comment.