@thenamespace/ens-components 0.31.0 → 0.33.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.d.ts +7 -3
- package/dist/index.js +25 -9
- package/dist/index.js.map +1 -1
- package/dist/types/components/ens-records-form/EnsUpdateRecordsForm.d.ts +2 -1
- package/dist/types/components/subname-mint-form/SubnameMintForm.d.ts +2 -1
- package/dist/types/hooks/useWaitTransaction.d.ts +2 -1
- package/dist/types/utils/async.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -135,6 +135,8 @@ declare const getBlockExplorerAddressUrl: (chainId: number, address: string) =>
|
|
|
135
135
|
declare const getBlockExplorerName: (chainId: number) => string;
|
|
136
136
|
declare const getEnsAppUrl: (ensName: string, isTestnet?: boolean) => string;
|
|
137
137
|
|
|
138
|
+
declare const wait: (ms: number) => Promise<void>;
|
|
139
|
+
|
|
138
140
|
interface EnsRecordsFormProps {
|
|
139
141
|
resolverChainId?: number;
|
|
140
142
|
resolverAddress?: Address;
|
|
@@ -177,8 +179,9 @@ interface SubnameMintFormProps {
|
|
|
177
179
|
onCancel?: () => void;
|
|
178
180
|
onSuccess?: (data: MintSuccessData) => void;
|
|
179
181
|
onSubnameMinted?: (data: SubnameMintedData) => void;
|
|
182
|
+
txConfirmations?: number;
|
|
180
183
|
}
|
|
181
|
-
declare const SubnameMintForm: ({ parentName, label, isTestnet, onCancel, onSuccess, onSubnameMinted, }: SubnameMintFormProps) => react_jsx_runtime.JSX.Element;
|
|
184
|
+
declare const SubnameMintForm: ({ parentName, label, isTestnet, onCancel, onSuccess, onSubnameMinted, txConfirmations }: SubnameMintFormProps) => react_jsx_runtime.JSX.Element;
|
|
182
185
|
|
|
183
186
|
interface OffchainSubnameCreatedData {
|
|
184
187
|
label: string;
|
|
@@ -569,8 +572,9 @@ interface WaitTransactionOptions {
|
|
|
569
572
|
retries?: number;
|
|
570
573
|
retryDelay?: number;
|
|
571
574
|
timeout?: number;
|
|
575
|
+
txConfirmations?: number;
|
|
572
576
|
}
|
|
573
|
-
declare const useWaitTransaction: ({ isTestnet, chainId }: {
|
|
577
|
+
declare const useWaitTransaction: ({ isTestnet, chainId, }: {
|
|
574
578
|
isTestnet?: boolean;
|
|
575
579
|
chainId?: number;
|
|
576
580
|
}) => {
|
|
@@ -1285,5 +1289,5 @@ interface OffchainClient {
|
|
|
1285
1289
|
|
|
1286
1290
|
declare const useOffchainManager: (name: string, apiKeyOrToken: string, isTestnet?: boolean) => OffchainClient;
|
|
1287
1291
|
|
|
1288
|
-
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, TxProgress, WalletConnectProvider, capitalize, convertEVMChainIdToCoinType, convertToMulticallResolverData, convertToResolverData, createEnsReferer, debounce, deepCopy, diffToEnsRecords, ensureFloatInput, equalsIgnoreCase, formatFloat, getBlockExplorer, getBlockExplorerAddressUrl, getBlockExplorerName, getBlockExplorerTransactionUrl, getChainIdForListingNetwork, getEnsAppUrl, getEnsRecordsDiff, getSupportedAddressByChainId, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isCommitmentToNewErr, isContenthashValid, isUserDeniedError, supportedAddresses, supportedContenthashRecords, supportedTexts, useENSResolver, useMintManager, useMintSubname, useOffchainManager, useRegisterENS, useTheme, useWaitTransaction, validateEnsRecords };
|
|
1292
|
+
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, TxProgress, WalletConnectProvider, capitalize, convertEVMChainIdToCoinType, convertToMulticallResolverData, convertToResolverData, createEnsReferer, debounce, deepCopy, diffToEnsRecords, ensureFloatInput, equalsIgnoreCase, formatFloat, getBlockExplorer, getBlockExplorerAddressUrl, getBlockExplorerName, getBlockExplorerTransactionUrl, getChainIdForListingNetwork, getEnsAppUrl, getEnsRecordsDiff, getSupportedAddressByChainId, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isCommitmentToNewErr, isContenthashValid, isUserDeniedError, supportedAddresses, supportedContenthashRecords, supportedTexts, useENSResolver, useMintManager, useMintSubname, useOffchainManager, useRegisterENS, useTheme, useWaitTransaction, validateEnsRecords, wait };
|
|
1289
1293
|
export type { AccordionProps, AlertPosition, AlertProps, AlertVariant, ButtonProps, ButtonSize, ButtonVariant, ChainName$2 as ChainName, ConnectAndSetChainProps, ContractErrorLabelProps, DropdownProps, EnsAddressRecord$1 as EnsAddressRecord, EnsContenthashRecord, EnsRecords$1 as EnsRecords, EnsRecordsDiff, EnsTextRecord$1 as EnsTextRecord, EstimatedFees, IconName, IconProps, InputProps, InputSize, InputType, ModalProps, ModalSize, NameListing, PricingDisplayProps, ProfileHeaderProps, RecordValidationError, RegistrationRequest, ShurikenSpinnerProps, SupportedContenthashRecord, SupportedEnsAddress, SupportedText, SupportedTextRecord, TextCategory, TextColor, TextProps, TextSize, TextWeight, TextareaProps, TextareaSize, ThemeContextValue, ThemeName, ThemeProviderProps, TooltipPosition, TooltipProps };
|
package/dist/index.js
CHANGED
|
@@ -22585,6 +22585,10 @@ const getEnsAppUrl = (ensName, isTestnet = false) => {
|
|
|
22585
22585
|
return `${baseUrl}/${ensName}`;
|
|
22586
22586
|
};
|
|
22587
22587
|
|
|
22588
|
+
const wait = (ms) => {
|
|
22589
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
22590
|
+
};
|
|
22591
|
+
|
|
22588
22592
|
const isValidEmvAddress = (value) => {
|
|
22589
22593
|
return isAddress$1(value);
|
|
22590
22594
|
};
|
|
@@ -26090,14 +26094,17 @@ const useWaitTransaction = ({ isTestnet, chainId }) => {
|
|
|
26090
26094
|
hash,
|
|
26091
26095
|
retries = 3,
|
|
26092
26096
|
retryDelay = 2e3,
|
|
26093
|
-
timeout = 6e4
|
|
26097
|
+
timeout = 6e4,
|
|
26094
26098
|
// 1 minute default timeout
|
|
26099
|
+
txConfirmations = 1
|
|
26095
26100
|
} = options;
|
|
26096
26101
|
let lastError = null;
|
|
26097
26102
|
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
26098
26103
|
try {
|
|
26104
|
+
const startTime = Date.now();
|
|
26099
26105
|
const receiptPromise = publicClient.waitForTransactionReceipt({
|
|
26100
|
-
hash
|
|
26106
|
+
hash,
|
|
26107
|
+
confirmations: txConfirmations
|
|
26101
26108
|
});
|
|
26102
26109
|
const timeoutPromise = new Promise((_, reject) => {
|
|
26103
26110
|
setTimeout(() => {
|
|
@@ -26105,6 +26112,12 @@ const useWaitTransaction = ({ isTestnet, chainId }) => {
|
|
|
26105
26112
|
}, timeout);
|
|
26106
26113
|
});
|
|
26107
26114
|
const receipt = await Promise.race([receiptPromise, timeoutPromise]);
|
|
26115
|
+
const elapsedTime = Date.now() - startTime;
|
|
26116
|
+
const minLoadingTime = 5e3;
|
|
26117
|
+
if (elapsedTime < minLoadingTime) {
|
|
26118
|
+
await wait(minLoadingTime - elapsedTime);
|
|
26119
|
+
}
|
|
26120
|
+
await wait(2e3);
|
|
26108
26121
|
return receipt;
|
|
26109
26122
|
} catch (err) {
|
|
26110
26123
|
lastError = err;
|
|
@@ -26112,7 +26125,7 @@ const useWaitTransaction = ({ isTestnet, chainId }) => {
|
|
|
26112
26125
|
throw err;
|
|
26113
26126
|
}
|
|
26114
26127
|
const delay = retryDelay * Math.pow(2, attempt);
|
|
26115
|
-
await
|
|
26128
|
+
await wait(delay);
|
|
26116
26129
|
}
|
|
26117
26130
|
}
|
|
26118
26131
|
throw lastError || new Error("Failed to wait for transaction");
|
|
@@ -61072,7 +61085,8 @@ const EnsUpdateRecordsForm = ({
|
|
|
61072
61085
|
onGreat,
|
|
61073
61086
|
onRecordsUpdated,
|
|
61074
61087
|
onCancel,
|
|
61075
|
-
onTransactionSent
|
|
61088
|
+
onTransactionSent,
|
|
61089
|
+
txConfirmations
|
|
61076
61090
|
}) => {
|
|
61077
61091
|
const [recordsTemplate, setRecordsTemplate] = useState(
|
|
61078
61092
|
deepCopy(existingRecords)
|
|
@@ -61144,7 +61158,7 @@ const EnsUpdateRecordsForm = ({
|
|
|
61144
61158
|
}
|
|
61145
61159
|
try {
|
|
61146
61160
|
onTransactionSent?.(tx);
|
|
61147
|
-
await waitTx({ hash: tx });
|
|
61161
|
+
await waitTx({ hash: tx, txConfirmations: txConfirmations || 1 });
|
|
61148
61162
|
setUpdateTx({ hash: tx, status: TxProgress.Success });
|
|
61149
61163
|
setIsUpdating({ waitingWallet: false, waitingTx: false });
|
|
61150
61164
|
onRecordsUpdated?.(diff);
|
|
@@ -61689,7 +61703,8 @@ const SubnameMintForm = ({
|
|
|
61689
61703
|
isTestnet = false,
|
|
61690
61704
|
onCancel,
|
|
61691
61705
|
onSuccess,
|
|
61692
|
-
onSubnameMinted
|
|
61706
|
+
onSubnameMinted,
|
|
61707
|
+
txConfirmations
|
|
61693
61708
|
}) => {
|
|
61694
61709
|
const { getListingDetails } = useMintManager({ isTestnet });
|
|
61695
61710
|
const [initState, setInitState] = useState({
|
|
@@ -61772,7 +61787,8 @@ const SubnameMintFormContent = ({
|
|
|
61772
61787
|
isExpirable = false,
|
|
61773
61788
|
onCancel,
|
|
61774
61789
|
onSuccess,
|
|
61775
|
-
onSubnameMinted
|
|
61790
|
+
onSubnameMinted,
|
|
61791
|
+
txConfirmations
|
|
61776
61792
|
}) => {
|
|
61777
61793
|
const { address: connectedAddress, chain: currentChain } = useAccount();
|
|
61778
61794
|
const { switchChain, isPending: isSwitchingChain } = useSwitchChain();
|
|
@@ -62087,7 +62103,7 @@ const SubnameMintFormContent = ({
|
|
|
62087
62103
|
return;
|
|
62088
62104
|
}
|
|
62089
62105
|
try {
|
|
62090
|
-
const receipt = await waitTx({ hash: tx });
|
|
62106
|
+
const receipt = await waitTx({ hash: tx, txConfirmations: txConfirmations || 1 });
|
|
62091
62107
|
const gasUsed = receipt.gasUsed;
|
|
62092
62108
|
const gasPrice = receipt.effectiveGasPrice || BigInt(0);
|
|
62093
62109
|
const txFees = gasUsed * gasPrice;
|
|
@@ -70559,5 +70575,5 @@ var walletConnectWalletYHWKVTDY = /*#__PURE__*/Object.freeze({
|
|
|
70559
70575
|
default: walletConnectWallet_default
|
|
70560
70576
|
});
|
|
70561
70577
|
|
|
70562
|
-
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$1 as Text, TextRecordCategory, Textarea, ThemeProvider, Tooltip, TxProgress, WalletConnectProvider, capitalize, convertEVMChainIdToCoinType, convertToMulticallResolverData, convertToResolverData, createEnsReferer, debounce$1 as debounce, deepCopy, diffToEnsRecords, ensureFloatInput, equalsIgnoreCase, formatFloat, getBlockExplorer, getBlockExplorerAddressUrl, getBlockExplorerName, getBlockExplorerTransactionUrl, getChainIdForListingNetwork, getEnsAppUrl, getEnsRecordsDiff, getSupportedAddressByChainId, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isCommitmentToNewErr, isContenthashValid, isUserDeniedError, supportedAddresses, supportedContenthashRecords, supportedTexts, useENSResolver, useMintManager, useMintSubname, useOffchainManager, useRegisterENS, useTheme, useWaitTransaction, validateEnsRecords };
|
|
70578
|
+
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$1 as Text, TextRecordCategory, Textarea, ThemeProvider, Tooltip, TxProgress, WalletConnectProvider, capitalize, convertEVMChainIdToCoinType, convertToMulticallResolverData, convertToResolverData, createEnsReferer, debounce$1 as debounce, deepCopy, diffToEnsRecords, ensureFloatInput, equalsIgnoreCase, formatFloat, getBlockExplorer, getBlockExplorerAddressUrl, getBlockExplorerName, getBlockExplorerTransactionUrl, getChainIdForListingNetwork, getEnsAppUrl, getEnsRecordsDiff, getSupportedAddressByChainId, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isCommitmentToNewErr, isContenthashValid, isUserDeniedError, supportedAddresses, supportedContenthashRecords, supportedTexts, useENSResolver, useMintManager, useMintSubname, useOffchainManager, useRegisterENS, useTheme, useWaitTransaction, validateEnsRecords, wait };
|
|
70563
70579
|
//# sourceMappingURL=index.js.map
|