123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- @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)
- {
- Console.WriteLine("acc found "+acc.Name);
- var bc = await acc.GetSelectedBlockChain();
- if (bc != null)
- {
- //Console.WriteLine("bc found, Smart "+ Smart);
- var addr = await acc.GetOrCreateActualAddress(bc);
- var res = await bc.SendTransaction(bc.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";
- }
- }
|