Skip to main content

LightningClientModule

Struct LightningClientModule 

Source
pub struct LightningClientModule {
    pub(crate) federation_id: FederationId,
    pub(crate) cfg: LightningClientConfig,
    pub(crate) notifier: ModuleNotifier<LightningClientStateMachines>,
    pub(crate) client_ctx: ClientContext<Self>,
    pub(crate) module_api: DynModuleApi,
    pub(crate) keypair: Keypair,
    pub(crate) lnurl_keypair: Keypair,
    pub(crate) gateway_conn: Arc<dyn GatewayConnection + Send + Sync>,
    pub(crate) admin_auth: Option<ApiAuth>,
}

Fields§

§federation_id: FederationId§cfg: LightningClientConfig§notifier: ModuleNotifier<LightningClientStateMachines>§client_ctx: ClientContext<Self>§module_api: DynModuleApi§keypair: Keypair§lnurl_keypair: Keypair§gateway_conn: Arc<dyn GatewayConnection + Send + Sync>§admin_auth: Option<ApiAuth>

Implementations§

Source§

impl LightningClientModule

Source

pub(crate) fn new( federation_id: FederationId, cfg: LightningClientConfig, notifier: ModuleNotifier<LightningClientStateMachines>, client_ctx: ClientContext<Self>, module_api: DynModuleApi, module_root_secret: &DerivableSecret, gateway_conn: Arc<dyn GatewayConnection + Send + Sync>, custom_meta_fn: Arc<dyn Fn() -> Value + Send + Sync>, admin_auth: Option<ApiAuth>, task_group: &TaskGroup, client_span: &Span, ) -> Self

Source

pub(crate) fn spawn_gateway_map_update_task( &self, task_group: &TaskGroup, client_span: &Span, )

Source

pub(crate) async fn update_gateway_map(&self)

Source

pub async fn select_gateway( &self, invoice: Option<Bolt11Invoice>, ) -> Result<(SafeUrl, RoutingInfo), SelectGatewayError>

Selects an available gateway by querying the federation’s registered gateways, checking if one of them match the invoice’s payee public key, then queries the gateway for RoutingInfo to determine if it is online.

Source

pub async fn list_gateways( &self, peer: Option<PeerId>, ) -> Result<Vec<SafeUrl>, ListGatewaysError>

Sends a request to each peer for their registered gateway list and returns a Vec<SafeUrl of all registered gateways to the client.

Source

pub async fn routing_info( &self, gateway: &SafeUrl, ) -> Result<Option<RoutingInfo>, RoutingInfoError>

Requests the RoutingInfo, including fee information, from the gateway available at the SafeUrl.

Source

pub async fn send( &self, invoice: Bolt11Invoice, gateway: Option<SafeUrl>, custom_meta: Value, ) -> Result<OperationId, SendPaymentError>

Pay an invoice. For testing you can optionally specify a gateway to route with, otherwise a gateway will be selected automatically. If the invoice was created by a gateway connected to our federation, the same gateway will be selected to allow for a direct ecash swap. Otherwise we select a random online gateway.

The fee for this payment may depend on the selected gateway but will be limited to one and a half percent plus one hundred satoshis. This fee accounts for the fee charged by the gateway as well as the additional fee required to reliably route this payment over lightning if necessary. Since the gateway has been vetted by at least one guardian we trust it to set a reasonable fee and only enforce a rather high limit.

The absolute fee for a payment can be calculated from the operation meta to be shown to the user in the transaction history.

Source

pub async fn send_with_terms( &self, invoice: Bolt11Invoice, gateway: SafeUrl, send_fee: PaymentFee, expiration_delta: u64, custom_meta: Value, ) -> Result<OperationId, SendWithTermsError>

Pays invoice through gateway at the terms the caller already checked.

