Ejemplo n.º 1
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());
    }
Ejemplo n.º 2
0
    /// <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();
    }
Ejemplo n.º 3
0
 /// <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);
        }
Ejemplo n.º 5
0
 /// <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);
 }
Ejemplo n.º 6
0
 /// <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;
 }
    /// <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);
    }
Ejemplo n.º 8
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);
    }