sui_json_rpc_types/
balance_changes.rs1use move_core_types::language_storage::TypeTag;
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6use serde_with::DisplayFromStr;
7use serde_with::serde_as;
8use std::fmt::{Display, Formatter, Result};
9use sui_types::object::Owner;
10use sui_types::sui_serde::SuiTypeTag;
11
12#[serde_as]
13#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, PartialEq, Eq)]
14#[serde(rename_all = "camelCase")]
15pub struct BalanceChange {
16 pub owner: Owner,
18 #[schemars(with = "String")]
19 #[serde_as(as = "SuiTypeTag")]
20 pub coin_type: TypeTag,
21 #[schemars(with = "String")]
24 #[serde_as(as = "DisplayFromStr")]
25 pub amount: i128,
26}
27
28impl Display for BalanceChange {
29 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
30 write!(
31 f,
32 " ┌──\n │ Owner: {} \n │ CoinType: {} \n │ Amount: {}\n └──",
33 self.owner, self.coin_type, self.amount
34 )
35 }
36}