Documentation ¶
Index ¶
- Constants
- func CoreTx2rpcTx(tx *core.Transaction, onChain bool) *rpcpb.Transaction
- type APIService
- func (s *APIService) GetAccount(ctx context.Context, req *rpcpb.GetAccountRequest) (*rpcpb.Account, error)
- func (s *APIService) GetBlock(ctx context.Context, req *rpcpb.GetBlockRequest) (*rpcpb.Block, error)
- func (s *APIService) GetBlocks(ctx context.Context, req *rpcpb.GetBlocksRequest) (*rpcpb.Blocks, error)
- func (s *APIService) GetCandidate(ctx context.Context, req *rpcpb.GetCandidateRequest) (*rpcpb.Candidate, error)
- func (s *APIService) GetCandidates(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.Candidates, error)
- func (s *APIService) GetDynasty(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.Dynasty, error)
- func (s *APIService) GetMedState(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.MedState, error)
- func (s *APIService) GetPendingTransactions(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.Transactions, error)
- func (s *APIService) GetTransaction(ctx context.Context, req *rpcpb.GetTransactionRequest) (..., error)
- func (s *APIService) GetTransactionReceipt(ctx context.Context, req *rpcpb.GetTransactionRequest) (..., error)
- func (s *APIService) HealthCheck(ctx context.Context, req *rpcpb.NonParamRequest) (*rpcpb.Health, error)
- func (s *APIService) SendTransaction(ctx context.Context, req *rpcpb.SendTransactionRequest) (..., error)
- func (s *APIService) Subscribe(req *rpcpb.SubscribeRequest, stream rpcpb.ApiService_SubscribeServer) error
- type HTTPServer
- type Server
Constants ¶
const ( // genesis block GENESIS = "genesis" // last irreversible block CONFIRMED = "confirmed" // tail block TAIL = "tail" )
Block alias
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
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 ¶
func (s *APIService) Subscribe(req *rpcpb.SubscribeRequest, stream rpcpb.ApiService_SubscribeServer) error
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.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is rpc server.
func (*Server) RunGateway ¶
RunGateway runs rest gateway server.