api

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApproveAPIGossipMessages

func ApproveAPIGossipMessages(ctx context.Context, s Service)

ApproveAPIGossipMessages registers the gossip api test protocol and approves every message as valid

Types

type GenesisTimeAPI

type GenesisTimeAPI interface {
	GetGenesisTime() time.Time
	GetCurrentLayer() types.LayerID
}

GenesisTimeAPI is an API to get genesis time and current layer of the system

type MempoolAPI added in v0.1.16

type MempoolAPI interface {
	Get(types.TransactionID) (*types.Transaction, error)
	GetTxIdsByAddress(types.Address) []types.TransactionID
	GetProjection(types.Address, uint64, uint64) (uint64, uint64)
}

MempoolAPI is an API for reading mempool data that's useful for API services

type MiningAPI

type MiningAPI interface {
	StartPost(address types.Address, datadir string, space uint64) error
	SetCoinbaseAccount(rewardAddress types.Address)
	// MiningStats returns state of post init, coinbase reward account and data directory path for post commitment
	MiningStats() (postStatus int, remainingBytes uint64, coinbaseAccount string, postDatadir string)
	GetSmesherID() types.NodeID
	Stop()
}

MiningAPI is an API for controlling Post, setting coinbase account and getting mining stats

type NetworkAPI

type NetworkAPI interface {
	Broadcast(channel string, data []byte) error
	SubscribePeerEvents() (conn, disc chan p2pcrypto.PublicKey)
}

NetworkAPI is an API to nodes gossip network

type PeerCounter

type PeerCounter interface {
	PeerCount() uint64
}

PeerCounter is an api to get amount of connected peers

type Service

type Service interface {
	RegisterGossipProtocol(string, priorityq.Priority) chan service.GossipMessage
}

Service is an interface for receiving messages via gossip

type Syncer

type Syncer interface {
	IsSynced() bool
	Start()
}

Syncer is the API to get sync status and to start sync

type TxAPI

type TxAPI interface {
	AddressExists(types.Address) bool
	ValidateNonceAndBalance(*types.Transaction) error
	GetATXs([]types.ATXID) (map[types.ATXID]*types.ActivationTx, []types.ATXID)
	GetLayer(types.LayerID) (*types.Layer, error)
	GetRewards(types.Address) ([]types.Reward, error)
	GetTransactions([]types.TransactionID) ([]*types.Transaction, map[types.TransactionID]struct{})
	GetTransactionsByDestination(types.LayerID, types.Address) []types.TransactionID
	GetTransactionsByOrigin(types.LayerID, types.Address) []types.TransactionID
	LatestLayer() types.LayerID
	GetLayerApplied(types.TransactionID) *types.LayerID
	GetTransaction(types.TransactionID) (*types.Transaction, error)
	GetProjection(types.Address, uint64, uint64) (uint64, uint64, error)
	LatestLayerInState() types.LayerID
	ProcessedLayer() types.LayerID
	GetStateRoot() types.Hash32
	GetLayerStateRoot(types.LayerID) (types.Hash32, error)
	GetBalance(types.Address) uint64
	GetNonce(types.Address) uint64
	GetAllAccounts() (*types.MultipleAccountsState, error)
}

TxAPI is an api for getting transaction status

Directories

Path Synopsis
Package config provides configuration for GRPC and HTTP api servers
Package config provides configuration for GRPC and HTTP api servers

Jump to

Keyboard shortcuts

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