예제 #1
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();
    }
예제 #2
0
 public void Construct(
     EthereumTransactionManager ethereumTransactionManager,
     EthereumNetworkManager.Settings ethereumNetworkSettings,
     EthereumPendingTransactionManager ethereumPendingTransactionManager,
     TokenContractManager tokenContractManager,
     TradableAssetManager tradableAssetManager,
     TradableAssetPriceManager tradableAssetPriceManager,
     TradableAssetNotificationManager notificationManager,
     LockedPRPSManager lockedPrpsManager,
     PRPS prpsContract,
     CurrencyManager currencyManager,
     HopeWalletInfoManager hopeWalletInfoManager,
     UserWalletManager userWalletManager,
     LogoutHandler logoutHandler)
 {
     this.ethereumNetworkSettings           = ethereumNetworkSettings;
     this.ethereumTransactionManager        = ethereumTransactionManager;
     this.ethereumPendingTransactionManager = ethereumPendingTransactionManager;
     this.tokenContractManager      = tokenContractManager;
     this.tradableAssetManager      = tradableAssetManager;
     this.tradableAssetPriceManager = tradableAssetPriceManager;
     this.notificationManager       = notificationManager;
     this.lockedPrpsManager         = lockedPrpsManager;
     this.prpsContract          = prpsContract;
     this.currencyManager       = currencyManager;
     this.hopeWalletInfoManager = hopeWalletInfoManager;
     this.userWalletManager     = userWalletManager;
     this.logoutHandler         = logoutHandler;
 }
예제 #3
0
        /// <summary>
        /// Sets the necessary variables needed for the pending transaction section
        /// </summary>
        /// <param name="ethereumNetworkSettings"> The active ethereum network settings. </param>
        /// <param name="ethereumPendingTransactionManager"> The active EthereumPendingTransactionManager. </param>
        /// <param name="userWalletManager"> The active UserWalletManager. </param>
        /// <param name="pendingTransactionSection"> The parent transform of the pending transaction section. </param>
        /// <param name="walletLogo"> The active wallet logo button. </param>
        /// /// <param name="logoutHandler"> The active LogoiutHandler. </param>
        public PendingTransactionManager(
            EthereumNetworkManager.Settings ethereumNetworkSettings,
            EthereumPendingTransactionManager ethereumPendingTransactionManager,
            UserWalletManager userWalletManager,
            Transform pendingTransactionSection,
            Button walletLogo)
        {
            this.ethereumNetworkSettings           = ethereumNetworkSettings;
            this.ethereumPendingTransactionManager = ethereumPendingTransactionManager;
            this.userWalletManager = userWalletManager;

            this.pendingTransactionSection = pendingTransactionSection.gameObject;
            this.walletLogo = walletLogo;

            statusIcon                     = pendingTransactionSection.GetChild(0).GetComponent <Image>();
            statusIconAnimator             = statusIcon.GetComponent <LoadingIconAnimator>();
            pendingTransactionText         = pendingTransactionSection.GetChild(1).GetComponent <TextMeshProUGUI>();
            pendingTransactionTextAnimator = pendingTransactionText.GetComponent <LoadingTextAnimator>();
            transactionHashText            = pendingTransactionSection.GetChild(2).GetComponent <TextMeshProUGUI>();
            viewOnBrowserButton            = pendingTransactionSection.GetChild(3).GetComponent <Button>();
            triangle   = pendingTransactionSection.GetChild(4).gameObject;
            exitButton = pendingTransactionSection.GetChild(5).GetComponent <Button>();
            exitButton.onClick.AddListener(TransactionPopupExited);
            logoAnimator = walletLogo.GetComponent <LoadingIconAnimator>();

            SetSprite(ref loadingIconSprite, "Loading_Icon");
            SetSprite(ref checkmarkIconSprite, "Checkmark_Icon");
            SetSprite(ref errorIconSprite, "Error_Icon");

            viewOnBrowserButton.onClick.AddListener(ViewOnBrowserClicked);

            ethereumPendingTransactionManager.OnNewTransactionPending   += TransactionStarted;
            ethereumPendingTransactionManager.OnTransactionSuccessful   += OnTransactionSuccessful;
            ethereumPendingTransactionManager.OnTransactionUnsuccessful += OnTransactionUnsuccessful;
            AccountsPopup.OnAccountChanged += _ => AccountChanged();
        }
예제 #4
0
 /// <summary>
 /// Initializes the <see cref="EthUtils"/> by assigning the reference to the active network.
 /// </summary>
 /// <param name="ethereumNetworkManager"> The active <see cref="global::EthereumNetworkManager"/>. </param>
 /// <param name="ethereumPendingTransactionManager"> The active <see cref="EthereumPendingTransactionManager"/>. </param>
 public EthUtils(EthereumNetworkManager ethereumNetworkManager, EthereumPendingTransactionManager ethereumPendingTransactionManager)
 {
     EthereumNetworkManager            = ethereumNetworkManager;
     EthereumPendingTransactionManager = ethereumPendingTransactionManager;
 }
예제 #5
0
 /// <summary>
 /// Initializes the EthTransactionPromise with the pending transaction manager.
 /// </summary>
 /// <param name="ethereumPendingTransactionManager"> The active EthereumPendingTransactionManager. </param>
 /// <param name="addressFrom"> The address the transaction was sent from. </param>
 /// <param name="message"> The message representing the transaction. </param>
 public EthTransactionPromise(EthereumPendingTransactionManager ethereumPendingTransactionManager, string addressFrom, string message)
 {
     this.ethereumPendingTransactionManager = ethereumPendingTransactionManager;
     this.addressFrom = addressFrom;
     this.message     = message;
 }