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

Commit 04f82fb

Browse files
committed
readme
1 parent ca9e4df commit 04f82fb

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

README.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,41 @@
22

33
Fork of [ethrpc](https://github.com/onrik/ethrpc) with additional [Flashbots RPC methods](https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint):
44

5-
* `FlashbotsGetUserStats`
6-
* `FlashbotsCallBundle`
7-
* `FlashbotsSendBundle`
5+
* `FlashbotsCallBundle` ([`eth_callBundle`](https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint/#eth_callbundle))
6+
* `FlashbotsSendBundle` ([`eth_sendBundle`](https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint/#eth_sendbundle))
7+
* `FlashbotsGetUserStats` ([`flashbots_getUserStats`](https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint/#flashbots_getuserstats))
88
* `FlashbotsSimulateBlock`: simulate a full block
99

1010
## Usage
1111

12+
`go get github.com/metachris/flashbotsrpc`
13+
1214
```go
1315
rpc := flashbotsrpc.New("https://relay.flashbots.net")
1416

1517
// Creating a new private key here for testing, you probably want to use an existing one
1618
privateKey, _ := crypto.GenerateKey()
1719

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)
20+
// flashbots_getUserStats example
21+
// ------------------------------
22+
result, err := rpc.FlashbotsGetUserStats(privateKey, 13281018)
23+
if err != nil {
24+
log.Fatal(err)
2625
}
26+
fmt.Printf("%+v\n", result)
2727

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-
}
28+
// eth_sendBundle example
29+
// ----------------------
30+
sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest{
31+
Txs: []string{"YOUR_HASH"},
32+
BlockNumber: fmt.Sprintf("0x%x", 13281018),
33+
}
3834

39-
// Print result
40-
fmt.Printf("%+v\n", result)
35+
result, err := rpc.FlashbotsSendBundle(privateKey, sendBundleArgs)
36+
if err != nil {
37+
log.Fatal(err)
4138
}
39+
fmt.Printf("%+v\n", result)
4240
```
4341

44-
You can find [more examples in `/examples/`](https://github.com/metachris/flashbotsrpc/tree/master/examples).
42+
You can find example code in the [`/examples/` directory](https://github.com/metachris/flashbotsrpc/tree/master/examples).

0 commit comments

Comments
 (0)