Skip to content

Commit

Permalink
fix: change client type
Browse files Browse the repository at this point in the history
  • Loading branch information
datluongductuan committed Apr 9, 2024
1 parent 2f6c7b5 commit fbe4797
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pkg/mev/bundle_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestSendBundle(t *testing.T) {
uuid := uuid.NewString()
ethClient, err = ethclient.Dial(endpoint)
require.NoError(t, err)
gasBundleEstimator := mev.NewGasBundleEstimator(ethClient)
gasBundleEstimator := mev.NewGasBundleEstimator(ethClient.Client())
sender, err := mev.NewClient(client, endpoint, privateKey, false, mev.BundleSenderTypeFlashbot, gasBundleEstimator)
require.NoError(t, err)

Expand Down Expand Up @@ -101,7 +101,7 @@ func TestCancelBeaver(t *testing.T) {

ethClient, err := ethclient.Dial(endpoint)
require.NoError(t, err)
gasBundleEstimator := mev.NewGasBundleEstimator(ethClient)
gasBundleEstimator := mev.NewGasBundleEstimator(ethClient.Client())

sender, err := mev.NewClient(client, endpoint, nil, true, mev.BundleSenderTypeBeaver, gasBundleEstimator)
require.NoError(t, err)
Expand Down Expand Up @@ -141,7 +141,7 @@ func Test_SimulateBundle(t *testing.T) {
simulationEndpoint := "http://localhost:8545"
ethClient, err := ethclient.Dial(simulationEndpoint)
require.NoError(t, err)
gasBundleEstimator := mev.NewGasBundleEstimator(ethClient)
gasBundleEstimator := mev.NewGasBundleEstimator(ethClient.Client())

client, err := mev.NewClient(http.DefaultClient,
simulationEndpoint, nil, false,
Expand Down
10 changes: 5 additions & 5 deletions pkg/mev/gas_bundle_estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient/gethclient"
"github.com/ethereum/go-ethereum/rpc"
)

type GasBundleEstimator struct {
ethClient *ethclient.Client
client *rpc.Client
}

func NewGasBundleEstimator(ethClient *ethclient.Client) GasBundleEstimator {
func NewGasBundleEstimator(client *rpc.Client) GasBundleEstimator {
return GasBundleEstimator{
ethClient: ethClient,
client: client,
}
}

Expand All @@ -32,7 +32,7 @@ func (g GasBundleEstimator) EstimateBundleGas(

var gasEstimateCost []hexutil.Uint64

err := g.ethClient.Client().Call(
err := g.client.Call(
&gasEstimateCost, ETHEstimateGasBundleMethod,
map[string]interface{}{
"transactions": bundles,
Expand Down

0 comments on commit fbe4797

Please sign in to comment.