models

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelActive = iota + 1
	ChannelInactive
	ChannelOpening
	ChannelClosing
	ChannelForceClosing
	ChannelWaitingClose
	ChannelClosed
)
View Source
const (
	RoutingSend = iota + 1
	RoutingReceive
	RoutingForward
)
View Source
const (
	RoutingStatusActive = iota + 1
	RoutingStatusFailed
	RoutingStatusSettled
	RoutingStatusLinkFailed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID                  uint64
	Status              int
	RemotePubKey        string
	ChannelPoint        string
	Capacity            int64
	LocalBalance        int64
	RemoteBalance       int64
	CommitFee           int64
	CommitWeight        int64
	FeePerKiloWeight    int64
	UnsettledBalance    int64
	TotalAmountSent     int64
	TotalAmountReceived int64
	UpdatesCount        uint64
	CSVDelay            uint32
	Age                 uint32
	Private             bool
	PendingHTLC         []*HTLC
	LastUpdate          *time.Time
	Node                *Node
	LocalPolicy         *RoutingPolicy
	RemotePolicy        *RoutingPolicy
	BlocksTilMaturity   int32
}

func (Channel) MarshalLogObject

func (m Channel) MarshalLogObject(enc logging.ObjectEncoder) error

func (Channel) ShortAlias added in v0.3.0

func (m Channel) ShortAlias() (alias string, forced bool)

type ChannelEdgeUpdate added in v0.4.0

type ChannelEdgeUpdate struct {
	ChanPoints []string
}

type ChannelUpdate

type ChannelUpdate struct {
}

type ChannelsBalance

type ChannelsBalance struct {
	Balance            int64
	PendingOpenBalance int64
}

func (ChannelsBalance) MarshalLogObject

func (m ChannelsBalance) MarshalLogObject(enc logging.ObjectEncoder) error

type ForwardingEvent added in v0.4.0

type ForwardingEvent struct {
	PeerAliasIn  string
	PeerAliasOut string
	ChanIdIn     uint64
	ChanIdOut    uint64
	AmtIn        uint64
	AmtOut       uint64
	Fee          uint64
	FeeMsat      uint64
	AmtInMsat    uint64
	AmtOutMsat   uint64
	EventTime    time.Time
}

type HTLC

type HTLC struct {
	Incoming         bool
	Amount           int64
	Hashlock         []byte
	ExpirationHeight uint32
}

type Hop

type Hop struct {
	// ChanID: The unique channel ID for the channel.
	// The first 3 bytes are the block height,
	// the next 3 the index within the block,
	// and the last 2 bytes are the output index for the channel.
	ChanID       uint64
	ChanCapacity int64
	Amount       int64
	Fee          int64
	Expiry       uint32
}

type Info

type Info struct {
	PubKey              string
	Alias               string
	NumPendingChannels  uint32
	NumActiveChannels   uint32
	NumInactiveChannels uint32
	NumPeers            uint32
	BlockHeight         uint32
	BlockHash           string
	Synced              bool
	Version             string
	Chains              []string
	Testnet             bool
}

func (Info) MarshalLogObject

func (i Info) MarshalLogObject(enc logging.ObjectEncoder) error

type Invoice

type Invoice struct {
	// Index: index of this invoice.
	// Each newly created invoice will increment
	// this index making it monotonically increasing.
	Index  uint64
	Amount int64
	// AmountPaid: The amount that was accepted for this invoice, in satoshis.
	AmountPaid int64
	// AmountPaidInMSat: The amount that was accepted for this invoice, in milli satoshis.
	AmountPaidInMSat int64
	Description      string
	// RPreImage: The hex-encoded preimage (32 byte) which will allow
	// settling an incoming HTLC payable to this preimage
	RPreImage []byte
	// RHash: The hash of the preimage.
	RHash []byte
	// PaymentRequest: A bare-bones invoice for a payment within the Lightning Network.
	// With the details of the invoice, the sender has all the data
	// necessary to send a payment to the recipient.
	PaymentRequest  string
	DescriptionHash []byte
	// FallBackAddress: Fallback on-chain address.
	FallBackAddress string
	Settled         bool
	CreationDate    int64
	SettleDate      int64
	Expiry          int64
	// CLTVExpiry: Delta to use for the time-lock of the CLTV extended to the final hop.
	CLTVExpiry uint64
	// Private: Whether this invoice should include routing hints for private channels.
	Private bool
}

