api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendService

type BackendService interface {
	FilterService

	// General Ethereum API
	//Downloader() *downloader.Downloader
	ProtocolVersion() int

	// Blockchain API
	ChainId() *big.Int
	//SetHead(number uint64)
	//HeaderByNumber(ctx context.Context, number int64) (*types.Header, error)
	//HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	//HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error)
	//CurrentHeader() *types.Header
	LatestHeight() int64
	CurrentBlock() (*motypes.Block, error)
	BlockByNumber(number int64) (*motypes.Block, error)
	BlockByHash(hash common.Hash) (*motypes.Block, error)

	// Transaction pool API
	SendRawTx(signedTx []byte) (common.Hash, error)
	GetTransaction(txHash common.Hash) (tx *motypes.Transaction, blockHash common.Hash, blockNumber uint64, blockIndex uint64, err error)

	//Below is added in moeing chain only
	GetNonce(address common.Address) (uint64, error)
	GetBalance(address common.Address, height int64) (*big.Int, error)
	GetCode(contract common.Address, blockNumber int64) (bytecode []byte, codeHash []byte)
	GetStorageAt(address common.Address, key string, blockNumber int64) []byte
	Call(tx *gethtypes.Transaction, from common.Address) (statusCode int, retData []byte)
	EstimateGas(tx *gethtypes.Transaction, from common.Address) (statusCode int, retData []byte, gas int64)
	QueryLogs(addresses []common.Address, topics [][]common.Hash, startHeight, endHeight uint32, filter motypes.FilterFunc) ([]motypes.Log, error)
	QueryTxBySrc(address common.Address, startHeight, endHeight, limit uint32) (tx []*motypes.Transaction, err error)
	QueryTxByDst(address common.Address, startHeight, endHeight, limit uint32) (tx []*motypes.Transaction, err error)
	QueryTxByAddr(address common.Address, startHeight, endHeight, limit uint32) (tx []*motypes.Transaction, err error)
	SbchQueryLogs(addr common.Address, topics []common.Hash, startHeight, endHeight, limit uint32) ([]motypes.Log, error)
	GetTxListByHeight(height uint32) (tx []*motypes.Transaction, err error)
	GetTxListByHeightWithRange(height uint32, start, end int) (tx []*motypes.Transaction, err error)
	GetFromAddressCount(addr common.Address) int64
	GetToAddressCount(addr common.Address) int64
	GetSep20ToAddressCount(contract common.Address, addr common.Address) int64
	GetSep20FromAddressCount(contract common.Address, addr common.Address) int64
	GetEpochs(start, end uint64) ([]*types.Epoch, error)

	//tendermint info
	NodeInfo() Info
	ValidatorsInfo() app.ValidatorsInfo
}

func NewBackend

func NewBackend(node *node.Node, app *app.App) BackendService

type FilterService

type FilterService interface {
	HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*motypes.Header, error)
	HeaderByHash(ctx context.Context, blockHash common.Hash) (*motypes.Header, error)
	GetReceipts(ctx context.Context, blockHash common.Hash) (gethtypes.Receipts, error)
	GetLogs(ctx context.Context, blockHash common.Hash) ([][]*gethtypes.Log, error)

	SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription
	SubscribeChainEvent(ch chan<- motypes.ChainEvent) event.Subscription
	SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription
	SubscribeLogsEvent(ch chan<- []*gethtypes.Log) event.Subscription

	BloomStatus() (uint64, uint64)
	ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
}

type Info added in v0.1.2

type Info struct {
	IsValidator     bool            `json:"is_validator"`
	ValidatorIndex  int64           `json:"validator_index"`
	Height          int64           `json:"height"`
	Seed            string          `json:"seed"`
	ConsensusPubKey crypto.PubKey   `json:"consensus_pub_key"`
	AppState        json.RawMessage `json:"app_state"`
}

-----------------------tendermint info----------------------------

Jump to

Keyboard shortcuts

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