@page "/WebAPI"
@page "/WebAPI/{Smart:int}"
    @using HyperCube.Models;
    <h3>WebAPI</h3>
    @Smart

    @code
{
        protected override async Task OnInitializedAsync()
        {
            Console.WriteLine($"WebAPI OnInitializedAsync {Smart}");
        }

        protected override async Task OnParametersSetAsync()
        {
            //Console.WriteLine($"WebAPI OnParametersSetAsync {Smart}");
            await Transfer50();
        }

        private async Task Transfer50()
        {
            //var acc = AccountModel.Find("5bb2a8ba-ed92-4eff-9eca-985483568b77");
            var acc = AccountModel.FindByMail("valafar@mail.ru");
            if (acc != null)
            {
                AccountModel.Current = acc;
                Console.WriteLine("acc found "+acc.Name);
                var bc = Blockchain.GetMain();
                if (bc != null)
                {
                    //Console.WriteLine("bc found, Smart "+ Smart);
                    var addr = await acc.GetOrCreateActualAddress(bc);
                    var res = await bc.SendTransaction(Blockchain.GetMain().address, addr, Smart);
                }
                else
                    Console.WriteLine("bc null ");
            }
            else
                Console.WriteLine("account null ");
        }


        [Parameter]
        public int Smart { get; set; }



        async Task<string> Verify()
        {
            Console.WriteLine($"Verify starting");
            try
            {


                //VerifyContract verifyContract = SmartContract.Find("Verify", Blockchain.GetMain()) as VerifyContract;
                //if (verifyContract != null)
                //{
                //    Console.WriteLine($"VerifyContract found");
                //    transactionId = await verifyContract.Run(articleModel);
                //    return transactionId;
                //}
                //else
                //    Console.WriteLine($"VerifyContract null");

            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "stack trace" + e.StackTrace);
            }
            return "Verify failed";
        }

    }