Skip to content

Commit

Permalink
build rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
pause125 committed Jun 6, 2024
1 parent 880f1e9 commit 64737b4
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 144 deletions.
204 changes: 62 additions & 142 deletions crates/rooch-open-rpc-spec/schemas/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,52 @@
}
}
},
{
"name": "rooch_getFieldStates",
"description": "Get Object Fields via ObjectID and field keys.",
"params": [
{
"name": "object_id",
"required": true,
"schema": {
"$ref": "#/components/schemas/ObjectID"
}
},
{
"name": "field_key",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SimpleKeyStateView"
}
}
},
{
"name": "state_option",
"schema": {
"$ref": "#/components/schemas/StateOptions"
}
}
],
"result": {
"name": "Vec<Option<StateView>>",
"required": true,
"schema": {
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/components/schemas/StateView"
},
{
"type": "null"
}
]
}
}
}
},
{
"name": "rooch_getObjectStates",
"description": "Get object states by object id",
Expand Down Expand Up @@ -386,7 +432,7 @@
}
},
{
"name": "rooch_listObjectFields",
"name": "rooch_listFieldStates",
"description": "List Object Fields via ObjectID.",
"params": [
{
Expand Down Expand Up @@ -499,44 +545,6 @@
}
}
},
{
"name": "rooch_queryFieldStates",
"description": "Query the Object field states indexer by state filter",
"params": [
{
"name": "filter",
"required": true,
"schema": {
"$ref": "#/components/schemas/FieldStateFilterView"
}
},
{
"name": "cursor",
"schema": {
"$ref": "#/components/schemas/IndexerStateID"
}
},
{
"name": "limit",
"schema": {
"$ref": "#/components/schemas/usize"
}
},
{
"name": "query_option",
"schema": {
"$ref": "#/components/schemas/QueryOptions"
}
}
],
"result": {
"name": "FieldStatePageView",
"required": true,
"schema": {
"$ref": "#/components/schemas/PageView_for_FieldStateView_and_IndexerStateID"
}
}
},
{
"name": "rooch_queryObjectStates",
"description": "Query the object states indexer by state filter",
Expand Down Expand Up @@ -1064,80 +1072,6 @@
}
]
},
"FieldStateFilterView": {
"oneOf": [
{
"description": "Query by object id.",
"type": "object",
"required": [
"object_id"
],
"properties": {
"object_id": {
"$ref": "#/components/schemas/ObjectID"
}
},
"additionalProperties": false
}
]
},
"FieldStateView": {
"type": "object",
"required": [
"created_at",
"key_hex",
"key_type",
"object_id",
"state_index",
"tx_order",
"updated_at",
"value_type"
],
"properties": {
"created_at": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"key_hex": {
"type": "string"
},
"key_type": {
"$ref": "#/components/schemas/move_core_types::language_storage::TypeTag"
},
"object_id": {
"$ref": "#/components/schemas/ObjectID"
},
"state_index": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"tx_order": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"updated_at": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"value": {
"anyOf": [
{
"$ref": "#/components/schemas/AnnotatedMoveValueView"
},
{
"type": "null"
}
]
},
"value_type": {
"$ref": "#/components/schemas/move_core_types::language_storage::TypeTag"
}
}
},
"FunctionCallView": {
"type": "object",
"required": [
Expand Down Expand Up @@ -2149,35 +2083,6 @@
}
}
},
"PageView_for_FieldStateView_and_IndexerStateID": {
"description": "`next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the next item after `next_cursor` if `next_cursor` is `Some`, otherwise it will start from the first item.",
"type": "object",
"required": [
"data",
"has_next_page"
],
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FieldStateView"
}
},
"has_next_page": {
"type": "boolean"
},
"next_cursor": {
"anyOf": [
{
"$ref": "#/components/schemas/IndexerStateID"
},
{
"type": "null"
}
]
}
}
},
"PageView_for_IndexerEventView_and_IndexerEventID": {
"description": "`next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the next item after `next_cursor` if `next_cursor` is `Some`, otherwise it will start from the first item.",
"type": "object",
Expand Down Expand Up @@ -2386,6 +2291,21 @@
}
}
},
"SimpleKeyStateView": {
"type": "object",
"required": [
"key",
"key_type"
],
"properties": {
"key": {
"$ref": "#/components/schemas/alloc::vec::Vec<u8>"
},
"key_type": {
"$ref": "#/components/schemas/move_core_types::language_storage::TypeTag"
}
}
},
"SpecificStructView": {
"description": "Some specific struct that we want to display in a special way for better readability",
"anyOf": [
Expand Down
4 changes: 2 additions & 2 deletions crates/rooch-rpc-api/src/jsonrpc_types/move_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ impl FromStr for ObjectIDVecView {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let ids = s
.split(",")
.map(|id| ObjectID::from_str(id))
.split(',')
.map(ObjectID::from_str)
.collect::<Result<Vec<_>, _>>()?;
Ok(StrView(ids))
}
Expand Down

0 comments on commit 64737b4

Please sign in to comment.