-
Notifications
You must be signed in to change notification settings - Fork 39
/
avax.go
174 lines (139 loc) · 5.1 KB
/
avax.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
172
173
174
// (c) 2021, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package models
import (
"time"
)
type PvmProposerModel struct {
ID StringID `json:"id"`
ParentID StringID `json:"parentID"`
PChainHeight uint64 `json:"pchainHeight"`
Proposer StringID `json:"proposer"`
TimeStamp time.Time `json:"timestamp"`
}
type Transaction struct {
ID StringID `json:"id"`
ChainID StringID `json:"chainID"`
Type string `json:"type"`
Inputs []*Input `json:"inputs"`
Outputs []*Output `json:"outputs"`
Memo []byte `json:"memo"`
InputTotals AssetTokenCounts `json:"inputTotals"`
OutputTotals AssetTokenCounts `json:"outputTotals"`
ReusedAddressTotals AssetTokenCounts `json:"reusedAddressTotals"`
CanonicalSerialization []byte `json:"canonicalSerialization,omitempty"`
CreatedAt time.Time `json:"timestamp"`
Txfee uint64 `json:"txFee"`
Genesis bool `json:"genesis"`
Rewarded bool `json:"rewarded"`
RewardedTime *time.Time `json:"rewardedTime"`
Epoch uint64 `json:"epoch"`
VertexID StringID `json:"vertexId"`
ValidatorNodeID StringID `json:"validatorNodeID"`
ValidatorStart uint64 `json:"validatorStart"`
ValidatorEnd uint64 `json:"validatorEnd"`
TxBlockID StringID `json:"txBlockId"`
Proposer *PvmProposerModel `json:"proposer,omitempty"`
Score uint64 `json:"-"`
}
type Input struct {
Output *Output `json:"output"`
Creds []InputCredentials `json:"credentials"`
}
type Output struct {
ID StringID `json:"id"`
TransactionID StringID `json:"transactionID"`
OutputIndex uint64 `json:"outputIndex"`
AssetID StringID `json:"assetID"`
Stake bool `json:"stake"`
Frozen bool `json:"frozen"`
Stakeableout bool `json:"stakeableout"`
Genesisutxo bool `json:"genesisutxo"`
OutputType OutputType `json:"outputType"`
Amount TokenAmount `json:"amount"`
Locktime uint64 `json:"locktime"`
StakeLocktime uint64 `json:"stakeLocktime"`
Threshold uint64 `json:"threshold"`
Addresses []Address `json:"addresses"`
CAddresses []string `json:"caddresses"`
CreatedAt time.Time `json:"timestamp"`
RedeemingTransactionID StringID `json:"redeemingTransactionID"`
ChainID StringID `json:"chainID"`
InChainID StringID `json:"inChainID"`
OutChainID StringID `json:"outChainID"`
GroupID uint64 `json:"groupID"`
Payload []byte `json:"payload"`
Block string `json:"block"`
Nonce uint64 `json:"nonce"`
RewardUtxo bool `json:"rewardUtxo"`
Score uint64 `json:"-"`
}
type InputCredentials struct {
Address Address `json:"address"`
PublicKey []byte `json:"public_key"`
Signature []byte `json:"signature"`
}
type OutputAddress struct {
OutputID StringID `json:"output_id"`
Address Address `json:"address"`
Signature []byte `json:"signature"`
PublicKey []byte `json:"-"`
}
type Asset struct {
ID StringID `json:"id"`
ChainID StringID `json:"chainID"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Alias string `json:"alias"`
CurrentSupply TokenAmount `json:"currentSupply"`
CreatedAt time.Time `json:"timestamp"`
Score uint64 `json:"-"`
Denomination uint8 `json:"denomination"`
VariableCap uint8 `json:"variableCap"`
Nft uint8 `json:"nft"`
}
type AssetInfo struct {
AssetID StringID `json:"id"`
TransactionCount uint64 `json:"transactionCount"`
UTXOCount uint64 `json:"utxoCount"`
Balance TokenAmount `json:"balance"`
TotalReceived TokenAmount `json:"totalReceived"`
TotalSent TokenAmount `json:"totalSent"`
}
type AddressInfo struct {
ChainID StringID `json:"chainID"`
Address Address `json:"address"`
PublicKey []byte `json:"publicKey"`
Assets map[StringID]AssetInfo `json:"assets"`
Score uint64 `json:"-"`
}
type AddressChainInfo struct {
Address Address `json:"address"`
ChainID StringID `json:"chainID"`
CreatedAt time.Time `json:"timestamp"`
}
type OutputList struct {
ListMetadata
Outputs []*Output `json:"outputs"`
}
type CvmOutput struct {
Type CChainType `json:"type"`
TransactionType CChainType `json:"transactionType"`
Idx uint64 `json:"idx"`
Amount TokenAmount `json:"amount"`
Nonce uint64 `json:"nonce"`
ID StringID `json:"id"`
TransactionID StringID `json:"transactionID"`
Address string `json:"address"`
AssetID StringID `json:"assetID"`
CreatedAt time.Time `json:"timestamp"`
ChainID StringID `json:"chainID"`
Block string `json:"block"`
}
type RawTx struct {
Tx string `json:"tx"`
}
type ChainCounts struct {
ChainID StringID `json:"chainID"`
Total string `json:"total"`
}