Documentation
¶
Index ¶
- Constants
- type Option
- type Storage
- func (s *Storage) AddressCount() int
- func (s *Storage) AddressInfo(address string) (*wtypes.AddressInfo, error)
- func (s *Storage) AllAddresses() []wtypes.AddressInfo
- func (s *Storage) Clone(path string) (storage.IStorage, error)
- func (s *Storage) Close() error
- func (s *Storage) GetPendingTransactions() (map[string]*wtypes.TransactionInfo, error)
- func (s *Storage) GetTransaction(no int64) (*wtypes.TransactionInfo, error)
- func (s *Storage) HasAddress(address string) bool
- func (s *Storage) HasTransaction(txID string) bool
- func (s *Storage) InsertAddress(info *wtypes.AddressInfo) error
- func (s *Storage) InsertTransaction(info *wtypes.TransactionInfo) error
- func (*Storage) IsLegacy() bool
- func (s *Storage) QueryTransactions(params storage.QueryParams) ([]*wtypes.TransactionInfo, error)
- func (s *Storage) SetDefaultFee(fee amount.Amount) error
- func (s *Storage) UpdateAddress(info *wtypes.AddressInfo) error
- func (s *Storage) UpdateTransactionStatus(no int64, status wtypes.TransactionStatus, blockHeight types.Height) error
- func (s *Storage) UpdateVault(vlt *vault.Vault) error
- func (s *Storage) Vault() *vault.Vault
- func (s *Storage) WalletInfo() *wtypes.WalletInfo
Constants ¶
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
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 (*Storage) AddressCount ¶
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) 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 ¶
HasAddress checks if an address exists.
func (*Storage) HasTransaction ¶
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) 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 ¶
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 ¶
UpdateVault updates the vault in storage.
func (*Storage) WalletInfo ¶
func (s *Storage) WalletInfo() *wtypes.WalletInfo
WalletInfo returns the wallet information.