@@ -21,7 +21,7 @@ func Test_TxOpts_LegacyTx(t *testing.T) {
2121 }
2222 config := createConfig ()
2323 config .TxType = "legacy"
24- calculator := NewGasFeeCalculator (ethClient , config )
24+ calculator := NewGasFeeCalculator (& ChainClient { ETHClient : ethClient } , config )
2525 txOpts := & bind.TransactOpts {}
2626 if err = calculator .Apply (context .Background (), txOpts ); err != nil {
2727 t .Fatal (err )
@@ -43,7 +43,7 @@ func Test_TxOpts_DynamicTx(t *testing.T) {
4343 t .Fatal (err )
4444 }
4545 config := createConfig ()
46- calculator := NewGasFeeCalculator (ethClient , config )
46+ calculator := NewGasFeeCalculator (& ChainClient { ETHClient : ethClient } , config )
4747 txOpts := & bind.TransactOpts {}
4848 if err = calculator .Apply (context .Background (), txOpts ); err != nil {
4949 t .Fatal (err )
@@ -66,7 +66,7 @@ func Test_TxOpts_AutoTx(t *testing.T) {
6666 }
6767 config := createConfig ()
6868 config .TxType = "auto"
69- calculator := NewGasFeeCalculator (ethClient , config )
69+ calculator := NewGasFeeCalculator (& ChainClient { ETHClient : ethClient } , config )
7070 txOpts := & bind.TransactOpts {}
7171 if err = calculator .Apply (context .Background (), txOpts ); err != nil {
7272 t .Fatal (err )
@@ -135,15 +135,15 @@ func Test_getFeeInfo(t *testing.T) {
135135
136136}
137137
138- type MockETHClient struct {
139- client. IETHClient
138+ type MockChainClient struct {
139+ IChainClient
140140 MockSuggestGasPrice big.Int
141141 MockPendingTransaction * txpool.RPCTransaction
142142 MockLatestHeaderNumber big.Int
143143 MockHistoryGasTipCap big.Int
144144 MockHistoryGasFeeCap big.Int
145145}
146- func (cl * MockETHClient ) SuggestGasPrice (ctx context.Context ) (* big.Int , error ) {
146+ func (cl * MockChainClient ) SuggestGasPrice (ctx context.Context ) (* big.Int , error ) {
147147 return & cl .MockSuggestGasPrice , nil
148148}
149149
@@ -152,7 +152,7 @@ func inclByPercent(n *big.Int, percent uint64) {
152152 n .Div (n , big .NewInt (100 ))
153153}
154154
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 ) {
156156 gasFeeCap := new (big.Int ).Set (cl .MockPendingTransaction .GasFeeCap .ToInt ())
157157 gasTipCap := new (big.Int ).Set (cl .MockPendingTransaction .GasTipCap .ToInt ())
158158
@@ -162,7 +162,7 @@ func (cl *MockETHClient) GetMinimumRequiredFee(ctx context.Context, address comm
162162 return cl .MockPendingTransaction , gasFeeCap , gasTipCap , nil
163163}
164164
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 ) {
166166 if number != nil {
167167 return & gethtypes.Header {
168168 Number : big .NewInt (0 ).Set (number ),
@@ -173,7 +173,7 @@ func (cl *MockETHClient) HeaderByNumber(ctx context.Context, number *big.Int) (*
173173 }, nil
174174 }
175175}
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 ) {
177177 return & ethereum.FeeHistory {
178178 Reward : [][]* big.Int { // gasTipCap
179179 { & cl .MockHistoryGasTipCap , },
@@ -185,7 +185,7 @@ func (cl *MockETHClient) FeeHistory(ctx context.Context, blockCount uint64, last
185185}
186186
187187func TestPriceBumpLegacy (t * testing.T ) {
188- cli := MockETHClient {}
188+ cli := MockChainClient {}
189189 config := createConfig ()
190190 config .TxType = TxTypeLegacy
191191 config .PriceBump = 10
@@ -223,7 +223,7 @@ func TestPriceBumpLegacy(t *testing.T) {
223223}
224224
225225func TestPriceBumpDynamic (t * testing.T ) {
226- cli := MockETHClient {}
226+ cli := MockChainClient {}
227227 config := createConfig ()
228228 config .TxType = TxTypeDynamic
229229 config .PriceBump = 100 //double
0 commit comments