handlers

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlocks

func GetBlocks(c *gin.Context)

@Summary Get all blocks @Description Retrieve all blocks @Tags blocks @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param filter query string false "Filter parameters" @Param group_by query string false "Field to group results by" @Param sort_by query string false "Field to sort results by" @Param sort_order query string false "Sort order (asc or desc)" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(5) @Param aggregate query []string false "List of aggregate functions to apply" @Param force_consistent_data query bool false "Force consistent data at the expense of query speed" @Success 200 {object} api.QueryResponse{data=[]BlockModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/blocks [get]

func GetLogs

func GetLogs(c *gin.Context)

@Summary Get all logs @Description Retrieve all logs across all contracts @Tags events @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param filter query string false "Filter parameters" @Param group_by query string false "Field to group results by" @Param sort_by query string false "Field to sort results by" @Param sort_order query string false "Sort order (asc or desc)" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(5) @Param aggregate query []string false "List of aggregate functions to apply" @Param force_consistent_data query bool false "Force consistent data at the expense of query speed" @Success 200 {object} api.QueryResponse{data=[]LogModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/events [get]

func GetLogsByContract

func GetLogsByContract(c *gin.Context)

@Summary Get logs by contract @Description Retrieve logs for a specific contract @Tags events @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param contract path string true "Contract address" @Param filter query string false "Filter parameters" @Param group_by query string false "Field to group results by" @Param sort_by query string false "Field to sort results by" @Param sort_order query string false "Sort order (asc or desc)" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(5) @Param aggregate query []string false "List of aggregate functions to apply" @Param force_consistent_data query bool false "Force consistent data at the expense of query speed" @Success 200 {object} api.QueryResponse{data=[]LogModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/events/{contract} [get]

func GetLogsByContractAndSignature

func GetLogsByContractAndSignature(c *gin.Context)

@Summary Get logs by contract and event signature @Description Retrieve logs for a specific contract and event signature. When a valid event signature is provided, the response includes decoded log data with both indexed and non-indexed parameters. @Tags events @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param contract path string true "Contract address" @Param signature path string true "Event signature (e.g., 'Transfer(address,address,uint256)')" @Param filter query string false "Filter parameters" @Param group_by query string false "Field to group results by" @Param sort_by query string false "Field to sort results by" @Param sort_order query string false "Sort order (asc or desc)" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(5) @Param aggregate query []string false "List of aggregate functions to apply" @Param force_consistent_data query bool false "Force consistent data at the expense of query speed" @Success 200 {object} api.QueryResponse{data=[]DecodedLogModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/events/{contract}/{signature} [get]

func GetTokenBalancesByType

func GetTokenBalancesByType(c *gin.Context)

@Summary Get token balances of an address by type @Description Retrieve token balances of an address by type @Tags balances @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param owner path string true "Owner address" @Param type path string true "Type of token balance" @Param hide_zero_balances query bool true "Hide zero balances" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(5) @Success 200 {object} api.QueryResponse{data=[]LogModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/events [get]

func GetTransactions

func GetTransactions(c *gin.Context)

@Summary Get all transactions @Description Retrieve all transactions across all contracts @Tags transactions @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param filter query string false "Filter parameters" @Param group_by query string false "Field to group results by" @Param sort_by query string false "Field to sort results by" @Param sort_order query string false "Sort order (asc or desc)" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(5) @Param aggregate query []string false "List of aggregate functions to apply" @Param force_consistent_data query bool false "Force consistent data at the expense of query speed" @Success 200 {object} api.QueryResponse{data=[]TransactionModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/transactions [get]

func GetTransactionsByContract

func GetTransactionsByContract(c *gin.Context)

@Summary Get transactions by contract @Description Retrieve transactions for a specific contract @Tags transactions @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param to path string true "Contract address" @Param filter query string false "Filter parameters" @Param group_by query string false "Field to group results by" @Param sort_by query string false "Field to sort results by" @Param sort_order query string false "Sort order (asc or desc)" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(5) @Param aggregate query []string false "List of aggregate functions to apply" @Param force_consistent_data query bool false "Force consistent data at the expense of query speed" @Success 200 {object} api.QueryResponse{data=[]TransactionModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/transactions/{to} [get]

func GetTransactionsByContractAndSignature

func GetTransactionsByContractAndSignature(c *gin.Context)

@Summary Get transactions by contract and signature @Description Retrieve transactions for a specific contract and signature. When a valid function signature is provided, the response includes decoded transaction data with function inputs. @Tags transactions @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param to path string true "Contract address" @Param signature path string true "Function signature (e.g., 'transfer(address,uint256)')" @Param filter query string false "Filter parameters" @Param group_by query string false "Field to group results by" @Param sort_by query string false "Field to sort results by" @Param sort_order query string false "Sort order (asc or desc)" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(5) @Param aggregate query []string false "List of aggregate functions to apply" @Param force_consistent_data query bool false "Force consistent data at the expense of query speed" @Success 200 {object} api.QueryResponse{data=[]DecodedTransactionModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/transactions/{to}/{signature} [get]

Types

type BalanceModel

type BalanceModel struct {
	ChainId      string   `json:"chain_id" ch:"chain_id"`
	TokenType    string   `json:"token_type" ch:"token_type"`
	TokenAddress string   `json:"token_address" ch:"address"`
	Owner        string   `json:"owner" ch:"owner"`
	TokenId      string   `json:"token_id" ch:"token_id"`
	Balance      *big.Int `json:"balance" ch:"balance"`
}

BalanceModel return type for Swagger documentation

type BlockModel

type BlockModel struct {
	ChainId          string `json:"chain_id"`
	Number           uint64 `json:"number"`
	Hash             string `json:"hash"`
	ParentHash       string `json:"parent_hash"`
	Timestamp        uint64 `json:"timestamp"`
	Nonce            string `json:"nonce"`
	Sha3Uncles       string `json:"sha3_uncles"`
	MixHash          string `json:"mix_hash"`
	Miner            string `json:"miner"`
	StateRoot        string `json:"state_root"`
	TransactionsRoot string `json:"transactions_root"`
	ReceiptsRoot     string `json:"receipts_root"`
	LogsBloom        string `json:"logs_bloom"`
	Size             uint64 `json:"size"`
	ExtraData        string `json:"extra_data"`
	Difficulty       string `json:"difficulty"`
	TotalDifficulty  string `json:"total_difficulty"`
	TransactionCount uint64 `json:"transaction_count"`
	GasLimit         uint64 `json:"gas_limit"`
	GasUsed          uint64 `json:"gas_used"`
	WithdrawalsRoot  string `json:"withdrawals_root"`
	BaseFeePerGas    uint64 `json:"base_fee_per_gas"`
}

BlockModel represents a simplified Block structure for Swagger documentation

type DecodedLogDataModel

type DecodedLogDataModel struct {
	Name             string                 `json:"name"`
	Signature        string                 `json:"signature"`
	IndexedParams    map[string]interface{} `json:"indexedParams" swaggertype:"object"`
	NonIndexedParams map[string]interface{} `json:"nonIndexedParams" swaggertype:"object"`
}

type DecodedLogModel

type DecodedLogModel struct {
	LogModel
	Decoded     DecodedLogDataModel `json:"decoded"`
	DecodedData DecodedLogDataModel `json:"decodedData" deprecated:"true"` // Deprecated: Use Decoded field instead
}

type DecodedTransactionDataModel

type DecodedTransactionDataModel struct {
	Name      string                 `json:"name"`
	Signature string                 `json:"signature"`
	Inputs    map[string]interface{} `json:"inputs"`
}

type DecodedTransactionModel

type DecodedTransactionModel struct {
	TransactionModel
	Decoded     DecodedTransactionDataModel `json:"decoded"`
	DecodedData DecodedTransactionDataModel `json:"decodedData" deprecated:"true"` // Deprecated: Use Decoded field instead
}

type LogModel

type LogModel struct {
	ChainId          string   `json:"chain_id"`
	BlockNumber      uint64   `json:"block_number"`
	BlockHash        string   `json:"block_hash"`
	BlockTimestamp   uint64   `json:"block_timestamp"`
	TransactionHash  string   `json:"transaction_hash"`
	TransactionIndex uint64   `json:"transaction_index"`
	LogIndex         uint64   `json:"log_index"`
	Address          string   `json:"address"`
	Data             string   `json:"data"`
	Topics           []string `json:"topics" swaggertype:"array,string"`
}

LogModel represents a simplified Log structure for Swagger documentation

type TransactionModel

type TransactionModel struct {
	ChainId              string   `json:"chain_id"`
	Hash                 string   `json:"hash"`
	Nonce                uint64   `json:"nonce"`
	BlockHash            string   `json:"block_hash"`
	BlockNumber          uint64   `json:"block_number"`
	BlockTimestamp       uint64   `json:"block_timestamp"`
	TransactionIndex     uint64   `json:"transaction_index"`
	FromAddress          string   `json:"from_address"`
	ToAddress            string   `json:"to_address"`
	Value                uint64   `json:"value"`
	Gas                  uint64   `json:"gas"`
	GasPrice             uint64   `json:"gas_price"`
	Data                 string   `json:"data"`
	FunctionSelector     string   `json:"function_selector"`
	MaxFeePerGas         uint64   `json:"max_fee_per_gas"`
	MaxPriorityFeePerGas uint64   `json:"max_priority_fee_per_gas"`
	TransactionType      uint8    `json:"transaction_type"`
	R                    string   `json:"r"`
	S                    string   `json:"s"`
	V                    string   `json:"v"`
	AccessListJson       *string  `json:"access_list_json"`
	ContractAddress      *string  `json:"contract_address"`
	GasUsed              *uint64  `json:"gas_used"`
	CumulativeGasUsed    *uint64  `json:"cumulative_gas_used"`
	EffectiveGasPrice    *big.Int `json:"effective_gas_price"`
	BlobGasUsed          *uint64  `json:"blob_gas_used"`
	BlobGasPrice         *big.Int `json:"blob_gas_price"`
	LogsBloom            *string  `json:"logs_bloom"`
	Status               *uint64  `json:"status"`
}

TransactionModel represents a simplified Transaction structure for Swagger documentation

Jump to

Keyboard shortcuts

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