lightningdevkit
Version:
Lightning Development Kit
210 lines (209 loc) • 9.41 kB
text/typescript
import { BalanceSource } from '../enums/BalanceSource.mjs';
import { CommonBase } from './CommonBase.mjs';
/**
* Details about the balance(s) available for spending once the channel appears on chain.
*
* See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
* be provided.
*/
export declare class Balance extends CommonBase {
protected constructor(_dummy: null, ptr: bigint);
clone_ptr(): bigint;
/**
* Creates a copy of the Balance
*/
clone(): Balance;
/**
* Utility method to constructs a new ClaimableOnChannelClose-variant Balance
*/
static constructor_claimable_on_channel_close(amount_satoshis: bigint, transaction_fee_satoshis: bigint, outbound_payment_htlc_rounded_msat: bigint, outbound_forwarded_htlc_rounded_msat: bigint, inbound_claiming_htlc_rounded_msat: bigint, inbound_htlc_rounded_msat: bigint): Balance;
/**
* Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
*/
static constructor_claimable_awaiting_confirmations(amount_satoshis: bigint, confirmation_height: number, source: BalanceSource): Balance;
/**
* Utility method to constructs a new ContentiousClaimable-variant Balance
*/
static constructor_contentious_claimable(amount_satoshis: bigint, timeout_height: number, payment_hash: Uint8Array, payment_preimage: Uint8Array): Balance;
/**
* Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
*/
static constructor_maybe_timeout_claimable_htlc(amount_satoshis: bigint, claimable_height: number, payment_hash: Uint8Array, outbound_payment: boolean): Balance;
/**
* Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
*/
static constructor_maybe_preimage_claimable_htlc(amount_satoshis: bigint, expiry_height: number, payment_hash: Uint8Array): Balance;
/**
* Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
*/
static constructor_counterparty_revoked_output_claimable(amount_satoshis: bigint): Balance;
/**
* Checks if two Balances contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
*/
eq(b: Balance): boolean;
/**
* The amount claimable, in satoshis.
*
* For outbound payments, this excludes the balance from the possible HTLC timeout.
*
* For forwarded payments, this includes the balance from the possible HTLC timeout as
* (to be conservative) that balance does not include routing fees we'd earn if we'd claim
* the balance from a preimage in a successful forward.
*
* For more information on these balances see [`Balance::MaybeTimeoutClaimableHTLC`] and
* [`Balance::MaybePreimageClaimableHTLC`].
*
* On-chain fees required to claim the balance are not included in this amount.
*/
claimable_amount_satoshis(): bigint;
}
/** A Balance of type ClaimableOnChannelClose */
export declare class Balance_ClaimableOnChannelClose extends Balance {
/**
* The amount available to claim, in satoshis, excluding the on-chain fees which will be
* required to do so.
*/
amount_satoshis: bigint;
/**
* The transaction fee we pay for the closing commitment transaction. This amount is not
* included in the [`Balance::ClaimableOnChannelClose::amount_satoshis`] value.
*
* Note that if this channel is inbound (and thus our counterparty pays the commitment
* transaction fee) this value will be zero. For [`ChannelMonitor`]s created prior to LDK
* 0.0.124, the channel is always treated as outbound (and thus this value is never zero).
*/
transaction_fee_satoshis: bigint;
/**
* The amount of millisatoshis which has been burned to fees from HTLCs which are outbound
* from us and are related to a payment which was sent by us. This is the sum of the
* millisatoshis part of all HTLCs which are otherwise represented by
* [`Balance::MaybeTimeoutClaimableHTLC`] with their
* [`Balance::MaybeTimeoutClaimableHTLC::outbound_payment`] flag set, as well as any dust
* HTLCs which would otherwise be represented the same.
*
* This amount (rounded up to a whole satoshi value) will not be included in `amount_satoshis`.
*/
outbound_payment_htlc_rounded_msat: bigint;
/**
* The amount of millisatoshis which has been burned to fees from HTLCs which are outbound
* from us and are related to a forwarded HTLC. This is the sum of the millisatoshis part
* of all HTLCs which are otherwise represented by [`Balance::MaybeTimeoutClaimableHTLC`]
* with their [`Balance::MaybeTimeoutClaimableHTLC::outbound_payment`] flag *not* set, as
* well as any dust HTLCs which would otherwise be represented the same.
*
* This amount (rounded up to a whole satoshi value) will not be included in `amount_satoshis`.
*/
outbound_forwarded_htlc_rounded_msat: bigint;
/**
* The amount of millisatoshis which has been burned to fees from HTLCs which are inbound
* to us and for which we know the preimage. This is the sum of the millisatoshis part of
* all HTLCs which would be represented by [`Balance::ContentiousClaimable`] on channel
* close, but whose current value is included in
* [`Balance::ClaimableOnChannelClose::amount_satoshis`], as well as any dust HTLCs which
* would otherwise be represented the same.
*
* This amount (rounded up to a whole satoshi value) will not be included in the counterparty's
* `amount_satoshis`.
*/
inbound_claiming_htlc_rounded_msat: bigint;
/**
* The amount of millisatoshis which has been burned to fees from HTLCs which are inbound
* to us and for which we do not know the preimage. This is the sum of the millisatoshis
* part of all HTLCs which would be represented by [`Balance::MaybePreimageClaimableHTLC`]
* on channel close, as well as any dust HTLCs which would otherwise be represented the
* same.
*
* This amount (rounded up to a whole satoshi value) will not be included in the counterparty's
* `amount_satoshis`.
*/
inbound_htlc_rounded_msat: bigint;
}
/** A Balance of type ClaimableAwaitingConfirmations */
export declare class Balance_ClaimableAwaitingConfirmations extends Balance {
/**
* The amount available to claim, in satoshis, possibly excluding the on-chain fees which
* were spent in broadcasting the transaction.
*/
amount_satoshis: bigint;
/**
* The height at which an [`Event::SpendableOutputs`] event will be generated for this
* amount.
*/
confirmation_height: number;
/**
* Whether this balance is a result of cooperative close, a force-close, or an HTLC.
*/
source: BalanceSource;
}
/** A Balance of type ContentiousClaimable */
export declare class Balance_ContentiousClaimable extends Balance {
/**
* The amount available to claim, in satoshis, excluding the on-chain fees which will be
* required to do so.
*/
amount_satoshis: bigint;
/**
* The height at which the counterparty may be able to claim the balance if we have not
* done so.
*/
timeout_height: number;
/**
* The payment hash that locks this HTLC.
*/
payment_hash: Uint8Array;
/**
* The preimage that can be used to claim this HTLC.
*/
payment_preimage: Uint8Array;
}
/** A Balance of type MaybeTimeoutClaimableHTLC */
export declare class Balance_MaybeTimeoutClaimableHTLC extends Balance {
/**
* The amount potentially available to claim, in satoshis, excluding the on-chain fees
* which will be required to do so.
*/
amount_satoshis: bigint;
/**
* The height at which we will be able to claim the balance if our counterparty has not
* done so.
*/
claimable_height: number;
/**
* The payment hash whose preimage our counterparty needs to claim this HTLC.
*/
payment_hash: Uint8Array;
/**
* Whether this HTLC represents a payment which was sent outbound from us. Otherwise it
* represents an HTLC which was forwarded (and should, thus, have a corresponding inbound
* edge on another channel).
*/
outbound_payment: boolean;
}
/** A Balance of type MaybePreimageClaimableHTLC */
export declare class Balance_MaybePreimageClaimableHTLC extends Balance {
/**
* The amount potentially available to claim, in satoshis, excluding the on-chain fees
* which will be required to do so.
*/
amount_satoshis: bigint;
/**
* The height at which our counterparty will be able to claim the balance if we have not
* yet received the preimage and claimed it ourselves.
*/
expiry_height: number;
/**
* The payment hash whose preimage we need to claim this HTLC.
*/
payment_hash: Uint8Array;
}
/** A Balance of type CounterpartyRevokedOutputClaimable */
export declare class Balance_CounterpartyRevokedOutputClaimable extends Balance {
/**
* The amount, in satoshis, of the output which we can claim.
*
* Note that for outputs from HTLC balances this may be excluding some on-chain fees that
* were already spent.
*/
amount_satoshis: bigint;
}