api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

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) GetEpochMeta

GetEpochMeta gets epoch metadata

func (*Server) GetReceiptByAction

GetReceiptByAction gets receipt with corresponding action hash

func (*Server) GetServerMeta

GetServerMeta gets the server metadata

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