wallet

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const BytesPerInput = 241

BytesPerInput is the encoded size of a SiacoinInput and corresponding TransactionSignature, assuming standard UnlockConditions.

Variables

This section is empty.

Functions

func AppendTransactionSignature

func AppendTransactionSignature(txn *types.Transaction, txnSig types.TransactionSignature, key ed25519.PrivateKey)

AppendTransactionSignature appends a TransactionSignature to txn and signs it with key.

func ExitOnError

func ExitOnError(err error)

ExitOnError prints err to stderr and exits with code 1.

func StandardAddress

func StandardAddress(pk types.SiaPublicKey) types.UnlockHash

StandardAddress returns the UnlockHash of a set of StandardUnlockConditions.

func StandardTransactionSignature

func StandardTransactionSignature(id crypto.Hash) types.TransactionSignature

StandardTransactionSignature is the most common form of TransactionSignature. It covers the entire transaction and references the first (typically the only) public key.

func StandardUnlockConditions

func StandardUnlockConditions(pk types.SiaPublicKey) types.UnlockConditions

StandardUnlockConditions are the unlock conditions for a standard address: one public key, no timelock.

func SumOutputs

func SumOutputs(outputs []UnspentOutput) types.Currency

SumOutputs returns the total value of the supplied outputs.

func UnconfirmedParents

func UnconfirmedParents(txn types.Transaction, tp TransactionPool) []types.Transaction

UnconfirmedParents returns the parent transactions of txn that have not yet appeared in the blockchain.

Types

type AddressOwner

type AddressOwner interface {
	OwnsAddress(addr types.UnlockHash) bool
}

An AddressOwner claims ownership of addresses.

type BoltDBStore

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

BoltDBStore implements SeedStore and WatchOnlyStore with a Bolt key-value database.

func NewBoltDBStore

func NewBoltDBStore(filename string, onErr func(error)) (*BoltDBStore, error)

NewBoltDBStore returns a new BoltDBStore. If onErr is nil, ExitOnError will be used.

func (*BoltDBStore) AddAddress

func (s *BoltDBStore) AddAddress(addr types.UnlockHash, info []byte)

AddAddress implements WatchOnlyStore.

func (*BoltDBStore) AddressInfo

func (s *BoltDBStore) AddressInfo(addr types.UnlockHash) (info []byte)

AddressInfo implements WatchOnlyStore.

func (*BoltDBStore) Addresses

func (s *BoltDBStore) Addresses() []types.UnlockHash

Addresses implements WatchOnlyStore.

func (*BoltDBStore) ApplyConsensusChange

func (s *BoltDBStore) ApplyConsensusChange(reverted, applied ProcessedConsensusChange, ccid modules.ConsensusChangeID)

ApplyConsensusChange implements Store.

func (*BoltDBStore) ChainHeight

func (s *BoltDBStore) ChainHeight() (height types.BlockHeight)

ChainHeight implements Store.

func (*BoltDBStore) Close

func (s *BoltDBStore) Close() error

Close closes the bolt database.

func (*BoltDBStore) ConsensusChangeID

func (s *BoltDBStore) ConsensusChangeID() (ccid modules.ConsensusChangeID)

ConsensusChangeID implements Store.

func (*BoltDBStore) LimboOutputs

func (s *BoltDBStore) LimboOutputs() (outputs []LimboOutput)

LimboOutputs implements Store.

func (*BoltDBStore) MarkSpent

func (s *BoltDBStore) MarkSpent(id types.SiacoinOutputID, spent bool)

MarkSpent implements Store.

func (*BoltDBStore) Memo

func (s *BoltDBStore) Memo(txid types.TransactionID) (memo []byte)

Memo implements Store.

func (*BoltDBStore) OwnsAddress

func (s *BoltDBStore) OwnsAddress(addr types.UnlockHash) (owned bool)

OwnsAddress implements WatchOnlyStore.

func (*BoltDBStore) RemoveAddress

