|
1 | 1 | package api
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - "math/big" |
5 | 4 | "strings"
|
6 | 5 | "time"
|
7 | 6 |
|
@@ -41,111 +40,135 @@ type queryTxParam struct {
|
41 | 40 | TxSeq *uint64 `form:"txSeq" binding:"required,number,gte=0"`
|
42 | 41 | }
|
43 | 42 |
|
| 43 | +// StorageTx model info |
| 44 | +// @Description Submission information |
44 | 45 | type StorageTx struct {
|
45 |
| - TxSeq uint64 `json:"txSeq"` |
46 |
| - BlockNum uint64 `json:"blockNum"` |
47 |
| - TxHash string `json:"txHash"` |
48 |
| - RootHash string `json:"rootHash"` |
49 |
| - Address string `json:"address"` |
50 |
| - Method string `json:"method"` |
51 |
| - Status uint64 `json:"status"` |
52 |
| - Timestamp int64 `json:"timestamp"` |
53 |
| - DataSize uint64 `json:"dataSize"` |
54 |
| - BaseFee decimal.Decimal `json:"baseFee"` |
55 |
| -} |
56 |
| - |
| 46 | + TxSeq uint64 `json:"txSeq"` // Submission index in submit event |
| 47 | + BlockNum uint64 `json:"blockNum"` // The block where the submit event is emitted |
| 48 | + TxHash string `json:"txHash"` // The transaction where the submit event is emitted |
| 49 | + RootHash string `json:"rootHash"` // Merkle root of the file to upload |
| 50 | + Address string `json:"address"` // File uploader address |
| 51 | + Method string `json:"method"` // The name of the submit event is always `submit` |
| 52 | + Status uint8 `json:"status"` // File upload status, 0-not uploaded,1-uploading,2-uploaded |
| 53 | + TotalSegNum uint64 `json:"totalSegNum"` // The total number of segments the file is split into |
| 54 | + UploadedSegNum uint64 `json:"uploadedSegNum"` // The number of segments the file has been uploaded |
| 55 | + Timestamp int64 `json:"timestamp"` // The block time when submit event emits |
| 56 | + DataSize uint64 `json:"dataSize"` // File size in bytes |
| 57 | + BaseFee decimal.Decimal `json:"baseFee"` // The token fee required to upload the file |
| 58 | +} |
| 59 | + |
| 60 | +// TokenInfo model info |
| 61 | +// @Description Charge token information |
57 | 62 | type TokenInfo struct {
|
58 |
| - Address string `json:"address"` |
59 |
| - Name string `json:"name"` |
60 |
| - Symbol string `json:"symbol"` |
61 |
| - Decimals uint8 `json:"decimals"` |
| 63 | + Address string `json:"address"` // The address of the token contract |
| 64 | + Name string `json:"name"` // Token name |
| 65 | + Symbol string `json:"symbol"` // Token symbol |
| 66 | + Decimals uint8 `json:"decimals"` // Token decimals |
62 | 67 | }
|
63 | 68 |
|
| 69 | +// CostInfo model info |
| 70 | +// @Description Charge fee information |
64 | 71 | type CostInfo struct {
|
65 |
| - TokenInfo `json:"tokenInfo"` |
66 |
| - BasicCost decimal.Decimal `json:"basicCost"` |
67 |
| -} |
68 |
| - |
69 |
| -type SubmissionNode struct { |
70 |
| - Root string `json:"root"` |
71 |
| - Height *big.Int `json:"height"` |
| 72 | + TokenInfo `json:"tokenInfo"` // Charge token info |
| 73 | + BasicCost decimal.Decimal `json:"basicCost"` // Charge fee |
72 | 74 | }
|
73 | 75 |
|
| 76 | +// TxList model info |
| 77 | +// @Description Submission information list |
74 | 78 | type TxList struct {
|
75 |
| - Total int64 `json:"total"` |
76 |
| - List []StorageTx `json:"list"` |
| 79 | + Total int64 `json:"total"` // The total number of submission returned |
| 80 | + List []StorageTx `json:"list"` // Submission list |
77 | 81 | }
|
78 | 82 |
|
| 83 | +// TxBrief model info |
| 84 | +// @Description Submission brief information |
79 | 85 | type TxBrief struct {
|
80 |
| - TxSeq string `json:"txSeq"` |
81 |
| - From string `json:"from"` |
82 |
| - Method string `json:"method"` |
83 |
| - |
84 |
| - RootHash string `json:"rootHash"` |
85 |
| - DataSize uint64 `json:"dataSize"` |
86 |
| - Expiration uint64 `json:"expiration"` |
87 |
| - CostInfo *CostInfo `json:"costInfo"` |
88 |
| - |
89 |
| - BlockNumber uint64 `json:"blockNumber"` |
90 |
| - TxHash string `json:"txHash"` |
91 |
| - Timestamp uint64 `json:"timestamp"` |
92 |
| - Status uint64 `json:"status"` |
93 |
| - GasFee uint64 `json:"gasFee"` |
94 |
| - GasUsed uint64 `json:"gasUsed"` |
95 |
| - GasLimit uint64 `json:"gasLimit"` |
96 |
| -} |
97 |
| - |
| 86 | + TxSeq string `json:"txSeq"` // Submission index in submit event |
| 87 | + From string `json:"from"` // File uploader address |
| 88 | + Method string `json:"method"` // The name of the submit event is always `submit` |
| 89 | + |
| 90 | + RootHash string `json:"rootHash"` // Merkle root of the file to upload |
| 91 | + DataSize uint64 `json:"dataSize"` // File size in bytes |
| 92 | + Expiration uint64 `json:"expiration"` // Expiration date of the uploaded file |
| 93 | + CostInfo *CostInfo `json:"costInfo"` // Charge fee information |
| 94 | + |
| 95 | + BlockNumber uint64 `json:"blockNumber"` // The block where the submit event is emitted |
| 96 | + TxHash string `json:"txHash"` // The transaction where the submit event is emitted |
| 97 | + Timestamp uint64 `json:"timestamp"` // The block time when submit event emits |
| 98 | + Status uint8 `json:"status"` // The status of the transaction on layer1 |
| 99 | + GasFee uint64 `json:"gasFee"` // The gas fee of the transaction on layer1 |
| 100 | + GasUsed uint64 `json:"gasUsed"` // The gas used of the transaction on layer1 |
| 101 | + GasLimit uint64 `json:"gasLimit"` // The gas limit of the transaction on layer1 |
| 102 | +} |
| 103 | + |
| 104 | +// TxDetail model info |
| 105 | +// @Description Submission detail information |
98 | 106 | type TxDetail struct {
|
99 |
| - TxSeq string `json:"txSeq"` |
100 |
| - RootHash string `json:"rootHash"` |
| 107 | + TxSeq string `json:"txSeq"` // Submission index in submit event |
| 108 | + RootHash string `json:"rootHash"` // Merkle root of the file to upload |
101 | 109 |
|
102 |
| - StartPos uint64 `json:"startPos"` |
103 |
| - EndPos uint64 `json:"endPos"` |
104 |
| - PieceCounts uint64 `json:"pieceCounts"` |
105 |
| - Pieces []SubmissionNode `json:"pieces"` |
| 110 | + StartPos uint64 `json:"startPos"` // The starting position of the file stored in the storage node |
| 111 | + EndPos uint64 `json:"endPos"` // The ending position of the file stored in the storage node |
| 112 | + PieceCounts uint64 `json:"pieceCounts"` // The total number of segments the file is split into |
106 | 113 | }
|
107 | 114 |
|
| 115 | +// StorageBasicCost model info |
| 116 | +// @Description Storage fee information |
108 | 117 | type StorageBasicCost struct {
|
109 |
| - TokenInfo |
110 |
| - BasicCostTotal decimal.Decimal `json:"basicCostTotal"` |
| 118 | + TokenInfo // Charge token info |
| 119 | + BasicCostTotal decimal.Decimal `json:"basicCostTotal"` // Total storage fee |
111 | 120 | }
|
112 | 121 |
|
| 122 | +// Dashboard model info |
| 123 | +// @Description Storage status information |
113 | 124 | type Dashboard struct {
|
114 |
| - StorageBasicCost `json:"storageBasicCost"` |
115 |
| - stat.LogSyncInfo `json:"logSyncInfo"` |
| 125 | + StorageBasicCost `json:"storageBasicCost"` // Storage fee information |
| 126 | + stat.LogSyncInfo `json:"logSyncInfo"` // Synchronization information of submit event |
116 | 127 | }
|
117 | 128 |
|
| 129 | +// DataStatList model info |
| 130 | +// @Description Storage data list |
118 | 131 | type DataStatList struct {
|
119 |
| - Total int64 `json:"total"` |
120 |
| - List []DataStat `json:"list"` |
| 132 | + Total int64 `json:"total"` // The total number of stat returned |
| 133 | + List []DataStat `json:"list"` // Stat list |
121 | 134 | }
|
122 | 135 |
|
| 136 | +// TxStatList model info |
| 137 | +// @Description Storage transaction list |
123 | 138 | type TxStatList struct {
|
124 |
| - Total int64 `json:"total"` |
125 |
| - List []TxStat `json:"list"` |
| 139 | + Total int64 `json:"total"` // The total number of stat returned |
| 140 | + List []TxStat `json:"list"` // Stat list |
126 | 141 | }
|
127 | 142 |
|
| 143 | +// FeeStatList model info |
| 144 | +// @Description Storage fee list |
128 | 145 | type FeeStatList struct {
|
129 |
| - Total int64 `json:"total"` |
130 |
| - List []FeeStat `json:"list"` |
| 146 | + Total int64 `json:"total"` // The total number of stat returned |
| 147 | + List []FeeStat `json:"list"` // Stat list |
131 | 148 | }
|
132 | 149 |
|
| 150 | +// DataStat model info |
| 151 | +// @Description Storage data information |
133 | 152 | type DataStat struct {
|
134 |
| - StatTime time.Time `json:"statTime"` |
135 |
| - FileCount uint64 `json:"fileCount"` |
136 |
| - FileTotal uint64 `json:"fileTotal"` |
137 |
| - DataSize uint64 `json:"dataSize"` |
138 |
| - DataTotal uint64 `json:"dataTotal"` |
| 153 | + StatTime time.Time `json:"statTime"` // Statistics time |
| 154 | + FileCount uint64 `json:"fileCount"` // Number of files in a specific time interval |
| 155 | + FileTotal uint64 `json:"fileTotal"` // Total number of files by a certain time |
| 156 | + DataSize uint64 `json:"dataSize"` // Size of storage data in a specific time interval |
| 157 | + DataTotal uint64 `json:"dataTotal"` // Total Size of storage data by a certain time |
139 | 158 | }
|
140 | 159 |
|
| 160 | +// TxStat model info |
| 161 | +// @Description Storage transaction information |
141 | 162 | type TxStat struct {
|
142 |
| - StatTime time.Time `json:"statTime"` |
143 |
| - TxCount uint64 `json:"txCount"` |
144 |
| - TxTotal uint64 `json:"txTotal"` |
| 163 | + StatTime time.Time `json:"statTime"` // Statistics time |
| 164 | + TxCount uint64 `json:"txCount"` // Number of layer1 transaction in a specific time interval |
| 165 | + TxTotal uint64 `json:"txTotal"` // Total number of layer1 transaction by a certain time |
145 | 166 | }
|
146 | 167 |
|
| 168 | +// FeeStat model info |
| 169 | +// @Description Storage fee information |
147 | 170 | type FeeStat struct {
|
148 |
| - StatTime time.Time `json:"statTime"` |
149 |
| - BaseFee decimal.Decimal `json:"baseFee"` |
150 |
| - BaseFeeTotal decimal.Decimal `json:"baseFeeTotal"` |
| 171 | + StatTime time.Time `json:"statTime"` // Statistics time |
| 172 | + BaseFee decimal.Decimal `json:"baseFee"` // The base fee for storage in a specific time interval |
| 173 | + BaseFeeTotal decimal.Decimal `json:"baseFeeTotal"` // The total base fee for storage by a certain time |
151 | 174 | }
|
0 commit comments