Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntryType ¶
type EntryType int
EntryType indicates the lightning specific type of an entry.
const ( // EntryTypeLocalChannelOpen represents the funding transaction we // created to open a channel to a remote peer. EntryTypeLocalChannelOpen EntryType // EntryTypeRemoteChannelOpen represents the funding transaction that // our peer created to open a channel to us. EntryTypeRemoteChannelOpen // EntryTypeChannelOpenFee records the fees we paid on chain when // opening a channel to a remote peer. EntryTypeChannelOpenFee // EntryTypeChannelClose represents a channel closing transaction. If // we were paid out a balance by this transaction, the entry will // contain that amount. Note that the on chain resolutions required to // resolve a force close are not contained in this category. If we // force closed, our own balance will also require further on chain // resolution, so it will not be included. EntryTypeChannelClose // EntryTypeReceipt indicates that we have received a payment. Off // chain, this receipt is an invoice that we were paid via lightning. // On chain, this receipt is an on chain transaction paying into our // wallet. EntryTypeReceipt // EntryTypePayment indicates that we have made a payment. Off chain, // this payment is a lightning payment to an invoice. On chain, this // receipt is an on chain transaction paying from our wallet. EntryTypePayment // EntryTypeFee represent fees paid for on chain transactions or off // chain routing. Note that this entry type excludes fees for channel // opens and closes. EntryTypeFee // EntryTypeCircularReceipt represents an invoice that we paid to // ourselves. This occurs when circular payments are used to rebalance // channels. EntryTypeCircularReceipt // EntryTypeForward represents a forward through our node. EntryTypeForward // EntryTypeForwardFee represents the fees we earned forwarding a // payment. EntryTypeForwardFee // EntryTypeCircularPayment represents an operational payment which // we pay to ourselves to rebalance channels. EntryTypeCircularPayment // EntryTypeCircularPaymentFee represents a the fees paid on an // operational payment paid to ourselves to rebalance channels. EntryTypeCircularPaymentFee )
type HarmonyEntry ¶
type HarmonyEntry struct {
// Timestamp is the time at which the event occurred.
// On chain events: timestamp will be obtained from the block timestamp.
// Off chain events: timestamp will be obtained from lnd's records.
Timestamp time.Time
// Amount is the balance change incurred by this entry, expressed in
// msat.
Amount lnwire.MilliSatoshi
// FiatValue is the fiat value of this entry's amount. This value is
// expressed as a decimal so that we do not lose precision.
FiatValue decimal.Decimal
// TxID is the transaction ID of this entry.
TxID string
// Reference is a unique identifier for this entry, if available.
Reference string
// Note is an optional note field.
Note string
// Type describes the type of entry.
Type EntryType
// OnChain indicates whether the transaction occurred on or off chain.
OnChain bool
// Credit is true if the amount listed is a credit, and false if it is
// a debit.
Credit bool
}
HarmonyEntry represents a single action on our balance.
type OffChainConfig ¶
type OffChainConfig struct {
// ListInvoices lists all our invoices.
ListInvoices func() ([]*lnrpc.Invoice, error)
// ListPayments lists all our payments.
ListPayments func() ([]*lnrpc.Payment, error)
// ListForwards lists all our forwards over out relevant period.
ListForwards func() ([]*lnrpc.ForwardingEvent, error)
// OwnPubKey is our node's public key. We use this value to identify
// payments that are made to our own node.
OwnPubKey string
// StartTime is the time from which the report should be created,
// inclusive.
StartTime time.Time
// EndTime is the time until which the report should be created,
// exclusive.
EndTime time.Time
// Granularity is the level of granularity we require for our price
// estimates.
Granularity fiat.Granularity
}
OffChainConfig contains all the functionality required to produce an off chain report.
type OnChainConfig ¶
type OnChainConfig struct {
// OpenChannels provides a list of all currently open channels.
OpenChannels func() ([]*lnrpc.Channel, error)
// ClosedChannels provides a list of all closed channels.
ClosedChannels func() ([]*lnrpc.ChannelCloseSummary, error)
// OnChainTransactions provides a list of all on chain transactions
// relevant to our wallet over a block range.
OnChainTransactions func() ([]*lnrpc.Transaction, error)
// StartTime is the time from which the report should be created,
// inclusive.
StartTime time.Time
// EndTime is the time until which the report should be created,
// exclusive.
EndTime time.Time
// Granularity is the level of granularity we require for our price
// estimates.
Granularity fiat.Granularity
}
OnChainConfig contains all the functionality required to produce an on chain report.
type Report ¶
type Report []*HarmonyEntry
Report contains a set of entries.
func OffChainReport ¶
func OffChainReport(ctx context.Context, cfg *OffChainConfig) (Report, error)
OffChainReport gets a report of off chain activity using live price data.
func OnChainReport ¶
func OnChainReport(ctx context.Context, cfg *OnChainConfig) (Report, error)
OnChainReport produces a report of our on chain activity for a period using live price data. Note that this report relies on transactions returned by GetTransactions in lnd. If a transaction is not included in this response (eg, a remote party opening a channel to us), it will not be included.