sui_jsonrpc/msgs/
mod.rs

1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Originally `sui_json_rpc_types`. Renamed to stress that types here are used in JSON-RPC
5//! communications.
6#![allow(
7    clippy::missing_const_for_fn,
8    clippy::use_self,
9    clippy::option_if_let_else
10)]
11
12pub use balance_changes::*;
13pub use dynamic_field::*;
14pub use object_changes::*;
15use serde::{Deserialize, Serialize};
16pub use sui_checkpoint::*;
17pub use sui_coin::*;
18pub use sui_event::*;
19pub use sui_extended::*;
20pub use sui_governance::*;
21pub use sui_move::*;
22pub use sui_object::*;
23pub use sui_protocol::*;
24pub use sui_transaction::*;
25
26mod balance_changes;
27mod displays;
28mod dynamic_field;
29mod object_changes;
30mod sui_checkpoint;
31mod sui_coin;
32mod sui_event;
33mod sui_extended;
34mod sui_governance;
35mod sui_move;
36mod sui_object;
37mod sui_protocol;
38mod sui_transaction;
39
40/// `next_cursor` points to the last item in the page;
41/// Reading with `next_cursor` will start from the next item after `next_cursor` if
42/// `next_cursor` is `Some`, otherwise it will start from the first item.
43#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
44#[serde(rename_all = "camelCase")]
45pub struct Page<T, C> {
46    pub data: Vec<T>,
47    pub next_cursor: Option<C>,
48    pub has_next_page: bool,
49}
50
51impl<T, C> Page<T, C> {
52    pub fn empty() -> Self {
53        Self {
54            data: vec![],
55            next_cursor: None,
56            has_next_page: false,
57        }
58    }
59}