Esempio n. 1
0
        // Block api demonstration
        //private static async Task BlockApiTest(NeoApiService service)
        //{

        //    }


        //var transaction = await service.Transactions.SendAssets.SendRequestAsync("c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "AeVCBqABbAwzdqp9e7LoYvEBf4rkphFvpc", -1);


        //var addresses = await service.Accounts.ListAddresses.SendRequestAsync();



        //WalletBalance balance = await service.Accounts.GetBalance.SendRequestAsync();

        //wrap with access denied exception handling
        //try
        //{
        //    string newAddress = await service.Accounts.GetNewAddress.SendRequestAsync();
        //}
        //catch (Exception ex)
        //{

        //}



        //Block genesisBlock = await service.Blocks.GetBlock.SendRequestAsync(10200); // Get genesis block by index (can pass a string with block hash as parameter too)
        //string bestBlockHash = await service.Blocks.GetBestBlockHash.SendRequestAsync();
        //int blockCount = await service.Blocks.GetBlockCount.SendRequestAsync();
        //string blockHash = await service.Blocks.GetBlockHash.SendRequestAsync(0);
        //string serializedBlock = await service.Blocks.GetBlockSerialized.SendRequestAsync(0);
        //string blockFee = await service.Blocks.GetBlockSysFee.SendRequestAsync(0);

        //}

        // Nep5 api demonstration
        private static async Task TestNep5Service(NeoNep5Service nep5Service)
        {
            var name = await nep5Service.GetName();

            var decimals = await nep5Service.GetDecimals();

            var totalsupply = await nep5Service.GetTotalSupply(decimals);

            var symbol = await nep5Service.GetSymbol();

            var balance = await nep5Service.GetBalance("0x0ff9070d64d19076d08947ba4a82b72709f30baf", decimals);

            Debug.WriteLine($"Token info: \nName: {name} \nSymbol: {symbol} \nDecimals: {decimals} \nTotalSupply: {totalsupply} \nBalance: {balance}");
        }
Esempio n. 2
0
        // Nep5 api demonstration
        private static async Task TestNep5Service(NeoNep5Service nep5Service)
        {
            var name = await nep5Service.GetName("ed07cffad18f1308db51920d99a2af60ac66a7b3", true);

            var decimals = await nep5Service.GetDecimals("ed07cffad18f1308db51920d99a2af60ac66a7b3");

            var totalsupply = await nep5Service.GetTotalSupply("ed07cffad18f1308db51920d99a2af60ac66a7b3", 8);

            var symbol = await nep5Service.GetSymbol("ed07cffad18f1308db51920d99a2af60ac66a7b3", true);

            var balance = await nep5Service.GetBalance("ed07cffad18f1308db51920d99a2af60ac66a7b3",
                                                       "0x3640b023405b4b9c818e8387bd01f67bba04dad2", 8);

            Debug.WriteLine(
                $"Token info: \nName: {name} \nSymbol: {symbol} \nDecimals: {decimals} \nTotalSupply: {totalsupply} \nBalance: {balance}");
        }
Esempio n. 3
0
        public async Task <string> GetNep5Symbol(string tokenScriptHash = null)
        {
            if (_nep5Service == null)
            {
                throw new ArgumentNullException($"NEP5 service not configured");
            }
            if (!string.IsNullOrEmpty(tokenScriptHash))
            {
                ChangeNep5ServiceToken(tokenScriptHash);
            }

            var result = await _nep5Service.GetSymbol();

            if (string.IsNullOrEmpty(result))
            {
                return(string.Empty);
            }

            return(result.HexToString());
        }