Example #1
0
        //查询余额
        async Task test_BalanceOf()
        {
            Console.WriteLine("Input target asset:");
            string name = Console.ReadLine();

            Console.WriteLine("Input target address (" + this.address + "):");
            string addr;

            try
            {
                addr = Console.ReadLine();
                if (addr == "\n")
                {
                    addr = this.address;
                }
            }
            catch (Exception e)
            {
                addr = this.address;
            }

            byte[] hash = ThinNeo.Helper.GetPublicKeyHashFromAddress(addr);

            var result = await token_common.api_InvokeScript(Config.tokenized, "balanceOf", "(str)" + name, "(addr)" + addr);

            token_common.ResultItem item = result.value;

            Console.WriteLine(item.subItem[0].AsInteger());
        }
Example #2
0
        //查询标志
        async Task test_symbol()
        {
            Console.WriteLine("Input target asset:");
            string name   = Console.ReadLine();
            var    result = await token_common.api_InvokeScript(Config.tokenized, "symbol", "(str)" + name);

            token_common.ResultItem item = result.value;

            Console.WriteLine(item.subItem[0].AsString());
        }
Example #3
0
        //查询最小单位
        async Task test_decimals()
        {
            Console.WriteLine("Input target asset:");
            string name = Console.ReadLine();

            var result = await token_common.api_InvokeScript(token_common.sc_wneo, "decimals", "(str)" + name);

            token_common.ResultItem item = result.value;

            Console.WriteLine(item.subItem[0].AsInteger());
        }
Example #4
0
        async Task test_getTXInfo()
        {
            Console.WriteLine("Input txid:");
            string txid   = Console.ReadLine();
            var    result = await token_common.api_InvokeScript(Config.tokenized, "getTXInfo", "(hex256)" + txid);

            token_common.ResultItem   item  = result.value;
            token_common.ResultItem[] items = item.subItem[0].subItem;

            //查询交易详细信息
            Console.WriteLine("from:" + ThinNeo.Helper.GetAddressFromScriptHash(items[0].AsHash160()));
            Console.WriteLine("to:" + ThinNeo.Helper.GetAddressFromScriptHash(items[1].AsHash160()));
            Console.WriteLine("value:" + items[2].AsInteger());
        }