-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwithdraw.go
44 lines (36 loc) · 1.38 KB
/
withdraw.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
package hitbtc
import "github.com/google/go-querystring/query"
/*
Request: POST /api/1/payment/payout
Parameters:
Parameter Required Type Description
amount Yes decimal Funds amount to withdraw
currency_code Yes string Currency symbol, e.g. BTC
address Yes string BTC/LTC address to withdraw to
extra_id No string payment id for cryptonote
recommended_fee No boolean use recommended network fee instead of flat, e.g. 0 or 1
Example: amount=0.001¤cy_code=BTC&address=1LuWvENyuPNHsHWjDgU1QYKWUYN9xxy7n5
*/
type WithdrawRequest struct {
Amount float64 `url:"amount"` //Yes decimal Funds amount to withdraw
CurrencyCode string `url:"currency_code"` // Yes string Currency symbol, e.g. BTC
Address string `url:"address"` //Yes string BTC/LTC address to withdraw to
ExtraId string `url:"extra_id"` //No string payment id for cryptonote
RecommendedFee int `url:"recommended_fee"` //No boolean use recommended network fee instead of flat, e.g. 0 or 1
}
func (w *WithdrawRequest) String() string {
v, _ := query.Values(w)
if w.ExtraId == "" {
v.Del("extra_id")
}
return v.Encode()
}
func NewWithdrawRequest(coin string, amount float64, address, paymentID string) *WithdrawRequest {
return &WithdrawRequest{
Amount: amount,
CurrencyCode: coin,
Address: address,
ExtraId: paymentID,
RecommendedFee: 1,
}
}