diff --git a/docs/rpc.md b/docs/rpc.md index 045dc83db..f4189d80b 100644 --- a/docs/rpc.md +++ b/docs/rpc.md @@ -70,6 +70,10 @@ key in the server which doesn't fit the model of our node-client interactions. Lacking this signature the transaction is almost useless, so there is no point in returning it. +It's possible to use `invokefunction` not only with contract scripthash, but also +with contract name (for native contracts) or contract ID (for all contracts). This +feature is not supported by the C# node. + Both methods also don't currently support arrays in function parameters. ##### `getunclaimedgas` diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index d820d8332..92ef4b7d9 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -984,9 +984,9 @@ func (s *Server) getCommittee(_ request.Params) (interface{}, *response.Error) { // invokeFunction implements the `invokeFunction` RPC call. func (s *Server) invokeFunction(reqParams request.Params) (interface{}, *response.Error) { - scriptHash, err := reqParams.ValueWithType(0, request.StringT).GetUint160FromHex() - if err != nil { - return nil, response.ErrInvalidParams + scriptHash, responseErr := s.contractScriptHashFromParam(reqParams.Value(0)) + if responseErr != nil { + return nil, responseErr } tx := &transaction.Transaction{} checkWitnessHashesIndex := len(reqParams)