-
Notifications
You must be signed in to change notification settings - Fork 90
/
lookupAssetBalances.go
96 lines (77 loc) · 3.21 KB
/
lookupAssetBalances.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package indexer
import (
"context"
"fmt"
"github.com/algorand/go-algorand-sdk/client/v2/common"
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
)
// LookupAssetBalancesParams contains all of the query parameters for url serialization.
type LookupAssetBalancesParams struct {
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
CurrencyGreaterThan uint64 `url:"currency-greater-than,omitempty"`
// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
// will be used.
CurrencyLessThan uint64 `url:"currency-less-than,omitempty"`
// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
IncludeAll bool `url:"include-all,omitempty"`
// Limit maximum number of results to return.
Limit uint64 `url:"limit,omitempty"`
// NextToken the next page of results. Use the next token provided by the previous
// results.
NextToken string `url:"next,omitempty"`
// Round include results for the specified round.
Round uint64 `url:"round,omitempty"`
}
// LookupAssetBalances lookup the list of accounts who hold this asset
type LookupAssetBalances struct {
c *Client
assetId uint64
p LookupAssetBalancesParams
}
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
func (s *LookupAssetBalances) CurrencyGreaterThan(CurrencyGreaterThan uint64) *LookupAssetBalances {
s.p.CurrencyGreaterThan = CurrencyGreaterThan
return s
}
// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
// will be used.
func (s *LookupAssetBalances) CurrencyLessThan(CurrencyLessThan uint64) *LookupAssetBalances {
s.p.CurrencyLessThan = CurrencyLessThan
return s
}
// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
func (s *LookupAssetBalances) IncludeAll(IncludeAll bool) *LookupAssetBalances {
s.p.IncludeAll = IncludeAll
return s
}
// Limit maximum number of results to return.
func (s *LookupAssetBalances) Limit(Limit uint64) *LookupAssetBalances {
s.p.Limit = Limit
return s
}
// NextToken the next page of results. Use the next token provided by the previous
// results.
func (s *LookupAssetBalances) NextToken(NextToken string) *LookupAssetBalances {
s.p.NextToken = NextToken
return s
}
// Round include results for the specified round.
func (s *LookupAssetBalances) Round(Round uint64) *LookupAssetBalances {
s.p.Round = Round
return s
}
// Do performs the HTTP request
func (s *LookupAssetBalances) Do(ctx context.Context, headers ...*common.Header) (response models.AssetBalancesResponse, err error) {
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/assets/%v/balances", s.assetId), s.p, headers)
return
}