wallet

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func SetWalletAccount

func SetWalletAccount(addressInfo *AddressInfo)

SetWalletAccount set an address information to wallet

Types

type AddressInfo

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

func GetWalletAccount

func GetWalletAccount(address string) (*AddressInfo, bool)

GetWalletAccount retrieval an address information in wallet by address

type Coin

type Coin struct {
	TxVersion types.TransactionVersion
	Output    *types.Output
	Height    uint32
}

func (*Coin) Deserialize

func (coin *Coin) Deserialize(r io.Reader) error

func (*Coin) Serialize

func (coin *Coin) Serialize(w io.Writer) error

type CoinLinkedItem

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

CoinLinkedItem as a value for OwnedCoins map to be a linked list item.

func (*CoinLinkedItem) Deserialize

func (cl *CoinLinkedItem) Deserialize(r io.Reader) error

func (*CoinLinkedItem) Serialize

func (cl *CoinLinkedItem) Serialize(w io.Writer) error

type CoinOwnership

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

CoinOwnership as a key for OwnedCoins map to represents the ownership between OutPoint and owner.

func (*CoinOwnership) Deserialize

func (co *CoinOwnership) Deserialize(r io.Reader) error

func (*CoinOwnership) Serialize

func (co *CoinOwnership) Serialize(w io.Writer) error

type CoinsCheckPoint

type CoinsCheckPoint struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CoinsCheckPoint implement the ICheckPoint interface and store all coins which be subscribed.

func NewCoinCheckPoint

func NewCoinCheckPoint() *CoinsCheckPoint

func (*CoinsCheckPoint) AppendCoin

func (ccp *CoinsCheckPoint) AppendCoin(owner string, op *types.OutPoint, coin *Coin)

func (*CoinsCheckPoint) DataExtension

func (ccp *CoinsCheckPoint) DataExtension() string

func (*CoinsCheckPoint) Deserialize

func (ccp *CoinsCheckPoint) Deserialize(r io.Reader) error

func (*CoinsCheckPoint) EffectivePeriod

func (ccp *CoinsCheckPoint) EffectivePeriod() uint32

func (*CoinsCheckPoint) Generator

func (ccp *CoinsCheckPoint) Generator() func(buf []byte) checkpoint.ICheckPoint

func (*CoinsCheckPoint) GetCoin

func (ccp *CoinsCheckPoint) GetCoin(owner string, op *types.OutPoint) (*Coin, bool)

func (*CoinsCheckPoint) GetHeight

func (ccp *CoinsCheckPoint) GetHeight() uint32

func (*CoinsCheckPoint) Key

func (ccp *CoinsCheckPoint) Key() string

func (*CoinsCheckPoint) ListCoins

func (ccp *CoinsCheckPoint) ListCoins(owner string) map[types.OutPoint]*Coin

func (*CoinsCheckPoint) LogError

func (ccp *CoinsCheckPoint) LogError(err error)

func (*CoinsCheckPoint) OnBlockSaved

func (ccp *CoinsCheckPoint) OnBlockSaved(block *types.DposBlock)

func (*CoinsCheckPoint) OnInit

func (ccp *CoinsCheckPoint) OnInit()

func (*CoinsCheckPoint) OnRollbackTo

func (ccp *CoinsCheckPoint) OnRollbackTo(height uint32) error

func (*CoinsCheckPoint) Priority

func (ccp *CoinsCheckPoint) Priority() checkpoint.Priority

func (*CoinsCheckPoint) SavePeriod

func (ccp *CoinsCheckPoint) SavePeriod() uint32

func (*CoinsCheckPoint) Serialize

func (ccp *CoinsCheckPoint) Serialize(w io.Writer) error

func (*CoinsCheckPoint) SetHeight

func (ccp *CoinsCheckPoint) SetHeight(height uint32)

func (*CoinsCheckPoint) Snapshot

func (ccp *CoinsCheckPoint) Snapshot() checkpoint.ICheckPoint

func (*CoinsCheckPoint) StartHeight

func (ccp *CoinsCheckPoint) StartHeight() uint32

type OwnedCoins

type OwnedCoins map[CoinOwnership]CoinLinkedItem

OwnedCoins store the ownership between OutPoint and owner, and can traverse the OutPoint of an owner through a linked list.

func NewOwnedCoins

func NewOwnedCoins() OwnedCoins

func (OwnedCoins) Deserialize

func (oc OwnedCoins) Deserialize(r io.Reader) error

func (OwnedCoins) Serialize

func (oc OwnedCoins) Serialize(w io.Writer) error

type Wallet

type Wallet struct {
	*CoinsCheckPoint
	*account.Client
}

func New

func New(dataDir string) *Wallet

func NewWallet

func NewWallet() *Wallet

func (*Wallet) ImportAddress

func (w *Wallet) ImportAddress(address string, enableUtxoDB bool) error

func (*Wallet) ImportPubkey

func (w *Wallet) ImportPubkey(pubKey []byte, enableUtxoDB bool) error

func (*Wallet) ListUnspent

func (w *Wallet) ListUnspent(address string, enableUtxoDB bool) (map[common.Uint256][]*types.UTXO,
	error)

func (*Wallet) LoadAddresses

func (w *Wallet) LoadAddresses() error

func (*Wallet) RescanWallet

func (w *Wallet) RescanWallet() error

Jump to

Keyboard shortcuts

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