uniffi_lipalightninglib/
limits.rsuse crate::lightning::receive_limits::{LiquidityLimit, ReceiveAmountLimits};
use crate::node_config::ReceiveLimitsConfig;
use crate::{Amount, ExchangeRate};
pub struct PaymentAmountLimits {
pub max_receive: Amount,
pub liquidity_limit: LiquidityLimit,
}
impl From<ReceiveAmountLimits> for PaymentAmountLimits {
fn from(value: ReceiveAmountLimits) -> Self {
Self {
max_receive: value.max_receive,
liquidity_limit: value.liquidity_limit,
}
}
}
impl PaymentAmountLimits {
pub fn calculate(
inbound_capacity_sat: u64,
lsp_min_fee_sat: u64,
exchange_rate: &Option<ExchangeRate>,
receive_limits_config: &ReceiveLimitsConfig,
) -> Self {
ReceiveAmountLimits::calculate(
inbound_capacity_sat,
lsp_min_fee_sat,
exchange_rate,
receive_limits_config,
)
.into()
}
}