sqlitestorage

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 17 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 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) (*Storage, error)

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

func Open

func Open(ctx context.Context, path string) (*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) (*types.AddressInfo, error)

AddressInfo returns the address information for the given address.

func (*Storage) AllAddresses

func (s *Storage) AllAddresses() []types.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]*types.TransactionInfo, error)

GetPendingTransactions returns pending transactions keyed by transaction ID.

func (*Storage) GetTransaction

func (s *Storage) GetTransaction(no int64) (*types.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 *types.AddressInfo) error

InsertAddress inserts a new address.

func (*Storage) InsertTransaction

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

InsertTransaction inserts a new transaction.

func (*Storage) IsLegacy

func (*Storage) IsLegacy() bool

func (*Storage) QueryTransactions

func (s *Storage) QueryTransactions(params storage.QueryParams) ([]*types.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 *types.AddressInfo) error

UpdateAddress updates an existing address.

func (*Storage) UpdateTransactionStatus

func (s *Storage) UpdateTransactionStatus(no int64, status types.TransactionStatus, blockHeight uint32) 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() *types.WalletInfo

WalletInfo returns the wallet information.

Jump to

Keyboard shortcuts

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