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;
 }
    public TradableAssetNotificationManager(
        EthereumNetworkManager.Settings networkSettings,
        DisposableComponentManager disposableComponentManager,
        UserWalletManager userWalletManager,
        TradableAssetManager tradableAssetManager,
        EthereumTransactionManager ethereumTransactionManager,
        LockedPRPSManager lockedPrpsManager,
        PRPS prpsContract)
    {
        this.networkSettings            = networkSettings;
        this.userWalletManager          = userWalletManager;
        this.ethereumTransactionManager = ethereumTransactionManager;
        this.lockedPrpsManager          = lockedPrpsManager;
        this.prpsContract = prpsContract;

        disposableComponentManager.AddDisposable(this);

        UserWalletManager.OnWalletLoadSuccessful += LoadNewNotificationList;

        tradableAssetManager.OnTradableAssetAdded   += AssetAdded;
        tradableAssetManager.OnTradableAssetRemoved += AssetRemoved;

        ethereumTransactionManager.OnTransactionsAdded += TransactionsUpdated;
        lockedPrpsManager.OnLockedPRPSUpdated          += TransactionsUpdated;
    }
 /// <summary>
 /// Initializes the TrezorWallet by passing all info to the base HardwareWallet class.
 /// </summary>
 /// <param name="ethereumNetworkManager"> The active EthereumNetworkManager. </param>
 /// <param name="ethereumNetworkSettings"> The settings for the EthereumNetworkManager. </param>
 /// <param name="popupManager"> The active PopupManager. </param>
 /// <param name="uiManager"> The active UIManager. </param>
 public TrezorWallet(
     EthereumNetworkManager ethereumNetworkManager,
     EthereumNetworkManager.Settings ethereumNetworkSettings,
     PopupManager popupManager,
     UIManager uiManager) : base(ethereumNetworkManager, ethereumNetworkSettings, popupManager)
 {
     this.uiManager = uiManager;
 }
Beispiel #4
0
 public TokenListManager(
     TokenContractManager tokenContractManager,
     PRPS prps,
     DUBI dubi,
     EthereumNetworkManager.Settings ethereumNetworkSettings)
 {
     Initialize(tokenContractManager, prps, dubi, ethereumNetworkSettings);
     ethereumNetworkSettings.OnNetworkChanged += _ => Initialize(tokenContractManager, prps, dubi, ethereumNetworkSettings);
 }
 /// <summary>
 /// Initializes the HardwareWallet instance.
 /// </summary>
 /// <param name="ethereumNetworkManager"> The active EthereumNetworkManager. </param>
 /// <param name="ethereumNetworkSettings"> The settings for the EthereumNetworkManager. </param>
 /// <param name="popupManager"> The active PopupManager. </param>
 protected HardwareWallet(
     EthereumNetworkManager ethereumNetworkManager,
     EthereumNetworkManager.Settings ethereumNetworkSettings,
     PopupManager popupManager)
 {
     this.ethereumNetworkManager  = ethereumNetworkManager;
     this.ethereumNetworkSettings = ethereumNetworkSettings;
     this.popupManager            = popupManager;
 }
Beispiel #6
0
    public void Construct(
        UserWalletManager userWalletManager,
        HopeWalletInfoManager walletInfoManager,
        EthereumNetworkManager.Settings ethereumNetworkSettings)
    {
        this.userWalletManager       = userWalletManager;
        this.walletInfoManager       = walletInfoManager;
        this.ethereumNetworkSettings = ethereumNetworkSettings;

        networkSettingDropdown.value = ethereumNetworkSettings.networkType == EthereumNetworkManager.NetworkType.Mainnet ? 0 : 1;
    }
    /// <summary>
    /// Initializes the TokenContractManager by creating all collections and getting the settings.
    /// </summary>
    /// <param name="popupManager"> The active PopupManager. </param>
    /// <param name="tradableAssetImageManager"> The active TradableAssetImageManager. </param>
    /// <param name="userWalletManager"> The active UserWalletManager. </param>
    /// <param name="networkSettings"> The current EthereumNetworkManager settings. </param>
    public TokenContractManager(PopupManager popupManager,
                                TradableAssetImageManager tradableAssetImageManager,
                                UserWalletManager userWalletManager,
                                EthereumNetworkManager.Settings networkSettings)
    {
        this.popupManager = popupManager;
        this.tradableAssetImageManager = tradableAssetImageManager;
        this.userWalletManager         = userWalletManager;

        tokens = new SecurePlayerPrefList <TokenInfo>(PlayerPrefConstants.SAVED_TOKEN_CONTRACTS, (int)networkSettings.networkType);
        networkSettings.OnNetworkChanged += network => tokens = new SecurePlayerPrefList <TokenInfo>(PlayerPrefConstants.SAVED_TOKEN_CONTRACTS, (int)network);
    }
 public void Construct(
     EthereumNetworkManager.Settings networkSettings,
     Hodler hodlerContract,
     UserWalletManager userWalletManager,
     GasPriceObserver gasPriceObserver,
     EtherBalanceObserver etherBalanceObserver)
 {
     this.networkSettings      = networkSettings;
     this.hodlerContract       = hodlerContract;
     this.userWalletManager    = userWalletManager;
     this.gasPriceObserver     = gasPriceObserver;
     this.etherBalanceObserver = etherBalanceObserver;
 }
    /// <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);
                }
            }
        };
    }