func (s *BoltDBStore) RemoveAddress(addr types.UnlockHash)

RemoveAddress implements WatchOnlyStore.

func (*BoltDBStore) Reset

func (s *BoltDBStore) Reset() error

Reset wipes the store's knowledge of the blockchain, including transactions, outputs, height, and consensus change ID. Addresses, memos, and the current seed index are preserved.

func (*BoltDBStore) SeedIndex

func (s *BoltDBStore) SeedIndex() (index uint64)

SeedIndex implements SeedStore.

func (*BoltDBStore) SetMemo

func (s *BoltDBStore) SetMemo(txid types.TransactionID, memo []byte)

SetMemo implements Store.

func (*BoltDBStore) SetSeedIndex

func (s *BoltDBStore) SetSeedIndex(index uint64)

SetSeedIndex implements SeedStore.

func (*BoltDBStore) Transaction

func (s *BoltDBStore) Transaction(id types.TransactionID) (txn types.Transaction, exists bool)

Transaction implements Store.

func (*BoltDBStore) Transactions

func (s *BoltDBStore) Transactions(n int) (txids []types.TransactionID)

Transactions implements Store.

func (*BoltDBStore) TransactionsByAddress

func (s *BoltDBStore) TransactionsByAddress(addr types.UnlockHash, n int) (txids []types.TransactionID)

TransactionsByAddress implements Store.

func (*BoltDBStore) UnspentOutputs

func (s *BoltDBStore) UnspentOutputs() (outputs []UnspentOutput)

UnspentOutputs implements Store.

type ChainScanner

type ChainScanner struct {
	Owner AddressOwner
	Store ChainStore
}

A ChainScanner scans the blockchain for outputs and transactions relevant to Owner and stores them in Store. Relevance is determined as follows: an output is relevant if its UnlockHash is owned by the AddressOwner; a transaction is relevant if any of the UnlockHashes or UnlockConditions appearing in it are owned by the AddressOwner.

func (ChainScanner) ProcessConsensusChange

func (cs ChainScanner) ProcessConsensusChange(cc modules.ConsensusChange)

ProcessConsensusChange implements modules.ConsensusSetSubscriber.

type ChainStore

type ChainStore interface {
	ApplyConsensusChange(reverted, applied ProcessedConsensusChange, id modules.ConsensusChangeID)
}

A ChainStore stores ProcessedConsensusChanges.

type ConsensusSet

type ConsensusSet interface {
	ConsensusSetSubscribe(s modules.ConsensusSetSubscriber, ccid modules.ConsensusChangeID, cancel <-chan struct{}) error
}

A ConsensusSet notifies subscribers of new consensus changes.

type EphemeralSeedStore

type EphemeralSeedStore struct {
	EphemeralStore
	// contains filtered or unexported fields
}

EphemeralSeedStore implements SeedStore in-memory.

func NewEphemeralSeedStore

func NewEphemeralSeedStore() *EphemeralSeedStore

NewEphemeralSeedStore returns a new EphemeralSeedStore.

func (*EphemeralSeedStore) SeedIndex

func (s *EphemeralSeedStore) SeedIndex() uint64

SeedIndex implements SeedStore.

func (*EphemeralSeedStore) SetSeedIndex

func (s *EphemeralSeedStore) SetSeedIndex(index uint64)

SetSeedIndex implements SeedStore.

type EphemeralStore

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

EphemeralStore implements Store in-memory.

func NewEphemeralStore

func NewEphemeralStore() *EphemeralStore

NewEphemeralStore returns a new EphemeralStore.

func (*EphemeralStore) ApplyConsensusChange

func (s *EphemeralStore) ApplyConsensusChange(reverted, applied ProcessedConsensusChange, ccid modules.ConsensusChangeID)

ApplyConsensusChange implements Store.

func (*EphemeralStore) ChainHeight

func (s *EphemeralStore) ChainHeight() types.BlockHeight

ChainHeight implements Store.

