handler

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressHandler

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

func NewAddressHandler

func NewAddressHandler(
	address storage.IAddress,
	txs storage.ITx,
	state storage.IState,
	indexerName string,
) *AddressHandler

func (*AddressHandler) Count

func (handler *AddressHandler) Count(c echo.Context) error

Count godoc

@Summary		Get count of addresses in network
@Description	Get count of addresses in network
@Tags			address
@ID				get-address-count
@Produce		json
@Success		200	{integer}   uint64
@Failure		500	{object}	Error
@Router			/v1/address/count [get]

func (*AddressHandler) Get

func (handler *AddressHandler) Get(c echo.Context) error

Get godoc

@Summary		Get address info
@Description	Get address info
@Tags			address
@ID				get-address
@Param			hash	path	string	true	"Hash"	minlength(48)	maxlength(48)
@Produce		json
@Success		200	{object}	responses.Address
@Success		204
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/address/{hash} [get]

func (*AddressHandler) List

func (handler *AddressHandler) List(c echo.Context) error

List godoc

@Summary		List address info
@Description	List address info
@Tags			address
@ID				list-address
@Param			limit		query	integer	false	"Count of requested entities"	mininum(1)	maximum(100)
@Param			offset		query	integer	false	"Offset"						mininum(1)
@Param			sort		query	string	false	"Sort order"					Enums(asc, desc)
@Produce		json
@Success		200	{array}		responses.Address
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/address [get]

func (*AddressHandler) Messages

func (handler *AddressHandler) Messages(c echo.Context) error

Messages godoc

@Summary		Get address messages
@Description	Get address messages
@Tags			address
@ID				address-messages
@Param			hash	    path	string	true	"Hash"	minlength(48)	maxlength(48)
@Param			limit		query	integer	false	"Count of requested entities"			minimum(1)	maximum(100)
@Param			offset		query	integer	false	"Offset"								minimum(1)
@Param			sort		query	string	false	"Sort order"							Enums(asc, desc)
@Produce		json
@Success		200	{array}		responses.Message
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/address/{hash}/messages [get]

func (*AddressHandler) Transactions

func (handler *AddressHandler) Transactions(c echo.Context) error

Transactions godoc

@Summary		Get address transactions
@Description	Get address transactions
@Tags			address
@ID				address-transactions
@Param			hash	path	string	true	"Hash"	minlength(48)	maxlength(48)
@Param			limit		query	integer	false	"Count of requested entities"			minimum(1)	maximum(100)
@Param			offset		query	integer	false	"Offset"								minimum(1)
@Param			sort		query	string	false	"Sort order"							Enums(asc, desc)
@Param			status		query	types.Status	false	"Comma-separated status list"
@Param			msg_type	query	types.MsgType	false	"Comma-separated message types list"
@Param			from		query	integer	false	"Time from in unix timestamp"			minimum(1)
@Param			to			query	integer	false	"Time to in unix timestamp"				minimum(1)
@Param			height		query	integer	false	"Block number"							minimum(1)
@Produce		json
@Success		200	{array}		responses.Tx
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/address/{hash}/txs [get]

type BlockHandler

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

func NewBlockHandler

func NewBlockHandler(
	block storage.IBlock,
	blockStats storage.IBlockStats,
	events storage.IEvent,
	namespace storage.INamespace,
	message storage.IMessage,
	state storage.IState,
	indexerName string,
) *BlockHandler

func (*BlockHandler) Count

func (handler *BlockHandler) Count(c echo.Context) error

Count godoc

@Summary		Get count of blocks in network
@Description	Get count of blocks in network
@Tags			block
@ID				get-block-count
@Produce		json
@Success		200	{integer}   uint64
@Failure		500	{object}	Error
@Router			/v1/block/count [get]

func (*BlockHandler) Get

func (handler *BlockHandler) Get(c echo.Context) error

Get godoc

@Summary		Get block info
@Description	Get block info
@Tags			block
@ID				get-block
@Param			height	path	integer	true	"Block height"	minimum(1)
@Param			stats	query	boolean	false 	"Need join stats for block"
@Produce		json
@Success		200	{object}	responses.Block
@Success		204
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/block/{height} [get]

