-
Notifications
You must be signed in to change notification settings - Fork 0
/
state_test.go
69 lines (53 loc) · 1.29 KB
/
state_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
package filecoin
import (
"context"
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"testing"
)
// 查询消息/交易执行状态
func TestClient_StateGetReceipt(t *testing.T) {
c := testClient()
id, err := cid.Parse("bafy2bzacebrx3sb5do2b7cqgsnys2lkxtdq3pvjtgmdt2wclwmrtjeraa7x3q")
if err != nil {
t.Error(err)
}
mr, err := c.StateGetReceipt(context.Background(), id, nil)
if err != nil {
t.Error(err)
}
t.Log(mr)
}
// 查询消息状态
// Receipt 为空表示未执行
func TestClient_StateSearchMsg(t *testing.T) {
c := testClient()
id, err := cid.Parse("bafy2bzacebrx3sb5do2b7cqgsnys2lkxtdq3pvjtgmdt2wclwmrtjeraa7x3q")
if err != nil {
t.Error(err)
}
msg, err := c.StateSearchMsg(context.Background(), id)
if err != nil {
t.Error(err)
}
if msg == nil {
t.Log("nil")
} else {
t.Log(msg)
}
}
func TestClient_StateGetActor(t *testing.T) {
c := testClient()
address.CurrentNetwork = address.Mainnet
addr, _ := address.NewFromString("f3qx3jo74v6d6z35qhfeax3xozsegzliowrrchuyumshnwb2kz66xajhl55pxjr5xvvpeggioytv7uko5hpzga")
actor, err := c.StateGetActor(context.Background(), addr, nil)
if err != nil {
t.Error(err)
}
t.Log(actor.Nonce)
nonce, err := c.MpoolGetNonce(context.Background(), addr)
if err != nil {
t.Error(err)
}
t.Log(nonce)
}