Self::send reads the gateway’s terms itself, so a caller that showed the user a fee and asked for approval has no guarantee the funded contract carries that fee: the gateway may change its schedule between the two reads. This variant takes the send_fee and expiration_delta the caller obtained from RoutingInfo::send_parameters and refuses with SendWithTermsError::TermsChanged, before funding anything, if the gateway currently reports different terms. A cheaper fee counts as changed too, so the funded contract always matches what was approved. This binds the funded contract to the approved terms, not the gateway’s acceptance: a gateway that raises its schedule after the check can still refuse the contract, in which case the payment is refunded. The error carries the current terms for re-quoting.

Source

pub(crate) async fn validate_send_invoice( &self, invoice: &Bolt11Invoice, ) -> Result<(u64, OperationId), SendPaymentError>

Checks that invoice is payable by this client and has not been attempted before, returning its amount in millisatoshis and the operation id a payment of it uses.

Source

pub(crate) async fn resolve_send_gateway( &self, invoice: &Bolt11Invoice, gateway: Option<SafeUrl>, ) -> Result<(SafeUrl, RoutingInfo), SendPaymentError>

Resolves the gateway to pay invoice through and its current routing info: the given one, or an automatically selected one when None.

Source

pub(crate) async fn fund_outgoing_contract( &self, invoice: Bolt11Invoice, amount: u64, operation_id: OperationId, gateway_api: SafeUrl, routing_info: RoutingInfo, custom_meta: Value, ) -> Result<OperationId, SendPaymentError>

Funds an outgoing contract for invoice at the terms in routing_info and starts the state machine that hands it to gateway_api.

Source

pub async fn get_invoice_send_status( &self, invoice: &Bolt11Invoice, ) -> Result<InvoiceSendStatus, OperationLookupError>

The status of a previous Self::send for this invoice.

Callers deciding whether an invoice is safe to pay through another mechanism must treat anything but InvoiceSendStatus::NotAttempted as a potential double payment.

Source

pub async fn subscribe_send_operation_state_updates( &self, operation_id: OperationId, ) -> Result<UpdateStreamOrOutcome<SendOperationState>, OperationLookupError>

Subscribe to all state updates of the send operation.

Source

pub async fn await_final_send_operation_state( &self, operation_id: OperationId, ) -> Result<FinalSendOperationState, OperationLookupError>

Await the final state of the send operation.

Source

pub async fn receive( &self, amount: Amount, expiry_secs: u32, description: Bolt11InvoiceDescription, gateway: Option<SafeUrl>, custom_meta: Value, ) -> Result<(Bolt11Invoice, OperationId), ReceiveError>

Request an invoice. For testing you can optionally specify a gateway to generate the invoice, otherwise a random online gateway will be selected automatically.

The total fee for this payment may depend on the chosen gateway but will be limited to half of one percent plus fifty satoshis. Since the selected gateway has been vetted by at least one guardian we trust it to set a reasonable fee and only enforce a rather high limit.

The absolute fee for a payment can be calculated from the operation meta to be shown to the user in the transaction history.

Source

pub async fn receive_with_terms( &self, amount: Amount, expiry_secs: u32, description: Bolt11InvoiceDescription, gateway: SafeUrl, receive_fee: PaymentFee, custom_meta: Value, ) -> Result<(Bolt11Invoice, OperationId), ReceiveWithTermsError>

Requests an invoice from gateway at the receive fee the caller already checked.

Self::receive reads the gateway’s fee itself, so a caller that showed the user a fee has no guarantee the incoming contract is created at that fee: the gateway may change its schedule between the two reads. This variant takes the receive_fee the caller obtained from RoutingInfo::receive_fee and refuses with ReceiveWithTermsError::TermsChanged, before creating anything, if the gateway currently reports a different fee. A cheaper fee counts as changed too, so the contract always matches what was approved; the error carries the current fee for re-quoting.

Source

pub(crate) async fn resolve_receive_gateway( &self, gateway: Option<SafeUrl>, ) -> Result<(SafeUrl, RoutingInfo), ReceiveError>

Resolves the gateway to request an invoice from and its current routing info: the given one, or an automatically selected one when None.

Source

