lexe/
types.rs

1//! Types used by the Lexe SDK.
2
3// ## Guidelines
4//
5// - **Simple**: Straightforward consumption by newbie developers via a JSON
6//   REST API (Lexe Sidecar SDK) or via language bindings (Lexe SDK).
7//
8//   - *Minimal nesting* means users don't have to define multiple structs per
9//     request / response.
10//   - *Fewer fields* means fewer long-term compatibility commitments.
11//
12// - **User-facing docs**: `///` doc strings here will be rendered in the public
13//   API docs. Write for SDK users, not Lexe developers.
14//
15// - **Document serialization and units**: When newtypes are used, document how
16//   users should interpret the serialized form:
17//
18//   - `UserPk`s and `NodePk`s are serialized as hex; mention it.
19//   - `Amount`s are serialized as sats; mention it.
20//   - `TimestampMs` is serialized as *milliseconds* since the UNIX epoch.
21//   - `semver::Version`s don't use a `v-` prefix; give an example: `0.6.9`.
22//
23// - **Serialize `null`**: Don't use `#[serde(skip_serializing_if = ...)]` as
24//   serializing `null` fields makes it clear to SDK users that information
25//   could be returned there in future responses.
26
27/// Authentication, identity, and node verification.
28pub mod auth;
29/// Request, response, and command types for SDK operations.
30pub mod command;
31/// Payment data types.
32pub mod payment;
33
34/// On-chain and Bitcoin primitives.
35pub mod bitcoin {
36    pub use lexe_api::types::invoice::Invoice;
37    pub use lexe_common::ln::{
38        amount::Amount, hashes::Txid, priority::ConfirmationPriority,
39    };
40}
41
42/// General-purpose utilities.
43pub mod util {
44    pub use lexe_common::time::TimestampMs;
45}