From 8388f4a55ea5bbd3f5cdb57154e5d191d2c9db88 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 3 Sep 2019 18:14:19 +0300 Subject: [PATCH] rpc: unexport methods returning internal structures Golint: pkg/rpc/rpc.go:15:67: exported method GetBlock returns unexported type *rpc.response, which can be annoying to use pkg/rpc/rpc.go:82:64: exported method GetRawTransaction returns unexported type *rpc.response, which can be annoying to use pkg/rpc/rpc.go:97:52: exported method SendRawTransaction returns unexported type *rpc.response, which can be annoying to use Refs. #213. --- pkg/rpc/rpc.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/rpc/rpc.go b/pkg/rpc/rpc.go index b2cf38953..272952f82 100644 --- a/pkg/rpc/rpc.go +++ b/pkg/rpc/rpc.go @@ -10,9 +10,9 @@ import ( "github.com/pkg/errors" ) -// GetBlock returns a block by its hash or index/height. If verbose is true +// getBlock returns a block by its hash or index/height. If verbose is true // the response will contain a pretty Block object instead of the raw hex string. -func (c *Client) GetBlock(indexOrHash interface{}, verbose bool) (*response, error) { +func (c *Client) getBlock(indexOrHash interface{}, verbose bool) (*response, error) { var ( params = newParams(indexOrHash) resp = &response{} @@ -78,8 +78,8 @@ func (c *Client) Invoke(script string, params []smartcontract.Parameter) (*Invok return resp, nil } -// GetRawTransaction queries a transaction by hash. -func (c *Client) GetRawTransaction(hash string, verbose bool) (*response, error) { +// getRawTransaction queries a transaction by hash. +func (c *Client) getRawTransaction(hash string, verbose bool) (*response, error) { var ( params = newParams(hash, verbose) resp = &response{} @@ -90,11 +90,11 @@ func (c *Client) GetRawTransaction(hash string, verbose bool) (*response, error) return resp, nil } -// SendRawTransaction broadcasts a transaction over the NEO network. +// sendRawTransaction broadcasts a transaction over the NEO network. // The given hex string needs to be signed with a keypair. // When the result of the response object is true, the TX has successfully // been broadcasted to the network. -func (c *Client) SendRawTransaction(rawTX string) (*response, error) { +func (c *Client) sendRawTransaction(rawTX string) (*response, error) { var ( params = newParams(rawTX) resp = &response{} @@ -132,7 +132,7 @@ func (c *Client) SendToAddress(asset util.Uint256, address string, amount util.F return nil, errors.Wrap(err, "failed to encode raw transaction to binary for `sendtoaddress`") } rawTxStr = hex.EncodeToString(buf.Bytes()) - if resp, err = c.SendRawTransaction(rawTxStr); err != nil { + if resp, err = c.sendRawTransaction(rawTxStr); err != nil { return nil, errors.Wrap(err, "failed to send raw transaction") } response.Error = resp.Error