func (Invoice) GetRHash

func (m Invoice) GetRHash() string

func (Invoice) MarshalLogObject

func (m Invoice) MarshalLogObject(enc logging.ObjectEncoder) error

type Node

type Node struct {
	NumChannels   uint32
	TotalCapacity int64
	LastUpdate    time.Time
	PubKey        string
	Alias         string
	ForcedAlias   string
	Addresses     []*NodeAddress
	Channels      []*Channel
}

type NodeAddress

type NodeAddress struct {
	Network string
	Addr    string
}

type PayReq

type PayReq struct {
	Destination     string
	PaymentHash     string
	Amount          int64
	Timestamp       int64
	Expiry          int64
	Description     string
	DescriptionHash string
	FallbackAddr    string
	CltvExpiry      int64
	String          string
}

type Payment

type Payment struct {
	PaymentError    string
	PaymentPreimage []byte
	PayReq          *PayReq
	Route           *Route
}

func (Payment) MarshalLogObject

func (p Payment) MarshalLogObject(enc logging.ObjectEncoder) error

type Route

type Route struct {
	// TimeLock: The cumulative (final) time lock across the entire route.
	// This is the CLTV value that should be extended to the first hop in the route.
	// All other hops will decrement the time-lock as advertised,
	// leaving enough time for all hops to wait for
	// or present the payment preimage to complete the payment.
	TimeLock uint32
	// Fee: The sum of the fees paid at each hop within the final route.
	// In the case of a one-hop payment, this value will be zero as we
	// don’t need to pay a fee it ourself.
	Fee int64
	// The total amount of funds required to complete a payment over this route.
	// This value includes the cumulative fees at each hop.
	// As a result, the HTLC extended to the first-hop in the route will need
	// to have at least this many satoshis, otherwise the route will fail
	// at an intermediate node due to an insufficient amount of fees.
	Amount int64

	Hops []*Hop
}

func (Route) MarshalLogObject

func (r Route) MarshalLogObject(enc logging.ObjectEncoder) error

type RoutingEvent added in v0.2.0

type RoutingEvent struct {
	IncomingChannelId uint64
	OutgoingChannelId uint64
	IncomingHtlcId    uint64
	OutgoingHtlcId    uint64
	LastUpdate        time.Time
	Direction         int
	Status            int
	IncomingTimelock  uint32
	OutgoingTimelock  uint32
	AmountMsat        uint64
	FeeMsat           uint64
	FailureCode       int32
	FailureDetail     string
}

func (*RoutingEvent) Equals added in v0.2.0

func (u *RoutingEvent) Equals(other *RoutingEvent) bool

func (*RoutingEvent) Update added in v0.2.0

func (u *RoutingEvent) Update(newer *RoutingEvent)

type RoutingPolicy

type RoutingPolicy struct {
	TimeLockDelta    uint32
	MinHtlc          int64
	MaxHtlc          uint64
	FeeBaseMsat      int64
	FeeRateMilliMsat int64
	Disabled         bool
}

type Transaction added in v0.1.0

type Transaction struct {
	// / The transaction hash
	TxHash string
	// / The transaction amount, denominated in satoshis
	Amount int64
	// / The number of confirmations
	NumConfirmations int32
	// / The hash of the block this transaction was included in
	BlockHash string
	// / The height of the block this transaction was included in
	BlockHeight int32
	// / Timestamp of this transaction
	Date time.Time
	// / Fees paid for this transaction
	TotalFees int64
	// / Addresses that received funds for this transaction
	DestAddresses []string
}

type WalletBalance

type WalletBalance struct {
	TotalBalance       int64
	ConfirmedBalance   int64
	UnconfirmedBalance int64
}

func (WalletBalance) MarshalLogObject

func (m WalletBalance) MarshalLogObject(enc logging.ObjectEncoder) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL