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
60
61
62
63
64
65
66
67
68
//! Messages and helper data types for the perps protocol.
#![deny(missing_docs)]
#![deny(clippy::as_conversions)]

/// Address Helpers
pub mod cosmwasm;

pub mod error;
pub mod event;

/// Contract result helpers
pub mod result;

pub(crate) mod addr;
pub(crate) mod auth;
pub mod compat;
pub mod direction;
pub mod ibc;
pub mod leverage;
/// Feature-gated logging functionality
pub mod log;
pub mod market_type;
pub mod max_gains;
pub mod namespace;
/// Number type and helpers
pub mod number;
/// Exports very commonly used items into the prelude glob
pub mod prelude;
pub mod price;
pub(crate) mod response;
pub mod storage;
pub mod time;

#[cfg(feature = "bridge")]
pub mod bridge;
pub mod constants;
pub mod contracts;
pub mod shutdown;
pub mod token;

#[test]
fn test_allow_unknown_fields() {
    #[cosmwasm_schema::cw_serde]
    struct Expanded {
        foo: String,
        bar: String,
    }

    impl Default for Expanded {
        fn default() -> Self {
            Expanded {
                foo: "hello".to_string(),
                bar: "world".to_string(),
            }
        }
    }

    #[cosmwasm_schema::cw_serde]
    struct Minimal {
        foo: String,
    }

    let expanded_str = serde_json::to_string(&Expanded::default()).unwrap();
    let expanded: Expanded = serde_json::from_str(&expanded_str).unwrap();
    let minimal: Minimal = serde_json::from_str(&expanded_str).unwrap();

    assert_eq!(expanded.foo, minimal.foo);
}