File tree Expand file tree Collapse file tree 3 files changed +9
-32
lines changed
public/samples/DataFeeds/SVR Expand file tree Collapse file tree 3 files changed +9
-32
lines changed Original file line number Diff line number Diff line change 1- type MevBundle struct {
2- Hash common.Hash
3- Tx []byte
4- CanRevert bool
5- }
6-
7- type Inclusion struct {
8- Block * big.Int
9- MaxBlock * big.Int
10- }
11-
12- type BundleParams struct {
13- Body []MevBundle
14- inclusion Inclusion
15- }
1+ import "github.com/flashbots/mev-share-node/mevshare"
162
173// ... create and sign your transaction
184tx := types.NewTransaction (... )
195signedTx , err := types.SignTx (tx , ... )
206txBytes := signedTx .MarshalBinary ()
217
22- bundle := []MevBundle {
8+ bundle := []mevshare. MevBundleBody {
239 {
24- Hash : event .EventHash ,
10+ Hash : & event .EventHash ,
2511 },
2612 {
2713 Tx : & txBytes ,
2814 CanRevert : false ,
2915 },
3016}
3117
32- params := BundleParams {
18+ params := mevshare. SendMevBundleArgs {
3319 Body : bundle ,
34- Inclusion : Inclusion {blockNumber , blockNumber + 1 },
20+ Inclusion : mevshare. MevBundleInclusion {blockNumber , blockNumber + 1 },
3521}
3622
3723byteParams , err := json.Marshal (params )
Original file line number Diff line number Diff line change 1- decoded , err := hex .DecodeString (strings .TrimPrefix (strings .ToLower (tx .CallData ), "0x" ))
1+ decoded , err := hex .DecodeString (strings .TrimPrefix (strings .ToLower (tx .CallData . String () ), "0x" ))
22contractAddress := "0x" + strings .ToLower (strings .TrimLeft (hex .EncodeToString (decoded [4 :36 ]), "0" ))
33
44ff := strings .ToLower (strings .TrimLeft (hex .EncodeToString (decoded [100 :104 ]), "0" ))
Original file line number Diff line number Diff line change 1- type MevShareEvent struct {
2- Hash common.Hash `json:"hash"`
3- Txs []PendingTransaction `json:"txs"`
4- }
5-
6- type PendingTransaction struct {
7- To common.Address `json:"to"`
8- FunctionSelector string `json:"functionSelector"`
9- CallData string `json:"callData"`
10- }
1+ import "github.com/flashbots/mev-share-node/mevshare"
112
123req , err := http .NewRequestWithContext (
134 ctx ,
@@ -18,12 +9,12 @@ req, err := http.NewRequestWithContext(
189
1910// ... read the event data from the response
2011
21- var event MevShareEvent
12+ var event mevshare. Hint
2213err := json .Unmarshal (responseData , & event )
2314
2415// ... check if tx is calling the forward method
2516if strings .Compare (
26- strings .ToLower (tx .FunctionSelector ),
17+ strings .ToLower (tx .FunctionSelector . String () ),
2718 "0x6fadcf72" ,
2819) != 0 {
2920 continue
You can’t perform that action at this time.
0 commit comments