"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var __1 = require("../");
var PaymentsStyledComponents_1 = require("./PaymentsStyledComponents");
var PaymentsTextComponents_1 = require("./PaymentsTextComponents");
var PaymentsEthUpdateAmount = /** @class */ (function (_super) {
    __extends(PaymentsEthUpdateAmount, _super);
    function PaymentsEthUpdateAmount(props) {
        var _this = _super.call(this, props) || this;
        _this.notEnoughEthError = function (error) {
            _this.setState({ notEnoughEthError: error });
        };
        _this.state = {
            etherToSpend: _this.props.etherToSpend,
            usdToSpend: _this.props.usdToSpend,
            notEnoughEthError: false,
        };
        return _this;
    }
    PaymentsEthUpdateAmount.prototype.render = function () {
        var _this = this;
        return (React.createElement(React.Fragment, null,
            React.createElement(PaymentsTextComponents_1.NotEnoughETHInWalletText, null),
            React.createElement(__1.UsdEthConverter, { fromValue: this.state.usdToSpend.toString(), onNotEnoughEthError: function (error) { return _this.notEnoughEthError(error); }, onConversion: function (usd, eth) { return _this.setConvertedAmount(usd, eth); } }),
            React.createElement(PaymentsStyledComponents_1.PaymentBtn, { onClick: function () {
                    return _this.props.handleBoostUpdate(_this.state.usdToSpend, _this.props.usdToSpend, _this.state.etherToSpend);
                }, disabled: this.state.notEnoughEthError }, "Update Boost Amount")));
    };
    PaymentsEthUpdateAmount.prototype.setConvertedAmount = function (usdToSpend, etherToSpend) {
        var eth = parseFloat(etherToSpend.toFixed(6));
        this.setState({ usdToSpend: usdToSpend, etherToSpend: eth });
    };
    return PaymentsEthUpdateAmount;
}(React.Component));
exports.PaymentsEthUpdateAmount = PaymentsEthUpdateAmount;
//# sourceMappingURL=PaymentsEthUpdateAmount.js.map