-
-
Notifications
You must be signed in to change notification settings - Fork 272
/
withdrawal.go
81 lines (69 loc) · 2.16 KB
/
withdrawal.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
package max
//go:generate -command GetRequest requestgen -method GET
//go:generate -command PostRequest requestgen -method POST
import (
"github.com/c9s/requestgen"
)
/*
example response
{
"uuid": "18022603540001",
"currency": "eth",
"currency_version": "eth",
"amount": "0.019",
"fee": "0.0",
"fee_currency": "eth",
"created_at": 1521726960,
"updated_at": 1521726960,
"state": "confirmed",
"type": "external",
"transaction_type": "external send",
"notes": "notes",
"sender": {
"email": "max****@maicoin.com"
},
"recipient": {
"address": "0x5c7d23d516f120d322fc7b116386b7e491739138"
}
}
*/
//go:generate PostRequest -url "v2/withdrawal" -type WithdrawalRequest -responseType .Withdraw
type WithdrawalRequest struct {
client requestgen.AuthenticatedAPIClient
addressUUID string `param:"address_uuid,required"`
currency string `param:"currency,required"`
amount float64 `param:"amount"`
}
type WithdrawalAddress struct {
UUID string `json:"uuid"`
Currency string `json:"currency"`
CurrencyVersion string `json:"currency_version"`
Address string `json:"address"`
ExtraLabel string `json:"extra_label"`
State string `json:"state"`
SygnaVaspCode string `json:"sygna_vasp_code"`
SygnaUserType string `json:"sygna_user_type"`
SygnaUserCode string `json:"sygna_user_code"`
IsInternal bool `json:"is_internal"`
}
//go:generate GetRequest -url "v2/withdraw_addresses" -type GetWithdrawalAddressesRequest -responseType []WithdrawalAddress
type GetWithdrawalAddressesRequest struct {
client requestgen.AuthenticatedAPIClient
currency string `param:"currency,required"`
}
type WithdrawalService struct {
client requestgen.AuthenticatedAPIClient
}
func (s *WithdrawalService) NewGetWithdrawalAddressesRequest() *GetWithdrawalAddressesRequest {
return &GetWithdrawalAddressesRequest{
client: s.client,
}
}
func (s *WithdrawalService) NewWithdrawalRequest() *WithdrawalRequest {
return &WithdrawalRequest{client: s.client}
}
func (s *WithdrawalService) NewGetWithdrawalHistoryRequest() *GetWithdrawHistoryRequest {
return &GetWithdrawHistoryRequest{
client: s.client,
}
}