|
7 | 7 |
|
8 | 8 | package etherscan
|
9 | 9 |
|
10 |
| -import "encoding/json" |
| 10 | +import ( |
| 11 | + "encoding/json" |
| 12 | +) |
11 | 13 |
|
12 | 14 | // Envelope is the carrier of nearly every response
|
13 | 15 | type Envelope struct {
|
14 |
| - // 1 for good, 0 for error |
15 |
| - Status int `json:"status,string"` |
16 |
| - // OK for good, other words when Status equals 0 |
17 |
| - Message string `json:"message"` |
18 |
| - // where response lies |
19 | 16 | Result json.RawMessage `json:"result"`
|
| 17 | + Error struct { |
| 18 | + Code int `json:"code"` |
| 19 | + Message string `json:"message"` |
| 20 | + } |
| 21 | +} |
| 22 | + |
| 23 | +type Transaction struct { |
| 24 | + BlockHash string `json:"blockHash"` |
| 25 | + BlockNumber string `json:"blockNumber"` |
| 26 | + From string `json:"from"` |
| 27 | + Gas string `json:"gas"` |
| 28 | + GasPrice string `json:"gasPrice"` |
| 29 | + Hash string `json:"hash"` |
| 30 | + Input string `json:"input"` |
| 31 | + Nonce string `json:"nonce"` |
| 32 | + To string `json:"to"` |
| 33 | + TransactionIndex string `json:"transactionIndex"` |
| 34 | + Value string `json:"value"` |
| 35 | + V string `json:"v"` |
| 36 | + R string `json:"r"` |
| 37 | + S string `json:"s"` |
| 38 | +} |
| 39 | + |
| 40 | +type Block struct { |
| 41 | + Difficulty string `json:"difficulty"` |
| 42 | + ExtraData string `json:"extraData"` |
| 43 | + GasLimit string `json:"gasLimit"` |
| 44 | + GasUsed string `json:"gasUsed"` |
| 45 | + Hash string `json:"hash"` |
| 46 | + LogsBloom string `json:"logsBloom"` |
| 47 | + Miner string `json:"miner"` |
| 48 | + MixHash string `json:"mixHash"` |
| 49 | + Nonce string `json:"nonce"` |
| 50 | + Number string `json:"number"` |
| 51 | + ParentHash string `json:"parentHash"` |
| 52 | + ReceiptsRoot string `json:"receiptsRoot"` |
| 53 | + Sha3Uncles string `json:"sha3Uncles"` |
| 54 | + Size string `json:"size"` |
| 55 | + StateRoot string `json:"stateRoot"` |
| 56 | + Timestamp string `json:"timestamp"` |
| 57 | + TotalDifficulty string `json:"totalDifficulty"` |
| 58 | + Transactions []Transaction `json:"transactions"` |
| 59 | + TransactionsRoot string `json:"transactionsRoot"` |
| 60 | + Uncles []interface{} `json:"uncles"` |
20 | 61 | }
|
21 | 62 |
|
22 | 63 | // AccountBalance account and its balance in pair
|
|
0 commit comments