Skip to main content

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/// Lightning and Bitcoin primitives.
35pub mod bitcoin {
36    pub use lexe_api::types::{
37        invoice::{DescriptionHash, Invoice},
38        lnurl::{LnurlPayRequest, LnurlPayRequestMetadata},
39        offer::Offer,
40        payer_proof::PayerProof,
41    };
42    pub use lexe_common::ln::{
43        amount::Amount,
44        channel::{ChannelId, OutPoint, UserChannelId},
45        hashes::Txid,
46        priority::ConfirmationPriority,
47    };
48    pub use lexe_payment_uri::{
49        ClaimMethod, LnurlWithdrawRequest, PaymentMethod, PaymentUriMethod,
50    };
51}
52
53/// General-purpose utilities.
54pub mod util {
55    pub use lexe_common::{ppm::Ppm, time::TimestampMs};
56}