-
Notifications
You must be signed in to change notification settings - Fork 37
/
query_types.go
121 lines (99 loc) · 2.64 KB
/
query_types.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
package common
import (
"encoding/json"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/common"
)
type PrivateTransactionsQueryResponse struct {
Receipts types.Receipts
Total uint64
}
type TransactionListingResponse struct {
TransactionsData []PublicTransaction
Total uint64
}
type BatchListingResponse struct {
BatchesData []PublicBatch
Total uint64
}
type BatchListingResponseDeprecated struct {
BatchesData []PublicBatchDeprecated
Total uint64
}
type BlockListingResponse struct {
BlocksData []PublicBlock
Total uint64
}
type RollupListingResponse struct {
RollupsData []PublicRollup
Total uint64
}
type PublicTransaction struct {
TransactionHash TxHash
BatchHeight *big.Int
BatchTimestamp uint64
Finality FinalityType
}
type PublicBatch struct {
SequencerOrderNo *big.Int `json:"sequence"`
FullHash common.Hash `json:"fullHash"`
Height *big.Int `json:"height"`
TxCount *big.Int `json:"txCount"`
Header *BatchHeader `json:"header"`
EncryptedTxBlob EncryptedTransactions `json:"encryptedTxBlob"`
}
// TODO (@will) remove when tenscan UI has been updated
type PublicBatchDeprecated struct {
BatchHeader
TxHashes []TxHash `json:"txHashes"`
}
type PublicRollup struct {
ID *big.Int
Hash string
FirstSeq *big.Int
LastSeq *big.Int
Timestamp uint64
Header *RollupHeader
L1Hash string
}
type PublicBlock struct {
BlockHeader types.Header `json:"blockHeader"`
RollupHash common.Hash `json:"rollupHash"`
}
type FinalityType string
const (
MempoolPending FinalityType = "Pending"
BatchFinal FinalityType = "Final"
)
type QueryPagination struct {
Offset uint64
Size uint
}
func (p *QueryPagination) UnmarshalJSON(data []byte) error {
// Use a temporary struct to avoid infinite unmarshalling loop
type Temp struct {
Size uint `json:"size"`
Offset uint64
}
var temp Temp
if err := json.Unmarshal(data, &temp); err != nil {
return err
}
if temp.Size < 1 || temp.Size > 100 {
return fmt.Errorf("size must be between 1 and 100")
}
p.Size = temp.Size
p.Offset = temp.Offset
return nil
}
type TenNetworkInfo struct {
ManagementContractAddress common.Address
L1StartHash common.Hash
MessageBusAddress common.Address
L2MessageBusAddress common.Address
ImportantContracts map[string]common.Address // map of contract name to address
TransactionPostProcessorAddress common.Address
PublicSystemContracts map[string]common.Address
}