makeinvoice

package module
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: Unlicense Imports: 17 Imported by: 0

README

makeinvoice

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

Currently supports Sparko, LND REST and LNbits.

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"

Functions

func MakeInvoice

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

Types

type BackendParams

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

type LNBitsParams

type LNBitsParams struct {
	Cert string
	Host string
	Key  string
}

type LNDParams

type LNDParams struct {
	Cert     string
	Host     string
	Macaroon string
}

type LNPayParams

type LNPayParams struct {
	PublicAccessKey  string
	WalletInvoiceKey string
}

type Params

type Params struct {
	Backend         BackendParams
	Msatoshi        int64
	Description     string
	DescriptionHash []byte

	Label string // only used for c-lightning
}

type SparkoParams

type SparkoParams struct {
	Cert string
	Host string
	Key  string
}

Jump to

Keyboard shortcuts

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