-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathquery_types.go
91 lines (72 loc) · 1.7 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
package common
import (
"encoding/json"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/common"
)
type PrivateQueryResponse struct {
Receipts types.Receipts
Total uint64
}
type TransactionListingResponse struct {
TransactionsData []PublicTransaction
Total uint64
}
type BatchListingResponse struct {
BatchesData []PublicBatch
Total uint64
}
type BlockListingResponse struct {
BlocksData []PublicBlock
Total uint64
}
type PublicTransaction struct {
TransactionHash TxHash
BatchHeight *big.Int
Finality FinalityType
}
type PublicBatch struct {
BatchHeader
}
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 PrivateCustomQueryListTransactions struct {
Address common.Address `json:"address"`
Pagination QueryPagination `json:"pagination"`
}
type ObscuroNetworkInfo struct {
ManagementContractAddress common.Address
L1StartHash common.Hash
SequencerID common.Address
MessageBusAddress common.Address
}