public WalletNameSection(
            HopeWalletInfoManager hopeWalletInfoManager,
            WalletPasswordVerification walletPasswordVerification,
            ContactsManager contactsManager,
            DynamicDataCache dynamicDataCache,
            UserWalletManager userWalletManager,
            SettingsPopupAnimator settingsPopupAnimator,
            GameObject currentPasswordSection,
            GameObject walletNameSection,
            GameObject loadingIcon,
            HopeInputField currentPasswordField,
            HopeInputField currentWalletNameField,
            HopeInputField newWalletNameField,
            Button nextButton,
            Button saveButton,
            GameObject[] hopeOnlyCategoryButtons)
        {
            this.hopeWalletInfoManager      = hopeWalletInfoManager;
            this.walletPasswordVerification = walletPasswordVerification;
            this.contactsManager            = contactsManager;
            this.dynamicDataCache           = dynamicDataCache;
            this.settingsPopupAnimator      = settingsPopupAnimator;
            this.currentPasswordSection     = currentPasswordSection;
            this.walletNameSection          = walletNameSection;
            this.loadingIcon             = loadingIcon;
            this.currentPasswordField    = currentPasswordField;
            this.currentWalletNameField  = currentWalletNameField;
            this.newWalletNameField      = newWalletNameField;
            this.nextButton              = nextButton;
            this.saveButton              = saveButton;
            this.hopeOnlyCategoryButtons = hopeOnlyCategoryButtons;

            walletInfo = hopeWalletInfoManager.GetWalletInfo(userWalletManager.GetWalletAddress());
            SetListeners();
        }
