Skip to content

Commit

Permalink
docs: update readme (#2)
Browse files Browse the repository at this point in the history
* docs(readme): add supported endpoints

Signed-off-by: Luca Georges Francois <[email protected]>

* docs(examples): add simple example

Signed-off-by: Luca Georges Francois <[email protected]>

* docs(readme): update examples section

Signed-off-by: Luca Georges Francois <[email protected]>

---------

Signed-off-by: Luca Georges Francois <[email protected]>
  • Loading branch information
0xpanoramix authored Dec 3, 2023
1 parent 12e3cd7 commit 7123c9b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,42 @@ To install the SDK in your own go project, run the following command:

### Examples

_Coming soon ! For now, you can refer to the tests to get a basic understanding of how the SDK
works._
_More examples will come soon ! You can find the existing examples in the [`examples`](./examples)
directory of this repository._

Below is an example of the SDK usage with the default HTTP client:
```rust
use redax_rs::sdk::data::v1::GetBidsDeliveredRequest;
use redax_rs::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let clt = relay::RelayClient::new()?.with_api_url("https://boost-relay.flashbots.net")?;
let relay_sdk = sdk::RelaySDK::new(clt);

// Get the bids delivered.
let bids_delivered = relay_sdk
.data()
.v1()
.get_bids_delivered(GetBidsDeliveredRequest::default())
.await?;

// Print the first bid's value.
println!("{:?}", bids_delivered[0].bid_trace.value.to_string());

Ok(())
}
```

### API

Below is a list of the supported API endpoints:

| Name | Status |
|:--------------------------------------------------------|:--------:|
| `/relay/v1/data/bidtraces/proposer_payload_delivered` | |
| `/relay/v1/data/bidtraces/builder_blocks_received` | |
| `/relay/v1/data/validator_registration` | |
| `/relay/v1/data/bidtraces/proposer_payload_delivered` | |
| `/relay/v1/data/bidtraces/builder_blocks_received` | |
| `/relay/v1/data/validator_registration` | |

## Issues

Expand Down
20 changes: 20 additions & 0 deletions examples/simple.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use redax_rs::sdk::data::v1::GetBidsDeliveredRequest;
use redax_rs::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let clt = relay::RelayClient::new()?.with_api_url("https://boost-relay.flashbots.net")?;
let relay_sdk = sdk::RelaySDK::new(clt);

// Get the bids delivered.
let bids_delivered = relay_sdk
.data()
.v1()
.get_bids_delivered(GetBidsDeliveredRequest::default())
.await?;

// Print the first bid's value.
println!("{:?}", bids_delivered[0].bid_trace.value.to_string());

Ok(())
}

0 comments on commit 7123c9b

Please sign in to comment.