Skip to content

Commit

Permalink
use ObjectIDVecView
Browse files Browse the repository at this point in the history
  • Loading branch information
pause125 committed Jun 6, 2024
1 parent d187b0b commit 0922ce3
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions crates/rooch-rpc-api/src/jsonrpc_types/state_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0

use super::{
AnnotatedMoveStructView, AnnotatedMoveValueView, BytesView, H256View, RoochAddressView,
StrView, StructTagView, TypeTagView,
AnnotatedMoveStructView, AnnotatedMoveValueView, BytesView, H256View, ObjectIDVecView,
RoochAddressView, StrView, StructTagView, TypeTagView,
};
use anyhow::Result;

Expand Down Expand Up @@ -428,7 +428,7 @@ pub enum ObjectStateFilterView {
/// Query by owner.
Owner(RoochAddressView),
/// Query by object ids.
ObjectId(String),
ObjectId(ObjectIDVecView),
}

impl ObjectStateFilterView {
Expand All @@ -446,17 +446,8 @@ impl ObjectStateFilterView {
ObjectStateFilter::ObjectType(object_type.into())
}
ObjectStateFilterView::Owner(owner) => ObjectStateFilter::Owner(owner.into()),
ObjectStateFilterView::ObjectId(object_ids_str) => {
let object_ids = if object_ids_str.trim().is_empty() {
vec![]
} else {
object_ids_str
.trim()
.split(',')
.map(ObjectID::from_str)
.collect::<Result<Vec<_>, _>>()?
};
ObjectStateFilter::ObjectId(object_ids)
ObjectStateFilterView::ObjectId(object_id_vec_view) => {
ObjectStateFilter::ObjectId(object_id_vec_view.into())
}
})
}
Expand Down

0 comments on commit 0922ce3

Please sign in to comment.