sui_jsonrpc/msgs/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//! Originally `sui_json_rpc_types`. Renamed to stress that types here are used in JSON-RPC
//! communications.
#![allow(
    clippy::missing_const_for_fn,
    clippy::use_self,
    clippy::option_if_let_else
)]

pub use balance_changes::*;
pub use dynamic_field::*;
pub use object_changes::*;
use serde::{Deserialize, Serialize};
pub use sui_checkpoint::*;
pub use sui_coin::*;
pub use sui_event::*;
pub use sui_extended::*;
pub use sui_governance::*;
pub use sui_move::*;
pub use sui_object::*;
pub use sui_protocol::*;
pub use sui_transaction::*;

mod balance_changes;
mod displays;
mod dynamic_field;
mod object_changes;
mod sui_checkpoint;
mod sui_coin;
mod sui_event;
mod sui_extended;
mod sui_governance;
mod sui_move;
mod sui_object;
mod sui_protocol;
mod sui_transaction;

/// `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.
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Page<T, C> {
    pub data: Vec<T>,
    pub next_cursor: Option<C>,
    pub has_next_page: bool,
}

impl<T, C> Page<T, C> {
    pub fn empty() -> Self {
        Self {
            data: vec![],
            next_cursor: None,
            has_next_page: false,
        }
    }
}