lightning

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 39 Imported by: 2

README

LightningAPI

LightningAPI is a thin wrapper around lightning APIs that are used for the agents (currently it just supports the minimal that is needed for channelchecker) We have LND gRPC, LND REST and CLN (over local UNIX domain socket) support for the time being.

Documentation

Index

Constants

View Source
const (
	ListChannels       = "listchannels"
	ListNodes          = "listnodes"
	ListFunds          = "listfunds"
	GetInfo            = "getinfo"
	ListForwards       = "listforwards"
	ListInvoices       = "listinvoices"
	ListSendPays       = "listsendpays"
	ListPays           = "listpays"
	Connect            = "connect"
	NewAddr            = "newaddr"
	Withdraw           = "withdraw"
	Pay                = "pay"
	InvoiceCmd         = "invoice"
	ListClosedChannels = "listclosedchannels"
	GetRoute           = "getroute"

	DefaultDuration = 1 * time.Hour
)

Method names.

View Source
const (
	LnRegTestPathPrefix = "/tmp/lnregtest-data/dev_network/"
)
View Source
const (
	MaxPathLen = 20
)

Variables

View Source
var (
	ErrRouteNotFound  = errors.New("route not found")
	ErrPubKeysInvalid = errors.New("pubkeys invalid")
)
View Source
var (
	// ErrNoNode means node was not found.
	ErrNoNode = errors.New("node not found")
	// ErrNoChan means channel was not found.
	ErrNoChan = errors.New("channel not found")
	// ErrInvalidResponse indicates invaid response.
	ErrInvalidResponse = errors.New("invalid response")
)
View Source
var UnknownCloseInfo = CloseInfo{ChanID: 0, Opener: Unknown, Closer: Unknown, CloseType: UnknownType}

Functions

func ConvertAmount

func ConvertAmount(s string) uint64

ConvertAmount - converts string amount to satoshis.

func ConvertFeatures

func ConvertFeatures(features string) map[string]NodeFeatureAPI

ConvertFeatures - convert bitmask to LND like feature map.

func FromLndChanID

func FromLndChanID(chanID uint64) string

FromLndChanID - converts from LND to CLN channel id.

func GetClient

func GetClient(getData GetDataCall) (lnrpc.LightningClient, routerrpc.RouterClient, func(), error)

GetClient - get a lightning API client.

func GetConnection

func GetConnection(getData GetDataCall) (*grpc.ClientConn, error)

GetConnection - returns a GRPC client connection.

func GetHashFromInvoice added in v0.2.1

func GetHashFromInvoice(bolt11 string) string

func GetMsatsFromInvoice added in v0.2.0

func GetMsatsFromInvoice(bolt11 string) uint64

GetMsatsFromInvoice - tries to get msat amount from an invoice, upon error it returns 0

func InitNameCache added in v0.2.2

func InitNameCache(ctx context.Context, l LightingAPICalls) (map[string]string, error)

InitNameCache - get the mapping between pubkey and name

func IsMacaroonValid

func IsMacaroonValid(mac *macaroon.Macaroon) (bool, time.Duration)

IsMacaroonValid - verify whether macaroon is valid.

func IsValidPubKey added in v0.2.2

func IsValidPubKey(pubKey string) bool

IsValidPubKey - returns true if pubkey is valid, false otherwise

func RegtestMine added in v0.1.1

func RegtestMine(numBlocks int) error

func SumCapacityExtended

func SumCapacityExtended(channels []NodeChannelAPIExtended) uint64

SumCapacityExtended - get sum of channel capacity.

func SumCapacitySimple

func SumCapacitySimple(channels []NodeChannelAPI) uint64

SumCapacitySimple - get sum of channel capacity.

func ToLndChanID

func ToLndChanID(id string) (uint64, error)

ToLndChanID - converts from CLN to LND channel id.

Types

type API added in v0.0.42

type API struct {
	Name                                  string
	GetNodeInfoFullThreshUseDescribeGraph int // If node has more than that number of channels use DescribeGraph else do GetChanInfo for each one
}

API - generic API settings.

func (*API) GetDefaultBatchSize added in v0.0.42

func (a *API) GetDefaultBatchSize() uint16

GetDefaultBatchSize returns the default batch size.

type APIType

type APIType int

APIType enum.

const (
	LndGrpc APIType = iota
	LndRest
	ClnSocket
	ClnCommando
)

ApiTypes.

func GetAPIType

func GetAPIType(t *int) (*APIType, error)

GetAPIType from integer.

type AddInvoiceResponseOverride added in v0.0.49

type AddInvoiceResponseOverride struct {
	RHash       string `json:"r_hash,omitempty"`
	AddIndex    string `json:"add_index,omitempty"`
	PaymentAddr string `json:"payment_addr,omitempty"`

	lnrpc.AddInvoiceResponse
}

AddInvoiceResponseOverride struct.

type CertificateVerification

type CertificateVerification int

CertificateVerification enum.

const (
	PublicCAorCert CertificateVerification = iota
	PublicCA
	AllowWhenPubKeySame
	Strict
	Insecure
	SkipHostVerification
)

Verification types.

type ChannelAPI

type ChannelAPI struct {
	Private               bool
	Active                bool
	RemotePubkey          string
	Initiator             bool
	CommitFee             uint64
	ChanID                uint64
	RemoteBalance         uint64
	LocalBalance          uint64
	Capacity              uint64
	PendingHtlcs          []HtlcAPI
	TotalSatoshisSent     uint64
	TotalSatoshisReceived uint64
	NumUpdates            uint64
}

ChannelAPI struct.

type ChannelCloseSummaryOverride added in v0.1.1

type ChannelCloseSummaryOverride struct {
	ChanId                string          `json:"chan_id,omitempty"`
	Capacity              string          `json:"capacity,omitempty"`
	SettledBalance        string          `json:"settled_balance,omitempty"`
	TimeLockedBalance     string          `json:"time_locked_balance,omitempty"`
	CloseType             string          `json:"close_type,omitempty"`
	OpenInitiator         string          `json:"open_initiator,omitempty"`
	CloseInitiator        string          `json:"close_initiator,omitempty"`
	Resolutions           json.RawMessage `json:"resolutions,omitempty"`
	AliasScids            json.RawMessage `json:"alias_scids,omitempty"`
	ZeroConfConfirmedScid json.RawMessage `json:"zero_conf_confirmed_scid,omitempty"`

	lnrpc.ChannelCloseSummary
}

ChannelCloseSummaryOverride struct

type ChannelConstraintsOverride

type ChannelConstraintsOverride struct {
	ChanReserveSat    string `json:"chan_reserve_sat,omitempty"`
	DustLimitSat      string `json:"dust_limit_sat,omitempty"`
	MaxPendingAmtMsat string `json:"max_pending_amt_msat,omitempty"`
	MinHtlcMsat       string `json:"min_htlc_msat,omitempty"`

	lnrpc.ChannelConstraints
}

ChannelConstraintsOverride struct.

type ChannelOverride

type ChannelOverride struct {
	ChanID                string `json:"chan_id,omitempty"`
	Capacity              string `json:"capacity,omitempty"`
	LocalBalance          string `json:"local_balance,omitempty"`
	RemoteBalance         string `json:"remote_balance,omitempty"`
	CommitFee             string `json:"commit_fee,omitempty"`
	CommitWeight          string `json:"commit_weight,omitempty"`
	FeePerKw              string `json:"fee_per_kw,omitempty"`
	UnsettledBalance      string `json:"unsettled_balance,omitempty"`
	TotalSatoshisSent     string `json:"total_satoshis_sent,omitempty"`
	TotalSatoshisReceived string `json:"total_satoshis_received,omitempty"`
	NumUpdates            string `json:"num_updates,omitempty"`
	// Deprecated
	LocalChanReserveSat string `json:"local_chan_reserve_sat,omitempty"`
	// Deprecated
	RemoteChanReserveSat string                      `json:"remote_chan_reserve_sat,omitempty"`
	CommitmentType       string                      `json:"commitment_type,omitempty"`
	PendingHtlcs         []*HtlcOverride             `json:"pending_htlcs,omitempty"`
	Lifetime             string                      `json:"lifetime,omitempty"`
	Uptime               string                      `json:"uptime,omitempty"`
	PushAmountSat        string                      `json:"push_amount_sat,omitempty"`
	LocalConstraints     *ChannelConstraintsOverride `json:"local_constraints,omitempty"`
	RemoteConstraints    *ChannelConstraintsOverride `json:"remote_constraints,omitempty"`

	AliasScids            []string `json:"alias_scids,omitempty"`
	ZeroConfConfirmedScid string   `json:"zero_conf_confirmed_scid,omitempty"`
	PeerScidAlias         string   `json:"peer_scid_alias,omitempty"`

	lnrpc.Channel
}

ChannelOverride struct.

type Channels

type Channels struct {
	Channels []*ChannelOverride `json:"channels"`
}

Channels struct.

type ChannelsAPI

type ChannelsAPI struct {
	Channels []ChannelAPI
}

ChannelsAPI struct.

type ClnClosedChannelEntires added in v0.1.1

type ClnClosedChannelEntires struct {
	Entries []ClnClosedChannelEntry `json:"closedchannels,omitempty"`
	ClnResp
}

ClnClosedChannelEntires struct.

type ClnClosedChannelEntry added in v0.1.1

type ClnClosedChannelEntry struct {
	ShortChannelID string `json:"short_channel_id,omitempty"`
	Closer         string `json:"closer,omitempty"`      // local, remote
	Opener         string `json:"opener,omitempty"`      // local, remote
	CloseCause     string `json:"close_cause,omitempty"` // close_cause (string): What caused the channel to close (one of "unknown", "local", "user", "remote", "protocol", "onchain")
}

ClnClosedChannelEntry struct.

type ClnCommandoConnection added in v0.0.44

type ClnCommandoConnection struct {
	ClnConnection
	// contains filtered or unexported fields
}

ClnCommandoConnection struct.

func NewCommandoConnection added in v0.0.44

func NewCommandoConnection(addr string, rune string, timeout time.Duration) *ClnCommandoConnection

NewCommandoConnection creates a new CLN connection.

func (*ClnCommandoConnection) Call added in v0.0.44

func (l *ClnCommandoConnection) Call(ctx context.Context, serviceMethod string, args any, reply any, timeout time.Duration) error

Call calls serviceMethod with args and fills reply with response.

func (*ClnCommandoConnection) Cleanup added in v0.0.46

func (l *ClnCommandoConnection) Cleanup()

Cleanup does the cleanup.

func (*ClnCommandoConnection) StreamResponse added in v0.0.44

func (l *ClnCommandoConnection) StreamResponse(ctx context.Context, serviceMethod string, args any) (io.Reader, error)

StreamResponse is meant for streaming responses it calls serviceMethod with args and returns an io.Reader.

type ClnCommandoLightningAPI added in v0.0.44

type ClnCommandoLightningAPI struct {
	ClnRawLightningAPI
}

