@thenamespace/ens-components 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +35 -7
- package/dist/index.js +279 -262
- package/dist/index.js.map +1 -1
- package/dist/types/components/ens-name-registration/ENSNameRegistrationForm.d.ts +1 -1
- package/dist/types/components/ens-name-registration/RegistrationProcess.d.ts +2 -2
- package/dist/types/components/ens-name-registration/RegistrationSummary.d.ts +2 -2
- package/dist/types/components/ens-name-registration/registration/RegistrationStep.d.ts +1 -1
- package/dist/types/components/ens-name-registration/registration/SuccessScreen.d.ts +1 -1
- package/dist/types/components/ens-name-registration/registration/types.d.ts +1 -1
- package/dist/types/components/molecules/duration-picker/DurationPicker.d.ts +8 -0
- package/dist/types/components/molecules/index.d.ts +1 -0
- package/dist/types/components/molecules/pricing-display/PricingDisplay.d.ts +3 -2
- package/dist/types/hooks/useRegisterENS.d.ts +2 -2
- package/dist/types/utils/date.d.ts +19 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11642,6 +11642,50 @@ const wait = (ms) => {
|
|
|
11642
11642
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11643
11643
|
};
|
|
11644
11644
|
|
|
11645
|
+
const ONE_DAY = 86400;
|
|
11646
|
+
const ONE_YEAR = 365 * ONE_DAY;
|
|
11647
|
+
const MIN_REGISTRATION_SECONDS = 28 * ONE_DAY;
|
|
11648
|
+
const secondsToDateInput = (expirySeconds) => {
|
|
11649
|
+
const date = new Date(expirySeconds * 1e3);
|
|
11650
|
+
const year = date.getFullYear();
|
|
11651
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
11652
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
11653
|
+
return `${year}-${month}-${day}`;
|
|
11654
|
+
};
|
|
11655
|
+
const roundDurationWithDay = (valueAsDate, nowSeconds) => {
|
|
11656
|
+
const start = new Date(nowSeconds * 1e3);
|
|
11657
|
+
const endDay = Date.UTC(valueAsDate.getFullYear(), valueAsDate.getMonth(), valueAsDate.getDate());
|
|
11658
|
+
const startDay = Date.UTC(start.getFullYear(), start.getMonth(), start.getDate());
|
|
11659
|
+
const days = Math.floor((endDay - startDay) / 864e5);
|
|
11660
|
+
return Math.max(0, days * 86400);
|
|
11661
|
+
};
|
|
11662
|
+
const secondsFromYears = (startDate, years) => {
|
|
11663
|
+
const end = new Date(startDate.getTime());
|
|
11664
|
+
end.setFullYear(end.getFullYear() + years);
|
|
11665
|
+
return Math.floor((end.getTime() - startDate.getTime()) / 1e3);
|
|
11666
|
+
};
|
|
11667
|
+
const yearsFromSeconds = (seconds) => seconds / ONE_YEAR;
|
|
11668
|
+
const formatDurationSummary = (durationSeconds) => {
|
|
11669
|
+
const now = /* @__PURE__ */ new Date();
|
|
11670
|
+
const end = new Date(now.getTime() + durationSeconds * 1e3);
|
|
11671
|
+
let years = end.getFullYear() - now.getFullYear();
|
|
11672
|
+
let months = end.getMonth() - now.getMonth();
|
|
11673
|
+
let days = end.getDate() - now.getDate();
|
|
11674
|
+
if (days < 0) {
|
|
11675
|
+
months -= 1;
|
|
11676
|
+
days += new Date(end.getFullYear(), end.getMonth(), 0).getDate();
|
|
11677
|
+
}
|
|
11678
|
+
if (months < 0) {
|
|
11679
|
+
years -= 1;
|
|
11680
|
+
months += 12;
|
|
11681
|
+
}
|
|
11682
|
+
const parts = [];
|
|
11683
|
+
if (years > 0) parts.push(`${years} year${years !== 1 ? "s" : ""}`);
|
|
11684
|
+
if (months > 0) parts.push(`${months} month${months !== 1 ? "s" : ""}`);
|
|
11685
|
+
if (days > 0 && years === 0) parts.push(`${days} day${days !== 1 ? "s" : ""}`);
|
|
11686
|
+
return parts.slice(0, 2).join(", ") || "0 days";
|
|
11687
|
+
};
|
|
11688
|
+
|
|
11645
11689
|
const isValidEmvAddress = (value) => {
|
|
11646
11690
|
return isAddress$1(value);
|
|
11647
11691
|
};
|
|
@@ -11855,6 +11899,124 @@ function ProgressBar({ progress }) {
|
|
|
11855
11899
|
) }) });
|
|
11856
11900
|
}
|
|
11857
11901
|
|
|
11902
|
+
const CalendarSVG = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: 16, height: 16, fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M19 3h-1V1h-2v2H8V1H6v2H5C3.9 3 3 3.9 3 5v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z" }) });
|
|
11903
|
+
const DurationPicker = ({
|
|
11904
|
+
durationSeconds,
|
|
11905
|
+
onDurationChange,
|
|
11906
|
+
minSeconds = MIN_REGISTRATION_SECONDS
|
|
11907
|
+
}) => {
|
|
11908
|
+
const [durationType, setDurationType] = useState("years");
|
|
11909
|
+
const dateInputRef = useRef(null);
|
|
11910
|
+
const nowSecondsRef = useRef(Math.floor(Date.now() / 1e3));
|
|
11911
|
+
const nowSeconds = nowSecondsRef.current;
|
|
11912
|
+
const years = Math.max(1, Math.floor(yearsFromSeconds(durationSeconds)));
|
|
11913
|
+
const minusSeconds = secondsFromYears(/* @__PURE__ */ new Date(), years - 1);
|
|
11914
|
+
const handleMinusYear = () => {
|
|
11915
|
+
if (minusSeconds >= minSeconds) {
|
|
11916
|
+
onDurationChange(minusSeconds);
|
|
11917
|
+
}
|
|
11918
|
+
};
|
|
11919
|
+
const handlePlusYear = () => {
|
|
11920
|
+
onDurationChange(secondsFromYears(/* @__PURE__ */ new Date(), years + 1));
|
|
11921
|
+
};
|
|
11922
|
+
const handleDateChange = (e) => {
|
|
11923
|
+
const { valueAsDate } = e.currentTarget;
|
|
11924
|
+
if (!valueAsDate) return;
|
|
11925
|
+
const normalised = new Date(
|
|
11926
|
+
valueAsDate.getTime() + valueAsDate.getTimezoneOffset() * 60 * 1e3
|
|
11927
|
+
);
|
|
11928
|
+
const minDate = new Date((nowSeconds + minSeconds) * 1e3);
|
|
11929
|
+
const clamped = normalised < minDate ? minDate : normalised;
|
|
11930
|
+
onDurationChange(roundDurationWithDay(clamped, nowSeconds));
|
|
11931
|
+
};
|
|
11932
|
+
const handleToggleMode = () => {
|
|
11933
|
+
if (durationType === "years") {
|
|
11934
|
+
setDurationType("date");
|
|
11935
|
+
} else {
|
|
11936
|
+
const snapped = secondsFromYears(
|
|
11937
|
+
/* @__PURE__ */ new Date(),
|
|
11938
|
+
Math.max(1, Math.floor(yearsFromSeconds(durationSeconds)))
|
|
11939
|
+
);
|
|
11940
|
+
onDurationChange(snapped);
|
|
11941
|
+
setDurationType("years");
|
|
11942
|
+
}
|
|
11943
|
+
};
|
|
11944
|
+
const minusDisabled = minusSeconds < minSeconds;
|
|
11945
|
+
const expirySeconds = nowSeconds + durationSeconds;
|
|
11946
|
+
const expiryDateDisplay = new Date(expirySeconds * 1e3).toLocaleDateString("en-US", {
|
|
11947
|
+
month: "long",
|
|
11948
|
+
day: "numeric",
|
|
11949
|
+
year: "numeric"
|
|
11950
|
+
});
|
|
11951
|
+
return /* @__PURE__ */ jsxs("div", { className: "ns-duration-picker", children: [
|
|
11952
|
+
durationType === "years" ? /* @__PURE__ */ jsxs("div", { className: "ns-duration-picker__control", children: [
|
|
11953
|
+
/* @__PURE__ */ jsx(
|
|
11954
|
+
Button,
|
|
11955
|
+
{
|
|
11956
|
+
className: "ns-duration-picker__btn",
|
|
11957
|
+
onClick: handleMinusYear,
|
|
11958
|
+
disabled: minusDisabled,
|
|
11959
|
+
children: "\u2212"
|
|
11960
|
+
}
|
|
11961
|
+
),
|
|
11962
|
+
/* @__PURE__ */ jsxs("span", { className: "ns-duration-picker__label", children: [
|
|
11963
|
+
years,
|
|
11964
|
+
" year",
|
|
11965
|
+
years !== 1 ? "s" : ""
|
|
11966
|
+
] }),
|
|
11967
|
+
/* @__PURE__ */ jsx(
|
|
11968
|
+
Button,
|
|
11969
|
+
{
|
|
11970
|
+
className: "ns-duration-picker__btn ns-duration-picker__btn--plus",
|
|
11971
|
+
onClick: handlePlusYear,
|
|
11972
|
+
children: "+"
|
|
11973
|
+
}
|
|
11974
|
+
)
|
|
11975
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "ns-duration-picker__calendar", children: [
|
|
11976
|
+
/* @__PURE__ */ jsx("span", { className: "ns-duration-picker__date-display", children: expiryDateDisplay }),
|
|
11977
|
+
/* @__PURE__ */ jsx(
|
|
11978
|
+
"input",
|
|
11979
|
+
{
|
|
11980
|
+
ref: dateInputRef,
|
|
11981
|
+
type: "date",
|
|
11982
|
+
className: "ns-duration-picker__date-input",
|
|
11983
|
+
value: secondsToDateInput(expirySeconds),
|
|
11984
|
+
min: secondsToDateInput(nowSeconds + minSeconds),
|
|
11985
|
+
onChange: handleDateChange
|
|
11986
|
+
}
|
|
11987
|
+
),
|
|
11988
|
+
/* @__PURE__ */ jsx(
|
|
11989
|
+
"button",
|
|
11990
|
+
{
|
|
11991
|
+
type: "button",
|
|
11992
|
+
className: "ns-duration-picker__calendar-btn",
|
|
11993
|
+
onClick: () => dateInputRef.current?.showPicker?.(),
|
|
11994
|
+
"aria-label": "Open calendar",
|
|
11995
|
+
children: /* @__PURE__ */ jsx(CalendarSVG, {})
|
|
11996
|
+
}
|
|
11997
|
+
)
|
|
11998
|
+
] }),
|
|
11999
|
+
/* @__PURE__ */ jsxs("div", { className: "ns-duration-picker__footer", children: [
|
|
12000
|
+
/* @__PURE__ */ jsxs(Text, { size: "xs", color: "grey", children: [
|
|
12001
|
+
formatDurationSummary(durationSeconds),
|
|
12002
|
+
" registration.\xA0"
|
|
12003
|
+
] }),
|
|
12004
|
+
/* @__PURE__ */ jsxs(
|
|
12005
|
+
"button",
|
|
12006
|
+
{
|
|
12007
|
+
type: "button",
|
|
12008
|
+
className: "ns-duration-picker__toggle",
|
|
12009
|
+
onClick: handleToggleMode,
|
|
12010
|
+
children: [
|
|
12011
|
+
"Pick by ",
|
|
12012
|
+
durationType === "years" ? "date" : "years"
|
|
12013
|
+
]
|
|
12014
|
+
}
|
|
12015
|
+
)
|
|
12016
|
+
] })
|
|
12017
|
+
] });
|
|
12018
|
+
};
|
|
12019
|
+
|
|
11858
12020
|
const PricingDisplay = ({
|
|
11859
12021
|
primaryFee,
|
|
11860
12022
|
networkFees,
|
|
@@ -11873,22 +12035,14 @@ const PricingDisplay = ({
|
|
|
11873
12035
|
return (eth * ethUsdRate).toFixed(2);
|
|
11874
12036
|
}, [ethUsdRate, total.amount, totalLoading]);
|
|
11875
12037
|
return /* @__PURE__ */ jsxs("div", { className: `ens-registration-pricing ${className}`, children: [
|
|
11876
|
-
expiryPicker && /* @__PURE__ */
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
),
|
|
11885
|
-
/* @__PURE__ */ jsxs(Text, { children: [
|
|
11886
|
-
expiryPicker.years,
|
|
11887
|
-
" year",
|
|
11888
|
-
expiryPicker.years > 1 ? "s" : ""
|
|
11889
|
-
] }),
|
|
11890
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => expiryPicker.onYearsChange(expiryPicker.years + 1), children: "+" })
|
|
11891
|
-
] }),
|
|
12038
|
+
expiryPicker && /* @__PURE__ */ jsx("div", { className: "ens-expiry-picker mb-2", children: /* @__PURE__ */ jsx(
|
|
12039
|
+
DurationPicker,
|
|
12040
|
+
{
|
|
12041
|
+
durationSeconds: expiryPicker.durationSeconds,
|
|
12042
|
+
onDurationChange: expiryPicker.onDurationChange,
|
|
12043
|
+
minSeconds: expiryPicker.minSeconds
|
|
12044
|
+
}
|
|
12045
|
+
) }),
|
|
11892
12046
|
/* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-between align-items-center mb-1", children: [
|
|
11893
12047
|
/* @__PURE__ */ jsx(Text, { size: "sm", color: "grey", children: primaryFee.label }),
|
|
11894
12048
|
primaryFee.isChecking ? /* @__PURE__ */ jsx(ShurikenSpinner, { size: 16 }) : /* @__PURE__ */ jsx(Text, { size: "sm", color: "grey", children: primaryFee.amount === "Free" ? "Free" : `${primaryFee.amount} ETH` })
|
|
@@ -63982,7 +64136,6 @@ const ABIS = {
|
|
|
63982
64136
|
RESOLVER
|
|
63983
64137
|
};
|
|
63984
64138
|
|
|
63985
|
-
const SECONDS_IN_YEAR = 31536e3;
|
|
63986
64139
|
const NAMESPACE_REFERRER_ADDRESS = "0xb7B18611b8C51B4B3F400BaF09DB49E61e0aF044";
|
|
63987
64140
|
const ENS_REGISTRY_ABI = parseAbi([
|
|
63988
64141
|
"function owner(bytes32) view returns (address)"
|
|
@@ -63995,12 +64148,12 @@ const useRegisterENS = ({ isTestnet }) => {
|
|
|
63995
64148
|
const { data: walletClient } = useWalletClient({
|
|
63996
64149
|
chainId: isTestnet ? sepolia.id : mainnet.id
|
|
63997
64150
|
});
|
|
63998
|
-
const getRegistrationPrice = async (label,
|
|
64151
|
+
const getRegistrationPrice = async (label, durationInSeconds = ONE_YEAR) => {
|
|
63999
64152
|
const ethController = getEthController();
|
|
64000
64153
|
const price = await publicClient.readContract({
|
|
64001
64154
|
abi: ABIS.ETH_REGISTRAR_CONTOLLER,
|
|
64002
64155
|
functionName: "rentPrice",
|
|
64003
|
-
args: [label, BigInt(
|
|
64156
|
+
args: [label, BigInt(durationInSeconds)],
|
|
64004
64157
|
address: ethController,
|
|
64005
64158
|
account: address
|
|
64006
64159
|
});
|
|
@@ -64025,7 +64178,7 @@ const useRegisterENS = ({ isTestnet }) => {
|
|
|
64025
64178
|
const c = {
|
|
64026
64179
|
label: request.label,
|
|
64027
64180
|
owner: request.owner,
|
|
64028
|
-
duration: BigInt(
|
|
64181
|
+
duration: BigInt(request.durationInSeconds),
|
|
64029
64182
|
secret: keccak256(toBytes$1(request.secret)),
|
|
64030
64183
|
resolver: getPublicResolver(),
|
|
64031
64184
|
data: resolverData,
|
|
@@ -64039,9 +64192,6 @@ const useRegisterENS = ({ isTestnet }) => {
|
|
|
64039
64192
|
args: [c]
|
|
64040
64193
|
});
|
|
64041
64194
|
};
|
|
64042
|
-
const yearsToSeconds = (years) => {
|
|
64043
|
-
return Math.ceil(years * SECONDS_IN_YEAR);
|
|
64044
|
-
};
|
|
64045
64195
|
const sendCommitmentTx = async (request) => {
|
|
64046
64196
|
if (!walletClient || !walletClient.account) {
|
|
64047
64197
|
throw new Error("Wallet client is not available");
|
|
@@ -64065,17 +64215,14 @@ const useRegisterENS = ({ isTestnet }) => {
|
|
|
64065
64215
|
const registration = {
|
|
64066
64216
|
label: request.label,
|
|
64067
64217
|
owner: request.owner,
|
|
64068
|
-
duration: BigInt(
|
|
64218
|
+
duration: BigInt(request.durationInSeconds),
|
|
64069
64219
|
secret: keccak256(toBytes$1(request.secret)),
|
|
64070
64220
|
resolver: getPublicResolver(),
|
|
64071
64221
|
data: resolverData,
|
|
64072
64222
|
reverseRecord: 0,
|
|
64073
64223
|
referrer: getRegReferrer(request)
|
|
64074
64224
|
};
|
|
64075
|
-
const price = await getRegistrationPrice(
|
|
64076
|
-
request.label,
|
|
64077
|
-
request.expiryInYears
|
|
64078
|
-
);
|
|
64225
|
+
const price = await getRegistrationPrice(request.label, request.durationInSeconds);
|
|
64079
64226
|
const { request: contractRequest } = await publicClient.simulateContract({
|
|
64080
64227
|
address: getEthController(),
|
|
64081
64228
|
abi: ABIS.ETH_REGISTRAR_CONTOLLER,
|
|
@@ -64085,20 +64232,11 @@ const useRegisterENS = ({ isTestnet }) => {
|
|
|
64085
64232
|
value: price.wei
|
|
64086
64233
|
});
|
|
64087
64234
|
const tx = await walletClient.writeContract(contractRequest);
|
|
64088
|
-
return {
|
|
64089
|
-
txHash: tx,
|
|
64090
|
-
price
|
|
64091
|
-
};
|
|
64092
|
-
};
|
|
64093
|
-
const getEthController = () => {
|
|
64094
|
-
return distExports$1.getEnsContracts(isTestnet).ethRegistrarController;
|
|
64095
|
-
};
|
|
64096
|
-
const getEnsRegistry = () => {
|
|
64097
|
-
return distExports$1.getEnsContracts(isTestnet).ensRegistry;
|
|
64098
|
-
};
|
|
64099
|
-
const getPublicResolver = () => {
|
|
64100
|
-
return distExports$1.getEnsContracts(isTestnet).publicResolver;
|
|
64235
|
+
return { txHash: tx, price };
|
|
64101
64236
|
};
|
|
64237
|
+
const getEthController = () => distExports$1.getEnsContracts(isTestnet).ethRegistrarController;
|
|
64238
|
+
const getEnsRegistry = () => distExports$1.getEnsContracts(isTestnet).ensRegistry;
|
|
64239
|
+
const getPublicResolver = () => distExports$1.getEnsContracts(isTestnet).publicResolver;
|
|
64102
64240
|
const getRegReferrer = (request) => {
|
|
64103
64241
|
const referrerAddress = request.referrer && isAddress$1(request.referrer) ? request.referrer : NAMESPACE_REFERRER_ADDRESS;
|
|
64104
64242
|
return createEnsReferer(referrerAddress);
|
|
@@ -89328,7 +89466,7 @@ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAvQAAAGjCAYAAABDv4HEA
|
|
|
89328
89466
|
const MIN_ENS_LEN$2 = 3;
|
|
89329
89467
|
const RegistrationSummary = ({
|
|
89330
89468
|
label,
|
|
89331
|
-
|
|
89469
|
+
durationSeconds,
|
|
89332
89470
|
price,
|
|
89333
89471
|
nameValidation,
|
|
89334
89472
|
transactionFees,
|
|
@@ -89339,7 +89477,7 @@ const RegistrationSummary = ({
|
|
|
89339
89477
|
hideBanner = false,
|
|
89340
89478
|
bannerWidth = 250,
|
|
89341
89479
|
onLabelChange,
|
|
89342
|
-
|
|
89480
|
+
onDurationChange,
|
|
89343
89481
|
onPriceChange,
|
|
89344
89482
|
onNameValidationChange,
|
|
89345
89483
|
onSetProfile,
|
|
@@ -89348,9 +89486,7 @@ const RegistrationSummary = ({
|
|
|
89348
89486
|
}) => {
|
|
89349
89487
|
const { isConnected } = useAccount();
|
|
89350
89488
|
const { ethUsdRate } = useEthDollarValue();
|
|
89351
|
-
const { isEnsAvailable, getRegistrationPrice } = useRegisterENS({
|
|
89352
|
-
isTestnet
|
|
89353
|
-
});
|
|
89489
|
+
const { isEnsAvailable, getRegistrationPrice } = useRegisterENS({ isTestnet });
|
|
89354
89490
|
const { regPrice, regFees, regTotal } = useMemo(() => {
|
|
89355
89491
|
let regPrice2 = 0;
|
|
89356
89492
|
let regFees2 = 0;
|
|
@@ -89363,18 +89499,13 @@ const RegistrationSummary = ({
|
|
|
89363
89499
|
regFees2 += transactionFees.price.eth;
|
|
89364
89500
|
total += transactionFees.price.eth;
|
|
89365
89501
|
}
|
|
89366
|
-
return {
|
|
89367
|
-
regFees: regFees2,
|
|
89368
|
-
regPrice: regPrice2,
|
|
89369
|
-
regTotal: formatFloat(total, 5)
|
|
89370
|
-
};
|
|
89502
|
+
return { regFees: regFees2, regPrice: regPrice2, regTotal: formatFloat(total, 5) };
|
|
89371
89503
|
}, [price, transactionFees]);
|
|
89372
89504
|
const checkAvailability = async (labelToCheck) => {
|
|
89373
|
-
let _available = false;
|
|
89374
89505
|
try {
|
|
89375
|
-
|
|
89376
|
-
onNameValidationChange({ isChecking: false, isTaken: !
|
|
89377
|
-
} catch
|
|
89506
|
+
const available = await isEnsAvailable(labelToCheck);
|
|
89507
|
+
onNameValidationChange({ isChecking: false, isTaken: !available });
|
|
89508
|
+
} catch {
|
|
89378
89509
|
onNameValidationChange({
|
|
89379
89510
|
isChecking: false,
|
|
89380
89511
|
isTaken: false,
|
|
@@ -89382,20 +89513,12 @@ const RegistrationSummary = ({
|
|
|
89382
89513
|
});
|
|
89383
89514
|
}
|
|
89384
89515
|
};
|
|
89385
|
-
const checkRegistrationPrice = async (labelToCheck,
|
|
89516
|
+
const checkRegistrationPrice = async (labelToCheck, durationSecs) => {
|
|
89386
89517
|
try {
|
|
89387
|
-
const rentPrice = await getRegistrationPrice(labelToCheck,
|
|
89388
|
-
onPriceChange({
|
|
89389
|
-
|
|
89390
|
-
|
|
89391
|
-
wei: rentPrice.wei
|
|
89392
|
-
});
|
|
89393
|
-
} catch (err) {
|
|
89394
|
-
onPriceChange({
|
|
89395
|
-
isChecking: false,
|
|
89396
|
-
eth: -1,
|
|
89397
|
-
wei: 0n
|
|
89398
|
-
});
|
|
89518
|
+
const rentPrice = await getRegistrationPrice(labelToCheck, durationSecs);
|
|
89519
|
+
onPriceChange({ isChecking: false, eth: rentPrice.eth, wei: rentPrice.wei });
|
|
89520
|
+
} catch {
|
|
89521
|
+
onPriceChange({ isChecking: false, eth: -1, wei: 0n });
|
|
89399
89522
|
}
|
|
89400
89523
|
};
|
|
89401
89524
|
const debouncedCheckAvailability = useCallback(
|
|
@@ -89404,19 +89527,17 @@ const RegistrationSummary = ({
|
|
|
89404
89527
|
);
|
|
89405
89528
|
const debouncedCheckPrice = useCallback(
|
|
89406
89529
|
debounce(
|
|
89407
|
-
(labelToCheck,
|
|
89530
|
+
(labelToCheck, durationSecs) => checkRegistrationPrice(labelToCheck, durationSecs),
|
|
89408
89531
|
500
|
|
89409
89532
|
),
|
|
89410
89533
|
[]
|
|
89411
89534
|
);
|
|
89412
89535
|
const handleNameChanged = async (value) => {
|
|
89413
89536
|
const _value = value.toLocaleLowerCase().trim();
|
|
89414
|
-
if (_value.includes("."))
|
|
89415
|
-
return;
|
|
89416
|
-
}
|
|
89537
|
+
if (_value.includes(".")) return;
|
|
89417
89538
|
try {
|
|
89418
89539
|
normalize(_value);
|
|
89419
|
-
} catch
|
|
89540
|
+
} catch {
|
|
89420
89541
|
return;
|
|
89421
89542
|
}
|
|
89422
89543
|
onLabelChange(_value);
|
|
@@ -89424,22 +89545,21 @@ const RegistrationSummary = ({
|
|
|
89424
89545
|
onNameValidationChange({ isChecking: true, isTaken: false });
|
|
89425
89546
|
onPriceChange({ isChecking: true, eth: 0, wei: 0n });
|
|
89426
89547
|
debouncedCheckAvailability(_value);
|
|
89427
|
-
debouncedCheckPrice(_value,
|
|
89548
|
+
debouncedCheckPrice(_value, durationSeconds);
|
|
89428
89549
|
} else {
|
|
89429
89550
|
onNameValidationChange({ isChecking: false, isTaken: false });
|
|
89430
89551
|
}
|
|
89431
89552
|
};
|
|
89432
|
-
const
|
|
89433
|
-
if (
|
|
89434
|
-
return;
|
|
89435
|
-
}
|
|
89553
|
+
const handleDurationChange = (newSeconds) => {
|
|
89554
|
+
if (newSeconds < MIN_REGISTRATION_SECONDS) return;
|
|
89436
89555
|
onPriceChange({ ...price, isChecking: true });
|
|
89437
|
-
|
|
89438
|
-
debouncedCheckPrice(label,
|
|
89556
|
+
onDurationChange(newSeconds);
|
|
89557
|
+
debouncedCheckPrice(label, newSeconds);
|
|
89439
89558
|
};
|
|
89440
|
-
const isNameAvailable = useMemo(
|
|
89441
|
-
|
|
89442
|
-
|
|
89559
|
+
const isNameAvailable = useMemo(
|
|
89560
|
+
() => label.length >= MIN_ENS_LEN$2 && !nameValidation.isChecking && !nameValidation.isTaken,
|
|
89561
|
+
[label.length, nameValidation.isChecking, nameValidation.isTaken]
|
|
89562
|
+
);
|
|
89443
89563
|
const nextBtnDisabled = label.length < MIN_ENS_LEN$2 || nameValidation.isChecking || nameValidation.isTaken;
|
|
89444
89564
|
const totalPriceLoading = transactionFees?.isChecking || price.isChecking;
|
|
89445
89565
|
const transactionFeesLoading = transactionFees?.isChecking || false;
|
|
@@ -89502,8 +89622,9 @@ const RegistrationSummary = ({
|
|
|
89502
89622
|
isChecking: totalPriceLoading
|
|
89503
89623
|
},
|
|
89504
89624
|
expiryPicker: {
|
|
89505
|
-
|
|
89506
|
-
|
|
89625
|
+
durationSeconds,
|
|
89626
|
+
onDurationChange: handleDurationChange,
|
|
89627
|
+
minSeconds: MIN_REGISTRATION_SECONDS
|
|
89507
89628
|
},
|
|
89508
89629
|
ethUsdRate
|
|
89509
89630
|
}
|
|
@@ -89516,15 +89637,7 @@ const RegistrationSummary = ({
|
|
|
89516
89637
|
style: { cursor: "pointer" },
|
|
89517
89638
|
children: /* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-between align-items-center", children: [
|
|
89518
89639
|
/* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center", children: [
|
|
89519
|
-
/* @__PURE__ */ jsx("div", { className: "shuriken-cont d-flex align-items-center justify-content-center", children: /* @__PURE__ */ jsx(
|
|
89520
|
-
"img",
|
|
89521
|
-
{
|
|
89522
|
-
className: "shuriken",
|
|
89523
|
-
width: 50,
|
|
89524
|
-
src: img$3,
|
|
89525
|
-
alt: "shuricken"
|
|
89526
|
-
}
|
|
89527
|
-
) }),
|
|
89640
|
+
/* @__PURE__ */ jsx("div", { className: "shuriken-cont d-flex align-items-center justify-content-center", children: /* @__PURE__ */ jsx("img", { className: "shuriken", width: 50, src: img$3, alt: "shuricken" }) }),
|
|
89528
89641
|
/* @__PURE__ */ jsxs("div", { className: "ms-3", children: [
|
|
89529
89642
|
/* @__PURE__ */ jsx(Text, { size: "sm", weight: "medium", children: "Complete your profile" }),
|
|
89530
89643
|
/* @__PURE__ */ jsx(Text, { size: "xs", color: "grey", children: "Make your ENS more discoverable" })
|
|
@@ -89535,16 +89648,7 @@ const RegistrationSummary = ({
|
|
|
89535
89648
|
}
|
|
89536
89649
|
)
|
|
89537
89650
|
] }),
|
|
89538
|
-
!isConnected && onConnectWallet ? /* @__PURE__ */ jsx(
|
|
89539
|
-
Button,
|
|
89540
|
-
{
|
|
89541
|
-
style: { width: "100%" },
|
|
89542
|
-
size: "lg",
|
|
89543
|
-
className: "mt-2",
|
|
89544
|
-
onClick: onConnectWallet,
|
|
89545
|
-
children: "Connect Wallet"
|
|
89546
|
-
}
|
|
89547
|
-
) : /* @__PURE__ */ jsx(
|
|
89651
|
+
!isConnected && onConnectWallet ? /* @__PURE__ */ jsx(Button, { style: { width: "100%" }, size: "lg", className: "mt-2", onClick: onConnectWallet, children: "Connect Wallet" }) : /* @__PURE__ */ jsx(
|
|
89548
89652
|
Button,
|
|
89549
89653
|
{
|
|
89550
89654
|
style: { width: "100%" },
|
|
@@ -89708,11 +89812,11 @@ const CommitmentStep = ({
|
|
|
89708
89812
|
setError(null);
|
|
89709
89813
|
let tx = null;
|
|
89710
89814
|
try {
|
|
89711
|
-
setBtnState({
|
|
89815
|
+
setBtnState({ waitingWallet: true, waitingTx: false });
|
|
89712
89816
|
const request = {
|
|
89713
89817
|
label: state.label,
|
|
89714
89818
|
owner: address,
|
|
89715
|
-
|
|
89819
|
+
durationInSeconds: state.durationInSeconds,
|
|
89716
89820
|
secret: state.secret,
|
|
89717
89821
|
records: state.records,
|
|
89718
89822
|
referrer: state.referrer
|
|
@@ -89922,33 +90026,22 @@ const RegistrationStep = ({
|
|
|
89922
90026
|
onStateUpdated,
|
|
89923
90027
|
onSuccess
|
|
89924
90028
|
}) => {
|
|
89925
|
-
const [btnState, setBtnState] = useState({
|
|
89926
|
-
waitingTx: false,
|
|
89927
|
-
waitingWallet: false
|
|
89928
|
-
});
|
|
90029
|
+
const [btnState, setBtnState] = useState({ waitingWallet: false, waitingTx: false });
|
|
89929
90030
|
const { address } = useAccount();
|
|
89930
90031
|
const { waitTx } = useWaitTransaction({ isTestnet });
|
|
89931
|
-
const [error, setError] = useState(
|
|
89932
|
-
|
|
89933
|
-
);
|
|
89934
|
-
const [commitTxStatus, setCommitTxStatus] = useState({
|
|
89935
|
-
sent: false,
|
|
89936
|
-
completed: false,
|
|
89937
|
-
hash: ""
|
|
89938
|
-
});
|
|
89939
|
-
const { sendRegisterTx, getRegistrationPrice } = useRegisterENS({
|
|
89940
|
-
isTestnet
|
|
89941
|
-
});
|
|
90032
|
+
const [error, setError] = useState(null);
|
|
90033
|
+
const [commitTxStatus, setCommitTxStatus] = useState({ sent: false, completed: false, hash: "" });
|
|
90034
|
+
const { sendRegisterTx } = useRegisterENS({ isTestnet });
|
|
89942
90035
|
const handleRegistration = async () => {
|
|
89943
90036
|
setError(null);
|
|
89944
90037
|
let tx = null;
|
|
89945
90038
|
let registrationPrice = 0;
|
|
89946
90039
|
try {
|
|
89947
|
-
setBtnState({
|
|
90040
|
+
setBtnState({ waitingWallet: true, waitingTx: false });
|
|
89948
90041
|
const request = {
|
|
89949
90042
|
label: state.label,
|
|
89950
90043
|
owner: address,
|
|
89951
|
-
|
|
90044
|
+
durationInSeconds: state.durationInSeconds,
|
|
89952
90045
|
secret: state.secret,
|
|
89953
90046
|
records: state.records,
|
|
89954
90047
|
referrer: state.referrer
|
|
@@ -89968,27 +90061,22 @@ const RegistrationStep = ({
|
|
|
89968
90061
|
if (err instanceof ContractFunctionExecutionError && !isUserDeniedError(err)) {
|
|
89969
90062
|
setError(err);
|
|
89970
90063
|
} else if (!isUserDeniedError(err)) {
|
|
89971
|
-
|
|
89972
|
-
err?.shortMessage || err?.message || "Transaction failed"
|
|
90064
|
+
setError(
|
|
90065
|
+
new Error(err?.shortMessage || err?.message || "Transaction failed")
|
|
89973
90066
|
);
|
|
89974
|
-
setError(genericError);
|
|
89975
90067
|
}
|
|
89976
90068
|
} finally {
|
|
89977
90069
|
setBtnState({ waitingTx: false, waitingWallet: false });
|
|
89978
90070
|
}
|
|
89979
|
-
if (!tx)
|
|
89980
|
-
return;
|
|
89981
|
-
}
|
|
90071
|
+
if (!tx) return;
|
|
89982
90072
|
try {
|
|
89983
90073
|
const receipt = await waitTx({ hash: tx });
|
|
89984
90074
|
setCommitTxStatus({ sent: true, completed: true, hash: tx });
|
|
89985
90075
|
const gasUsed = receipt.gasUsed;
|
|
89986
90076
|
const gasPrice = receipt.effectiveGasPrice || BigInt(0);
|
|
89987
|
-
const
|
|
89988
|
-
const transactionFeesEth = formatEther(transactionFees);
|
|
90077
|
+
const transactionFeesEth = formatEther(gasUsed * gasPrice);
|
|
89989
90078
|
const totalCost = (registrationPrice + parseFloat(transactionFeesEth)).toString();
|
|
89990
|
-
const expiryDate =
|
|
89991
|
-
expiryDate.setFullYear(expiryDate.getFullYear() + state.expiryInYears);
|
|
90079
|
+
const expiryDate = new Date(Date.now() + state.durationInSeconds * 1e3);
|
|
89992
90080
|
const formattedExpiryDate = expiryDate.toLocaleDateString("en-US", {
|
|
89993
90081
|
year: "numeric",
|
|
89994
90082
|
month: "long",
|
|
@@ -89998,11 +90086,11 @@ const RegistrationStep = ({
|
|
|
89998
90086
|
onStateUpdated({
|
|
89999
90087
|
...state,
|
|
90000
90088
|
step: ProcessSteps.RegistrationCompleted,
|
|
90001
|
-
commitment: { tx, completed: true, time:
|
|
90089
|
+
commitment: { tx, completed: true, time: Date.now() }
|
|
90002
90090
|
});
|
|
90003
90091
|
setCommitTxStatus({ sent: false, completed: false, hash: "" });
|
|
90004
90092
|
onSuccess?.({
|
|
90005
|
-
|
|
90093
|
+
durationLabel: formatDurationSummary(state.durationInSeconds),
|
|
90006
90094
|
registrationCost: registrationPrice.toString(),
|
|
90007
90095
|
transactionFees: transactionFeesEth,
|
|
90008
90096
|
total: totalCost,
|
|
@@ -90017,26 +90105,19 @@ const RegistrationStep = ({
|
|
|
90017
90105
|
setCommitTxStatus({ sent: false, completed: false, hash: "" });
|
|
90018
90106
|
}
|
|
90019
90107
|
};
|
|
90020
|
-
const { isCurrentStep, isDisabled,
|
|
90021
|
-
const isPending2 = state.step < ProcessSteps.TimerCompleted;
|
|
90108
|
+
const { isCurrentStep, isDisabled, isCompleted } = useMemo(() => {
|
|
90022
90109
|
const isCurrentStep2 = state.step >= ProcessSteps.TimerCompleted && state.step < ProcessSteps.RegistrationCompleted;
|
|
90023
90110
|
const isCompleted2 = state.step >= ProcessSteps.RegistrationCompleted;
|
|
90024
90111
|
const isDisabled2 = state.step < ProcessSteps.TimerCompleted;
|
|
90025
|
-
return {
|
|
90026
|
-
isCurrentStep: isCurrentStep2,
|
|
90027
|
-
isDisabled: isDisabled2,
|
|
90028
|
-
isPending: isPending2,
|
|
90029
|
-
isCompleted: isCompleted2
|
|
90030
|
-
};
|
|
90112
|
+
return { isCurrentStep: isCurrentStep2, isDisabled: isDisabled2, isCompleted: isCompleted2 };
|
|
90031
90113
|
}, [state]);
|
|
90032
90114
|
const getProgressStatusBadge = () => {
|
|
90033
90115
|
if (isCurrentStep) {
|
|
90034
90116
|
return /* @__PURE__ */ jsx("div", { className: "ns-process-badge me-2", children: /* @__PURE__ */ jsx(Text, { color: "white", weight: "bold", size: "sm", children: "3" }) });
|
|
90035
90117
|
} else if (isCompleted) {
|
|
90036
90118
|
return /* @__PURE__ */ jsx("div", { className: "ns-process-badge ns-process-badge--inactive ns-process-badge--completed me-2", children: /* @__PURE__ */ jsx(Icon, { name: "check", size: 16, color: "black" }) });
|
|
90037
|
-
} else {
|
|
90038
|
-
return /* @__PURE__ */ jsx("div", { className: "ns-process-badge ns-process-badge--inactive me-2", children: /* @__PURE__ */ jsx(Text, { color: "primary", weight: "bold", size: "sm", children: "3" }) });
|
|
90039
90119
|
}
|
|
90120
|
+
return /* @__PURE__ */ jsx("div", { className: "ns-process-badge ns-process-badge--inactive me-2", children: /* @__PURE__ */ jsx(Text, { color: "primary", weight: "bold", size: "sm", children: "3" }) });
|
|
90040
90121
|
};
|
|
90041
90122
|
const btnDisabled = btnState.waitingTx || btnState.waitingWallet;
|
|
90042
90123
|
const btnLabel = btnState.waitingWallet ? "Waiting Wallet..." : "Open Wallet";
|
|
@@ -90054,15 +90135,7 @@ const RegistrationStep = ({
|
|
|
90054
90135
|
!commitTxStatus.sent && /* @__PURE__ */ jsxs("div", { className: "ns-text-center", children: [
|
|
90055
90136
|
/* @__PURE__ */ jsx(Text, { weight: "medium", className: "mb-2", children: "Register Name" }),
|
|
90056
90137
|
/* @__PURE__ */ jsx(Text, { size: "xs", color: "grey", children: "Your name is not registered until you've completed the second transaction. You have 23 hours remaining to complete it." }),
|
|
90057
|
-
/* @__PURE__ */ jsx(
|
|
90058
|
-
Button,
|
|
90059
|
-
{
|
|
90060
|
-
disabled: btnDisabled,
|
|
90061
|
-
onClick: () => handleRegistration(),
|
|
90062
|
-
className: "mt-3 ns-wd-100",
|
|
90063
|
-
children: btnLabel
|
|
90064
|
-
}
|
|
90065
|
-
),
|
|
90138
|
+
/* @__PURE__ */ jsx(Button, { disabled: btnDisabled, onClick: handleRegistration, className: "mt-3 ns-wd-100", children: btnLabel }),
|
|
90066
90139
|
/* @__PURE__ */ jsx(ContractErrorLabel, { error })
|
|
90067
90140
|
] }),
|
|
90068
90141
|
commitTxStatus.sent && /* @__PURE__ */ jsx(
|
|
@@ -90727,7 +90800,7 @@ var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAACBCAYAAABpepAsAAA
|
|
|
90727
90800
|
|
|
90728
90801
|
const SuccessScreen$1 = ({
|
|
90729
90802
|
ensName,
|
|
90730
|
-
|
|
90803
|
+
durationLabel,
|
|
90731
90804
|
registrationCost,
|
|
90732
90805
|
transactionFees,
|
|
90733
90806
|
total,
|
|
@@ -90789,8 +90862,8 @@ const SuccessScreen$1 = ({
|
|
|
90789
90862
|
/* @__PURE__ */ jsxs("div", { className: "ens-registration-success-summary", children: [
|
|
90790
90863
|
/* @__PURE__ */ jsxs("div", { className: "ens-registration-success-summary-row", children: [
|
|
90791
90864
|
/* @__PURE__ */ jsxs(Text, { size: "sm", color: "grey", children: [
|
|
90792
|
-
|
|
90793
|
-
"
|
|
90865
|
+
durationLabel,
|
|
90866
|
+
" registration"
|
|
90794
90867
|
] }),
|
|
90795
90868
|
/* @__PURE__ */ jsxs(Text, { size: "sm", color: "grey", children: [
|
|
90796
90869
|
parseFloat(registrationCost).toFixed(4),
|
|
@@ -90853,24 +90926,21 @@ const generateEnsRegistrationSecret = () => {
|
|
|
90853
90926
|
return toHex(Math.floor(Math.random() * 1e9));
|
|
90854
90927
|
};
|
|
90855
90928
|
|
|
90856
|
-
const getBlankRegistrationState = (label,
|
|
90857
|
-
|
|
90858
|
-
|
|
90859
|
-
|
|
90860
|
-
|
|
90861
|
-
|
|
90862
|
-
|
|
90863
|
-
|
|
90864
|
-
|
|
90865
|
-
|
|
90866
|
-
|
|
90867
|
-
|
|
90868
|
-
};
|
|
90869
|
-
return blankRegistrationState;
|
|
90870
|
-
};
|
|
90929
|
+
const getBlankRegistrationState = (label, durationInSeconds, records, isTestnet, referrer) => ({
|
|
90930
|
+
step: ProcessSteps.Start,
|
|
90931
|
+
label,
|
|
90932
|
+
commitment: { completed: false, time: 0 },
|
|
90933
|
+
registration: { completed: false },
|
|
90934
|
+
timerStartedAt: 0,
|
|
90935
|
+
durationInSeconds,
|
|
90936
|
+
secret: generateEnsRegistrationSecret(),
|
|
90937
|
+
records,
|
|
90938
|
+
isTestnet,
|
|
90939
|
+
referrer
|
|
90940
|
+
});
|
|
90871
90941
|
const RegistrationProcess = ({
|
|
90872
90942
|
label,
|
|
90873
|
-
|
|
90943
|
+
durationInSeconds,
|
|
90874
90944
|
isTestnet = false,
|
|
90875
90945
|
records,
|
|
90876
90946
|
onBack,
|
|
@@ -90884,29 +90954,17 @@ const RegistrationProcess = ({
|
|
|
90884
90954
|
const isOnCorrectNetwork = chain?.id === expectedChainId;
|
|
90885
90955
|
const shouldSwitchNetwork = chain && !isOnCorrectNetwork;
|
|
90886
90956
|
const [registrationState, setRegistrationState] = useState(
|
|
90887
|
-
getBlankRegistrationState(
|
|
90888
|
-
label,
|
|
90889
|
-
expiryInYears,
|
|
90890
|
-
records,
|
|
90891
|
-
isTestnet,
|
|
90892
|
-
referrer
|
|
90893
|
-
)
|
|
90957
|
+
() => getBlankRegistrationState(label, durationInSeconds, records, isTestnet, referrer)
|
|
90894
90958
|
);
|
|
90895
90959
|
const [showConfirmClose, setShowConfirmClose] = useState(false);
|
|
90896
90960
|
useEffect(() => {
|
|
90897
|
-
setRegistrationState({ ...
|
|
90961
|
+
setRegistrationState((prev) => ({ ...prev, records }));
|
|
90898
90962
|
}, [records]);
|
|
90899
90963
|
const handleSwitchNetwork = () => {
|
|
90900
|
-
if (switchChain) {
|
|
90901
|
-
switchChain({ chainId: expectedChainId });
|
|
90902
|
-
}
|
|
90964
|
+
if (switchChain) switchChain({ chainId: expectedChainId });
|
|
90903
90965
|
};
|
|
90904
90966
|
const handleTimerPassed = () => {
|
|
90905
|
-
|
|
90906
|
-
...registrationState,
|
|
90907
|
-
step: ProcessSteps.TimerCompleted
|
|
90908
|
-
};
|
|
90909
|
-
setRegistrationState(newState);
|
|
90967
|
+
setRegistrationState((prev) => ({ ...prev, step: ProcessSteps.TimerCompleted }));
|
|
90910
90968
|
};
|
|
90911
90969
|
const networkName = isTestnet ? "Sepolia" : "Mainnet";
|
|
90912
90970
|
const handleCloseClick = () => {
|
|
@@ -90916,13 +90974,6 @@ const RegistrationProcess = ({
|
|
|
90916
90974
|
onBack?.();
|
|
90917
90975
|
}
|
|
90918
90976
|
};
|
|
90919
|
-
const handleConfirmClose = () => {
|
|
90920
|
-
setShowConfirmClose(false);
|
|
90921
|
-
onBack?.(true);
|
|
90922
|
-
};
|
|
90923
|
-
const handleCancelClose = () => {
|
|
90924
|
-
setShowConfirmClose(false);
|
|
90925
|
-
};
|
|
90926
90977
|
return /* @__PURE__ */ jsxs("div", { className: "ens-registration-progress", children: [
|
|
90927
90978
|
/* @__PURE__ */ jsx(
|
|
90928
90979
|
"button",
|
|
@@ -90934,14 +90985,7 @@ const RegistrationProcess = ({
|
|
|
90934
90985
|
children: /* @__PURE__ */ jsx(Icon, { name: "chevron-left", size: 16 })
|
|
90935
90986
|
}
|
|
90936
90987
|
),
|
|
90937
|
-
/* @__PURE__ */ jsx("div", { className: "d-flex justify-content-center", children: /* @__PURE__ */ jsx(
|
|
90938
|
-
"img",
|
|
90939
|
-
{
|
|
90940
|
-
style: { width: "250px", margin: "auto" },
|
|
90941
|
-
src: img$1,
|
|
90942
|
-
alt: "Ninja Image"
|
|
90943
|
-
}
|
|
90944
|
-
) }),
|
|
90988
|
+
/* @__PURE__ */ jsx("div", { className: "d-flex justify-content-center", children: /* @__PURE__ */ jsx("img", { style: { width: "250px", margin: "auto" }, src: img$1, alt: "Ninja Image" }) }),
|
|
90945
90989
|
/* @__PURE__ */ jsxs("div", { className: "ns-text-center mt-2 mb-2", children: [
|
|
90946
90990
|
/* @__PURE__ */ jsx(Text, { size: "lg", weight: "medium", children: "ENS Registration Process" }),
|
|
90947
90991
|
/* @__PURE__ */ jsx(Text, { size: "xs", color: "grey", children: "Registration Consists of 3 Steps" })
|
|
@@ -90971,23 +91015,13 @@ const RegistrationProcess = ({
|
|
|
90971
91015
|
}
|
|
90972
91016
|
}
|
|
90973
91017
|
) }),
|
|
90974
|
-
/* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(
|
|
90975
|
-
TimerStep,
|
|
90976
|
-
{
|
|
90977
|
-
state: registrationState,
|
|
90978
|
-
onTimerCompleted: () => {
|
|
90979
|
-
handleTimerPassed();
|
|
90980
|
-
}
|
|
90981
|
-
}
|
|
90982
|
-
) }),
|
|
91018
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(TimerStep, { state: registrationState, onTimerCompleted: handleTimerPassed }) }),
|
|
90983
91019
|
/* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(
|
|
90984
91020
|
RegistrationStep,
|
|
90985
91021
|
{
|
|
90986
91022
|
state: registrationState,
|
|
90987
91023
|
isTestnet,
|
|
90988
|
-
onStateUpdated:
|
|
90989
|
-
setRegistrationState(state);
|
|
90990
|
-
},
|
|
91024
|
+
onStateUpdated: setRegistrationState,
|
|
90991
91025
|
onSuccess
|
|
90992
91026
|
}
|
|
90993
91027
|
) })
|
|
@@ -90996,7 +91030,7 @@ const RegistrationProcess = ({
|
|
|
90996
91030
|
Modal,
|
|
90997
91031
|
{
|
|
90998
91032
|
isOpen: showConfirmClose,
|
|
90999
|
-
onClose:
|
|
91033
|
+
onClose: () => setShowConfirmClose(false),
|
|
91000
91034
|
title: "Leave Registration?",
|
|
91001
91035
|
size: "sm",
|
|
91002
91036
|
footer: /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8, width: "100%" }, children: [
|
|
@@ -91004,7 +91038,7 @@ const RegistrationProcess = ({
|
|
|
91004
91038
|
Button,
|
|
91005
91039
|
{
|
|
91006
91040
|
variant: "outline",
|
|
91007
|
-
onClick:
|
|
91041
|
+
onClick: () => setShowConfirmClose(false),
|
|
91008
91042
|
style: { flex: 1 },
|
|
91009
91043
|
children: "Cancel"
|
|
91010
91044
|
}
|
|
@@ -91013,7 +91047,10 @@ const RegistrationProcess = ({
|
|
|
91013
91047
|
Button,
|
|
91014
91048
|
{
|
|
91015
91049
|
variant: "destructive",
|
|
91016
|
-
onClick:
|
|
91050
|
+
onClick: () => {
|
|
91051
|
+
setShowConfirmClose(false);
|
|
91052
|
+
onBack?.(true);
|
|
91053
|
+
},
|
|
91017
91054
|
style: { flex: 1 },
|
|
91018
91055
|
children: "Leave"
|
|
91019
91056
|
}
|
|
@@ -91026,37 +91063,21 @@ const RegistrationProcess = ({
|
|
|
91026
91063
|
};
|
|
91027
91064
|
|
|
91028
91065
|
const getLabel = (name) => {
|
|
91029
|
-
if (!name)
|
|
91030
|
-
|
|
91031
|
-
}
|
|
91032
|
-
if (name.split(".").length !== 1) {
|
|
91033
|
-
return name.split(".")[0];
|
|
91034
|
-
}
|
|
91066
|
+
if (!name) return "";
|
|
91067
|
+
if (name.split(".").length !== 1) return name.split(".")[0];
|
|
91035
91068
|
return name;
|
|
91036
91069
|
};
|
|
91037
91070
|
const EnsNameRegistrationForm = (props) => {
|
|
91038
91071
|
const [label, setLabel] = useState(getLabel(props.name));
|
|
91039
|
-
const [step, setStep] = useState(
|
|
91040
|
-
|
|
91041
|
-
);
|
|
91042
|
-
const [years, setYears] = useState(1);
|
|
91072
|
+
const [step, setStep] = useState(0 /* Summary */);
|
|
91073
|
+
const [durationSeconds, setDurationSeconds] = useState(() => secondsFromYears(/* @__PURE__ */ new Date(), 1));
|
|
91043
91074
|
const [regTxFees, setRegTxFees] = useState({
|
|
91044
91075
|
estimatedGas: 0,
|
|
91045
91076
|
isChecking: false,
|
|
91046
|
-
price: {
|
|
91047
|
-
wei: 0n,
|
|
91048
|
-
eth: 1e-4
|
|
91049
|
-
}
|
|
91050
|
-
});
|
|
91051
|
-
const [price, setPrice] = useState({
|
|
91052
|
-
isChecking: false,
|
|
91053
|
-
wei: 0n,
|
|
91054
|
-
eth: 0
|
|
91055
|
-
});
|
|
91056
|
-
const [nameValidation, setNameValidation] = useState({
|
|
91057
|
-
isChecking: false,
|
|
91058
|
-
isTaken: false
|
|
91077
|
+
price: { wei: 0n, eth: 1e-4 }
|
|
91059
91078
|
});
|
|
91079
|
+
const [price, setPrice] = useState({ isChecking: false, wei: 0n, eth: 0 });
|
|
91080
|
+
const [nameValidation, setNameValidation] = useState({ isChecking: false, isTaken: false });
|
|
91060
91081
|
const [showProfile, setShowProfile] = useState(false);
|
|
91061
91082
|
const [ensRecordTemplate, setEnsRecordsTemplate] = useState({
|
|
91062
91083
|
addresses: [],
|
|
@@ -91066,9 +91087,10 @@ const EnsNameRegistrationForm = (props) => {
|
|
|
91066
91087
|
addresses: [],
|
|
91067
91088
|
texts: []
|
|
91068
91089
|
});
|
|
91069
|
-
const hasRecordsDifference = useMemo(
|
|
91070
|
-
|
|
91071
|
-
|
|
91090
|
+
const hasRecordsDifference = useMemo(
|
|
91091
|
+
() => getEnsRecordsDiff(ensRecords, ensRecordTemplate).isDifferent,
|
|
91092
|
+
[ensRecords, ensRecordTemplate]
|
|
91093
|
+
);
|
|
91072
91094
|
const [successData, setSuccessData] = useState();
|
|
91073
91095
|
const handleSaveRecords = () => {
|
|
91074
91096
|
setEnsRecords(deepCopy(ensRecordTemplate));
|
|
@@ -91080,7 +91102,7 @@ const EnsNameRegistrationForm = (props) => {
|
|
|
91080
91102
|
};
|
|
91081
91103
|
const clearInputState = () => {
|
|
91082
91104
|
setLabel("");
|
|
91083
|
-
|
|
91105
|
+
setDurationSeconds(secondsFromYears(/* @__PURE__ */ new Date(), 1));
|
|
91084
91106
|
setEnsRecords({ addresses: [], texts: [] });
|
|
91085
91107
|
setEnsRecordsTemplate({ addresses: [], texts: [] });
|
|
91086
91108
|
setNameValidation({ isChecking: false, isTaken: false });
|
|
@@ -91111,7 +91133,7 @@ const EnsNameRegistrationForm = (props) => {
|
|
|
91111
91133
|
RegistrationSummary,
|
|
91112
91134
|
{
|
|
91113
91135
|
label,
|
|
91114
|
-
|
|
91136
|
+
durationSeconds,
|
|
91115
91137
|
price,
|
|
91116
91138
|
nameValidation,
|
|
91117
91139
|
isTestnet: props.isTestnet || false,
|
|
@@ -91122,7 +91144,7 @@ const EnsNameRegistrationForm = (props) => {
|
|
|
91122
91144
|
hideBanner: props.hideBanner,
|
|
91123
91145
|
bannerWidth: props.bannerWidth,
|
|
91124
91146
|
onLabelChange: setLabel,
|
|
91125
|
-
|
|
91147
|
+
onDurationChange: setDurationSeconds,
|
|
91126
91148
|
onPriceChange: setPrice,
|
|
91127
91149
|
onNameValidationChange: setNameValidation,
|
|
91128
91150
|
onSetProfile: () => setShowProfile(true),
|
|
@@ -91136,13 +91158,11 @@ const EnsNameRegistrationForm = (props) => {
|
|
|
91136
91158
|
{
|
|
91137
91159
|
isTestnet: props.isTestnet || false,
|
|
91138
91160
|
label,
|
|
91139
|
-
|
|
91161
|
+
durationInSeconds: durationSeconds,
|
|
91140
91162
|
records: ensRecords,
|
|
91141
91163
|
referrer: props.referrer,
|
|
91142
91164
|
onBack: (clearState) => {
|
|
91143
|
-
if (clearState)
|
|
91144
|
-
clearInputState();
|
|
91145
|
-
}
|
|
91165
|
+
if (clearState) clearInputState();
|
|
91146
91166
|
setStep(0 /* Summary */);
|
|
91147
91167
|
},
|
|
91148
91168
|
onStart: props.onRegistrationStart,
|
|
@@ -91157,7 +91177,7 @@ const EnsNameRegistrationForm = (props) => {
|
|
|
91157
91177
|
SuccessScreen$1,
|
|
91158
91178
|
{
|
|
91159
91179
|
ensName: label,
|
|
91160
|
-
|
|
91180
|
+
durationLabel: successData.durationLabel,
|
|
91161
91181
|
registrationCost: successData.registrationCost,
|
|
91162
91182
|
transactionFees: successData.transactionFees,
|
|
91163
91183
|
total: successData.total,
|
|
@@ -92620,7 +92640,7 @@ const SubnameMintFormContent = ({
|
|
|
92620
92640
|
const hasRecordsDifference = useMemo(() => {
|
|
92621
92641
|
return getEnsRecordsDiff(ensRecords, ensRecordTemplate).isDifferent;
|
|
92622
92642
|
}, [ensRecords, ensRecordTemplate]);
|
|
92623
|
-
const [
|
|
92643
|
+
const [durationSeconds, setDurationSeconds] = useState(() => secondsFromYears(/* @__PURE__ */ new Date(), 1));
|
|
92624
92644
|
const [availability, setAvailability] = useState({
|
|
92625
92645
|
isChecking: false,
|
|
92626
92646
|
isAvailable: true
|
|
@@ -92714,11 +92734,8 @@ const SubnameMintFormContent = ({
|
|
|
92714
92734
|
isFree: isFree2
|
|
92715
92735
|
};
|
|
92716
92736
|
}, [mintDetails, transactionFees]);
|
|
92717
|
-
const
|
|
92718
|
-
|
|
92719
|
-
return;
|
|
92720
|
-
}
|
|
92721
|
-
setYears(newYears);
|
|
92737
|
+
const handleDurationChange = (seconds) => {
|
|
92738
|
+
setDurationSeconds(seconds);
|
|
92722
92739
|
};
|
|
92723
92740
|
const totalPriceLoading = transactionFees.isChecking || mintDetails.isChecking;
|
|
92724
92741
|
const transactionFeesLoading = transactionFees.isChecking;
|
|
@@ -93021,8 +93038,8 @@ const SubnameMintFormContent = ({
|
|
|
93021
93038
|
isChecking: totalPriceLoading
|
|
93022
93039
|
},
|
|
93023
93040
|
expiryPicker: isExpirable ? {
|
|
93024
|
-
|
|
93025
|
-
|
|
93041
|
+
durationSeconds,
|
|
93042
|
+
onDurationChange: handleDurationChange
|
|
93026
93043
|
} : void 0,
|
|
93027
93044
|
ethUsdRate
|
|
93028
93045
|
}
|
|
@@ -93629,5 +93646,5 @@ const useTheme = () => {
|
|
|
93629
93646
|
return ctx;
|
|
93630
93647
|
};
|
|
93631
93648
|
|
|
93632
|
-
export { Accordion, Alert, Button, Card, ChainIcon, ConnectAndSetChain, ContenthashIcon, ContenthashProtocol, ContractErrorLabel, Dropdown, ENS_RESOLVER_ABI, EnsNameRegistrationForm, EnsRecordsForm, Icon, Input, ListingNetwork, ListingType, MULTICALL, Modal, OffchainSubnameForm, PricingDisplay, ProfileHeader, ProgressBar, SET_ADDRESS_FUNC, SET_CONTENTHASH_FUNC, SET_TEXT_FUNC, SelectRecordsForm, ShurikenSpinner, SubnameMintForm, Text, TextRecordCategory, Textarea, ThemeProvider, Tooltip, TransactionPendingScreen, TxProgress, capitalize, convertEVMChainIdToCoinType, convertToMulticallResolverData, convertToResolverData, createEnsReferer, debounce, deepCopy, diffToEnsRecords, ensureFloatInput, equalsIgnoreCase, formatFloat, getAvatarUploadErrorMessage, getBlockExplorer, getBlockExplorerAddressUrl, getBlockExplorerName, getBlockExplorerTransactionUrl, getChainIdForListingNetwork, getEnsAppUrl, getEnsRecordsDiff, getImageUploadErrorMessage, getSupportedAddressByChainId, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isCommitmentToNewErr, isContenthashValid, isUserDeniedError, supportedAddresses, supportedContenthashRecords, supportedTexts, useAvatarClient, useENSResolver, useEthDollarValue, useMintManager, useMintSubname, useOffchainManager, useRegisterENS, useTheme, useWaitTransaction, validateEnsRecords, wait };
|
|
93649
|
+
export { Accordion, Alert, Button, Card, ChainIcon, ConnectAndSetChain, ContenthashIcon, ContenthashProtocol, ContractErrorLabel, Dropdown, DurationPicker, ENS_RESOLVER_ABI, EnsNameRegistrationForm, EnsRecordsForm, Icon, Input, ListingNetwork, ListingType, MIN_REGISTRATION_SECONDS, MULTICALL, Modal, ONE_DAY, ONE_YEAR, OffchainSubnameForm, PricingDisplay, ProfileHeader, ProgressBar, SET_ADDRESS_FUNC, SET_CONTENTHASH_FUNC, SET_TEXT_FUNC, SelectRecordsForm, ShurikenSpinner, SubnameMintForm, Text, TextRecordCategory, Textarea, ThemeProvider, Tooltip, TransactionPendingScreen, TxProgress, capitalize, convertEVMChainIdToCoinType, convertToMulticallResolverData, convertToResolverData, createEnsReferer, debounce, deepCopy, diffToEnsRecords, ensureFloatInput, equalsIgnoreCase, formatDurationSummary, formatFloat, getAvatarUploadErrorMessage, getBlockExplorer, getBlockExplorerAddressUrl, getBlockExplorerName, getBlockExplorerTransactionUrl, getChainIdForListingNetwork, getEnsAppUrl, getEnsRecordsDiff, getImageUploadErrorMessage, getSupportedAddressByChainId, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isCommitmentToNewErr, isContenthashValid, isUserDeniedError, roundDurationWithDay, secondsFromYears, secondsToDateInput, supportedAddresses, supportedContenthashRecords, supportedTexts, useAvatarClient, useENSResolver, useEthDollarValue, useMintManager, useMintSubname, useOffchainManager, useRegisterENS, useTheme, useWaitTransaction, validateEnsRecords, wait, yearsFromSeconds };
|
|
93633
93650
|
//# sourceMappingURL=index.js.map
|