Example #2
0
    public void Construct(
        PlayerPrefPasswordDerivation playerPrefPasswordDerivation,
        UserWalletManager userWalletManager,
        HopeWalletInfoManager hopeWalletInfoManager,
        WalletPasswordVerification walletPasswordVerification,
        ContactsManager contactsManager,
        DynamicDataCache dynamicDataCache,
        ButtonClickObserver buttonClickObserver,
        CurrencyManager currencyManager,
        LogoutHandler logoutHandler)
    {
        this.playerPrefPasswordDerivation = playerPrefPasswordDerivation;
        this.userWalletManager            = userWalletManager;
        this.hopeWalletInfoManager        = hopeWalletInfoManager;
        this.walletPasswordVerification   = walletPasswordVerification;
        this.contactsManager     = contactsManager;
        this.dynamicDataCache    = dynamicDataCache;
        this.buttonClickObserver = buttonClickObserver;
        this.currencyManager     = currencyManager;
        this.logoutHandler       = logoutHandler;

        buttonClickObserver.SubscribeObservable(this);
        defaultCurrencyOptions.ButtonClicked((int)currencyManager.ActiveCurrency);

        walletName = hopeWalletInfoManager.GetWalletInfo(userWalletManager.GetWalletAddress()).WalletName;

        deleteWalletButton.onClick.AddListener(() => popupManager.GetPopup <GeneralOkCancelPopup>(true)
                                               .SetSubText($"Are you sure you want to delete wallet '{walletName}'?\nThis cannot be undone!")
                                               .OnOkClicked(() => DeleteWallet(userWalletManager, hopeWalletInfoManager, logoutHandler))
                                               .DisableEnterButton());
    }
 /// <summary>
 /// Initializes the <see cref="WalletDecryptor"/> with the references to needed objects.
 /// </summary>
 /// <param name="playerPrefPassword"> The <see cref="PlayerPrefPasswordDerivation"/> object used to encrypt the wallet data. </param>
 /// <param name="dynamicDataCache"> The <see cref="DynamicDataCache"/> used for retrieving the number of the wallet we are decrypting. </param>
 /// <param name="walletSettings"> The settings for the <see cref="HopeWallet"/>. </param>
 public WalletDecryptor(
     PlayerPrefPasswordDerivation playerPrefPassword,
     DynamicDataCache dynamicDataCache)
 {
     this.playerPrefPassword = playerPrefPassword;
     this.dynamicDataCache   = dynamicDataCache;
 }
        public PasswordSection(
            PlayerPrefPasswordDerivation playerPrefPasswordDerivation,
            UserWalletManager userWalletManager,
            HopeWalletInfoManager hopeWalletInfoManager,
            DynamicDataCache dynamicDataCache,
            SettingsPopupAnimator settingsPopupAnimator,
            HopeInputField newPasswordField,
            HopeInputField confirmPasswordField,
            Button saveButton,
            GameObject loadingIcon)
        {
            this.playerPrefPasswordDerivation = playerPrefPasswordDerivation;
            this.hopeWalletInfoManager        = hopeWalletInfoManager;
            this.dynamicDataCache             = dynamicDataCache;
            this.settingsPopupAnimator        = settingsPopupAnimator;
            this.newPasswordField             = newPasswordField;
            this.confirmPasswordField         = confirmPasswordField;
            this.saveButton  = saveButton;
            this.loadingIcon = loadingIcon;

            walletEncryptor = new WalletEncryptor(playerPrefPasswordDerivation, dynamicDataCache);
            walletDecryptor = new WalletDecryptor(playerPrefPasswordDerivation, dynamicDataCache);
            walletInfo      = hopeWalletInfoManager.GetWalletInfo(userWalletManager.GetWalletAddress());

            newPasswordField.OnInputUpdated     += _ => PasswordsUpdated();
            confirmPasswordField.OnInputUpdated += _ => PasswordsUpdated();
            saveButton.onClick.AddListener(SavePasswordButtonClicked);
        }
    /// <summary>
    /// Initializes the UserWallet given the settings to apply.
    /// </summary>
    /// <param name="playerPrefPasswordDerivation"> The active PlayerPrefPasswordDerivation. </param>
    /// <param name="ethereumPendingTransactionManager"> The active EthereumPendingTransactionManager. </param>
    /// <param name="disposableComponentManager"> The active DisposableComponentManager. </param>
    /// <param name="popupManager"> The PopupManager to assign to the wallet. </param>
    /// <param name="ethereumNetworkManager"> The active EthereumNetworkManager to assign to the wallet. </param>
    /// <param name="dynamicDataCache"> The active DynamicDataCache. </param>
    /// <param name="ledgerWallet"> The active LedgerWallet. </param>
    /// <param name="trezorWallet"> The active TrezorWallet. </param>
    /// <param name="userWalletInfoManager"> The active UserWalletInfoManager. </param>
    public UserWalletManager(
        PlayerPrefPasswordDerivation playerPrefPasswordDerivation,
        EthereumPendingTransactionManager ethereumPendingTransactionManager,
        PopupManager popupManager,
        EthereumNetworkManager ethereumNetworkManager,
        DynamicDataCache dynamicDataCache,
        LedgerWallet ledgerWallet,
        TrezorWallet trezorWallet,
        HopeWalletInfoManager userWalletInfoManager)
    {
        this.ethereumPendingTransactionManager = ethereumPendingTransactionManager;
        this.popupManager = popupManager;

        this.ledgerWallet = ledgerWallet;
        this.trezorWallet = trezorWallet;

        hopeWallet   = new HopeWallet(playerPrefPasswordDerivation, popupManager, ethereumNetworkManager, dynamicDataCache, userWalletInfoManager);
        activeWallet = hopeWallet;

        ledgerWallet.OnWalletLoadSuccessful   += () => OnWalletLoadSuccessful?.Invoke();
        ledgerWallet.OnWalletLoadUnsuccessful += () => OnWalletLoadUnsuccessful?.Invoke();
        trezorWallet.OnWalletLoadSuccessful   += () => OnWalletLoadSuccessful?.Invoke();
        trezorWallet.OnWalletLoadUnsuccessful += () => OnWalletLoadUnsuccessful?.Invoke();
        hopeWallet.OnWalletLoadSuccessful     += () => OnWalletLoadSuccessful?.Invoke();
        hopeWallet.OnWalletLoadUnsuccessful   += () => OnWalletLoadUnsuccessful?.Invoke();
    }
    public void Construct(
        CurrencyManager currencyManager,
        UserWalletManager userWalletManager,
        TradableAssetManager tradableAssetManager,
        TradableAssetPriceManager tradableAssetPriceManager,
        EthereumTransactionButtonManager ethereumTransactionButtonManager,
        EtherBalanceObserver etherBalanceObserver,
        GasPriceObserver gasPriceObserver,
        UpdateManager updateManager,
        DynamicDataCache dynamicDataCache,
        PeriodicUpdateManager periodicUpdateManager,
        ContactsManager contactsManager,
        ButtonClickObserver buttonClickObserver,
        RestrictedAddressManager restrictedAddressManager)
    {
        this.ethereumTransactionButtonManager = ethereumTransactionButtonManager;
        this.userWalletManager   = userWalletManager;
        this.dynamicDataCache    = dynamicDataCache;
        this.buttonClickObserver = buttonClickObserver;

        Asset   = new AssetManager(tradableAssetManager, etherBalanceObserver, updateManager, assetSymbol, assetBalance, assetImage);
        Gas     = new GasManager(tradableAssetManager, tradableAssetPriceManager, currencyManager, gasPriceObserver, periodicUpdateManager, advancedModeToggle, transactionSpeedSlider, gasLimitField, gasPriceField, transactionFee);
        Address = new AddressManager(addressField, contactName, contactsManager, restrictedAddressManager);
        Amount  = new AmountManager(currencyManager, tradableAssetPriceManager, maxToggle, maxText, amountField, currencyText, oppositeCurrencyAmountText, currencyButton, assetSymbol.text);

        Gas.SetupDependencies(Amount);
        Amount.SetupDependencies(Gas, Asset);

        simpleModeSelectableFields.Add(addressField.InputFieldBase);
        simpleModeSelectableFields.Add(amountField.InputFieldBase);

        advancedModeSelectableFields.AddRange(simpleModeSelectableFields);
        advancedModeSelectableFields.Add(gasLimitField.InputFieldBase);
        advancedModeSelectableFields.Add(gasPriceField.InputFieldBase);
    }
 /// <summary>
 /// Initializes the WalletUnlocker with all required references.
 /// </summary>
 /// <param name="popupManager"> The active PopupManager. </param>
 /// <param name="playerPrefPassword"> The PlayerPrefPassword used to encrypt the wallet. </param>
 /// <param name="dynamicDataCache"> The active DynamicDataCache. </param>
 /// <param name="hopeWalletInfoManager"> The active HopeWalletInfoManager. </param>
 public WalletUnlocker(
     PopupManager popupManager,
     PlayerPrefPasswordDerivation playerPrefPassword,
     DynamicDataCache dynamicDataCache,
     HopeWalletInfoManager hopeWalletInfoManager) : base(popupManager, playerPrefPassword, dynamicDataCache, hopeWalletInfoManager)
 {
     walletDecryptor = new WalletDecryptor(playerPrefPassword, dynamicDataCache);
 }
 /// <summary>
 /// Initializes the WalletLoaderBase with all required references.
 /// </summary>
 /// <param name="popupManager"> The active PopupManager. </param>
 /// <param name="playerPrefPassword"> The PlayerPrefPassword used to encrypt the wallet. </param>
 /// <param name="dynamicDataCache"> The active DynamicDataCache. </param>
 /// <param name="hopeWalletInfoManager"> The active UserWalletInfoManager. </param>
 protected WalletLoaderBase(
     PopupManager popupManager,
     PlayerPrefPasswordDerivation playerPrefPassword,
     DynamicDataCache dynamicDataCache,
     HopeWalletInfoManager hopeWalletInfoManager)
 {
     this.popupManager          = popupManager;
     this.playerPrefPassword    = playerPrefPassword;
     this.dynamicDataCache      = dynamicDataCache;
     this.hopeWalletInfoManager = hopeWalletInfoManager;
 }