func (*EphemeralStore) ConsensusChangeID

func (s *EphemeralStore) ConsensusChangeID() modules.ConsensusChangeID

ConsensusChangeID implements Store.

func (*EphemeralStore) LimboOutputs

func (s *EphemeralStore) LimboOutputs() []LimboOutput

LimboOutputs implements Store.

func (*EphemeralStore) MarkSpent

func (s *EphemeralStore) MarkSpent(id types.SiacoinOutputID, spent bool)

MarkSpent implements Store.

func (*EphemeralStore) Memo

func (s *EphemeralStore) Memo(txid types.TransactionID) []byte

Memo implements Store.

func (*EphemeralStore) SetMemo

func (s *EphemeralStore) SetMemo(txid types.TransactionID, memo []byte)

SetMemo implements Store.

func (*EphemeralStore) Transaction

func (s *EphemeralStore) Transaction(id types.TransactionID) (types.Transaction, bool)

Transaction implements Store.

func (*EphemeralStore) Transactions

func (s *EphemeralStore) Transactions(n int) []types.TransactionID

Transactions implements Store.

func (*EphemeralStore) TransactionsByAddress

func (s *EphemeralStore) TransactionsByAddress(addr types.UnlockHash, n int) []types.TransactionID

TransactionsByAddress implements Store.

func (*EphemeralStore) UnspentOutputs

func (s *EphemeralStore) UnspentOutputs() []UnspentOutput

UnspentOutputs implements Store.

type EphemeralWatchOnlyStore

type EphemeralWatchOnlyStore struct {
	EphemeralStore
	// contains filtered or unexported fields
}

EphemeralWatchOnlyStore implements WatchOnlyStore in-memory.

func NewEphemeralWatchOnlyStore

func NewEphemeralWatchOnlyStore() *EphemeralWatchOnlyStore

NewEphemeralWatchOnlyStore returns a new EphemeralWatchOnlyStore.

func (*EphemeralWatchOnlyStore) AddAddress

func (s *EphemeralWatchOnlyStore) AddAddress(addr types.UnlockHash, info []byte)

AddAddress implements WatchOnlyStore.

func (*EphemeralWatchOnlyStore) AddressInfo

func (s *EphemeralWatchOnlyStore) AddressInfo(addr types.UnlockHash) (info []byte)

AddressInfo implements WatchOnlyStore.

func (*EphemeralWatchOnlyStore) Addresses

func (s *EphemeralWatchOnlyStore) Addresses() []types.UnlockHash

Addresses implements WatchOnlyStore.

func (*EphemeralWatchOnlyStore) OwnsAddress

func (s *EphemeralWatchOnlyStore) OwnsAddress(addr types.UnlockHash) bool

OwnsAddress implements WatchOnlyStore.

func (*EphemeralWatchOnlyStore) RemoveAddress

func (s *EphemeralWatchOnlyStore) RemoveAddress(addr types.UnlockHash)

RemoveAddress implements WatchOnlyStore.

type LimboOutput

type LimboOutput struct {
	UnspentOutput
	LimboSince time.Time
}

A LimboOutput is an output that may or may not be spendable.

func (LimboOutput) MarshalSia

func (o LimboOutput) MarshalSia(w io.Writer) error

MarshalSia implements encoding.SiaMarshaler.

func (*LimboOutput) UnmarshalSia

func (o *LimboOutput) UnmarshalSia(r io.Reader) error

UnmarshalSia implements encoding.SiaUnmarshaler.

type ProcessedConsensusChange

type ProcessedConsensusChange struct {
	Outputs             []UnspentOutput
	Transactions        []types.Transaction
	AddressTransactions map[types.UnlockHash][]types.TransactionID
	BlockCount          int
	CCID                modules.ConsensusChangeID
}

A ProcessedConsensusChange is a condensation of a modules.ConsensusChange, containing only the data relevant to certain addresses, and intended to be processed by an atomic unit.

type Seed

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

A Seed generates addresses deterministically from some initial entropy.

func NewSeed

func NewSeed() Seed

NewSeed returns a random Seed.

func SeedFromEntropy

func SeedFromEntropy(entropy [16]byte) Seed

SeedFromEntropy returns the Seed derived from the supplied entropy.

func SeedFromPhrase

func SeedFromPhrase(phrase string) (Seed, error)

SeedFromPhrase returns the Seed derived from the supplied phrase.

func (Seed) PublicKey

func (s Seed) PublicKey(index uint64) types.SiaPublicKey

PublicKey derives the types.SiaPublicKey for the specified index.

func (Seed) SecretKey

func (s Seed) SecretKey(index uint64) ed25519.PrivateKey

SecretKey derives the ed25519 private key for the specified index.

func (Seed) SiadSeed

func (s Seed) SiadSeed() modules.Seed

SiadSeed returns a Sia-compatible form of the Seed. This form can be imported into a standard siad wallet.

func (Seed) String

func (s Seed) String() string

String implements fmt.Stringer by encoding the seed as a mnemonic phrase. Note that these phrases are shorter than standard siad wallet seed phrases.

type SeedAddressInfo

type SeedAddressInfo struct {
	UnlockConditions types.UnlockConditions `json:"unlockConditions"`
	KeyIndex         uint64                 `json:"keyIndex"`
}

A SeedAddressInfo contains the unlock conditions and key index for an address derived from a seed.

func (SeedAddressInfo) MarshalJSON

func (info SeedAddressInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type SeedManager

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

A SeedManager tracks the addresses derived from a Seed, and provides the UnlockConditions for the addresses it has generated.

func NewSeedManager

func NewSeedManager(seed Seed, maxUseIndex uint64) *SeedManager

NewSeedManager initializes a SeedManager using the provided seed and maxUseIndex, which is the number of keys previously derived from the Seed. Those keys must be re-derived before NewSeedManager returns, so NewSeedManager may take a while for large values of maxUseIndex.

func (*SeedManager) AddressIndex

func (sm *SeedManager) AddressIndex(addr types.UnlockHash) (uint64, bool)

AddressIndex returns the key index, or false if the address is not known to the SeedManager.

func (*SeedManager) Addresses

func (sm *SeedManager) Addresses() []types.UnlockHash

Addresses returns all addresses generated by the SeedManager.

func (*SeedManager) CurrentIndex

func (sm *SeedManager) CurrentIndex() uint64

CurrentIndex returns the index that will be used to derive the next address.

func (*SeedManager) NextAddress

func (sm *SeedManager) NextAddress() types.UnlockHash

NextAddress returns a new address derived from the SeedManager's Seed.

func (*SeedManager) OwnsAddress

func (sm *SeedManager) OwnsAddress(addr types.UnlockHash) bool

OwnsAddress implements AddressOwner.

func (*SeedManager) SecretKey

func (sm *SeedManager) SecretKey(addr types.UnlockHash) (ed25519.PrivateKey, bool)

SecretKey returns the ed25519 private key associated with the specified address, or false if the address is not known to the SeedManager.

func (*SeedManager) SignTransaction

func (sm *SeedManager) SignTransaction(txn *types.Transaction, toSign []int) error

SignTransaction signs the specified transaction using keys owned by the SeedManager. If toSign is nil, SignTransaction will automatically add TransactionSignatures for each input owned by the SeedManager. If toSign is not nil, it a list of indices of TransactionSignatures already present in txn; SignTransaction will fill in the Signature field of each.

func (*SeedManager) UnlockConditions

func (sm *SeedManager) UnlockConditions(addr types.UnlockHash) (types.UnlockConditions, bool)

UnlockConditions returns the UnlockConditions associated with the specified address, or false if the address is not known to the SeedManager.

type SeedStore

type SeedStore interface {
	Store
	SeedIndex() uint64
	SetSeedIndex(index uint64)
}

A SeedStore stores information needed by a SeedWallet.

type SeedWallet

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

A SeedWallet is a seed-based wallet that can track spendable outputs and sign transactions. It is safe for concurrent use.

SeedWallets can only handle siacoins, not siafunds.

func NewSeedWallet

func NewSeedWallet(sm *SeedManager, store SeedStore) *SeedWallet

NewSeedWallet intializes a SeedWallet using the provided seed and store.

func (*SeedWallet) AddressInfo

func (w *SeedWallet) AddressInfo(addr types.UnlockHash) (SeedAddressInfo, bool)

AddressInfo returns the metadata associated with the specified address.

func (*SeedWallet) Addresses

func (w *SeedWallet) Addresses() []types.UnlockHash

Addresses returns all addresses generated by the SeedManager.

func (*SeedWallet) Balance

func (w *SeedWallet) Balance() types.Currency

Balance returns the siacoin balance of the wallet. Unconfirmed transactions are not reflected in the balance.

func (*SeedWallet) ChainHeight

func (w *SeedWallet) ChainHeight() types.BlockHeight

ChainHeight returns the number of blocks processed by the wallet.

func (*SeedWallet) ConsensusChangeID

func (w *SeedWallet) ConsensusChangeID() modules.ConsensusChangeID

ConsensusChangeID returns the ConsensusChangeID most recently processed by the wallet.

func (*SeedWallet) LimboOutputs

func (w *SeedWallet) LimboOutputs() []LimboOutput

LimboOutputs returns the outputs that have been marked as spent, but have not been confirmed spent in the blockchain.

func (*SeedWallet) MarkSpent

func (w *SeedWallet) MarkSpent(id types.SiacoinOutputID, spent bool)

MarkSpent marks an output as spent or unspent.

func (*SeedWallet) Memo

func (w *SeedWallet) Memo(txid types.TransactionID) []byte

Memo returns the memo associated with the specified transaction.

func (*SeedWallet) NextAddress

func (w *SeedWallet) NextAddress() types.UnlockHash

NextAddress returns a new address derived from the wallet's Seed and updates the wallet's SeedIndex.

func (*SeedWallet) OwnsAddress

func (w *SeedWallet) OwnsAddress(addr types.UnlockHash) bool

OwnsAddress reports whether addr was generated from the wallet's seed.

func (*SeedWallet) ProcessConsensusChange

func (w *SeedWallet) ProcessConsensusChange(cc modules.ConsensusChange)

ProcessConsensusChange implements modules.ConsensusSetSubscriber.

func (*SeedWallet) SeedIndex

func (w *SeedWallet) SeedIndex() uint64

SeedIndex returns the index that will be used to derive the next address.

func (*SeedWallet) SetMemo

func (w *SeedWallet) SetMemo(txid types.TransactionID, memo []byte)

SetMemo sets the memo associated with the specified transaction.

func (*SeedWallet) SignTransaction

func (w *SeedWallet) SignTransaction(txn *types.Transaction, toSign []int) error

SignTransaction signs the specified transaction using keys owned by the wallet. If toSign is nil, SignTransaction will automatically add TransactionSignatures for each input owned by the SeedManager. If toSign is not nil, it a list of indices of TransactionSignatures already present in txn; SignTransaction will fill in the Signature field of each.

func (*SeedWallet) Transaction

func (w *SeedWallet) Transaction(id types.TransactionID) (types.Transaction, bool)

Transaction returns the transaction with the specified id. The transaction must be relevant to the SeedWallet.

func (*SeedWallet) Transactions

func (w *SeedWallet) Transactions(n int) []types.TransactionID

Transactions returns the IDs of the n most recent transactions in the blockchain that are relevant to the SeedWallet, or fewer if less than n such transactions exist. If n < 0, all such transactions are returned. The IDs are ordered from oldest to newest.

func (*SeedWallet) TransactionsByAddress

func (w *SeedWallet) TransactionsByAddress(addr types.UnlockHash, n int) []types.TransactionID

TransactionsByAddress returns the IDs of the n most recent transactions in the blockchain that are relevant to the specified wallet-owned address, or fewer if less than n such transactions exist. If n < 0, all such transactions are returned. The IDs are ordered from oldest to newest.

func (*SeedWallet) ValuedInputs

func (w *SeedWallet) ValuedInputs() []ValuedInput

ValuedInputs returns the spendable outputs tracked by the wallet.

type Store

type Store interface {
	ChainStore
	ConsensusChangeID() modules.ConsensusChangeID
	ChainHeight() types.BlockHeight
	LimboOutputs() []LimboOutput
	MarkSpent(id types.SiacoinOutputID, spent bool)
	Memo(txid types.TransactionID) []byte
	SetMemo(txid types.TransactionID, memo []byte)
	Transaction(id types.TransactionID) (types.Transaction, bool)
	Transactions(n int) []types.TransactionID
	TransactionsByAddress(addr types.UnlockHash, n int) []types.TransactionID
	UnspentOutputs() []UnspentOutput
}

A Store stores information needed by a generic wallet.

type TransactionPool

type TransactionPool interface {
	AcceptTransactionSet([]types.Transaction) error
	FeeEstimation() (min types.Currency, max types.Currency)
	TransactionSet(id crypto.Hash) []types.Transaction
}

A TransactionPool can broadcast transactions and estimate transaction fees.

type UnspentOutput

type UnspentOutput struct {
	types.SiacoinOutput
	ID types.SiacoinOutputID
}

An UnspentOutput is a SiacoinOutput along with its ID.

func (UnspentOutput) MarshalSia

func (o UnspentOutput) MarshalSia(w io.Writer) error

MarshalSia implements encoding.SiaMarshaler.

func (*UnspentOutput) UnmarshalSia

func (o *UnspentOutput) UnmarshalSia(r io.Reader) error

UnmarshalSia implements encoding.SiaUnmarshaler.

type ValuedInput

type ValuedInput struct {
	types.SiacoinInput
	Value types.Currency
}

A ValuedInput is a SiacoinInput along with its value. Seen another way, it is an UnspentOutput that knows its UnlockConditions.

func FundAtLeast

func FundAtLeast(amount types.Currency, inputs []ValuedInput) (used []ValuedInput, change types.Currency, ok bool)

FundAtLeast selects a set of inputs whose total value is at least amount, returning the selected inputs and the resulting change, or false if the sum of all inputs is less than amount.

func FundTransaction

func FundTransaction(amount, feePerByte types.Currency, inputs []ValuedInput) (used []ValuedInput, fee, change types.Currency, ok bool)

FundTransaction selects a set of inputs whose total value is amount+fee, where fee is the estimated fee required to pay for the inputs and their signatures.

func (ValuedInput) MarshalSia

func (i ValuedInput) MarshalSia(w io.Writer) error

MarshalSia implements encoding.SiaMarshaler.

func (*ValuedInput) UnmarshalSia

func (i *ValuedInput) UnmarshalSia(r io.Reader) error

UnmarshalSia implements encoding.SiaUnmarshaler.

type WatchOnlyStore

type WatchOnlyStore interface {
	Store
	AddressOwner
	Addresses() []types.UnlockHash
	AddAddress(addr types.UnlockHash, info []byte)
	AddressInfo(addr types.UnlockHash) []byte
	RemoveAddress(addr types.UnlockHash)
}

A WatchOnlyStore stores information needed by a WatchOnlyWallet. For convenience, it also implements AddressOwner.

type WatchOnlyWallet

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

A WatchOnlyWallet is an unprivileged wallet that can track spendable outputs, but cannot sign transactions. It is safe for concurrent use.

func NewWatchOnlyWallet

func NewWatchOnlyWallet(store WatchOnlyStore) *WatchOnlyWallet

NewWatchOnlyWallet intializes a WatchOnlyWallet using the provided store.

func (*WatchOnlyWallet) AddAddress

func (w *WatchOnlyWallet) AddAddress(addr types.UnlockHash, info []byte)

AddAddress adds an address to the wallet.

func (*WatchOnlyWallet) AddressInfo

func (w *WatchOnlyWallet) AddressInfo(addr types.UnlockHash) (info []byte)

AddressInfo returns the metadata associated with the specified address.

func (*WatchOnlyWallet) Addresses

func (w *WatchOnlyWallet) Addresses() []types.UnlockHash

Addresses returns the set of addresses tracked by the wallet.

func (*WatchOnlyWallet) Balance

func (w *WatchOnlyWallet) Balance() types.Currency

Balance returns the siacoin balance of the wallet. Unconfirmed transactions are not reflected in the balance.

func (*WatchOnlyWallet) ChainHeight

func (w *WatchOnlyWallet) ChainHeight() types.BlockHeight

ChainHeight returns the number of blocks processed by the wallet.

func (*WatchOnlyWallet) ConsensusChangeID

func (w *WatchOnlyWallet) ConsensusChangeID() modules.ConsensusChangeID

ConsensusChangeID returns the ConsensusChangeID most recently processed by the wallet.

func (*WatchOnlyWallet) LimboOutputs

func (w *WatchOnlyWallet) LimboOutputs() []LimboOutput

LimboOutputs returns the outputs that have been marked as spent, but have not been confirmed spent in the blockchain.

func (*WatchOnlyWallet) MarkSpent

func (w *WatchOnlyWallet) MarkSpent(id types.SiacoinOutputID, spent bool)

MarkSpent marks an output as spent or unspent.

func (*WatchOnlyWallet) Memo

func (w *WatchOnlyWallet) Memo(txid types.TransactionID) []byte

Memo returns the memo associated with the specified transaction.

func (*WatchOnlyWallet) OwnsAddress

func (w *WatchOnlyWallet) OwnsAddress(addr types.UnlockHash) bool

OwnsAddress reports whether addr is being tracked by the wallet.

func (*WatchOnlyWallet) ProcessConsensusChange

func (w *WatchOnlyWallet) ProcessConsensusChange(cc modules.ConsensusChange)

ProcessConsensusChange implements modules.ConsensusSetSubscriber.

func (*WatchOnlyWallet) RemoveAddress

func (w *WatchOnlyWallet) RemoveAddress(addr types.UnlockHash)

RemoveAddress removes an address from the wallet.

func (*WatchOnlyWallet) SetMemo

func (w *WatchOnlyWallet) SetMemo(txid types.TransactionID, memo []byte)

SetMemo sets the memo associated with the specified transaction.

func (*WatchOnlyWallet) Transaction

func (w *WatchOnlyWallet) Transaction(id types.TransactionID) (types.Transaction, bool)

Transaction returns the transaction with the specified id. The transaction must be relevant to the wallet.

func (*WatchOnlyWallet) Transactions

func (w *WatchOnlyWallet) Transactions(n int) []types.TransactionID

Transactions returns the IDs of the n most recent transactions in the blockchain that are relevant to the wallet, or fewer if less than n such transactions exist. If n < 0, all such transactions are returned. The IDs are ordered from oldest to newest.

func (*WatchOnlyWallet) TransactionsByAddress

func (w *WatchOnlyWallet) TransactionsByAddress(addr types.UnlockHash, n int) []types.TransactionID

TransactionsByAddress returns the IDs of the n most recent transactions in the blockchain that are relevant to the specified wallet-owned address, or fewer if less than n such transactions exist. If n < 0, all such transactions are returned. The IDs are ordered from oldest to newest.

func (*WatchOnlyWallet) UnspentOutputs

func (w *WatchOnlyWallet) UnspentOutputs() []UnspentOutput

UnspentOutputs returns the spendable outputs tracked by the wallet.

Jump to

Keyboard shortcuts

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