api

package
v0.5.0-rc2-b2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: Apache-2.0 Imports: 27 Imported by: 4 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInternalServer indicates the internal server error
	ErrInternalServer = errors.New("internal server error")
	// ErrReceipt indicates the error of receipt
	ErrReceipt = errors.New("invalid receipt")
	// ErrAction indicates the error of action
	ErrAction = errors.New("invalid action")
)

Functions

This section is empty.

Types

type BroadcastOutbound

type BroadcastOutbound func(ctx context.Context, chainID uint32, msg proto.Message) error

BroadcastOutbound sends a broadcast message to the whole network

type Config

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

Config represents the config to setup api

type Option

type Option func(cfg *Config) error

Option is the option to override the api config

func WithBroadcastOutbound

func WithBroadcastOutbound(broadcastHandler BroadcastOutbound) Option

WithBroadcastOutbound is the option to broadcast msg outbound

type Server

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

Server provides api for user to query blockchain data

func NewServer

func NewServer(
	cfg config.API,
	chain blockchain.Blockchain,
	dispatcher dispatcher.Dispatcher,
	actPool actpool.ActPool,
	idx *indexservice.Server,
	registry *protocol.Registry,
	opts ...Option,
) (*Server, error)

NewServer creates a new server

func (*Server) EstimateGasForAction

EstimateGasForAction estimates gas for action

func (*Server) GetAccount

GetAccount returns the metadata of an account

func (*Server) GetActions

GetActions returns actions

func (*Server) GetBlockMetas

GetBlockMetas returns block metadata

func (*Server) GetChainMeta

GetChainMeta returns blockchain metadata

func (*Server) GetReceiptByAction

GetReceiptByAction gets receipt with corresponding action hash

func (*Server) ReadContract

ReadContract reads the state in a contract address specified by the slot

func (*Server) ReadState

ReadState reads state on blockchain

func (*Server) SendAction

func (api *Server) SendAction(ctx context.Context, in *iotexapi.SendActionRequest) (res *iotexapi.SendActionResponse, err error)

SendAction is the API to send an action to blockchain.

func (*Server) Start

func (api *Server) Start() error

Start starts the API server

func (*Server) Stop

func (api *Server) Stop() error

Stop stops the API server

func (*Server) SuggestGasPrice

SuggestGasPrice suggests gas price

Jump to

Keyboard shortcuts

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