func (*BlockHandler) GetEvents

func (handler *BlockHandler) GetEvents(c echo.Context) error

GetEvents godoc

@Summary		Get events from begin and end of block
@Description	Get events from begin and end of block
@Tags			block
@ID				get-block-events
@Param			height	path	integer	true	"Block height"	minimum(1)
@Produce		json
@Success		200	{array}		responses.Event
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/block/{height}/events [get]

func (*BlockHandler) GetMessages added in v1.0.4

func (handler *BlockHandler) GetMessages(c echo.Context) error

GetMessages godoc

@Summary		Get messages contained in the block
@Description	Get messages contained in the block
@Tags			block
@ID				get-block-messages
@Param			height				path	integer	true	"Block height"					minimum(1)
@Param			limit				query	integer	false	"Count of requested entities"	mininum(1)	maximum(100)
@Param			offset				query	integer	false	"Offset"						mininum(1)
@Param			msg_type			query	types.MsgType	false	"Comma-separated message types list"
@Param			excluded_msg_type	query	types.MsgType	false	"Comma-separated message types which should be excluded from list"
@Produce		json
@Success		200	{array} 	responses.Message
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/block/{height}/messages [get]

func (*BlockHandler) GetNamespaces

func (handler *BlockHandler) GetNamespaces(c echo.Context) error

GetNamespaces godoc

@Summary		Get namespaces affected in the block
@Description	Get namespaces affected in the block
@Tags			block
@ID				get-block-namespaces
@Param			height	path	integer	true	"Block height"					minimum(1)
@Param			limit	query	integer	false	"Count of requested entities"	mininum(1)	maximum(100)
@Param			offset	query	integer	false	"Offset"						mininum(1)
@Produce		json
@Success		200	{array} 	responses.NamespaceMessage
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/block/{height}/namespace [get]

func (*BlockHandler) GetNamespacesCount

func (handler *BlockHandler) GetNamespacesCount(c echo.Context) error

GetNamespacesCount godoc

@Summary		Get count of affected in the block namespaces
@Description	Get count of affected in the block namespaces
@Tags			block
@ID				get-block-namespaces-count
@Param			height	path	integer	true	"Block height"	minimum(1)
@Produce		json
@Success		200	{integer} 	uint64
@Failure		500	{object}	Error
@Router			/v1/block/{height}/namespace/count [get]

func (*BlockHandler) GetStats

func (handler *BlockHandler) GetStats(c echo.Context) error

GetStats godoc

@Summary		Get block stats by height
@Description	Get block stats by height
@Tags			block
@ID				get-block-stats
@Param			height	path	integer	true	"Block height"	minimum(1)
@Produce		json
@Success		200	{object}	responses.BlockStats
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/block/{height}/stats [get]

func (*BlockHandler) List

func (handler *BlockHandler) List(c echo.Context) error

List godoc

@Summary		List blocks info
@Description	List blocks info
@Tags			block
@ID				list-block
@Param			limit	query	integer	false	"Count of requested entities"	mininum(1)	maximum(100)
@Param			offset	query	integer	false	"Offset"						mininum(1)
@Param			sort	query	string	false	"Sort order"					Enums(asc, desc)
@Param			stats	query	boolean	false 	"Need join stats for block"
@Produce		json
@Success		200	{array}		responses.Block
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/block [get]

type CelestiaApiValidator

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

func NewCelestiaApiValidator

func NewCelestiaApiValidator() *CelestiaApiValidator

func (*CelestiaApiValidator) Validate

func (v *CelestiaApiValidator) Validate(i interface{}) error

type ConstantHandler

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

func NewConstantHandler

func NewConstantHandler(constants storage.IConstant, denomMetadata storage.IDenomMetadata, address storage.IAddress) *ConstantHandler

func (*ConstantHandler) Get

func (handler *ConstantHandler) Get(c echo.Context) error

Get godoc

@Summary		Get network constants
@Description	Get network constants
@Tags			general
@ID				get-constants
@Produce		json
@Success		200	{object}	responses.Constants
@Success		204
@Failure		500	{object}	Error
@Router			/v1/constants [get]

type Error

type Error struct {
	Message string `json:"message"`
}

type MsgTypeArray

type MsgTypeArray StringArray

type NamespaceHandler

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

func NewNamespaceHandler

func NewNamespaceHandler(
	namespace storage.INamespace,
	state storage.IState,
	indexerName string,
	blob node.DalApi,
) *NamespaceHandler

func (*NamespaceHandler) Count

func (handler *NamespaceHandler) Count(c echo.Context) error

Count godoc

@Summary		Get count of namespaces in network
@Description	Get count of namespaces in network
@Tags			namespace
@ID				get-namespace-count
@Produce		json
@Success		200	{integer}   uint64
@Failure		500	{object}	Error
@Router			/v1/namespace/count [get]

func (*NamespaceHandler) Get

func (handler *NamespaceHandler) Get(c echo.Context) error

Get godoc

@Summary		Get namespace info
@Description	Returns array of namespace versions
@Tags			namespace
@ID				get-namespace
@Param			id	path	string	true	"Namespace id in hexadecimal"	minlength(56)	maxlength(56)
@Produce		json
@Success		200	{array}		responses.Namespace
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/namespace/{id} [get]

func (*NamespaceHandler) GetActive

func (handler *NamespaceHandler) GetActive(c echo.Context) error

GetActive godoc

@Summary		Get last used namespace
@Description	Get last used namespace
@Tags			namespace
@ID				get-namespace-active
@Produce		json
@Success		200	{array}		responses.ActiveNamespace
@Failure		500	{object}	Error
@Router			/v1/namespace/active [get]

func (*NamespaceHandler) GetBlob

func (handler *NamespaceHandler) GetBlob(c echo.Context) error

GetBlob godoc

@Summary		Get namespace blob by commitment on height
@Description	Returns blob
@Tags			namespace
@ID				get-namespace-blob
@Param			hash		path	string	true	"Base64-encoded namespace id and version"
@Param			height		path	integer	true	"Block heigth"	minimum(1)
@Param			commitment	path	string	true	"Blob commitment"
@Produce		json
@Success		200	{object}	responses.Blob
@Failure		400	{object}	Error
@Router			/v1/namespace_by_hash/{hash}/{height}/{commitment} [get]

func (*NamespaceHandler) GetBlobs

func (handler *NamespaceHandler) GetBlobs(c echo.Context) error

GetBlobs godoc

@Summary		Get namespace blobs on height
@Description	Returns blobs
@Tags			namespace
@ID				get-namespace-blobs
@Param			hash	path	string	true	"Base64-encoded namespace id and version"
@Param			height	path	integer	true	"Block heigth"	minimum(1)
@Produce		json
@Success		200	{array}		responses.Blob
@Failure		400	{object}	Error
@Router			/v1/namespace_by_hash/{hash}/{height} [get]

func (*NamespaceHandler) GetByHash

func (handler *NamespaceHandler) GetByHash(c echo.Context) error

GetByHash godoc

@Summary		Get namespace info by base64
@Description	Returns namespace by base64 encoded identity
@Tags			namespace
@ID				get-namespace-base64
@Param			hash	path	string	true	"Base64-encoded namespace id and version"
@Produce		json
@Success		200	{object}	responses.Namespace
@Success		204
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/namespace_by_hash/{hash} [get]

func (*NamespaceHandler) GetMessages

func (handler *NamespaceHandler) GetMessages(c echo.Context) error

GetMessages godoc

@Summary		Get namespace messages by id and version
@Description	Returns namespace messages by version byte and namespace id
@Tags			namespace
@ID				get-namespace-messages
@Param			id		path	string	true	"Namespace id in hexadecimal"	minlength(56)	maxlength(56)
@Param			version	path	integer	true	"Version of namespace"
@Param			limit	query	integer	false	"Count of requested entities"	mininum(1)	maximum(100)
@Param			offset	query	integer	false	"Offset"						mininum(1)
@Produce		json
@Success		200	{array}	responses.NamespaceMessage
@Success		204
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/namespace/{id}/{version}/messages [get]

