Skip to main content

forest/lotus_json/
address.rs

1// Copyright 2019-2026 ChainSafe Systems
2// SPDX-License-Identifier: Apache-2.0, MIT
3
4use super::*;
5use crate::shim::address::Address;
6
7#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)]
8#[schemars(rename = "Address")]
9pub struct AddressLotusJson(
10    #[schemars(with = "String")]
11    #[serde(with = "crate::lotus_json::stringify")]
12    Address,
13);
14
15impl HasLotusJson for Address {
16    type LotusJson = AddressLotusJson;
17
18    #[cfg(test)]
19    fn snapshots() -> Vec<(serde_json::Value, Self)> {
20        vec![(json!("f00"), Address::default())]
21    }
22
23    fn into_lotus_json(self) -> Self::LotusJson {
24        AddressLotusJson(self)
25    }
26
27    fn from_lotus_json(AddressLotusJson(address): Self::LotusJson) -> Self {
28        address
29    }
30}