@@ -10,8 +10,10 @@ package etherscan
10
10
import (
11
11
"encoding/json"
12
12
"fmt"
13
+ "math/big"
13
14
"strconv"
14
15
"strings"
16
+ "time"
15
17
)
16
18
17
19
// Envelope is the carrier of nearly every response
@@ -26,125 +28,125 @@ type Envelope struct {
26
28
27
29
// AccountBalance account and its balance in pair
28
30
type AccountBalance struct {
29
- Account string `json:"account"`
30
- Balance * BigInt `json:"balance"`
31
+ Account string `json:"account"`
32
+ Balance * big. Int `json:"balance"`
31
33
}
32
34
33
35
// NormalTx holds info from normal tx query
34
36
type NormalTx struct {
35
- BlockNumber int `json:"blockNumber,string"`
36
- TimeStamp Time `json:"timeStamp"`
37
- Hash string `json:"hash"`
38
- Nonce int `json:"nonce,string"`
39
- BlockHash string `json:"blockHash"`
40
- TransactionIndex int `json:"transactionIndex,string"`
41
- From string `json:"from"`
42
- To string `json:"to"`
43
- Value * BigInt `json:"value"`
44
- Gas int `json:"gas,string"`
45
- GasPrice * BigInt `json:"gasPrice"`
46
- IsError int `json:"isError,string"`
47
- TxReceiptStatus string `json:"txreceipt_status"`
48
- Input string `json:"input"`
49
- ContractAddress string `json:"contractAddress"`
50
- CumulativeGasUsed int `json:"cumulativeGasUsed,string"`
51
- GasUsed int `json:"gasUsed,string"`
52
- Confirmations int `json:"confirmations,string"`
37
+ BlockNumber int `json:"blockNumber,string"`
38
+ TimeStamp time. Time `json:"timeStamp"`
39
+ Hash string `json:"hash"`
40
+ Nonce int `json:"nonce,string"`
41
+ BlockHash string `json:"blockHash"`
42
+ TransactionIndex int `json:"transactionIndex,string"`
43
+ From string `json:"from"`
44
+ To string `json:"to"`
45
+ Value * big. Int `json:"value"`
46
+ Gas int `json:"gas,string"`
47
+ GasPrice * big. Int `json:"gasPrice"`
48
+ IsError int `json:"isError,string"`
49
+ TxReceiptStatus string `json:"txreceipt_status"`
50
+ Input string `json:"input"`
51
+ ContractAddress string `json:"contractAddress"`
52
+ CumulativeGasUsed int `json:"cumulativeGasUsed,string"`
53
+ GasUsed int `json:"gasUsed,string"`
54
+ Confirmations int `json:"confirmations,string"`
53
55
}
54
56
55
57
// InternalTx holds info from internal tx query
56
58
type InternalTx struct {
57
- BlockNumber int `json:"blockNumber,string"`
58
- TimeStamp Time `json:"timeStamp"`
59
- Hash string `json:"hash"`
60
- From string `json:"from"`
61
- To string `json:"to"`
62
- Value * BigInt `json:"value"`
63
- ContractAddress string `json:"contractAddress"`
64
- Input string `json:"input"`
65
- Type string `json:"type"`
66
- Gas int `json:"gas,string"`
67
- GasUsed int `json:"gasUsed,string"`
68
- TraceID string `json:"traceId"`
69
- IsError int `json:"isError,string"`
70
- ErrCode string `json:"errCode"`
59
+ BlockNumber int `json:"blockNumber,string"`
60
+ TimeStamp time. Time `json:"timeStamp"`
61
+ Hash string `json:"hash"`
62
+ From string `json:"from"`
63
+ To string `json:"to"`
64
+ Value * big. Int `json:"value"`
65
+ ContractAddress string `json:"contractAddress"`
66
+ Input string `json:"input"`
67
+ Type string `json:"type"`
68
+ Gas int `json:"gas,string"`
69
+ GasUsed int `json:"gasUsed,string"`
70
+ TraceID string `json:"traceId"`
71
+ IsError int `json:"isError,string"`
72
+ ErrCode string `json:"errCode"`
71
73
}
72
74
73
75
// ERC20Transfer holds info from ERC20 token transfer event query
74
76
type ERC20Transfer struct {
75
- BlockNumber int `json:"blockNumber,string"`
76
- TimeStamp Time `json:"timeStamp"`
77
- Hash string `json:"hash"`
78
- Nonce int `json:"nonce,string"`
79
- BlockHash string `json:"blockHash"`
80
- From string `json:"from"`
81
- ContractAddress string `json:"contractAddress"`
82
- To string `json:"to"`
83
- Value * BigInt `json:"value"`
84
- TokenName string `json:"tokenName"`
85
- TokenSymbol string `json:"tokenSymbol"`
86
- TokenDecimal uint8 `json:"tokenDecimal,string"`
87
- TransactionIndex int `json:"transactionIndex,string"`
88
- Gas int `json:"gas,string"`
89
- GasPrice * BigInt `json:"gasPrice"`
90
- GasUsed int `json:"gasUsed,string"`
91
- CumulativeGasUsed int `json:"cumulativeGasUsed,string"`
92
- Input string `json:"input"`
93
- Confirmations int `json:"confirmations,string"`
77
+ BlockNumber int `json:"blockNumber,string"`
78
+ TimeStamp time. Time `json:"timeStamp"`
79
+ Hash string `json:"hash"`
80
+ Nonce int `json:"nonce,string"`
81
+ BlockHash string `json:"blockHash"`
82
+ From string `json:"from"`
83
+ ContractAddress string `json:"contractAddress"`
84
+ To string `json:"to"`
85
+ Value * big. Int `json:"value"`
86
+ TokenName string `json:"tokenName"`
87
+ TokenSymbol string `json:"tokenSymbol"`
88
+ TokenDecimal uint8 `json:"tokenDecimal,string"`
89
+ TransactionIndex int `json:"transactionIndex,string"`
90
+ Gas int `json:"gas,string"`
91
+ GasPrice * big. Int `json:"gasPrice"`
92
+ GasUsed int `json:"gasUsed,string"`
93
+ CumulativeGasUsed int `json:"cumulativeGasUsed,string"`
94
+ Input string `json:"input"`
95
+ Confirmations int `json:"confirmations,string"`
94
96
}
95
97
96
98
// ERC721Transfer holds info from ERC721 token transfer event query
97
99
type ERC721Transfer struct {
98
- BlockNumber int `json:"blockNumber,string"`
99
- TimeStamp Time `json:"timeStamp"`
100
- Hash string `json:"hash"`
101
- Nonce int `json:"nonce,string"`
102
- BlockHash string `json:"blockHash"`
103
- From string `json:"from"`
104
- ContractAddress string `json:"contractAddress"`
105
- To string `json:"to"`
106
- TokenID * BigInt `json:"tokenID"`
107
- TokenName string `json:"tokenName"`
108
- TokenSymbol string `json:"tokenSymbol"`
109
- TokenDecimal uint8 `json:"tokenDecimal,string"`
110
- TransactionIndex int `json:"transactionIndex,string"`
111
- Gas int `json:"gas,string"`
112
- GasPrice * BigInt `json:"gasPrice"`
113
- GasUsed int `json:"gasUsed,string"`
114
- CumulativeGasUsed int `json:"cumulativeGasUsed,string"`
115
- Input string `json:"input"`
116
- Confirmations int `json:"confirmations,string"`
100
+ BlockNumber int `json:"blockNumber,string"`
101
+ TimeStamp time. Time `json:"timeStamp"`
102
+ Hash string `json:"hash"`
103
+ Nonce int `json:"nonce,string"`
104
+ BlockHash string `json:"blockHash"`
105
+ From string `json:"from"`
106
+ ContractAddress string `json:"contractAddress"`
107
+ To string `json:"to"`
108
+ TokenID * big. Int `json:"tokenID"`
109
+ TokenName string `json:"tokenName"`
110
+ TokenSymbol string `json:"tokenSymbol"`
111
+ TokenDecimal uint8 `json:"tokenDecimal,string"`
112
+ TransactionIndex int `json:"transactionIndex,string"`
113
+ Gas int `json:"gas,string"`
114
+ GasPrice * big. Int `json:"gasPrice"`
115
+ GasUsed int `json:"gasUsed,string"`
116
+ CumulativeGasUsed int `json:"cumulativeGasUsed,string"`
117
+ Input string `json:"input"`
118
+ Confirmations int `json:"confirmations,string"`
117
119
}
118
120
119
121
// ERC1155Transfer holds info from ERC1155 token transfer event query
120
122
type ERC1155Transfer struct {
121
- BlockNumber int `json:"blockNumber,string"`
122
- TimeStamp Time `json:"timeStamp"`
123
- Hash string `json:"hash"`
124
- Nonce int `json:"nonce,string"`
125
- BlockHash string `json:"blockHash"`
126
- From string `json:"from"`
127
- ContractAddress string `json:"contractAddress"`
128
- To string `json:"to"`
129
- TokenID * BigInt `json:"tokenID"`
130
- TokenName string `json:"tokenName"`
131
- TokenSymbol string `json:"tokenSymbol"`
132
- TokenDecimal int `json:"tokenDecimal,string"`
133
- TokenValue int `json:"tokenValue,string"`
134
- TransactionIndex int `json:"transactionIndex,string"`
135
- Gas int `json:"gas,string"`
136
- GasPrice * BigInt `json:"gasPrice"`
137
- GasUsed int `json:"gasUsed,string"`
138
- CumulativeGasUsed int `json:"cumulativeGasUsed,string"`
139
- Input string `json:"input"`
140
- Confirmations int `json:"confirmations,string"`
123
+ BlockNumber int `json:"blockNumber,string"`
124
+ TimeStamp time. Time `json:"timeStamp"`
125
+ Hash string `json:"hash"`
126
+ Nonce int `json:"nonce,string"`
127
+ BlockHash string `json:"blockHash"`
128
+ From string `json:"from"`
129
+ ContractAddress string `json:"contractAddress"`
130
+ To string `json:"to"`
131
+ TokenID * big. Int `json:"tokenID"`
132
+ TokenName string `json:"tokenName"`
133
+ TokenSymbol string `json:"tokenSymbol"`
134
+ TokenDecimal int `json:"tokenDecimal,string"`
135
+ TokenValue int `json:"tokenValue,string"`
136
+ TransactionIndex int `json:"transactionIndex,string"`
137
+ Gas int `json:"gas,string"`
138
+ GasPrice * big. Int `json:"gasPrice"`
139
+ GasUsed int `json:"gasUsed,string"`
140
+ CumulativeGasUsed int `json:"cumulativeGasUsed,string"`
141
+ Input string `json:"input"`
142
+ Confirmations int `json:"confirmations,string"`
141
143
}
142
144
143
145
// MinedBlock holds info from query for mined block by address
144
146
type MinedBlock struct {
145
- BlockNumber int `json:"blockNumber,string"`
146
- TimeStamp Time `json:"timeStamp"`
147
- BlockReward * BigInt `json:"blockReward"`
147
+ BlockNumber int `json:"blockNumber,string"`
148
+ TimeStamp Time `json:"timeStamp"`
149
+ BlockReward * big. Int `json:"blockReward"`
148
150
}
149
151
150
152
// ContractSource holds info from query for contract source code
@@ -173,16 +175,16 @@ type ExecutionStatus struct {
173
175
174
176
// BlockRewards holds info from query for block and uncle rewards
175
177
type BlockRewards struct {
176
- BlockNumber int `json:"blockNumber,string"`
177
- TimeStamp Time `json:"timeStamp"`
178
- BlockMiner string `json:"blockMiner"`
179
- BlockReward * BigInt `json:"blockReward"`
178
+ BlockNumber int `json:"blockNumber,string"`
179
+ TimeStamp Time `json:"timeStamp"`
180
+ BlockMiner string `json:"blockMiner"`
181
+ BlockReward * big. Int `json:"blockReward"`
180
182
Uncles []struct {
181
- Miner string `json:"miner"`
182
- UnclePosition int `json:"unclePosition,string"`
183
- BlockReward * BigInt `json:"blockreward"`
183
+ Miner string `json:"miner"`
184
+ UnclePosition int `json:"unclePosition,string"`
185
+ BlockReward * big. Int `json:"blockreward"`
184
186
} `json:"uncles"`
185
- UncleInclusionReward * BigInt `json:"uncleInclusionReward"`
187
+ UncleInclusionReward * big. Int `json:"uncleInclusionReward"`
186
188
}
187
189
188
190
// LatestPrice holds info from query for latest ether price
0 commit comments