Example #9
0
 /// <summary>
 /// Initializes the LogoutHandler.
 /// </summary>
 /// <param name="uiManager"> The active UIManager component. </param>
 /// <param name="popupManager"> The active PopupManager. </param>
 /// <param name="disposableComponentManager"> The active DisposableComponentManager. </param>
 /// <param name="dynamicDataCache"> The active DynamicDataCache. </param>
 public LogoutHandler(
     UIManager uiManager,
     PopupManager popupManager,
     DisposableComponentManager disposableComponentManager,
     DynamicDataCache dynamicDataCache)
 {
     this.uiManager    = uiManager;
     this.popupManager = popupManager;
     this.disposableComponentManager = disposableComponentManager;
     this.dynamicDataCache           = dynamicDataCache;
 }
Example #10
0
 public void Construct(
     WalletButton.Factory walletButtonFactory,
     DynamicDataCache dynamicDataCache,
     HopeWalletInfoManager hopeWalletInfoManager,
     Settings settings)
 {
     this.walletButtonFactory   = walletButtonFactory;
     this.dynamicDataCache      = dynamicDataCache;
     this.hopeWalletInfoManager = hopeWalletInfoManager;
     this.settings = settings;
 }
    /// <summary>
    /// Initializes the <see cref="WalletTransactionSigner"/> by assigning all references.
    /// </summary>
    /// <param name="playerPrefPassword"> The <see cref="PlayerPrefPasswordDerivation"/> instance to assign to the <see cref="WalletDecryptor"/>. </param>
    /// <param name="dynamicDataCache"> The active <see cref="DynamicDataCache"/> to assign to the <see cref="WalletDecryptor"/>. </param>
    /// <param name="ethereumNetworkManager"> The active <see cref="EthereumNetworkManager"/>. </param>
    /// <param name="passwordEncryptor"> The <see cref="MemoryEncryptor"/> instance used to encrypt the password. </param>
    /// <param name="hopeWalletInfoManager"> The active <see cref="HopeWalletInfoManager"/>. </param>
    public WalletTransactionSigner(
        PlayerPrefPasswordDerivation playerPrefPassword,
        DynamicDataCache dynamicDataCache,
        EthereumNetworkManager ethereumNetworkManager,
        MemoryEncryptor passwordEncryptor,
        HopeWalletInfoManager hopeWalletInfoManager)
    {
        this.ethereumNetworkManager = ethereumNetworkManager;
        this.passwordEncryptor      = passwordEncryptor;
        this.hopeWalletInfoManager  = hopeWalletInfoManager;

        walletDecryptor = new WalletDecryptor(playerPrefPassword, dynamicDataCache);
    }
 public void Construct(
     TradableAssetManager tradableAssetManager,
     TradableAssetImageManager tradableAssetImageManager,
     HopeWalletInfoManager userWalletInfoManager,
     DynamicDataCache dynamicDataCache,
     ContactsManager contactsManager)
 {
     this.tradableAssetManager      = tradableAssetManager;
     this.tradableAssetImageManager = tradableAssetImageManager;
     this.userWalletInfoManager     = userWalletInfoManager;
     this.dynamicDataCache          = dynamicDataCache;
     this.contactsManager           = contactsManager;
 }
    public void Construct(DynamicDataCache dynamicDataCache,
                          HopeWalletInfoManager hopeWalletInfoManager,
                          ButtonClickObserver buttonClickObserver)
    {
        this.dynamicDataCache      = dynamicDataCache;
        this.hopeWalletInfoManager = hopeWalletInfoManager;
        this.buttonClickObserver   = buttonClickObserver;

        if (hopeWalletInfoManager.WalletCount == 0)
        {
            ComingFromChooseWalletMenu = true;
        }
    }
