-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
102 lines (87 loc) · 3.09 KB
/
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
package bundlerpc
import (
"fmt"
"math/big"
"time"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
)
type RPCError struct {
Code int `json:"code"`
Message string `json:"message"`
}
func (e *RPCError) Error() string {
return fmt.Sprintf("rpc error %d: %s", e.Code, e.Message)
}
type HashSigner interface {
SignHash(acc accounts.Account, hash []byte) ([]byte, error)
}
type BundleIdentifier interface {
Identifier() (hash common.Hash, blockNumber uint64)
}
type SendBundleParam struct {
Txs []*types.Transaction
BlockNumber uint64
MinTimestamp time.Time
MaxTimestamp time.Time
AllowRevertTxs []*types.Transaction
}
type SentBundle struct {
BundleHash common.Hash `json:"bundleHash"`
BlockNumber uint64 `json:"-"`
}
func (b *SentBundle) Identifier() (hash common.Hash, blockNumber uint64) {
return b.BundleHash, b.BlockNumber
}
type CallBundleParam struct {
Txs []*types.Transaction
BlockNumber uint64
StateBlockNumber rpc.BlockNumber
Timestamp time.Time
}
type TxResult struct {
CoinbaseDiff *big.Int `json:"coinbaseDiff"`
ETHSentToCoinbase *big.Int `json:"ethSentToCoinbase"`
GasFees *big.Int `json:"gasFees"`
GasPrice *big.Int `json:"gasPrice"`
GasUsed uint64 `json:"gasUsed"`
From common.Address `json:"fromAddress"`
To common.Address `json:"toAddress"`
Hash common.Hash `json:"txHash"`
Value *big.Int `json:"value"`
Error string `json:"error"`
Revert string `json:"revert"`
}
type CalledBundle struct {
BundleHash common.Hash `json:"bundleHash"`
BlockNumber uint64 `json:"-"`
CoinbaseDiff *big.Int `json:"coinbaseDiff"`
ETHSentToCoinbase *big.Int `json:"ethSentToCoinbase"`
GasFees *big.Int `json:"gasFees"`
TotalGasUsed uint64 `json:"totalGasUsed"`
StateBlockNumber uint64 `json:"stateBlockNumber"`
Results []TxResult `json:"results"`
FirstRevert *TxResult `json:"firstRevert"`
}
func (b *CalledBundle) Identifier() (hash common.Hash, blockNumber uint64) {
return b.BundleHash, b.BlockNumber
}
type BundleStats struct {
IsSimulated bool `json:"isSimulated"`
IsSentToMiners bool `json:"isSentToMiners"`
IsHighPriority bool `json:"isHighPriority"`
SimulatedAt time.Time `json:"simulatedAt"`
SubmittedAt time.Time `json:"submittedAt"`
SentToMinersAt time.Time `json:"sentToMinersAt"`
}
type UserStats struct {
IsHighPriority bool `json:"is_high_priority"`
AllTimeMinerPayments *big.Int `json:"all_time_miner_payments"`
AllTimeGasSimulated *big.Int `json:"all_time_gas_simulated"`
Last7DaysMinerPayments *big.Int `json:"last_7d_miner_payments"`
Last7DaysGasSimulated *big.Int `json:"last_7d_gas_simulated"`
Last1DayMinerPayments *big.Int `json:"last_1d_miner_payments"`
Last1DayGasSimulated *big.Int `json:"last_1d_gas_simulated"`
}