rpc

package
v0.0.0-...-84d53aa Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: GPL-3.0 Imports: 28 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// genesis block
	GENESIS = "genesis"
	// last irreversible block
	CONFIRMED = "confirmed"
	// tail block
	TAIL = "tail"
)

Block alias

View Source
const (
	ErrMsgBlockNotFound           = "block not found"
	ErrMsgInternalError           = "unverified server error"
	ErrMsgInvalidBlockHeight      = "invalid block height"
	ErrMsgInvalidTxHash           = "invalid transaction hash"
	ErrMsgInvalidTxValue          = "invalid transaction value"
	ErrMsgTransactionNotFound     = "transaction not found"
	ErrMsgInvalidRequest          = "invalid request"
	ErrMsgFailedToUpdateBandwidth = "failed to update bandwidth"
	ErrMsgFailedToUpdateUnstaking = "failed to update Unstaking"
	ErrMsgTooManyBlocksRequest    = "exceed max blocks count"
	ErrMsgAliasNotFound           = "alias not found"
	ErrMsgInvalidBlockType        = "invalid block type"
	ErrMsgCandidateNotFound       = "candidate not found"
	ErrMsgInvalidToAddress        = "invalid to address"
	ErrMsgInvalidSignature        = "invalid signature"
	ErrMsgInvalidPayerSignature   = "invalid payer signature"
	ErrMsgInvalidBlockHash        = "invalid block hash"
	ErrMsgInvalidCandidateID      = "invalid candidate id"
	ErrMsgInvalidAddress          = "invalid address"
	ErrMsgInvalidPayload          = "invalid payload"
)

Errors for rpc

View Source
const (
	MaxBlocksCount = 50
)

Limit for get blocks request

Variables

This section is empty.

Functions

func CoreTx2rpcTx

func CoreTx2rpcTx(tx *core.Transaction, onChain bool) *rpcpb.Transaction

CoreTx2rpcTx converts core transaction type to rpcpb response type

Types

type APIService

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

APIService is blockchain api rpc service.

func (*APIService) GetAccount

func (s *APIService) GetAccount(ctx context.Context, req *rpcpb.GetAccountRequest) (*rpcpb.Account,
	error)

GetAccount handles GetAccount rpc.

func (*APIService) GetBlock

func (s *APIService) GetBlock(ctx context.Context, req *rpcpb.GetBlockRequest) (*rpcpb.Block, error)

GetBlock returns block

func (*APIService) GetBlocks

func (s *APIService) GetBlocks(ctx context.Context, req *rpcpb.GetBlocksRequest) (*rpcpb.Blocks, error)

GetBlocks returns blocks

func (*APIService) GetCandidate

func (s *APIService) GetCandidate(ctx context.Context, req *rpcpb.GetCandidateRequest) (*rpcpb.Candidate, error)

GetCandidate returns matched candidate information

func (*APIService) GetCandidates

func (s *APIService) GetCandidates(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.Candidates,
	error)

GetCandidates returns all candidates

func (*APIService) GetDynasty

func (s *APIService) GetDynasty(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.Dynasty, error)

GetDynasty returns all dynasty accounts

func (*APIService) GetMedState

func (s *APIService) GetMedState(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.MedState,
	error)

GetMedState return mednet state

func (*APIService) GetPendingTransactions

func (s *APIService) GetPendingTransactions(ctx context.Context,
	req *rpcpb.NonParamRequest) (*rpcpb.Transactions, error)

GetPendingTransactions sends all transactions in the transaction pool TODO Need GETALL(?)

func (*APIService) GetTransaction

func (s *APIService) GetTransaction(ctx context.Context, req *rpcpb.GetTransactionRequest) (*rpcpb.
	Transaction, error)

GetTransaction returns transaction

func (*APIService) GetTransactionReceipt

func (s *APIService) GetTransactionReceipt(ctx context.Context, req *rpcpb.GetTransactionRequest) (*rpcpb.
	TransactionReceipt, error)

GetTransactionReceipt returns transaction receipt

func (*APIService) HealthCheck

func (s *APIService) HealthCheck(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.Health,
	error)

HealthCheck returns success.

func (*APIService) SendTransaction

func (s *APIService) SendTransaction(ctx context.Context, req *rpcpb.SendTransactionRequest) (*rpcpb.
	TransactionHash, error)

SendTransaction sends transaction

func (*APIService) Subscribe

Subscribe to listen event

type HTTPServer

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

HTTPServer is a rest gateway wrapping the grpc server.

func NewHTTPServer

func NewHTTPServer(httpAddr string, grpcAddr string) (*HTTPServer, error)

NewHTTPServer creates HTTPServer.

func (*HTTPServer) Run

func (srv *HTTPServer) Run() error

Run starts the server.

type Server

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

Server is rpc server.

func New

func New(cfg *medletpb.Config) *Server

New returns NewServer.

func (*Server) RunGateway

func (s *Server) RunGateway() error

RunGateway runs rest gateway server.

func (*Server) Setup

func (s *Server) Setup(bm *core.BlockManager, tm *core.TransactionManager, ee *event.Emitter, ns net.Service)

Setup sets up server.

func (*Server) Start

func (s *Server) Start() error

Start starts rpc server.

func (*Server) Stop

func (s *Server) Stop()

Stop stops server.

Directories

Path Synopsis
pb
Package rpcpb is a generated protocol buffer package.
Package rpcpb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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