Documentation
¶
Index ¶
- Variables
- type BroadcastOutbound
- type Config
- type Option
- type Server
- func (api *Server) EstimateGasForAction(ctx context.Context, in *iotexapi.EstimateGasForActionRequest) (*iotexapi.EstimateGasForActionResponse, error)
- func (api *Server) GetAccount(ctx context.Context, in *iotexapi.GetAccountRequest) (*iotexapi.GetAccountResponse, error)
- func (api *Server) GetActions(ctx context.Context, in *iotexapi.GetActionsRequest) (*iotexapi.GetActionsResponse, error)
- func (api *Server) GetActionsByAddress(ctx context.Context, in *iotexapi.GetActionsByAddressRequest) (*iotexapi.GetActionsResponse, error)
- func (api *Server) GetBlockMetas(ctx context.Context, in *iotexapi.GetBlockMetasRequest) (*iotexapi.GetBlockMetasResponse, error)
- func (api *Server) GetChainMeta(ctx context.Context, in *iotexapi.GetChainMetaRequest) (*iotexapi.GetChainMetaResponse, error)
- func (api *Server) GetEpochMeta(ctx context.Context, in *iotexapi.GetEpochMetaRequest) (*iotexapi.GetEpochMetaResponse, error)
- func (api *Server) GetRawBlocks(ctx context.Context, in *iotexapi.GetRawBlocksRequest) (*iotexapi.GetRawBlocksResponse, error)
- func (api *Server) GetReceiptByAction(ctx context.Context, in *iotexapi.GetReceiptByActionRequest) (*iotexapi.GetReceiptByActionResponse, error)
- func (api *Server) GetServerMeta(ctx context.Context, in *iotexapi.GetServerMetaRequest) (*iotexapi.GetServerMetaResponse, error)
- func (api *Server) ReadContract(ctx context.Context, in *iotexapi.ReadContractRequest) (*iotexapi.ReadContractResponse, error)
- func (api *Server) ReadState(ctx context.Context, in *iotexapi.ReadStateRequest) (*iotexapi.ReadStateResponse, error)
- func (api *Server) SendAction(ctx context.Context, in *iotexapi.SendActionRequest) (res *iotexapi.SendActionResponse, err error)
- func (api *Server) SendSignedActionBytes(ctx context.Context, in *iotexapi.SendSignedActionBytesRequest) (*iotexapi.SendActionResponse, error)
- func (api *Server) Start() error
- func (api *Server) Stop() error
- func (api *Server) StreamBlocks(in *iotexapi.StreamBlocksRequest, ...) error
- func (api *Server) SuggestGasPrice(ctx context.Context, in *iotexapi.SuggestGasPriceRequest) (*iotexapi.SuggestGasPriceResponse, error)
- type ServiceClient
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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.Config, chain blockchain.Blockchain, dispatcher dispatcher.Dispatcher, actPool actpool.ActPool, registry *protocol.Registry, opts ...Option, ) (*Server, error)
NewServer creates a new server
func (*Server) EstimateGasForAction ¶
func (api *Server) EstimateGasForAction(ctx context.Context, in *iotexapi.EstimateGasForActionRequest) (*iotexapi.EstimateGasForActionResponse, error)
EstimateGasForAction estimates gas for action
func (*Server) GetAccount ¶
func (api *Server) GetAccount(ctx context.Context, in *iotexapi.GetAccountRequest) (*iotexapi.GetAccountResponse, error)
GetAccount returns the metadata of an account
func (*Server) GetActions ¶
func (api *Server) GetActions(ctx context.Context, in *iotexapi.GetActionsRequest) (*iotexapi.GetActionsResponse, error)
GetActions returns actions
func (*Server) GetActionsByAddress ¶ added in v0.6.0
func (api *Server) GetActionsByAddress( ctx context.Context, in *iotexapi.GetActionsByAddressRequest) (*iotexapi.GetActionsResponse, error)
GetActionsByAddress returns actions by address
func (*Server) GetBlockMetas ¶
func (api *Server) GetBlockMetas(ctx context.Context, in *iotexapi.GetBlockMetasRequest) (*iotexapi.GetBlockMetasResponse, error)
GetBlockMetas returns block metadata
func (*Server) GetChainMeta ¶
func (api *Server) GetChainMeta(ctx context.Context, in *iotexapi.GetChainMetaRequest) (*iotexapi.GetChainMetaResponse, error)
GetChainMeta returns blockchain metadata
func (*Server) GetEpochMeta ¶
func (api *Server) GetEpochMeta( ctx context.Context, in *iotexapi.GetEpochMetaRequest, ) (*iotexapi.GetEpochMetaResponse, error)
GetEpochMeta gets epoch metadata
func (*Server) GetRawBlocks ¶ added in v0.6.0
func (api *Server) GetRawBlocks( ctx context.Context, in *iotexapi.GetRawBlocksRequest, ) (*iotexapi.GetRawBlocksResponse, error)
GetRawBlocks gets raw block data
func (*Server) GetReceiptByAction ¶
func (api *Server) GetReceiptByAction(ctx context.Context, in *iotexapi.GetReceiptByActionRequest) (*iotexapi.GetReceiptByActionResponse, error)
GetReceiptByAction gets receipt with corresponding action hash
func (*Server) GetServerMeta ¶
func (api *Server) GetServerMeta(ctx context.Context, in *iotexapi.GetServerMetaRequest) (*iotexapi.GetServerMetaResponse, error)
GetServerMeta gets the server metadata
func (*Server) ReadContract ¶
func (api *Server) ReadContract(ctx context.Context, in *iotexapi.ReadContractRequest) (*iotexapi.ReadContractResponse, error)
ReadContract reads the state in a contract address specified by the slot
func (*Server) ReadState ¶
func (api *Server) ReadState(ctx context.Context, in *iotexapi.ReadStateRequest) (*iotexapi.ReadStateResponse, error)
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) SendSignedActionBytes ¶ added in v0.6.0
func (api *Server) SendSignedActionBytes( ctx context.Context, in *iotexapi.SendSignedActionBytesRequest) (*iotexapi.SendActionResponse, error)
SendSignedActionBytes sends signed transaction bytes
func (*Server) StreamBlocks ¶ added in v0.6.0
func (api *Server) StreamBlocks(in *iotexapi.StreamBlocksRequest, stream iotexapi.APIService_StreamBlocksServer) error
StreamBlocks streams blocks
func (*Server) SuggestGasPrice ¶
func (api *Server) SuggestGasPrice(ctx context.Context, in *iotexapi.SuggestGasPriceRequest) (*iotexapi.SuggestGasPriceResponse, error)
SuggestGasPrice suggests gas price
type ServiceClient ¶ added in v0.6.0
type ServiceClient interface { // get the address detail of an address GetAccount(ctx context.Context, in *iotexapi.GetAccountRequest, opts ...grpc.CallOption) (*iotexapi.GetAccountResponse, error) // get action(s) by: // 1. start index and action count // 2. action hash // 3. address with start index and action count // 4. get unconfirmed actions by address with start index and action count // 5. block hash with start index and action count GetActions(ctx context.Context, in *iotexapi.GetActionsRequest, opts ...grpc.CallOption) (*iotexapi.GetActionsResponse, error) // get block metadata(s) by: // 1. start index and block count // 2. block hash GetBlockMetas(ctx context.Context, in *iotexapi.GetBlockMetasRequest, opts ...grpc.CallOption) (*iotexapi.GetBlockMetasResponse, error) // get chain metadata GetChainMeta(ctx context.Context, in *iotexapi.GetChainMetaRequest, opts ...grpc.CallOption) (*iotexapi.GetChainMetaResponse, error) // get server version GetServerMeta(ctx context.Context, in *iotexapi.GetServerMetaRequest, opts ...grpc.CallOption) (*iotexapi.GetServerMetaResponse, error) // sendAction SendAction(ctx context.Context, in *iotexapi.SendActionRequest, opts ...grpc.CallOption) (*iotexapi.SendActionResponse, error) // get receipt by action Hash GetReceiptByAction(ctx context.Context, in *iotexapi.GetReceiptByActionRequest, opts ...grpc.CallOption) (*iotexapi.GetReceiptByActionResponse, error) // TODO: read contract ReadContract(ctx context.Context, in *iotexapi.ReadContractRequest, opts ...grpc.CallOption) (*iotexapi.ReadContractResponse, error) // suggest gas price SuggestGasPrice(ctx context.Context, in *iotexapi.SuggestGasPriceRequest, opts ...grpc.CallOption) (*iotexapi.SuggestGasPriceResponse, error) // estimate gas for action EstimateGasForAction(ctx context.Context, in *iotexapi.EstimateGasForActionRequest, opts ...grpc.CallOption) (*iotexapi.EstimateGasForActionResponse, error) // read state from blockchain ReadState(ctx context.Context, in *iotexapi.ReadStateRequest, opts ...grpc.CallOption) (*iotexapi.ReadStateResponse, error) // get epoch metadata GetEpochMeta(ctx context.Context, in *iotexapi.GetEpochMetaRequest, opts ...grpc.CallOption) (*iotexapi.GetEpochMetaResponse, error) // get raw blocks data GetRawBlocks(ctx context.Context, in *iotexapi.GetRawBlocksRequest, opts ...grpc.CallOption) (*iotexapi.GetRawBlocksResponse, error) // get block info in stream StreamBlocks(ctx context.Context, in *iotexapi.StreamBlocksRequest, opts ...grpc.CallOption) (iotexapi.APIService_StreamBlocksClient, error) // get actions by addr GetActionsByAddress(ctx context.Context, in *iotexapi.GetActionsByAddressRequest, opts ...grpc.CallOption) (*iotexapi.GetActionsResponse, error) // send signed transaction bytes SendSignedActionBytes(ctx context.Context, in *iotexapi.SendSignedActionBytesRequest, opts ...grpc.CallOption) (*iotexapi.SendActionResponse, error) }
ServiceClient is the api service client interface corresponding to the one in github.com/iotexproject/iotex-proto. This interface is used by mockgen for test purposes. Remember to update it whenever definitions in api.proto change.