Skip to main content

mesh_llm_wallet/
lib.rs

1//! Provider-neutral Lightning wallet abstraction for mesh-llm.
2//!
3//! This crate owns three things and nothing else:
4//!
5//! - [`provider::WalletProvider`], the Rust trait the payment ledger drives.
6//! - [`invoice::Invoice`], BOLT11 parsing and validation at trust boundaries.
7//! - [`contract`], the versioned `wallet.v1` plugin capability: operation
8//!   names plus the JSON request/response/error shapes that cross the plugin
9//!   IPC boundary.
10//!
11//! No wallet SDK (Lexe or otherwise) is linked here. Concrete wallets are
12//! plugin processes that implement [`backend::WalletBackend`] and are
13//! projected onto the plugin runtime by the `plugin-server` feature, and run
14//! from their own executables (e.g. `lexe-wallet`).
15#![forbid(unsafe_code)]
16
17pub mod contract;
18pub mod invoice;
19pub mod provider;
20pub mod provisioning;
21
22#[cfg(feature = "plugin-server")]
23pub mod backend;
24#[cfg(feature = "plugin-server")]
25pub mod plugin_server;
26
27pub fn now_ms() -> u64 {
28    std::time::SystemTime::now()
29        .duration_since(std::time::UNIX_EPOCH)
30        .unwrap_or_default()
31        .as_millis()
32        .try_into()
33        .unwrap_or(u64::MAX)
34}