From 691c6acfe70686a901a554a36f5289657f15cfb0 Mon Sep 17 00:00:00 2001 From: Artem Poltorzhitskiy Date: Mon, 9 Dec 2024 11:53:10 +0100 Subject: [PATCH] Feature: add total bytes to API (#74) --- cmd/api/docs/docs.go | 8 ++++++++ cmd/api/docs/swagger.json | 5 +++++ cmd/api/docs/swagger.yaml | 4 ++++ cmd/api/handler/responses/state.go | 2 ++ 4 files changed, 19 insertions(+) diff --git a/cmd/api/docs/docs.go b/cmd/api/docs/docs.go index 5f2a2b1..45c7d98 100644 --- a/cmd/api/docs/docs.go +++ b/cmd/api/docs/docs.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2024 PK Lab AG +// SPDX-License-Identifier: MIT + // Package docs Code generated by swaggo/swag. DO NOT EDIT package docs @@ -3698,6 +3701,11 @@ const docTemplate = `{ "format": "int64", "example": 312 }, + "total_bytes": { + "type": "integer", + "format": "int64", + "example": 312 + }, "total_rollups": { "type": "integer", "format": "int64", diff --git a/cmd/api/docs/swagger.json b/cmd/api/docs/swagger.json index 236fbda..11a7e2a 100644 --- a/cmd/api/docs/swagger.json +++ b/cmd/api/docs/swagger.json @@ -3691,6 +3691,11 @@ "format": "int64", "example": 312 }, + "total_bytes": { + "type": "integer", + "format": "int64", + "example": 312 + }, "total_rollups": { "type": "integer", "format": "int64", diff --git a/cmd/api/docs/swagger.yaml b/cmd/api/docs/swagger.yaml index de0d902..7dc19ee 100644 --- a/cmd/api/docs/swagger.yaml +++ b/cmd/api/docs/swagger.yaml @@ -658,6 +658,10 @@ definitions: example: 312 format: int64 type: integer + total_bytes: + example: 312 + format: int64 + type: integer total_rollups: example: 312 format: int64 diff --git a/cmd/api/handler/responses/state.go b/cmd/api/handler/responses/state.go index 7119852..d1f7c0f 100644 --- a/cmd/api/handler/responses/state.go +++ b/cmd/api/handler/responses/state.go @@ -23,6 +23,7 @@ type State struct { TotalAccounts int64 `example:"43" format:"int64" json:"total_accounts" swaggertype:"integer"` TotalRollups int64 `example:"312" format:"int64" json:"total_rollups" swaggertype:"integer"` TotalBridges int64 `example:"312" format:"int64" json:"total_bridges" swaggertype:"integer"` + TotalBytes int64 `example:"312" format:"int64" json:"total_bytes" swaggertype:"integer"` TotalSupply string `example:"312" format:"string" json:"total_supply" swaggertype:"string"` Synced bool `example:"true" format:"boolean" json:"synced" swaggertype:"boolean"` } @@ -39,6 +40,7 @@ func NewState(state storage.State) State { TotalAccounts: state.TotalAccounts, TotalRollups: state.TotalRollups, TotalBridges: state.TotalBridges, + TotalBytes: state.TotalBytes, TotalSupply: state.TotalSupply.String(), Synced: !state.LastTime.UTC().Add(2 * time.Minute).Before(time.Now().UTC()), }