(Engine) Variety of engine updates (#390)

* drop common uuid v4 func and imported package as needed

* removed common functions regarding json marshal and unmarshal and used the json package directly. WRT unmarshal it was calling reflect and converted to string which is also checked in the JSON package so it was doing a double up, this will be a tiny gain as it was directly used in the requester package for all our outbound requests.

* add in string

* explicitly throw away return error value

* atleast return the error that websocket initialise returns

* return error when not connected

* fix comment

* Adds comments

* move package declarations

* drop append whenever we call supported

* remove unused import

* Change incorrect spelling

* fix tests

* fix go import issue
This commit is contained in:
Ryan O'Hara-Reid
2019-12-03 10:06:08 +11:00
committed by Adrian Gallagher
parent c27b8657e2
commit 0c5d75b22c
70 changed files with 393 additions and 462 deletions

View File

@@ -305,7 +305,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method, path string, params map[str
var err error
if params != nil {
PayloadJSON, err = common.JSONEncode(req)
PayloadJSON, err = json.Marshal(req)
if err != nil {
return err
}
@@ -317,7 +317,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method, path string, params map[str
n := i.Requester.GetNonce(true).String()
timestamp := strconv.FormatInt(time.Now().UnixNano()/1000000, 10)
message, err := common.JSONEncode([]string{method, urlPath, string(PayloadJSON), n, timestamp})
message, err := json.Marshal([]string{method, urlPath, string(PayloadJSON), n, timestamp})
if err != nil {
return err
}
@@ -354,7 +354,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method, path string, params map[str
return err
}
err = common.JSONDecode(intermediary, &errCheck)
err = json.Unmarshal(intermediary, &errCheck)
if err == nil {
if errCheck.Code != 0 || errCheck.Description != "" {
return fmt.Errorf("itbit.go SendAuthRequest error code: %d description: %s",
@@ -363,7 +363,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method, path string, params map[str
}
}
return common.JSONDecode(intermediary, result)
return json.Unmarshal(intermediary, result)
}
// GetFee returns an estimate of fee based on type of transaction