Beispiel #10
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();
        }
Beispiel #11
0
 /// <summary>
 /// Initializes the EtherscanApiService by assigning the network settings.
 /// </summary>
 /// <param name="networkSettings"> The ethereum network settings object. </param>
 public EtherscanApiService(EthereumNetworkManager.Settings networkSettings)
 {
     this.networkSettings = networkSettings;
 }
Beispiel #12
0
 /// <summary>
 /// Initializes <see cref="DUBI"/> by transferring references to the <see cref="StaticSmartContract"/> base.
 /// </summary>
 /// <param name="ethereumNetworkSettings"> The settings of the active <see cref="EthereumNetworkManager"/>. </param>
 /// <param name="settings"> The settings of this <see cref="DUBI"/> contract. </param>
 public DUBI(EthereumNetworkManager.Settings ethereumNetworkSettings, Settings settings) : base(ethereumNetworkSettings, settings)
 {
 }
Beispiel #13
0
    private void InitializeDefaultTokenList(TokenContractManager tokenContractManager, PRPS prps, DUBI dubi, EthereumNetworkManager.Settings ethereumNetworkSettings)
    {
        if (addableTokens.Count > 0)
        {
            return;
        }

        addableTokens.Add(new TokenInfo(prps.ContractAddress.ToLower(), "Purpose", "PRPS", 18));
        addableTokens.Add(new TokenInfo(dubi.ContractAddress.ToLower(), "Decentralized Universal Basic Income", "DUBI", 18));
        tokenContractManager.AddToken(new TokenInfo(prps.ContractAddress.ToLower(), "Purpose", "PRPS", 18));
        tokenContractManager.AddToken(new TokenInfo(dubi.ContractAddress.ToLower(), "Decentralized Universal Basic Income", "DUBI", 18));

        if (ethereumNetworkSettings.networkType == EthereumNetworkManager.NetworkType.Mainnet)
        {
            var defaultTokenList = Resources.Load("Data/tokens") as TextAsset;
            var deserializedData = JsonUtils.DeserializeDynamicCollection(defaultTokenList.text);

            for (int i = 0; i < deserializedData.Count; i++)
            {
                var obj = deserializedData[i];

                var address  = (string)obj.address;
                var symbol   = (string)obj.symbol;
                var name     = (string)obj.name;
                var decimals = (int)obj.decimals;

                var isEnabled = address.EqualsIgnoreCase(prps.ContractAddress) || address.EqualsIgnoreCase(dubi.ContractAddress);

                addableTokens.Add(new TokenInfo(address.ToLower(), name, symbol, decimals));

                if (isEnabled)
                {
                    tokenContractManager.AddToken(new TokenInfo(address.ToLower(), name, symbol, decimals));
                }
            }
        }
    }
Beispiel #14
0
 private void Initialize(TokenContractManager tokenContractManager, PRPS prps, DUBI dubi, EthereumNetworkManager.Settings ethereumNetworkSettings)
 {
     addableTokens = new SecurePlayerPrefList <TokenInfo>(PlayerPrefConstants.CACHED_TOKEN_LIST, (int)ethereumNetworkSettings.networkType);
     InitializeDefaultTokenList(tokenContractManager, prps, dubi, ethereumNetworkSettings);
 }
Beispiel #15
0
 /// <summary>
 /// Initializes the LedgerWallet by passing all info to the base HardwareWallet class.
 /// </summary>
 /// <param name="ethereumNetworkManager"> The active EthereumNetworkManager. </param>
 /// <param name="ethereumNetworkSettings"> The settings for the EthereumNetworkManager. </param>
 /// <param name="popupManager"> The active PopupManager. </param>
 public LedgerWallet(
     EthereumNetworkManager ethereumNetworkManager,
     EthereumNetworkManager.Settings ethereumNetworkSettings,
     PopupManager popupManager) : base(ethereumNetworkManager, ethereumNetworkSettings, popupManager)
 {
 }
Beispiel #16
0
 /// <summary>
 /// Initializes the <see cref="StaticSmartContract"/> by assigning the references to the required settings.
 /// </summary>
 /// <param name="ethereumNetworkSettings"> The current <see cref="EthereumNetworkManager.Settings"/> instance. </param>
 /// <param name="settings"> The settings of this smart contract. </param>
 protected StaticSmartContract(EthereumNetworkManager.Settings ethereumNetworkSettings, SettingsBase settings)
 {
     this.ethereumNetworkSettings = ethereumNetworkSettings;
     this.settings = settings;
 }