Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
59 lines (49 loc) · 1.39 KB

File metadata and controls

59 lines (49 loc) · 1.39 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*
* Copyright (c) 2018 LI Zhennan
*
* Use of this work is governed by a MIT License.
* You may find a license copy in project root.
*/
package etherscan
import "errors"
// ErrPreByzantiumTx transaction before 4,370,000 does not support receipt status check
var ErrPreByzantiumTx = errors.New("pre-byzantium transaction does not support receipt status check")
// ExecutionStatus checks contract execution status (if there was an error during contract execution)
//
// note on IsError: 0 = pass, 1 = error
func (c *Client) ExecutionStatus(txHash string) (status ExecutionStatus, err error) {
param := M{
"txhash": txHash,
}
err = c.call("transaction", "getstatus", param, &status)
return
}
// ReceiptStatus checks transaction receipt status
//
// only applicable for post byzantium fork transactions, i.e. after block 4,370,000
//
// An special err ErrPreByzantiumTx raises for the transaction before byzantium fork.
//
// Note: receiptStatus: 0 = Fail, 1 = Pass.
func (c *Client) ReceiptStatus(txHash string) (receiptStatus int, err error) {
param := M{
"txhash": txHash,
}
var rawStatus = struct {
Status string `json:"status"`
}{}
err = c.call("transaction", "gettxreceiptstatus", param, &rawStatus)
if err != nil {
return
}
switch rawStatus.Status {
case "0":
receiptStatus = 0
case "1":
receiptStatus = 1
default:
receiptStatus = -1
err = ErrPreByzantiumTx
}
return
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.