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:
parent
1fd5e5928c
commit
8388f4a55e
1 changed files with 7 additions and 7 deletions
|
@ -10,9 +10,9 @@ import (
|
||||||
"github.com/pkg/errors"
|
"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.
|
// 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 (
|
var (
|
||||||
params = newParams(indexOrHash)
|
params = newParams(indexOrHash)
|
||||||
resp = &response{}
|
resp = &response{}
|
||||||
|
@ -78,8 +78,8 @@ func (c *Client) Invoke(script string, params []smartcontract.Parameter) (*Invok
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRawTransaction queries a transaction by hash.
|
// getRawTransaction queries a transaction by hash.
|
||||||
func (c *Client) GetRawTransaction(hash string, verbose bool) (*response, error) {
|
func (c *Client) getRawTransaction(hash string, verbose bool) (*response, error) {
|
||||||
var (
|
var (
|
||||||
params = newParams(hash, verbose)
|
params = newParams(hash, verbose)
|
||||||
resp = &response{}
|
resp = &response{}
|
||||||
|
@ -90,11 +90,11 @@ func (c *Client) GetRawTransaction(hash string, verbose bool) (*response, error)
|
||||||
return resp, nil
|
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.
|
// The given hex string needs to be signed with a keypair.
|
||||||
// When the result of the response object is true, the TX has successfully
|
// When the result of the response object is true, the TX has successfully
|
||||||
// been broadcasted to the network.
|
// been broadcasted to the network.
|
||||||
func (c *Client) SendRawTransaction(rawTX string) (*response, error) {
|
func (c *Client) sendRawTransaction(rawTX string) (*response, error) {
|
||||||
var (
|
var (
|
||||||
params = newParams(rawTX)
|
params = newParams(rawTX)
|
||||||
resp = &response{}
|
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`")
|
return nil, errors.Wrap(err, "failed to encode raw transaction to binary for `sendtoaddress`")
|
||||||
}
|
}
|
||||||
rawTxStr = hex.EncodeToString(buf.Bytes())
|
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")
|
return nil, errors.Wrap(err, "failed to send raw transaction")
|
||||||
}
|
}
|
||||||
response.Error = resp.Error
|
response.Error = resp.Error
|
||||||
|
|
Loading…
Reference in a new issue