Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeauchamp authored Feb 12, 2023
1 parent f895c4f commit 104b87d
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,55 @@
# Go Defined.fi API Client

A client library for accessing Defined.fi graphql api
A client library for accessing [Defined.fi's](www.defined.fi) realtime graphql api

## Installation

```bash
go get -u github.com/dbeauchamp/go-defined
```

## Usage
You'll need a Defined API Key. See instructions here: [defined docs](www.defined.fi)

```go
package main

import (
"fmt"
"os"

"github.com/dbeauchamp/go-defined/pkg/wsclient"
)

func main() {
// Your api key
ws := wsclient.New(os.Getenv("DEFINED_API_KEY"))

// Subscribe to events
msgCh, doneCh, err := ws.SubscribeToPairEvents(
wsclient.PairEventsSubscriptionArgs{
Id: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1", // WETH/USDC
},
)
if err != nil {
...
}

// Do something fun!
for msg := range *msgCh {
fmt.Println(*msg.Maker)
}

// Unsubscribe
*doneCh <- struct{}{}

// Close connection
ws.Close()
}
```

## License
MIT

## Contributing
Contributions are welcome!

0 comments on commit 104b87d

Please sign in to comment.