-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapclient_test.go
68 lines (55 loc) · 1.23 KB
/
mapclient_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
package ethclient
import (
"context"
"encoding/json"
"fmt"
"math/big"
"testing"
)
var MAPEndpoint = "http://18.142.54.137:7445"
func TestClient_MAPBlockByNumber(t *testing.T) {
cli, err := Dial(MAPEndpoint)
if err != nil {
t.Fatalf(err.Error())
}
header, err := cli.MAPBlockByNumber(context.Background(), big.NewInt(15960))
if err != nil {
t.Fatalf(err.Error())
}
fmt.Printf("block: %+v\n", header)
h, err := json.Marshal(header)
if err != nil {
t.Fatalf(err.Error())
}
fmt.Println("block: ", string(h))
}
func TestClient_MAPHeaderByNumber(t *testing.T) {
cli, err := Dial(MAPEndpoint)
if err != nil {
t.Fatalf(err.Error())
}
header, err := cli.MAPHeaderByNumber(context.Background(), big.NewInt(1))
if err != nil {
t.Fatalf(err.Error())
}
h, err := json.Marshal(header)
if err != nil {
t.Fatalf(err.Error())
}
fmt.Println("header: ", string(h))
}
func TestClient_GetSnapshot(t *testing.T) {
cli, err := Dial(MAPEndpoint)
if err != nil {
t.Fatalf(err.Error())
}
snapshot, err := cli.GetSnapshot(context.Background(), big.NewInt(0))
if err != nil {
t.Fatalf(err.Error())
}
snap, err := json.Marshal(snapshot)
if err != nil {
t.Fatalf(err.Error())
}
fmt.Println("snapshot: ", string(snap))
}