-
Notifications
You must be signed in to change notification settings - Fork 17
/
wallet_test.go
48 lines (38 loc) · 958 Bytes
/
wallet_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
package goftx
import (
"context"
"os"
"testing"
"github.com/joho/godotenv"
"github.com/stretchr/testify/require"
"github.com/grishinsana/goftx/models"
)
func TestWallet_GetBalances(t *testing.T) {
_ = godotenv.Load()
ftx := New(
WithAuth(os.Getenv("FTX_KEY"), os.Getenv("FTX_SECRET")),
)
err := ftx.SetServerTimeDiff()
require.NoError(t, err)
balances, err := ftx.GetBalances()
require.Nil(t, err)
t.Logf("%+v", balances)
require.NotNil(t, balances)
}
func TestWallet_Withdraw(t *testing.T) {
_ = godotenv.Load()
ftx := New(
WithAuth(os.Getenv("FTX_KEY"), os.Getenv("FTX_SECRET")),
)
payload := models.CreateWithdrawPayload{
Coin: os.Getenv("WITHDRAW_COIN"),
Size: 2,
Address: os.Getenv("WITHDRAW_ADDR"),
Tag: os.Getenv("WITHDRAW_TAG"),
Method: os.Getenv("WITHDRAW_NETWORK"),
}
res, err := ftx.Withdraw(context.Background(), &payload)
require.Nil(t, err)
t.Logf("%+v", res)
require.NotNil(t, res)
}