db

package
v0.0.0-...-1b2ca8d Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 16 Imported by: 0

README

SQLite db implementation

The Datastore interface allows for a pluggable wallet database. OpenBazaar, for example, uses its own Datastore implementation so that wallet data can be stored in the same database alongside the rest of OpenBazaar data so that users need only make one backup.

Writing your own implementation is probably the best approach, however, this package does contain a workable Datastore implementation using SQLite. This is the datastore used by NewDefaultConfig.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeysDB

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

func (*KeysDB) GetAll

func (k *KeysDB) GetAll() ([]wallet.KeyPath, error)

func (*KeysDB) GetImported

func (k *KeysDB) GetImported() ([]*btcec.PrivateKey, error)

func (*KeysDB) GetKey

func (k *KeysDB) GetKey(scriptAddress []byte) (*btcec.PrivateKey, error)

func (*KeysDB) GetLastKeyIndex

func (k *KeysDB) GetLastKeyIndex(purpose wallet.KeyPurpose) (int, bool, error)

func (*KeysDB) GetLookaheadWindows

func (k *KeysDB) GetLookaheadWindows() map[wallet.KeyPurpose]int

func (*KeysDB) GetPathForKey

func (k *KeysDB) GetPathForKey(scriptAddress []byte) (wallet.KeyPath, error)

func (*KeysDB) GetUnused

func (k *KeysDB) GetUnused(purpose wallet.KeyPurpose) ([]int, error)

func (*KeysDB) ImportKey

func (k *KeysDB) ImportKey(scriptAddress []byte, key *btcec.PrivateKey) error

func (*KeysDB) MarkKeyAsUsed

func (k *KeysDB) MarkKeyAsUsed(scriptAddress []byte) error

func (*KeysDB) Put

func (k *KeysDB) Put(scriptAddress []byte, keyPath wallet.KeyPath) error

type SQLiteDatastore

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

This database is mostly just an example implementation used for testing. End users are free to user their own database.

func Create

func Create(repoPath string) (*SQLiteDatastore, error)

func (*SQLiteDatastore) GetCreationDate

func (s *SQLiteDatastore) GetCreationDate() (time.Time, error)

func (*SQLiteDatastore) GetMnemonic

func (s *SQLiteDatastore) GetMnemonic() (string, error)

func (*SQLiteDatastore) Keys

func (db *SQLiteDatastore) Keys() wallet.Keys

func (*SQLiteDatastore) SetCreationDate

func (s *SQLiteDatastore) SetCreationDate(creationDate time.Time) error

func (*SQLiteDatastore) SetMnemonic

func (s *SQLiteDatastore) SetMnemonic(mnemonic string) error

func (*SQLiteDatastore) Stxos

func (db *SQLiteDatastore) Stxos() wallet.Stxos

func (*SQLiteDatastore) Txns

func (db *SQLiteDatastore) Txns() wallet.Txns

func (*SQLiteDatastore) Utxos

func (db *SQLiteDatastore) Utxos() wallet.Utxos

func (*SQLiteDatastore) WatchedScripts

func (db *SQLiteDatastore) WatchedScripts() wallet.WatchedScripts

type StxoDB

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

func (*StxoDB) Delete

func (s *StxoDB) Delete(stxo wallet.Stxo) error

func (*StxoDB) GetAll

func (s *StxoDB) GetAll() ([]wallet.Stxo, error)

func (*StxoDB) Put

func (s *StxoDB) Put(stxo wallet.Stxo) error

type TxnsDB

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

func (*TxnsDB) Delete

func (t *TxnsDB) Delete(txid *chainhash.Hash) error

func (*TxnsDB) Get

func (t *TxnsDB) Get(txid chainhash.Hash) (wallet.Txn, error)

func (*TxnsDB) GetAll

func (t *TxnsDB) GetAll(includeWatchOnly bool) ([]wallet.Txn, error)

func (*TxnsDB) Put

func (t *TxnsDB) Put(txn []byte, txid string, value, height int, timestamp time.Time, watchOnly bool) error

func (*TxnsDB) UpdateHeight

func (t *TxnsDB) UpdateHeight(txid chainhash.Hash, height int, timestamp time.Time) error

type UtxoDB

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

func (*UtxoDB) Delete

func (u *UtxoDB) Delete(utxo wallet.Utxo) error

func (*UtxoDB) GetAll

func (u *UtxoDB) GetAll() ([]wallet.Utxo, error)

func (*UtxoDB) Put

func (u *UtxoDB) Put(utxo wallet.Utxo) error

func (*UtxoDB) SetWatchOnly

func (u *UtxoDB) SetWatchOnly(utxo wallet.Utxo) error

type WatchedScriptsDB

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

func (*WatchedScriptsDB) Delete

func (w *WatchedScriptsDB) Delete(scriptPubKey []byte) error

func (*WatchedScriptsDB) GetAll

func (w *WatchedScriptsDB) GetAll() ([][]byte, error)

func (*WatchedScriptsDB) Put

func (w *WatchedScriptsDB) Put(scriptPubKey []byte) error

func (*WatchedScriptsDB) PutAll

func (w *WatchedScriptsDB) PutAll(scripts [][]byte) error

Jump to

Keyboard shortcuts

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