handlers

package
v1.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: Apache-2.0 Imports: 17 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=[]common.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=[]common.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=[]common.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=[]common.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=[]BalanceModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/balances/{owner}/{type} [get]

func GetTokenHoldersByType

func GetTokenHoldersByType(c *gin.Context)

@Summary Get holders of a token @Description Retrieve holders of a token @Tags holders @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param address path string true "Address of the token" @Param token_type query string false "Type of token" @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=[]HolderModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/holders/{address} [get]

func GetTokenIdsByType

func GetTokenIdsByType(c *gin.Context)

@Summary Get token IDs by type for a specific token address @Description Retrieve token IDs by type for a specific token address @Tags tokens @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param address path string true "Token address" @Param token_type query string false "Type of token (erc721 or erc1155)" @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=[]TokenIdModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/tokens/{address} [get]

func GetTokenTransfers

func GetTokenTransfers(c *gin.Context)

@Summary Get token transfers @Description Retrieve token transfers by various filters @Tags transfers @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param token_type query []string false "Token types (erc721, erc1155, erc20)" @Param token_address query string false "Token contract address" @Param wallet query string false "Wallet address" @Param start_block query string false "Start block number" @Param end_block query string false "End block number" @Param start_timestamp query string false "Start timestamp (RFC3339 format)" @Param end_timestamp query string false "End timestamp (RFC3339 format)" @Param token_id query []string false "Token IDs" @Param transaction_hash query string false "Transaction hash" @Param page query int false "Page number for pagination" @Param limit query int false "Number of items per page" default(20) @Success 200 {object} api.QueryResponse{data=[]TransferModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/transfers [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=[]common.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=[]common.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=[]common.DecodedTransactionModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/transactions/{to}/{signature} [get]

func GetWalletTransactions

func GetWalletTransactions(c *gin.Context)

@Summary Get wallet transactions @Description Retrieve all incoming and outgoing transactions for a specific wallet address @Tags wallet @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param wallet_address path string true "Wallet 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 force_consistent_data query bool false "Force consistent data at the expense of query speed" @Param decode query bool false "Decode transaction data" @Success 200 {object} api.QueryResponse{data=[]common.DecodedTransactionModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /{chainId}/wallet-transactions [get]

func Search(c *gin.Context)

@Summary Search blockchain data @Description Search blocks, transactions and events @Tags search @Accept json @Produce json @Security BasicAuth @Param chainId path string true "Chain ID" @Param input path string true "Search input" @Success 200 {object} api.QueryResponse{data=SearchResultModel} @Failure 400 {object} api.Error @Failure 401 {object} api.Error @Failure 500 {object} api.Error @Router /search/:input [GET]

Types

type BalanceModel

type BalanceModel struct {
	TokenAddress string `json:"token_address" ch:"address"`
	TokenId      string `json:"token_id" ch:"token_id"`
	Balance      string `json:"balance" ch:"balance"`
	TokenType    string `json:"token_type" ch:"token_type"`
}

Models return type for Swagger documentation

type ContractCodeState

type ContractCodeState int
const (
	ContractCodeUnknown ContractCodeState = iota
	ContractCodeExists
	ContractCodeDoesNotExist
)

type HolderModel

type HolderModel struct {
	HolderAddress string `json:"holder_address" ch:"owner"`
	TokenId       string `json:"token_id" ch:"token_id"`
	Balance       string `json:"balance" ch:"balance"`
	TokenType     string `json:"token_type" ch:"token_type"`
}

type SearchInput

type SearchInput struct {
	BlockNumber       *big.Int
	Hash              string
	Address           string
	FunctionSignature string
	ErrorMessage      string
}

type SearchResultModel

type SearchResultModel struct {
	Blocks       []common.BlockModel       `json:"blocks,omitempty"`
	Transactions []common.TransactionModel `json:"transactions,omitempty"`
	Events       []common.LogModel         `json:"events,omitempty"`
	Type         SearchResultType          `json:"type,omitempty"`
}

type SearchResultType

type SearchResultType string
const (
	SearchResultTypeBlock             SearchResultType = "block"
	SearchResultTypeTransaction       SearchResultType = "transaction"
	SearchResultTypeEventSignature    SearchResultType = "event_signature"
	SearchResultTypeFunctionSignature SearchResultType = "function_signature"
	SearchResultTypeAddress           SearchResultType = "address"
	SearchResultTypeContract          SearchResultType = "contract"
)

type TokenIdModel

type TokenIdModel struct {
	TokenId   string `json:"token_id" ch:"token_id"`
	TokenType string `json:"token_type" ch:"token_type"`
}

type TransferModel

type TransferModel struct {
	TokenType       string `json:"token_type" ch:"token_type"`
	TokenAddress    string `json:"token_address" ch:"token_address"`
	FromAddress     string `json:"from_address" ch:"from_address"`
	ToAddress       string `json:"to_address" ch:"to_address"`
	TokenId         string `json:"token_id" ch:"token_id"`
	Amount          string `json:"amount" ch:"amount"`
	BlockNumber     string `json:"block_number" ch:"block_number"`
	BlockTimestamp  string `json:"block_timestamp" ch:"block_timestamp"`
	TransactionHash string `json:"transaction_hash" ch:"transaction_hash"`
	LogIndex        uint64 `json:"log_index" ch:"log_index"`
}

TransferModel return type for Swagger documentation

Jump to

Keyboard shortcuts

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