From a6432b02a64e83ae3b689baa92fe07df767a1747 Mon Sep 17 00:00:00 2001 From: Dat Luong Date: Mon, 8 Apr 2024 16:08:10 +0700 Subject: [PATCH 1/5] feat: EstimateBundleGas --- pkg/eth/simulator.go | 23 ++-------------------- pkg/mev/bundle_sender.go | 42 ++++++++++++++++++++++++++++++++++++++-- pkg/mev/pkg.go | 22 +++++++++++++++++++++ 3 files changed, 64 insertions(+), 23 deletions(-) diff --git a/pkg/eth/simulator.go b/pkg/eth/simulator.go index 14c86b2..3c2656d 100644 --- a/pkg/eth/simulator.go +++ b/pkg/eth/simulator.go @@ -5,6 +5,7 @@ import ( "fmt" "math/big" + "github.com/KyberNetwork/tradinglib/pkg/mev" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -28,33 +29,13 @@ func (s *Simulator) EstimateGasWithOverrides( ) (uint64, error) { var hex hexutil.Uint64 err := s.c.CallContext( - ctx, &hex, "eth_estimateGas", toCallArg(msg), + ctx, &hex, "eth_estimateGas", mev.ToCallArg(msg), toBlockNumArg(blockNumber), overrides, ) return uint64(hex), err } -func toCallArg(msg ethereum.CallMsg) interface{} { - arg := map[string]interface{}{ - "from": msg.From, - "to": msg.To, - } - if len(msg.Data) > 0 { - arg["input"] = hexutil.Bytes(msg.Data) - } - if msg.Value != nil { - arg["value"] = (*hexutil.Big)(msg.Value) - } - if msg.Gas != 0 { - arg["gas"] = hexutil.Uint64(msg.Gas) - } - if msg.GasPrice != nil { - arg["gasPrice"] = (*hexutil.Big)(msg.GasPrice) - } - return arg -} - func toBlockNumArg(number *big.Int) string { if number == nil { return "latest" diff --git a/pkg/mev/bundle_sender.go b/pkg/mev/bundle_sender.go index d86f029..1600f8a 100644 --- a/pkg/mev/bundle_sender.go +++ b/pkg/mev/bundle_sender.go @@ -9,11 +9,14 @@ import ( "net/http" "github.com/duoxehyon/mev-share-go/rpc" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/ethclient/gethclient" "github.com/flashbots/mev-share-node/mevshare" ) @@ -27,6 +30,7 @@ type Client struct { senderType BundleSenderType // mevShareClient is the client for mev-share flashbots node mevShareClient rpc.MevAPIClient + ethClient *ethclient.Client } // NewClient set the flashbotKey to nil will skip adding the signature header. @@ -36,12 +40,17 @@ func NewClient( flashbotKey *ecdsa.PrivateKey, cancelBySendBundle bool, senderType BundleSenderType, -) *Client { +) (*Client, error) { var mevShareClient rpc.MevAPIClient if flashbotKey != nil { mevShareClient = rpc.NewClient(endpoint, flashbotKey) } + client, err := ethclient.Dial(endpoint) + if err != nil { + return nil, fmt.Errorf("dial eth client error: %w", err) + } + return &Client{ c: c, endpoint: endpoint, @@ -49,7 +58,8 @@ func NewClient( cancelBySendBundle: cancelBySendBundle, senderType: senderType, mevShareClient: mevShareClient, - } + ethClient: client, + }, nil } func (s *Client) GetSenderType() BundleSenderType { @@ -124,6 +134,34 @@ func (s *Client) flashbotBackrunSendBundle( return res, err } +func (s *Client) EstimateBundleGas( + messages []ethereum.CallMsg, + overrides *map[common.Address]gethclient.OverrideAccount, +) ([]uint64, error) { + bundles := make([]interface{}, 0, len(messages)) + for _, msg := range messages { + bundles = append(bundles, ToCallArg(msg)) + } + + var gasEstimateCost []hexutil.Uint64 + + err := s.ethClient.Client().Call( + &gasEstimateCost, "eth_estimateGasBundle", + map[string]interface{}{ + "transactions": bundles, + }, "latest", overrides, + ) + if err != nil { + return nil, err + } + result := make([]uint64, 0, len(gasEstimateCost)) + + for _, gasEstimate := range gasEstimateCost { + result = append(result, uint64(gasEstimate)) + } + return result, nil +} + func (s *Client) MevSimulateBundle( blockNumber uint64, pendingTxHash common.Hash, diff --git a/pkg/mev/pkg.go b/pkg/mev/pkg.go index 9d39849..519d31f 100644 --- a/pkg/mev/pkg.go +++ b/pkg/mev/pkg.go @@ -9,7 +9,9 @@ import ( "io" "net/http" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/flashbots/mev-share-node/mevshare" ) @@ -174,3 +176,23 @@ type TitanCancelBundleResponse struct { Result int `json:"result,omitempty"` Error SendBundleError `json:"error,omitempty"` } + +func ToCallArg(msg ethereum.CallMsg) interface{} { + arg := map[string]interface{}{ + "from": msg.From, + "to": msg.To, + } + if len(msg.Data) > 0 { + arg["input"] = hexutil.Bytes(msg.Data) + } + if msg.Value != nil { + arg["value"] = (*hexutil.Big)(msg.Value) + } + if msg.Gas != 0 { + arg["gas"] = hexutil.Uint64(msg.Gas) + } + if msg.GasPrice != nil { + arg["gasPrice"] = (*hexutil.Big)(msg.GasPrice) + } + return arg +} From ca4c34d3fc8bb6252626512173b8a6d0229fb744 Mon Sep 17 00:00:00 2001 From: Dat Luong Date: Mon, 8 Apr 2024 16:41:23 +0700 Subject: [PATCH 2/5] feat: add getfrom --- pkg/mev/blxr_bundle_sender.go | 10 ++++++++++ pkg/mev/bundle_sender.go | 3 ++- pkg/mev/bundle_sender_test.go | 9 ++++++--- pkg/mev/pkg.go | 12 ++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/pkg/mev/blxr_bundle_sender.go b/pkg/mev/blxr_bundle_sender.go index 1e12819..09d7c2e 100644 --- a/pkg/mev/blxr_bundle_sender.go +++ b/pkg/mev/blxr_bundle_sender.go @@ -9,8 +9,10 @@ import ( "net/http" "strconv" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient/gethclient" "github.com/flashbots/mev-share-node/mevshare" ) @@ -32,6 +34,14 @@ type BloxrouteClient struct { enabledBuilders []BlxrBuilder } +func (s *BloxrouteClient) EstimateBundleGas( + _ context.Context, + _ []ethereum.CallMsg, + _ *map[common.Address]gethclient.OverrideAccount, +) ([]uint64, error) { + return nil, nil +} + func (s *BloxrouteClient) MevSimulateBundle( _ uint64, _ common.Hash, diff --git a/pkg/mev/bundle_sender.go b/pkg/mev/bundle_sender.go index 1600f8a..28d6008 100644 --- a/pkg/mev/bundle_sender.go +++ b/pkg/mev/bundle_sender.go @@ -135,6 +135,7 @@ func (s *Client) flashbotBackrunSendBundle( } func (s *Client) EstimateBundleGas( + _ context.Context, messages []ethereum.CallMsg, overrides *map[common.Address]gethclient.OverrideAccount, ) ([]uint64, error) { @@ -146,7 +147,7 @@ func (s *Client) EstimateBundleGas( var gasEstimateCost []hexutil.Uint64 err := s.ethClient.Client().Call( - &gasEstimateCost, "eth_estimateGasBundle", + &gasEstimateCost, ETHEstimateGasBundleMethod, map[string]interface{}{ "transactions": bundles, }, "latest", overrides, diff --git a/pkg/mev/bundle_sender_test.go b/pkg/mev/bundle_sender_test.go index 7897fc8..743475d 100644 --- a/pkg/mev/bundle_sender_test.go +++ b/pkg/mev/bundle_sender_test.go @@ -66,7 +66,8 @@ func TestSendBundle(t *testing.T) { t.Log("new tx", signedTx.Hash().String()) uuid := uuid.NewString() - sender := mev.NewClient(client, endpoint, privateKey, false, mev.BundleSenderTypeFlashbot) + sender, err := mev.NewClient(client, endpoint, privateKey, false, mev.BundleSenderTypeFlashbot) + require.NoError(t, err) resp, err := sender.SendBundle(ctx, &uuid, blockNumber+12, signedTx) require.NoError(t, err) // sepolia: code: [-32000], message: [internal server error] @@ -95,7 +96,8 @@ func TestCancelBeaver(t *testing.T) { bundleUUID = uuid.New().String() ) - sender := mev.NewClient(client, endpoint, nil, true, mev.BundleSenderTypeBeaver) + sender, err := mev.NewClient(client, endpoint, nil, true, mev.BundleSenderTypeBeaver) + require.NoError(t, err) require.NoError(t, sender.CancelBundle(ctx, bundleUUID)) } @@ -131,8 +133,9 @@ func Test_SimulateBundle(t *testing.T) { var ( simulationEndpoint = "http://localhost:8545" - client = mev.NewClient(http.DefaultClient, simulationEndpoint, nil, false, mev.BundleSenderTypeFlashbot) + client, err = mev.NewClient(http.DefaultClient, simulationEndpoint, nil, false, mev.BundleSenderTypeFlashbot) ) + require.NoError(t, err) simulationResponse, err := client.SimulateBundle(context.Background(), uint64(blockNumber), txs...) require.NoError(t, err) diff --git a/pkg/mev/pkg.go b/pkg/mev/pkg.go index 519d31f..5da50bd 100644 --- a/pkg/mev/pkg.go +++ b/pkg/mev/pkg.go @@ -13,6 +13,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient/gethclient" "github.com/flashbots/mev-share-node/mevshare" ) @@ -35,6 +36,7 @@ const ( ETHSendBundleMethod = "eth_sendBundle" EthCallBundleMethod = "eth_callBundle" ETHCancelBundleMethod = "eth_cancelBundle" + ETHEstimateGasBundleMethod = "eth_estimateGasBundle" MevSendBundleMethod = "mev_sendBundle" MaxBlockFromTarget = 3 ) @@ -57,6 +59,11 @@ type IBundleSender interface { ctx context.Context, bundleUUID string, ) error SimulateBundle(ctx context.Context, blockNumber uint64, txs ...*types.Transaction) (SendBundleResponse, error) + EstimateBundleGas( + ctx context.Context, + messages []ethereum.CallMsg, + overrides *map[common.Address]gethclient.OverrideAccount, + ) ([]uint64, error) MevSimulateBundle( blockNumber uint64, pendingTxHash common.Hash, @@ -196,3 +203,8 @@ func ToCallArg(msg ethereum.CallMsg) interface{} { } return arg } + +func GetFrom(tx *types.Transaction) (common.Address, error) { + from, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx) + return from, err +} From 92107a30f5fd79b8379d05ba2c509caeb5ad5f17 Mon Sep 17 00:00:00 2001 From: Dat Luong Date: Tue, 9 Apr 2024 10:14:59 +0700 Subject: [PATCH 3/5] fix: add IGasBundleEstimator --- pkg/mev/bundle_sender.go | 38 ++++--------------------- pkg/mev/bundle_sender_test.go | 21 ++++++++++---- pkg/mev/gas_bundle_estimator.go | 49 +++++++++++++++++++++++++++++++++ pkg/mev/pkg.go | 8 ++++++ 4 files changed, 78 insertions(+), 38 deletions(-) create mode 100644 pkg/mev/gas_bundle_estimator.go diff --git a/pkg/mev/bundle_sender.go b/pkg/mev/bundle_sender.go index 28d6008..0a4ad99 100644 --- a/pkg/mev/bundle_sender.go +++ b/pkg/mev/bundle_sender.go @@ -15,7 +15,6 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/ethclient/gethclient" "github.com/flashbots/mev-share-node/mevshare" ) @@ -29,8 +28,8 @@ type Client struct { cancelBySendBundle bool senderType BundleSenderType // mevShareClient is the client for mev-share flashbots node - mevShareClient rpc.MevAPIClient - ethClient *ethclient.Client + mevShareClient rpc.MevAPIClient + gasBundleEstimator IGasBundleEstimator } // NewClient set the flashbotKey to nil will skip adding the signature header. @@ -40,17 +39,13 @@ func NewClient( flashbotKey *ecdsa.PrivateKey, cancelBySendBundle bool, senderType BundleSenderType, + gasBundleEstimator IGasBundleEstimator, ) (*Client, error) { var mevShareClient rpc.MevAPIClient if flashbotKey != nil { mevShareClient = rpc.NewClient(endpoint, flashbotKey) } - client, err := ethclient.Dial(endpoint) - if err != nil { - return nil, fmt.Errorf("dial eth client error: %w", err) - } - return &Client{ c: c, endpoint: endpoint, @@ -58,7 +53,7 @@ func NewClient( cancelBySendBundle: cancelBySendBundle, senderType: senderType, mevShareClient: mevShareClient, - ethClient: client, + gasBundleEstimator: gasBundleEstimator, }, nil } @@ -135,32 +130,11 @@ func (s *Client) flashbotBackrunSendBundle( } func (s *Client) EstimateBundleGas( - _ context.Context, + ctx context.Context, messages []ethereum.CallMsg, overrides *map[common.Address]gethclient.OverrideAccount, ) ([]uint64, error) { - bundles := make([]interface{}, 0, len(messages)) - for _, msg := range messages { - bundles = append(bundles, ToCallArg(msg)) - } - - var gasEstimateCost []hexutil.Uint64 - - err := s.ethClient.Client().Call( - &gasEstimateCost, ETHEstimateGasBundleMethod, - map[string]interface{}{ - "transactions": bundles, - }, "latest", overrides, - ) - if err != nil { - return nil, err - } - result := make([]uint64, 0, len(gasEstimateCost)) - - for _, gasEstimate := range gasEstimateCost { - result = append(result, uint64(gasEstimate)) - } - return result, nil + return s.gasBundleEstimator.EstimateBundleGas(ctx, messages, overrides) } func (s *Client) MevSimulateBundle( diff --git a/pkg/mev/bundle_sender_test.go b/pkg/mev/bundle_sender_test.go index 743475d..828d8ea 100644 --- a/pkg/mev/bundle_sender_test.go +++ b/pkg/mev/bundle_sender_test.go @@ -66,7 +66,10 @@ func TestSendBundle(t *testing.T) { t.Log("new tx", signedTx.Hash().String()) uuid := uuid.NewString() - sender, err := mev.NewClient(client, endpoint, privateKey, false, mev.BundleSenderTypeFlashbot) + ethClient, err = ethclient.Dial(endpoint) + require.NoError(t, err) + gasBundleEstimator := mev.NewGasBundleEstimator(ethClient) + sender, err := mev.NewClient(client, endpoint, privateKey, false, mev.BundleSenderTypeFlashbot, gasBundleEstimator) require.NoError(t, err) resp, err := sender.SendBundle(ctx, &uuid, blockNumber+12, signedTx) @@ -96,7 +99,11 @@ func TestCancelBeaver(t *testing.T) { bundleUUID = uuid.New().String() ) - sender, err := mev.NewClient(client, endpoint, nil, true, mev.BundleSenderTypeBeaver) + ethClient, err := ethclient.Dial(endpoint) + require.NoError(t, err) + gasBundleEstimator := mev.NewGasBundleEstimator(ethClient) + + sender, err := mev.NewClient(client, endpoint, nil, true, mev.BundleSenderTypeBeaver, gasBundleEstimator) require.NoError(t, err) require.NoError(t, sender.CancelBundle(ctx, bundleUUID)) @@ -131,10 +138,12 @@ func Test_SimulateBundle(t *testing.T) { txs = append(txs, &tx) } - var ( - simulationEndpoint = "http://localhost:8545" - client, err = mev.NewClient(http.DefaultClient, simulationEndpoint, nil, false, mev.BundleSenderTypeFlashbot) - ) + simulationEndpoint := "http://localhost:8545" + ethClient, err := ethclient.Dial(simulationEndpoint) + require.NoError(t, err) + gasBundleEstimator := mev.NewGasBundleEstimator(ethClient) + + client, err := mev.NewClient(http.DefaultClient, simulationEndpoint, nil, false, mev.BundleSenderTypeFlashbot, gasBundleEstimator) require.NoError(t, err) simulationResponse, err := client.SimulateBundle(context.Background(), uint64(blockNumber), txs...) diff --git a/pkg/mev/gas_bundle_estimator.go b/pkg/mev/gas_bundle_estimator.go new file mode 100644 index 0000000..5d55bac --- /dev/null +++ b/pkg/mev/gas_bundle_estimator.go @@ -0,0 +1,49 @@ +package mev + +import ( + "context" + "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" +) + +type GasBundleEstimator struct { + ethClient *ethclient.Client +} + +func NewGasBundleEstimator(ethClient *ethclient.Client) GasBundleEstimator { + return GasBundleEstimator{ + ethClient: ethClient, + } +} + +func (g GasBundleEstimator) EstimateBundleGas( + _ context.Context, + messages []ethereum.CallMsg, + overrides *map[common.Address]gethclient.OverrideAccount, +) ([]uint64, error) { + bundles := make([]interface{}, 0, len(messages)) + for _, msg := range messages { + bundles = append(bundles, ToCallArg(msg)) + } + + var gasEstimateCost []hexutil.Uint64 + + err := g.ethClient.Client().Call( + &gasEstimateCost, ETHEstimateGasBundleMethod, + map[string]interface{}{ + "transactions": bundles, + }, "latest", overrides, + ) + if err != nil { + return nil, err + } + result := make([]uint64, 0, len(gasEstimateCost)) + + for _, gasEstimate := range gasEstimateCost { + result = append(result, uint64(gasEstimate)) + } + return result, nil +} diff --git a/pkg/mev/pkg.go b/pkg/mev/pkg.go index 5da50bd..0b8cb19 100644 --- a/pkg/mev/pkg.go +++ b/pkg/mev/pkg.go @@ -71,6 +71,14 @@ type IBundleSender interface { GetSenderType() BundleSenderType } +type IGasBundleEstimator interface { + EstimateBundleGas( + ctx context.Context, + messages []ethereum.CallMsg, + overrides *map[common.Address]gethclient.OverrideAccount, + ) ([]uint64, error) +} + var ( _ IBundleSender = &Client{} _ IBundleSender = &BloxrouteClient{} From 2f6c7b5577c0e7168278ef32e5d77692cbaff86e Mon Sep 17 00:00:00 2001 From: Dat Luong Date: Tue, 9 Apr 2024 10:21:26 +0700 Subject: [PATCH 4/5] chore: lint --- pkg/mev/bundle_sender_test.go | 4 +++- pkg/mev/gas_bundle_estimator.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/mev/bundle_sender_test.go b/pkg/mev/bundle_sender_test.go index 828d8ea..f30938c 100644 --- a/pkg/mev/bundle_sender_test.go +++ b/pkg/mev/bundle_sender_test.go @@ -143,7 +143,9 @@ func Test_SimulateBundle(t *testing.T) { require.NoError(t, err) gasBundleEstimator := mev.NewGasBundleEstimator(ethClient) - client, err := mev.NewClient(http.DefaultClient, simulationEndpoint, nil, false, mev.BundleSenderTypeFlashbot, gasBundleEstimator) + client, err := mev.NewClient(http.DefaultClient, + simulationEndpoint, nil, false, + mev.BundleSenderTypeFlashbot, gasBundleEstimator) require.NoError(t, err) simulationResponse, err := client.SimulateBundle(context.Background(), uint64(blockNumber), txs...) diff --git a/pkg/mev/gas_bundle_estimator.go b/pkg/mev/gas_bundle_estimator.go index 5d55bac..e415b31 100644 --- a/pkg/mev/gas_bundle_estimator.go +++ b/pkg/mev/gas_bundle_estimator.go @@ -2,6 +2,7 @@ package mev import ( "context" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" From fbe479799b0a6611cac58bc42968926c443cff98 Mon Sep 17 00:00:00 2001 From: Dat Luong Date: Tue, 9 Apr 2024 11:04:45 +0700 Subject: [PATCH 5/5] fix: change client type --- pkg/mev/bundle_sender_test.go | 6 +++--- pkg/mev/gas_bundle_estimator.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/mev/bundle_sender_test.go b/pkg/mev/bundle_sender_test.go index f30938c..b63ff26 100644 --- a/pkg/mev/bundle_sender_test.go +++ b/pkg/mev/bundle_sender_test.go @@ -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) @@ -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) @@ -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, diff --git a/pkg/mev/gas_bundle_estimator.go b/pkg/mev/gas_bundle_estimator.go index e415b31..0784399 100644 --- a/pkg/mev/gas_bundle_estimator.go +++ b/pkg/mev/gas_bundle_estimator.go @@ -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, } } @@ -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,