@thenamespace/ens-components 1.1.5 → 1.1.6
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 +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11918,6 +11918,7 @@ const TextRecords = ({
|
|
|
11918
11918
|
}, [texts]);
|
|
11919
11919
|
const [lastAddedKey, setLastAddedKey] = useState(null);
|
|
11920
11920
|
const [customDrafts, setCustomDrafts] = useState([]);
|
|
11921
|
+
const [lastAddedDraftId, setLastAddedDraftId] = useState(null);
|
|
11921
11922
|
const inputRefs = useRef({});
|
|
11922
11923
|
const draftKeys = useMemo(
|
|
11923
11924
|
() => new Set(customDrafts.map((d) => d.key).filter(Boolean)),
|
|
@@ -11935,8 +11936,18 @@ const TextRecords = ({
|
|
|
11935
11936
|
return true;
|
|
11936
11937
|
};
|
|
11937
11938
|
const handleAddCustomDraft = () => {
|
|
11938
|
-
|
|
11939
|
+
const id = genDraftId();
|
|
11940
|
+
setCustomDrafts((prev) => [...prev, { id, key: "", value: "" }]);
|
|
11941
|
+
setLastAddedDraftId(id);
|
|
11939
11942
|
};
|
|
11943
|
+
useEffect(() => {
|
|
11944
|
+
if (!lastAddedDraftId) return;
|
|
11945
|
+
const el = inputRefs.current[lastAddedDraftId];
|
|
11946
|
+
if (!el) return;
|
|
11947
|
+
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
11948
|
+
el.focus();
|
|
11949
|
+
setLastAddedDraftId(null);
|
|
11950
|
+
}, [customDrafts, lastAddedDraftId]);
|
|
11940
11951
|
const handleCustomDraftKeyChange = (draftId, newKey) => {
|
|
11941
11952
|
const draft = customDrafts.find((d) => d.id === draftId);
|
|
11942
11953
|
const oldKey = draft.key;
|
|
@@ -12148,6 +12159,9 @@ const TextRecords = ({
|
|
|
12148
12159
|
/* @__PURE__ */ jsx(
|
|
12149
12160
|
Input,
|
|
12150
12161
|
{
|
|
12162
|
+
ref: (el) => {
|
|
12163
|
+
inputRefs.current[draft.id] = el;
|
|
12164
|
+
},
|
|
12151
12165
|
style: { flex: 1 },
|
|
12152
12166
|
value: draft.key,
|
|
12153
12167
|
onChange: (e) => handleCustomDraftKeyChange(draft.id, e.target.value),
|
|
@@ -63903,15 +63917,18 @@ const useRegisterENS = ({ isTestnet }) => {
|
|
|
63903
63917
|
const publicClient = usePublicClient({
|
|
63904
63918
|
chainId: isTestnet ? sepolia.id : mainnet.id
|
|
63905
63919
|
});
|
|
63920
|
+
const { address } = useAccount();
|
|
63906
63921
|
const { data: walletClient } = useWalletClient({
|
|
63907
63922
|
chainId: isTestnet ? sepolia.id : mainnet.id
|
|
63908
63923
|
});
|
|
63909
63924
|
const getRegistrationPrice = async (label, expiryInYears = 1) => {
|
|
63925
|
+
const ethController = getEthController();
|
|
63910
63926
|
const price = await publicClient.readContract({
|
|
63911
63927
|
abi: ABIS.ETH_REGISTRAR_CONTOLLER,
|
|
63912
63928
|
functionName: "rentPrice",
|
|
63913
|
-
args: [label, expiryInYears * SECONDS_IN_YEAR],
|
|
63914
|
-
address:
|
|
63929
|
+
args: [label, BigInt(expiryInYears * SECONDS_IN_YEAR)],
|
|
63930
|
+
address: ethController,
|
|
63931
|
+
account: address
|
|
63915
63932
|
});
|
|
63916
63933
|
const totalPrice = price.base + price.premium;
|
|
63917
63934
|
return {
|