pub(crate) async fn select_receive_gateway( &self, ) -> Result<(SafeUrl, RoutingInfo), SelectGatewayError>

Selects the first registered gateway that is online and currently accepts incoming payments for this federation. A gateway that answers but has turned receives off is skipped rather than handed an invoice request it would refuse.

Source

pub(crate) async fn receive_with_routing_info( &self, amount: Amount, expiry_secs: u32, description: Bolt11InvoiceDescription, gateway: SafeUrl, routing_info: RoutingInfo, custom_meta: Value, ) -> Result<(Bolt11Invoice, OperationId), ReceiveError>

Creates the incoming contract locked to a public key derived from our static module public key, fetches its invoice from gateway at the terms in routing_info, then starts the receive operation.

Source

pub async fn receive_fee_quote( &self, amount: Amount, ) -> Result<FeeQuote, TransactionSubmitError>

Computes the federation fee a receive of amount would incur, without submitting anything.

When the incoming contract is claimed, the client submits a transaction with a single Lightning input worth the contract amount; the primary module balances it by minting the change credited to the wallet. This quotes the fee of that transaction — the Lightning input fee, the mint output fees, and any sub-denomination dust — via the shared, module-agnostic fee quote.

The gateway’s off-chain Lightning fee is deliberately excluded: this is only the fee of the on-federation transaction. For that reason the quote is taken on amount directly (rather than the gateway-reduced contract amount), and no gateway round-trip is needed.

Source

pub(crate) async fn is_worth_claiming(&self, amount: Amount) -> bool

Whether an incoming contract worth amount is worth claiming, i.e. whether claiming it would leave the wallet better off than leaving it.

This is the computed counterpart of a fixed dust limit: it prices the actual claim - the lightning input fee at this federation’s fee consensus, the change the primary module has to mint, and the sub-denomination remainder that cannot be minted at all - rather than assuming a floor. A quote that fails outright is the same verdict: the claim spends the contract as the transaction’s only input, so a fee larger than the contract leaves a transaction that cannot be balanced.

Source

pub async fn send_fee_quote( &self, amount: Amount, ) -> Result<FeeQuote, TransactionSubmitError>

Computes the federation fee a send funding an outgoing contract worth amount would incur, without submitting anything.

When a payment is sent, the client submits a transaction with a single Lightning output (the outgoing contract) worth amount; the primary module balances it by spending ecash to fund the contract and minting any change. This quotes the fee of that transaction — the Lightning output fee, the mint input fees on the funding notes, any mint change output fees, and sub-denomination dust — via the shared, module-agnostic fee quote.

The gateway’s off-chain Lightning fee is deliberately excluded: it is part of the contract amount the gateway claims, not the on-federation transaction fee. So amount is the full outgoing contract value (send_fee.add_to(invoice_amount)).

Source

pub async fn spendable_amount( &self, balance: Amount, gateway: Option<SafeUrl>, ) -> Result<Amount, SpendableAmountError>

Computes the largest invoice amount the client can pay in full out of balance, i.e. the amount to request an invoice for in order to spend (close to) the entire balance.

Paying an invoice deducts two kinds of fee from the balance:

  • the gateway fee, which is added on top of the invoice amount to form the outgoing contract (send_fee.add_to(invoice_amount)), and
  • the federation fee of funding that contract — the Lightning output fee, the mint input fees on the funding notes, the mint output fees on any change, and sub-denomination dust — as quoted by Self::send_fee_quote.

balance is the client’s current Bitcoin balance (e.g. from Client::get_balance_for_btc). gateway optionally pins the gateway whose fee schedule to use; if None one is selected automatically, the same way Self::send does when no gateway is given. The gateway’s default send fee is used — the higher of its two send fees, applied to a Lightning swap rather than a direct fedimint-to-fedimint swap — so the returned amount stays payable even when the eventual invoice is routed over Lightning.

