-
Notifications
You must be signed in to change notification settings - Fork 4
/
client_test.go
41 lines (37 loc) · 910 Bytes
/
client_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
package go_cowswap
import (
"context"
"testing"
)
func TestNewClient(t *testing.T) {
options := Options
client, err := NewClient(options)
if err != nil {
t.Fatal(err)
}
if client.TransactionSigner != nil {
t.Logf("initialized client with a transaction signer: %v", client)
} else {
t.Logf("initialized client without a transaction signer: %v", client)
}
chainId, err := client.EthClient.ChainID(context.Background())
if err != nil {
t.Fatal(err)
}
t.Logf("%v", chainId)
block, err := client.EthClient.BlockNumber(context.Background())
if err != nil {
t.Fatal(err)
}
t.Logf("current block: %v", block)
addressList := TOKEN_ADDRESSES[Options.Network]
for s, s2 := range addressList {
t.Logf("%v, %v \n", s, s2)
}
resp, code, err := client.GetVersion(context.Background())
if err != nil {
t.Fatal(err)
}
t.Logf("statusCode: %v", code)
t.Logf("version resp: %v", resp)
}