-
Notifications
You must be signed in to change notification settings - Fork 76
/
deposit.go
99 lines (86 loc) · 3.38 KB
/
deposit.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
97
98
99
package kucoin
import (
"context"
"net/http"
)
// A DepositAddressModel represents a deposit address of currency for deposit.
type DepositAddressModel struct {
Address string `json:"address"`
Memo string `json:"memo"`
Chain string `json:"chain"`
}
// A DepositAddressesModel is the set of *DepositAddressModel.
type DepositAddressesModel DepositAddressModel
// A DepositModel represents a deposit record.
type DepositModel struct {
Chain string `json:"chain"`
Address string `json:"address"`
Memo string `json:"memo"`
Amount string `json:"amount"`
Fee string `json:"fee"`
Currency string `json:"currency"`
IsInner bool `json:"isInner"`
WalletTxId string `json:"walletTxId"`
Status string `json:"status"`
Remark string `json:"remark"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// A DepositsModel is the set of *DepositModel.
type DepositsModel []*DepositModel
// CreateDepositAddress creates a deposit address.
func (as *ApiService) CreateDepositAddress(ctx context.Context, currency, chain string) (*ApiResponse, error) {
params := map[string]string{"currency": currency}
if chain != "" {
params["chain"] = chain
}
req := NewRequest(http.MethodPost, "/api/v1/deposit-addresses", params)
return as.Call(ctx, req)
}
// DepositAddresses returns the deposit address of currency for deposit.
// If return data is empty, you may need create a deposit address first.
func (as *ApiService) DepositAddresses(ctx context.Context, currency, chain string) (*ApiResponse, error) {
params := map[string]string{"currency": currency}
if chain != "" {
params["chain"] = chain
}
req := NewRequest(http.MethodGet, "/api/v1/deposit-addresses", params)
return as.Call(ctx, req)
}
type depositAddressV2Model struct {
Address string `json:"address"`
Memo string `json:"memo"`
Chain string `json:"chain"`
ContractAddress string `json:"contract_address"`
}
type DepositAddressesV2Model []*depositAddressV2Model
// DepositAddressesV2 Get all deposit addresses for the currency you intend to deposit.
// If the returned data is empty, you may need to create a deposit address first.
func (as *ApiService) DepositAddressesV2(ctx context.Context, currency string) (*ApiResponse, error) {
params := map[string]string{"currency": currency}
req := NewRequest(http.MethodGet, "/api/v2/deposit-addresses", params)
return as.Call(ctx, req)
}
// Deposits returns a list of deposit.
func (as *ApiService) Deposits(ctx context.Context, params map[string]string, pagination *PaginationParam) (*ApiResponse, error) {
pagination.ReadParam(params)
req := NewRequest(http.MethodGet, "/api/v1/deposits", params)
return as.Call(ctx, req)
}
// A V1DepositModel represents a v1 deposit record.
type V1DepositModel struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
IsInner bool `json:"isInner"`
WalletTxId string `json:"walletTxId"`
Status string `json:"status"`
CreateAt int64 `json:"createAt"`
}
// A V1DepositsModel is the set of *V1DepositModel.
type V1DepositsModel []*V1DepositModel
// V1Deposits returns a list of v1 historical deposits.
func (as *ApiService) V1Deposits(ctx context.Context, params map[string]string, pagination *PaginationParam) (*ApiResponse, error) {
pagination.ReadParam(params)
req := NewRequest(http.MethodGet, "/api/v1/hist-deposits", params)
return as.Call(ctx, req)
}