Ejemplo n.º 1
0
        /*invoke destory(single signer)*/
        public void InvokeDestroyNormal1()
        {
            Console.WriteLine("********************************");
            Console.WriteLine("Destroy(normal- > single signer)");
            RpcStack[] emptyRpcStack = new RpcStack[] { };
            Signer[]   signers       = new[]
            {
                new Signer
                {
                    Account = UInt160.Parse("0xf642a0401fdd56a03114639a98b7963eb587a30a"),
                    Scopes  = WitnessScope.CalledByEntry
                }
            };
            var rpcInvokeResult = rpcClient.InvokeFunctionAsync("0x254b9decd76080ef368e7a6b0a065938dfbc31cf", "destroy", emptyRpcStack, signers);
            var destroy         = rpcInvokeResult.Result.ToJson();

            Console.WriteLine("result: " + destroy);
            Console.WriteLine("********************************");
            Console.WriteLine();
        }
Ejemplo n.º 2
0
        /*invoke destory(exeception case)*/
        public void InvokeDestroyAbnormal()
        {
            Console.WriteLine("********************************");
            Console.WriteLine("Destroy(exeception -> signer is not owner)");
            RpcStack[] emptyRpcStack = new RpcStack[] { };
            Signer[]   signers       = new[]
            {
                new Signer
                {
                    Account = UInt160.Parse("0x9f2dd7df630980dce111d3b31ebe35d3cfae58cd"),
                    Scopes  = WitnessScope.CalledByEntry
                }
            };
            var rpcInvokeResult = rpcClient.InvokeFunctionAsync("0x254b9decd76080ef368e7a6b0a065938dfbc31cf", "destroy", emptyRpcStack, signers);
            var destroy         = rpcInvokeResult.Result.ToJson();

            Console.WriteLine("result: " + destroy);
            Console.WriteLine("********************************");
            Console.WriteLine();
        }
Ejemplo n.º 3
0
        public async Task TestInvokeFunction()
        {
            var test   = TestUtils.RpcTestCases.Find(p => p.Name == nameof(rpc.InvokeFunctionAsync).ToLower());
            var result = await rpc.InvokeFunctionAsync(test.Request.Params[0].AsString(), test.Request.Params[1].AsString(),
                                                       ((JArray)test.Request.Params[2]).Select(p => RpcStack.FromJson(p)).ToArray());

            Assert.AreEqual(test.Response.Result.ToString(), result.ToJson().ToString());

            // TODO test verify method
        }
Ejemplo n.º 4
0
        public void TestInvokeFunction()
        {
            var test   = TestUtils.RpcTestCases.Find(p => p.Name == nameof(rpc.InvokeFunction).ToLower());
            var result = rpc.InvokeFunction(test.Request.Params[0].AsString(), test.Request.Params[1].AsString(),
                                            ((JArray)test.Request.Params[2]).Select(p => RpcStack.FromJson(p)).ToArray());

            Assert.AreEqual(test.Response.Result.ToString(), result.ToJson().ToString());
        }