makeinvoice

package module
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Unlicense Imports: 21 Imported by: 5 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

makeinvoice

A simple function capable of generating an invoice in multiple Lightning backends.

Currently supports Sparko, LND REST, LNbits, LNPay, Eclair and Commando.

Usage

package main

import "github.com/fiatjaf/makeinvoice"

func main () {
	bolt11, err := makeinvoice.MakeInvoice(makeinvoice.Params{
		Msatoshi: 100000,
		Backend: LNDParams{
			Host: "https://my.lnd.com:1234",
			Macaroon: "0201036c6e640258030a10e82b814c2a3871f9753984e0f5e01ffb1201301a160a0761646472657373120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a0f0a076f6e636861696e1204726561640000062087d4b068ad6b4d912680b3e0d912ca02936733a3377f246aa32bf354aa74ab2d",
		},
		DescriptionHash: []byte("fd85a881de24b15942425e61bdccf581a84b70ac2128490b8d14ea53fd6b8815"),
	})
}

See https://pkg.go.dev/github.com/fiatjaf/makeinvoice for the full docs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TorProxyURL = "socks5://127.0.0.1:9050"
	Client      = &http.Client{
		Timeout: 10 * time.Second,
	}
)

Functions

func MakeInvoice

func MakeInvoice(params Params) (bolt11 string, err error)

Types

type BackendParams

type BackendParams interface {
	// contains filtered or unexported methods
}

type CommandoParams added in v1.4.0

type CommandoParams struct {
	Rune   string
	Host   string
	NodeId string
}

type EclairParams added in v1.3.0

type EclairParams struct {
	Host     string
	Password string
	Cert     string
}

type LNBitsParams

type LNBitsParams struct {
	Cert string
	Host string
	Key  string
}

type LNDParams

type LNDParams struct {
	Cert     string
	Host     string
	Macaroon string
	Private  bool
}

type LNPayParams added in v1.2.0

type LNPayParams struct {
	PublicAccessKey  string
	WalletInvoiceKey string
}

type Params

type Params struct {
	Backend     BackendParams
	Msatoshi    int64
	Description string

	// setting this to true will cause .Description to be hashed and used as
	// the description_hash (h) field on the bolt11 invoice
	UseDescriptionHash bool

	Label string // only used for c-lightning
}

type SparkoParams

type SparkoParams struct {
	Cert string
	Host string
	Key  string
}

type StrikeParams added in v1.4.0

type StrikeParams struct {
	Key      string
	Username string
	Currency string
}

Jump to

Keyboard shortcuts

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