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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! ### Basic usage of the crate without the "serde" nor "dervie" features would be using `Builder` and `Selector`.
//!
//! ```rust
//! let function = Builder::new()
//!     .name("transfer")
//!     .push("daniel")
//!     .push(10u128)
//!     .push(Bytes10([1u8; 10]))
//!     .build();
//! ```
//!
//! ### Usage with the "derive" feature would look like.
//!
//! Use `#[solid(contstructor)]` if you're constructing a contract.
//! Otherwise the name of the struct and the field types will be used
//! to derive the function signature.
//!
//! ```rust
//! #[derive(Encode)]
//! #[solid(rename = "random_function")]
//! struct ContractCallComposite<'a> {
//!     to: (&'a str, u128),
//!     memos: &'a [&'a str],
//!     matrix: &'a [&'a [&'a [u8]]],
//! }
//!
//! #[derive(Decode)]
//! struct ContractCallResponse<'a> {
//!     int: Uint256,
//!     bytes: Bytes<'a>,
//!     memo: &'a str,
//!     address: Address,
//! }
//! ```
//!
//! ### Usage with the "serde" feature would look like.
//!
//! ```rust
//! #[derive(Serialize)]
//! #[solid(rename = "random_function")]
//! struct ContractCallComposite<'a> {
//!     to: (&'a str, u128),
//!     memos: &'a [&'a str],
//!     matrix: &'a [&'a [&'a [u8]]],
//! }
//!
//! #[derive(Deserialize)]
//! struct ContractCallResponse<'a> {
//!     // Uint256 is not supported.
//!     // int: Uint256,
//!     int: u128,
//!     bytes: Bytes<'a>,
//!     memo: &'a str,
//!     // Address is not supported.
//!     // address: Address,
//! }
//! ```
//!
#[cfg(feature = "derive")]
pub use solid_derive as derive;

pub use solid_core::{
    address::Address,
    builder::Builder,
    bytes::Bytes,
    bytesfix::stable::*,
    decode::Decode,
    encode::Encode,
    error::{
        Error,
        Result,
    },
    function::Function,
    int::stable::*,
    selector::Selector,
};

#[cfg(feature = "nightly")]
pub use solid_core::bytesfix::nightly::*;

#[cfg(feature = "nightly")]
pub use solid_core::int::nightly::*;

#[cfg(feature = "serde")]
pub use solid_core::derive::to_bytes;

#[cfg(feature = "nightly")]
pub use solid_core::bytesfix::nightly::*;

#[cfg(feature = "nightly")]
pub use solid_core::int::nightly::*;

// #[cfg(feature = "fixed")]
// pub use solid_core::fixed::*;