/// <summary> /// Initializes the <see cref="GasManager"/> by assigning all required references. /// </summary> /// <param name="tradableAssetManager"> The active <see cref="TradableAssetManager"/>. </param> /// <param name="tradableAssetPriceManager"> The active <see cref="TradableAssetPriceManager"/>. </param> /// <param name="currencyManager"> The active <see cref="CurrencyManager"/>. </param> /// <param name="gasPriceObserver"> The active <see cref="GasPriceObserver"/>. </param> /// <param name="periodicUpdateManager"> The active <see cref="PeriodicUpdateManager"/>. </param> /// <param name="advancedModeToggle"> The toggle for switching between advanced and simple mode. </param> /// <param name="slider"> The slider used to control transaction speed. </param> /// <param name="gasLimitField"> The input field for the gas limit when in advanced mode. </param> /// <param name="gasPriceField"> The input field for the gas price when in advanced mode. </param> /// <param name="transactionFeeText"> The text component to use to set the transaction fee. </param> public GasManager( TradableAssetManager tradableAssetManager, TradableAssetPriceManager tradableAssetPriceManager, CurrencyManager currencyManager, GasPriceObserver gasPriceObserver, PeriodicUpdateManager periodicUpdateManager, Toggle advancedModeToggle, Slider slider, HopeInputField gasLimitField, HopeInputField gasPriceField, TMP_Text transactionFeeText) { this.tradableAssetManager = tradableAssetManager; this.tradableAssetPriceManager = tradableAssetPriceManager; this.currencyManager = currencyManager; this.periodicUpdateManager = periodicUpdateManager; this.advancedModeToggle = advancedModeToggle; this.gasLimitField = gasLimitField; this.gasPriceField = gasPriceField; this.transactionFeeText = transactionFeeText; transactionSpeedSlider = new TransactionSpeedSlider(gasPriceObserver, slider, UpdateGasPriceEstimate); OnGasChanged += UpdateTransactionFeeVisuals; AddListenersAndObservables(); EstimateGasLimit(); transactionSpeedSlider.Start(); }
/// <summary> /// Initializes the GasMAnager by assigning required dependencies. /// </summary> /// <param name="tradableAssetPriceManager"> The active TradableAssetPriceManager. </param> /// <param name="currencyManager"> The active CurrencyManager. </param> /// <param name="lockPRPSManager"> The active LockPRPSManager. </param> /// <param name="gasPriceObserver"> The active GasPriceObserver. </param> /// <param name="slider"> The slider for controlling the gas prices. </param> /// <param name="transactionFeeText"> The text used for displaying the gas cost of the transaction. </param> /// <param name="lockPRPSPopup"></param> public GasManager( TradableAssetPriceManager tradableAssetPriceManager, CurrencyManager currencyManager, LockPRPSManager lockPRPSManager, GasPriceObserver gasPriceObserver, Slider slider, TMP_Text transactionFeeText, LockPRPSPopup lockPRPSPopup) { this.tradableAssetPriceManager = tradableAssetPriceManager; this.currencyManager = currencyManager; this.lockPRPSManager = lockPRPSManager; this.transactionFeeText = transactionFeeText; this.lockPRPSPopup = lockPRPSPopup; transactionSpeedSlider = new TransactionSpeedSlider(gasPriceObserver, slider, UpdateGasPriceEstimate); transactionSpeedSlider.Start(); }