forked from hashquark-staking/staking-service-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rewards.go
63 lines (54 loc) · 1.98 KB
/
rewards.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
package staking_service
import "fmt"
func (stakingService *StakingService) DailyRewards(uid string, startTime int64, endTime int64) (result *RewardList, code uint, msg string, err error) {
req := stakingService.getBaseRequest()
if uid != "" {
req.SetQueryParam("uid", uid)
}
req.SetQueryParam("startTime", fmt.Sprintf("%d", startTime))
req.SetQueryParam("endTime", fmt.Sprintf("%d", endTime))
res, err := req.Send("GET", "/openapi/rewards/daily")
if err != nil {
return
}
return processResponse[RewardList](res)
}
func (stakingService *StakingService) MonthlyRewards(uid string, startTime int64, endTime int64) (result *RewardList, code uint, msg string, err error) {
req := stakingService.getBaseRequest()
if uid != "" {
req.SetQueryParam("uid", uid)
}
req.SetQueryParam("startTime", fmt.Sprintf("%d", startTime))
req.SetQueryParam("endTime", fmt.Sprintf("%d", endTime))
res, err := req.Send("GET", "/openapi/rewards/monthly")
if err != nil {
return
}
return processResponse[RewardList](res)
}
func (stakingService *StakingService) QuarterlyRewards(uid string, startTime int64, endTime int64) (result *RewardList, code uint, msg string, err error) {
req := stakingService.getBaseRequest()
if uid != "" {
req.SetQueryParam("uid", uid)
}
req.SetQueryParam("startTime", fmt.Sprintf("%d", startTime))
req.SetQueryParam("endTime", fmt.Sprintf("%d", endTime))
res, err := req.Send("GET", "/openapi/rewards/quarterly")
if err != nil {
return
}
return processResponse[RewardList](res)
}
func (stakingService *StakingService) AnnuallyRewards(uid string, startTime int64, endTime int64) (result *RewardList, code uint, msg string, err error) {
req := stakingService.getBaseRequest()
if uid != "" {
req.SetQueryParam("uid", uid)
}
req.SetQueryParam("startTime", fmt.Sprintf("%d", startTime))
req.SetQueryParam("endTime", fmt.Sprintf("%d", endTime))
res, err := req.Send("GET", "/openapi/rewards/annually")
if err != nil {
return
}
return processResponse[RewardList](res)
}