forked from bitmartexchange/bitmart-go-sdk-api
/
api_account_test.go
100 lines (91 loc) · 2.16 KB
/
api_account_test.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
100
package bitmart
import (
"log"
"testing"
)
// GET https://api-cloud.bitmart.com/account/v1/currencies
func TestGetAccountCurrencies(t *testing.T) {
c := NewTestClient()
ac, err := c.GetAccountCurrencies()
if err != nil {
log.Panic(err)
} else {
PrintResponse(ac)
}
}
// GET https://api-cloud.bitmart.com/account/v1/wallet
func TestGetAccountWallet(t *testing.T) {
c := NewTestClient()
ac, err := c.GetAccountWallet("BTC") // find by currency
if err != nil {
log.Panic(err)
} else {
PrintResponse(ac)
}
ab, err := c.GetAccountWallet("") // find all
if err != nil {
log.Panic(err)
} else {
PrintResponse(ab)
}
}
// GET https://api-cloud.bitmart.com/account/v1/deposit/address
func TestGetAccountDepositAddress(t *testing.T) {
c := NewTestClient()
ac, err := c.GetAccountDepositAddress("USDT-ERC20")
if err != nil {
log.Panic(err)
} else {
PrintResponse(ac)
}
}
// GET https://api-cloud.bitmart.com/account/v1/withdraw/charge
func TestGetAccountWithdrawCharge(t *testing.T) {
c := NewTestClient()
ac, err := c.GetAccountWithdrawCharge("USDT-ERC20")
if err != nil {
log.Panic(err)
} else {
PrintResponse(ac)
}
}
// POST https://api-cloud.bitmart.com/account/v1/withdraw/apply
func TestPostAccountWithdrawApply(t *testing.T) {
c := NewTestClient()
ac, err := c.PostAccountWithdrawApply(WithdrawApply{
Currency: "USDT-ERC20",
Amount: "50",
Destination: "To Digital Address",
Address: "0xe57b69a8776b37860407965B73cdFFBDFe668Bb5",
AddressMemo: "",
})
if err != nil {
log.Panic(err)
} else {
PrintResponse(ac)
}
}
// GET https://api-cloud.bitmart.com/account/v2/deposit-withdraw/history
func TestPostAccountWithdrawHistory(t *testing.T) {
c := NewTestClient()
ac, err := c.GetDepositWithdrawHistory(HistoryApply{
Currency: "USDT-ERC20",
OperationType: "withdraw",
N: 100,
})
if err != nil {
log.Panic(err)
} else {
PrintResponse(ac)
}
}
// GET https://api-cloud.bitmart.com/account/v1/deposit-withdraw/detail
func TestPostAccountWithdrawDetail(t *testing.T) {
c := NewTestClient()
ac, err := c.GetDepositWithdrawDetail(12121212)
if err != nil {
log.Panic(err)
} else {
PrintResponse(ac)
}
}