-
Notifications
You must be signed in to change notification settings - Fork 3
/
query_api.go
96 lines (78 loc) · 1.9 KB
/
query_api.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
package antchain
// 查询交易
func (c *Client) QueryTransaction(hash string) (data []byte, err error) {
c.Shakehand()
params := ParamsMap{
"bizid": c.BIZID,
"method": "QUERYTRANSACTION",
"accessId": c.AccessID,
"hash": hash,
"token": c.Token,
}
data, err = c.doRequest(CHAIN_CALL, params)
return
}
// 查询交易回执
func (c *Client) QueryReceipt(hash string) (data []byte, err error) {
c.Shakehand()
params := ParamsMap{
"bizid": c.BIZID,
"method": "QUERYRECEIPT",
"accessId": c.AccessID,
"hash": hash,
"token": c.Token,
}
data, err = c.doRequest(CHAIN_CALL, params)
return
}
// 查询块头
func (c *Client) QueryBlockHeader(blockNumber int64) (data []byte, err error) {
c.Shakehand()
params := ParamsMap{
"bizid": c.BIZID,
"method": "QUERYBLOCK",
"accessId": c.AccessID,
"requestStr": blockNumber,
"token": c.Token,
}
data, err = c.doRequest(CHAIN_CALL, params)
return
}
// 查询块体
func (c *Client) QueryBlockBody(blockNumber int64) (data []byte, err error) {
c.Shakehand()
params := ParamsMap{
"bizid": c.BIZID,
"method": "QUERYBLOCKBODY",
"accessId": c.AccessID,
"requestStr": blockNumber,
"token": c.Token,
}
data, err = c.doRequest(CHAIN_CALL, params)
return
}
// 查询最新块高
func (c *Client) QueryLastBlock() (data []byte, err error) {
c.Shakehand()
params := ParamsMap{
"bizid": c.BIZID,
"method": "QUERYLASTBLOCK",
"accessId": c.AccessID,
"token": c.Token,
}
data, err = c.doRequest(CHAIN_CALL, params)
return
}
// 查询账户
func (c *Client) QueryAccount(account string) (data []byte, err error) {
c.Shakehand()
params := ParamsMap{
"bizid": c.BIZID,
"method": "QUERYACCOUNT",
"requestStr": "{\"queryAccount\":\"" + account + "\"}",
"accessId": c.AccessID,
"token": c.Token,
}
data, err = c.doRequest(CHAIN_CALL, params)
return
}