https://github.com/sugarblock/go-simplex
Go binding for Simplex Wallet API
https://github.com/sugarblock/go-simplex
api go simplex
Last synced: 2 months ago
JSON representation
Go binding for Simplex Wallet API
- Host: GitHub
- URL: https://github.com/sugarblock/go-simplex
- Owner: sugarblock
- License: apache-2.0
- Created: 2022-10-12T20:51:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-21T19:17:09.000Z (over 3 years ago)
- Last Synced: 2024-08-07T21:39:42.799Z (over 1 year ago)
- Topics: api, go, simplex
- Language: Go
- Homepage: https://integrations.simplex.com/reference
- Size: 40 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-simplex
Go binding for Simplex API
## Installation
Use go get.
go get github.com/sugarblock/go-simplex
Then import the go-simplex package into your own code.
import (
"github.com/sugarblock/go-simplex"
v2 "github.com/sugarblock/go-simplex/api/v2"
)
## Usage
Set **apikey** environment variable
```
$ export SIMPLEX_APIKEY=''
```
### GetQuote:
```go
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/sugarblock/go-simplex"
v2 "github.com/sugarblock/go-simplex/api/v2"
)
func main() {
cli, err := simplex.NewEnvClient()
if err != nil {
log.Fatal(err)
}
request := &v2.QuoteRequest{
EndUserId: "11b111d1-161e-32d9-6bda-8dd2b5c8af17",
DigitalCurrency: "BTC",
FiatCurrency: "USD",
RequestedCurrency: "USD",
RequestedAmount: 50,
WalletId: "WalletID",
ClientIp: "1.2.3.4",
}
quote, err := cli.GetQuote(context.TODO(), request)
if err != nil {
log.Fatal(err)
}
json, _ := json.Marshal(quote)
fmt.Println(string(json))
}
```
### GetAllEvent:
```go
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/sugarblock/go-simplex"
)
func main() {
cli, err := simplex.NewEnvClient()
if err != nil {
log.Fatal(err)
}
events, err := cli.GetAllEvents(context.TODO())
if err != nil {
log.Fatal(err)
}
json, _ := json.Marshal(events)
fmt.Println(string(json))
}
```
## License
Apache License 2.0