forked from OdyseeTeam/chainquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reponse.go
156 lines (143 loc) · 5.79 KB
/
reponse.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
package lbrycrd
// ClaimNameResult models the data from the claimtrie of lbrycrd.
type ClaimNameResult struct {
Name string `json:"name"`
Claims []ClaimResult `json:"claims,omitempty"`
}
// ClaimResult models the static data of a claim in the claimtrie
type ClaimResult struct {
ClaimID string `json:"claimId"`
TxID string `json:"txid"`
Sequence uint64 `json:"n"`
Amount float64 `json:"amount"`
Height uint64 `json:"height"`
Value string `json:"value"`
}
// GetBlockHeaderResponse models the data from the getblockheader command when
// the verbose flag is set. When the verbose flag is not set, getblockheader
// returns a hex-encoded string.
type GetBlockHeaderResponse struct {
Hash string `json:"hash"`
Confirmations uint64 `json:"confirmations"`
Height int32 `json:"height"`
Version int32 `json:"version"`
VersionHex string `json:"versionHex"`
MerkleRoot string `json:"merkleroot"`
Time int64 `json:"time"`
Nonce uint64 `json:"nonce"`
Bits string `json:"bits"`
Difficulty float64 `json:"difficulty"`
PreviousHash string `json:"previousblockhash,omitempty"`
NextHash string `json:"nextblockhash,omitempty"`
}
// GetBlockResponse models the data from the getblock command when the
// verbose flag is set. When the verbose flag is not set, getblock returns a
// hex-encoded string.
type GetBlockResponse struct {
Hash string `json:"hash"`
Confirmations uint64 `json:"confirmations"`
StrippedSize int32 `json:"strippedsize"`
Size int32 `json:"size"`
Weight int32 `json:"weight"`
Height int64 `json:"height"`
Version int32 `json:"version"`
VersionHex string `json:"versionHex"`
MerkleRoot string `json:"merkleroot"`
NameClaimRoot string `json:"nameclaimroot"`
Tx []string `json:"tx"`
Time int64 `json:"time"`
Nonce uint64 `json:"nonce"`
Bits string `json:"bits"`
Difficulty float64 `json:"difficulty"`
PreviousHash string `json:"previousblockhash"`
NextHash string `json:"nextblockhash,omitempty"`
ChainWork string `json:"chainwork"`
}
// TxRawResult models the data from the getrawtransaction command.
type TxRawResult struct {
Hex string `json:"hex"`
Txid string `json:"txid"`
Hash string `json:"hash,omitempty"`
Size int32 `json:"size,omitempty"`
Vsize int32 `json:"vsize,omitempty"`
Version int32 `json:"version"`
LockTime uint64 `json:"locktime"`
Vin []Vin `json:"vin"`
Vout []Vout `json:"vout"`
BlockHash string `json:"blockhash,omitempty"`
Confirmations uint64 `json:"confirmations,omitempty"`
Time int64 `json:"time,omitempty"`
Blocktime int64 `json:"blocktime,omitempty"`
}
// Vout models parts of the tx data. It is defined separately since both
// getrawtransaction and decoderawtransaction use the same structure.
type Vout struct {
Value float64 `json:"value"`
N uint64 `json:"n"`
ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
}
// Vin models parts of the tx data. It is defined separately since
// getrawtransaction, decoderawtransaction, and searchrawtransaction use the
// same structure.
type Vin struct {
Coinbase string `json:"coinbase"`
TxID string `json:"txid"`
Vout uint64 `json:"vout"`
ScriptSig *ScriptSig `json:"scriptSig"`
Sequence uint64 `json:"sequence"`
}
// ScriptPubKeyResult models the scriptPubKey data of a tx script. It is
// defined separately since it is used by multiple commands.
type ScriptPubKeyResult struct {
Asm string `json:"asm"`
Hex string `json:"hex,omitempty"`
ReqSigs int32 `json:"reqSigs,omitempty"`
Type string `json:"type"`
Addresses []string `json:"addresses,omitempty"`
}
// ScriptSig models a signature script. It is defined separately since it only
// applies to non-coinbase. Therefore the field in the Vin structure needs
// to be a pointer.
type ScriptSig struct {
Asm string `json:"asm"`
Hex string `json:"hex"`
}
// ClaimsForNameResult models the claim list for a name in the claimtrie of lbrycrd.
type ClaimsForNameResult struct {
LastTakeOverHeight int32 `json:"nLastTakeoverheight"`
Claims []Claim `json:"claims"`
UnmatchedSupports []Support `json:"unmatched supports"`
}
// Claim models the data of a claim both static and dynamic. Used for claimtrie sync.
type Claim struct {
Name string `json:"name,omitempty"`
ClaimID string `json:"claimId"`
TxID string `json:"txid"`
N int32 `json:"n"`
Height int32 `json:"nHeight"`
ValidAtHeight int32 `json:"nValidAtHeight"`
Amount float64 `json:"nAmount"`
EffectiveAmount uint64 `json:"nEffectiveAmount"`
Supports []Support `json:"supports,omitempty"`
}
// Support models the support information for a claim in the claimtrie of lbrycrd.
type Support struct {
TxID string `json:"txid"`
N int32 `json:"n"`
Height int32 `json:"nHeight"`
ValidAtHeight int32 `json:"nValidAtHeight"`
Amount float64 `json:"nAmount"`
}
// GetRawMempoolVerboseResult models the data returned from the getrawmempool
// command when the verbose flag is set. When the verbose flag is not set,
// getrawmempool returns an array of transaction hashes.
type GetRawMempoolVerboseResult struct {
Size int32 `json:"size"`
Vsize int32 `json:"vsize"`
Fee float64 `json:"fee"`
Time int64 `json:"time"`
Height int64 `json:"height"`
StartingPriority float64 `json:"startingpriority"`
CurrentPriority float64 `json:"currentpriority"`
Depends []string `json:"depends"`
}