Skip to content

Commit

Permalink
Add TzKT methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Jul 19, 2022
1 parent 4cc1ce4 commit 66db7e0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion tzkt/api/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@ import (

// AccountCounter - Returns account counter
func (tzkt *API) AccountCounter(ctx context.Context, address string) (uint64, error) {
return tzkt.count(ctx, fmt.Sprintf("/v1/accounts/%s/counter", address))
return tzkt.count(ctx, fmt.Sprintf("/v1/accounts/%s/counter", address), nil)
}

// AccountCounter - Returns a number of accounts.
func (tzkt *API) AccountsCount(ctx context.Context, filters map[string]string) (uint64, error) {
return tzkt.count(ctx, "/v1/accounts/count", filters)
}
4 changes: 2 additions & 2 deletions tzkt/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ func (tzkt *API) json(ctx context.Context, endpoint string, args map[string]stri
}
}

func (tzkt *API) count(ctx context.Context, endpoint string) (uint64, error) {
resp, err := tzkt.get(ctx, endpoint, nil, false)
func (tzkt *API) count(ctx context.Context, endpoint string, args map[string]string) (uint64, error) {
resp, err := tzkt.get(ctx, endpoint, args, false)
if err != nil {
return 0, err
}
Expand Down
2 changes: 1 addition & 1 deletion tzkt/api/bigmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// GetBigmapsCount -
func (tzkt *API) GetBigmapsCount(ctx context.Context) (uint64, error) {
return tzkt.count(ctx, "/v1/bigmaps/count")
return tzkt.count(ctx, "/v1/bigmaps/count", nil)
}

// GetBigmaps -
Expand Down
2 changes: 1 addition & 1 deletion tzkt/api/delegates.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (tzkt *API) GetDelegates(ctx context.Context, filters map[string]string) (d

// GetDelegatesCount -
func (tzkt *API) GetDelegatesCount(ctx context.Context) (uint64, error) {
return tzkt.count(ctx, "/v1/delegates/count")
return tzkt.count(ctx, "/v1/delegates/count", nil)
}

// GetDelegateByAddress -
Expand Down

0 comments on commit 66db7e0

Please sign in to comment.