Documentation ¶
Index ¶
- Constants
- func GetAddressKey(address string) string
- func GetExplorerPort(nodePort string) string
- type Address
- type Data
- type HTTPError
- type Service
- func (s *Service) APIs() []rpc.API
- func (s *Service) GetAddresses(w http.ResponseWriter, r *http.Request)
- func (s *Service) GetCirculatingSupply(w http.ResponseWriter, r *http.Request)
- func (s *Service) GetTotalSupply(w http.ResponseWriter, r *http.Request)
- func (s *Service) Init(remove bool)
- func (s *Service) NotifyService(params map[string]interface{})
- func (s *Service) Run() *http.Server
- func (s *Service) SetMessageChan(messageChan chan *msg_pb.Message)
- func (s *Service) StartService()
- func (s *Service) StopService()
- type Storage
- func (storage *Storage) Dump(block *types.Block, height uint64)
- func (storage *Storage) GetAddresses(size int, prefix string) ([]string, error)
- func (storage *Storage) GetDB() *leveldb.DB
- func (storage *Storage) Init(ip, port string, remove bool)
- func (storage *Storage) UpdateAddress(batch *leveldb.Batch, explorerTransaction *Transaction, tx *types.Transaction)
- func (storage *Storage) UpdateAddressStorage(batch *leveldb.Batch, addr string, explorerTransaction *Transaction, ...)
- type Transaction
Constants ¶
const ( AddressPrefix = "ad" PrefixLen = 3 )
Constants for storage.
const ( Received = "RECEIVED" Sent = "SENT" )
Tx types ...
Variables ¶
This section is empty.
Functions ¶
func GetExplorerPort ¶
GetExplorerPort returns the port serving explorer dashboard. This port is explorerPortDifference less than the node port.
Types ¶
type Address ¶
type Address struct { ID string `json:"id"` Balance *big.Int `json:"balance"` TXs []*Transaction `json:"txs"` }
Address ...
type Service ¶
type Service struct { IP string Port string Storage *Storage // contains filtered or unexported fields }
Service is the struct for explorer service.
func (*Service) GetAddresses ¶ added in v1.2.5
func (s *Service) GetAddresses(w http.ResponseWriter, r *http.Request)
GetAddresses serves end-point /addresses, returns size of addresses from address with prefix.
func (*Service) GetCirculatingSupply ¶ added in v1.3.2
func (s *Service) GetCirculatingSupply(w http.ResponseWriter, r *http.Request)
GetCirculatingSupply serves /circulating-supply end-point.
func (*Service) GetTotalSupply ¶ added in v1.3.2
func (s *Service) GetTotalSupply(w http.ResponseWriter, r *http.Request)
GetTotalSupply serves /total-supply end-point.
func (*Service) NotifyService ¶
NotifyService notify service.
func (*Service) SetMessageChan ¶
SetMessageChan sets up message channel to service.
func (*Service) StartService ¶
func (s *Service) StartService()
StartService starts explorer service.
func (*Service) StopService ¶
func (s *Service) StopService()
StopService shutdowns explorer service.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage dump the block info into leveldb.
func GetStorageInstance ¶
GetStorageInstance returns attack model by using singleton pattern.
func (*Storage) GetAddresses ¶ added in v1.2.5
GetAddresses returns size of addresses from address with prefix.
func (*Storage) UpdateAddress ¶
func (storage *Storage) UpdateAddress(batch *leveldb.Batch, explorerTransaction *Transaction, tx *types.Transaction)
UpdateAddress ...
func (*Storage) UpdateAddressStorage ¶
func (storage *Storage) UpdateAddressStorage(batch *leveldb.Batch, addr string, explorerTransaction *Transaction, tx *types.Transaction)
UpdateAddressStorage updates specific addr Address.
type Transaction ¶
type Transaction struct { ID string `json:"id"` Timestamp string `json:"timestamp"` From string `json:"from"` To string `json:"to"` Value *big.Int `json:"value"` Bytes string `json:"bytes"` Data string `json:"data"` GasFee *big.Int `json:"gasFee"` FromShard uint32 `json:"fromShard"` ToShard uint32 `json:"toShard"` Type string `json:"type"` }
Transaction ...
func GetTransaction ¶
func GetTransaction(tx *types.Transaction, addressBlock *types.Block) *Transaction
GetTransaction ...