saa_common/
types.rs

1// Apache license in both but giving the credits to the original authors
2// Copied to derive custom traits. Most of the features removed except for +/- operations
3
4use saa_schema::{saa_type};
5
6// Copied from `cosmwasm_crypto` [here](https://github.com/CosmWasm/cosmwasm/tree/main/packages/crypto)
7pub mod identity;
8// Copied from `cw_utils`  [here](https://github.com/CosmWasm/cw-minus)
9pub mod expiration;
10
11// Copied from cosmwasm_std [here](https://github.com/CosmWasm/cosmwasm/tree/main/packages/std)
12#[cfg(not(feature = "wasm"))]
13mod ts;
14#[cfg(not(feature = "wasm"))]
15mod bin;
16#[cfg(not(feature = "wasm"))]
17mod uint;
18
19
20pub mod binary {
21    #[cfg(not(feature = "wasm"))]
22    pub use super::bin::{Binary, to_json_binary, from_json};
23    #[cfg(feature = "wasm")]
24    pub use crate::wasm::{Binary, to_json_binary, from_json, to_json_string};
25    #[cfg(all(feature = "types", not(feature = "wasm")))]
26    pub use serde_json_wasm::to_string as to_json_string;
27}
28
29pub mod uints {
30    #[cfg(not(feature = "wasm"))]
31    pub use super::uint::{Uint128, Uint64};
32    #[cfg(feature = "wasm")]
33    pub use crate::wasm::{Uint128, Uint64};
34}
35
36pub mod timestamp {
37    #[cfg(not(feature = "wasm"))]
38    pub use super::ts::Timestamp;
39    #[cfg(feature = "wasm")]
40    pub use crate::wasm::Timestamp;
41}
42
43
44#[saa_type]
45pub struct Empty {}
46
47#[cfg(feature = "session")]
48impl saa_schema::strum::IntoDiscriminant for Empty {
49    type Discriminant = String;
50    fn discriminant(&self) -> Self::Discriminant {
51        String::from("empty")
52    }
53}
54
55impl core::fmt::Display for Empty {
56    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57        write!(f, "empty")
58    }
59}