@cmdoss/walrus-site-builder-react 2.2.0 → 2.4.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.js CHANGED
@@ -921,11 +921,38 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
921
921
  const [isSwapping, setIsSwapping] = useState(false);
922
922
  const [estimatedPrice, setEstimatedPrice] = useState(null);
923
923
  const [error, setError] = useState(null);
924
+ const [selectedYears, setSelectedYears] = useState(1);
925
+ const [pricePerYear, setPricePerYear] = useState(null);
926
+ const [pricePerYearFormatted, setPricePerYearFormatted] = useState(null);
927
+ const [pricePerYearUsdc, setPricePerYearUsdc] = useState(null);
928
+ const [totalPriceUsdc, setTotalPriceUsdc] = useState(null);
929
+ const priceRefreshIntervalRef = useRef(null);
924
930
  const normalizedName = searchName.toLowerCase().trim();
925
931
  const fullName = normalizedName ? `${normalizedName}.sui` : "";
926
932
  const network = suiClient.network;
927
933
  const isMainnet = network === "mainnet";
928
934
  const isTestnet = network === "testnet";
935
+ const expirationDate = useMemo(() => {
936
+ if (!selectedYears) return null;
937
+ const date = /* @__PURE__ */ new Date();
938
+ date.setFullYear(date.getFullYear() + selectedYears);
939
+ return date;
940
+ }, [selectedYears]);
941
+ const totalPrice = useMemo(() => {
942
+ if (!pricePerYear || !selectedYears) return null;
943
+ return pricePerYear * selectedYears;
944
+ }, [pricePerYear, selectedYears]);
945
+ const totalPriceFormatted = useMemo(() => {
946
+ if (!totalPrice || !pricePerYearFormatted) return null;
947
+ const perYearValue = parseFloat(pricePerYearFormatted.replace(/[^\d.]/g, ""));
948
+ if (Number.isNaN(perYearValue)) return null;
949
+ const totalValue = perYearValue * selectedYears;
950
+ return pricePerYearFormatted.replace(/[\d.]+/, totalValue.toFixed(4));
951
+ }, [
952
+ totalPrice,
953
+ pricePerYearFormatted,
954
+ selectedYears
955
+ ]);
929
956
  const WAL_COIN_TYPE = mainPackage[network]?.walrusCoinType;
930
957
  const aggregatorClient = useMemo(() => {
931
958
  if (!suiClient || !currentAccount || !isMainnet) return null;
@@ -939,6 +966,131 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
939
966
  currentAccount,
940
967
  isMainnet
941
968
  ]);
