lnbits

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(key, url string) lightning.Client

NewClient returns a new lnbits api client. Pass your API key and url here.

func NewInvoice

func NewInvoice() lightning.Invoicer

Types

type Client

type Client struct {
	AdminKey   string
	InvoiceKey string
	// contains filtered or unexported fields
}

func (*Client) CreateInvoice

func (c *Client) CreateInvoice(amount int64, memo string) (lightning.Invoicer, error)

Invoice creates an invoice associated with this wallet.

func (Client) GetPaymentStatus

func (c Client) GetPaymentStatus(payment_hash string) (payment lightning.Payment, err error)

Payment state of a payment

func (Client) InvoiceStatus

func (c Client) InvoiceStatus(paymentHash string) (lightning.Payment, error)

Payment state of a payment

func (*Client) Pay

func (c *Client) Pay(paymentRequest string) (wtx lightning.Invoicer, err error)

Pay pays a given invoice with funds from the wallet.

func (Client) Status

func (c Client) Status() (wtx Wallet, err error)

Info returns wallet information

type Error

type Error struct {
	Detail string `json:"detail"`
}

func (Error) Error

func (err Error) Error() string

type InvoiceParams

type InvoiceParams struct {
	Out                 bool   `json:"out"`                            // must be True if invoice is paid, False if invoice is received
	Amount              int64  `json:"amount"`                         // amount in Satoshi
	Memo                string `json:"memo,omitempty"`                 // the invoice memo.
	Webhook             string `json:"webhook,omitempty"`              // the webhook to fire back to when payment is received.
	DescriptionHash     string `json:"description_hash,omitempty"`     // the invoice description hash.
	UnhashedDescription string `json:"unhashed_description,omitempty"` // the unhashed invoice description.
}

type LNbitsPayment

type LNbitsPayment struct {
	Paid     bool           `json:"paid"`
	Preimage string         `json:"preimage"`
	Details  PaymentDetails `json:"details,omitempty"`
}

func (LNbitsPayment) GetPreimage

func (p LNbitsPayment) GetPreimage() string

func (LNbitsPayment) IsPaid

func (p LNbitsPayment) IsPaid() bool

type PayParams

type PayParams struct {
	// the BOLT11 payment request you want to pay.
	PaymentRequest string `json:"payment_request"`

	// custom data you may want to associate with this invoice. optional.
	PassThru map[string]interface{} `json:"passThru"`
}

type PaymentDetails

type PaymentDetails struct {
	CheckingID    string      `json:"checking_id"`
	Pending       bool        `json:"pending"`
	Amount        int64       `json:"amount"`
	Fee           uint64      `json:"fee"`
	Memo          string      `json:"memo"`
	Time          int         `json:"time"`
	Bolt11        string      `json:"bolt11"`
	Preimage      string      `json:"preimage"`
	PaymentHash   string      `json:"payment_hash"`
	Extra         struct{}    `json:"extra"`
	WalletID      string      `json:"wallet_id"`
	Webhook       interface{} `json:"webhook"`
	WebhookStatus interface{} `json:"webhook_status"`
}

type PaymentParams

type PaymentParams struct {
	Out          bool   `json:"out"`
	Bolt11       string `json:"bolt11"`
	FeeLimitMSat int64  `json:"feeLimitMSat"`
}

type Payments

type Payments []PaymentDetails

type TransferParams

type TransferParams struct {
	Memo         string `json:"memo"`           // the transfer description.
	NumSatoshis  uint64 `json:"num_satoshis"`   // the transfer amount.
	DestWalletId string `json:"dest_wallet_id"` // the key or id of the destination
}

type Wallet

type Wallet struct {
	ID       string `json:"id" gorm:"id"`
	Adminkey string `json:"adminkey"`
	Inkey    string `json:"inkey"`
	Balance  uint64 `json:"balance"`
	Name     string `json:"name"`
	User     string `json:"user"`
}

Jump to

Keyboard shortcuts

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