From 164f3b7259137352ffa06d49c5f7cd1902793bf3 Mon Sep 17 00:00:00 2001 From: Amine Afia Date: Tue, 1 Oct 2024 17:14:10 +0200 Subject: [PATCH] Integrate swagger docs --- api/api.go | 30 +- cmd/api.go | 25 + docs/docs.go | 956 +++++++++++++++++++++ docs/swagger.json | 927 ++++++++++++++++++++ docs/swagger.yaml | 595 +++++++++++++ go.mod | 13 + go.sum | 54 +- internal/handlers/logs_handlers.go | 74 ++ internal/handlers/transactions_handlers.go | 86 +- 9 files changed, 2751 insertions(+), 9 deletions(-) create mode 100644 docs/docs.go create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml diff --git a/api/api.go b/api/api.go index fa5e8df..32bfbbd 100644 --- a/api/api.go +++ b/api/api.go @@ -13,35 +13,63 @@ import ( "github.com/rs/zerolog/log" ) +// Error represents an API error response +// @Description Error represents an API error response type Error struct { + // @Description HTTP status code Code int `json:"code"` + // @Description Error message Message string `json:"message"` + // @Description Support ID for tracking the error SupportId string `json:"support_id"` } +// QueryParams represents the parameters for querying data +// @Description QueryParams represents the parameters for querying data type QueryParams struct { + // @Description Map of filter parameters FilterParams map[string]string `schema:"-"` + // @Description Field to group results by GroupBy string `schema:"group_by"` + // @Description Field to sort results by SortBy string `schema:"sort_by"` + // @Description Sort order (asc or desc) SortOrder string `schema:"sort_order"` + // @Description Page number for pagination Page int `schema:"page"` + // @Description Number of items per page Limit int `schema:"limit"` + // @Description List of aggregate functions to apply Aggregates []string `schema:"aggregate"` } +// Meta represents metadata for a query response +// @Description Meta represents metadata for a query response type Meta struct { - ChainId uint64 `json:"chain_id"` + // @Description Chain ID of the blockchain + ChainId uint64 `json:"chain_id"` + // @Description Contract address ContractAddress string `json:"address"` + // @Description Function or event signature Signature string `json:"signature"` + // @Description Current page number Page int `json:"page"` + // @Description Number of items per page Limit int `json:"limit"` + // @Description Total number of items TotalItems int `json:"total_items"` + // @Description Total number of pages TotalPages int `json:"total_pages"` } +// QueryResponse represents the response structure for a query +// @Description QueryResponse represents the response structure for a query type QueryResponse struct { + // @Description Metadata for the query response Meta Meta `json:"meta"` + // @Description Query result data Data interface{} `json:"data,omitempty"` + // @Description Aggregation results Aggregations map[string]string `json:"aggregations,omitempty"` } diff --git a/cmd/api.go b/cmd/api.go index 6860829..7dbe718 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -5,9 +5,14 @@ import ( "github.com/gin-gonic/gin" "github.com/spf13/cobra" + swaggerFiles "github.com/swaggo/files" + ginSwagger "github.com/swaggo/gin-swagger" "github.com/thirdweb-dev/indexer/internal/handlers" "github.com/thirdweb-dev/indexer/internal/middleware" + + // Import the generated Swagger docs + _ "github.com/thirdweb-dev/indexer/docs" ) var ( @@ -21,11 +26,31 @@ var ( } ) +// @title Thirdweb Insight +// @version 0.0.1 +// @description API for querying blockchain transactions and events +// @termsOfService http://swagger.io/terms/ + +// @contact.name Thirdweb Support +// @contact.url https://thirdweb.com/support +// @contact.email support@thirdweb.com + +// @license.name Apache 2.0 +// @license.url https://github.com/thirdweb-dev/indexer/blob/main/LICENSE + +// @host localhost:3000 +// @BasePath / + +// @securityDefinitions.basic BasicAuth + func RunApi(cmd *cobra.Command, args []string) { r := gin.New() r.Use(gin.Logger()) r.Use(gin.Recovery()) + // Add Swagger route + r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) + root := r.Group("/:chainId") { root.Use(middleware.Authorization) diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 0000000..3b3c7e2 --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,956 @@ +// Package docs Code generated by swaggo/swag. DO NOT EDIT +package docs + +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "contact": {}, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/{chainId}/events": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve all logs across all contracts", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "events" + ], + "summary": "Get all logs", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.LogModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/events/{contract}": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve logs for a specific contract", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "events" + ], + "summary": "Get logs by contract", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Contract address", + "name": "contract", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.LogModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/events/{contract}/{signature}": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve logs for a specific contract and event signature", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "events" + ], + "summary": "Get logs by contract and event signature", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Contract address", + "name": "contract", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Event signature", + "name": "signature", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.LogModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/transactions": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve all transactions across all contracts", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "transactions" + ], + "summary": "Get all transactions", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TransactionModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/transactions/{to}": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve transactions for a specific contract", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "transactions" + ], + "summary": "Get transactions by contract", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Contract address", + "name": "to", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TransactionModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/transactions/{to}/{signature}": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve transactions for a specific contract and signature (Not implemented yet)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "transactions" + ], + "summary": "Get transactions by contract and signature", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Contract address", + "name": "to", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Function signature", + "name": "signature", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TransactionModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + } + }, + "definitions": { + "api.Error": { + "description": "Error represents an API error response", + "type": "object", + "properties": { + "code": { + "description": "@Description HTTP status code", + "type": "integer" + }, + "message": { + "description": "@Description Error message", + "type": "string" + }, + "support_id": { + "description": "@Description Support ID for tracking the error", + "type": "string" + } + } + }, + "api.Meta": { + "description": "Meta represents metadata for a query response", + "type": "object", + "properties": { + "address": { + "description": "@Description Contract address", + "type": "string" + }, + "chain_id": { + "description": "@Description Chain ID of the blockchain", + "type": "integer" + }, + "limit": { + "description": "@Description Number of items per page", + "type": "integer" + }, + "page": { + "description": "@Description Current page number", + "type": "integer" + }, + "signature": { + "description": "@Description Function or event signature", + "type": "string" + }, + "total_items": { + "description": "@Description Total number of items", + "type": "integer" + }, + "total_pages": { + "description": "@Description Total number of pages", + "type": "integer" + } + } + }, + "api.QueryResponse": { + "description": "QueryResponse represents the response structure for a query", + "type": "object", + "properties": { + "aggregations": { + "description": "@Description Aggregation results", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "data": { + "description": "@Description Query result data" + }, + "meta": { + "description": "@Description Metadata for the query response", + "allOf": [ + { + "$ref": "#/definitions/api.Meta" + } + ] + } + } + }, + "handlers.LogModel": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "string" + }, + "block_timestamp": { + "type": "integer" + }, + "chain_id": { + "type": "string" + }, + "data": { + "type": "string" + }, + "log_index": { + "type": "integer" + }, + "topics": { + "type": "array", + "items": { + "type": "string" + } + }, + "transaction_hash": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + } + } + }, + "handlers.TransactionModel": { + "type": "object", + "properties": { + "access_list_json": { + "type": "string" + }, + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "string" + }, + "block_timestamp": { + "type": "integer" + }, + "chain_id": { + "type": "string" + }, + "data": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "gas": { + "type": "integer" + }, + "gas_price": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "max_fee_per_gas": { + "type": "string" + }, + "max_priority_fee_per_gas": { + "type": "string" + }, + "nonce": { + "type": "integer" + }, + "r": { + "type": "string" + }, + "s": { + "type": "string" + }, + "to_address": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "transaction_type": { + "type": "integer" + }, + "v": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "", + Description: "", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 0000000..382b52b --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,927 @@ +{ + "swagger": "2.0", + "info": { + "contact": {} + }, + "paths": { + "/{chainId}/events": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve all logs across all contracts", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "events" + ], + "summary": "Get all logs", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.LogModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/events/{contract}": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve logs for a specific contract", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "events" + ], + "summary": "Get logs by contract", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Contract address", + "name": "contract", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.LogModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/events/{contract}/{signature}": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve logs for a specific contract and event signature", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "events" + ], + "summary": "Get logs by contract and event signature", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Contract address", + "name": "contract", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Event signature", + "name": "signature", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.LogModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/transactions": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve all transactions across all contracts", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "transactions" + ], + "summary": "Get all transactions", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TransactionModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/transactions/{to}": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve transactions for a specific contract", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "transactions" + ], + "summary": "Get transactions by contract", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Contract address", + "name": "to", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TransactionModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, + "/{chainId}/transactions/{to}/{signature}": { + "get": { + "security": [ + { + "BasicAuth": [] + } + ], + "description": "Retrieve transactions for a specific contract and signature (Not implemented yet)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "transactions" + ], + "summary": "Get transactions by contract and signature", + "parameters": [ + { + "type": "string", + "description": "Chain ID", + "name": "chainId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Contract address", + "name": "to", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Function signature", + "name": "signature", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Filter parameters", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "Field to group results by", + "name": "group_by", + "in": "query" + }, + { + "type": "string", + "description": "Field to sort results by", + "name": "sort_by", + "in": "query" + }, + { + "type": "string", + "description": "Sort order (asc or desc)", + "name": "sort_order", + "in": "query" + }, + { + "type": "integer", + "description": "Page number for pagination", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "Number of items per page", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "List of aggregate functions to apply", + "name": "aggregate", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/api.QueryResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TransactionModel" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + } + }, + "definitions": { + "api.Error": { + "description": "Error represents an API error response", + "type": "object", + "properties": { + "code": { + "description": "@Description HTTP status code", + "type": "integer" + }, + "message": { + "description": "@Description Error message", + "type": "string" + }, + "support_id": { + "description": "@Description Support ID for tracking the error", + "type": "string" + } + } + }, + "api.Meta": { + "description": "Meta represents metadata for a query response", + "type": "object", + "properties": { + "address": { + "description": "@Description Contract address", + "type": "string" + }, + "chain_id": { + "description": "@Description Chain ID of the blockchain", + "type": "integer" + }, + "limit": { + "description": "@Description Number of items per page", + "type": "integer" + }, + "page": { + "description": "@Description Current page number", + "type": "integer" + }, + "signature": { + "description": "@Description Function or event signature", + "type": "string" + }, + "total_items": { + "description": "@Description Total number of items", + "type": "integer" + }, + "total_pages": { + "description": "@Description Total number of pages", + "type": "integer" + } + } + }, + "api.QueryResponse": { + "description": "QueryResponse represents the response structure for a query", + "type": "object", + "properties": { + "aggregations": { + "description": "@Description Aggregation results", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "data": { + "description": "@Description Query result data" + }, + "meta": { + "description": "@Description Metadata for the query response", + "allOf": [ + { + "$ref": "#/definitions/api.Meta" + } + ] + } + } + }, + "handlers.LogModel": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "string" + }, + "block_timestamp": { + "type": "integer" + }, + "chain_id": { + "type": "string" + }, + "data": { + "type": "string" + }, + "log_index": { + "type": "integer" + }, + "topics": { + "type": "array", + "items": { + "type": "string" + } + }, + "transaction_hash": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + } + } + }, + "handlers.TransactionModel": { + "type": "object", + "properties": { + "access_list_json": { + "type": "string" + }, + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "string" + }, + "block_timestamp": { + "type": "integer" + }, + "chain_id": { + "type": "string" + }, + "data": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "gas": { + "type": "integer" + }, + "gas_price": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "max_fee_per_gas": { + "type": "string" + }, + "max_priority_fee_per_gas": { + "type": "string" + }, + "nonce": { + "type": "integer" + }, + "r": { + "type": "string" + }, + "s": { + "type": "string" + }, + "to_address": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "transaction_type": { + "type": "integer" + }, + "v": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 0000000..4830041 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,595 @@ +definitions: + api.Error: + description: Error represents an API error response + properties: + code: + description: '@Description HTTP status code' + type: integer + message: + description: '@Description Error message' + type: string + support_id: + description: '@Description Support ID for tracking the error' + type: string + type: object + api.Meta: + description: Meta represents metadata for a query response + properties: + address: + description: '@Description Contract address' + type: string + chain_id: + description: '@Description Chain ID of the blockchain' + type: integer + limit: + description: '@Description Number of items per page' + type: integer + page: + description: '@Description Current page number' + type: integer + signature: + description: '@Description Function or event signature' + type: string + total_items: + description: '@Description Total number of items' + type: integer + total_pages: + description: '@Description Total number of pages' + type: integer + type: object + api.QueryResponse: + description: QueryResponse represents the response structure for a query + properties: + aggregations: + additionalProperties: + type: string + description: '@Description Aggregation results' + type: object + data: + description: '@Description Query result data' + meta: + allOf: + - $ref: '#/definitions/api.Meta' + description: '@Description Metadata for the query response' + type: object + handlers.LogModel: + properties: + address: + type: string + block_hash: + type: string + block_number: + type: string + block_timestamp: + type: integer + chain_id: + type: string + data: + type: string + log_index: + type: integer + topics: + items: + type: string + type: array + transaction_hash: + type: string + transaction_index: + type: integer + type: object + handlers.TransactionModel: + properties: + access_list_json: + type: string + block_hash: + type: string + block_number: + type: string + block_timestamp: + type: integer + chain_id: + type: string + data: + type: string + from_address: + type: string + gas: + type: integer + gas_price: + type: string + hash: + type: string + max_fee_per_gas: + type: string + max_priority_fee_per_gas: + type: string + nonce: + type: integer + r: + type: string + s: + type: string + to_address: + type: string + transaction_index: + type: integer + transaction_type: + type: integer + v: + type: string + value: + type: string + type: object +info: + contact: {} +paths: + /{chainId}/events: + get: + consumes: + - application/json + description: Retrieve all logs across all contracts + parameters: + - description: Chain ID + in: path + name: chainId + required: true + type: string + - description: Filter parameters + in: query + name: filter + type: string + - description: Field to group results by + in: query + name: group_by + type: string + - description: Field to sort results by + in: query + name: sort_by + type: string + - description: Sort order (asc or desc) + in: query + name: sort_order + type: string + - description: Page number for pagination + in: query + name: page + type: integer + - description: Number of items per page + in: query + name: limit + type: integer + - collectionFormat: csv + description: List of aggregate functions to apply + in: query + items: + type: string + name: aggregate + type: array + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/api.QueryResponse' + - properties: + data: + items: + $ref: '#/definitions/handlers.LogModel' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/api.Error' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/api.Error' + security: + - BasicAuth: [] + summary: Get all logs + tags: + - events + /{chainId}/events/{contract}: + get: + consumes: + - application/json + description: Retrieve logs for a specific contract + parameters: + - description: Chain ID + in: path + name: chainId + required: true + type: string + - description: Contract address + in: path + name: contract + required: true + type: string + - description: Filter parameters + in: query + name: filter + type: string + - description: Field to group results by + in: query + name: group_by + type: string + - description: Field to sort results by + in: query + name: sort_by + type: string + - description: Sort order (asc or desc) + in: query + name: sort_order + type: string + - description: Page number for pagination + in: query + name: page + type: integer + - description: Number of items per page + in: query + name: limit + type: integer + - collectionFormat: csv + description: List of aggregate functions to apply + in: query + items: + type: string + name: aggregate + type: array + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/api.QueryResponse' + - properties: + data: + items: + $ref: '#/definitions/handlers.LogModel' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/api.Error' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/api.Error' + security: + - BasicAuth: [] + summary: Get logs by contract + tags: + - events + /{chainId}/events/{contract}/{signature}: + get: + consumes: + - application/json + description: Retrieve logs for a specific contract and event signature + parameters: + - description: Chain ID + in: path + name: chainId + required: true + type: string + - description: Contract address + in: path + name: contract + required: true + type: string + - description: Event signature + in: path + name: signature + required: true + type: string + - description: Filter parameters + in: query + name: filter + type: string + - description: Field to group results by + in: query + name: group_by + type: string + - description: Field to sort results by + in: query + name: sort_by + type: string + - description: Sort order (asc or desc) + in: query + name: sort_order + type: string + - description: Page number for pagination + in: query + name: page + type: integer + - description: Number of items per page + in: query + name: limit + type: integer + - collectionFormat: csv + description: List of aggregate functions to apply + in: query + items: + type: string + name: aggregate + type: array + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/api.QueryResponse' + - properties: + data: + items: + $ref: '#/definitions/handlers.LogModel' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/api.Error' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/api.Error' + security: + - BasicAuth: [] + summary: Get logs by contract and event signature + tags: + - events + /{chainId}/transactions: + get: + consumes: + - application/json + description: Retrieve all transactions across all contracts + parameters: + - description: Chain ID + in: path + name: chainId + required: true + type: string + - description: Filter parameters + in: query + name: filter + type: string + - description: Field to group results by + in: query + name: group_by + type: string + - description: Field to sort results by + in: query + name: sort_by + type: string + - description: Sort order (asc or desc) + in: query + name: sort_order + type: string + - description: Page number for pagination + in: query + name: page + type: integer + - description: Number of items per page + in: query + name: limit + type: integer + - collectionFormat: csv + description: List of aggregate functions to apply + in: query + items: + type: string + name: aggregate + type: array + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/api.QueryResponse' + - properties: + data: + items: + $ref: '#/definitions/handlers.TransactionModel' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/api.Error' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/api.Error' + security: + - BasicAuth: [] + summary: Get all transactions + tags: + - transactions + /{chainId}/transactions/{to}: + get: + consumes: + - application/json + description: Retrieve transactions for a specific contract + parameters: + - description: Chain ID + in: path + name: chainId + required: true + type: string + - description: Contract address + in: path + name: to + required: true + type: string + - description: Filter parameters + in: query + name: filter + type: string + - description: Field to group results by + in: query + name: group_by + type: string + - description: Field to sort results by + in: query + name: sort_by + type: string + - description: Sort order (asc or desc) + in: query + name: sort_order + type: string + - description: Page number for pagination + in: query + name: page + type: integer + - description: Number of items per page + in: query + name: limit + type: integer + - collectionFormat: csv + description: List of aggregate functions to apply + in: query + items: + type: string + name: aggregate + type: array + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/api.QueryResponse' + - properties: + data: + items: + $ref: '#/definitions/handlers.TransactionModel' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/api.Error' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/api.Error' + security: + - BasicAuth: [] + summary: Get transactions by contract + tags: + - transactions + /{chainId}/transactions/{to}/{signature}: + get: + consumes: + - application/json + description: Retrieve transactions for a specific contract and signature (Not + implemented yet) + parameters: + - description: Chain ID + in: path + name: chainId + required: true + type: string + - description: Contract address + in: path + name: to + required: true + type: string + - description: Function signature + in: path + name: signature + required: true + type: string + - description: Filter parameters + in: query + name: filter + type: string + - description: Field to group results by + in: query + name: group_by + type: string + - description: Field to sort results by + in: query + name: sort_by + type: string + - description: Sort order (asc or desc) + in: query + name: sort_order + type: string + - description: Page number for pagination + in: query + name: page + type: integer + - description: Number of items per page + in: query + name: limit + type: integer + - collectionFormat: csv + description: List of aggregate functions to apply + in: query + items: + type: string + name: aggregate + type: array + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/api.QueryResponse' + - properties: + data: + items: + $ref: '#/definitions/handlers.TransactionModel' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/api.Error' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/api.Error' + security: + - BasicAuth: [] + summary: Get transactions by contract and signature + tags: + - transactions +swagger: "2.0" diff --git a/go.mod b/go.mod index 4bda5f6..88a3dc4 100644 --- a/go.mod +++ b/go.mod @@ -13,10 +13,14 @@ require ( github.com/rs/zerolog v1.33.0 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.18.0 + github.com/swaggo/files v1.0.1 + github.com/swaggo/gin-swagger v1.6.0 + github.com/swaggo/swag v1.16.3 ) require ( github.com/ClickHouse/ch-go v0.61.5 // indirect + github.com/KyleBanks/depth v1.2.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -29,6 +33,7 @@ require ( github.com/cloudwego/iasm v0.2.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect @@ -40,6 +45,10 @@ require ( github.com/go-faster/city v1.0.1 // indirect github.com/go-faster/errors v0.7.1 // indirect github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/spec v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.22.1 // indirect @@ -49,11 +58,13 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/holiman/uint256 v1.3.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -83,6 +94,7 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + github.com/urfave/cli/v2 v2.27.4 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.opentelemetry.io/otel v1.26.0 // indirect go.opentelemetry.io/otel/trace v1.26.0 // indirect @@ -94,6 +106,7 @@ require ( golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect + golang.org/x/tools v0.25.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 6e17e5f..a84ca05 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/ClickHouse/clickhouse-go/v2 v2.28.3 h1:SkFzPULX6nzgfNZd1YD1XTECivjTMr github.com/ClickHouse/clickhouse-go/v2 v2.28.3/go.mod h1:vzn73hp+3JwxtFU4RjPCQ7r6fP2pMKVwdi8E1/Tkua8= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -46,8 +48,9 @@ github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= @@ -80,6 +83,8 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqG github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= +github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= @@ -91,6 +96,14 @@ github.com/go-faster/errors v0.7.1/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7F github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -144,6 +157,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -170,6 +185,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -223,8 +240,8 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= @@ -271,6 +288,12 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8 github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= +github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= +github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M= +github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo= +github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= +github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= @@ -284,16 +307,17 @@ github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2n github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= -github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= -github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8= +github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= @@ -308,6 +332,7 @@ golang.org/x/arch v0.10.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= @@ -315,17 +340,24 @@ golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8 golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -335,6 +367,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -345,10 +379,13 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= @@ -357,6 +394,9 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/handlers/logs_handlers.go b/internal/handlers/logs_handlers.go index 201f663..dbbc3b5 100644 --- a/internal/handlers/logs_handlers.go +++ b/internal/handlers/logs_handlers.go @@ -19,15 +19,89 @@ var ( storageErr error ) +// LogModel represents a simplified Log structure for Swagger documentation +type LogModel struct { + ChainId string `json:"chain_id"` + BlockNumber string `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"` +} + +// @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" +// @Param aggregate query []string false "List of aggregate functions to apply" +// @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 GetLogs(c *gin.Context) { handleLogsRequest(c, "", "") } +// @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" +// @Param aggregate query []string false "List of aggregate functions to apply" +// @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 GetLogsByContract(c *gin.Context) { contractAddress := c.Param("contract") handleLogsRequest(c, contractAddress, "") } +// @Summary Get logs by contract and event signature +// @Description Retrieve logs for a specific contract and event signature +// @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" +// @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" +// @Param aggregate query []string false "List of aggregate functions to apply" +// @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}/{signature} [get] func GetLogsByContractAndSignature(c *gin.Context) { contractAddress := c.Param("contract") eventSignature := c.Param("signature") diff --git a/internal/handlers/transactions_handlers.go b/internal/handlers/transactions_handlers.go index 47b3cc2..22273bf 100644 --- a/internal/handlers/transactions_handlers.go +++ b/internal/handlers/transactions_handlers.go @@ -9,15 +9,99 @@ import ( "github.com/thirdweb-dev/indexer/internal/storage" ) +// TransactionModel represents a simplified Transaction structure for Swagger documentation +type TransactionModel struct { + ChainId string `json:"chain_id"` + Hash string `json:"hash"` + Nonce uint64 `json:"nonce"` + BlockHash string `json:"block_hash"` + BlockNumber string `json:"block_number"` + BlockTimestamp uint64 `json:"block_timestamp"` + TransactionIndex uint64 `json:"transaction_index"` + FromAddress string `json:"from_address"` + ToAddress string `json:"to_address"` + Value string `json:"value"` + Gas uint64 `json:"gas"` + GasPrice string `json:"gas_price"` + Data string `json:"data"` + MaxFeePerGas string `json:"max_fee_per_gas"` + MaxPriorityFeePerGas string `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"` +} + +// @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" +// @Param aggregate query []string false "List of aggregate functions to apply" +// @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 GetTransactions(c *gin.Context) { handleTransactionsRequest(c, "", "") } +// @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" +// @Param aggregate query []string false "List of aggregate functions to apply" +// @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 GetTransactionsByContract(c *gin.Context) { to := c.Param("to") handleTransactionsRequest(c, to, "") } +// @Summary Get transactions by contract and signature +// @Description Retrieve transactions for a specific contract and signature (Not implemented yet) +// @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" +// @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" +// @Param aggregate query []string false "List of aggregate functions to apply" +// @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}/{signature} [get] func GetTransactionsByContractAndSignature(c *gin.Context) { to := c.Param("to") // TODO: Implement signature lookup before activating this @@ -83,4 +167,4 @@ func handleTransactionsRequest(c *gin.Context, contractAddress, signature string } c.JSON(http.StatusOK, response) -} +} \ No newline at end of file