Skip to content

Commit

Permalink
Use a public type for easier accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Mar 28, 2022
1 parent 8be86f7 commit fb395c5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
const (

// version is the current version
version = "v0.10.0"
version = "v0.10.1"

// defaultUserAgent is the default user agent for all requests
defaultUserAgent string = "go-whatsonchain: " + version
Expand Down
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestNewClient_CustomHTTPClient(t *testing.T) {
func ExampleNewClient() {
client := NewClient(NetworkTest, nil, nil)
fmt.Println(client.UserAgent())
// Output:go-whatsonchain: v0.10.0
// Output:go-whatsonchain: v0.10.1
}

// BenchmarkNewClient benchmarks the NewClient method
Expand Down
2 changes: 1 addition & 1 deletion interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type TransactionService interface {

// WebsocketService is the WhatsOnCHain websocket related clients
type WebsocketService interface {
NewMempoolWebsocket(handler socketHandler) *centrifuge.Client
NewMempoolWebsocket(handler SocketHandler) *centrifuge.Client
}

// ClientInterface is the WhatsOnChain client interface
Expand Down
10 changes: 5 additions & 5 deletions websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ const (
socketEndpointMempool = "mempool"
)

// socketHandler describe the interface
type socketHandler interface {
// SocketHandler describe the interface
type SocketHandler interface {
OnConnect(*centrifuge.Client, centrifuge.ConnectEvent)
OnError(*centrifuge.Client, centrifuge.ErrorEvent)
OnDisconnect(*centrifuge.Client, centrifuge.DisconnectEvent)
OnError(*centrifuge.Client, centrifuge.ErrorEvent)
OnMessage(*centrifuge.Client, centrifuge.MessageEvent)
OnServerPublish(*centrifuge.Client, centrifuge.ServerPublishEvent)
}

// NewMempoolWebsocket instantiates a new websocket client to stream mempool transactions
func (c *Client) NewMempoolWebsocket(handler socketHandler) *centrifuge.Client {
func (c *Client) NewMempoolWebsocket(handler SocketHandler) *centrifuge.Client {
return newWebsocketClient(socketEndpoint+socketEndpointMempool, handler)
}

// newWebsocketClient will create a new websocket client
func newWebsocketClient(url string, handler socketHandler) (client *centrifuge.Client) {
func newWebsocketClient(url string, handler SocketHandler) (client *centrifuge.Client) {
if url == "" || handler == nil {
return
}
Expand Down
4 changes: 2 additions & 2 deletions websocket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (h *testHandler) OnError(_ *centrifuge.Client, _ centrifuge.ErrorEvent) {

func TestClient_NewMempoolWebsocket(t *testing.T) {
type args struct {
handler socketHandler
handler SocketHandler
}
tests := []struct {
name string
Expand All @@ -55,7 +55,7 @@ func TestClient_NewMempoolWebsocket(t *testing.T) {
func Test_newWebsocketClient(t *testing.T) {
type args struct {
url string
handler socketHandler
handler SocketHandler
}
tests := []struct {
name string
Expand Down

0 comments on commit fb395c5

Please sign in to comment.