pub struct RemittanceAdapter<W: WalletInterface + Clone + 'static> { /* private fields */ }Expand description
Bridge between MessageBoxClient<W> and the CommsLayer trait.
RemittanceAdapter<W> is the primary integration point for downstream
consumers (e.g. metawatt-edge-rs) that interact with the messagebox
protocol through the SDK’s CommsLayer trait boundary.
Uses composition (Arc<MessageBoxClient<W>>) rather than inheritance —
this matches the pre-phase architectural decision in STATE.md and keeps
the adapter lightweight.
Implementations§
Source§impl<W: WalletInterface + Clone + 'static> RemittanceAdapter<W>
impl<W: WalletInterface + Clone + 'static> RemittanceAdapter<W>
Sourcepub fn new(client: Arc<MessageBoxClient<W>>) -> Self
pub fn new(client: Arc<MessageBoxClient<W>>) -> Self
Construct a new RemittanceAdapter wrapping client.
Trait Implementations§
Source§impl<W: WalletInterface + Clone + 'static + Send + Sync> CommsLayer for RemittanceAdapter<W>
impl<W: WalletInterface + Clone + 'static + Send + Sync> CommsLayer for RemittanceAdapter<W>
Source§fn send_message<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_box: &'life2 str,
body: &'life3 str,
host_override: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<String, RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn send_message<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_box: &'life2 str,
body: &'life3 str,
host_override: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<String, RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Delegate to MessageBoxClient, passing host_override through.
When host_override is Some(host), calls send_message_to_host directly
bypassing overlay resolution. When None, calls send_message which resolves
the recipient’s host via overlay (TS parity: overrideHost ?? resolveHostForRecipient).
Source§fn list_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message_box: &'life1 str,
_host: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerMessage>, RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message_box: &'life1 str,
_host: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerMessage>, RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieve messages and map them to Vec<PeerMessage>.
CRITICAL: PeerMessage.recipient is populated from get_identity_key()
— NOT from ServerPeerMessage, which does not carry a recipient field.
PeerMessage.message_box comes from the parameter, not the server response.
Source§fn acknowledge_message<'life0, 'life1, 'async_trait>(
&'life0 self,
message_ids: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<(), RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn acknowledge_message<'life0, 'life1, 'async_trait>(
&'life0 self,
message_ids: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<(), RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delegate to MessageBoxClient::acknowledge_message.
Converts &[String] to Vec<String> to match the inner method signature (Pitfall 4).
Source§fn send_live_message<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_box: &'life2 str,
body: &'life3 str,
host_override: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<String, RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn send_live_message<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_box: &'life2 str,
body: &'life3 str,
host_override: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<String, RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Delegate to MessageBoxClient::send_live_message.
Passes host_override through to MessageBoxClient::send_live_message
which applies it on the HTTP fallback path.
The CommsLayer trait requires Result<String, RemittanceError>.
MessageBoxClient::send_live_message now returns Result<DeliveryMode>;
we extract the message ID via .message_id(). Callers that need to
distinguish live vs persisted delivery should use MessageBoxClient
directly rather than going through this adapter.
Source§fn listen_for_live_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message_box: &'life1 str,
override_host: Option<&'life2 str>,
on_message: Arc<dyn Fn(PeerMessage) + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<(), RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn listen_for_live_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message_box: &'life1 str,
override_host: Option<&'life2 str>,
on_message: Arc<dyn Fn(PeerMessage) + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<(), RemittanceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delegate to MessageBoxClient::listen_for_live_messages.
Passes override_host through (currently deferred in WS path).