walletdb

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func Open

func Open(path string) (*DB, error)

func (*DB) Close

func (d *DB) Close()

func (*DB) CountUnusedInvoices

func (d *DB) CountUnusedInvoices() (int, error)

func (*DB) CreateInvoice

func (d *DB) CreateInvoice(invoice *Invoice) error

func (*DB) FindByPaymentHash

func (d *DB) FindByPaymentHash(hash []byte) (*Invoice, error)

func (*DB) FindFirstUnusedInvoice

func (d *DB) FindFirstUnusedInvoice() (*Invoice, error)

func (*DB) SaveInvoice

func (d *DB) SaveInvoice(invoice *Invoice) error

type Invoice

type Invoice struct {
	gorm.Model
	Preimage      []byte
	PaymentHash   []byte
	PaymentSecret []byte
	KeyPath       string
	ShortChanId   uint64
	AmountSat     int64
	State         InvoiceState
	Metadata      string
	UsedAt        *time.Time
}

TODO: probably rename to InvoiceSecrets or similar

type InvoiceState

type InvoiceState string
const (
	InvoiceStateRegistered InvoiceState = "registered"
	InvoiceStateUsed       InvoiceState = "used"
)

Jump to

Keyboard shortcuts

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