@@ -15,7 +15,11 @@ import {
1515 CredentialType ,
1616 KeyManager ,
1717} from '@/core/services/kms/kms-types.interface' ;
18- import { HederaTokenType , KeyAlgorithm } from '@/core/shared/constants' ;
18+ import {
19+ DAY_IN_SECONDS ,
20+ HederaTokenType ,
21+ KeyAlgorithm ,
22+ } from '@/core/shared/constants' ;
1923import {
2024 EntityReferenceType ,
2125 SupplyType ,
@@ -475,6 +479,8 @@ export const TokenAliasNameSchema = AliasNameSchema.describe(
475479 'Token alias name (local identifier, not on-chain name)' ,
476480) ;
477481
482+ export const TokenFreezeDefaultSchema = z . boolean ( ) . default ( false ) ;
483+
478484/**
479485 * Memo Input
480486 * Optional memo field for transactions
@@ -950,15 +956,16 @@ export const ResolvedPublicKeySchema = z.object({
950956 * Hedera network allows auto-renew period between 30 and 92 days (inclusive), in seconds.
951957 * @see https://docs.hedera.com/hedera/core-concepts/smart-contracts/tokens#auto-renewal
952958 */
953- export const HEDERA_AUTO_RENEW_PERIOD_SECONDS_MIN = 2592000 ; // 30 days
954- export const HEDERA_AUTO_RENEW_PERIOD_SECONDS_MAX = 8000001 ; // 92 days (per network rules)
959+ const HEDERA_AUTO_RENEW_PERIOD_MIN = 30 * DAY_IN_SECONDS ; // 30 days
960+ const HEDERA_AUTO_RENEW_PERIOD_MAX = 92 * DAY_IN_SECONDS ; // 92 days (per network rules)
961+ const HEDERA_EXPIRATION_TIME_MAX = 92 * DAY_IN_SECONDS * 1000 ; // 92 days (per network rules)
955962
956963/** Output / mirror fields: optional seconds, validated when present. */
957964export const HederaAutoRenewPeriodSecondsOptionalSchema = z
958965 . number ( )
959966 . int ( )
960- . min ( HEDERA_AUTO_RENEW_PERIOD_SECONDS_MIN )
961- . max ( HEDERA_AUTO_RENEW_PERIOD_SECONDS_MAX )
967+ . min ( HEDERA_AUTO_RENEW_PERIOD_MIN )
968+ . max ( HEDERA_AUTO_RENEW_PERIOD_MAX )
962969 . optional ( ) ;
963970
964971/**
@@ -977,18 +984,15 @@ export const AutoRenewPeriodSecondsSchema: z.ZodType<number | undefined> = z
977984 z
978985 . number ( )
979986 . optional ( )
980- . superRefine ( ( sec , ctx ) => {
981- if ( sec === undefined ) return ;
982- if (
983- sec < HEDERA_AUTO_RENEW_PERIOD_SECONDS_MIN ||
984- sec > HEDERA_AUTO_RENEW_PERIOD_SECONDS_MAX
985- ) {
986- ctx . addIssue ( {
987- code : z . ZodIssueCode . custom ,
988- message : `Auto-renew period must be between ${ HEDERA_AUTO_RENEW_PERIOD_SECONDS_MIN } and ${ HEDERA_AUTO_RENEW_PERIOD_SECONDS_MAX } seconds (30–92 days inclusive).` ,
989- } ) ;
990- }
991- } ) ,
987+ . refine (
988+ ( sec ) =>
989+ ! sec ||
990+ ( sec >= HEDERA_AUTO_RENEW_PERIOD_MIN &&
991+ sec <= HEDERA_AUTO_RENEW_PERIOD_MAX ) ,
992+ {
993+ message : `Auto-renew period must be between ${ HEDERA_AUTO_RENEW_PERIOD_MIN } and ${ HEDERA_AUTO_RENEW_PERIOD_MAX } seconds (30–92 days inclusive).` ,
994+ } ,
995+ ) ,
992996 ) ;
993997
994998/**
@@ -998,25 +1002,23 @@ export const AutoRenewPeriodSecondsSchema: z.ZodType<number | undefined> = z
9981002export const ExpirationTimeSchema : z . ZodType < Date | undefined > = z
9991003 . string ( )
10001004 . optional ( )
1001- . superRefine ( ( s , ctx ) => {
1002- if ( ! s || s . trim ( ) === '' ) {
1003- return ;
1004- }
1005- if ( Number . isNaN ( new Date ( s ) . getTime ( ) ) ) {
1006- ctx . addIssue ( {
1007- code : z . ZodIssueCode . custom ,
1008- message :
1009- 'Invalid expiration time. Use an ISO 8601 datetime (e.g. 2026-12-31T23:59:59.000Z).' ,
1010- } ) ;
1011- }
1005+ . refine ( ( s ) => ! s || ! Number . isNaN ( new Date ( s ) . getTime ( ) ) , {
1006+ message :
1007+ 'Invalid expiration time. Use an ISO 8601 datetime (e.g. 2026-12-31T23:59:59.000Z).' ,
10121008 } )
10131009 . transform ( ( s ) : Date | undefined => {
1014- if ( ! s || s . trim ( ) === '' ) {
1010+ if ( ! s ) {
10151011 return undefined ;
10161012 }
10171013 return new Date ( s ) ;
10181014 } )
1019- . refine ( ( d ) => d === undefined || d . getTime ( ) > Date . now ( ) , {
1020- message :
1021- 'Expiration time must be in the future (strictly after the current time).' ,
1022- } ) ;
1015+ . refine (
1016+ ( d ) =>
1017+ ! d ||
1018+ ( d . getTime ( ) > Date . now ( ) &&
1019+ d . getTime ( ) <=
1020+ new Date ( Date . now ( ) + HEDERA_EXPIRATION_TIME_MAX ) . getTime ( ) ) ,
1021+ {
1022+ message : 'Expiration time must be set in 92 days period.' ,
1023+ } ,
1024+ ) ;
0 commit comments