sqlite

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

A Store is a persistent store that uses a SQL database as its backend.

func OpenDatabase

func OpenDatabase(fp string, log *zap.Logger) (*Store, error)

OpenDatabase creates a new SQLite store and initializes the database. If the database does not exist, it is created.

func (*Store) Close

func (s *Store) Close() error

Close closes the underlying database.

func (*Store) LastWalletChange

func (s *Store) LastWalletChange() (id modules.ConsensusChangeID, height uint64, err error)

LastWalletChange gets the last consensus change processed by the wallet.

func (*Store) ResetWallet

func (s *Store) ResetWallet() error

ResetWallet resets the wallet to its initial state. This is used when a consensus subscription error occurs.

func (*Store) SetLogger

func (s *Store) SetLogger(log *zap.Logger)

SetLogger sets the logger used by the store.

func (*Store) TransactionCount

func (s *Store) TransactionCount() (count uint64, err error)

TransactionCount returns the total number of transactions in the wallet.

func (*Store) Transactions

func (s *Store) Transactions(limit, offset int) (txns []wallet.Transaction, err error)

Transactions returns a paginated list of transactions ordered by block height descending. If no transactions are found, (nil, nil) is returned.

func (*Store) UnspentSiacoinElements

func (s *Store) UnspentSiacoinElements() (utxos []wallet.SiacoinElement, err error)

UnspentSiacoinElements returns the spendable siacoin outputs in the wallet.

func (*Store) UpdateWallet

func (s *Store) UpdateWallet(ccID modules.ConsensusChangeID, height uint64, fn func(wallet.UpdateTransaction) error) error

UpdateWallet begins an update transaction on the wallet store.

func (*Store) VerifyWalletKey

func (s *Store) VerifyWalletKey(seedHash types.Hash256) error

VerifyWalletKey checks that the wallet seed matches the seed hash. This detects if the user's recovery phrase has changed and the wallet needs to rescan.

Jump to

Keyboard shortcuts

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