mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
parent
d5355acfa9
commit
9e7fca013e
6 changed files with 225 additions and 39 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue