This repository was archived by the owner on Oct 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-15
lines changed Expand file tree Collapse file tree 2 files changed +26
-15
lines changed Original file line number Diff line number Diff line change @@ -12,17 +12,33 @@ Fork of [ethrpc](https://github.com/onrik/ethrpc) with additional [Flashbots RPC
12
12
``` go
13
13
rpc := flashbotsrpc.New (" https://relay.flashbots.net" )
14
14
15
- // Creating a new private key here for testing; you probably would want to use an existing one
16
- privateKey , _ := crypto.GenerateKey ()
15
+ // Creating a new private key here for testing, you probably want to use an existing one
16
+ privateKey , _ := crypto.GenerateKey ()
17
17
18
- // Query relay for user stats
19
- result , err := rpc.FlashbotsGetUserStats (privateKey, 13281018 )
20
- if err != nil {
21
- log.Fatal (err)
18
+ func getUserStats () {
19
+ result , err := rpc.FlashbotsGetUserStats (privateKey, 13281018 )
20
+ if err != nil {
21
+ log.Fatal (err)
22
+ }
23
+
24
+ // Print result
25
+ fmt.Printf (" %+v \n " , result)
22
26
}
23
27
24
- // Print result
25
- fmt.Printf (" %+v \n " , result)
28
+ func sendBundle () {
29
+ sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest {
30
+ Txs: []string {" YOUR_HASH" },
31
+ BlockNumber: fmt.Sprintf (" 0x%x " , 13281018 ),
32
+ }
33
+
34
+ result , err := rpc.FlashbotsSendBundle (privateKey, sendBundleArgs)
35
+ if err != nil {
36
+ log.Fatal (err)
37
+ }
38
+
39
+ // Print result
40
+ fmt.Printf (" %+v \n " , result)
41
+ }
26
42
```
27
43
28
44
You can find [ more examples in ` /examples/ ` ] ( https://github.com/metachris/flashbotsrpc/tree/master/examples ) .
Original file line number Diff line number Diff line change @@ -12,13 +12,8 @@ var privateKey, _ = crypto.GenerateKey() // creating a new private key for testi
12
12
func main () {
13
13
rpc := flashbotsrpc .New ("https://relay.flashbots.net" )
14
14
15
- sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest {
16
- Txs : []string {"0x02f9019d011e843b9aca008477359400830247fa94def1c0ded9bec7f1a1670819833240f027b25eff88016345785d8a0000b90128d9627aa40000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000001394b63b2cbaea253a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f869584cd00000000000000000000000086003b044f70dac0abc80ac8957305b6370893ed0000000000000000000000000000000000000000000000d3443651ba615f6cd6c001a011a9f58ebe30aa679783b31793f897fdb603dd2ea086845723a22dae85ab2864a0090cf1fcce0f6e85da54f4eccf32a485d71a7d39bc0b43a53a9e64901c656230" },
17
- // BlockNumber: fmt.Sprintf("0x%x", blockNumber),
18
- BlockNumber : "13281018" ,
19
- }
20
-
21
- result , err := rpc .FlashbotsSendBundle (privateKey , sendBundleArgs )
15
+ // Query relay for user stats
16
+ result , err := rpc .FlashbotsGetUserStats (privateKey , 13281018 )
22
17
if err != nil {
23
18
panic (err )
24
19
}
You can’t perform that action at this time.
0 commit comments