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