Documentation
¶
Index ¶
- Constants
- func NewDefaultHttpClient(requestTimeoutSec uint64) *httpClient
- func NewHyperBlockProxy(hyperBlockFacade HyperBlockFacadeHandler, cfg config.Config) (*hyperBlockProxy, error)
- func NewMultiversxHyperBlockEndPoint(httpClient HTTPClient) (*multiversxHyperBlockEndPoint, error)
- type CovalentHyperBlockApiResponse
- type CovalentHyperBlocksApiResponse
- type HTTPClient
- type HTTPServer
- type HyperBlockFacadeHandler
- type HyperBlockProxy
- type Interval
- type MultiversxHyperBlockApiResponse
- type MultiversxHyperBlockApiResponsePayload
- type MultiversxHyperBlockEndpointHandler
- type ReturnCode
Constants ¶
const ( // UrlParameterWithLogs represents the name of an URL parameter to query logs per hyperBlock UrlParameterWithLogs = "withLogs" // UrlParameterNotarizedAtSource represents the name of an URL parameter to query hyper blocks which are notarized at source UrlParameterNotarizedAtSource = "notarizedAtSource" // UrlParameterWithAlteredAccounts represents the name of an URL parameter to query altered accounts per hyperBlock UrlParameterWithAlteredAccounts = "withAlteredAccounts" // UrlParameterTokens represents the name of an URL parameter to query altered accounts with tokens UrlParameterTokens = "tokens" )
Variables ¶
This section is empty.
Functions ¶
func NewDefaultHttpClient ¶
func NewDefaultHttpClient(requestTimeoutSec uint64) *httpClient
NewDefaultHttpClient will create a default http client which can be queried to GET url responses
func NewHyperBlockProxy ¶
func NewHyperBlockProxy( hyperBlockFacade HyperBlockFacadeHandler, cfg config.Config, ) (*hyperBlockProxy, error)
NewHyperBlockProxy will create a covalent proxy, able to fetch hyper block requests from Multiversx and return them in covalent format
func NewMultiversxHyperBlockEndPoint ¶
func NewMultiversxHyperBlockEndPoint(httpClient HTTPClient) (*multiversxHyperBlockEndPoint, error)
NewMultiversxHyperBlockEndPoint will create a handler which can fetch hyper blocks from Multiversx gateway
Types ¶
type CovalentHyperBlockApiResponse ¶
type CovalentHyperBlockApiResponse struct {
Data []byte `json:"data"`
Error string `json:"error"`
Code ReturnCode `json:"code"`
}
CovalentHyperBlockApiResponse is the hyper block dto response for Covalent
type CovalentHyperBlocksApiResponse ¶
type CovalentHyperBlocksApiResponse struct {
Data [][]byte `json:"data"`
Error string `json:"error"`
Code ReturnCode `json:"code"`
}
CovalentHyperBlocksApiResponse is the hyper blocks dto response for Covalent
type HTTPClient ¶
HTTPClient defines what a client which should be able to GET requests should do
type HTTPServer ¶
type HTTPServer interface {
ListenAndServe() error
Shutdown(ctx context.Context) error
Close() error
}
HTTPServer defines what an http server should do
type HyperBlockFacadeHandler ¶
type HyperBlockFacadeHandler interface {
GetHyperBlockByNonce(nonce uint64, options config.HyperBlockQueryOptions) (*CovalentHyperBlockApiResponse, error)
GetHyperBlockByHash(hash string, options config.HyperBlockQueryOptions) (*CovalentHyperBlockApiResponse, error)
GetHyperBlocksByInterval(noncesInterval *Interval, options config.HyperBlocksQueryOptions) (*CovalentHyperBlocksApiResponse, error)
}
HyperBlockFacadeHandler defines the actions needed for fetching of hyperBlocks from Multiversx proxy in covalent format
type HyperBlockProxy ¶
type HyperBlockProxy interface {
GetHyperBlockByNonce(c *gin.Context)
GetHyperBlockByHash(c *gin.Context)
GetHyperBlocksByInterval(c *gin.Context)
}
HyperBlockProxy is the covalent proxy. It should be able to fetch hyper blocks from Multiversx proxy(json format), process them and provide avro schema defined hyper blocks(as byte array).
type MultiversxHyperBlockApiResponse ¶
type MultiversxHyperBlockApiResponse struct {
Data MultiversxHyperBlockApiResponsePayload `json:"data"`
Error string `json:"error"`
Code ReturnCode `json:"code"`
}
MultiversxHyperBlockApiResponse is the expected hyper block dto response from Multiversx proxy
type MultiversxHyperBlockApiResponsePayload ¶
type MultiversxHyperBlockApiResponsePayload struct {
HyperBlock hyperBlock.HyperBlock `json:"hyperblock"`
}
MultiversxHyperBlockApiResponsePayload wraps a hyperBlock
type MultiversxHyperBlockEndpointHandler ¶
type MultiversxHyperBlockEndpointHandler interface {
GetHyperBlock(path string) (*MultiversxHyperBlockApiResponse, error)
}
MultiversxHyperBlockEndpointHandler should fetch hyper block api responses from Multiversx
type ReturnCode ¶
type ReturnCode string
ReturnCode identifies api return codes
const ReturnCodeInternalError ReturnCode = "internal_issue"
ReturnCodeInternalError defines a request which hasn't been executed successfully due to an internal error
const ReturnCodeRequestError ReturnCode = "bad_request"
ReturnCodeRequestError defines a request which hasn't been executed successfully due to a bad request received
const ReturnCodeSuccess ReturnCode = "successful"
ReturnCodeSuccess defines a successful request