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
//! Wallet communication substrates.
//!
//! This module provides transport substrates for wallet communication.
//! Substrates implement the [`crate::wallet::wire::WalletWire`] trait and handle the actual
//! network communication.
//!
//! # Available Substrates
//!
//! | Substrate | Protocol | Default Port | Description |
//! |-----------|----------|--------------|-------------|
//! | `HttpWalletWire` | Binary | 3301 | Wire protocol over HTTP |
//! | `HttpWalletJson` | JSON | 3321 | JSON API over HTTP |
//!
//! # Platform-Specific Substrates (Not Included)
//!
//! The following substrates from the TypeScript SDK are NOT included in Rust:
//!
//! - **XDM**: Requires browser `window.parent.postMessage()` API
//! - **ReactNativeWebView**: Requires React Native bridge
//! - **WindowCWI**: Requires browser extension injection
//!
//! These substrates require a JavaScript runtime and are not applicable to
//! native Rust code. The Go SDK also excludes these for the same reason.
//!
//! # Example
//!
//! ```rust,ignore
//! use bsv_rs::wallet::substrates::HttpWalletWire;
//! use bsv_rs::wallet::wire::WalletWireTransceiver;
//!
//! // Create HTTP wire substrate
//! let wire = HttpWalletWire::new(Some("myapp.example.com".into()), None);
//!
//! // Wrap with transceiver for wallet operations
//! let wallet = WalletWireTransceiver::new(wire);
//!
//! // Use wallet methods
//! let version = wallet.get_version("myapp.example.com").await?;
//! ```
pub use HttpWalletJson;
pub use HttpWalletWire;
/// Default port for HTTP Wire protocol.
pub const DEFAULT_WIRE_PORT: u16 = 3301;
/// Default port for HTTP JSON protocol.
pub const DEFAULT_JSON_PORT: u16 = 3321;
/// Default base URL for HTTP Wire protocol.
pub const DEFAULT_WIRE_URL: &str = "http://localhost:3301";
/// Default base URL for HTTP JSON protocol.
pub const DEFAULT_JSON_URL: &str = "http://localhost:3321";
/// Secure local JSON API URL.
pub const SECURE_JSON_URL: &str = "https://localhost:2121";