lightning

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Wrap lightning network node implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Edge
	ChannelID     ChannelID
	LocalBalance  Satoshi
	RemoteBalance Satoshi
	RemoteNode    Node
}

Channel between local and remote node.

func (Channel) Liquidity

func (c Channel) Liquidity() float64

Liquidity of the channel.

func (Channel) LiquidityLevel added in v0.3.0

func (c Channel) LiquidityLevel() ChannelLiquidityLevel

LiquidityLevel of the channel.

type ChannelID added in v0.2.1

type ChannelID uint64

ChannelID for channel.

type ChannelLiquidityLevel added in v0.3.0

type ChannelLiquidityLevel string

ChannelLiquidityLevel coarse-grained bucket based on current liquidity.

const (
	LowLiquidity      ChannelLiquidityLevel = "low"
	StandardLiquidity ChannelLiquidityLevel = "standard"
	HighLiquidity     ChannelLiquidityLevel = "high"
)

ChannelLiquidityLevels

type Channels

type Channels []Channel

Channels of node.

func (Channels) HighLiquidity

func (cs Channels) HighLiquidity() Channels

HighLiquidity channels of node.

func (Channels) LowLiquidity

func (cs Channels) LowLiquidity() Channels

LowLiquidity channels of node.

type Edge

type Edge struct {
	Capacity Satoshi
	Node1    string
	Node2    string
}

Edge between nodes in the Lightning Network.

type FeePPM

type FeePPM float64

FeePPM is the channel fee in part per million.

func (FeePPM) Rate

func (f FeePPM) Rate() float64

Rate of fee.

type Forward added in v0.2.0

type Forward struct {
	Timestamp  time.Time
	ChannelIn  ChannelID
	ChannelOut ChannelID
}

Forward routing event.

type Graph

type Graph struct {
	Nodes []Node
	Edges []Edge
}

Graph of nodes and edges of the Lightning Network.

type Info

type Info struct {
	Pubkey string
}

Info of a node.

type Invoice added in v0.2.1

type Invoice string

Invoice for lightning payment.

type Lightning

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

Lightning client backed by LND node.

func New

func New(c channeler, i invoicer, r router) Lightning

New Lightning instance.

func (Lightning) AddInvoice

func (l Lightning) AddInvoice(ctx context.Context, amount Satoshi) (Invoice, error)

AddInvoice of amount.

func (Lightning) DescribeGraph

func (l Lightning) DescribeGraph(ctx context.Context) (*Graph, error)

DescribeGraph of the Lightning Network.

func (Lightning) ForwardingHistory added in v0.2.0

func (l Lightning) ForwardingHistory(ctx context.Context, since time.Time) ([]Forward, error)

ForwardingHistory of node since the time give, capped at 50,000 events.

func (Lightning) GetChannel

func (l Lightning) GetChannel(ctx context.Context, channelID ChannelID) (Channel, error)

GetChannel with ID.

func (Lightning) GetInfo

func (l Lightning) GetInfo(ctx context.Context) (*Info, error)

GetInfo of local node.

func (Lightning) ListChannels

func (l Lightning) ListChannels(ctx context.Context) (Channels, error)

ListChannels of local node.

func (Lightning) SendPayment

func (l Lightning) SendPayment(ctx context.Context, invoice Invoice, outChannelID ChannelID, lastHopPubkey string, maxFee Satoshi) (Satoshi, error)

SendPayment to pay for invoice.

func (Lightning) SetFees

func (l Lightning) SetFees(ctx context.Context, channelID ChannelID, fee FeePPM) error

SetFees for channel with rate in ppm.

type Node

type Node struct {
	PubKey    string
	Alias     string
	Updated   time.Time
	Addresses []string
}

Node in the Lightning Network.

func (Node) Clearnet

func (n Node) Clearnet() bool

Clearnet is true if node has a clearnet address.

type Satoshi

type Satoshi int64

Satoshi unit of bitcoin.

func (Satoshi) BTC

func (s Satoshi) BTC() float64

BTC value of Satoshi.

Jump to

Keyboard shortcuts

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