-
Notifications
You must be signed in to change notification settings - Fork 41
/
models.go
171 lines (155 loc) · 4.62 KB
/
models.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
package model
type Status struct {
Info Info `json:"info"`
}
type Info struct {
Version int `json:"version"`
ProtocolVersion int `json:"protocolversion"`
Blocks int `json:"blocks"`
TimeOffset int `json:"timeoffset"`
Connections int `json:"connections"`
DifficultyIface interface{} `json:"difficulty"`
Difficulty float64 `json:"-"`
Testnet bool `json:"testnet"`
RelayFeeIface interface{} `json:"relayfee"`
RelayFee float64 `json:"-"`
Errors string `json:"errors"`
Network string `json:"network"`
}
func (i Info) IsEqual(other Info) bool {
if i.Version != other.Version {
return false
}
if i.ProtocolVersion != other.ProtocolVersion {
return false
}
if i.Blocks != other.Blocks {
return false
}
if i.TimeOffset != other.TimeOffset {
return false
}
if i.Connections != other.Connections {
return false
}
if i.Difficulty != other.Difficulty {
return false
}
if i.Testnet != other.Testnet {
return false
}
if i.RelayFee != other.RelayFee {
return false
}
if i.Errors != other.Errors {
return false
}
if i.Network != other.Network {
return false
}
return true
}
type BlockList struct {
Blocks []Block `json:"blocks"`
Length int `json:"length"`
Pagination Pagination `json:"pagination"`
}
type Pagination struct {
Next string `json:"next"`
Prev string `json:"prev"`
CurrentTs int `json:"currentTs"`
Current string `json:"current"`
IsToday bool `json:"isToday"`
More bool `json:"more"`
MoreTs int `json:"moreTs"`
}
type Block struct {
Hash string `json:"hash"`
Size int `json:"size"`
Height int `json:"height"`
Version int `json:"version"`
MerkleRoot string `json:"merkleroot"`
Tx []string `json:"tx"`
Time int64 `json:"time"`
Nonce string `json:"nonce"`
Solution string `json:"solution"`
Bits string `json:"bits"`
Difficulty float64 `json:"difficulty"`
Chainwork string `json:"chainwork"`
Confirmations int `json:"confirmations"`
PreviousBlockhash string `json:"previousblockhash"`
NextBlockhash string `json:"nextblockhash"`
Reward float64 `json:"reward"`
IsMainChain bool `json:"isMainChain"`
PoolInfo *PoolInfo `json:"poolinfo"`
}
type PoolInfo struct {
PoolName string `json:"poolName"`
URL string `json:"url"`
}
type Utxo struct {
Address string `json:"address"`
Txid string `json:"txid"`
Vout int `json:"vout"`
ScriptPubKey string `json:"scriptPubKey"`
AmountIface interface{} `json:"amount"`
Amount float64
Satoshis int64 `json:"satoshis"`
Confirmations int `json:"confirmations"`
}
type TransactionList struct {
TotalItems int `json:"totalItems"`
From int `json:"from"`
To int `json:"to"`
Items []Transaction `json:"items"`
}
type Transaction struct {
Txid string `json:"txid"`
Version int `json:"version"`
Locktime int `json:"locktime"`
Inputs []Input `json:"vin"`
Outputs []Output `json:"vout"`
BlockHash string `json:"blockhash"`
BlockHeight int `json:"blockheight"`
Confirmations int `json:"confirmations"`
Time int64 `json:"time"`
BlockTime int64 `json:"blocktime"`
RawBytes []byte `json:"rawbytes"`
}
type RawTxResponse struct {
RawTx string `json:"rawtx"`
}
type Input struct {
Txid string `json:"txid"`
Vout int `json:"vout"`
Sequence uint32 `json:"sequence"`
N int `json:"n"`
ScriptSig Script `json:"scriptSig"`
Addr string `json:"addr"`
Satoshis int64 `json:"valueSat"`
ValueIface interface{} `json:"value"`
Value float64
DoubleSpentTxid string `json:"doubleSpentTxID"`
}
type Output struct {
ValueIface interface{} `json:"value"`
Value float64
N int `json:"n"`
ScriptPubKey OutScript `json:"scriptPubKey"`
SpentTxid string `json:"spentTxId"`
SpentIndex int `json:"spentIndex"`
SpentHeight int `json:"spentHeight"`
}
type Script struct {
Hex string `json:"hex"`
Asm string `json:"asm"`
}
type OutScript struct {
Script
Addresses []string `json:"addresses"`
Type string `json:"type"`
}
type AddressTxid struct {
Address string `json:"address"`
Txid string `json:"txid"`
}