@@ -21,7 +21,7 @@ func Test_TxOpts_LegacyTx(t *testing.T) {
21
21
}
22
22
config := createConfig ()
23
23
config .TxType = "legacy"
24
- calculator := NewGasFeeCalculator (ethClient , config )
24
+ calculator := NewGasFeeCalculator (& ChainClient { ETHClient : ethClient } , config )
25
25
txOpts := & bind.TransactOpts {}
26
26
if err = calculator .Apply (context .Background (), txOpts ); err != nil {
27
27
t .Fatal (err )
@@ -43,7 +43,7 @@ func Test_TxOpts_DynamicTx(t *testing.T) {
43
43
t .Fatal (err )
44
44
}
45
45
config := createConfig ()
46
- calculator := NewGasFeeCalculator (ethClient , config )
46
+ calculator := NewGasFeeCalculator (& ChainClient { ETHClient : ethClient } , config )
47
47
txOpts := & bind.TransactOpts {}
48
48
if err = calculator .Apply (context .Background (), txOpts ); err != nil {
49
49
t .Fatal (err )
@@ -66,7 +66,7 @@ func Test_TxOpts_AutoTx(t *testing.T) {
66
66
}
67
67
config := createConfig ()
68
68
config .TxType = "auto"
69
- calculator := NewGasFeeCalculator (ethClient , config )
69
+ calculator := NewGasFeeCalculator (& ChainClient { ETHClient : ethClient } , config )
70
70
txOpts := & bind.TransactOpts {}
71
71
if err = calculator .Apply (context .Background (), txOpts ); err != nil {
72
72
t .Fatal (err )
@@ -135,15 +135,15 @@ func Test_getFeeInfo(t *testing.T) {
135
135
136
136
}
137
137
138
- type MockETHClient struct {
139
- client. IETHClient
138
+ type MockChainClient struct {
139
+ IChainClient
140
140
MockSuggestGasPrice big.Int
141
141
MockPendingTransaction * txpool.RPCTransaction
142
142
MockLatestHeaderNumber big.Int
143
143
MockHistoryGasTipCap big.Int
144
144
MockHistoryGasFeeCap big.Int
145
145
}
146
- func (cl * MockETHClient ) SuggestGasPrice (ctx context.Context ) (* big.Int , error ) {
146
+ func (cl * MockChainClient ) SuggestGasPrice (ctx context.Context ) (* big.Int , error ) {
147
147
return & cl .MockSuggestGasPrice , nil
148
148
}
149
149
@@ -152,7 +152,7 @@ func inclByPercent(n *big.Int, percent uint64) {
152
152
n .Div (n , big .NewInt (100 ))
153
153
}
154
154
155
- func (cl * MockETHClient ) GetMinimumRequiredFee (ctx context.Context , address common.Address , nonce uint64 , priceBump uint64 ) (* txpool.RPCTransaction , * big.Int , * big.Int , error ) {
155
+ func (cl * MockChainClient ) GetMinimumRequiredFee (ctx context.Context , address common.Address , nonce uint64 , priceBump uint64 ) (* txpool.RPCTransaction , * big.Int , * big.Int , error ) {
156
156
gasFeeCap := new (big.Int ).Set (cl .MockPendingTransaction .GasFeeCap .ToInt ())
157
157
gasTipCap := new (big.Int ).Set (cl .MockPendingTransaction .GasTipCap .ToInt ())
158
158
@@ -162,7 +162,7 @@ func (cl *MockETHClient) GetMinimumRequiredFee(ctx context.Context, address comm
162
162
return cl .MockPendingTransaction , gasFeeCap , gasTipCap , nil
163
163
}
164
164
165
- func (cl * MockETHClient ) HeaderByNumber (ctx context.Context , number * big.Int ) (* gethtypes.Header , error ) {
165
+ func (cl * MockChainClient ) HeaderByNumber (ctx context.Context , number * big.Int ) (* gethtypes.Header , error ) {
166
166
if number != nil {
167
167
return & gethtypes.Header {
168
168
Number : big .NewInt (0 ).Set (number ),
@@ -173,7 +173,7 @@ func (cl *MockETHClient) HeaderByNumber(ctx context.Context, number *big.Int) (*
173
173
}, nil
174
174
}
175
175
}
176
- func (cl * MockETHClient ) FeeHistory (ctx context.Context , blockCount uint64 , lastBlock * big.Int , rewardPercentiles []float64 ) (* ethereum.FeeHistory , error ) {
176
+ func (cl * MockChainClient ) FeeHistory (ctx context.Context , blockCount uint64 , lastBlock * big.Int , rewardPercentiles []float64 ) (* ethereum.FeeHistory , error ) {
177
177
return & ethereum.FeeHistory {
178
178
Reward : [][]* big.Int { // gasTipCap
179
179
{ & cl .MockHistoryGasTipCap , },
@@ -185,7 +185,7 @@ func (cl *MockETHClient) FeeHistory(ctx context.Context, blockCount uint64, last
185
185
}
186
186
187
187
func TestPriceBumpLegacy (t * testing.T ) {
188
- cli := MockETHClient {}
188
+ cli := MockChainClient {}
189
189
config := createConfig ()
190
190
config .TxType = TxTypeLegacy
191
191
config .PriceBump = 10
@@ -223,7 +223,7 @@ func TestPriceBumpLegacy(t *testing.T) {
223
223
}
224
224
225
225
func TestPriceBumpDynamic (t * testing.T ) {
226
- cli := MockETHClient {}
226
+ cli := MockChainClient {}
227
227
config := createConfig ()
228
228
config .TxType = TxTypeDynamic
229
229
config .PriceBump = 100 //double
0 commit comments