lib.rs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //! Rust implementation of the Cashu Protocol
  2. #![doc = include_str!("../README.md")]
  3. #![warn(missing_docs)]
  4. #![warn(rustdoc::bare_urls)]
  5. // Disallow enabling `tor` feature on wasm32 with a clear error.
  6. #[cfg(all(target_arch = "wasm32", feature = "tor"))]
  7. compile_error!("The 'tor' feature is not supported on wasm32 targets (browser). Disable the 'tor' feature or use a non-wasm32 target.");
  8. pub mod cdk_database {
  9. //! CDK Database
  10. pub use cdk_common::database::Error;
  11. #[cfg(all(feature = "mint", feature = "auth"))]
  12. pub use cdk_common::database::MintAuthDatabase;
  13. #[cfg(feature = "wallet")]
  14. pub use cdk_common::database::WalletDatabase;
  15. #[cfg(feature = "mint")]
  16. pub use cdk_common::database::{
  17. MintDatabase, MintKVStore, MintKVStoreDatabase, MintKVStoreTransaction, MintKeysDatabase,
  18. MintProofsDatabase, MintQuotesDatabase, MintSignaturesDatabase, MintTransaction,
  19. };
  20. }
  21. #[cfg(feature = "mint")]
  22. pub mod mint;
  23. #[cfg(feature = "wallet")]
  24. pub mod wallet;
  25. #[cfg(test)]
  26. mod test_helpers;
  27. #[cfg(all(feature = "bip353", not(target_arch = "wasm32")))]
  28. mod bip353;
  29. #[cfg(feature = "wallet")]
  30. mod lightning_address;
  31. #[cfg(all(any(feature = "wallet", feature = "mint"), feature = "auth"))]
  32. mod oidc_client;
  33. #[cfg(feature = "mint")]
  34. #[doc(hidden)]
  35. pub use cdk_common::payment as cdk_payment;
  36. /// Re-export amount type
  37. #[doc(hidden)]
  38. pub use cdk_common::{
  39. amount, common as types, dhke, ensure_cdk,
  40. error::{self, Error},
  41. lightning_invoice, mint_url, nuts, secret, util, ws, Amount, Bolt11Invoice,
  42. };
  43. #[cfg(all(any(feature = "wallet", feature = "mint"), feature = "auth"))]
  44. pub use oidc_client::OidcClient;
  45. #[cfg(any(feature = "wallet", feature = "mint"))]
  46. pub mod event;
  47. pub mod fees;
  48. pub mod invoice;
  49. #[doc(hidden)]
  50. pub use bitcoin::secp256k1;
  51. #[cfg(feature = "mint")]
  52. #[doc(hidden)]
  53. pub use mint::Mint;
  54. #[cfg(feature = "wallet")]
  55. #[doc(hidden)]
  56. pub use wallet::{Wallet, WalletSubscription};
  57. #[doc(hidden)]
  58. pub use self::util::SECP256K1;
  59. #[cfg(feature = "wallet")]
  60. #[doc(hidden)]
  61. pub use self::wallet::HttpClient;
  62. /// Result
  63. #[doc(hidden)]
  64. pub type Result<T, E = Box<dyn std::error::Error>> = std::result::Result<T, E>;
  65. /// Re-export subscription
  66. pub use cdk_common::subscription;
  67. /// Re-export futures::Stream
  68. #[cfg(any(feature = "wallet", feature = "mint"))]
  69. pub use futures::{Stream, StreamExt};
  70. /// Payment Request
  71. #[cfg(feature = "wallet")]
  72. pub use wallet::payment_request;