Add new time periods for ERC20 and native token permissions#190
Merged
jeffsmale90 merged 10 commits intomainfrom Oct 22, 2025
Merged
Add new time periods for ERC20 and native token permissions#190jeffsmale90 merged 10 commits intomainfrom
jeffsmale90 merged 10 commits intomainfrom
Conversation
MoMannn
requested changes
Oct 14, 2025
packages/gator-permissions-snap/src/permissions/nativeTokenPeriodic/context.ts
Outdated
Show resolved
Hide resolved
…xt and time utility files
… token contexts; add tests for edge cases in getClosestTimePeriod function
MoMannn
previously approved these changes
Oct 15, 2025
…ve token contexts; add zPeriodDuration definition
jeffsmale90
reviewed
Oct 20, 2025
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/context.ts
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/context.ts
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/rules.ts
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/permissions/nativeTokenPeriodic/context.ts
Outdated
Show resolved
Hide resolved
… tests and labels for consistency
…emove getClosestTimePeriod function; simplify duration conversion logic
… ERC20 and native token contexts; update related tests for consistency
jeffsmale90
reviewed
Oct 22, 2025
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/rules.ts
Outdated
Show resolved
Hide resolved
jeffsmale90
previously approved these changes
Oct 22, 2025
Contributor
jeffsmale90
left a comment
There was a problem hiding this comment.
Looks good to me!
One minor comment - I don't feel strongly about it though. Maybe having the additional level of normalization as it is makes this more anti-fragile.
… across ERC20 and native token contexts; update related tests for consistency
jeffsmale90
approved these changes
Oct 22, 2025
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/rules.ts
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR updates the Transfer Window period picker to align with the latest design specifications.
Previously, the picker displayed durations in seconds or allowed manual input of seconds, which was confusing and inconsistent.
The updated picker now offers a fixed set of human-readable transfer window options for improved usability and clarity:
These predefined options provide a more opinionated and user-friendly experience, covering the majority of use cases while maintaining consistency with the design direction.
Related issues
Fixes: #396
Manual testing steps
Go to the page where the transfer period picker is displayed.
Open the period picker dropdown.
Verify that the options available are:
Select any option and confirm that:
Verify that manual second input is no longer available.
Screenshots/Recordings
Before
Period duration shown in seconds or manual seconds input field.
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds Hourly/Biweekly/Yearly options and replaces freeform seconds with a
Frequencydropdown; normalizesperiodDurationto a validated number across ERC20/native periodic permissions.periodType+ freeform seconds with a singleFrequencydropdown usingTimePeriodoptions (Hourly,Daily,Weekly,Biweekly,Monthly,Yearly).Duration (seconds)field; label updated to "Frequency".periodDurationnow anumber(not string); Zod useszPeriodDuration(<= 10 years) that snaps to closestTimePeriodseconds.periodTypefrom contexts/metadata; update validation to accept numericperiodDuration.TimePeriodenum andTIME_PERIOD_TO_SECONDSmapping; addgetClosestTimePeriod().applyContextandbuildContextupdated to use numericperiodDuration; stop deriving/storingperiodType.periodDuration.getClosestTimePeriod().Written by Cursor Bugbot for commit b9704d5. This will update automatically on new commits. Configure here.