From 8ecb7342ea0b53b8c6bbe0af1474df7d28db6132 Mon Sep 17 00:00:00 2001 From: thanhpp Date: Thu, 11 Jan 2024 10:44:24 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=A9=B9=20mev:=20blxrResponse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: thanhpp --- pkg/mev/bloxroute_submit_bundle.go | 16 ++++++++++++++-- pkg/mev/pkg.go | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pkg/mev/bloxroute_submit_bundle.go b/pkg/mev/bloxroute_submit_bundle.go index 68ff816..8f2b094 100644 --- a/pkg/mev/bloxroute_submit_bundle.go +++ b/pkg/mev/bloxroute_submit_bundle.go @@ -83,7 +83,7 @@ func (s *BloxrouteClient) SendBundle( return SendBundleResponse{}, fmt.Errorf("new http request error: %w", err) } - resp, err := doRequest[SendBundleResponse](s.c, httpReq, [2]string{"Authorization", s.auth}) + resp, err := doRequest[BLXRSubmitBundleResponse](s.c, httpReq, [2]string{"Authorization", s.auth}) if err != nil { return SendBundleResponse{}, err } @@ -93,7 +93,12 @@ func (s *BloxrouteClient) SendBundle( resp.Error.Code, resp.Error.Messange) } - return resp, nil + return SendBundleResponse{ + Jsonrpc: resp.Jsonrpc, + ID: resp.ID, + Result: resp.Result, + Error: resp.Error, + }, nil } type BLXRSubmitBundleRequest struct { @@ -129,6 +134,13 @@ func (p *BLXRSubmitBundleParams) SetBlockNumber(block uint64) *BLXRSubmitBundleP return p } +type BLXRSubmitBundleResponse struct { + Jsonrpc string `json:"jsonrpc,omitempty"` + ID int `json:"id,string,omitempty"` + Result SendBundleResult `json:"result,omitempty"` + Error SendBundbleError `json:"error,omitempty"` +} + func bloxrouteSignFlashbot(key *ecdsa.PrivateKey, p *BLXRSubmitBundleParams) (string, error) { param := new(SendBundleParams) param.Txs = p.Transaction diff --git a/pkg/mev/pkg.go b/pkg/mev/pkg.go index 1ea629f..8b42f2e 100644 --- a/pkg/mev/pkg.go +++ b/pkg/mev/pkg.go @@ -82,7 +82,7 @@ func doRequest[T any](c *http.Client, req *http.Request, headers ...[2]string) ( type SendBundleResponse struct { Jsonrpc string `json:"jsonrpc,omitempty"` - ID int `json:"id,string,omitempty"` + ID int `json:"id,omitempty"` Result SendBundleResult `json:"result,omitempty"` Error SendBundbleError `json:"error,omitempty"` }