ClnCommandoLightningAPI struct.

type ClnConnectResp added in v0.0.49

type ClnConnectResp struct {
	ID string `json:"id"`
	ClnResp
}

ClnConnectResp struct.

type ClnConnection added in v0.0.44

type ClnConnection struct{}

ClnConnection struct.

type ClnConnectionAPI added in v0.0.44

type ClnConnectionAPI interface {
	// Call calls serviceMethod with args and fills reply with response
	Call(ctx context.Context, serviceMethod string, args any, reply any, timeout time.Duration) error
	// StreamResponse is meant for streaming responses it calls serviceMethod with args and returns an io.Reader
	StreamResponse(ctx context.Context, serviceMethod string, args any) (io.Reader, error)
	// Cleanup does the cleanup
	Cleanup()
}

ClnConnectionAPI interface.

type ClnErrorResp added in v0.0.44

type ClnErrorResp struct {
	ClnResp

	Error struct {
		Code    int    `json:"code,omitempty"`
		Message string `json:"message,omitempty"`
	} `json:"error"`
}

ClnErrorResp struct.

type ClnFeatures

type ClnFeatures struct {
	Init    string `json:"init"`
	Node    string `json:"node"`
	Channel string `json:"channe"`
	Invoice string `json:"invoice"`
}

ClnFeatures struct.

type ClnForwardEntries added in v0.0.42

type ClnForwardEntries struct {
	Entries []ClnForwardEntry `json:"forwards,omitempty"`
}

ClnForwardEntries struct.

type ClnForwardEntry added in v0.0.42

type ClnForwardEntry struct {
	InChannel    string            `json:"in_channel"`
	InMsat       string            `json:"in_msat"`
	Status       string            `json:"status"` // one of "offered", "settled", "local_failed", "failed"
	ReceivedTime entities.JsonTime `json:"received_time"`

	OutChannel string `json:"out_channel,omitempty"`
	OutMsat    string `json:"out_msat,omitempty"`
	FeeMsat    string `json:"fee_msat,omitempty"`
	FailCode   uint32 `json:"fail_code,omitempty"`
	FailReason string `json:"fail_reason,omitempty"`
}

ClnForwardEntry struct.

type ClnFundsChainResp added in v0.0.49

type ClnFundsChainResp struct {
	Outputs []ClnFundsOutput `json:"outputs,omitempty"`
	ClnResp
}

ClnFundsChainResp struct.

type ClnFundsChan

type ClnFundsChan struct {
	PeerID         string `json:"peer_id"`
	Connected      bool   `json:"connected,omitempty"`
	ShortChannelID string `json:"short_channel_id"`
	State          string `json:"state"`
	Capacity       uint64 `json:"channel_total_sat"`
	OurAmount      uint64 `json:"channel_sat"`
	FundingTxID    string `json:"funding_txid"`
	FundingOutput  int    `json:"funding_output"`
}

ClnFundsChan struct.

type ClnFundsChanResp

type ClnFundsChanResp struct {
	Channels []ClnFundsChan `json:"channels,omitempty"`
	ClnResp
}

ClnFundsChanResp struct.

type ClnFundsOutput added in v0.0.49

type ClnFundsOutput struct {
	AmountMsat string `json:"amount_msat,omitempty"`
	Status     string `json:"status,omitempty"`
	Reserved   bool   `json:"reserved,omitempty"`
}

ClnFundsOutput struct.

type ClnInfo

type ClnInfo struct {
	PubKey                string            `json:"id"`
	Alias                 string            `json:"alias"`
	Color                 string            `json:"color"`
	Network               string            `json:"network"`
	Addresses             []ClnListNodeAddr `json:"address,omitempty"`
	Features              ClnFeatures       `json:"our_features"`
	Version               string            `json:"version"`
	Blockheight           uint32            `json:"blockheight"`
	WarningBitcoindSync   string            `json:"warning_bitcoind_sync,omitempty"`
	WarningLightningdSync string            `json:"warning_lightningd_sync,omitempty"`
}

ClnInfo struct.

type ClnInvoiceEntries added in v0.0.49

type ClnInvoiceEntries struct {
	Entries []ClnInvoiceEntry `json:"invoices,omitempty"`
}

ClnInvoiceEntries struct.

type ClnInvoiceEntry added in v0.0.49

type ClnInvoiceEntry struct {
	Status      string `json:"status"` //  (one of "unpaid", "paid", "expired")
	PaymentHash string `json:"payment_hash,omitempty"`
}

ClnInvoiceEntry struct.

type ClnInvoiceResp added in v0.0.49

type ClnInvoiceResp struct {
	Bolt11      string `json:"bolt11,omitempty"`
	PaymentHash string `json:"payment_hash,omitempty"`
	// omitted stuff
	ClnResp
}

ClnInvoiceResp struct.

type ClnListChan

type ClnListChan struct {
	Source         string            `json:"source"`
	Destination    string            `json:"destination"`
	Public         bool              `json:"public"`
	Capacity       uint64            `json:"satoshis"`
	Active         bool              `json:"active"`
	LastUpdate     entities.JsonTime `json:"last_update"`
	FeeBase        uint64            `json:"base_fee_millisatoshi"`
	FeePpm         uint64            `json:"fee_per_millionth"`
	MinHtlc        string            `json:"htlc_minimum_msat"`
	MaxHtlc        string            `json:"htlc_maximum_msat"`
	ShortChannelID string            `json:"short_channel_id,omitempty"`
	Delay          uint64            `json:"delay"`
}

ClnListChan struct.

type ClnListChanResp

type ClnListChanResp struct {
	Channels []ClnListChan `json:"channels,omitempty"`
	ClnResp
}

ClnListChanResp struct.

type ClnListNode

type ClnListNode struct {
	PubKey     string             `json:"nodeid"`
	Alias      string             `json:"alias,omitempty"`
	Color      string             `json:"color,omitempty"`
	Features   string             `json:"features,omitempty"`
	Addresses  []ClnListNodeAddr  `json:"addresses,omitempty"`
	LastUpdate *entities.JsonTime `json:"last_update,omitempty"`
}

ClnListNode struct.

type ClnListNodeAddr

type ClnListNodeAddr struct {
	Type    string `json:"type"`
	Address string `json:"address"`
	Port    int    `json:"port"`
}

ClnListNodeAddr struct.

type ClnListNodeResp

type ClnListNodeResp struct {
	Nodes []ClnListNode `json:"nodes,omitempty"`
	ClnResp
}

ClnListNodeResp struct.

type ClnNewAddrResp added in v0.0.49

type ClnNewAddrResp struct {
	Bech32 string `json:"bech32,omitempty"`
	ClnResp
}

ClnNewAddrResp struct.

type ClnPayResp added in v0.0.49

type ClnPayResp struct {
	PaymentPreimage string `json:"payment_preimage,omitempty"`
	PaymentHash     string `json:"payment_hash,omitempty"`
	AmountMsat      string `json:"amount_msat,omitempty"`
	AmountSentMsat  string `json:"amount_sent_msat,omitempty"`
	Status          string `json:"status,omitempty"`
	Destination     string `json:"destination,omitempty"`

	ClnResp
}

ClnPayResp struct.

type ClnPaymentEntries added in v0.0.49

type ClnPaymentEntries struct {
	Entries []ClnPaymentEntry `json:"payments,omitempty"`
}

ClnPaymentEntries struct.

type ClnPaymentEntry added in v0.0.49

type ClnPaymentEntry struct {
	PaymentHash     string `json:"payment_hash,omitempty"`
	Status          string `json:"status"` // (one of "pending", "failed", "complete")
	PaymentPreimage string `json:"payment_preimage,omitempty"`
}

ClnPaymentEntry struct.

type ClnRawForwardEntries added in v0.0.42

type ClnRawForwardEntries struct {
	Entries []json.RawMessage `json:"forwards,omitempty"`
}

ClnRawForwardEntries struct.

func (ClnRawForwardEntries) GetEntries added in v0.0.42

func (r ClnRawForwardEntries) GetEntries() []json.RawMessage

GetEntries to comply with ClnRawMessageItf.

type ClnRawForwardsTime added in v0.0.42

type ClnRawForwardsTime struct {
	Time float64 `json:"received_time,omitempty"`
}

ClnRawForwardsTime struct.

func (ClnRawForwardsTime) GetUnixTimeMs added in v0.0.43

func (r ClnRawForwardsTime) GetUnixTimeMs() uint64

GetUnixTimeMs to comply with ClnRawTimeItf.

type ClnRawInvoiceTime added in v0.0.42

type ClnRawInvoiceTime struct {
	Time uint64 `json:"expires_at,omitempty"`
}

ClnRawInvoiceTime struct.

func (ClnRawInvoiceTime) GetUnixTimeMs added in v0.0.43

func (r ClnRawInvoiceTime) GetUnixTimeMs() uint64

GetUnixTimeMs to comply with ClnRawTimeItf.

type ClnRawInvoices added in v0.0.42

type ClnRawInvoices struct {
	Entries []json.RawMessage `json:"invoices,omitempty"`
}

ClnRawInvoices struct.

func (ClnRawInvoices) GetEntries added in v0.0.42

func (r ClnRawInvoices) GetEntries() []json.RawMessage

GetEntries to comply with ClnRawMessageItf.

type ClnRawLightningAPI added in v0.0.44

type ClnRawLightningAPI struct {
	API
	// contains filtered or unexported fields
}

ClnRawLightningAPI struct.

func (*ClnRawLightningAPI) Cleanup added in v0.0.44

func (l *ClnRawLightningAPI) Cleanup()

Cleanup - clean up API.

func (*ClnRawLightningAPI) ConnectPeer added in v0.0.49

func (l *ClnRawLightningAPI) ConnectPeer(ctx context.Context, id string) error

ConnectPeer - API call.

func (*ClnRawLightningAPI) CreateInvoice added in v0.0.49

func (l *ClnRawLightningAPI) CreateInvoice(ctx context.Context, sats int64, preimage string, memo string, expiry time.Duration) (*InvoiceResp, error)

CreateInvoice - API call.

func (*ClnRawLightningAPI) DescribeGraph added in v0.0.44

func (l *ClnRawLightningAPI) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphAPI, error)

DescribeGraph - DescribeGraph API call.

func (*ClnRawLightningAPI) GetAPIType added in v0.0.44

func (l *ClnRawLightningAPI) GetAPIType() APIType

GetAPIType - API call.

func (*ClnRawLightningAPI) GetChanInfo added in v0.0.44

func (l *ClnRawLightningAPI) GetChanInfo(ctx context.Context, chanID uint64) (*NodeChannelAPI, error)

GetChanInfo - GetChanInfo API call.

func (*ClnRawLightningAPI) GetChannelCloseInfo added in v0.1.1

func (l *ClnRawLightningAPI) GetChannelCloseInfo(ctx context.Context, chanIDs []uint64) ([]CloseInfo, error)

GetChannelCloseInfo - API call.

