api

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SEP206ContractAddress [20]byte = [20]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x27, 0x11}

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, sig [65]byte, err error)

	//Below is added in moeing chain only
	GetNonce(address common.Address, height int64) (uint64, error)
	GetBalance(address common.Address, height int64) (*big.Int, error)
	GetCode(contract common.Address, height int64) (bytecode []byte, codeHash []byte)
	GetStorageAt(address common.Address, key string, height int64) []byte
	Call(tx *gethtypes.Transaction, from common.Address, height int64) (statusCode int, retData []byte)
	CallForSbch(tx *gethtypes.Transaction, sender common.Address, height int64) *CallDetail
	EstimateGas(tx *gethtypes.Transaction, from common.Address, height int64) (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, sigs [][65]byte, err error)
	QueryTxByDst(address common.Address, startHeight, endHeight, limit uint32) (tx []*motypes.Transaction, sigs [][65]byte, err error)
	QueryTxByAddr(address common.Address, startHeight, endHeight, limit uint32) (tx []*motypes.Transaction, sigs [][65]byte, err error)
	SbchQueryLogs(addr common.Address, topics []common.Hash, startHeight, endHeight, limit uint32) ([]motypes.Log, error)
	GetTxListByHeight(height uint32) (tx []*motypes.Transaction, sigs [][65]byte, err error)
	GetTxListByHeightWithRange(height uint32, start, end int) (tx []*motypes.Transaction, sigs [][65]byte, 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)
	GetEpochList(from string) ([]*types.Epoch, error)
	GetCurrEpoch() *types.Epoch
	GetCCEpochs(start, end uint64) ([]*cctypes.CCEpoch, error)
	GetSeq(address common.Address) uint64
	GetPosVotes() map[[32]byte]*big.Int
	GetSyncBlock(height int64) (blk []byte, err error)
	GetRpcMaxLogResults() int

	//tendermint info
	NodeInfo() Info
	ValidatorsInfo() app.ValidatorsInfo
	ValidatorOnlineInfos() (int64, stakingtypes.ValidatorOnlineInfos)
	ValidatorWatchInfos() stakingtypes.ValidatorWatchInfos

	IsArchiveMode() bool
}

func NewBackend

func NewBackend(node ITmNode, app app.IApp) BackendService

type CallDetail added in v0.4.0

type CallDetail struct {
	Status                 int
	GasUsed                uint64
	OutData                []byte
	Logs                   []motypes.EvmLog
	CreatedContractAddress common.Address
	InternalTxCalls        []motypes.InternalTxCall
	InternalTxReturns      []motypes.InternalTxReturn
	RwLists                *motypes.ReadWriteLists
}

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, blockNum uint64) (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 ITmNode added in v0.4.5

type ITmNode interface {
	BroadcastTxSync(tx tmtypes.Tx) (common.Hash, error)
	GetNodeInfo() Info
}

func NewTmNode added in v0.4.5

func NewTmNode(node *node.Node) ITmNode

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 hexutil.Bytes   `json:"consensus_pub_key"`
	AppState        json.RawMessage `json:"genesis_state"`
	NextBlock       NextBlock       `json:"next_block"`
}

type NextBlock added in v0.4.3

type NextBlock struct {
	Number    int64       `json:"number"`
	Timestamp int64       `json:"timestamp"`
	Hash      common.Hash `json:"hash"`
}

Jump to

Keyboard shortcuts

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