Skip to content

Commit

Permalink
docs(readme): add working example of the SDK (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Georges Francois <[email protected]>
  • Loading branch information
0xpanoramix committed Dec 4, 2023
1 parent 0a48ae9 commit c271633
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,35 @@ go get github.com/quartz-technology/redax-go

### 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 !_

```go
package test

import (
"context"
"fmt"
"testing"

"github.com/quartz-technology/redax-go/relay"
"github.com/quartz-technology/redax-go/sdk"
"github.com/stretchr/testify/require"
)

func TestRedaxSDK(t *testing.T) {
client, err := relay.NewClient(relay.WithAPIURL("https://boost-relay.flashbots.net"))
require.NoError(t, err)

relaySDK := sdk.NewRelaySDK(client)

// Get the bids delivered.
bidsDelivered, err := relaySDK.Data().V1().GetBidsDelivered(context.Background(), nil)
require.NoError(t, err)

// Print the first bid's value.
fmt.Println(bidsDelivered[0].Value.String())
}
```

### API

Expand Down

0 comments on commit c271633

Please sign in to comment.