storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProofNotFound = errors.New("proof not found")
)

Functions

This section is empty.

Types

type BoltDB

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

func InitBolt

func InitBolt(path string) (*BoltDB, error)

func (*BoltDB) AddPendingProofsByQuoteId added in v0.3.0

func (db *BoltDB) AddPendingProofsByQuoteId(proofs cashu.Proofs, quoteId string) error

func (*BoltDB) DeletePendingProofs added in v0.3.0

func (db *BoltDB) DeletePendingProofs(Ys []string) error

func (*BoltDB) DeletePendingProofsByQuoteId added in v0.3.0

func (db *BoltDB) DeletePendingProofsByQuoteId(quoteId string) error

func (*BoltDB) DeleteProof

func (db *BoltDB) DeleteProof(secret string) error

func (*BoltDB) GetInvoice

func (db *BoltDB) GetInvoice(paymentHash string) *Invoice

func (*BoltDB) GetInvoiceByQuoteId added in v0.3.0

func (db *BoltDB) GetInvoiceByQuoteId(quoteId string) *Invoice

func (*BoltDB) GetInvoices

func (db *BoltDB) GetInvoices() []Invoice

func (*BoltDB) GetKeyset added in v0.2.0

func (db *BoltDB) GetKeyset(keysetId string) *crypto.WalletKeyset

func (*BoltDB) GetKeysetCounter added in v0.2.0

func (db *BoltDB) GetKeysetCounter(keysetId string) uint32

func (*BoltDB) GetKeysets

func (db *BoltDB) GetKeysets() crypto.KeysetsMap

func (*BoltDB) GetMnemonic added in v0.2.0

func (db *BoltDB) GetMnemonic() string

func (*BoltDB) GetPendingProofs added in v0.3.0

func (db *BoltDB) GetPendingProofs() []DBProof

func (*BoltDB) GetPendingProofsByQuoteId added in v0.3.0

func (db *BoltDB) GetPendingProofsByQuoteId(quoteId string) []DBProof

func (*BoltDB) GetProofs

func (db *BoltDB) GetProofs() cashu.Proofs

return all proofs from db

func (*BoltDB) GetProofsByKeysetId

func (db *BoltDB) GetProofsByKeysetId(id string) cashu.Proofs

func (*BoltDB) GetSeed added in v0.2.0

func (db *BoltDB) GetSeed() []byte

func (*BoltDB) IncrementKeysetCounter added in v0.2.0

func (db *BoltDB) IncrementKeysetCounter(keysetId string, num uint32) error

func (*BoltDB) SaveInvoice

func (db *BoltDB) SaveInvoice(invoice Invoice) error

func (*BoltDB) SaveKeyset

func (db *BoltDB) SaveKeyset(keyset *crypto.WalletKeyset) error

func (*BoltDB) SaveMnemonicSeed added in v0.2.0

func (db *BoltDB) SaveMnemonicSeed(mnemonic string, seed []byte)

func (*BoltDB) SaveProofs added in v0.3.0

func (db *BoltDB) SaveProofs(proofs cashu.Proofs) error

type DBProof added in v0.3.0

type DBProof struct {
	Y      string           `json:"y"`
	Amount uint64           `json:"amount"`
	Id     string           `json:"id"`
	Secret string           `json:"secret"`
	C      string           `json:"C"`
	DLEQ   *cashu.DLEQProof `json:"dleq,omitempty"`
	// set if proofs are tied to a melt quote
	MeltQuoteId string `json:"quote_id"`
}

type Invoice added in v0.2.0

type Invoice struct {
	TransactionType QuoteType
	// mint or melt quote id
	Id string
	// mint that issued quote
	Mint           string
	QuoteAmount    uint64
	InvoiceAmount  uint64
	PaymentRequest string
	PaymentHash    string
	Preimage       string
	CreatedAt      int64
	Paid           bool
	SettledAt      int64
	QuoteExpiry    uint64
}

type QuoteType added in v0.2.0

type QuoteType int
const (
	Mint QuoteType = iota + 1
	Melt
)

func (QuoteType) String added in v0.2.0

func (quote QuoteType) String() string

type WalletDB added in v0.3.0

type WalletDB interface {
	SaveMnemonicSeed(string, []byte)
	GetSeed() []byte
	GetMnemonic() string

	SaveProofs(cashu.Proofs) error
	GetProofs() cashu.Proofs
	GetProofsByKeysetId(string) cashu.Proofs
	DeleteProof(string) error

	AddPendingProofsByQuoteId(cashu.Proofs, string) error
	GetPendingProofs() []DBProof
	GetPendingProofsByQuoteId(string) []DBProof
	DeletePendingProofsByQuoteId(string) error

	SaveKeyset(*crypto.WalletKeyset) error
	GetKeysets() crypto.KeysetsMap
	GetKeyset(string) *crypto.WalletKeyset
	IncrementKeysetCounter(string, uint32) error
	GetKeysetCounter(string) uint32

	SaveInvoice(Invoice) error
	GetInvoice(string) *Invoice
	GetInvoiceByQuoteId(string) *Invoice
	GetInvoices() []Invoice
}

Jump to

Keyboard shortcuts

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