pub struct RestClientChainService { /* private fields */ }Expand description
REST-backed BitcoinChainService.
The trait is exported through UniFFI with with_foreign, which makes
UniFFI re-wrap every Arc<dyn BitcoinChainService> that round-trips
across the FFI boundary in a foreign-callback proxy — even when both
sides are Rust in the same process. That proxy routes calls back into
Rust via UniFFI’s RustFuture, which is polled outside the surrounding
tokio runtime context, so reqwest’s tokio::time::sleep panics with
“no reactor running”.
To stay correct under round-tripping (e.g. shared-chain-service in a
server-side harness that builds the service in Rust, hands it to a
foreign-language integration, and passes it back into multiple SDK
instances), we capture a [tokio::runtime::Handle] at construction
time and dispatch each trait-method body onto it via
[tokio::runtime::Handle::spawn]. The outer future we return to
UniFFI is just a JoinHandle await — a channel-wakeup poll that
needs no tokio context.
Implementations§
Trait Implementations§
Source§impl BitcoinChainService for RestClientChainService
impl BitcoinChainService for RestClientChainService
fn get_address_utxos<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Vec<Utxo>, ChainServiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_transaction_status<'life0, 'async_trait>(
&'life0 self,
txid: String,
) -> Pin<Box<dyn Future<Output = Result<TxStatus, ChainServiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_transaction_hex<'life0, 'async_trait>(
&'life0 self,
txid: String,
) -> Pin<Box<dyn Future<Output = Result<String, ChainServiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn broadcast_transaction<'life0, 'async_trait>(
&'life0 self,
tx: String,
) -> Pin<Box<dyn Future<Output = Result<(), ChainServiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recommended_fees<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RecommendedFees, ChainServiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for RestClientChainService
impl !RefUnwindSafe for RestClientChainService
impl Send for RestClientChainService
impl Sync for RestClientChainService
impl Unpin for RestClientChainService
impl UnsafeUnpin for RestClientChainService
impl !UnwindSafe for RestClientChainService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request