"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
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_1 = __importStar(require("react"));
var react_qr_svg_1 = require("react-qr-svg");
var commons_1 = require("@universal-login/commons");
var DeploymentWithCryptoInfo = function (_a) {
    var minimalAmount = _a.minimalAmount;
    return react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement("p", { className: "info-text" },
            "Send at least ",
            minimalAmount || '...',
            " ETH to this address"),
        react_1.default.createElement("p", { className: "info-text" }, "This screen will update itself as soon as we detect a mined transaction"));
};
var TopUpCryptoInfo = function () {
    return react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement("p", { className: "info-text" }, "All your Ethereum tokens have the same address"),
        react_1.default.createElement("p", { className: "info-text" }, "Only send Ethereum tokens to this address"));
};
exports.TopUpWithCrypto = function (_a) {
    var walletService = _a.walletService;
    var _b = __read(react_1.useState(''), 2), cryptoClass = _b[0], setCryptoClass = _b[1];
    var contractAddress = walletService.getContractAddress();
    react_1.useEffect(function () {
        setCryptoClass('crypto-selected');
    }, []);
    return (react_1.default.createElement("div", { className: "top-up-body" },
        react_1.default.createElement("div", { className: "top-up-body-inner" },
            react_1.default.createElement("div", { className: "crypto " + cryptoClass },
                react_1.default.createElement("label", { htmlFor: "input-address", className: "top-up-label" }, "Send to"),
                react_1.default.createElement("div", { className: "input-address-wrapper" },
                    react_1.default.createElement("input", { id: "contract-address", className: "input-address", onChange: function () { }, defaultValue: contractAddress, readOnly: true }),
                    react_1.default.createElement("button", { onClick: function () { return commons_1.copy('contract-address'); }, className: "copy-btn" },
                        react_1.default.createElement("p", { className: "copy-btn-feedback" }, "Copied"))),
                react_1.default.createElement("div", { className: "qr-code-wrapper" },
                    react_1.default.createElement(react_qr_svg_1.QRCode, { level: "M", bgColor: "#ffffff", fgColor: "#120839", width: 128, height: 128, value: contractAddress })),
                walletService.isKind('Future')
                    ? react_1.default.createElement(DeploymentWithCryptoInfo, { minimalAmount: walletService.getRequiredDeploymentBalance() })
                    : react_1.default.createElement(TopUpCryptoInfo, null)))));
};
//# sourceMappingURL=TopUpWithCrypto.js.map