ln

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2018 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ln contains the Lightning Network-related code.

There should be no need to use this package when implementing a web service that uses ln-paywall.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLNDoptions = LNDoptions{
	Address:      "localhost:10009",
	CertFile:     "tls.cert",
	MacaroonFile: "invoice.macaroon",
}

DefaultLNDoptions provides default values for LNDoptions.

Functions

func HashPreimage

func HashPreimage(preimage string) (string, error)

HashPreimage hashes the Base64 preimage and encodes the hash in Base64. It's the same format that's being shown by lncli listinvoices (preimage as well as hash).

Types

type LNDclient added in v0.3.0

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

LNDclient is an implementation of the wall.Client interface for the lnd Lightning Network node implementation.

func NewLNDclient added in v0.3.0

func NewLNDclient(lndOptions LNDoptions) (LNDclient, error)

NewLNDclient creates a new LNDclient instance.

func (LNDclient) CheckInvoice added in v0.3.0

func (c LNDclient) CheckInvoice(preimage string) (bool, error)

CheckInvoice takes a Base64 encoded preimage, fetches the corresponding invoice, and checks if the invoice was settled. An error is returned if the preimage contains invalid Base64 characters or if no corresponding invoice was found. False is returned if the invoice isn't settled.

func (LNDclient) GenerateInvoice added in v0.3.0

func (c LNDclient) GenerateInvoice(amount int64, memo string) (string, error)

GenerateInvoice generates an invoice with the given price and memo.

type LNDoptions added in v0.4.0

type LNDoptions struct {
	// Address of your LND node, including the port.
	// Optional ("localhost:10009" by default).
	Address string
	// Path to the "tls.cert" file that your LND node uses.
	// Optional ("tls.cert" by default).
	CertFile string
	// Path to the "invoice.macaroon" file that your LND node uses.
	// Optional ("invoice.macaroon" by default).
	MacaroonFile string
}

LNDoptions are the options for the connection to the lnd node.

Jump to

Keyboard shortcuts

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