Exemple #1
0
        public async Task Test_GetScoreApi()
        {
            var getScoreApi = new GetScoreApi(Consts.ApiUrl.TestNet);
            var scoreApi    = await getScoreApi.Invoke("cx0000000000000000000000000000000000000001");

            Assert.Greater(scoreApi.Length, 0);
        }
Exemple #2
0
        public async Task Test_Call()
        {
            var getScoreApi = new GetScoreApi(Consts.ApiUrl.TestNet);
            var scoreApi    = await getScoreApi.Invoke("cx0000000000000000000000000000000000000001");

            Console.WriteLine(JsonConvert.SerializeObject(scoreApi, Formatting.Indented));

            var privateKey = PrivateKey.Random();
            var address    = Addresser.Create(privateKey);

            var call   = new Call(Consts.ApiUrl.TestNet);
            var result = await call.Invoke(
                address,
                "cx0000000000000000000000000000000000000001",
                "isDeployer",
                ("address", address)
                );

            // 0x0
            Console.WriteLine(result);

            var call0   = new Call <bool>(Consts.ApiUrl.TestNet);
            var result0 = await call0.Invoke(
                address,
                "cx0000000000000000000000000000000000000001",
                "isDeployer",
                ("address", address)
                );

            // false
            Console.WriteLine(result0);

            var call1   = new Call <IsDeployerRequestParam, bool>(Consts.ApiUrl.TestNet);
            var result1 = await call1.Invoke(
                address,
                "cx0000000000000000000000000000000000000001",
                "isDeployer",
                new IsDeployerRequestParam()
            {
                Address = address
            }
                );

            // false
            Console.WriteLine(result1);

            var call2   = new Call <BigInteger>(Consts.ApiUrl.TestNet);
            var result2 = await call2.Invoke(
                address,
                "cx0000000000000000000000000000000000000001",
                "getStepPrice"
                );

            Console.WriteLine(result2);

            var call3   = new Call <GetRevisionResponseParam>(Consts.ApiUrl.TestNet);
            var result3 = await call3.Invoke(
                address,
                "cx0000000000000000000000000000000000000001",
                "getRevision"
                );

            Console.WriteLine(result3.Code);
            Console.WriteLine(result3.Name);

            var call4   = new Call <Dictionary <string, BigInteger> >(Consts.ApiUrl.TestNet);
            var result4 = await call4.Invoke(
                address,
                "cx0000000000000000000000000000000000000001",
                "getStepCosts"
                );

            Console.WriteLine(JsonConvert.SerializeObject(result4));
        }