sqlitestorage

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version1 = 1 // Initial version

	VersionLatest = Version1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v1.14.0

type Option func(*settings)

Option configures SQLite settings.

func WithLockingMode added in v1.14.0

func WithLockingMode(lockMode bool) Option

WithLockingMode sets SQLite locking mode (e.g. NORMAL, EXCLUSIVE).

type Storage

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

Storage represents the SQLite-based wallet storage implementing IStorage interface.

func Create

func Create(ctx context.Context, path string, network genesis.ChainType, vlt *vault.Vault,
	opts ...Option,
) (*Storage, error)

Create creates a new SQLite storage instance and initializes the schema.

func Open

func Open(ctx context.Context, path string, opts ...Option) (*Storage, error)

Open opens an existing SQLite storage instance without creating schema.

func (*Storage) AddressCount

func (s *Storage) AddressCount() int

AddressCount returns the number of addresses in the wallet.

func (*Storage) AddressInfo

func (s *Storage) AddressInfo(address string) (*wtypes.AddressInfo, error)

AddressInfo returns the address information for the given address.

func (*Storage) AllAddresses

func (s *Storage) AllAddresses() []wtypes.AddressInfo

AllAddresses returns all addresses in the wallet.

func (*Storage) Clone

func (s *Storage) Clone(path string) (storage.IStorage, error)

Clone creates a copy of the storage at a new path.

func (*Storage) Close

func (s *Storage) Close() error

Close closes the database connection.

func (*Storage) GetPendingTransactions

func (s *Storage) GetPendingTransactions() (map[string]*wtypes.TransactionInfo, error)

GetPendingTransactions returns pending transactions keyed by transaction ID.

func (*Storage) GetTransaction

func (s *Storage) GetTransaction(no int64) (*wtypes.TransactionInfo, error)

GetTransaction retrieves a transaction by primary key.

func (*Storage) HasAddress

func (s *Storage) HasAddress(address string) bool

HasAddress checks if an address exists.

func (*Storage) HasTransaction

func (s *Storage) HasTransaction(txID string) bool

HasTransaction checks if a transaction exists by transaction ID.

func (*Storage) InsertAddress

func (s *Storage) InsertAddress(info *wtypes.AddressInfo) error

InsertAddress inserts a new address.

func (*Storage) InsertTransaction

func (s *Storage) InsertTransaction(info *wtypes.TransactionInfo) error

InsertTransaction inserts a new transaction.

func (*Storage) IsLegacy

func (*Storage) IsLegacy() bool

func (*Storage) QueryTransactions

func (s *Storage) QueryTransactions(params storage.QueryParams) ([]*wtypes.TransactionInfo, error)

QueryTransactions returns transactions matching the provided filters with pagination. Empty or "*" address value is treated as no filter. Filters are combined with AND.

func (*Storage) SetDefaultFee

func (s *Storage) SetDefaultFee(fee amount.Amount) error

SetDefaultFee sets the default fee.

func (*Storage) UpdateAddress

func (s *Storage) UpdateAddress(info *wtypes.AddressInfo) error

UpdateAddress updates an existing address.

func (*Storage) UpdateTransactionStatus

func (s *Storage) UpdateTransactionStatus(no int64, status wtypes.TransactionStatus, blockHeight types.Height) error

UpdateTransactionStatus updates the status and block height for all transactions with the given primary key.

func (*Storage) UpdateVault

func (s *Storage) UpdateVault(vlt *vault.Vault) error

UpdateVault updates the vault in storage.

func (*Storage) Vault

func (s *Storage) Vault() *vault.Vault

Vault returns the vault.

func (*Storage) WalletInfo

func (s *Storage) WalletInfo() *wtypes.WalletInfo

WalletInfo returns the wallet information.

Jump to

Keyboard shortcuts

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