rpc: update CLI and RPC client invoke* calls

part of #1036
This commit is contained in:
Anna Shaleva 2020-06-11 11:45:17 +03:00
parent d5355acfa9
commit 9e7fca013e
6 changed files with 225 additions and 39 deletions

View file

@ -338,11 +338,16 @@ func (c *Client) GetVersion() (*result.Version, error) {
// InvokeScript returns the result of the given script after running it true the VM.
// NOTE: This is a test invoke and will not affect the blockchain.
func (c *Client) InvokeScript(script string) (*result.Invoke, error) {
func (c *Client) InvokeScript(script string, cosigners []transaction.Cosigner) (*result.Invoke, error) {
var (
params = request.NewRawParams(script)
params request.RawParams
resp = &result.Invoke{}
)
if cosigners != nil {
params = request.NewRawParams(script, cosigners)
} else {
params = request.NewRawParams(script)
}
if err := c.performRequest("invokescript", params, resp); err != nil {
return nil, err
}
@ -352,11 +357,16 @@ func (c *Client) InvokeScript(script string) (*result.Invoke, error) {
// InvokeFunction returns the results after calling the smart contract scripthash
// with the given operation and parameters.
// NOTE: this is test invoke and will not affect the blockchain.
func (c *Client) InvokeFunction(script, operation string, params []smartcontract.Parameter) (*result.Invoke, error) {
func (c *Client) InvokeFunction(script, operation string, params []smartcontract.Parameter, cosigners []transaction.Cosigner) (*result.Invoke, error) {
var (
p = request.NewRawParams(script, operation, params)
p request.RawParams
resp = &result.Invoke{}
)
if cosigners != nil {
p = request.NewRawParams(script, operation, params, cosigners)
} else {
p = request.NewRawParams(script, operation, params)
}
if err := c.performRequest("invokefunction", p, resp); err != nil {
return nil, err
}