Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit ca9e4df

Browse files
committed
cleanup
1 parent 2d9448d commit ca9e4df

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,33 @@ Fork of [ethrpc](https://github.com/onrik/ethrpc) with additional [Flashbots RPC
1212
```go
1313
rpc := flashbotsrpc.New("https://relay.flashbots.net")
1414

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()
1717

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)
2226
}
2327

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+
}
2642
```
2743

2844
You can find [more examples in `/examples/`](https://github.com/metachris/flashbotsrpc/tree/master/examples).

examples/userstats/main.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@ var privateKey, _ = crypto.GenerateKey() // creating a new private key for testi
1212
func main() {
1313
rpc := flashbotsrpc.New("https://relay.flashbots.net")
1414

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)
2217
if err != nil {
2318
panic(err)
2419
}

0 commit comments

Comments
 (0)