public async Task HandleRestore(WebWalletRestoreAction action, IDispatcher dispatcher) { try { var store = new AccountInMemoryStorage(); var name = Guid.NewGuid().ToString(); Wallet.Create(store, name, "", config["network"], action.privateKey); var wallet = Wallet.Open(store, name, ""); if (action.selfVote) { wallet.VoteFor = wallet.AccountId; } await wallet.Sync(client); dispatcher.Dispatch(new WebWalletResultAction(wallet, true, UIStage.Main)); } catch (Exception ex) { dispatcher.Dispatch(new WebWalletResultAction(null, false, UIStage.Entry)); } }
public static WebWalletState RestoreWalletActionHandler(WebWalletState state, WebWalletRestoreAction action) => state.With(new { IsLoading = true });