Skip to main content

RemittanceAdapter

Struct RemittanceAdapter 

Source
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>

Source

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>

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,

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,

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,

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,

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,

Delegate to MessageBoxClient::listen_for_live_messages.

Passes override_host through (currently deferred in WS path).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more