-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunds.go
48 lines (35 loc) · 892 Bytes
/
funds.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
package wazirx_client
import (
"context"
"encoding/json"
"net/http"
helpers "github.com/yuvan11/wazirx-go/wazirx-client/Helpers"
api "github.com/yuvan11/wazirx-go/wazirx-client/endpoints"
)
type FundInfoService struct {
C *Client
}
type FundInfo struct {
Asset string `json:"asset"`
Free string `json:"free"`
Locked string `json:"locked"`
ReservedFee string `json:"reservedFee"`
}
func (s *FundInfoService) FetchFundsInfo(ctx context.Context) (*[]FundInfo, error) {
r := &Request{
Method: http.MethodGet,
Endpoint: api.FUNDS,
SecType: SecTypeSigned,
RecvWindow: 10000,
TimeStamp: helpers.CurrentTimestamp(),
}
data, err := s.C.HandleAPI(ctx, r)
if err != nil {
return &[]FundInfo{}, err
}
result := new([]FundInfo)
if err := json.Unmarshal(data, &result); err != nil {
return &[]FundInfo{}, err
}
return result, nil
}