lnurl

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK    = "OK"
	StatusError = "ERROR"
)
View Source
const (
	ErrNone                int = 0
	ErrDecode              int = 1
	ErrUnsafeURL           int = 2
	ErrUnreachable         int = 3
	ErrInvalidResponse     int = 4
	ErrResponse            int = 5
	ErrUnknown             int = 6
	ErrWrongTag            int = 7
	ErrNoAvailableBalance  int = 8
	ErrRequestExpired      int = 9
	ErrNoRoute             int = 10
	ErrTorNotSupported     int = 11
	ErrAlreadyUsed         int = 12
	ErrForbidden           int = 13
	ErrCountryNotSupported int = 14 // By LNURL Service Provider

	StatusContacting     int = 100
	StatusInvoiceCreated int = 101
	StatusReceiving      int = 102
)

After adding new codes here, remember to export them in the root libwallet module so that the apps can consume them.

Variables

This section is empty.

Functions

func Validate

func Validate(qr string) bool

func Withdraw

func Withdraw(qr string, createInvoiceFunc CreateInvoiceFunction, allowUnsafe bool, notify func(e *Event))

Withdraw will parse an LNURL withdraw QR and begin a withdraw process. Caller must wait for the actual payment after this function has notified success.

Types

type CreateInvoiceFunction

type CreateInvoiceFunction func(amt lnwire.MilliSatoshi, desc string, host string) (string, error)

type Event

type Event struct {
	Code     int
	Message  string
	Metadata EventMetadata
}

type EventMetadata

type EventMetadata struct {
	Host    string
	Invoice string
}

type Response

type Response struct {
	Status string `json:"status,omitempty"`
	Reason string `json:"reason,omitempty"`
}

func (*Response) Validate

func (fr *Response) Validate() (int, string)

type WithdrawResponse

type WithdrawResponse struct {
	Response
	Tag                string         `json:"tag"`
	K1                 string         `json:"k1"`
	Callback           string         `json:"callback"`
	MaxWithdrawable    stringOrNumber `json:"maxWithdrawable"`
	MinWithdrawable    stringOrNumber `json:"minWithdrawable"`
	DefaultDescription string         `json:"defaultDescription"`
}

func (*WithdrawResponse) Validate

func (wr *WithdrawResponse) Validate() (int, string)

Jump to

Keyboard shortcuts

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