Example #14
0
 public void Construct(
     UIManager uiManager,
     UserWalletManager userWalletManager,
     DynamicDataCache dynamicDataCache,
     ButtonClickObserver buttonClickObserver,
     WalletPasswordVerification walletPasswordVerification)
 {
     this.uiManager                  = uiManager;
     this.userWalletManager          = userWalletManager;
     this.dynamicDataCache           = dynamicDataCache;
     this.buttonClickObserver        = buttonClickObserver;
     this.walletPasswordVerification = walletPasswordVerification;
 }
Example #15
0
    /// <summary>
    /// Initializes the UserWallet with the PlayerPrefPassword object.
    /// </summary>
    /// <param name="prefPassword"> The PlayerPrefPassword object used for managing the wallet's encryption password. </param>
    /// <param name="popupManager"> The active PopupManager. </param>
    /// <param name="ethereumNetworkManager"> The active EthereumNetworkManager. </param>
    /// <param name="dynamicDataCache"> The active ProtectedStringDataCache. </param>
    /// <param name="hopeWalletInfoManager"> The active HopeWalletInfoManager. </param>
    public HopeWallet(PlayerPrefPasswordDerivation prefPassword,
                      PopupManager popupManager,
                      EthereumNetworkManager ethereumNetworkManager,
                      DynamicDataCache dynamicDataCache,
                      HopeWalletInfoManager hopeWalletInfoManager)
    {
        this.popupManager     = popupManager;
        this.dynamicDataCache = dynamicDataCache;

        passwordEncryptor       = new MemoryEncryptor(this);
        walletCreator           = new WalletCreator(popupManager, prefPassword, dynamicDataCache, hopeWalletInfoManager);
        walletUnlocker          = new WalletUnlocker(popupManager, prefPassword, dynamicDataCache, hopeWalletInfoManager);
        walletTransactionSigner = new WalletTransactionSigner(prefPassword, dynamicDataCache, ethereumNetworkManager, passwordEncryptor, hopeWalletInfoManager);
    }
