Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func RunApi(cmd *cobra.Command, args []string) {
// token holder queries
root.GET("/holders/:address", handlers.GetTokenHoldersByType)

// token ID queries
root.GET("/tokens/:address", handlers.GetTokenIdsByType)

// search
root.GET("/search/:input", handlers.Search)
}
Expand Down
128 changes: 127 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ const docTemplate = `{
"type": "string",
"description": "Type of token",
"name": "token_type",
"in": "path"
"in": "query"
},
{
"type": "boolean",
Expand Down Expand Up @@ -813,6 +813,109 @@ const docTemplate = `{
}
}
},
"/{chainId}/tokens/{address}": {
"get": {
"security": [
{
"BasicAuth": []
}
],
"description": "Retrieve token IDs by type for a specific token address",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"tokens"
],
"summary": "Get token IDs by type for a specific token address",
"parameters": [
{
"type": "string",
"description": "Chain ID",
"name": "chainId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Token address",
"name": "address",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Type of token (erc721 or erc1155)",
"name": "token_type",
"in": "query"
},
{
"type": "boolean",
"description": "Hide zero balances",
"name": "hide_zero_balances",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "Page number for pagination",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 5,
"description": "Number of items per page",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.QueryResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/handlers.TokenIdModel"
}
}
}
}
]
}
},
"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": [
Expand Down Expand Up @@ -1359,12 +1462,18 @@ const docTemplate = `{
"indexedParams": {
"type": "object"
},
"indexed_params": {
"type": "object"
},
"name": {
"type": "string"
},
"nonIndexedParams": {
"type": "object"
},
"non_indexed_params": {
"type": "object"
},
"signature": {
"type": "string"
}
Expand Down Expand Up @@ -1678,6 +1787,9 @@ const docTemplate = `{
},
"token_id": {
"type": "string"
},
"token_type": {
"type": "string"
}
}
},
Expand All @@ -1692,6 +1804,9 @@ const docTemplate = `{
},
"token_id": {
"type": "string"
},
"token_type": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -1739,6 +1854,17 @@ const docTemplate = `{
"SearchResultTypeAddress",
"SearchResultTypeContract"
]
},
"handlers.TokenIdModel": {
"type": "object",
"properties": {
"token_id": {
"type": "string"
},
"token_type": {
"type": "string"
}
}
}
},
"securityDefinitions": {
Expand Down
128 changes: 127 additions & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@
"type": "string",
"description": "Type of token",
"name": "token_type",
"in": "path"
"in": "query"
},
{
"type": "boolean",
Expand Down Expand Up @@ -806,6 +806,109 @@
}
}
},
"/{chainId}/tokens/{address}": {
"get": {
"security": [
{
"BasicAuth": []
}
],
"description": "Retrieve token IDs by type for a specific token address",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"tokens"
],
"summary": "Get token IDs by type for a specific token address",
"parameters": [
{
"type": "string",
"description": "Chain ID",
"name": "chainId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Token address",
"name": "address",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Type of token (erc721 or erc1155)",
"name": "token_type",
"in": "query"
},
{
"type": "boolean",
"description": "Hide zero balances",
"name": "hide_zero_balances",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "Page number for pagination",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 5,
"description": "Number of items per page",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.QueryResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/handlers.TokenIdModel"
}
}
}
}
]
}
},
"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": [
Expand Down Expand Up @@ -1352,12 +1455,18 @@
"indexedParams": {
"type": "object"
},
"indexed_params": {
"type": "object"
},
"name": {
"type": "string"
},
"nonIndexedParams": {
"type": "object"
},
"non_indexed_params": {
"type": "object"
},
"signature": {
"type": "string"
}
Expand Down Expand Up @@ -1671,6 +1780,9 @@
},
"token_id": {
"type": "string"
},
"token_type": {
"type": "string"
}
}
},
Expand All @@ -1685,6 +1797,9 @@
},
"token_id": {
"type": "string"
},
"token_type": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -1732,6 +1847,17 @@
"SearchResultTypeAddress",
"SearchResultTypeContract"
]
},
"handlers.TokenIdModel": {
"type": "object",
"properties": {
"token_id": {
"type": "string"
},
"token_type": {
"type": "string"
}
}
}
},
"securityDefinitions": {
Expand Down
Loading