Documentation
¶
Index ¶
- Variables
- func NewExplorerProxy(url string) explorer.Explorer
- func StartJSONServer(blockchain blockchain.Blockchain, consensus consensus.Consensus, isTest bool, ...)
- type LogFilter
- type Service
- func (exp *Service) GetAddressBalance(address string) (int64, error)
- func (exp *Service) GetAddressDetails(address string) (explorer.AddressDetails, error)
- func (exp *Service) GetBlockByID(blkID string) (explorer.Block, error)
- func (exp *Service) GetBlockchainHeight() (int64, error)
- func (exp *Service) GetCoinStatistic() (explorer.CoinStatistic, error)
- func (exp *Service) GetConsensusMetrics() (explorer.ConsensusMetrics, error)
- func (exp *Service) GetLastBlocksByRange(offset int64, limit int64) ([]explorer.Block, error)
- func (exp *Service) GetLastTransfersByRange(startBlockHeight int64, offset int64, limit int64, showCoinBase bool) ([]explorer.Transfer, error)
- func (exp *Service) GetLastVotesByRange(startBlockHeight int64, offset int64, limit int64) ([]explorer.Vote, error)
- func (exp *Service) GetTransferByID(transferID string) (explorer.Transfer, error)
- func (exp *Service) GetTransfersByAddress(address string, offset int64, limit int64) ([]explorer.Transfer, error)
- func (exp *Service) GetTransfersByBlockID(blkID string, offset int64, limit int64) ([]explorer.Transfer, error)
- func (exp *Service) GetVoteByID(voteID string) (explorer.Vote, error)
- func (exp *Service) GetVotesByAddress(address string, offset int64, limit int64) ([]explorer.Vote, error)
- func (exp *Service) GetVotesByBlockID(blkID string, offset int64, limit int64) ([]explorer.Vote, error)
- type TestExplorer
- func (exp *TestExplorer) GetAddressBalance(address string) (int64, error)
- func (exp *TestExplorer) GetAddressDetails(address string) (explorer.AddressDetails, error)
- func (exp *TestExplorer) GetBlockByID(blkID string) (explorer.Block, error)
- func (exp *TestExplorer) GetBlockchainHeight() (int64, error)
- func (exp *TestExplorer) GetCoinStatistic() (explorer.CoinStatistic, error)
- func (exp *TestExplorer) GetConsensusMetrics() (explorer.ConsensusMetrics, error)
- func (exp *TestExplorer) GetLastBlocksByRange(offset int64, limit int64) ([]explorer.Block, error)
- func (exp *TestExplorer) GetLastTransfersByRange(startBlockHeight int64, offset int64, limit int64, showCoinBase bool) ([]explorer.Transfer, error)
- func (exp *TestExplorer) GetLastVotesByRange(startBlockHeight int64, offset int64, limit int64) ([]explorer.Vote, error)
- func (exp *TestExplorer) GetTransferByID(transferID string) (explorer.Transfer, error)
- func (exp *TestExplorer) GetTransfersByAddress(address string, offset int64, limit int64) ([]explorer.Transfer, error)
- func (exp *TestExplorer) GetTransfersByBlockID(blockID string, offset int64, limit int64) ([]explorer.Transfer, error)
- func (exp *TestExplorer) GetVoteByID(voteID string) (explorer.Vote, error)
- func (exp *TestExplorer) GetVotesByAddress(address string, offset int64, limit int64) ([]explorer.Vote, error)
- func (exp *TestExplorer) GetVotesByBlockID(blkID string, offset int64, limit int64) ([]explorer.Vote, error)
Constants ¶
This section is empty.
Variables ¶
var ErrInternalServer = errors.New("internal server error")
ErrInternalServer indicates the internal server error
Functions ¶
func NewExplorerProxy ¶
NewExplorerProxy accepts an URL to the endpoint of the Explorer server and returns a proxy that implements the Explorer interface
func StartJSONServer ¶
func StartJSONServer( blockchain blockchain.Blockchain, consensus consensus.Consensus, isTest bool, port string, tpsWindow int, )
StartJSONServer start the json server for explorer
Types ¶
type LogFilter ¶
type LogFilter struct{}
LogFilter example of Filter implementation
func (LogFilter) PostInvoke ¶
PostInvoke implement empty postinvoke
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provide api for user to query blockchain data
func (*Service) GetAddressBalance ¶
GetAddressBalance returns the balance of an address
func (*Service) GetAddressDetails ¶
func (exp *Service) GetAddressDetails(address string) (explorer.AddressDetails, error)
GetAddressDetails returns the properties of an address
func (*Service) GetBlockByID ¶
GetBlockByID returns block by block id
func (*Service) GetBlockchainHeight ¶
GetBlockchainHeight returns the current blockchain tip height
func (*Service) GetCoinStatistic ¶
func (exp *Service) GetCoinStatistic() (explorer.CoinStatistic, error)
GetCoinStatistic returns stats in blockchain
func (*Service) GetConsensusMetrics ¶
func (exp *Service) GetConsensusMetrics() (explorer.ConsensusMetrics, error)
GetConsensusMetrics returns the latest consensus metrics
func (*Service) GetLastBlocksByRange ¶
GetLastBlocksByRange get block with height [offset-limit+1, offset]
func (*Service) GetLastTransfersByRange ¶
func (exp *Service) GetLastTransfersByRange(startBlockHeight int64, offset int64, limit int64, showCoinBase bool) ([]explorer.Transfer, error)
GetLastTransfersByRange return transfers in [-(offset+limit-1), -offset] from block with height startBlockHeight
func (*Service) GetLastVotesByRange ¶
func (exp *Service) GetLastVotesByRange(startBlockHeight int64, offset int64, limit int64) ([]explorer.Vote, error)
GetLastVotesByRange return votes in [-(offset+limit-1), -offset] from block with height startBlockHeight
func (*Service) GetTransferByID ¶
GetTransferByID returns transfer by transfer id
func (*Service) GetTransfersByAddress ¶
func (exp *Service) GetTransfersByAddress(address string, offset int64, limit int64) ([]explorer.Transfer, error)
GetTransfersByAddress returns all transfers associate with an address
func (*Service) GetTransfersByBlockID ¶
func (exp *Service) GetTransfersByBlockID(blkID string, offset int64, limit int64) ([]explorer.Transfer, error)
GetTransfersByBlockID returns transfers in a block
func (*Service) GetVoteByID ¶
GetVoteByID returns vote by vote id
type TestExplorer ¶
type TestExplorer struct { }
TestExplorer return an explorer for test purpose
func (*TestExplorer) GetAddressBalance ¶
func (exp *TestExplorer) GetAddressBalance(address string) (int64, error)
GetAddressBalance returns the balance of an address
func (*TestExplorer) GetAddressDetails ¶
func (exp *TestExplorer) GetAddressDetails(address string) (explorer.AddressDetails, error)
GetAddressDetails returns the properties of an address
func (*TestExplorer) GetBlockByID ¶
func (exp *TestExplorer) GetBlockByID(blkID string) (explorer.Block, error)
GetBlockByID returns block by block id
func (*TestExplorer) GetBlockchainHeight ¶
func (exp *TestExplorer) GetBlockchainHeight() (int64, error)
GetBlockchainHeight returns the blockchain height
func (*TestExplorer) GetCoinStatistic ¶
func (exp *TestExplorer) GetCoinStatistic() (explorer.CoinStatistic, error)
GetCoinStatistic returns stats in blockchain
func (*TestExplorer) GetConsensusMetrics ¶
func (exp *TestExplorer) GetConsensusMetrics() (explorer.ConsensusMetrics, error)
GetConsensusMetrics returns the fake consensus metrics
func (*TestExplorer) GetLastBlocksByRange ¶
GetLastBlocksByRange get block with height [offset-limit+1, offset]
func (*TestExplorer) GetLastTransfersByRange ¶
func (exp *TestExplorer) GetLastTransfersByRange(startBlockHeight int64, offset int64, limit int64, showCoinBase bool) ([]explorer.Transfer, error)
GetLastTransfersByRange return transfers in [-(offset+limit-1), -offset] from block with height startBlockHeight
func (*TestExplorer) GetLastVotesByRange ¶
func (exp *TestExplorer) GetLastVotesByRange(startBlockHeight int64, offset int64, limit int64) ([]explorer.Vote, error)
GetLastVotesByRange return votes in [-(offset+limit-1), -offset] from block with height startBlockHeight
func (*TestExplorer) GetTransferByID ¶
func (exp *TestExplorer) GetTransferByID(transferID string) (explorer.Transfer, error)
GetTransferByID returns transfer by transfer id
func (*TestExplorer) GetTransfersByAddress ¶
func (exp *TestExplorer) GetTransfersByAddress(address string, offset int64, limit int64) ([]explorer.Transfer, error)
GetTransfersByAddress returns all transfers associate with an address
func (*TestExplorer) GetTransfersByBlockID ¶
func (exp *TestExplorer) GetTransfersByBlockID(blockID string, offset int64, limit int64) ([]explorer.Transfer, error)
GetTransfersByBlockID returns transfers in a block
func (*TestExplorer) GetVoteByID ¶
func (exp *TestExplorer) GetVoteByID(voteID string) (explorer.Vote, error)
GetVoteByID returns vote by vote id
func (*TestExplorer) GetVotesByAddress ¶
func (exp *TestExplorer) GetVotesByAddress(address string, offset int64, limit int64) ([]explorer.Vote, error)
GetVotesByAddress returns all votes associate with an address
func (*TestExplorer) GetVotesByBlockID ¶
func (exp *TestExplorer) GetVotesByBlockID(blkID string, offset int64, limit int64) ([]explorer.Vote, error)
GetVotesByBlockID returns votes in a block