The maximum payable amount is found by binary search over the real fee quote (see [max_affordable_send_amount]) rather than a closed form, because the federation fee is stepwise in the amount. The quote is point-in-time and moves with the balance, exactly like Self::send_fee_quote; the eventual Self::send remains the source of truth and may still fail if balance or gateway state changes in between.

Returns SpendableAmountError::BalanceTooLow if the balance cannot cover even the smallest payable amount plus fees, and SpendableAmountError::Quote if the fee probe itself failed; only the first of the two says the wallet is short. Any LNURL minSendable/maxSendable bounds are the caller’s responsibility to apply. The remaining variants of SpendableAmountError are gateway-side, and none of them means the wallet is short.

Source

pub(crate) async fn receive_incoming_contract( &self, sk: SecretKey, contract: IncomingContract, operation_meta: LightningOperationMeta, ) -> Option<OperationId>

Source

pub(crate) fn recover_contract_keys( &self, sk: SecretKey, contract: &IncomingContract, ) -> Option<(Keypair, AggregateDecryptionKey)>

Source

pub async fn subscribe_receive_operation_state_updates( &self, operation_id: OperationId, ) -> Result<UpdateStreamOrOutcome<ReceiveOperationState>, OperationLookupError>

Subscribe to all state updates of the receive operation.

Source

pub async fn await_final_receive_operation_state( &self, operation_id: OperationId, ) -> Result<FinalReceiveOperationState, OperationLookupError>

Await the final state of the receive operation.

Source

pub async fn generate_lnurl( &self, recurringd: SafeUrl, gateway: Option<SafeUrl>, ) -> Result<String, GenerateLnurlError>

Generate an lnurl for the client. You can optionally specify a gateway to use for testing purposes.

Source

pub(crate) fn spawn_receive_lnurl_task( &self, custom_meta_fn: Arc<dyn Fn() -> Value + Send + Sync>, task_group: &TaskGroup, client_span: &Span, )

Source

pub(crate) async fn receive_lnurl(&self, custom_meta: Value)

Trait Implementations§

Source§

impl ClientModule for LightningClientModule

Source§

type Init = LightningClientInit

Source§

type Common = LightningModuleTypes

Common module types shared between client and server
Source§

type Backup = NoModuleBackup

Data stored in regular backups so that restoring doesn’t have to start from epoch 0
Source§

type ModuleStateMachineContext = LightningClientContext

Data and API clients available to state machine transitions of this module
Source§

type States = LightningClientStateMachines

All possible states this client can submit to the executor
Source§

fn context(&self) -> Self::ModuleStateMachineContext

Source§

fn input_fee( &self, amounts: &Amounts, _input: &<Self::Common as ModuleCommon>::Input, ) -> Option<Amounts>

Returns the fee the processing of this input requires. Read more
Source§

fn output_fee( &self, amounts: &Amounts, _output: &<Self::Common as ModuleCommon>::Output, ) -> Option<Amounts>

Returns the fee the processing of this output requires. Read more
Source§

fn handle_cli_command<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 [OsString], ) -> Pin<Box<dyn Future<Output = Result<Value, ClientModuleError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Runs a fedimint-cli module command, given as its arguments. Read more
§

fn decoder() -> Decoder

§

fn kind() -> ModuleKind

§

fn start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Initialize client. Read more
§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, _method: String, _request: Value, ) -> Pin<Box<dyn Future<Output = Pin<Box<dyn Stream<Item = Result<Value, ClientModuleError>> + Send + 'life0>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Serves a JSON request, such as one fedimint-client-rpc forwards. Read more
§

fn supports_backup(&self) -> bool

§

fn backup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Backup, ClientModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

The module’s part of a client backup. Read more
§

fn supports_being_primary(&self) -> PrimaryModuleSupport

Does this module support being a primary module Read more
§

fn create_final_inputs_and_outputs<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _dbtx: &'life1 mut DatabaseTransaction<'life2>, _operation_id: OperationId, _unit: AmountUnit, _input_amount: Amount, _output_amount: Amount, ) -> Pin<Box<dyn Future<Output = Result<(ClientInputBundle<<Self::Common as ModuleCommon>::Input, Self::States>, ClientOutputBundle<<Self::Common as ModuleCommon>::Output, Self::States>), ClientModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Sync + 'async_trait,

