Esempio n. 1
0
 public static async Task InvokeScript()
 {
     var client      = new RpcClient(new Uri("http://seed5.neo.org:10332"));
     var scriptHash  = "b951ecbbc5fe37a9c280a76cb0ce0014827294cf";
     var nep5Service = new NeoNep5Service(client, scriptHash);
     var result      = await nep5Service.GetNep5Name();
 }
Esempio n. 2
0
        public NeoApiService(IClient client) : base(client)
        {
            Client = client;

            Accounts      = new NeoApiAccountService(client);
            Assets        = new NeoApiAssetService(client);
            Blocks        = new NeoApiBlockService(client);
            Contracts     = new NeoApiContractService(client);
            TokenStandard = new NeoNep5Service(client);
            Nodes         = new NeoApiNodeService(client);
            Transactions  = new NeoApiTransactionService(client);
        }
Esempio n. 3
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. 4
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. 5
0
 //if you want to use nep5 tranfer method, you need to init this
 public void InitializeNep5Service(string tokenScriptHash)
 {
     _nep5Service = tokenScriptHash.StartsWith("0x") ? new NeoNep5Service(Client, tokenScriptHash.Substring(2)) : new NeoNep5Service(Client, tokenScriptHash);
 }