示例#1
0
        /// <summary>
        /// Returns the result after passing a script through the VM.
        /// This RPC call does not affect the blockchain in any way.
        /// </summary>
        public RpcInvokeResult InvokeScript(byte[] script, params UInt160[] scriptHashesForVerifying)
        {
            List <JObject> parameters = new List <JObject> {
                script.ToHexString()
            };

            if (scriptHashesForVerifying.Length > 0)
            {
                parameters.Add(scriptHashesForVerifying.Select(p => (JObject)p.ToString()).ToArray());
            }
            return(RpcInvokeResult.FromJson(RpcSend("invokescript", parameters.ToArray())));
        }
示例#2
0
        /// <summary>
        /// Returns the result after calling a smart contract at scripthash with the given operation and parameters.
        /// This RPC call does not affect the blockchain in any way.
        /// </summary>
        public RpcInvokeResult InvokeFunction(string scriptHash, string operation, RpcStack[] stacks, params UInt160[] scriptHashesForVerifying)
        {
            List <JObject> parameters = new List <JObject> {
                scriptHash, operation, stacks.Select(p => p.ToJson()).ToArray()
            };

            if (scriptHashesForVerifying.Length > 0)
            {
                parameters.Add(scriptHashesForVerifying.Select(p => (JObject)p.ToString()).ToArray());
            }
            return(RpcInvokeResult.FromJson(RpcSend("invokefunction", parameters.ToArray())));
        }