router

package
v0.0.0-...-70addda Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(v1Handler Handler) *gin.Engine

Types

type BlockInfo

type BlockInfo struct {
	BlockNum   uint64 `json:"block_num"`
	BlockHash  string `json:"block_hash"`
	BlockTime  uint64 `json:"block_time"`
	ParentHash string `json:"parent_hash"`
}

type Handler

type Handler interface {
	GetLatestBlocks(*gin.Context)
	GetBlockById(*gin.Context)
	GetTransactionByTxHash(*gin.Context)
}

func NewHandlerV1Impl

func NewHandlerV1Impl(config *config.Config, repo repository.EthereumIndexRepository) Handler

type ReqGetLatestBlocks

type ReqGetLatestBlocks struct {
	Limit uint16 `form:"limit,default=1" binding="required,min=1,max=1000"`
}

type RespGetBlockDetail

type RespGetBlockDetail struct {
	BlockInfo
	Transactions []string `json:"transactions"`
	RespStatus
}

type RespGetLatestBlocks

type RespGetLatestBlocks struct {
	Blocks []BlockInfo `json:"blocks"`
	RespStatus
}

type RespGetTransactionDetail

type RespGetTransactionDetail struct {
	TransactionInfo
	Logs []TransactionEventLogInfo `json:"logs"`
	RespStatus
}

type RespStatus

type RespStatus struct {
	Message   string `json:"message"`
	Timestamp uint64 `json:"timestamp"`
}

type TransactionEventLogInfo

type TransactionEventLogInfo struct {
	Index uint64 `json:"index"`
	Data  string `json:"data"`
}

type TransactionInfo

type TransactionInfo struct {
	TxHash string `json:"tx_hash"`
	From   string `json:"from"`
	To     string `json:"to"`
	Nonce  uint64 `json:"nonce"`
	Data   string `json:"data"`
	Value  uint64 `json:"value"`
}

Jump to

Keyboard shortcuts

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