@@ -350,3 +350,232 @@ message BestBlock {
350350 // The height at which the block was confirmed.
351351 uint32 height = 2 ;
352352}
353+
354+ // Details about the status of a known Lightning balance.
355+ message LightningBalance {
356+ oneof balance_type {
357+ ClaimableOnChannelClose claimable_on_channel_close = 1 ;
358+ ClaimableAwaitingConfirmations claimable_awaiting_confirmations = 2 ;
359+ ContentiousClaimable contentious_claimable = 3 ;
360+ MaybeTimeoutClaimableHTLC maybe_timeout_claimable_htlc = 4 ;
361+ MaybePreimageClaimableHTLC maybe_preimage_claimable_htlc = 5 ;
362+ CounterpartyRevokedOutputClaimable counterparty_revoked_output_claimable = 6 ;
363+ }
364+ }
365+
366+ // The channel is not yet closed (or the commitment or closing transaction has not yet appeared in a block).
367+ // The given balance is claimable (less on-chain fees) if the channel is force-closed now.
368+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.LightningBalance.html#variant.ClaimableOnChannelClose
369+ message ClaimableOnChannelClose {
370+ // The identifier of the channel this balance belongs to.
371+ string channel_id = 1 ;
372+
373+ // The identifier of our channel counterparty.
374+ string counterparty_node_id = 2 ;
375+
376+ // The amount available to claim, in satoshis, excluding the on-chain fees which will be required to do so.
377+ uint64 amount_satoshis = 3 ;
378+
379+ // The transaction fee we pay for the closing commitment transaction.
380+ // This amount is not included in the `amount_satoshis` value.
381+ //
382+ // Note that if this channel is inbound (and thus our counterparty pays the commitment transaction fee) this value
383+ // will be zero.
384+ uint64 transaction_fee_satoshis = 4 ;
385+
386+ // The amount of millisatoshis which has been burned to fees from HTLCs which are outbound from us and are related to
387+ // a payment which was sent by us. This is the sum of the millisatoshis part of all HTLCs which are otherwise
388+ // represented by `LightningBalance::MaybeTimeoutClaimableHTLC` with their
389+ // `LightningBalance::MaybeTimeoutClaimableHTLC::outbound_payment` flag set, as well as any dust HTLCs which would
390+ // otherwise be represented the same.
391+ //
392+ // This amount (rounded up to a whole satoshi value) will not be included in `amount_satoshis`.
393+ uint64 outbound_payment_htlc_rounded_msat = 5 ;
394+
395+ // The amount of millisatoshis which has been burned to fees from HTLCs which are outbound from us and are related to
396+ // a forwarded HTLC. This is the sum of the millisatoshis part of all HTLCs which are otherwise represented by
397+ // `LightningBalance::MaybeTimeoutClaimableHTLC` with their `LightningBalance::MaybeTimeoutClaimableHTLC::outbound_payment`
398+ // flag not set, as well as any dust HTLCs which would otherwise be represented the same.
399+ //
400+ // This amount (rounded up to a whole satoshi value) will not be included in `amount_satoshis`.
401+ uint64 outbound_forwarded_htlc_rounded_msat = 6 ;
402+
403+ // The amount of millisatoshis which has been burned to fees from HTLCs which are inbound to us and for which we know
404+ // the preimage. This is the sum of the millisatoshis part of all HTLCs which would be represented by
405+ // `LightningBalance::ContentiousClaimable` on channel close, but whose current value is included in `amount_satoshis`,
406+ // as well as any dust HTLCs which would otherwise be represented the same.
407+ //
408+ // This amount (rounded up to a whole satoshi value) will not be included in `amount_satoshis`.
409+ uint64 inbound_claiming_htlc_rounded_msat = 7 ;
410+
411+ // The amount of millisatoshis which has been burned to fees from HTLCs which are inbound to us and for which we do
412+ // not know the preimage. This is the sum of the millisatoshis part of all HTLCs which would be represented by
413+ // `LightningBalance::MaybePreimageClaimableHTLC` on channel close, as well as any dust HTLCs which would otherwise be
414+ // represented the same.
415+ //
416+ // This amount (rounded up to a whole satoshi value) will not be included in the counterparty’s `amount_satoshis`.
417+ uint64 inbound_htlc_rounded_msat = 8 ;
418+ }
419+
420+ // The channel has been closed, and the given balance is ours but awaiting confirmations until we consider it spendable.
421+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.LightningBalance.html#variant.ClaimableAwaitingConfirmations
422+ message ClaimableAwaitingConfirmations {
423+ // The identifier of the channel this balance belongs to.
424+ string channel_id = 1 ;
425+
426+ // The identifier of our channel counterparty.
427+ string counterparty_node_id = 2 ;
428+
429+ // The amount available to claim, in satoshis, possibly excluding the on-chain fees which were spent in broadcasting
430+ // the transaction.
431+ uint64 amount_satoshis = 3 ;
432+
433+ // The height at which we start tracking it as `SpendableOutput`.
434+ uint32 confirmation_height = 4 ;
435+ }
436+
437+ // The channel has been closed, and the given balance should be ours but awaiting spending transaction confirmation.
438+ // If the spending transaction does not confirm in time, it is possible our counterparty can take the funds by
439+ // broadcasting an HTLC timeout on-chain.
440+ //
441+ // Once the spending transaction confirms, before it has reached enough confirmations to be considered safe from chain
442+ // reorganizations, the balance will instead be provided via `LightningBalance::ClaimableAwaitingConfirmations`.
443+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.LightningBalance.html#variant.ContentiousClaimable
444+ message ContentiousClaimable {
445+ // The identifier of the channel this balance belongs to.
446+ string channel_id = 1 ;
447+
448+ // The identifier of our channel counterparty.
449+ string counterparty_node_id = 2 ;
450+
451+ // The amount available to claim, in satoshis, excluding the on-chain fees which were spent in broadcasting
452+ // the transaction.
453+ uint64 amount_satoshis = 3 ;
454+
455+ // The height at which the counterparty may be able to claim the balance if we have not done so.
456+ uint32 timeout_height = 4 ;
457+
458+ // The payment hash that locks this HTLC.
459+ string payment_hash = 5 ;
460+
461+ // The preimage that can be used to claim this HTLC.
462+ string payment_preimage = 6 ;
463+ }
464+
465+ // HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain fees) if the counterparty
466+ // does not know the preimage for the HTLCs. These are somewhat likely to be claimed by our counterparty before we do.
467+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.LightningBalance.html#variant.MaybeTimeoutClaimableHTLC
468+ message MaybeTimeoutClaimableHTLC {
469+ // The identifier of the channel this balance belongs to.
470+ string channel_id = 1 ;
471+
472+ // The identifier of our channel counterparty.
473+ string counterparty_node_id = 2 ;
474+
475+ // The amount available to claim, in satoshis, excluding the on-chain fees which were spent in broadcasting
476+ // the transaction.
477+ uint64 amount_satoshis = 3 ;
478+
479+ // The height at which we will be able to claim the balance if our counterparty has not done so.
480+ uint32 claimable_height = 4 ;
481+
482+ // The payment hash whose preimage our counterparty needs to claim this HTLC.
483+ string payment_hash = 5 ;
484+
485+ // Indicates whether this HTLC represents a payment which was sent outbound from us.
486+ bool outbound_payment = 6 ;
487+ }
488+
489+ // HTLCs which we received from our counterparty which are claimable with a preimage which we do not currently have.
490+ // This will only be claimable if we receive the preimage from the node to which we forwarded this HTLC before the
491+ // timeout.
492+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.LightningBalance.html#variant.MaybePreimageClaimableHTLC
493+ message MaybePreimageClaimableHTLC {
494+ // The identifier of the channel this balance belongs to.
495+ string channel_id = 1 ;
496+
497+ // The identifier of our channel counterparty.
498+ string counterparty_node_id = 2 ;
499+
500+ // The amount available to claim, in satoshis, excluding the on-chain fees which were spent in broadcasting
501+ // the transaction.
502+ uint64 amount_satoshis = 3 ;
503+
504+ // The height at which our counterparty will be able to claim the balance if we have not yet received the preimage and
505+ // claimed it ourselves.
506+ uint32 expiry_height = 4 ;
507+
508+ // The payment hash whose preimage we need to claim this HTLC.
509+ string payment_hash = 5 ;
510+ }
511+ // The channel has been closed, and our counterparty broadcasted a revoked commitment transaction.
512+ //
513+ // Thus, we’re able to claim all outputs in the commitment transaction, one of which has the following amount.
514+ //
515+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.LightningBalance.html#variant.CounterpartyRevokedOutputClaimable
516+ message CounterpartyRevokedOutputClaimable {
517+ // The identifier of the channel this balance belongs to.
518+ string channel_id = 1 ;
519+
520+ // The identifier of our channel counterparty.
521+ string counterparty_node_id = 2 ;
522+
523+ // The amount, in satoshis, of the output which we can claim.
524+ uint64 amount_satoshis = 3 ;
525+ }
526+
527+ // Details about the status of a known balance currently being swept to our on-chain wallet.
528+ message PendingSweepBalance {
529+ oneof balance_type {
530+ PendingBroadcast pending_broadcast = 1 ;
531+ BroadcastAwaitingConfirmation broadcast_awaiting_confirmation = 2 ;
532+ AwaitingThresholdConfirmations awaiting_threshold_confirmations = 3 ;
533+ }
534+ }
535+
536+ // The spendable output is about to be swept, but a spending transaction has yet to be generated and broadcast.
537+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.PendingSweepBalance.html#variant.PendingBroadcast
538+ message PendingBroadcast {
539+ // The identifier of the channel this balance belongs to.
540+ optional string channel_id = 1 ;
541+
542+ // The amount, in satoshis, of the output being swept.
543+ uint64 amount_satoshis = 2 ;
544+ }
545+
546+ // A spending transaction has been generated and broadcast and is awaiting confirmation on-chain.
547+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.PendingSweepBalance.html#variant.BroadcastAwaitingConfirmation
548+ message BroadcastAwaitingConfirmation {
549+ // The identifier of the channel this balance belongs to.
550+ optional string channel_id = 1 ;
551+
552+ // The best height when we last broadcast a transaction spending the output being swept.
553+ uint32 latest_broadcast_height = 2 ;
554+
555+ // The identifier of the transaction spending the swept output we last broadcast.
556+ string latest_spending_txid = 3 ;
557+
558+ // The amount, in satoshis, of the output being swept.
559+ uint64 amount_satoshis = 4 ;
560+ }
561+
562+ // A spending transaction has been confirmed on-chain and is awaiting threshold confirmations.
563+ //
564+ // It will be considered irrevocably confirmed after reaching `ANTI_REORG_DELAY`.
565+ // See more: https://docs.rs/ldk-node/latest/ldk_node/enum.PendingSweepBalance.html#variant.AwaitingThresholdConfirmations
566+ message AwaitingThresholdConfirmations {
567+ // The identifier of the channel this balance belongs to.
568+ optional string channel_id = 1 ;
569+
570+ // The identifier of the confirmed transaction spending the swept output.
571+ string latest_spending_txid = 2 ;
572+
573+ // The hash of the block in which the spending transaction was confirmed.
574+ string confirmation_hash = 3 ;
575+
576+ // The height at which the spending transaction was confirmed.
577+ uint32 confirmation_height = 4 ;
578+
579+ // The amount, in satoshis, of the output being swept.
580+ uint64 amount_satoshis = 5 ;
581+ }
0 commit comments