Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // leveldb: not found DBNotFound = errors.New("数据库表没有记录") // 其它错误 ParseErr = errors.New("解析数据库记录错误") )
Functions ¶
This section is empty.
Types ¶
type ChainReader ¶
type ChainReader interface {
// 获取链状态 (GetBlockChainStatus)
GetChainStatus() (*xpb.ChainStatus, error)
// 检查是否是主干Tip Block (ConfirmBlockChainStatus)
IsTrunkTipBlock(blkId []byte) (bool, error)
// 获取系统状态
GetSystemStatus() (*xpb.SystemStatus, error)
// 获取节点NetUR
GetNetURL() (string, error)
// 获取共识状态
GetConsensusStatus() (*xpb.ConsensusStatus, error)
}
func NewChainReader ¶
func NewChainReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) ChainReader
type ConsensusReader ¶
type ConsensusReader interface {
// 获取共识状态
GetConsStatus() (cons.ConsensusStatus, error)
}
func NewConsensusReader ¶
func NewConsensusReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) ConsensusReader
type ContractReader ¶
type ContractReader interface {
// 查询该链合约统计数据
QueryContractStatData() (*protos.ContractStatData, error)
// 查询账户下合约状态
GetAccountContracts(account string) ([]*protos.ContractStatus, error)
// 查询地址下合约状态
GetAddressContracts(addr string, needContent bool) (map[string][]*protos.ContractStatus, error)
// 查询地址下账户
GetAccountByAK(addr string) ([]string, error)
// 查询合约账户ACL
QueryAccountACL(account string) (*protos.Acl, error)
// 查询合约方法ACL
QueryContractMethodACL(contract, method string) (*protos.Acl, error)
// 查询账户治理代币余额
QueryAccountGovernTokenBalance(account string) (*protos.GovernTokenBalance, error)
}
func NewContractReader ¶
func NewContractReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) ContractReader
type LedgerReader ¶
type LedgerReader interface {
// 查询交易信息(QueryTx)
QueryTx(txId []byte) (*xpb.TxInfo, error)
// 通过交易哈希(string)查询交易信息
QueryTxString(txid string) (*xpb.TxInfo, error)
// 查询区块ID信息(GetBlock)
QueryBlock(blkId []byte, needContent bool) (*xpb.BlockInfo, error)
QueryBlockHeader(blkId []byte) (*xpb.BlockInfo, error)
// 通过区块高度查询区块信息(GetBlockByHeight)
QueryBlockByHeight(height int64, needContent bool) (*xpb.BlockInfo, error)
QueryBlockHeaderByHeight(height int64) (*xpb.BlockInfo, error)
// VotesUsage 票数(治理代币)使用情况,包括投票与被投票谁,提名信息,总票数与剩余可用票数等
VotesUsage(address string) (*protos.CandidateRatio, error)
//
PledgeVotingRecords(address string) (*protos.PledgeVotingResponse, error)
//
GetVerification(address string) (*protos.VerificationTable, error)
// 查询tdpos投票分红接口
GovernTokenBonusQuery(account string) (*protos.BonusQueryReply, error)
GetSystemStatusExplorer() (*protos.BCStatusExplorer, error)
}
func NewLedgerReader ¶
func NewLedgerReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) LedgerReader
type UtxoReader ¶
type UtxoReader interface {
// 获取账户余额
GetBalance(account string) (string, error)
// 获取账户冻结余额
GetFrozenBalance(account string) (string, error)
// 获取账户余额详情
GetBalanceDetail(account string) ([]*lpb.BalanceDetailInfo, error)
// 拉取固定数目的utxo
QueryUtxoRecord(account string, count int64) (*lpb.UtxoRecordDetail, error)
// 选择合适金额的utxo
SelectUTXO(account string, need *big.Int, isLock, isExclude bool) (*lpb.UtxoOutput, error)
// 按最大交易大小选择utxo
SelectUTXOBySize(account string, isLock, isExclude bool) (*lpb.UtxoOutput, error)
// 随机逼近法选择utxo
StochasticApproximationSelectUtxos(account string, need *big.Int, isLock, isExclude bool) (*lpb.UtxoOutput, error)
}
func NewUtxoReader ¶
func NewUtxoReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) UtxoReader
Click to show internal directories.
Click to hide internal directories.