func (*ClnRawLightningAPI) GetChannelCloseInfoLegacy added in v0.1.1

func (l *ClnRawLightningAPI) GetChannelCloseInfoLegacy(ctx context.Context, chanIDs []uint64) ([]CloseInfo, error)

GetChannelCloseInfoLegacy - API call.

func (*ClnRawLightningAPI) GetChannels added in v0.0.44

func (l *ClnRawLightningAPI) GetChannels(ctx context.Context) (*ChannelsAPI, error)

GetChannels - GetChannels API call.

func (*ClnRawLightningAPI) GetForwardsRaw added in v0.0.44

func (l *ClnRawLightningAPI) GetForwardsRaw(ctx context.Context, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetForwardsRaw - API call.

func (*ClnRawLightningAPI) GetInfo added in v0.0.44

func (l *ClnRawLightningAPI) GetInfo(ctx context.Context) (*InfoAPI, error)

GetInfo - GetInfo API call.

func (*ClnRawLightningAPI) GetInternalChannels added in v0.0.44

func (l *ClnRawLightningAPI) GetInternalChannels(ctx context.Context, pubKey string) (map[string][]ClnListChan, error)

GetInternalChannels - internal method to get channels.

func (*ClnRawLightningAPI) GetInternalChannelsAll added in v0.0.44

func (l *ClnRawLightningAPI) GetInternalChannelsAll(ctx context.Context) (map[string][]ClnListChan, error)

GetInternalChannelsAll - internal method to get all channels.

func (*ClnRawLightningAPI) GetInvoices added in v0.0.44

func (l *ClnRawLightningAPI) GetInvoices(ctx context.Context, pendingOnly bool, pagination Pagination) (*InvoicesResponse, error)

GetInvoices - API call.

func (*ClnRawLightningAPI) GetInvoicesRaw added in v0.0.44

func (l *ClnRawLightningAPI) GetInvoicesRaw(ctx context.Context, pendingOnly bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetInvoicesRaw - API call.

func (*ClnRawLightningAPI) GetNodeInfo added in v0.0.44

func (l *ClnRawLightningAPI) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoAPI, error)

GetNodeInfo - API call.

func (*ClnRawLightningAPI) GetNodeInfoFull added in v0.0.44

func (l *ClnRawLightningAPI) GetNodeInfoFull(ctx context.Context, channels bool, unannounced bool) (*NodeInfoAPIExtended, error)

GetNodeInfoFull - API call.

func (*ClnRawLightningAPI) GetOnChainAddress added in v0.0.49

func (l *ClnRawLightningAPI) GetOnChainAddress(ctx context.Context) (string, error)

GetOnChainAddress - API call.

func (*ClnRawLightningAPI) GetOnChainFunds added in v0.0.49

func (l *ClnRawLightningAPI) GetOnChainFunds(ctx context.Context) (*Funds, error)

GetOnChainFunds - API call.

func (*ClnRawLightningAPI) GetPaymentStatus added in v0.0.49

func (l *ClnRawLightningAPI) GetPaymentStatus(ctx context.Context, paymentRequest string) (*PaymentResp, error)

GetPaymentStatus - API call.

func (*ClnRawLightningAPI) GetPayments added in v0.0.44

func (l *ClnRawLightningAPI) GetPayments(ctx context.Context, includeIncomplete bool, pagination Pagination) (*PaymentsResponse, error)

GetPayments - API call.

func (*ClnRawLightningAPI) GetPaymentsRaw added in v0.0.44

func (l *ClnRawLightningAPI) GetPaymentsRaw(ctx context.Context, includeIncomplete bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetPaymentsRaw - API call.

func (*ClnRawLightningAPI) GetRoute added in v0.2.2

func (l *ClnRawLightningAPI) GetRoute(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (DeterminedRoute, error)

GetRoute - API call.

func (*ClnRawLightningAPI) GetRoutes added in v0.2.2

func (l *ClnRawLightningAPI) GetRoutes(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (<-chan DeterminedRoute, error)

func (*ClnRawLightningAPI) IsInvoicePaid added in v0.0.49

func (l *ClnRawLightningAPI) IsInvoicePaid(ctx context.Context, paymentHash string) (bool, error)

IsInvoicePaid - API call.

func (*ClnRawLightningAPI) PayInvoice added in v0.0.49

func (l *ClnRawLightningAPI) PayInvoice(ctx context.Context, paymentRequest string, sats int64, outgoingChanIds []uint64) (*PaymentResp, error)

PayInvoice - API call.

func (*ClnRawLightningAPI) SendToOnChainAddress added in v0.0.49

func (l *ClnRawLightningAPI) SendToOnChainAddress(ctx context.Context, address string, sats int64, useUnconfirmed bool, urgency Urgency) (string, error)

SendToOnChainAddress - API call.

func (*ClnRawLightningAPI) SubscribeForwards added in v0.0.44

func (l *ClnRawLightningAPI) SubscribeForwards(ctx context.Context, since time.Time, batchSize uint16, maxErrors uint16) (<-chan []ForwardingEvent, <-chan ErrorData)

SubscribeForwards - API call.

type ClnRawMessageItf added in v0.0.42

type ClnRawMessageItf interface {
	GetEntries() []json.RawMessage
}

ClnRawMessageItf interface.

type ClnRawPayTime added in v0.0.42

type ClnRawPayTime struct {
	Time uint64 `json:"created_at,omitempty"`
}

ClnRawPayTime struct.

func (ClnRawPayTime) GetUnixTimeMs added in v0.0.43

func (r ClnRawPayTime) GetUnixTimeMs() uint64

GetUnixTimeMs to comply with ClnRawTimeItf.

type ClnRawPayments added in v0.0.42

type ClnRawPayments struct {
	Entries []json.RawMessage `json:"payments,omitempty"`
}

ClnRawPayments struct.

func (ClnRawPayments) GetEntries added in v0.0.42

func (r ClnRawPayments) GetEntries() []json.RawMessage

GetEntries to comply with ClnRawMessageItf.

type ClnRawTimeItf added in v0.0.42

type ClnRawTimeItf interface {
	GetUnixTimeMs() uint64
}

ClnRawTimeItf interface.

type ClnResp added in v0.0.44

type ClnResp struct{}

ClnResp struct is the base type for all responses.

type ClnRoute added in v0.2.2

type ClnRoute struct {
	PubKey    string `json:"id"`
	Channel   string `json:"channel"`
	Direction int    `json:"direction"`
}

ClnRoute struct.

type ClnRouteResp added in v0.2.2

type ClnRouteResp struct {
	Route []ClnRoute `json:"route,omitempty"`
	ClnResp
}

ClnRouteResp struct.

type ClnSetChan

type ClnSetChan struct {
	PeerID         string `json:"peer_id"`
	LongChanID     string `json:"channel_id"`
	FeeBase        string `json:"fee_base_msat"`
	FeePpm         string `json:"fee_proportional_milli"`
	MiHtlc         string `json:"minimum_htlc_out_msat"`
	MaxHtlc        string `json:"maximum_htlc_out_msat"`
	ShortChannelID string `json:"short_channel_id,omitempty"`
}

ClnSetChan struct.

type ClnSetChanResp

type ClnSetChanResp struct {
	Settings []ClnSetChan `json:"channels,omitempty"`
	ClnResp
}

ClnSetChanResp struct.

type ClnSocketLightningAPI

type ClnSocketLightningAPI struct {
	ClnRawLightningAPI
}

ClnSocketLightningAPI struct.

type ClnSuccessResp added in v0.0.44

type ClnSuccessResp struct {
	ClnResp

	Result json.RawMessage `json:"result,omitempty"`
}

ClnSuccessResp struct.

type ClnUnixConnection added in v0.0.44

type ClnUnixConnection struct {
	Client *rpc.Client

	ClnConnection
}

ClnUnixConnection represents a UNIX domain socket.

func NewUnixConnection added in v0.0.44

func NewUnixConnection(socketType string, address string) *ClnUnixConnection

NewUnixConnection create a new CLN connection.

func (*ClnUnixConnection) Call added in v0.0.44

func (l *ClnUnixConnection) Call(ctx context.Context, serviceMethod string, args any, reply any, timeout time.Duration) error

Call calls serviceMethod with args and fills reply with response.

func (*ClnUnixConnection) Cleanup added in v0.0.46

func (l *ClnUnixConnection) Cleanup()

Cleanup does the cleanup.

func (*ClnUnixConnection) StreamResponse added in v0.0.44

func (l *ClnUnixConnection) StreamResponse(ctx context.Context, serviceMethod string, args any) (io.Reader, error)

StreamResponse is meant for streaming responses it calls serviceMethod with args and returns an io.Reader.

type ClnWithdrawResp added in v0.0.49

type ClnWithdrawResp struct {
	TxID string `json:"txid,omitempty"`
	ClnResp
}

ClnWithdrawResp struct.

type CloseInfo added in v0.1.1

type CloseInfo struct {
	ChanID    uint64          `json:"channel_id,omitempty"`
	Opener    CommonInitiator `json:"opener"`
	Closer    CommonInitiator `json:"closer"`
	CloseType CommonCloseType `json:"close_type"`
}

Close info struct.

type ClosedChannelsResponseOverride added in v0.1.1

type ClosedChannelsResponseOverride struct {
	Channels []*ChannelCloseSummaryOverride `json:"channels,omitempty"`
	lnrpc.ClosedChannelsResponse
}

ClosedChannelsResponseOverride struct.

type CommonCloseType added in v0.1.1

type CommonCloseType string

Close type enum.

const (
	UnknownType     CommonCloseType = "unknown"
	CooperativeType CommonCloseType = "cooperative"
	ForceType       CommonCloseType = "force"
)

type CommonInitiator added in v0.1.1

type CommonInitiator string

CommonInitiator enum.

const (
	Unknown CommonInitiator = "unknown"
	Local   CommonInitiator = "local"
	Remote  CommonInitiator = "remote"
)

type ConnectPeerRequestOverride added in v0.0.49

type ConnectPeerRequestOverride struct {
	Addr    *LightningAddressOverride `json:"addr,omitempty"`
	Timeout string                    `json:"timeout,omitempty"`
	lnrpc.ConnectPeerRequest
}

ConnectPeerRequestOverride struct.

type DescribeGraphAPI

type DescribeGraphAPI struct {
	Nodes    []DescribeGraphNodeAPI
	Channels []NodeChannelAPI
}

DescribeGraphAPI struct.

type DescribeGraphNodeAPI

type DescribeGraphNodeAPI struct {
	PubKey     string                    `json:"pub_key,omitempty"`
	Alias      string                    `json:"alias,omitempty"`
	Color      string                    `json:"color,omitempty"`
	Addresses  []NodeAddressAPI          `json:"addresses,omitempty"`
	Features   map[string]NodeFeatureAPI `json:"features,omitempty"`
	LastUpdate entities.JsonTime         `json:"last_update,omitempty"`
}

DescribeGraphNodeAPI struct.

func ConvertNodeInfo

func ConvertNodeInfo(node ClnListNode) *DescribeGraphNodeAPI

ConvertNodeInfo - convert CLN to internal node representation.

type DestCustomRecordsEntryOverride added in v0.0.49

type DestCustomRecordsEntryOverride struct {
}

DestCustomRecordsEntryOverride struct.

type DeterminedRoute added in v0.2.2

type DeterminedRoute []RouteElement

Route alias.

func (DeterminedRoute) Clone added in v0.2.2

func (r DeterminedRoute) Clone() DeterminedRoute

Clone - create a copy of given DeterminedRoute

func (DeterminedRoute) PrettyRoute added in v0.2.2

func (r DeterminedRoute) PrettyRoute(destination string, chanIds bool, nameCache map[string]string) string

PrettyRoute - returns a pretty route

type ErrorData added in v0.0.42

type ErrorData struct {
	Error          error
	IsStillRunning bool
}

ErrorData struct.

type ExcludedEdge added in v0.2.2

type ExcludedEdge struct {
	ChannelId uint64
	ExclusionBase
}

ExcludedEdge struct.

func (ExcludedEdge) IsNodeExclusion added in v0.2.2

func (e ExcludedEdge) IsNodeExclusion() bool

IsNodeExclusion for edge

type ExcludedNode added in v0.2.2

type ExcludedNode struct {
	PubKey string
	ExclusionBase
}

ExcludedNode struct.

func (ExcludedNode) IsNodeExclusion added in v0.2.2

func (e ExcludedNode) IsNodeExclusion() bool

IsNodeExclusion for node

type Exclusion added in v0.2.2

type Exclusion interface {
	IsNodeExclusion() bool
}

Exclusion interface.

type ExclusionBase added in v0.2.2

type ExclusionBase struct {
}

ExclusionBase struct.

type ExclusionBuilder added in v0.2.2

type ExclusionBuilder struct {
	// contains filtered or unexported fields
}

ExlusionBuilder struct.

func NewEmptyExclusionBuilder added in v0.2.2

func NewEmptyExclusionBuilder() ExclusionBuilder

NewEmptyExclusionBuilder - creates a new empty builder

func NewExclusionBuilder added in v0.2.2

func NewExclusionBuilder(existing []Exclusion) ExclusionBuilder

NewExclusionBuilder - creates a new builder with existing exclusions

func (ExclusionBuilder) AddEdge added in v0.2.2

func (b ExclusionBuilder) AddEdge(edge uint64)

AddEdge - excluse edge by channel id

func (ExclusionBuilder) AddEdgeWithDeadline added in v0.2.2

func (b ExclusionBuilder) AddEdgeWithDeadline(edge uint64, deadline time.Time)

AddEdgeWithDeadline - excluse edge by channel id

func (ExclusionBuilder) AddNode added in v0.2.2

func (b ExclusionBuilder) AddNode(node string)

AddNode - excludes node by pubkey

func (ExclusionBuilder) AddNodeWithDeadline added in v0.2.2

func (b ExclusionBuilder) AddNodeWithDeadline(node string, deadline time.Time)

AddNodeWithDeadline - excludes node by pubkey

func (ExclusionBuilder) Build added in v0.2.2

func (b ExclusionBuilder) Build() []Exclusion

Build - get the built exclusions

type ForwardingEvent added in v0.0.42

type ForwardingEvent struct {
	Timestamp     time.Time
	ChanIDIn      uint64
	ChanIDOut     uint64
	AmountInMsat  uint64
	AmountOutMsat uint64
	FeeMsat       uint64
	IsSuccess     bool
	FailureString string
}

ForwardingEvent struct.

type ForwardingEventOverride added in v0.0.42

type ForwardingEventOverride struct {
	Timestamp   string `json:"timestamp,omitempty"`
	ChanIDIn    string `json:"chan_id_in,omitempty"`
	ChanIDOut   string `json:"chan_id_out,omitempty"`
	AmtIn       string `json:"amt_in,omitempty"`
	AmtOut      string `json:"amt_out,omitempty"`
	Fee         string `json:"fee,omitempty"`
	FeeMsat     string `json:"fee_msat,omitempty"`
	AmtInMsat   string `json:"amt_in_msat,omitempty"`
	AmtOutMsat  string `json:"amt_out_msat,omitempty"`
	TimestampNs string `json:"timestamp_ns,omitempty"`

	lnrpc.ForwardingEvent
}

ForwardingEventOverride struct.

type ForwardingHistoryRequestOverride added in v0.0.42

type ForwardingHistoryRequestOverride struct {
	StartTime string `json:"start_time,omitempty"`
	EndTime   string `json:"end_time,omitempty"`

	lnrpc.ForwardingHistoryRequest
}

ForwardingHistoryRequestOverride struct.

type ForwardingHistoryResponseOverride added in v0.0.42

type ForwardingHistoryResponseOverride struct {
	ForwardingEvents []*ForwardingEventOverride `json:"forwarding_events,omitempty"`
	lnrpc.ForwardingHistoryResponse
}

ForwardingHistoryResponseOverride struct.

type Funds added in v0.0.49

type Funds struct {
	TotalBalance     int64
	ConfirmedBalance int64
	LockedBalance    int64
}

Funds struct.

type GetDataCall

type GetDataCall func() (*entities.Data, error)

GetDataCall - signature of function for retrieving data.

type GetDoFunc

type GetDoFunc func(req *http.Request) (*http.Response, error)

GetDoFunc = signature for Do function.

type GetInfoResponseOverride

type GetInfoResponseOverride struct {
	BestHeaderTimestamp string `json:"best_header_timestamp,omitempty"`
	lnrpc.GetInfoResponse
}

GetInfoResponseOverride struct.

type GetNodeInfoOverride

type GetNodeInfoOverride struct {
	Node          *GraphNodeOverride   `json:"node,omitempty"`
	NumChannels   int64                `json:"num_channels,omitempty"`
	TotalCapacity string               `json:"total_capacity,omitempty"`
	Channels      []*GraphEdgeOverride `json:"channels"`

	lnrpc.NodeInfo
}

GetNodeInfoOverride struct.

type Graph

type Graph struct {
	GraphNodeOverride  []*GraphNodeOverride `json:"nodes,omitempty"`
	GraphEdgesOverride []*GraphEdgeOverride `json:"edges,omitempty"`
}

Graph struct.

type GraphEdgeOverride

type GraphEdgeOverride struct {
	ChannelID   string                 `json:"channel_id,omitempty"`
	Capacity    string                 `json:"capacity,omitempty"`
	Node1Policy *RoutingPolicyOverride `json:"node1_policy,omitempty"`
	Node2Policy *RoutingPolicyOverride `json:"node2_policy,omitempty"`

	lnrpc.ChannelEdge
}

GraphEdgeOverride struct.

type GraphNodeOverride

type GraphNodeOverride struct {
	lnrpc.LightningNode
}

GraphNodeOverride struct.

type HTLCAttempt added in v0.0.42

type HTLCAttempt struct {
	ID      uint64
	Status  HTLCStatus
	Attempt time.Time
	Resolve time.Time

	Route Route
}

HTLCAttempt struct.

type HTLCAttemptOverride added in v0.0.42

type HTLCAttemptOverride struct {
	AttemptID     string          `json:"attempt_id,omitempty"`
	Status        string          `json:"status,omitempty"`
	Route         *RouteOverride  `json:"route,omitempty"`
	AttemptTimeNs string          `json:"attempt_time_ns,omitempty"`
	ResolveTimeNs string          `json:"resolve_time_ns,omitempty"`
	Failure       json.RawMessage `json:"failure,omitempty"` // ignore
	Preimage      string          `protobuf:"bytes,6,opt,name=preimage,proto3" json:"preimage,omitempty"`

	lnrpc.HTLCAttempt
}

HTLCAttemptOverride struct.

type HTLCStatus added in v0.0.42

type HTLCStatus int

HTLCStatus enum.

const (
	HTLCInFlight HTLCStatus = 0
	HTLCSucceeded
	HTLCFailed
)

HTLCStatus values.

type HTTPAPI

type HTTPAPI struct {
	DoFunc GetDoFunc
	// contains filtered or unexported fields
}

HTTPAPI struct.

func NewHTTPAPI

func NewHTTPAPI() *HTTPAPI

NewHTTPAPI returns a new HTTPAPI.

func (*HTTPAPI) Do

func (h *HTTPAPI) Do(req *http.Request) (*http.Response, error)

Do - invokes HTTP request.

func (*HTTPAPI) GetHTTPRequest

func (h *HTTPAPI) GetHTTPRequest(getData GetDataCall) (*http.Request, *http.Transport, error)

GetHTTPRequest - generic method for doing HTTP requests.

func (*HTTPAPI) HTTPAddInvoice added in v0.0.49

func (h *HTTPAPI) HTTPAddInvoice(ctx context.Context, req *http.Request, input *InvoiceOverride) (*AddInvoiceResponseOverride, error)

HTTPAddInvoice - invokes AddInvoice method.

func (*HTTPAPI) HTTPBalance added in v0.0.49

func (h *HTTPAPI) HTTPBalance(ctx context.Context, req *http.Request) (*WalletBalanceResponseOverride, error)

HTTPBalance - invokes Balance method.

func (*HTTPAPI) HTTPClosedChannels added in v0.1.1

func (h *HTTPAPI) HTTPClosedChannels(ctx context.Context, req *http.Request) (*ClosedChannelsResponseOverride, error)

HTTPClosedChannels - invokes ClosedChannels method.

func (*HTTPAPI) HTTPForwardEvents added in v0.0.42

HTTPForwardEvents - invokes ForwardEvents method.

func (*HTTPAPI) HTTPGetChanInfo

func (h *HTTPAPI) HTTPGetChanInfo(ctx context.Context, req *http.Request, chanID uint64) (*GraphEdgeOverride, error)

HTTPGetChanInfo - invokes GetChanInfo method.

func (*HTTPAPI) HTTPGetChannels

func (h *HTTPAPI) HTTPGetChannels(ctx context.Context, req *http.Request) (*Channels, error)

HTTPGetChannels - invokes GetChannels method.

func (*HTTPAPI) HTTPGetGraph

func (h *HTTPAPI) HTTPGetGraph(ctx context.Context, req *http.Request, unannounced bool) (*Graph, error)

HTTPGetGraph - invokes GetGraph method.

func (*HTTPAPI) HTTPGetInfo

func (h *HTTPAPI) HTTPGetInfo(ctx context.Context, req *http.Request) (*GetInfoResponseOverride, error)

HTTPGetInfo - invokes GetInfo method.

func (*HTTPAPI) HTTPGetNodeInfo

func (h *HTTPAPI) HTTPGetNodeInfo(ctx context.Context, req *http.Request, pubKey string, channels bool) (*GetNodeInfoOverride, error)

HTTPGetNodeInfo - invokes GetNodeInfo method.

func (*HTTPAPI) HTTPListInvoices added in v0.0.42

HTTPListInvoices - invokes ListInvoices method.

func (*HTTPAPI) HTTPListPayments added in v0.0.42

HTTPListPayments - invokes ListPayments method.

func (*HTTPAPI) HTTPLookupInvoice added in v0.0.49

func (h *HTTPAPI) HTTPLookupInvoice(ctx context.Context, req *http.Request, paymentHash string) (*InvoiceOverride, error)

HTTPLookupInvoice - invokes LookupInvoice method.

func (*HTTPAPI) HTTPNewAddress added in v0.0.49

func (h *HTTPAPI) HTTPNewAddress(ctx context.Context, req *http.Request, input *lnrpc.NewAddressRequest) (*lnrpc.NewAddressResponse, error)

HTTPNewAddress - invokes NewAddress method.

func (*HTTPAPI) HTTPPayInvoice added in v0.0.49

func (h *HTTPAPI) HTTPPayInvoice(ctx context.Context, req *http.Request, input *SendPaymentRequestOverride) (*PaymentOverride, error)

HTTPPayInvoice - invokes PayInvoice method.

func (*HTTPAPI) HTTPPeers added in v0.0.49

func (h *HTTPAPI) HTTPPeers(ctx context.Context, req *http.Request, input *ConnectPeerRequestOverride) error

HTTPPeers - invokes peers method.

func (*HTTPAPI) HTTPSendCoins added in v0.0.49

func (h *HTTPAPI) HTTPSendCoins(ctx context.Context, req *http.Request, input *SendCoinsRequestOverride) (*lnrpc.SendCoinsResponse, error)

HTTPSendCoins - invokes SendCoins method.

func (*HTTPAPI) HTTPSubscribeHtlcEvents added in v0.0.42

func (h *HTTPAPI) HTTPSubscribeHtlcEvents(ctx context.Context, req *http.Request) (<-chan *HtlcEventOverride, error)

HTTPSubscribeHtlcEvents - invokes SubscribeHtlcEvents method.

func (*HTTPAPI) HTTPTrackPayment added in v0.0.49

func (h *HTTPAPI) HTTPTrackPayment(ctx context.Context, req *http.Request, input *TrackPaymentRequestOverride) (*PaymentOverride, error)

HTTPTrackPayment - invokes TrackPayment method.

func (*HTTPAPI) SetTransport

func (h *HTTPAPI) SetTransport(transport *http.Transport)

SetTransport - sets HTTP transport.

type Hop added in v0.0.42

type Hop struct {
	ChanID           uint64
	Expiry           uint32
	AmtToForwardMsat int64
	FeeMsat          int64
}

Hop struct.

type HopHintOverride added in v0.0.42

type HopHintOverride struct {
	ChanID string `json:"chan_id,omitempty"`

	lnrpc.HopHint
}

HopHintOverride struct.

type HopOverride added in v0.0.42

type HopOverride struct {
	ChanID           string          `json:"chan_id,omitempty"`
	ChanCapacity     string          `json:"chan_capacity,omitempty"`
	AmtToForward     string          `json:"amt_to_forward,omitempty"`
	Fee              string          `json:"fee,omitempty"`
	AmtToForwardMsat string          `json:"amt_to_forward_msat,omitempty"`
	FeeMsat          string          `json:"fee_msat,omitempty"`
	MppRecord        json.RawMessage `json:"mpp_record,omitempty"`     // ignore
	AmpRecord        json.RawMessage `json:"amp_record,omitempty"`     // ignore
	CustomRecords    json.RawMessage `json:"custom_records,omitempty"` // ignore
	Metadata         string          `json:"metadata,omitempty"`

	lnrpc.Hop
}

HopOverride struct.

type HtlcAPI

type HtlcAPI struct {
	Amount              uint64
	Incoming            bool
	ForwardingChannel   uint64
	ForwardingHtlcIndex uint64
}

HtlcAPI struct.

type HtlcEventComposite added in v0.0.42

type HtlcEventComposite struct {
	Info          *HtlcInfoOverride `json:"info,omitempty"`
	Preimage      string            `json:"preimage,omitempty"`
	WireFailure   string            `json:"wire_failure,omitempty"`
	FailureDetail string            `json:"failure_detail,omitempty"`
	FailureString string            `json:"failure_string,omitempty"`
}

HtlcEventComposite struct (our abstraction over that mess with inheritance).

type HtlcEventOverride added in v0.0.42

type HtlcEventOverride struct {
	IncomingChannelID string             `json:"incoming_channel_id,omitempty"`
	OutgoingChannelID string             `json:"outgoing_channel_id,omitempty"`
	IncomingHtlcID    string             `json:"incoming_htlc_id,omitempty"`
	OutgoingHtlcID    string             `json:"outgoing_htlc_id,omitempty"`
	TimestampNs       string             `json:"timestamp_ns,omitempty"`
	EventType         string             `json:"event_type,omitempty"`
	Event             HtlcEventComposite `json:"event,omitempty"`

	routerrpc.HtlcEvent
}

HtlcEventOverride struct.

type HtlcInfoOverride added in v0.0.42

type HtlcInfoOverride struct {
	IncomingAmtMsat string `json:"incoming_amt_msat,omitempty"`
	OutgoingAmtMsat string `json:"outgoing_amt_msat,omitempty"`
}

HtlcInfoOverride struct.

type HtlcOverride

type HtlcOverride struct {
	Amount              string `json:"amount,omitempty"`
	HashLock            string `json:"hash_lock,omitempty"`
	HtlcIndex           string `json:"htlc_index,omitempty"`
	ForwardingChannel   string `json:"forwarding_channel,omitempty"`
	ForwardingHtlcIndex string `json:"forwarding_htlc_index,omitempty"`
	lnrpc.HTLC
}

HtlcOverride struct.

type InfoAPI

type InfoAPI struct {
	IdentityPubkey  string
	Alias           string
	Chain           string
	Network         string
	Version         string
	IsSyncedToGraph bool
	IsSyncedToChain bool
	BlockHeight     int
}

InfoAPI struct.

type Invoice added in v0.0.42

type Invoice struct {
	Memo            string
	ValueMsat       int64
	PaidMsat        int64
	CreationDate    time.Time
	SettleDate      time.Time
	PaymentRequest  string
	DescriptionHash string
	Expiry          int64
	FallbackAddr    string
	CltvExpiry      uint64
	Private         bool
	IsKeySend       bool
	IsAmp           bool
	State           InvoiceHTLCState
	AddIndex        uint64
	SettleIndex     uint64
}

Invoice struct.

type InvoiceHTLCState added in v0.0.42

type InvoiceHTLCState int

InvoiceHTLCState enum.

const (
	InvoiceAccepted InvoiceHTLCState = 0
	InvoiceSettled
	InvoiceCancelled
)

InvoiceHTLCState values.

func StringToInvoiceHTLCState added in v0.0.42

func StringToInvoiceHTLCState(in string) InvoiceHTLCState

StringToInvoiceHTLCState creates InvoiceHTLCState based on a string.

type InvoiceOverride added in v0.0.42

type InvoiceOverride struct {
	Value        string `json:"value,omitempty"`
	ValueMsat    string `json:"value_msat,omitempty"`
	RPreimage    string `json:"r_preimage,omitempty"`
	RHash        string `json:"r_hash,omitempty"`
	CreationDate string `json:"creation_date,omitempty"`
	SettleDate   string `json:"settle_date,omitempty"`
	Expiry       string `json:"expiry,omitempty"`
	CltvExpiry   string `json:"cltv_expiry,omitempty"`

	AddIndex    string `json:"add_index,omitempty"`
	SettleIndex string `json:"settle_index,omitempty"`
	AmtPaid     string `json:"amt_paid,omitempty"`
	AmtPaidSat  string `json:"amt_paid_sat,omitempty"`
	AmtPaidMsat string `json:"amt_paid_msat,omitempty"`

	DescriptionHash string               `json:"description_hash,omitempty"`
	RouteHints      []*RouteHintOverride `json:"route_hints,omitempty"`
	State           string               `json:"state,omitempty"`

	// Ignore this stuff
	Features        json.RawMessage `json:"features,omitempty"`
	Htlcs           json.RawMessage `json:"htlcs,omitempty"`
	AmpInvoiceState json.RawMessage `json:"amp_invoice_state,omitempty"`

	lnrpc.Invoice
}

InvoiceOverride struct.

type InvoiceResp added in v0.0.49

type InvoiceResp struct {
	Hash           string
	PaymentRequest string
}

InvoiceResp struct.

type InvoicesResponse added in v0.0.42

type InvoicesResponse struct {
	Invoices []Invoice
	ResponsePagination
}

InvoicesResponse struct.

type Item added in v0.2.2

type Item struct {
	// contains filtered or unexported fields
}

An Item is something we manage in a priority queue.

type LightingAPICalls

type LightingAPICalls interface {
	Cleanup()
	GetAPIType() APIType
	GetInfo(ctx context.Context) (*InfoAPI, error)
	GetChannels(ctx context.Context) (*ChannelsAPI, error)
	DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphAPI, error)
	GetNodeInfoFull(ctx context.Context, channels, unannounced bool) (*NodeInfoAPIExtended, error)
	GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoAPI, error)
	GetChanInfo(ctx context.Context, chanID uint64) (*NodeChannelAPI, error)

	GetInvoices(ctx context.Context, pendingOnly bool, pagination Pagination) (*InvoicesResponse, error)
	GetPayments(ctx context.Context, includeIncomplete bool, pagination Pagination) (*PaymentsResponse, error)

	SubscribeForwards(ctx context.Context, since time.Time, batchSize uint16, maxErrors uint16) (<-chan []ForwardingEvent, <-chan ErrorData)

	GetInvoicesRaw(ctx context.Context, pendingOnly bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)
	GetPaymentsRaw(ctx context.Context, includeIncomplete bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)
	GetForwardsRaw(ctx context.Context, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

	ConnectPeer(ctx context.Context, id string) error
	GetOnChainAddress(ctx context.Context) (string, error)
	GetOnChainFunds(ctx context.Context) (*Funds, error)
	SendToOnChainAddress(ctx context.Context, address string, sats int64, useUnconfirmed bool, urgency Urgency) (string, error)
	PayInvoice(ctx context.Context, paymentRequest string, sats int64, outgoingChanIds []uint64) (*PaymentResp, error)
	GetPaymentStatus(ctx context.Context, paymentRequest string) (*PaymentResp, error)
	CreateInvoice(ctx context.Context, sats int64, preimage string, memo string, expiry time.Duration) (*InvoiceResp, error)
	IsInvoicePaid(ctx context.Context, paymentHash string) (bool, error)

	GetChannelCloseInfo(ctx context.Context, chanIDs []uint64) ([]CloseInfo, error)

	// Includes source but NOT destination addreses in response
	GetRoute(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (DeterminedRoute, error)
	GetRoutes(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (<-chan DeterminedRoute, error)
}

LightingAPICalls is the interface for lightning API.

func NewAPI

func NewAPI(apiType APIType, getData GetDataCall) (LightingAPICalls, error)

NewAPI - gets new lightning API.

func NewClnCommandoLightningAPI added in v0.0.44

func NewClnCommandoLightningAPI(getData GetDataCall) LightingAPICalls

NewClnCommandoLightningAPI returns a new lightning API.

func NewClnCommandoLightningAPIRaw added in v0.0.44

func NewClnCommandoLightningAPIRaw(addr, rune string) LightingAPICalls

NewClnCommandoLightningAPIRaw gets a new API (note that addr is in pubkey@address format).

func NewClnSocketLightningAPI

func NewClnSocketLightningAPI(getData GetDataCall) LightingAPICalls

NewClnSocketLightningAPI return a new lightning API.

func NewClnSocketLightningAPIRaw

func NewClnSocketLightningAPIRaw(socketType string, address string) LightingAPICalls

NewClnSocketLightningAPIRaw gets a new API - usage "unix", "/home/ubuntu/.lightning/bitcoin/lightning-rpc".

func NewLndGrpcLightningAPI

func NewLndGrpcLightningAPI(getData GetDataCall) LightingAPICalls

NewLndGrpcLightningAPI - creates new lightning API.

func NewLndRestLightningAPI

func NewLndRestLightningAPI(getData GetDataCall) LightingAPICalls

NewLndRestLightningAPI constructs new lightning API.

type LightningAddressOverride added in v0.0.49

type LightningAddressOverride struct {
	lnrpc.LightningAddress
}

LightningAddressOverride struct.

type ListInvoiceRequestOverride added in v0.0.42

type ListInvoiceRequestOverride struct {
	IndexOffset    string `json:"index_offset,omitempty"`
	NumMaxInvoices string `json:"num_max_invoices,omitempty"`

	lnrpc.ListInvoiceRequest
}

ListInvoiceRequestOverride struct.

type ListInvoiceResponseOverride added in v0.0.42

type ListInvoiceResponseOverride struct {
	Invoices         []*InvoiceOverride `json:"invoices,omitempty"`
	LastIndexOffset  string             `json:"last_index_offset,omitempty"`
	FirstIndexOffset string             `json:"first_index_offset,omitempty"`

	lnrpc.ListInvoiceResponse
}

ListInvoiceResponseOverride struct.

type ListPaymentsRequestOverride added in v0.0.42

type ListPaymentsRequestOverride struct {
	IndexOffset string `json:"index_offset,omitempty"`
	MaxPayments string `json:"max_payments,omitempty"`

	lnrpc.ListPaymentsRequest
}

ListPaymentsRequestOverride struct.

type ListPaymentsResponseOverride added in v0.0.42

type ListPaymentsResponseOverride struct {
	Payments         []*PaymentOverride `json:"payments,omitempty"`
	LastIndexOffset  string             `json:"last_index_offset,omitempty"`
	FirstIndexOffset string             `json:"first_index_offset,omitempty"`
	TotalNumPayments string             `json:"total_num_payments,omitempty"`

	lnrpc.ListPaymentsResponse
}

ListPaymentsResponseOverride struct.

type LndGrpcLightningAPI

type LndGrpcLightningAPI struct {
	Client       lnrpc.LightningClient
	RouterClient routerrpc.RouterClient
	CleanupFunc  func()

	API
}

LndGrpcLightningAPI struct.

func (*LndGrpcLightningAPI) Cleanup

func (l *LndGrpcLightningAPI) Cleanup()

Cleanup API.

func (*LndGrpcLightningAPI) ConnectPeer added in v0.0.49

func (l *LndGrpcLightningAPI) ConnectPeer(ctx context.Context, id string) error

ConnectPeer API.

func (*LndGrpcLightningAPI) CreateInvoice added in v0.0.49

func (l *LndGrpcLightningAPI) CreateInvoice(ctx context.Context, sats int64, preimage string, memo string, expiry time.Duration) (*InvoiceResp, error)

CreateInvoice API.

func (*LndGrpcLightningAPI) DescribeGraph

func (l *LndGrpcLightningAPI) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphAPI, error)

DescribeGraph API.

func (*LndGrpcLightningAPI) GetAPIType added in v0.0.42

func (l *LndGrpcLightningAPI) GetAPIType() APIType

GetAPIType API.

func (*LndGrpcLightningAPI) GetChanInfo

func (l *LndGrpcLightningAPI) GetChanInfo(ctx context.Context, chanID uint64) (*NodeChannelAPI, error)

GetChanInfo API.

func (*LndGrpcLightningAPI) GetChannelCloseInfo added in v0.1.1

func (l *LndGrpcLightningAPI) GetChannelCloseInfo(ctx context.Context, chanIDs []uint64) ([]CloseInfo, error)

GetChannelCloseInfo API.

func (*LndGrpcLightningAPI) GetChannels

func (l *LndGrpcLightningAPI) GetChannels(ctx context.Context) (*ChannelsAPI, error)

GetChannels API.

func (*LndGrpcLightningAPI) GetForwardsRaw added in v0.0.42

func (l *LndGrpcLightningAPI) GetForwardsRaw(ctx context.Context, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetForwardsRaw API.

func (*LndGrpcLightningAPI) GetInfo

func (l *LndGrpcLightningAPI) GetInfo(ctx context.Context) (*InfoAPI, error)

GetInfo API.

func (*LndGrpcLightningAPI) GetInvoices added in v0.0.42

func (l *LndGrpcLightningAPI) GetInvoices(ctx context.Context, pendingOnly bool, pagination Pagination) (*InvoicesResponse, error)

GetInvoices API.

func (*LndGrpcLightningAPI) GetInvoicesRaw added in v0.0.42

func (l *LndGrpcLightningAPI) GetInvoicesRaw(ctx context.Context, pendingOnly bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetInvoicesRaw API.

func (*LndGrpcLightningAPI) GetNodeInfo

func (l *LndGrpcLightningAPI) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoAPI, error)

GetNodeInfo API.

func (*LndGrpcLightningAPI) GetNodeInfoFull

func (l *LndGrpcLightningAPI) GetNodeInfoFull(ctx context.Context, channels, unnanounced bool) (*NodeInfoAPIExtended, error)

GetNodeInfoFull - GetNodeInfoFull API (GRPC interface).

func (*LndGrpcLightningAPI) GetOnChainAddress added in v0.0.49

func (l *LndGrpcLightningAPI) GetOnChainAddress(ctx context.Context) (string, error)

GetOnChainAddress API.

func (*LndGrpcLightningAPI) GetOnChainFunds added in v0.0.49

func (l *LndGrpcLightningAPI) GetOnChainFunds(ctx context.Context) (*Funds, error)

GetOnChainFunds API.

func (*LndGrpcLightningAPI) GetPaymentStatus added in v0.0.49

func (l *LndGrpcLightningAPI) GetPaymentStatus(ctx context.Context, paymentRequest string) (*PaymentResp, error)

GetPaymentStatus API.

func (*LndGrpcLightningAPI) GetPayments added in v0.0.42

func (l *LndGrpcLightningAPI) GetPayments(ctx context.Context, includeIncomplete bool, pagination Pagination) (*PaymentsResponse, error)

GetPayments API.

func (*LndGrpcLightningAPI) GetPaymentsRaw added in v0.0.42

func (l *LndGrpcLightningAPI) GetPaymentsRaw(ctx context.Context, includeIncomplete bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetPaymentsRaw API.

func (*LndGrpcLightningAPI) GetRoute added in v0.2.2

func (l *LndGrpcLightningAPI) GetRoute(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (DeterminedRoute, error)

GetRoute API.

func (*LndGrpcLightningAPI) GetRoutes added in v0.2.2

func (l *LndGrpcLightningAPI) GetRoutes(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (<-chan DeterminedRoute, error)

func (*LndGrpcLightningAPI) IsInvoicePaid added in v0.0.49

func (l *LndGrpcLightningAPI) IsInvoicePaid(ctx context.Context, paymentHash string) (bool, error)

IsInvoicePaid API.

func (*LndGrpcLightningAPI) PayInvoice added in v0.0.49

func (l *LndGrpcLightningAPI) PayInvoice(ctx context.Context, paymentRequest string, sats int64, outgoingChanIds []uint64) (*PaymentResp, error)

PayInvoice API.

func (*LndGrpcLightningAPI) SendToOnChainAddress added in v0.0.49

func (l *LndGrpcLightningAPI) SendToOnChainAddress(ctx context.Context, address string, sats int64, useUnconfirmed bool, urgency Urgency) (string, error)

SendToOnChainAddress API.

func (*LndGrpcLightningAPI) SubscribeFailedForwards added in v0.0.43

func (l *LndGrpcLightningAPI) SubscribeFailedForwards(ctx context.Context, outchan chan RawMessage) error

SubscribeFailedForwards is used to subscribe to failed forwards.

func (*LndGrpcLightningAPI) SubscribeForwards added in v0.0.42

func (l *LndGrpcLightningAPI) SubscribeForwards(ctx context.Context, since time.Time, batchSize uint16, maxErrors uint16) (<-chan []ForwardingEvent, <-chan ErrorData)

SubscribeForwards API.

type LndRestLightningAPI

type LndRestLightningAPI struct {
	Request   *http.Request
	Transport *http.Transport
	HTTPAPI   *HTTPAPI

	API
}

LndRestLightningAPI struct.

func (*LndRestLightningAPI) Cleanup

func (l *LndRestLightningAPI) Cleanup()

Cleanup - clean up.

func (*LndRestLightningAPI) ConnectPeer added in v0.0.49

func (l *LndRestLightningAPI) ConnectPeer(ctx context.Context, id string) error

ConnectPeer API.

func (*LndRestLightningAPI) CreateInvoice added in v0.0.49

func (l *LndRestLightningAPI) CreateInvoice(ctx context.Context, sats int64, preimage string, memo string, expiry time.Duration) (*InvoiceResp, error)

CreateInvoice API.

func (*LndRestLightningAPI) DescribeGraph

func (l *LndRestLightningAPI) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphAPI, error)

DescribeGraph - DescribeGraph API.

func (*LndRestLightningAPI) GetAPIType added in v0.0.42

func (l *LndRestLightningAPI) GetAPIType() APIType

GetAPIType API.

func (*LndRestLightningAPI) GetChanInfo

func (l *LndRestLightningAPI) GetChanInfo(ctx context.Context, chanID uint64) (*NodeChannelAPI, error)

GetChanInfo - GetChanInfo API.

func (*LndRestLightningAPI) GetChannelCloseInfo added in v0.1.1

func (l *LndRestLightningAPI) GetChannelCloseInfo(ctx context.Context, chanIDs []uint64) ([]CloseInfo, error)

GetChannelCloseInfo API.

func (*LndRestLightningAPI) GetChannels

func (l *LndRestLightningAPI) GetChannels(ctx context.Context) (*ChannelsAPI, error)

GetChannels - GetChannels API.

func (*LndRestLightningAPI) GetForwardsRaw added in v0.0.42

func (l *LndRestLightningAPI) GetForwardsRaw(ctx context.Context, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetForwardsRaw - API call.

func (*LndRestLightningAPI) GetInfo

func (l *LndRestLightningAPI) GetInfo(ctx context.Context) (*InfoAPI, error)

GetInfo - GetInfo API.

func (*LndRestLightningAPI) GetInvoices added in v0.0.42

func (l *LndRestLightningAPI) GetInvoices(ctx context.Context, pendingOnly bool, pagination Pagination) (*InvoicesResponse, error)

GetInvoices API.

func (*LndRestLightningAPI) GetInvoicesRaw added in v0.0.42

func (l *LndRestLightningAPI) GetInvoicesRaw(ctx context.Context, pendingOnly bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetInvoicesRaw - API call.

func (*LndRestLightningAPI) GetNodeInfo

func (l *LndRestLightningAPI) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoAPI, error)

GetNodeInfo - GetNodeInfo API.

func (*LndRestLightningAPI) GetNodeInfoFull

func (l *LndRestLightningAPI) GetNodeInfoFull(ctx context.Context, channels, unnanounced bool) (*NodeInfoAPIExtended, error)

GetNodeInfoFull - GetNodeInfoFull API (REST interface).

func (*LndRestLightningAPI) GetOnChainAddress added in v0.0.49

func (l *LndRestLightningAPI) GetOnChainAddress(ctx context.Context) (string, error)

GetOnChainAddress API.

func (*LndRestLightningAPI) GetOnChainFunds added in v0.0.49

func (l *LndRestLightningAPI) GetOnChainFunds(ctx context.Context) (*Funds, error)

GetOnChainFunds API.

func (*LndRestLightningAPI) GetPaymentStatus added in v0.0.49

func (l *LndRestLightningAPI) GetPaymentStatus(ctx context.Context, paymentRequest string) (*PaymentResp, error)

GetPaymentStatus API.

func (*LndRestLightningAPI) GetPayments added in v0.0.42

func (l *LndRestLightningAPI) GetPayments(ctx context.Context, includeIncomplete bool, pagination Pagination) (*PaymentsResponse, error)

GetPayments API.

func (*LndRestLightningAPI) GetPaymentsRaw added in v0.0.42

func (l *LndRestLightningAPI) GetPaymentsRaw(ctx context.Context, includeIncomplete bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

GetPaymentsRaw - API call.

func (*LndRestLightningAPI) GetRoute added in v0.2.2

func (l *LndRestLightningAPI) GetRoute(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (DeterminedRoute, error)

GetRoute API.

func (*LndRestLightningAPI) GetRoutes added in v0.2.2

func (l *LndRestLightningAPI) GetRoutes(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (<-chan DeterminedRoute, error)

func (*LndRestLightningAPI) IsInvoicePaid added in v0.0.49

func (l *LndRestLightningAPI) IsInvoicePaid(ctx context.Context, paymentHash string) (bool, error)

IsInvoicePaid API.

func (*LndRestLightningAPI) PayInvoice added in v0.0.49

func (l *LndRestLightningAPI) PayInvoice(ctx context.Context, paymentRequest string, sats int64, outgoingChanIds []uint64) (*PaymentResp, error)

PayInvoice API.

func (*LndRestLightningAPI) SendToOnChainAddress added in v0.0.49

func (l *LndRestLightningAPI) SendToOnChainAddress(ctx context.Context, address string, sats int64, useUnconfirmed bool, urgency Urgency) (string, error)

SendToOnChainAddress API.

func (*LndRestLightningAPI) SubscribeFailedForwards added in v0.0.43

func (l *LndRestLightningAPI) SubscribeFailedForwards(ctx context.Context, outchan chan RawMessage) error

SubscribeFailedForwards is used to subscribe to failed forwards.

func (*LndRestLightningAPI) SubscribeForwards added in v0.0.42

func (l *LndRestLightningAPI) SubscribeForwards(ctx context.Context, since time.Time, batchSize uint16, maxErrors uint16) (<-chan []ForwardingEvent, <-chan ErrorData)

SubscribeForwards - API call.

type MockLightningAPI added in v0.0.49

type MockLightningAPI struct {
	Trace string
}

func (*MockLightningAPI) Cleanup added in v0.0.49

func (m *MockLightningAPI) Cleanup()

func (*MockLightningAPI) ConnectPeer added in v0.0.49

func (m *MockLightningAPI) ConnectPeer(ctx context.Context, id string) error

func (*MockLightningAPI) CreateInvoice added in v0.0.49

func (m *MockLightningAPI) CreateInvoice(ctx context.Context, sats int64, preimage string, memo string, expiry time.Duration) (*InvoiceResp, error)

func (*MockLightningAPI) DescribeGraph added in v0.0.49

func (m *MockLightningAPI) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphAPI, error)

func (*MockLightningAPI) GetAPIType added in v0.0.49

func (m *MockLightningAPI) GetAPIType() APIType

func (*MockLightningAPI) GetChanInfo added in v0.0.49

func (m *MockLightningAPI) GetChanInfo(ctx context.Context, chanID uint64) (*NodeChannelAPI, error)

func (*MockLightningAPI) GetChannelCloseInfo added in v0.1.1

func (m *MockLightningAPI) GetChannelCloseInfo(ctx context.Context, chanIDs []uint64) ([]CloseInfo, error)

func (*MockLightningAPI) GetChannels added in v0.0.49

func (m *MockLightningAPI) GetChannels(ctx context.Context) (*ChannelsAPI, error)

func (*MockLightningAPI) GetForwardsRaw added in v0.0.49

func (m *MockLightningAPI) GetForwardsRaw(ctx context.Context, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

func (*MockLightningAPI) GetInfo added in v0.0.49

func (m *MockLightningAPI) GetInfo(ctx context.Context) (*InfoAPI, error)

func (*MockLightningAPI) GetInvoices added in v0.0.49

func (m *MockLightningAPI) GetInvoices(ctx context.Context, pendingOnly bool, pagination Pagination) (*InvoicesResponse, error)

func (*MockLightningAPI) GetInvoicesRaw added in v0.0.49

func (m *MockLightningAPI) GetInvoicesRaw(ctx context.Context, pendingOnly bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

func (*MockLightningAPI) GetNodeInfo added in v0.0.49

func (m *MockLightningAPI) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoAPI, error)

func (*MockLightningAPI) GetNodeInfoFull added in v0.0.49

func (m *MockLightningAPI) GetNodeInfoFull(ctx context.Context, channels, unannounced bool) (*NodeInfoAPIExtended, error)

func (*MockLightningAPI) GetOnChainAddress added in v0.0.49

func (m *MockLightningAPI) GetOnChainAddress(ctx context.Context) (string, error)

func (*MockLightningAPI) GetOnChainFunds added in v0.0.49

func (m *MockLightningAPI) GetOnChainFunds(ctx context.Context) (*Funds, error)

func (*MockLightningAPI) GetPaymentStatus added in v0.0.49

func (m *MockLightningAPI) GetPaymentStatus(ctx context.Context, paymentRequest string) (*PaymentResp, error)

func (*MockLightningAPI) GetPayments added in v0.0.49

func (m *MockLightningAPI) GetPayments(ctx context.Context, includeIncomplete bool, pagination Pagination) (*PaymentsResponse, error)

func (*MockLightningAPI) GetPaymentsRaw added in v0.0.49

func (m *MockLightningAPI) GetPaymentsRaw(ctx context.Context, includeIncomplete bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error)

func (*MockLightningAPI) GetRoute added in v0.2.2

func (m *MockLightningAPI) GetRoute(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (DeterminedRoute, error)

func (*MockLightningAPI) GetRoutes added in v0.2.2

func (m *MockLightningAPI) GetRoutes(ctx context.Context, source string, destination string, exclusions []Exclusion, optimizeFor OptimizeRouteFor, msats int64) (<-chan DeterminedRoute, error)

func (*MockLightningAPI) IsInvoicePaid added in v0.0.49

func (m *MockLightningAPI) IsInvoicePaid(ctx context.Context, paymentHash string) (bool, error)

func (*MockLightningAPI) PayInvoice added in v0.0.49

func (m *MockLightningAPI) PayInvoice(ctx context.Context, paymentRequest string, sats int64, outgoingChanIds []uint64) (*PaymentResp, error)

func (*MockLightningAPI) SendToOnChainAddress added in v0.0.49

func (m *MockLightningAPI) SendToOnChainAddress(ctx context.Context, address string, sats int64, useUnconfirmed bool, urgency Urgency) (string, error)

func (*MockLightningAPI) SubscribeForwards added in v0.0.49

func (m *MockLightningAPI) SubscribeForwards(ctx context.Context, since time.Time, batchSize uint16, maxErrors uint16) (<-chan []ForwardingEvent, <-chan ErrorData)

type NewAPICall added in v0.1.1

type NewAPICall func() (LightingAPICalls, error)

NewAPICall is the signature of the function to get Lightning API

func GetLocalCln added in v0.1.1

func GetLocalCln(t *testing.T, name string) NewAPICall

func GetLocalLnd added in v0.1.1

func GetLocalLnd(t *testing.T, name string, endpoint string) NewAPICall

func GetLocalLndByName added in v0.1.1

func GetLocalLndByName(t *testing.T, name string) NewAPICall

func GetTestnetLnd added in v0.1.1

func GetTestnetLnd(t *testing.T) NewAPICall

type NodeAddressAPI

type NodeAddressAPI struct {
	Network string `json:"network,omitempty"`
	Addr    string `json:"addr,omitempty"`
}

NodeAddressAPI struct.

func ConvertAddresses

func ConvertAddresses(addr []ClnListNodeAddr) []NodeAddressAPI

ConvertAddresses converts CLN addresses to interanl format.

type NodeChannelAPI

type NodeChannelAPI struct {
	ChannelID   uint64            `json:"channel_id,omitempty"`
	ChanPoint   string            `json:"chan_point"`
	Node1Pub    string            `json:"node1_pub,omitempty"`
	Node2Pub    string            `json:"node2_pub,omitempty"`
	Capacity    uint64            `json:"capacity,omitempty"`
	Node1Policy *RoutingPolicyAPI `json:"node1_policy,omitempty"`
	Node2Policy *RoutingPolicyAPI `json:"node2_policy,omitempty"`
	LastUpdate  entities.JsonTime `json:"last_update,omitempty"`
}

NodeChannelAPI struct.

type NodeChannelAPIExtended

type NodeChannelAPIExtended struct {
	Private bool `json:"private,omitempty"`
	NodeChannelAPI
}

NodeChannelAPIExtended struct.

func ConvertChannelInternal

func ConvertChannelInternal(chans []ClnListChan, id uint64, chanpoint string) (*NodeChannelAPIExtended, error)

ConvertChannelInternal - convert CLN channel to internal format.

type NodeFeatureAPI

type NodeFeatureAPI struct {
	Name       string `json:"name,omitempty"`
	IsRequired bool   `json:"is_required,omitempty"`
	IsKnown    bool   `json:"is_known,omitempty"`
}

NodeFeatureAPI struct.

type NodeInfoAPI

type NodeInfoAPI struct {
	Node          DescribeGraphNodeAPI `json:"node,omitempty"`
	Channels      []NodeChannelAPI     `json:"channels"`
	NumChannels   uint32               `json:"num_channels"`
	TotalCapacity uint64               `json:"total_capacity"`
}

NodeInfoAPI struct.

type NodeInfoAPIExtended

type NodeInfoAPIExtended struct {
	NodeInfoAPI
	Channels []NodeChannelAPIExtended `json:"channels"`
}

NodeInfoAPIExtended struct.

type OptimizeRouteFor added in v0.2.2

type OptimizeRouteFor int

OptimizeRouteFor enum.

const (
	Reliability OptimizeRouteFor = iota
	Price
	None
)

OptimizeRouteFor values.

type Pagination added in v0.0.42

type Pagination struct {
	Offset    uint64 // Exclusive thus 1 means start from 2 (0 will start from beginning)
	BatchSize uint64 // limit is 10k or so
	Reversed  bool
	From      *time.Time
	To        *time.Time
}

Pagination struct.

type Payment added in v0.0.42

type Payment struct {
	PaymentHash     string
	ValueMsat       int64
	FeeMsat         int64
	PaymentPreimage string
	PaymentRequest  string
	PaymentStatus   PaymentStatus
	CreationTime    time.Time
	Index           uint64
	FailureReason   PaymentFailureReason
	HTLCAttempts    []HTLCAttempt
}

Payment struct.

type PaymentFailureReason added in v0.0.42

type PaymentFailureReason int

PaymentFailureReason enum.

const (
	FailureReasonNone PaymentFailureReason = 0
	FailureReasonTimeout
	FailureReasonNoRoute
	FailureReasonError
	FailureReasonIncorrectPaymentDetails
	FailureReasonInsufficientBalance
)

PaymentFailureReason values.

type PaymentOverride added in v0.0.42

type PaymentOverride struct {
	Value          string                 `json:"value,omitempty"`
	CreationDate   string                 `json:"creation_date,omitempty"`
	Fee            string                 `json:"fee,omitempty"`
	ValueSat       string                 `json:"value_sat,omitempty"`
	ValueMsat      string                 `json:"value_msat,omitempty"`
	Status         string                 `json:"status,omitempty"`
	FeeSat         string                 `json:"fee_sat,omitempty"`
	FeeMsat        string                 `json:"fee_msat,omitempty"`
	CreationTimeNs string                 `json:"creation_time_ns,omitempty"`
	Htlcs          []*HTLCAttemptOverride `json:"htlcs,omitempty"`
	PaymentIndex   string                 `json:"payment_index,omitempty"`
	FailureReason  string                 `json:"failure_reason,omitempty"`

	lnrpc.Payment
}

PaymentOverride struct.

type PaymentResp added in v0.0.49

type PaymentResp struct {
	Hash     string
	Preimage string
	Status   PaymentStatusEnum
}

PaymentResp struct.

type PaymentStatus added in v0.0.42

type PaymentStatus int

PaymentStatus enum.

const (
	PaymentUnknown PaymentStatus = iota
	PaymentInFlight
	PaymentSucceeded
	PaymentFailed
)

PaymentStatus values.

func StringToPaymentStatus added in v0.0.42

func StringToPaymentStatus(in string) PaymentStatus

StringToPaymentStatus creates PaymentStatus based on a string.

type PaymentStatusEnum added in v0.0.49

type PaymentStatusEnum int

PaymentStatusEnum basic enum.

const (
	Failed PaymentStatusEnum = iota
	Pending
	Success
)

PaymentStatusEnum enum.

type PaymentsResponse added in v0.0.42

type PaymentsResponse struct {
	Payments []Payment
	ResponsePagination
}

PaymentsResponse struct.

type PriorityQueue added in v0.2.2

type PriorityQueue []*Item

A PriorityQueue implements heap.Interface and holds Items.

func (*PriorityQueue) Contains added in v0.2.2

func (pq *PriorityQueue) Contains(value DeterminedRoute) bool

Contains - check whether priority queue contains element

func (PriorityQueue) Len added in v0.2.2

func (pq PriorityQueue) Len() int

Len - returns number of items in the PriorityQueue

func (PriorityQueue) Less added in v0.2.2

func (pq PriorityQueue) Less(i, j int) bool

Less - is element i less than element j

func (*PriorityQueue) Pop added in v0.2.2

func (pq *PriorityQueue) Pop() any

Pop - return last element from queue

func (*PriorityQueue) Push added in v0.2.2

func (pq *PriorityQueue) Push(x any)

Push - add ne element to queue

func (PriorityQueue) Swap added in v0.2.2

func (pq PriorityQueue) Swap(i, j int)

Swap - swap elements i and j

type RawMessage added in v0.0.42

type RawMessage struct {
	Timestamp      time.Time       `json:"timestamp"`
	Implementation string          `json:"implementation,omitempty"`
	Message        json.RawMessage `json:"message,omitempty"`
}

RawMessage struct.

type RawPagination added in v0.0.42

type RawPagination struct {
	UseTimestamp bool
	FirstTime    time.Time
	LastTime     time.Time
	Pagination
}

RawPagination struct.

type ResponseForwardPagination added in v0.0.42

type ResponseForwardPagination struct {
	LastOffsetIndex uint64
}

ResponseForwardPagination struct.

type ResponsePagination added in v0.0.42

type ResponsePagination struct {
	ResponseForwardPagination
	FirstOffsetIndex uint64
}

ResponsePagination struct.

type ResponseRawPagination added in v0.0.42

type ResponseRawPagination struct {
	UseTimestamp bool
	FirstTime    time.Time
	LastTime     time.Time
	ResponsePagination
}

ResponseRawPagination struct.

type Route added in v0.0.42

type Route struct {
	TotalTimeLock uint32
	TotalFeesMsat int64
	TotalAmtMsat  int64

	Hops []Hop
}

Route struct.

type RouteElement added in v0.2.2

type RouteElement struct {
	PubKey            string
	OutgoingChannelId uint64
}

RouteElement struct.

type RouteHintOverride added in v0.0.42

type RouteHintOverride struct {
	HopHints []*HopHintOverride `json:"hop_hints,omitempty"`

	lnrpc.RouteHint
}

RouteHintOverride struct.

type RouteOverride added in v0.0.42

type RouteOverride struct {
	TotalFees     string         `json:"total_fees,omitempty"`
	TotalAmt      string         `json:"total_amt,omitempty"`
	Hops          []*HopOverride `json:"hops,omitempty"`
	TotalFeesMsat string         `json:"total_fees_msat,omitempty"`
	TotalAmtMsat  string         `json:"total_amt_msat,omitempty"`

	lnrpc.Route
}

RouteOverride struct.

type RoutingPolicyAPI

type RoutingPolicyAPI struct {
	TimeLockDelta uint32            `json:"time_lock_delta"`
	MinHtlc       uint64            `json:"min_htlc"`
	BaseFee       uint64            `json:"fee_base_msat"`
	FeeRate       uint64            `json:"fee_rate_milli_msat"`
	Disabled      bool              `json:"disabled,omitempty"`
	LastUpdate    entities.JsonTime `json:"last_update,omitempty"`
	MaxHtlc       uint64            `json:"max_htlc_msat"`
}

RoutingPolicyAPI struct.

type RoutingPolicyOverride

type RoutingPolicyOverride struct {
	MinHtlc          string `json:"min_htlc,omitempty"`
	FeeBaseMsat      string `json:"fee_base_msat,omitempty"`
	FeeRateMilliMsat string `json:"fee_rate_milli_msat,omitempty"`
	MaxHtlcMsat      string `json:"max_htlc_msat,omitempty"`

	lnrpc.RoutingPolicy
}

RoutingPolicyOverride struct.

type SendCoinsRequestOverride added in v0.0.49

type SendCoinsRequestOverride struct {
	Amount      string `json:"amount,omitempty"`
	SatPerVbyte string `json:"sat_per_vbyte,omitempty"`
	// Deprecated
	SatPerByte string `json:"sat_per_byte,omitempty"`
	lnrpc.SendCoinsRequest
}

SendCoinsRequestOverride struct.

type SendPaymentRequestOverride added in v0.0.49

type SendPaymentRequestOverride struct {
	Dest         string `json:"dest,omitempty"`
	Amt          string `json:"amt,omitempty"`
	AmtMsat      string `json:"amt_msat,omitempty"`
	PaymentHash  string `json:"payment_hash,omitempty"`
	PaymentAddr  string `json:"payment_addr,omitempty"`
	FeeLimitSat  string `json:"fee_limit_sat,omitempty"`
	FeeLimitMsat string `json:"fee_limit_msat,omitempty"`
	// Deprecated: Do not use.
	OutgoingChanId    string                         `json:"outgoing_chan_id,omitempty"`
	OutgoingChanIds   []string                       `json:"outgoing_chan_ids,omitempty"`
	LastHopPubkey     string                         `json:"last_hop_pubkey,omitempty"`
	RouteHints        []RouteHintOverride            `json:"route_hints,omitempty"`
	DestCustomRecords DestCustomRecordsEntryOverride `json:"dest_custom_records,omitempty"`
	DestFeatures      []lnrpc.FeatureBit             `json:"dest_features,omitempty"`
	MaxShardSizeMsat  string                         `json:"max_shard_size_msat,omitempty"`

	routerrpc.SendPaymentRequest
}

SendPaymentRequestOverride struct.

type TrackPaymentRequestOverride added in v0.0.49

type TrackPaymentRequestOverride struct {
	PaymentHash string `json:"payment_hash,omitempty"`
	routerrpc.TrackPaymentRequest
}

TrackPaymentRequestOverride struct.

type Urgency added in v0.0.49

type Urgency int

Urgency of the on-chain sending

const (
	Low Urgency = iota
	Normal
	Urgent
)

Urgency enum.

type WalletBalanceResponseOverride added in v0.0.49

type WalletBalanceResponseOverride struct {
	TotalBalance              string          `json:"total_balance,omitempty"`
	ConfirmedBalance          string          `json:"confirmed_balance,omitempty"`
	UnconfirmedBalance        string          `json:"unconfirmed_balance,omitempty"`
	LockedBalance             string          `json:"locked_balance,omitempty"`
	ReservedBalanceAnchorChan string          `json:"reserved_balance_anchor_chan,omitempty"`
	AccountBalance            json.RawMessage `json:"account_balance,omitempty"`

	lnrpc.WalletBalanceResponse
}

WalletBalanceResponseOverride struct.

Directories

Path Synopsis
Package mock_lnrpc is a generated GoMock package.
Package mock_lnrpc is a generated GoMock package.

Jump to

Keyboard shortcuts

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