client

package
v0.0.0-...-2bfee4e Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: ISC Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimatedInvoiceAmount

func EstimatedInvoiceAmount(channelSize uint64, feeRate float64) uint64

EstimatedInvoiceAmount returns the estimated invoice amount from the LP server when the fee rate for creating the channel is the specified one.

Types

type Client

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

Client is a client to the LN Liquidity Provider. It can perform a request for inbound liquidity to a remote server.

func New

func New(cfg Config) (*Client, error)

func (*Client) RequestChannel

func (c *Client) RequestChannel(ctx context.Context, channelSize uint64) error

RequestChannel requests a new channel from the liquidity provider with the specified target size (in atoms).

type Config

type Config struct {
	// LC is the lightning client used to pay for the invoice and is the
	// target of the created channels.
	LC lnrpc.LightningClient

	// Address is the address of the LP server.
	Address string

	// Key is the optional key needed to request invoices from the LP
	// server.
	Key string

	// PolicyFetched is called once the LP policy for creating channels is
	// fetched. If this function returns an error, then channel creation is
	// aborted.
	PolicyFetched func(policy ServerPolicy) error

	// PayingInvoice is called just before starting to pay the invoice.
	PayingInvoice func(payHash string)

	// InvoicePaid is called after the invoice was settled.
	InvoicePaid func()

	// PendingChannel is called when the channel opened by the remote host
	// is found as pending.
	PendingChannel func(chanID string, capacity uint64)

	// Certificates are the bytes for a PEM-encoded certificate chain used
	// for the TLS connection.
	Certificates []byte
}

Config holds the config needed to start a new run of an LPD client.

type ServerPolicy

type ServerPolicy = lprpc_v1.PolicyResponse

Jump to

Keyboard shortcuts

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