/// <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);
    }
Exemplo n.º 2
0
    public void Construct(DynamicDataCache dynamicDataCache,
                          HopeWalletInfoManager hopeWalletInfoManager,
                          ButtonClickObserver buttonClickObserver)
    {
        this.dynamicDataCache      = dynamicDataCache;
        this.hopeWalletInfoManager = hopeWalletInfoManager;
        this.buttonClickObserver   = buttonClickObserver;

        if (hopeWalletInfoManager.WalletCount == 0)
        {
            ComingFromChooseWalletMenu = true;
        }
    }
 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;
 }
Exemplo n.º 4
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);
    }
    public void Construct(
        TradableAssetManager tradableAssetManager,
        TradableAssetImageManager tradableAssetImageManager,
        ContactsManager contactsManager,
        UserWalletManager userWalletManager,
        HopeWalletInfoManager userWalletInfoManager,
        Hodler hodler)
    {
        this.tradableAssetManager      = tradableAssetManager;
        this.tradableAssetImageManager = tradableAssetImageManager;
        this.contactsManager           = contactsManager;
        this.hodler = hodler;

        walletAddress = userWalletManager.GetWalletAddress();
        walletName    = userWalletManager.ActiveWalletType == UserWalletManager.WalletType.Hope ? userWalletInfoManager.GetWalletInfo(walletAddress).WalletName : userWalletManager.ActiveWalletType.ToString();
    }
Exemplo n.º 6
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));
    }
Exemplo n.º 7
0
    /// <summary>
    /// Adds contact under the newly created wallet name and address
    /// </summary>
    /// <param name="userWalletManager"> The active UserWalletManager </param>
    /// <param name="userWalletInfoManager"> The active UserWalletInfoManager </param>
    /// <param name="settings"> The settings for the ContactsManager. </param>
    /// <param name="networkSettings"> The settings for the EthereumNetworkManager. </param>
    public ContactsManager(
        UserWalletManager userWalletManager,
        HopeWalletInfoManager userWalletInfoManager,
        EthereumNetworkManager.Settings networkSettings)
    {
        UserWalletManager.OnWalletLoadSuccessful += () =>
        {
            ContactList = new SecurePlayerPrefList <ContactInfo>(PlayerPrefConstants.CONTACT_LIST, (int)networkSettings.networkType);

            var walletAddress = userWalletManager.GetWalletAddress();

            if (!ContactList.Contains(walletAddress.ToLower()))
            {
                var info = userWalletInfoManager.GetWalletInfo(walletAddress);

                if (!string.IsNullOrEmpty(info?.WalletName))
                {
                    AddContact(walletAddress.ToLower(), info.WalletName);
                }
            }
        };
    }
 /// <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;
 }