forked from naftalimurgor/go-bgld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transaction.go
96 lines (87 loc) · 3.35 KB
/
transaction.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
package bgld
// A ScriptSig represents a scriptsyg
type ScriptSig struct {
Asm string `json:"asm"`
Hex string `json:"hex"`
}
// Vin represent an IN value
type Vin struct {
Coinbase string `json:"coinbase"`
Txid string `json:"txid"`
Vout int `json:"vout"`
ScriptSig ScriptSig `json:"scriptSig"`
Sequence uint32 `json:"sequence"`
}
type ScriptPubKey struct {
Asm string `json:"asm"`
Hex string `json:"hex"`
ReqSigs int `json:"reqSigs,omitempty"`
Type string `json:"type"`
Address string `json:"address,omitempty"`
Addresses []string `json:"addresses,omitempty"`
}
// Vout represent an OUT value
type Vout struct {
Value float64 `json:"value"`
N int `json:"n"`
ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
}
// RawTx represents a raw transaction
type RawTransaction struct {
Hex string `json:"hex"`
Txid string `json:"txid"`
Version uint32 `json:"version"`
LockTime uint32 `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"`
}
// TransactionDetails represents details about a transaction
type TransactionDetails struct {
Account string `json:"account"`
Address string `json:"address,omitempty"`
Category string `json:"category"`
Amount float64 `json:"amount"`
Fee float64 `json:"fee,omitempty"`
Label string `json:"label,omitempty"`
}
// Transaction represents a transaction
type Transaction struct {
Amount float64 `json:"amount"`
Account string `json:"account,omitempty"`
Address string `json:"address,omitempty"`
Category string `json:"category,omitempty"`
Fee float64 `json:"fee,omitempty"`
Confirmations int64 `json:"confirmations"`
BlockHash string `json:"blockhash"`
BlockIndex int64 `json:"blockindex"`
BlockTime int64 `json:"blocktime"`
TxID string `json:"txid"`
WalletConflicts []string `json:"walletconflicts"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
Details []TransactionDetails `json:"details,omitempty"`
Hex string `json:"hex,omitempty"`
}
// UTransactionOut represents a unspent transaction out (UTXO)
type UTransactionOut struct {
Bestblock string `json:"bestblock"`
Confirmations uint32 `json:"confirmations"`
Value float64 `json:"value"`
ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
Version uint32 `json:"version"`
Coinbase bool `json:"coinbase"`
}
// TransactionOutSet represents statistics about the unspent transaction output database
type TransactionOutSet struct {
Height uint32 `json:"height"`
Bestblock string `json:"bestblock"`
Transactions float64 `json:"transactions"`
TxOuts float64 `json:"txouts"`
BytesSerialized float64 `json:"bytes_serialized"`
HashSerialized string `json:"hash_serialized"`
TotalAmount float64 `json:"total_amount"`
}