explorer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInternalServer = errors.New("internal server error")

ErrInternalServer indicates the internal server error

Functions

func NewExplorerProxy

func NewExplorerProxy(url string) explorer.Explorer

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

func (f LogFilter) PostInvoke(r *barrister.RequestResponse) bool

PostInvoke implement empty postinvoke

func (LogFilter) PreInvoke

func (f LogFilter) PreInvoke(r *barrister.RequestResponse) bool

PreInvoke implement empty preinvoke

type Service

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

Service provide api for user to query blockchain data

func (*Service) GetAddressBalance

func (exp *Service) GetAddressBalance(address string) (int64, error)

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

func (exp *Service) GetBlockByID(blkID string) (explorer.Block, error)

GetBlockByID returns block by block id

func (*Service) GetBlockchainHeight

func (exp *Service) GetBlockchainHeight() (int64, error)

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

func (exp *Service) GetLastBlocksByRange(offset int64, limit int64) ([]explorer.Block, error)

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

func (exp *Service) GetTransferByID(transferID string) (explorer.Transfer, error)

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

func (exp *Service) GetVoteByID(voteID string) (explorer.Vote, error)

GetVoteByID returns vote by vote id

func (*Service) GetVotesByAddress

func (exp *Service) GetVotesByAddress(address string, offset int64, limit int64) ([]explorer.Vote, error)

GetVotesByAddress returns all votes associate with an address

func (*Service) GetVotesByBlockID

func (exp *Service) GetVotesByBlockID(blkID string, offset int64, limit int64) ([]explorer.Vote, error)

GetVotesByBlockID returns votes in a block

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

func (exp *TestExplorer) GetLastBlocksByRange(offset int64, limit int64) ([]explorer.Block, error)

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

Directories

Path Synopsis
idl
explorer
Code generated by idl2go from JSON generated by Barrister v0.1.6
Code generated by idl2go from JSON generated by Barrister v0.1.6

Jump to

Keyboard shortcuts

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