diff --git a/pkg/mev/bloxroute_submit_bundle.go b/pkg/mev/bloxroute_submit_bundle.go index 182c313..68ff816 100644 --- a/pkg/mev/bloxroute_submit_bundle.go +++ b/pkg/mev/bloxroute_submit_bundle.go @@ -24,7 +24,7 @@ const ( BuilderAll BlxrBuilder = "all" ) -type BloxrouteBundleSender struct { +type BloxrouteClient struct { c *http.Client endpoint string auth string @@ -32,16 +32,16 @@ type BloxrouteBundleSender struct { enabledBuilders []BlxrBuilder } -// NewBloxrouteBundleSender set flashbotKey to nil if you don't want to send to flashbot builders +// NewBloxrouteClient set flashbotKey to nil if you don't want to send to flashbot builders // With BuilderAll still need to add the flashbot key & the flashbot builder separately // https://docs.bloxroute.com/apis/mev-solution/bundle-submission -func NewBloxrouteBundleSender( +func NewBloxrouteClient( c *http.Client, endpoint, auth string, flashbotKey *ecdsa.PrivateKey, enabledBuilders ...BlxrBuilder, -) *BloxrouteBundleSender { - return &BloxrouteBundleSender{ +) *BloxrouteClient { + return &BloxrouteClient{ c: c, endpoint: endpoint, auth: auth, @@ -50,7 +50,7 @@ func NewBloxrouteBundleSender( } } -func (s *BloxrouteBundleSender) Send( +func (s *BloxrouteClient) SendBundle( ctx context.Context, blockNumber uint64, txs ...*types.Transaction, ) (SendBundleResponse, error) { p := new(BLXRSubmitBundleParams).SetBlockNumber(blockNumber).SetTransactions(txs...) diff --git a/pkg/mev/pkg.go b/pkg/mev/pkg.go index 6b0c23a..2c4d9b0 100644 --- a/pkg/mev/pkg.go +++ b/pkg/mev/pkg.go @@ -20,12 +20,12 @@ const ( ) type IBundleSender interface { - Send(ctx context.Context, blockNumber uint64, tx ...*types.Transaction) (SendBundleResponse, error) + SendBundle(ctx context.Context, blockNumber uint64, tx ...*types.Transaction) (SendBundleResponse, error) } var ( - _ IBundleSender = &BundleSender{} - _ IBundleSender = &BloxrouteBundleSender{} + _ IBundleSender = &MEVClient{} + _ IBundleSender = &BloxrouteClient{} ) var defaultHeaders = [][2]string{ // nolint: gochecknoglobals diff --git a/pkg/mev/send_bundle.go b/pkg/mev/send_bundle.go index b6ca04e..2f10f15 100644 --- a/pkg/mev/send_bundle.go +++ b/pkg/mev/send_bundle.go @@ -14,24 +14,24 @@ import ( "github.com/ethereum/go-ethereum/crypto" ) -// BundleSender https://beaverbuild.org/docs.html; https://rsync-builder.xyz/docs; +// MEVClient https://beaverbuild.org/docs.html; https://rsync-builder.xyz/docs; // https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#eth_sendbundle -type BundleSender struct { +type MEVClient struct { c *http.Client endpoint string flashbotKey *ecdsa.PrivateKey } -// NewBundlerSender set the flashbotKey to nil will skip adding the signature header. -func NewBundlerSender(c *http.Client, endpoint string, flashbotKey *ecdsa.PrivateKey) *BundleSender { - return &BundleSender{ +// NewMEVClient set the flashbotKey to nil will skip adding the signature header. +func NewMEVClient(c *http.Client, endpoint string, flashbotKey *ecdsa.PrivateKey) *MEVClient { + return &MEVClient{ c: c, endpoint: endpoint, flashbotKey: flashbotKey, } } -func (s *BundleSender) Send( +func (s *MEVClient) SendBundle( ctx context.Context, blockNumber uint64, txs ...*types.Transaction, ) (SendBundleResponse, error) { req := SendBundleRequest{ diff --git a/pkg/mev/send_bundle_test.go b/pkg/mev/send_bundle_test.go index da50428..521d619 100644 --- a/pkg/mev/send_bundle_test.go +++ b/pkg/mev/send_bundle_test.go @@ -55,8 +55,8 @@ func TestSendBundle(t *testing.T) { t.Log("new tx", signedTx.Hash().String()) - sender := mev.NewBundlerSender(client, endpoint, privateKey) - resp, err := sender.Send(ctx, blockNumber+12, signedTx) + sender := mev.NewMEVClient(client, endpoint, privateKey) + resp, err := sender.SendBundle(ctx, blockNumber+12, signedTx) require.NoError(t, err) // sepolia: code: [-32000], message: [internal server error] t.Log("send bundle response", resp)