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.
This commit is contained in:
Roman Khimov 2019-09-03 18:14:19 +03:00
parent 1fd5e5928c
commit 8388f4a55e

View file

@ -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