969
+ const updatePriceEstimate = useCallback(async () => {
970
+ if (!suinsClient || !currentAccount || !isMainnet || !WAL_COIN_TYPE || !aggregatorClient || !normalizedName) return;
971
+ const priceList = await suinsClient.getPriceList();
972
+ const nameLength = normalizedName.length;
973
+ let pricePerYearValue = 0;
974
+ for (const [[from, to], price] of priceList.entries()) if (nameLength >= from && nameLength <= to) {
975
+ pricePerYearValue = price;
976
+ break;
977
+ }
978
+ if (pricePerYearValue > 0) {
979
+ setPricePerYear(pricePerYearValue);
980
+ const totalPriceValue = pricePerYearValue * selectedYears;
981
+ const requiredAmount = BigInt(Math.floor(totalPriceValue * 1.05));
982
+ const usdcBalance = (await suiClient.getCoins({
983
+ owner: currentAccount.address,
984
+ coinType: suinsClient.config.coins.USDC.type
985
+ })).data?.reduce((sum, coin) => sum + BigInt(coin.balance), 0n) ?? 0n;
986
+ const missingUsdc = usdcBalance < requiredAmount ? requiredAmount - usdcBalance : requiredAmount;
987
+ const baseWalAtomic = 1000000000n;
988
+ const rateRouter = await aggregatorClient.findRouters({
989
+ from: WAL_COIN_TYPE,
990
+ target: suinsClient.config.coins.USDC.type,
991
+ amount: new BN(baseWalAtomic.toString()),
992
+ byAmountIn: true,
993
+ providers: ["CETUS"]
994
+ });
995
+ if (rateRouter && !rateRouter.error && rateRouter.amountOut) {
996
+ const rawAmountOut = rateRouter.amountOut;
997
+ const usdcOutForOneWal = BigInt(rawAmountOut instanceof BN ? rawAmountOut.toString() : new BN(String(rawAmountOut)).toString());
998
+ if (usdcOutForOneWal > 0n) {
999
+ const exchangeRate = Number(baseWalAtomic) / Number(usdcOutForOneWal);
1000
+ const estimatedWalNeeded = missingUsdc * BigInt(Math.ceil(exchangeRate));
1001
+ const walNeededFormatted = (Number(estimatedWalNeeded) / 1e9).toFixed(4);
1002
+ setPricePerYearFormatted(`${(Number(estimatedWalNeeded) / selectedYears / 1e9).toFixed(4)} WAL`);
1003
+ setEstimatedPrice(`~${walNeededFormatted} WAL`);
1004
+ } else {
1005
+ const usdcPrice = (Number(requiredAmount) / 1e6).toFixed(2);
1006
+ setPricePerYearFormatted(`${(pricePerYearValue / 1e6).toFixed(2)} USDC`);
1007
+ setEstimatedPrice(`~${usdcPrice} USDC`);
1008
+ }
1009
+ } else {
1010
+ const usdcPrice = (Number(requiredAmount) / 1e6).toFixed(2);
1011
+ setPricePerYearFormatted(`${(pricePerYearValue / 1e6).toFixed(2)} USDC`);
1012
+ setEstimatedPrice(`~${usdcPrice} USDC`);
1013
+ }
1014
+ }
1015
+ }, [
1016
+ suinsClient,
1017
+ currentAccount,
1018
+ isMainnet,
1019
+ WAL_COIN_TYPE,
1020
+ aggregatorClient,
1021
+ normalizedName,
1022
+ selectedYears,
1023
+ suiClient
1024
+ ]);
1025
+ const updateTestnetPriceEstimate = useCallback(async () => {
1026
+ if (!suinsClient || !currentAccount || !isTestnet || !normalizedName) return;
1027
+ const priceList = await suinsClient.getPriceList();
1028
+ const nameLength = normalizedName.length;
1029
+ let pricePerYearValue = 0;
1030
+ for (const [[from, to], price] of priceList.entries()) if (nameLength >= from && nameLength <= to) {
1031
+ pricePerYearValue = price;
1032
+ break;
1033
+ }
1034
+ if (pricePerYearValue > 0) {
1035
+ setPricePerYear(pricePerYearValue);
1036
+ const totalPriceValue = pricePerYearValue * selectedYears;
1037
+ const usdcAmountAtomic = BigInt(Math.floor(totalPriceValue));
1038
+ const suiNeededAtomic = usdcAmountAtomic * 2n * 1000000000n / (3n * 1000000n);
1039
+ const suiPerYearAtomic = BigInt(Math.floor(pricePerYearValue)) * 2n * 1000000000n / (3n * 1000000n);
1040
+ const suiNeededFormatted = (Number(suiNeededAtomic) / 1e9).toFixed(4);
1041
+ const suiPerYearFormatted = (Number(suiPerYearAtomic) / 1e9).toFixed(4);
1042
+ const usdcPrice = (Number(usdcAmountAtomic) / 1e6).toFixed(2);
1043
+ const usdcPerYear = (pricePerYearValue / 1e6).toFixed(2);
1044
+ setPricePerYearFormatted(`${suiPerYearFormatted} SUI`);
1045
+ setEstimatedPrice(`${suiNeededFormatted} SUI`);
1046
+ setPricePerYearUsdc(`${usdcPerYear} USDC`);
1047
+ setTotalPriceUsdc(`${usdcPrice} USDC`);
1048
+ }
1049
+ }, [
1050
+ suinsClient,
1051
+ currentAccount,
1052
+ isTestnet,
1053
+ normalizedName,
1054
+ selectedYears
1055
+ ]);
1056
+ useEffect(() => {
1057
+ if (isMainnet && isAvailable && normalizedName && !isRegistering && aggregatorClient) {
1058
+ if (priceRefreshIntervalRef.current) clearInterval(priceRefreshIntervalRef.current);
1059
+ priceRefreshIntervalRef.current = setInterval(() => {
1060
+ updatePriceEstimate().catch((err) => {
1061
+ console.error("Error refreshing price:", err);
1062
+ });
1063
+ }, 1e4);
1064
+ return () => {
1065
+ if (priceRefreshIntervalRef.current) clearInterval(priceRefreshIntervalRef.current);
1066
+ };
1067
+ }
1068
+ }, [
1069
+ isMainnet,
1070
+ isAvailable,
1071
+ normalizedName,
1072
+ isRegistering,
1073
+ aggregatorClient,
1074
+ updatePriceEstimate
1075
+ ]);
1076
+ useEffect(() => {
1077
+ if (isAvailable && pricePerYear !== null) {
1078
+ if (isMainnet && aggregatorClient) updatePriceEstimate().catch((err) => {
1079
+ console.error("Error updating price:", err);
1080
+ });
1081
+ else if (isTestnet) updateTestnetPriceEstimate().catch((err) => {
1082
+ console.error("Error updating price:", err);
1083
+ });
1084
+ }
1085
+ }, [
1086
+ isAvailable,
1087
+ pricePerYear,
1088
+ isMainnet,
1089
+ isTestnet,
1090
+ aggregatorClient,
1091
+ updatePriceEstimate,
1092
+ updateTestnetPriceEstimate
1093
+ ]);
942
1094
  return {
943
1095
  searchName,
944
1096
  setSearchName,
@@ -950,6 +1102,15 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
950
1102
  error,
951
1103
  normalizedName,
952
1104
  fullName,
1105
+ selectedYears,
1106
+ setSelectedYears,
1107
+ pricePerYear,
1108
+ pricePerYearFormatted,
1109
+ pricePerYearUsdc,
1110
+ totalPrice,
1111
+ totalPriceFormatted,
1112
+ totalPriceUsdc,
1113
+ expirationDate,
953
1114
  handleSearch: useCallback(async () => {
954
1115
  if (!normalizedName || !suinsClient) return;
955
1116
  if (normalizedName.length < 3) {
@@ -965,40 +1126,9 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
965
1126
  try {
966
1127
  const available = !(await suinsClient.getNameRecord(fullName))?.nftId;
967
1128
  setIsAvailable(available);
968
- if (available && currentAccount && isMainnet && WAL_COIN_TYPE && aggregatorClient) try {
969
- const priceList = await suinsClient.getPriceList();
970
- const nameLength = normalizedName.length;
971
- let pricePerYear = 0;
972
- for (const [[from, to], price] of priceList.entries()) if (nameLength >= from && nameLength <= to) {
973
- pricePerYear = price;
974
- break;
975
- }
976
- if (pricePerYear > 0) {
977
- const totalPrice = pricePerYear * 1;
978
- const requiredAmount = BigInt(Math.floor(totalPrice * 1.05));
979
- const usdcBalance = (await suiClient.getCoins({
980
- owner: currentAccount.address,
981
- coinType: suinsClient.config.coins.USDC.type
982
- })).data?.reduce((sum, coin) => sum + BigInt(coin.balance), 0n) ?? 0n;
983
- const missingUsdc = usdcBalance < requiredAmount ? requiredAmount - usdcBalance : requiredAmount;
984
- const baseWalAtomic = 1000000000n;
985
- const rateRouter = await aggregatorClient.findRouters({
986
- from: WAL_COIN_TYPE,
987
- target: suinsClient.config.coins.USDC.type,
988
- amount: new BN(baseWalAtomic.toString()),
989
- byAmountIn: true,
990
- providers: ["CETUS"]
991
- });
992
- if (rateRouter && !rateRouter.error && rateRouter.amountOut) {
993
- const rawAmountOut = rateRouter.amountOut;
994
- const usdcOutForOneWal = BigInt(rawAmountOut instanceof BN ? rawAmountOut.toString() : new BN(String(rawAmountOut)).toString());
995
- if (usdcOutForOneWal > 0n) {
996
- const exchangeRate = Number(baseWalAtomic) / Number(usdcOutForOneWal);
997
- const estimatedWalNeeded = missingUsdc * BigInt(Math.ceil(exchangeRate));
998
- setEstimatedPrice(`~${(Number(estimatedWalNeeded) / 1e9).toFixed(4)} WAL`);
999
- } else setEstimatedPrice(`~${(Number(requiredAmount) / 1e6).toFixed(2)} USDC`);
1000
- } else setEstimatedPrice(`~${(Number(requiredAmount) / 1e6).toFixed(2)} USDC`);
1001
- }
1129
+ if (available && currentAccount && aggregatorClient) try {
1130
+ if (isMainnet && WAL_COIN_TYPE) await updatePriceEstimate();
1131
+ else if (isTestnet) await updateTestnetPriceEstimate();
1002
1132
  } catch (priceError) {
1003
1133
  console.error("Error estimating price:", priceError);
1004
1134
  }
@@ -1014,9 +1144,11 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
1014
1144
  suinsClient,
1015
1145
  currentAccount,
1016
1146
  isMainnet,
1147
+ isTestnet,
1017
1148
  WAL_COIN_TYPE,
1018
1149
  aggregatorClient,
1019
- suiClient
1150
+ updatePriceEstimate,
1151
+ updateTestnetPriceEstimate
1020
1152
  ]),
1021
1153
  handleRegister: useCallback(async () => {
1022
1154
  if (!suinsClient || !currentAccount || !isAvailable || !normalizedName) return;
@@ -1029,14 +1161,14 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
1029
1161
  try {
1030
1162
  const priceList = await suinsClient.getPriceList();
1031
1163
  const nameLength = normalizedName.length;
1032
- let pricePerYear = 0;
1164
+ let pricePerYear$1 = 0;
1033
1165
  for (const [[from, to], price] of priceList.entries()) if (nameLength >= from && nameLength <= to) {
1034
- pricePerYear = price;
1166
+ pricePerYear$1 = price;
1035
1167
  break;
1036
1168
  }
1037
- if (pricePerYear === 0) throw new Error("Unable to determine price for this domain");
1038
- const years = 1;
1039
- const totalPrice = pricePerYear * years;
1169
+ if (pricePerYear$1 === 0) throw new Error("Unable to determine price for this domain");
1170
+ const years = selectedYears;
1171
+ const totalPrice$1 = pricePerYear$1 * years;
1040
1172
  const coinType = isTestnet ? "SUI" : "USDC";
1041
1173
  const coinConfig = suinsClient.config.coins[coinType];
1042
1174
  const [usdcCoins, walCoins] = await Promise.all([isMainnet ? suiClient.getCoins({
@@ -1048,7 +1180,7 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
1048
1180
  }) : Promise.resolve({ data: [] })]);
1049
1181
  const usdcBalance = usdcCoins.data?.reduce((sum, coin) => sum + BigInt(coin.balance), 0n) ?? 0n;
1050
1182
  const walBalance = walCoins.data?.reduce((sum, coin) => sum + BigInt(coin.balance), 0n) ?? 0n;
1051
- const requiredAmount = BigInt(Math.floor(totalPrice * 1.05));
1183
+ const requiredAmount = BigInt(Math.floor(totalPrice$1 * 1.05));
1052
1184
  if (isMainnet && coinType === "USDC") {
1053
1185
  if (usdcBalance < requiredAmount) {
1054
1186
  if (!aggregatorClient || !WAL_COIN_TYPE) throw new Error("Swap client not ready. Please try again in a few seconds.");
@@ -1115,7 +1247,7 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
1115
1247
  coinType: coinConfig.type
1116
1248
  });
1117
1249
  if (coins.data.length === 0) throw new Error(`No ${coinType} coins found in your wallet`);
1118
- const maxPaymentAmount = Math.floor(totalPrice * 1.05);
1250
+ const maxPaymentAmount = Math.floor(totalPrice$1 * 1.05);
1119
1251
  const totalBalance = coins.data.reduce((sum, coin) => sum + BigInt(coin.balance), 0n);
1120
1252
  const requiredBalance = BigInt(maxPaymentAmount) + 10000000n;
1121
1253
  if (totalBalance < requiredBalance) throw new Error(`Insufficient balance. Need approximately ${(Number(requiredBalance) / 1e9).toFixed(4)} ${coinType}`);
@@ -1174,6 +1306,7 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
1174
1306
  isAvailable,
1175
1307
  normalizedName,
1176
1308
  fullName,
1309
+ selectedYears,
1177
1310
  txExecutor,
1178
1311
  isTestnet,
1179
1312
  isMainnet,
@@ -1191,6 +1324,15 @@ function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClien
1191
1324
  setIsSearching(false);
1192
1325
  setIsRegistering(false);
1193
1326
  setIsSwapping(false);
1327
+ setSelectedYears(1);
1328
+ setPricePerYear(null);
1329
+ setPricePerYearFormatted(null);
1330
+ setPricePerYearUsdc(null);
1331
+ setTotalPriceUsdc(null);
1332
+ if (priceRefreshIntervalRef.current) {
1333
+ clearInterval(priceRefreshIntervalRef.current);
1334
+ priceRefreshIntervalRef.current = null;
1335
+ }
1194
1336
  }, [])
1195
1337
  };
1196
1338
  }
@@ -4331,7 +4473,7 @@ var title = "SuiNsModal_title__lh8k8k3";
4331
4473
  //#endregion
4332
4474
  //#region src/components/suins-modal/RegisterSuiNsDialog.tsx
4333
4475
  const RegisterSuiNsDialog = ({ isOpen, onClose, onRegistered, currentAccount, clients: { suiClient, queryClient, suinsClient }, signAndExecuteTransaction, sponsorConfig }) => {
4334
- const { searchName, setSearchName, isSearching, isAvailable, isRegistering, isSwapping, estimatedPrice, error, normalizedName, fullName, handleSearch, handleRegister: handleRegisterInternal, reset } = useSuiNsRegistration({
4476
+ const { searchName, setSearchName, isSearching, isAvailable, isRegistering, isSwapping, estimatedPrice, error, normalizedName, fullName, selectedYears, setSelectedYears, pricePerYearFormatted, pricePerYearUsdc, totalPriceFormatted, totalPriceUsdc, expirationDate, handleSearch, handleRegister: handleRegisterInternal, reset } = useSuiNsRegistration({
4335
4477
  currentAccount,
4336
4478
  clients: {
4337
4479
  suiClient,
@@ -4341,6 +4483,7 @@ const RegisterSuiNsDialog = ({ isOpen, onClose, onRegistered, currentAccount, cl
4341
4483
  signAndExecuteTransaction,
4342
4484
  sponsorConfig
4343
4485
  });
4486
+ const isTestnet = suiClient.network === "testnet";
4344
4487
  const handleRegister = async () => {
4345
4488
  if (await handleRegisterInternal()) {
4346
4489
  if (onRegistered) onRegistered();
@@ -4519,25 +4662,230 @@ const RegisterSuiNsDialog = ({ isOpen, onClose, onRegistered, currentAccount, cl
4519
4662
  width: "1.25rem",
4520
4663
  height: "1.25rem",
4521
4664
  flexShrink: 0
4522
- } }), /* @__PURE__ */ jsxs("div", {
4665
+ } }), /* @__PURE__ */ jsx("div", {
4523
4666
  style: {
4524
4667
  flex: 1,
4525
4668
  minWidth: 0
4526
4669
  },
4527
- children: [/* @__PURE__ */ jsx("p", {
4670
+ children: /* @__PURE__ */ jsx("p", {
4528
4671
  style: {
4529
4672
  fontSize: "0.875rem",
4530
4673
  fontWeight: 600
4531
4674
  },
4532
4675
  children: isAvailable ? `${fullName} is available!` : `${fullName} is already taken`
4533
- }), isAvailable && estimatedPrice && /* @__PURE__ */ jsxs("p", {
4676
+ })
4677
+ })]
4678
+ }),
4679
+ isAvailable && /* @__PURE__ */ jsxs("div", {
4680
+ style: { marginBottom: "1rem" },
4681
+ children: [/* @__PURE__ */ jsx("label", {
4682
+ htmlFor: "year-select",
4683
+ style: {
4684
+ display: "block",
4685
+ fontSize: "0.875rem",
4686
+ fontWeight: 500,
4687
+ marginBottom: "0.5rem"
4688
+ },
4689
+ children: "Registration Period"
4690
+ }), /* @__PURE__ */ jsx("div", {
4691
+ style: {
4692
+ display: "flex",
4693
+ gap: "0.5rem",
4694
+ flexWrap: "wrap"
4695
+ },
4696
+ children: [
4697
+ 1,
4698
+ 2,
4699
+ 3,
4700
+ 4,
4701
+ 5
4702
+ ].map((year) => /* @__PURE__ */ jsxs("button", {
4703
+ type: "button",
4704
+ onClick: () => setSelectedYears(year),
4705
+ disabled: isRegistering || isSwapping,
4534
4706
  style: {
4535
- fontSize: "0.75rem",
4536
- opacity: .8,
4537
- marginTop: "0.125rem"
4707
+ padding: "0.5rem 1rem",
4708
+ borderRadius: "0.375rem",
4709
+ border: `1px solid ${selectedYears === year ? "rgba(59, 130, 246, 0.5)" : "rgba(229, 231, 235, 1)"}`,
4710
+ backgroundColor: selectedYears === year ? "rgba(59, 130, 246, 0.1)" : "transparent",
4711
+ color: selectedYears === year ? "rgb(37, 99, 235)" : "inherit",
4712
+ fontWeight: selectedYears === year ? 600 : 400,
4713
+ cursor: isRegistering || isSwapping ? "not-allowed" : "pointer",
4714
+ fontSize: "0.875rem",
4715
+ transition: "all 0.2s",
4716
+ opacity: isRegistering || isSwapping ? .5 : 1
4538
4717
  },
4539
- children: ["Estimated cost: ", estimatedPrice]
4540
- })]
4718
+ children: [
4719
+ year,
4720
+ " ",
4721
+ year === 1 ? "Year" : "Years"
4722
+ ]
4723
+ }, year))
4724
+ })]
4725
+ }),
4726
+ isAvailable && (pricePerYearFormatted || estimatedPrice) && /* @__PURE__ */ jsxs("div", {
4727
+ style: {
4728
+ padding: "1rem",
4729
+ borderRadius: "0.5rem",
4730
+ backgroundColor: "rgba(249, 250, 251, 1)",
4731
+ border: "1px solid rgba(229, 231, 235, 1)",
4732
+ marginBottom: "1rem"
4733
+ },
4734
+ children: [/* @__PURE__ */ jsx("h3", {
4735
+ style: {
4736
+ fontSize: "0.875rem",
4737
+ fontWeight: 600,
4738
+ marginBottom: "0.75rem",
4739
+ color: "rgb(17, 24, 39)"
4740
+ },
4741
+ children: "Price Breakdown"
4742
+ }), /* @__PURE__ */ jsxs("div", {
4743
+ style: {
4744
+ display: "flex",
4745
+ flexDirection: "column",
4746
+ gap: "0.5rem"
4747
+ },
4748
+ children: [
4749
+ /* @__PURE__ */ jsxs("div", {
4750
+ style: {
4751
+ display: "flex",
4752
+ justifyContent: "space-between",
4753
+ alignItems: "center"
4754
+ },
4755
+ children: [/* @__PURE__ */ jsx("span", {
4756
+ style: {
4757
+ fontSize: "0.875rem",
4758
+ color: "rgb(107, 114, 128)"
4759
+ },
4760
+ children: "Price per year:"
4761
+ }), /* @__PURE__ */ jsxs("div", {
4762
+ style: {
4763
+ display: "flex",
4764
+ flexDirection: "column",
4765
+ alignItems: "flex-end",
4766
+ gap: "0.125rem"
4767
+ },
4768
+ children: [/* @__PURE__ */ jsx("span", {
4769
+ style: {
4770
+ fontSize: "0.875rem",
4771
+ fontWeight: 600,
4772
+ color: "rgb(17, 24, 39)"
4773
+ },
4774
+ children: pricePerYearFormatted || estimatedPrice
4775
+ }), isTestnet && pricePerYearUsdc && /* @__PURE__ */ jsxs("span", {
4776
+ style: {
4777
+ fontSize: "0.75rem",
4778
+ color: "rgb(107, 114, 128)",
4779
+ opacity: .8
4780
+ },
4781
+ children: [
4782
+ "(",
4783
+ pricePerYearUsdc,
4784
+ ")"
4785
+ ]
4786
+ })]
4787
+ })]
4788
+ }),
4789
+ /* @__PURE__ */ jsxs("div", {
4790
+ style: {
4791
+ display: "flex",
4792
+ justifyContent: "space-between",
4793
+ alignItems: "center"
4794
+ },
4795
+ children: [/* @__PURE__ */ jsx("span", {
4796
+ style: {
4797
+ fontSize: "0.875rem",
4798
+ color: "rgb(107, 114, 128)"
4799
+ },
4800
+ children: "Number of years:"
4801
+ }), /* @__PURE__ */ jsx("span", {
4802
+ style: {
4803
+ fontSize: "0.875rem",
4804
+ fontWeight: 600,
4805
+ color: "rgb(17, 24, 39)"
4806
+ },
4807
+ children: selectedYears
4808
+ })]
4809
+ }),
4810
+ /* @__PURE__ */ jsx("div", { style: {
4811
+ height: "1px",
4812
+ backgroundColor: "rgba(229, 231, 235, 1)",
4813
+ margin: "0.5rem 0"
4814
+ } }),
4815
+ /* @__PURE__ */ jsxs("div", {
4816
+ style: {
4817
+ display: "flex",
4818
+ justifyContent: "space-between",
4819
+ alignItems: "center"
4820
+ },
4821
+ children: [/* @__PURE__ */ jsx("span", {
4822
+ style: {
4823
+ fontSize: "0.875rem",
4824
+ fontWeight: 600,
4825
+ color: "rgb(17, 24, 39)"
4826
+ },
4827
+ children: "Total:"
4828
+ }), /* @__PURE__ */ jsxs("div", {
4829
+ style: {
4830
+ display: "flex",
4831
+ flexDirection: "column",
4832
+ alignItems: "flex-end",
4833
+ gap: "0.125rem"
4834
+ },
4835
+ children: [/* @__PURE__ */ jsx("span", {
4836
+ style: {
4837
+ fontSize: "1rem",
4838
+ fontWeight: 700,
4839
+ color: "rgb(17, 24, 39)"
4840
+ },
4841
+ children: totalPriceFormatted || estimatedPrice
4842
+ }), isTestnet && totalPriceUsdc && /* @__PURE__ */ jsxs("span", {
4843
+ style: {
4844
+ fontSize: "0.75rem",
4845
+ color: "rgb(107, 114, 128)",
4846
+ opacity: .8
4847
+ },
4848
+ children: [
4849
+ "(",
4850
+ totalPriceUsdc,
4851
+ ")"
4852
+ ]
4853
+ })]
4854
+ })]
4855
+ }),
4856
+ expirationDate && /* @__PURE__ */ jsx("div", {
4857
+ style: {
4858
+ marginTop: "0.5rem",
4859
+ paddingTop: "0.5rem",
4860
+ borderTop: "1px solid rgba(229, 231, 235, 1)"
4861
+ },
4862
+ children: /* @__PURE__ */ jsxs("div", {
4863
+ style: {
4864
+ display: "flex",
4865
+ justifyContent: "space-between",
4866
+ alignItems: "center"
4867
+ },
4868
+ children: [/* @__PURE__ */ jsx("span", {
4869
+ style: {
4870
+ fontSize: "0.75rem",
4871
+ color: "rgb(107, 114, 128)"
4872
+ },
4873
+ children: "Expires on:"
4874
+ }), /* @__PURE__ */ jsx("span", {
4875
+ style: {
4876
+ fontSize: "0.75rem",
4877
+ fontWeight: 500,
4878
+ color: "rgb(17, 24, 39)"
4879
+ },
4880
+ children: expirationDate.toLocaleDateString("en-US", {
4881
+ year: "numeric",
4882
+ month: "long",
4883
+ day: "numeric"
4884
+ })
4885
+ })]
4886
+ })
4887
+ })
4888
+ ]
4541
4889
  })]
4542
4890
  }),
4543
4891
  error && /* @__PURE__ */ jsx("div", {
@@ -4567,7 +4915,7 @@ const RegisterSuiNsDialog = ({ isOpen, onClose, onRegistered, currentAccount, cl
4567
4915
  height: "1rem",
4568
4916
  animation: "spin 1s linear infinite",
4569
4917
  marginRight: "0.5rem"
4570
- } }), "Registering..."] }) : `Register ${fullName}`
4918
+ } }), "Registering..."] }) : `Register ${fullName} for ${selectedYears} ${selectedYears === 1 ? "year" : "years"}`
4571
4919
  })
4572
4920
  ]
4573
4921
  })