Creates all inputs and outputs necessary to balance the transaction. Read more
§

fn await_primary_module_output<'life0, 'async_trait>( &'life0 self, _operation_id: OperationId, _out_point: OutPoint, ) -> Pin<Box<dyn Future<Output = Result<(), ClientModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Waits for the funds from an output created by [Self::create_final_inputs_and_outputs] to become available. This function returning typically implies a change in the output of [Self::get_balance]. Read more
§

fn get_balance<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _dbtx: &'life1 mut DatabaseTransaction<'life2>, _unit: AmountUnit, ) -> Pin<Box<dyn Future<Output = Amount> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Sync + 'async_trait,

Returns the balance held by this module and available for funding transactions.
§

fn get_balances<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _dbtx: &'life1 mut DatabaseTransaction<'life2>, ) -> Pin<Box<dyn Future<Output = Amounts> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Sync + 'async_trait,

Returns the balance held by this module and available for funding transactions.
§

fn subscribe_balance_changes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Pin<Box<dyn Stream<Item = ()> + Send>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns a stream that will output the updated module balance each time it changes.
§

fn leave<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _dbtx: &'life1 mut DatabaseTransaction<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), ClientModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Sync + 'async_trait,

Leave the federation Read more
Source§

impl Clone for LightningClientModule

Source§

fn clone(&self) -> LightningClientModule

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LightningClientModule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> CompatExt for T

§

fn compat(self) -> Compat<T>

Applies the [Compat] adapter by value. Read more
§

fn compat_ref(&self) -> Compat<&T>

Applies the [Compat] adapter by shared reference. Read more
§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the [Compat] adapter by mutable reference. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> IClientModule for T
where T: ClientModule,

§

fn as_any(&self) -> &(dyn Any + Send + Sync + 'static)

§

fn as_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

§

fn decoder(&self) -> Decoder

§

fn context(&self, instance: u16) -> DynContext

§

fn start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

§

fn handle_cli_command<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 [OsString], ) -> Pin<Box<dyn Future<Output = Result<Value, ClientModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, method: String, request: Value, ) -> Pin<Box<dyn Future<Output = Pin<Box<dyn Stream<Item = Result<Value, ClientModuleError>> + Send + 'life0>>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

§

fn input_fee(&self, amount: &Amounts, input: &DynInput) -> Option<Amounts>

§

fn output_fee(&self, amount: &Amounts, output: &DynOutput) -> Option<Amounts>

§

fn supports_backup(&self) -> bool

§

fn backup<'life0, 'async_trait>( &'life0 self, module_instance_id: u16, ) -> Pin<Box<dyn Future<Output = Result<DynModuleBackup, ClientModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

§

fn supports_being_primary(&self) -> PrimaryModuleSupport

§

fn create_final_inputs_and_outputs<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, module_instance: u16, dbtx: &'life1 mut DatabaseTransaction<'life2>, operation_id: OperationId, unit: AmountUnit, input_amount: Amount, output_amount: Amount, ) -> Pin<Box<dyn Future<Output = Result<(ClientInputBundle, ClientOutputBundle), ClientModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

§

fn await_primary_module_output<'life0, 'async_trait>( &'life0 self, operation_id: OperationId, out_point: OutPoint, ) -> Pin<Box<dyn Future<Output = Result<(), ClientModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

§

fn get_balance<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, module_instance: u16, dbtx: &'life1 mut DatabaseTransaction<'life2>, unit: AmountUnit, ) -> Pin<Box<dyn Future<Output = Amount> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

§

fn subscribe_balance_changes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Pin<Box<dyn Stream<Item = ()> + Send>>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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
§

impl<T> PossiblyOption<T> for T

§

fn to_option(self) -> Option<T>

Convert this object into an Option<T>
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,