rpc: allow to get contract scripthash from address, id or name [Server]
... for `invokefunction` RPC method.
This commit is contained in:
parent
15a939b1da
commit
d3daaafbe4
2 changed files with 7 additions and 3 deletions
|
@ -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`
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue