Documentation ¶
Index ¶
- Constants
- Variables
- func AccountFromAnalyzer(acc analyzer.Account) *rosettaTypes.AccountIdentifier
- func AllCallMethods() []string
- func FullToPartialBlockIdentifier(blockIdentifer *rosettaTypes.BlockIdentifier) *rosettaTypes.PartialBlockIdentifier
- func HeaderContainsTx(header *ethclient.HeaderAndTxnHashes, txHash common.Hash) bool
- func HeaderToBlockIdentifier(header *gethTypes.Header) *rosettaTypes.BlockIdentifier
- func HeaderToParentBlockIdentifier(header *gethTypes.Header) *rosettaTypes.BlockIdentifier
- func LogErrCeloClient(rpcEndpoint string, err error) *types.Error
- func LogErrDetails(rosettaErr *types.Error, err error) *types.Error
- func LogErrFetchBlockHeader(err error) *types.Error
- func LogErrInternal(err error, params ...interface{}) *types.Error
- func LogErrUnimplemented(rosettaEndpoint string) *types.Error
- func LogErrValidation(err error) *types.Error
- func MapTxHashesToTransaction(txHashes []common.Hash) []*rosettaTypes.TransactionIdentifier
- func NewAccountIdentifier(addr common.Address, subAccount *rosettaTypes.SubAccountIdentifier) rosettaTypes.AccountIdentifier
- func NewAmount(value *big.Int, currency *rosettaTypes.Currency) *rosettaTypes.Amount
- func NewErrorResponse(code int32, msg string) *types.Error
- func NewOperationIdentifier(index int64) *rosettaTypes.OperationIdentifier
- func NewRetriableErrorResponse(code int32, msg string) *types.Error
- func NewRosettaServer(cc *client.CeloClient, db db.RosettaDBReader, cfg *RosettaServerConfig, ...) (*rosettaServer, error)
- func OperationsFromAnalyzer(iop *analyzer.Operation, baseIndex int64) []*rosettaTypes.Operation
- func PeersFromInfo(peersInfo []p2p.PeerInfo) []*rosettaTypes.Peer
- func TxIdsFromTxAccountMap(txAccountMap txpool.TxAccountMap) []*rosettaTypes.TransactionIdentifier
- type CallLogsResult
- type CallMethod
- type CallResult
- type OperationResult
- type RosettaServerConfig
- type Servicer
- func (s *Servicer) AccountBalance(ctx context.Context, request *types.AccountBalanceRequest) (*types.AccountBalanceResponse, *types.Error)
- func (s *Servicer) Block(ctx context.Context, request *types.BlockRequest) (*types.BlockResponse, *types.Error)
- func (S *Servicer) BlockTransaction(ctx context.Context, request *types.BlockTransactionRequest) (*types.BlockTransactionResponse, *types.Error)
- func (s *Servicer) Call(ctx context.Context, request *types.CallRequest) (*types.CallResponse, *types.Error)
- func (s *Servicer) ConstructionCombine(context.Context, *types.ConstructionCombineRequest) (*types.ConstructionCombineResponse, *types.Error)
- func (s *Servicer) ConstructionDerive(context.Context, *types.ConstructionDeriveRequest) (*types.ConstructionDeriveResponse, *types.Error)
- func (s *Servicer) ConstructionHash(context.Context, *types.ConstructionHashRequest) (*types.TransactionIdentifierResponse, *types.Error)
- func (s *Servicer) ConstructionMetadata(ctx context.Context, request *types.ConstructionMetadataRequest) (*types.ConstructionMetadataResponse, *types.Error)
- func (s *Servicer) ConstructionParse(context.Context, *types.ConstructionParseRequest) (*types.ConstructionParseResponse, *types.Error)
- func (s *Servicer) ConstructionPayloads(context.Context, *types.ConstructionPayloadsRequest) (*types.ConstructionPayloadsResponse, *types.Error)
- func (s *Servicer) ConstructionPreprocess(context.Context, *types.ConstructionPreprocessRequest) (*types.ConstructionPreprocessResponse, *types.Error)
- func (s *Servicer) ConstructionSubmit(ctx context.Context, request *types.ConstructionSubmitRequest) (*types.TransactionIdentifierResponse, *types.Error)
- func (s *Servicer) Mempool(ctx context.Context, request *types.NetworkRequest) (*types.MempoolResponse, *types.Error)
- func (s *Servicer) MempoolTransaction(ctx context.Context, request *types.MempoolTransactionRequest) (*types.MempoolTransactionResponse, *types.Error)
- func (s *Servicer) NetworkList(ctx context.Context, request *types.MetadataRequest) (*types.NetworkListResponse, *types.Error)
- func (s *Servicer) NetworkOptions(ctx context.Context, request *types.NetworkRequest) (*types.NetworkOptionsResponse, *types.Error)
- func (s *Servicer) NetworkStatus(ctx context.Context, request *types.NetworkRequest) (*types.NetworkStatusResponse, *types.Error)
Constants ¶
View Source
const ( OptionsFromKey = "from" OptionsToKey = "to" OptionsValueKey = "value" OptionsMethodKey = "method" OptionsArgsKey = "args" )
View Source
const ( RosettaVersion = "1.3.1" BlockchainName = "celo" )
Variables ¶
View Source
var ( ErrValidation = NewErrorResponse(400, "Request body invalid") ErrUnimplemented = NewErrorResponse(405, "Unimplemented rosetta endpoint") ErrInternal = NewErrorResponse(500, "Internal server error") ErrCeloClient = NewErrorResponse(502, "Celo node rpc request failed") )
View Source
var ( ErrBadBlockIdentifier = errors.New("Bad block identifier") ErrFetchBlockHeader = errors.New("Failed to fetch block header") ErrMissingTxInBlock = errors.New("Transaction doesn't belong to block") )
View Source
var ( CeloGold = &types.Currency{ Symbol: "cGLD", Decimals: 18, } CeloDollar = &types.Currency{ Symbol: "cUSD", Decimals: 18, } )
View Source
var ( MiddlewareVersion = "1.0.1" NodeVersion = params.Version )
Functions ¶
func AccountFromAnalyzer ¶
func AccountFromAnalyzer(acc analyzer.Account) *rosettaTypes.AccountIdentifier
func AllCallMethods ¶ added in v0.7.5
func AllCallMethods() []string
func FullToPartialBlockIdentifier ¶
func FullToPartialBlockIdentifier(blockIdentifer *rosettaTypes.BlockIdentifier) *rosettaTypes.PartialBlockIdentifier
func HeaderContainsTx ¶
func HeaderContainsTx(header *ethclient.HeaderAndTxnHashes, txHash common.Hash) bool
func HeaderToBlockIdentifier ¶
func HeaderToBlockIdentifier(header *gethTypes.Header) *rosettaTypes.BlockIdentifier
func HeaderToParentBlockIdentifier ¶
func HeaderToParentBlockIdentifier(header *gethTypes.Header) *rosettaTypes.BlockIdentifier
func LogErrDetails ¶ added in v0.7.3
func LogErrFetchBlockHeader ¶
func LogErrInternal ¶
func LogErrUnimplemented ¶
func LogErrValidation ¶
func MapTxHashesToTransaction ¶
func MapTxHashesToTransaction(txHashes []common.Hash) []*rosettaTypes.TransactionIdentifier
func NewAccountIdentifier ¶
func NewAccountIdentifier(addr common.Address, subAccount *rosettaTypes.SubAccountIdentifier) rosettaTypes.AccountIdentifier
func NewAmount ¶
func NewAmount(value *big.Int, currency *rosettaTypes.Currency) *rosettaTypes.Amount
func NewErrorResponse ¶
[Caution]: all expected error responses must be enumerated in /network/options
func NewOperationIdentifier ¶
func NewOperationIdentifier(index int64) *rosettaTypes.OperationIdentifier
func NewRetriableErrorResponse ¶
[Caution]: all expected error responses must be enumerated in /network/options
func NewRosettaServer ¶
func NewRosettaServer(cc *client.CeloClient, db db.RosettaDBReader, cfg *RosettaServerConfig, chainParams *chain.ChainParameters) (*rosettaServer, error)
func OperationsFromAnalyzer ¶
func OperationsFromAnalyzer(iop *analyzer.Operation, baseIndex int64) []*rosettaTypes.Operation
func PeersFromInfo ¶
func PeersFromInfo(peersInfo []p2p.PeerInfo) []*rosettaTypes.Peer
func TxIdsFromTxAccountMap ¶
func TxIdsFromTxAccountMap(txAccountMap txpool.TxAccountMap) []*rosettaTypes.TransactionIdentifier
Types ¶
type CallLogsResult ¶ added in v0.7.7
type CallMethod ¶ added in v0.7.5
type CallMethod string
const CeloCall CallMethod = "celo_call"
const CeloGetLogs CallMethod = "celo_getLogs"
func (CallMethod) String ¶ added in v0.7.5
func (cm CallMethod) String() string
type CallResult ¶ added in v0.7.7
type CallResult struct { Raw []byte `json:"raw"` BlockIdentifier *types.BlockIdentifier `json:"block_identifier"` }
type OperationResult ¶
type OperationResult string
const ( OperationSuccess OperationResult = "success" OperationFailed OperationResult = "failed" )
func GetOperationStatus ¶
func GetOperationStatus(success bool) OperationResult
func (OperationResult) String ¶
func (or OperationResult) String() string
func (OperationResult) ToOperationStatus ¶
func (or OperationResult) ToOperationStatus() *types.OperationStatus
type RosettaServerConfig ¶
func (*RosettaServerConfig) ListenAddress ¶
func (hs *RosettaServerConfig) ListenAddress() string
type Servicer ¶
type Servicer struct {
// contains filtered or unexported fields
}
Servicer is a service that implents the logic for the Servicerr This service should implement the business logic for every endpoint for the AccountApi API. Include any external packages or services that will be required by this service.
func NewServicer ¶
func NewServicer(celoClient *client.CeloClient, db db.RosettaDBReader, cfg *RosettaServerConfig, cp *chain.ChainParameters) (*Servicer, error)
NewServicer creates a default api service
func (*Servicer) AccountBalance ¶
func (s *Servicer) AccountBalance(ctx context.Context, request *types.AccountBalanceRequest) (*types.AccountBalanceResponse, *types.Error)
AccountBalance - Get an Account Balance
func (*Servicer) Block ¶
func (s *Servicer) Block(ctx context.Context, request *types.BlockRequest) (*types.BlockResponse, *types.Error)
Block - Get a Block
func (*Servicer) BlockTransaction ¶
func (S *Servicer) BlockTransaction(ctx context.Context, request *types.BlockTransactionRequest) (*types.BlockTransactionResponse, *types.Error)
BlockTransaction - Get a Block Transaction
func (*Servicer) Call ¶ added in v0.7.5
func (s *Servicer) Call(ctx context.Context, request *types.CallRequest) (*types.CallResponse, *types.Error)
func (*Servicer) ConstructionCombine ¶ added in v0.7.3
func (s *Servicer) ConstructionCombine( context.Context, *types.ConstructionCombineRequest, ) (*types.ConstructionCombineResponse, *types.Error)
func (*Servicer) ConstructionDerive ¶ added in v0.7.3
func (s *Servicer) ConstructionDerive( context.Context, *types.ConstructionDeriveRequest, ) (*types.ConstructionDeriveResponse, *types.Error)
func (*Servicer) ConstructionHash ¶ added in v0.7.3
func (s *Servicer) ConstructionHash( context.Context, *types.ConstructionHashRequest, ) (*types.TransactionIdentifierResponse, *types.Error)
func (*Servicer) ConstructionMetadata ¶
func (s *Servicer) ConstructionMetadata(ctx context.Context, request *types.ConstructionMetadataRequest) (*types.ConstructionMetadataResponse, *types.Error)
func (*Servicer) ConstructionParse ¶ added in v0.7.3
func (s *Servicer) ConstructionParse( context.Context, *types.ConstructionParseRequest, ) (*types.ConstructionParseResponse, *types.Error)
func (*Servicer) ConstructionPayloads ¶ added in v0.7.3
func (s *Servicer) ConstructionPayloads( context.Context, *types.ConstructionPayloadsRequest, ) (*types.ConstructionPayloadsResponse, *types.Error)
func (*Servicer) ConstructionPreprocess ¶ added in v0.7.3
func (s *Servicer) ConstructionPreprocess( context.Context, *types.ConstructionPreprocessRequest, ) (*types.ConstructionPreprocessResponse, *types.Error)
func (*Servicer) ConstructionSubmit ¶
func (s *Servicer) ConstructionSubmit(ctx context.Context, request *types.ConstructionSubmitRequest) (*types.TransactionIdentifierResponse, *types.Error)
func (*Servicer) Mempool ¶
func (s *Servicer) Mempool(ctx context.Context, request *types.NetworkRequest) (*types.MempoolResponse, *types.Error)
Mempool - Get All Mempool Transactions
func (*Servicer) MempoolTransaction ¶
func (s *Servicer) MempoolTransaction(ctx context.Context, request *types.MempoolTransactionRequest) (*types.MempoolTransactionResponse, *types.Error)
MempoolTransaction - Get a Mempool Transaction
func (*Servicer) NetworkList ¶
func (s *Servicer) NetworkList(ctx context.Context, request *types.MetadataRequest) (*types.NetworkListResponse, *types.Error)
func (*Servicer) NetworkOptions ¶
func (s *Servicer) NetworkOptions(ctx context.Context, request *types.NetworkRequest) (*types.NetworkOptionsResponse, *types.Error)
func (*Servicer) NetworkStatus ¶
func (s *Servicer) NetworkStatus(ctx context.Context, request *types.NetworkRequest) (*types.NetworkStatusResponse, *types.Error)
NetworkStatus - Get Network Status
Click to show internal directories.
Click to hide internal directories.