import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { FormInput } from "@powerhousedao/design-system";
import { EthereumAddress as EthereumAddressScalar } from "#graphql";
import { useState } from "react";
export const EthereumAddress = ({ onChange, }) => {
    const [address, setAddress] = useState("");
    const result = EthereumAddressScalar.schema.safeParse(address);
    const errors = result.error?.errors.map((error) => error.message).join(", ");
    if (onChange) {
        onChange(address, result.success);
    }
    return (_jsxs("div", { children: [_jsx(FormInput, { id: "eth-address-input", value: address, onChange: (e) => setAddress(e.target.value), placeholder: "0x...." }), _jsx("label", { htmlFor: "eth-address-input", children: address !== "" && errors })] }));
};
//# sourceMappingURL=EthereumAddress.js.map