Example #16
0
    public void Construct(
        HopeWalletInfoManager hopeWalletInfoManager,
        UserWalletManager userWalletManager,
        WalletPasswordVerification walletPasswordVerification,
        LogoutHandler logoutHandler,
        DynamicDataCache dynamicDataCache,
        ButtonClickObserver buttonClickObserver)
    {
        this.walletPasswordVerification = walletPasswordVerification;
        this.logoutHandler       = logoutHandler;
        this.dynamicDataCache    = dynamicDataCache;
        this.buttonClickObserver = buttonClickObserver;

        walletName     = hopeWalletInfoManager.GetWalletInfo(userWalletManager.GetWalletAddress()).WalletName;
        formTitle.text = walletName;

        SetMessageText();

        (dynamicDataCache.GetData("pass") as ProtectedString)?.SetValue(RandomBytes.Secure.SHA3.GetBytes(16));
    }
 public void Construct(DynamicDataCache dynamicDataCache, ButtonClickObserver buttonClickObserver)
 {
     this.dynamicDataCache    = dynamicDataCache;
     this.buttonClickObserver = buttonClickObserver;
 }
Example #18
0
 public void Construct(ButtonClickObserver buttonObserver, DynamicDataCache dynamicDataCache)
 {
     this.buttonObserver   = buttonObserver;
     this.dynamicDataCache = dynamicDataCache;
 }
Example #19
0
 public void Construct(DynamicDataCache dynamicDataCache) => this.dynamicDataCache = dynamicDataCache;
 /// <summary>
 /// Initializes the WalletPasswordVerification instance with the wallet settings and data cache.
 /// </summary>
 /// <param name="hopeWalletInfoManager"> The active HopeWalletInfoManager. </param>
 /// <param name="dynamicDataCache"> The active DynamicDataCache. </param>
 public WalletPasswordVerification(HopeWalletInfoManager hopeWalletInfoManager, DynamicDataCache dynamicDataCache)
 {
     this.hopeWalletInfoManager = hopeWalletInfoManager;
     this.dynamicDataCache      = dynamicDataCache;
 }
Example #21
0
 public void Construct(PopupManager popupManager, DynamicDataCache dynamicDataCache)
 {
     this.popupManager     = popupManager;
     this.dynamicDataCache = dynamicDataCache;
 }