func (*NamespaceHandler) GetWithVersion

func (handler *NamespaceHandler) GetWithVersion(c echo.Context) error

GetWithVersion godoc

@Summary		Get namespace info by id and version
@Description	Returns namespace by version byte and namespace id
@Tags			namespace
@ID				get-namespace-by-version-and-id
@Param			id		path	string	true	"Namespace id in hexadecimal"	minlength(56)	maxlength(56)
@Param			version	path	integer	true	"Version of namespace"
@Produce		json
@Success		200	{object}	responses.Namespace
@Success		204
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/namespace/{id}/{version} [get]

func (*NamespaceHandler) List

func (handler *NamespaceHandler) List(c echo.Context) error

List godoc

@Summary		List namespace info
@Description	List namespace info
@Tags			namespace
@ID				list-namespace
@Param			limit	query	integer	false	"Count of requested entities"	mininum(1)	maximum(100)
@Param			offset	query	integer	false	"Offset"						mininum(1)
@Param			sort	query	string	false	"Sort order"					Enums(asc, desc)
@Produce		json
@Success		200	{array}		responses.Namespace
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/namespace [get]

type NoRows

type NoRows interface {
	IsNoRows(err error) bool
}

type SearchHandler

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

func NewSearchHandler

func NewSearchHandler(
	address storage.IAddress,
	block storage.IBlock,
	namespace storage.INamespace,
	tx storage.ITx,
) SearchHandler

func (SearchHandler) Search

func (handler SearchHandler) Search(c echo.Context) error

Get godoc

@Summary				Search by hash
@Description.markdown	search
@Tags					search
@ID						search
@Param					query	query	string	true	"Search string"
@Produce				json
@Success				200	{object}	responses.SearchResponse[responses.Searchable]
@Success				204
@Failure				400	{object}	Error
@Failure				500	{object}	Error
@Router					/v1/search [get]

type StateHandler

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

func NewStateHandler

func NewStateHandler(state storage.IState) *StateHandler

func (*StateHandler) Head

func (sh *StateHandler) Head(c echo.Context) error

Head godoc

@Summary		Get current indexer head
@Description	Get current indexer head
@Tags			general
@ID				head
@Produce		json
@Success		200	{object}	responses.State
@Success		204
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/head [get]

type StatsHandler

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

func NewStatsHandler

func NewStatsHandler(repo storage.IStats) StatsHandler

func (StatsHandler) Histogram

func (sh StatsHandler) Histogram(c echo.Context) error

Histogram godoc

@Summary				Get histogram
@Description.markdown	histogram
@Tags					stats
@ID						stats-histogram
@Param					table		path	string	true	"Table name"	Enums(block, block_stats, tx, event, message)
@Param					function	path	string	true	"Function name"	Enums(min, max, avg, sum, count)
@Param					timeframe	path	string	true	"Timeframe"		Enums(hour, day, week, month, year)
@Param					column		query	string	false	"Column name which will be used for computation. Optional for count"
@Param					from		query	integer	false	"Time from in unix timestamp"	mininum(1)
@Param					to			query	integer	false	"Time to in unix timestamp"		mininum(1)
@Produce				json
@Success				200	{array}		responses.HistogramItem
@Failure				400	{object}	Error
@Failure				500	{object}	Error
@Router					/v1/stats/histogram/{table}/{function}/{timeframe} [get]

func (StatsHandler) Summary

func (sh StatsHandler) Summary(c echo.Context) error

Summary godoc

@Summary				Get value by table and function
@Description.markdown	summary
@Tags					stats
@ID						stats-summary
@Param					table		path	string	true	"Table name"	Enums(block, block_stats, tx, event, message, validator)
@Param					function	path	string	true	"Function name"	Enums(min, max, avg, sum, count)
@Param					column		query	string	false	"Column name which will be used for computation. Optional for count."
@Param					from		query	integer	false	"Time from in unix timestamp"	mininum(1)
@Param					to			query	integer	false	"Time to in unix timestamp"		mininum(1)
@Produce				json
@Success				200	{object}	string
@Failure				400	{object}	Error
@Failure				500	{object}	Error
@Router					/v1/stats/summary/{table}/{function} [get]

type StatusArray

type StatusArray StringArray

type StringArray

type StringArray []string

func (*StringArray) UnmarshalParam

func (s *StringArray) UnmarshalParam(param string) error

type TxHandler

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

func NewTxHandler

func NewTxHandler(
	tx storage.ITx,
	events storage.IEvent,
	messages storage.IMessage,
	state storage.IState,
	indexerName string,
) *TxHandler

func (*TxHandler) Count

func (handler *TxHandler) Count(c echo.Context) error

Count godoc

@Summary		Get count of transactions in network
@Description	Get count of transactions in network
@Tags			transactions
@ID				get-transactions-count
@Produce		json
@Success		200	{integer}   uint64
@Failure		500	{object}	Error
@Router			/v1/tx/count [get]

func (*TxHandler) Genesis

func (handler *TxHandler) Genesis(c echo.Context) error

Genesis godoc

@Summary		List genesis transactions info
@Description	List genesis transactions info
@Tags			transactions
@ID				list-genesis -transactions
@Param			limit		query	integer			false	"Count of requested entities"			mininum(1)	maximum(100)
@Param			offset		query	integer			false	"Offset"								mininum(1)
@Param			sort		query	string			false	"Sort order"					mininum(1)
@Produce		json
@Success		200	{array}		responses.Tx
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/tx/genesis [get]

func (*TxHandler) Get

func (handler *TxHandler) Get(c echo.Context) error

Get godoc

@Summary		Get transaction by hash
@Description	Get transaction by hash
@Tags			transactions
@ID				get-transaction
@Param			hash	path	string	true	"Transaction hash in hexadecimal"	minlength(64)	maxlength(64)
@Produce		json
@Success		200	{object}	responses.Tx
@Success		204
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/tx/{hash} [get]

func (*TxHandler) GetEvents

func (handler *TxHandler) GetEvents(c echo.Context) error

GetEvents godoc

@Summary		Get transaction events
@Description	Get transaction events
@Tags			transactions
@ID				get-transaction-events
@Param			hash	path	string	true	"Transaction hash in hexadecimal"	minlength(64)	maxlength(64)
@Produce		json
@Success		200	{array}		responses.Event
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/tx/{hash}/events [get]

func (*TxHandler) GetMessages

func (handler *TxHandler) GetMessages(c echo.Context) error

GetMessages godoc

@Summary		Get transaction messages
@Description	Get transaction messages
@Tags			transactions
@ID				get-transaction-messages
@Param			hash	path	string	true	"Transaction hash in hexadecimal"	minlength(64)	maxlength(64)
@Produce		json
@Success		200	{array}		responses.Message
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/tx/{hash}/messages [get]

func (*TxHandler) List

func (handler *TxHandler) List(c echo.Context) error

List godoc

@Summary		List transactions info
@Description	List transactions info
@Tags			transactions
@ID				list-transactions
@Param			limit		 		query	integer			false	"Count of requested entities"			mininum(1)	maximum(100)
@Param			offset		 		query	integer			false	"Offset"								mininum(1)
@Param			sort		 		query	string			false	"Sort order"							Enums(asc, desc)
@Param			status		 		query	types.Status	false	"Comma-separated status list"
@Param			msg_type	 		query	types.MsgType	false	"Comma-separated message types list"
@Param			excluded_msg_type   query	types.MsgType	false	"Comma-separated message types list which should be excluded"
@Param			from		 		query	integer			false	"Time from in unix timestamp"			mininum(1)
@Param			to			 		query	integer			false	"Time to in unix timestamp"				mininum(1)
@Param			height		 		query	integer			false	"Block number"							mininum(1)
@Param			messages	 		query	boolean			false	"If true join messages"					mininum(1)
@Produce		json
@Success		200	{array}		responses.Tx
@Failure		400	{object}	Error
@Failure		500	{object}	Error
@Router			/v1/tx [get]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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