Skip to content

Commit 27481ee

Browse files
committed
Add ability to request panic sell
1 parent 18dc963 commit 27481ee

21 files changed

Lines changed: 1678 additions & 4 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212
*.out
1313

1414
# Dependency directories (remove the comment below to include it)
15-
# vendor/
15+
vendor/
16+
bin/
17+
examples/secrets.go

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Cryptwire
3+
Copyright (c) 2021 Cryptwire (Pty) Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
# gogocryptohopper
2-
A Go client for working with the Cryptohopper API
1+
# GoGoCryptohopper
2+
3+
A [Go](https://golang.org/) client for working with the [Cryptohopper API](https://www.cryptohopper.com/api-documentation)
4+
5+
## Structure of the client
6+
7+
### Request/Response
8+
9+
The definitions for request and response formats are located in `/pkg` and
10+
can be used independently of the client itself.
11+
12+
## Examples
13+
14+
See the examples folder for code samples.
15+
16+
Example: if you'd like to run the fetch Hoppers sample. You will need to define
17+
the access token variable which needs to contain a valid Cryptohopper access
18+
token
19+
20+
```go
21+
go run examples/hopper.go
22+
```
23+
24+
## Licence
25+
26+
MIT
27+
28+
## Contact
29+
30+
Twitter: [@cryptwireapp](https://twitter.com/cryptwireapp)

examples/authentication.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/cryptwire/gogocryptohopper"
7+
"github.com/cryptwire/gogocryptohopper/pkg"
8+
)
9+
10+
func main() {
11+
fmt.Println("Example: Authentication")
12+
13+
ch, err := gogocryptohopper.New(
14+
"https://www.cryptohopper.com",
15+
"https://api.cryptohopper.com/v1",
16+
"accessToken")
17+
if err != nil {
18+
panic(err)
19+
}
20+
21+
tokenExchangeRequest := pkg.TokenExchangeRequest{
22+
ClientID: "your client ID",
23+
ClientSecret: "your client secret",
24+
GrantType: "authorization_code", // This must be authorization_code
25+
RedirectURI: "https://www.your.com/redirect/url",
26+
GrantCode: "your grant code",
27+
}
28+
29+
token, err := ch.ExchangeGrantToken(tokenExchangeRequest)
30+
if err != nil {
31+
panic(err)
32+
}
33+
34+
fmt.Println("AccessToken: ", token.AccessToken)
35+
fmt.Println("ExpiresIn: ", token.ExpiresIn)
36+
fmt.Println("TokenType: ", token.TokenType)
37+
fmt.Println("Scope: ", token.Scope)
38+
fmt.Println("RefreshToken: ", token.RefreshToken)
39+
40+
}

0 commit comments

Comments
 (0)