public void TestRpcInvokeResult() { JObject json = TestUtils.RpcTestCases.Find(p => p.Name == nameof(RpcClient.InvokeFunctionAsync).ToLower()).Response.Result; var item = RpcInvokeResult.FromJson(json); Assert.AreEqual(json.ToString(), item.ToJson().ToString()); }
/// <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() }; parameters.AddRange(scriptHashesForVerifying.Select(p => (JObject)p.ToString())); return(RpcInvokeResult.FromJson(RpcSend("invokescript", parameters.ToArray()))); }
/// <summary> /// Returns the result after passing a script through the VM. /// This RPC call does not affect the blockchain in any way. /// </summary> public async Task <RpcInvokeResult> InvokeScriptAsync(byte[] script, params Signer[] signers) { List <JObject> parameters = new() { Convert.ToBase64String(script) }; if (signers.Length > 0) { parameters.Add(signers.Select(p => p.ToJson()).ToArray()); } var result = await RpcSendAsync(GetRpcName(), parameters.ToArray()).ConfigureAwait(false); return(RpcInvokeResult.FromJson(result)); }
/// <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 async Task <RpcInvokeResult> InvokeFunctionAsync(string scriptHash, string operation, RpcStack[] stacks, params Signer[] signer) { List <JObject> parameters = new() { scriptHash.AsScriptHash(), operation, stacks.Select(p => p.ToJson()).ToArray() }; if (signer.Length > 0) { parameters.Add(signer.Select(p => p.ToJson()).ToArray()); } var result = await RpcSendAsync(GetRpcName(), parameters.ToArray()).ConfigureAwait(false); return(RpcInvokeResult.FromJson(result)); }
/// <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()))); }
/// <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 Signer[] signers) { List <JObject> parameters = new List <JObject> { script.ToHexString() }; if (signers.Length > 0) { parameters.Add(signers.Select(p => p.ToJson()).ToArray()); } return(RpcInvokeResult.FromJson(RpcSend("invokescript", parameters.ToArray()))); }
/// <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 address, string function, RpcStack[] stacks) { return(RpcInvokeResult.FromJson(RpcSend("invokefunction", address, function, stacks.Select(p => p.ToJson()).ToArray()))); }
/// <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(string script) { return(RpcInvokeResult.FromJson(RpcSend("invokescript", script))); }
/// <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) { return(RpcInvokeResult.FromJson(RpcSend("invokescript", script.ToHexString()))); }
/// <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) { return(RpcInvokeResult.FromJson(RpcSend("invokefunction", scriptHash, operation, stacks.Select(p => p.ToJson()).ToArray()))); }