Documentation ¶
Index ¶
- Constants
- Variables
- func DBDelACCTBalance(dbTx legacydb.Tx, address string) error
- func DBDelACCTUTXO(dbTx legacydb.Tx, address string, op *types.TxOutPoint) error
- func DBDelACCTUTXOs(dbTx legacydb.Tx, address string) error
- func DBGetACCTUTXOs(dbTx legacydb.Tx, address string) map[string]*AcctUTXO
- func DBPutACCTBalance(dbTx legacydb.Tx, address string, ab *AcctBalance) error
- func DBPutACCTInfo(dbTx legacydb.Tx, ai *AcctInfo) error
- func DBPutACCTUTXO(dbTx legacydb.Tx, address string, op *types.TxOutPoint, au *AcctUTXO) error
- func GetACCTUTXOKey(address string) []byte
- func OutpointKey(outpoint *types.TxOutPoint) []byte
- func UseLogger(logger l.Logger)
- type AccountManager
- func (a *AccountManager) APIs() []api.API
- func (a *AccountManager) AddAddress(addr string) error
- func (a *AccountManager) Apply(add bool, op *types.TxOutPoint, entry interface{}) error
- func (a *AccountManager) Commit() error
- func (a *AccountManager) DelWatcher(addr string, op *types.TxOutPoint)
- func (a *AccountManager) GetBalance(addr string) (uint64, error)
- func (a *AccountManager) GetChain() *blockchain.BlockChain
- func (a *AccountManager) GetUTXOs(addr string) ([]UTXOResult, error)
- func (a *AccountManager) SetEvents(evs *event.Feed)
- func (a *AccountManager) Start() error
- func (a *AccountManager) Stop() error
- type AcctBalance
- type AcctBalanceWatcher
- func (aw *AcctBalanceWatcher) Add(op []byte, au AcctUTXOIWatcher)
- func (aw *AcctBalanceWatcher) Del(op []byte)
- func (aw *AcctBalanceWatcher) Get(op []byte) AcctUTXOIWatcher
- func (aw *AcctBalanceWatcher) GetBalance() uint64
- func (aw *AcctBalanceWatcher) GetByOPS(ops string) AcctUTXOIWatcher
- func (aw *AcctBalanceWatcher) Has(op []byte) bool
- func (aw *AcctBalanceWatcher) Update(am *AccountManager) error
- type AcctInfo
- func (ai *AcctInfo) Add(addr string)
- func (ai *AcctInfo) Decode(r io.Reader) error
- func (ai *AcctInfo) Encode(w io.Writer) error
- func (ai *AcctInfo) GetAddrTotal() int
- func (ai *AcctInfo) Has(addr string) bool
- func (ai *AcctInfo) IsCurrentVersion() bool
- func (ai *AcctInfo) IsEmpty() bool
- func (ai *AcctInfo) String() string
- type AcctUTXO
- func (au *AcctUTXO) Decode(r io.Reader) error
- func (au *AcctUTXO) Encode(w io.Writer) error
- func (au *AcctUTXO) IsCLTV() bool
- func (au *AcctUTXO) IsCoinbase() bool
- func (au *AcctUTXO) SetBalance(balance uint64)
- func (au *AcctUTXO) SetCLTV()
- func (au *AcctUTXO) SetCoinbase()
- func (au *AcctUTXO) String() string
- func (au *AcctUTXO) TypeStr() string
- type AcctUTXOIWatcher
- type BalanceInfoResult
- type CLTVWatcher
- type CoinbaseWatcher
- type PublicAccountManagerAPI
- func (api *PublicAccountManagerAPI) AddBalance(addr string) (interface{}, error)
- func (api *PublicAccountManagerAPI) GetAcctInfo() (interface{}, error)
- func (api *PublicAccountManagerAPI) GetBalance(addr string, coinID types.CoinID) (interface{}, error)
- func (api *PublicAccountManagerAPI) GetBalanceInfo(addr string, coinID types.CoinID) (interface{}, error)
- type UTXOOP
- type UTXOResult
Constants ¶
View Source
const ( AddressUTXOsSuffix = "-utxos" NormalUTXOType = 0 CoinbaseUTXOType = 1 CLTVUTXOType = 2 TokenUTXOType = 3 )
View Source
const (
CurrentAcctInfoVersion = 2
)
Variables ¶
View Source
var ( // ByteOrder is the preferred byte order used for serializing numeric // fields for storage in the database. ByteOrder = binary.LittleEndian // BalanceBucketName is the name of the db bucket used to house to // Address -> Balance BalanceBucketName = []byte("acctbalance") // InfoBucketName is the name of the db bucket used to house to // account info InfoBucketName = []byte("acctinfo") )
Functions ¶
func DBDelACCTUTXO ¶
func DBGetACCTUTXOs ¶ added in v1.0.17
func DBPutACCTBalance ¶
func DBPutACCTBalance(dbTx legacydb.Tx, address string, ab *AcctBalance) error
func DBPutACCTUTXO ¶
func OutpointKey ¶
func OutpointKey(outpoint *types.TxOutPoint) []byte
Types ¶
type AccountManager ¶
account manager communicate with various backends for signing transactions.
func New ¶
func New(chain *blockchain.BlockChain, cfg *config.Config, _events *event.Feed) (*AccountManager, error)
func (*AccountManager) APIs ¶
func (a *AccountManager) APIs() []api.API
func (*AccountManager) AddAddress ¶ added in v1.0.18
func (a *AccountManager) AddAddress(addr string) error
func (*AccountManager) Apply ¶
func (a *AccountManager) Apply(add bool, op *types.TxOutPoint, entry interface{}) error
func (*AccountManager) Commit ¶
func (a *AccountManager) Commit() error
func (*AccountManager) DelWatcher ¶
func (a *AccountManager) DelWatcher(addr string, op *types.TxOutPoint)
func (*AccountManager) GetBalance ¶
func (a *AccountManager) GetBalance(addr string) (uint64, error)
func (*AccountManager) GetChain ¶ added in v1.2.0
func (a *AccountManager) GetChain() *blockchain.BlockChain
func (*AccountManager) GetUTXOs ¶ added in v1.0.17
func (a *AccountManager) GetUTXOs(addr string) ([]UTXOResult, error)
func (*AccountManager) SetEvents ¶ added in v1.2.0
func (a *AccountManager) SetEvents(evs *event.Feed)
func (*AccountManager) Start ¶
func (a *AccountManager) Start() error
func (*AccountManager) Stop ¶
func (a *AccountManager) Stop() error
type AcctBalance ¶
type AcctBalance struct {
// contains filtered or unexported fields
}
func DBGetACCTBalance ¶
func DBGetACCTBalance(dbTx legacydb.Tx, address string) (*AcctBalance, error)
balance
func NewAcctBalance ¶
func NewAcctBalance(normal uint64, norUTXONum uint32, locked uint64, locUTXONum uint32) *AcctBalance
func (*AcctBalance) IsEmpty ¶
func (ab *AcctBalance) IsEmpty() bool
func (*AcctBalance) String ¶
func (ab *AcctBalance) String() string
type AcctBalanceWatcher ¶
type AcctBalanceWatcher struct {
// contains filtered or unexported fields
}
func NewAcctBalanceWatcher ¶
func NewAcctBalanceWatcher(address string, ab *AcctBalance) *AcctBalanceWatcher
func (*AcctBalanceWatcher) Add ¶
func (aw *AcctBalanceWatcher) Add(op []byte, au AcctUTXOIWatcher)
func (*AcctBalanceWatcher) Del ¶
func (aw *AcctBalanceWatcher) Del(op []byte)
func (*AcctBalanceWatcher) Get ¶ added in v1.0.17
func (aw *AcctBalanceWatcher) Get(op []byte) AcctUTXOIWatcher
func (*AcctBalanceWatcher) GetBalance ¶
func (aw *AcctBalanceWatcher) GetBalance() uint64
func (*AcctBalanceWatcher) GetByOPS ¶ added in v1.0.17
func (aw *AcctBalanceWatcher) GetByOPS(ops string) AcctUTXOIWatcher
func (*AcctBalanceWatcher) Has ¶
func (aw *AcctBalanceWatcher) Has(op []byte) bool
func (*AcctBalanceWatcher) Update ¶
func (aw *AcctBalanceWatcher) Update(am *AccountManager) error
type AcctInfo ¶
type AcctInfo struct {
// contains filtered or unexported fields
}
func NewAcctInfo ¶
func NewAcctInfo() *AcctInfo
func (*AcctInfo) GetAddrTotal ¶ added in v1.0.18
func (*AcctInfo) IsCurrentVersion ¶ added in v1.0.18
type AcctUTXO ¶
type AcctUTXO struct {
// contains filtered or unexported fields
}
func NewAcctUTXO ¶
func NewAcctUTXO() *AcctUTXO
func (*AcctUTXO) IsCoinbase ¶
func (*AcctUTXO) SetBalance ¶
func (*AcctUTXO) SetCoinbase ¶
func (au *AcctUTXO) SetCoinbase()
type AcctUTXOIWatcher ¶
type AcctUTXOIWatcher interface { Update(am *AccountManager) error GetBalance() uint64 IsUnlocked() bool GetName() string }
func BuildUTXOWatcher ¶
func BuildUTXOWatcher(op []byte, au *AcctUTXO, entry *utxo.UtxoEntry, am *AccountManager) AcctUTXOIWatcher
type BalanceInfoResult ¶ added in v1.0.17
type BalanceInfoResult struct { CoinId string `json:"coinid"` Balance int64 `json:"balance"` UTXOs []UTXOResult `json:"utxos,omitempty"` }
type CLTVWatcher ¶
type CLTVWatcher struct {
// contains filtered or unexported fields
}
func NewCLTVWatcher ¶
func NewCLTVWatcher(au *AcctUTXO, lockTime int64, isForkGenUTXO bool) *CLTVWatcher
func (*CLTVWatcher) GetBalance ¶
func (cw *CLTVWatcher) GetBalance() uint64
func (*CLTVWatcher) GetName ¶
func (cw *CLTVWatcher) GetName() string
func (*CLTVWatcher) IsUnlocked ¶
func (cw *CLTVWatcher) IsUnlocked() bool
func (*CLTVWatcher) Lock ¶
func (cw *CLTVWatcher) Lock()
func (*CLTVWatcher) Update ¶
func (cw *CLTVWatcher) Update(am *AccountManager) error
type CoinbaseWatcher ¶
type CoinbaseWatcher struct {
// contains filtered or unexported fields
}
func NewCoinbaseWatcher ¶
func NewCoinbaseWatcher(au *AcctUTXO, target meerdag.IBlock) *CoinbaseWatcher
func (*CoinbaseWatcher) GetBalance ¶
func (cw *CoinbaseWatcher) GetBalance() uint64
func (*CoinbaseWatcher) GetName ¶
func (cw *CoinbaseWatcher) GetName() string
func (*CoinbaseWatcher) IsUnlocked ¶
func (cw *CoinbaseWatcher) IsUnlocked() bool
func (*CoinbaseWatcher) Lock ¶
func (cw *CoinbaseWatcher) Lock()
func (*CoinbaseWatcher) Update ¶
func (cw *CoinbaseWatcher) Update(am *AccountManager) error
type PublicAccountManagerAPI ¶
type PublicAccountManagerAPI struct {
// contains filtered or unexported fields
}
PublicEthereumAPI provides an API to access Ethereum full node-related information.
func NewPublicAccountManagerAPI ¶
func NewPublicAccountManagerAPI(a *AccountManager) *PublicAccountManagerAPI
NewPublicEthereumAPI creates a new Ethereum protocol API for full nodes.
func (*PublicAccountManagerAPI) AddBalance ¶ added in v1.0.18
func (api *PublicAccountManagerAPI) AddBalance(addr string) (interface{}, error)
func (*PublicAccountManagerAPI) GetAcctInfo ¶
func (api *PublicAccountManagerAPI) GetAcctInfo() (interface{}, error)
func (*PublicAccountManagerAPI) GetBalance ¶
func (api *PublicAccountManagerAPI) GetBalance(addr string, coinID types.CoinID) (interface{}, error)
func (*PublicAccountManagerAPI) GetBalanceInfo ¶ added in v1.0.17
func (api *PublicAccountManagerAPI) GetBalanceInfo(addr string, coinID types.CoinID) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.