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;
};
import React, { useState, useEffect } from 'react';
import { QRCode } from 'react-qr-svg';
import { copy } from '@universal-login/commons';
var DeploymentWithCryptoInfo = function (_a) {
    var minimalAmount = _a.minimalAmount;
    return React.createElement(React.Fragment, null,
        React.createElement("p", { className: "info-text" },
            "Send at least ",
            minimalAmount || '...',
            " ETH to this address"),
        React.createElement("p", { className: "info-text" }, "This screen will update itself as soon as we detect a mined transaction"));
};
var TopUpCryptoInfo = function () {
    return React.createElement(React.Fragment, null,
        React.createElement("p", { className: "info-text" }, "All your Ethereum tokens have the same address"),
        React.createElement("p", { className: "info-text" }, "Only send Ethereum tokens to this address"));
};
export var TopUpWithCrypto = function (_a) {
    var walletService = _a.walletService;
    var _b = __read(useState(''), 2), cryptoClass = _b[0], setCryptoClass = _b[1];
    var contractAddress = walletService.getContractAddress();
    useEffect(function () {
        setCryptoClass('crypto-selected');
    }, []);
    return (React.createElement("div", { className: "top-up-body" },
        React.createElement("div", { className: "top-up-body-inner" },
            React.createElement("div", { className: "crypto " + cryptoClass },
                React.createElement("label", { htmlFor: "input-address", className: "top-up-label" }, "Send to"),
                React.createElement("div", { className: "input-address-wrapper" },
                    React.createElement("input", { id: "contract-address", className: "input-address", onChange: function () { }, defaultValue: contractAddress, readOnly: true }),
                    React.createElement("button", { onClick: function () { return copy('contract-address'); }, className: "copy-btn" },
                        React.createElement("p", { className: "copy-btn-feedback" }, "Copied"))),
                React.createElement("div", { className: "qr-code-wrapper" },
                    React.createElement(QRCode, { level: "M", bgColor: "#ffffff", fgColor: "#120839", width: 128, height: 128, value: contractAddress })),
                walletService.isKind('Future')
                    ? React.createElement(DeploymentWithCryptoInfo, { minimalAmount: walletService.getRequiredDeploymentBalance() })
                    : React.createElement(TopUpCryptoInfo, null)))));
};
//# sourceMappingURL=TopUpWithCrypto.js.map