-
Notifications
You must be signed in to change notification settings - Fork 6
/
type.go
134 lines (122 loc) · 4.46 KB
/
type.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package zillean
import "math/big"
// Balance describes the balance for an account.
type Balance struct {
Balance string `json:"balance"`
Nonce int64 `json:"nonce"`
}
// DsBlock describes a DS-Block.
type DsBlock struct {
Header struct {
BlockNum string `json:"blockNum"`
Difficulty int64 `json:"difficulty"`
DifficultyDS int64 `json:"difficultyDS"`
GasPrice string `json:"gasPrice"`
LeaderPubKey string `json:"leaderPubKey"`
PoWWinners []string `json:"powWinners"`
Prevhash string `json:"prevhash"`
Timestamp string `json:"timestamp"`
} `json:"header"`
Signature string `json:"signature"`
}
// TxBlock describes a TX-Block.
type TxBlock struct {
Body struct {
HeaderSign string `json:"HeaderSign"`
MicroBlockInfos []struct {
MicroBlockHash string `json:"MicroBlockHash"`
MicroBlockShardID int64 `json:"MicroBlockShardId"`
MicroBlockTxnRootHash string `json:"MicroBlockTxnRootHash"`
} `json:"MicroBlockInfos"`
} `json:"body"`
Header struct {
BlockNum string `json:"BlockNum"`
DsBlockNum string `json:"DSBlockNum"`
GasLimit string `json:"GasLimit"`
GasUsed string `json:"GasUsed"`
MbInfoHash string `json:"MbInfoHash"`
MinerPubKey string `json:"MinerPubKey"`
NumMicroBlocks int64 `json:"NumMicroBlocks"`
NumTxns int64 `json:"NumTxns"`
PrevBlockHash string `json:"PrevBlockHash"`
Rewards string `json:"Rewards"`
StateDeltaHash string `json:"StateDeltaHash"`
StateRootHash string `json:"StateRootHash"`
Timestamp string `json:"Timestamp"`
TxnHash string `json:"TxnHash"`
Version int64 `json:"version"`
} `json:"header"`
}
// Transaction describes a transaction object.
type Transaction struct {
ID string `json:"ID"`
Amount string `json:"amount"`
GasLimit string `json:"gasLimit"`
GasPrice string `json:"gasPrice"`
Nonce string `json:"nonce"`
Receipt struct {
CumulativeGas string `json:"cumulative_gas"`
EpochNum string `json:"epoch_num"`
Success bool `json:"success"`
} `json:"receipt"`
SenderPubKey string `json:"senderPubKey"`
Signature string `json:"signature"`
ToAddr string `json:"toAddr"`
Version string `json:"version"`
}
// RawTransaction describes a raw transaction object, which can be used in creating a new transaction.
type RawTransaction struct {
Version uint32 `json:"version"`
Nonce uint64 `json:"nonce"`
To string `json:"toAddr"`
Amount string `json:"amount"`
PubKey string `json:"pubKey"`
GasPrice *big.Int `json:"gasPrice"`
GasLimit uint64 `json:"gasLimit"`
Code string `json:"code"`
Data string `json:"data"`
Signature string `json:"signature"`
}
// BlockchainInfo describes the information about Zilliqa blockchain.
type BlockchainInfo struct {
CurrentDSEpoch string `json:"CurrentDSEpoch"`
CurrentMiniEpoch string `json:"CurrentMiniEpoch"`
DSBlockRate float64 `json:"DSBlockRate"`
NumDSBlocks string `json:"NumDSBlocks"`
NumPeers int64 `json:"NumPeers"`
NumTransactions string `json:"NumTransactions"`
NumTxBlocks string `json:"NumTxBlocks"`
NumTxnsDSEpoch string `json:"NumTxnsDSEpoch"`
NumTxnsTxEpoch int64 `json:"NumTxnsTxEpoch"`
ShardingStructure ShardingStructure `json:"ShardingStructure"`
TransactionRate int64 `json:"TransactionRate"`
TxBlockRate float64 `json:"TxBlockRate"`
}
// ShardingStructure contains the number of peers in each shard.
type ShardingStructure struct {
NumPeers []int64 `json:"NumPeers"`
}
// RecentTransactions contains the most recent transactions (up to 100).
type RecentTransactions struct {
TxnHashes []string `json:"TxnHashes"`
Number int64 `json:"number"`
}
// ListedBlocks contains the paginated list of Blocks. This can be used for both DS-Blocks and TX-Blocks.
type ListedBlocks struct {
Data []struct {
BlockNum int64 `json:"BlockNum"`
Hash string `json:"Hash"`
} `json:"data"`
MaxPages int64 `json:"maxPages"`
}
// SmartContract describes the smart contracts created by an address.
type SmartContract struct {
Address string `json:"address"`
State []SmartContractState `json:"state"`
}
// SmartContractState describes the state of a smart contract.
type SmartContractState struct {
Type string `json:"type"`
Value string `json:"value"`
Vname string `json:"vname"`
}