Skip to content

Commit

Permalink
fix: 🩹 mev: blxrResponse
Browse files Browse the repository at this point in the history
Signed-off-by: thanhpp <[email protected]>
  • Loading branch information
thanhpp committed Jan 11, 2024
1 parent 32257f1 commit 8ecb734
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions pkg/mev/bloxroute_submit_bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -93,7 +93,12 @@ func (s *BloxrouteClient) SendBundle(
resp.Error.Code, resp.Error.Messange)
}

return resp, nil
return SendBundleResponse{

Check failure on line 96 in pkg/mev/bloxroute_submit_bundle.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

S1016: should convert resp (type BLXRSubmitBundleResponse) to SendBundleResponse instead of using struct literal (gosimple)
Jsonrpc: resp.Jsonrpc,
ID: resp.ID,
Result: resp.Result,
Error: resp.Error,
}, nil
}

type BLXRSubmitBundleRequest struct {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/mev/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down

0 comments on commit 8ecb734

Please sign in to comment.