@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
|
@@ -3,7 +3,7 @@ import "./RegistrationProcess.css";
|
|
|
3
3
|
import { EnsRecords } from "@/types";
|
|
4
4
|
import { Address } from "viem";
|
|
5
5
|
interface RegistrationSuccessData {
|
|
6
|
-
|
|
6
|
+
durationLabel: string;
|
|
7
7
|
registrationCost: string;
|
|
8
8
|
transactionFees: string;
|
|
9
9
|
total: string;
|
|
@@ -11,7 +11,7 @@ interface RegistrationSuccessData {
|
|
|
11
11
|
}
|
|
12
12
|
interface RegistrationProcessProps {
|
|
13
13
|
label: string;
|
|
14
|
-
|
|
14
|
+
durationInSeconds: number;
|
|
15
15
|
isTestnet: boolean;
|
|
16
16
|
records: EnsRecords;
|
|
17
17
|
onBack?: (clearState?: boolean) => void;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import "./RegistrationSummary.css";
|
|
3
3
|
export interface RegistrationSummaryProps {
|
|
4
4
|
label: string;
|
|
5
|
-
|
|
5
|
+
durationSeconds: number;
|
|
6
6
|
price: {
|
|
7
7
|
isChecking: boolean;
|
|
8
8
|
wei: bigint;
|
|
@@ -28,7 +28,7 @@ export interface RegistrationSummaryProps {
|
|
|
28
28
|
hideBanner?: boolean;
|
|
29
29
|
bannerWidth?: number;
|
|
30
30
|
onLabelChange: (label: string) => void;
|
|
31
|
-
|
|
31
|
+
onDurationChange: (seconds: number) => void;
|
|
32
32
|
onPriceChange: (price: {
|
|
33
33
|
isChecking: boolean;
|
|
34
34
|
wei: bigint;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { RegistrationState } from "./types";
|
|
3
3
|
import { EnsRecords } from "@/types";
|
|
4
4
|
export interface RegistrationSuccessData {
|
|
5
|
-
|
|
5
|
+
durationLabel: string;
|
|
6
6
|
registrationCost: string;
|
|
7
7
|
transactionFees: string;
|
|
8
8
|
total: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./DurationPicker.css";
|
|
3
|
+
export interface DurationPickerProps {
|
|
4
|
+
durationSeconds: number;
|
|
5
|
+
onDurationChange: (seconds: number) => void;
|
|
6
|
+
minSeconds?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DurationPicker: React.FC<DurationPickerProps>;
|
|
@@ -15,8 +15,9 @@ export interface PricingDisplayProps {
|
|
|
15
15
|
isChecking: boolean;
|
|
16
16
|
};
|
|
17
17
|
expiryPicker?: {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
durationSeconds: number;
|
|
19
|
+
onDurationChange: (seconds: number) => void;
|
|
20
|
+
minSeconds?: number;
|
|
20
21
|
};
|
|
21
22
|
ethUsdRate?: number | null;
|
|
22
23
|
className?: string;
|
|
@@ -7,7 +7,7 @@ interface RentPriceResponse {
|
|
|
7
7
|
export interface RegistrationRequest {
|
|
8
8
|
label: string;
|
|
9
9
|
owner: Address;
|
|
10
|
-
|
|
10
|
+
durationInSeconds: number;
|
|
11
11
|
secret: string;
|
|
12
12
|
records: EnsRecords;
|
|
13
13
|
referrer?: Address;
|
|
@@ -16,7 +16,7 @@ export declare const useRegisterENS: ({ isTestnet }: {
|
|
|
16
16
|
isTestnet?: boolean;
|
|
17
17
|
}) => {
|
|
18
18
|
isEnsAvailable: (label: string) => Promise<boolean>;
|
|
19
|
-
getRegistrationPrice: (label: string,
|
|
19
|
+
getRegistrationPrice: (label: string, durationInSeconds?: number) => Promise<RentPriceResponse>;
|
|
20
20
|
sendCommitmentTx: (request: RegistrationRequest) => Promise<Hash>;
|
|
21
21
|
sendRegisterTx: (request: RegistrationRequest) => Promise<{
|
|
22
22
|
txHash: Hash;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const ONE_DAY = 86400;
|
|
2
|
+
/** Fixed 365-day year. Use secondsFromYears() when calendar accuracy is required (e.g. initial state). */
|
|
3
|
+
export declare const ONE_YEAR: number;
|
|
4
|
+
export declare const MIN_REGISTRATION_SECONDS: number;
|
|
5
|
+
/** "YYYY-MM-DD" string for <input type="date"> value, from Unix expiry timestamp */
|
|
6
|
+
export declare const secondsToDateInput: (expirySeconds: number) => string;
|
|
7
|
+
/** Duration in seconds from nowSeconds to the start of valueAsDate's calendar day (UTC-day aligned).
|
|
8
|
+
* Uses local date parts fed into Date.UTC to count whole calendar days without DST skew. */
|
|
9
|
+
export declare const roundDurationWithDay: (valueAsDate: Date, nowSeconds: number) => number;
|
|
10
|
+
/** Calendar-aware seconds for N whole years from startDate (handles leap years) */
|
|
11
|
+
export declare const secondsFromYears: (startDate: Date, years: number) => number;
|
|
12
|
+
/** Fractional years from duration seconds */
|
|
13
|
+
export declare const yearsFromSeconds: (seconds: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* Human-readable duration label for display.
|
|
16
|
+
* Examples: "1 year", "2 years", "6 months, 3 days", "28 days"
|
|
17
|
+
* Shows at most 2 parts; omits days when years are present.
|
|
18
|
+
*/
|
|
19
|
+
export declare const formatDurationSummary: (durationSeconds: number) => string;
|