Skip to content

Commit dce34b9

Browse files
Add TzKT statistics endpoint
1 parent 7a7bb01 commit dce34b9

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

tzkt/api/statistics.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package api
2+
3+
import (
4+
"context"
5+
6+
"github.com/dipdup-net/go-lib/tzkt/data"
7+
)
8+
9+
// Statistics -
10+
func (tzkt *API) Statistics(ctx context.Context, filters map[string]string) (stats []data.Statistics, err error) {
11+
err = tzkt.json(ctx, "/v1/statistics", filters, false, &stats)
12+
return
13+
}
14+
15+
// StatisticsDaily -
16+
func (tzkt *API) StatisticsDaily(ctx context.Context, filters map[string]string) (stats []data.Statistics, err error) {
17+
err = tzkt.json(ctx, "/v1/statistics/daily", filters, false, &stats)
18+
return
19+
}
20+
21+
// StatisticsCyclic -
22+
func (tzkt *API) StatisticsCyclic(ctx context.Context, filters map[string]string) (stats []data.Statistics, err error) {
23+
err = tzkt.json(ctx, "/v1/statistics/cyclic", filters, false, &stats)
24+
return
25+
}
26+
27+
// StatisticsCurrent -
28+
func (tzkt *API) StatisticsCurrent(ctx context.Context, filters map[string]string) (stats data.Statistics, err error) {
29+
err = tzkt.json(ctx, "/v1/statistics/current", filters, false, &stats)
30+
return
31+
}

tzkt/data/general.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,21 @@ type ProtocolMetadata struct {
142142
Docs string `json:"docs"`
143143
Alias string `json:"alias"`
144144
}
145+
146+
// Statistics -
147+
type Statistics struct {
148+
Level uint64 `json:"level"`
149+
Timestamp time.Time `json:"timestamp"`
150+
TotalSupply uint64 `json:"totalSupply"`
151+
CirculatingSupply uint64 `json:"circulatingSupply"`
152+
TotalBootstrapped uint64 `json:"totalBootstrapped"`
153+
TotalCommitments uint64 `json:"totalCommitments"`
154+
TotalActivated uint64 `json:"totalActivated"`
155+
TotalCreated uint64 `json:"totalCreated"`
156+
TotalBurned uint64 `json:"totalBurned"`
157+
TotalBanished uint64 `json:"totalBanished"`
158+
TotalFrozen uint64 `json:"totalFrozen"`
159+
TotalRollupBonds uint64 `json:"totalRollupBonds"`
160+
TotalVested uint64 `json:"totalVested"`
161+
Quote *Quote `json:"quote,omitempty"`
162+
}

0 commit comments

Comments
 (0)