Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SIWE sign message section #24997

Merged
merged 71 commits into from
Jun 13, 2024
Merged

feat: SIWE sign message section #24997

merged 71 commits into from
Jun 13, 2024

Conversation

jpuri
Copy link
Contributor

@jpuri jpuri commented Jun 3, 2024

Description

Changes in message section for SIWE signature pages.

Related issues

Fixes: #24650

Manual testing steps

  1. Enable re-designed pages for SIWE signatures
  2. Go to test DAPP
  3. Submit SIWE signature

Screenshots/Recordings

Screenshot 2024-06-03 at 5 18 44 PM

Screenshot 2024-06-04 at 3 20 52 PM

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

app/_locales/en/messages.json Outdated Show resolved Hide resolved
ui/pages/confirmations/types/confirm.ts Show resolved Hide resolved
if (!dateString) {
return dateString;
}
const date = new Date(dateString);
Copy link
Member

@matthewwalsh0 matthewwalsh0 Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we achieve this easier with Intl.DateTimeFormat.format, plus it will be translatable?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format

There seems to be some existing usages in ui/helpers/utils/notification.util.ts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that, but I was facing issues in displayed same value of day in different locales.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My worry is what we have currently is partially re-implementing that, plus we have no translation or locale support at all.

Can you share the issue concerning locales?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@matthewwalsh0 matthewwalsh0 Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested with that commit, and I believe the issue was just that we weren't explicit with the timezone.

Using the following in format date, the existing util and snapshot tests passed without any changes to them:

export const formatDate = (dateString: string) => {
  if (!dateString) {
    return dateString;
  }

  return DateTime.fromISO(dateString)
    .setLocale('en')
    .setZone('utc')
    .toFormat('dd LLLL yyyy, HH:mm');
};

We can of course choose to use the user's timezone and or their locale, but as a first step, this means we don't rely on any custom format logic and have easy configuration of the output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, I updated the PR.

@jpuri jpuri requested a review from matthewwalsh0 June 7, 2024 11:14
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 79.01235% with 17 lines in your changes missing coverage. Please review.

Project coverage is 65.62%. Comparing base (57b9c82) to head (9e42c01).
Report is 21 commits behind head on develop.

Files Patch % Lines
ui/selectors/selectors.js 50.00% 4 Missing ⚠️
app/scripts/controllers/app-state.js 0.00% 3 Missing ⚠️
...method-middleware/handlers/ethereum-chain-utils.js 50.00% 3 Missing ⚠️
app/scripts/metamask-controller.js 76.92% 3 Missing ⚠️
ui/store/actions.ts 33.33% 2 Missing ⚠️
...p/scripts/lib/createRPCMethodTrackingMiddleware.js 85.71% 1 Missing ⚠️
...confirm/info/personal-sign/siwe-sign/siwe-sign.tsx 93.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #24997      +/-   ##
===========================================
- Coverage    65.65%   65.62%   -0.02%     
===========================================
  Files         1368     1375       +7     
  Lines        54269    54544     +275     
  Branches     14192    14291      +99     
===========================================
+ Hits         35627    35794     +167     
- Misses       18642    18750     +108     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [de2aca0]
Page Load Metrics (124 ± 144 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint731048894
domContentLoaded9141111
load451430124300144
domInteractive9141111
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 4.6 KiB (0.07%)
  • common: 324 Bytes (0.01%)

Copy link

socket-security bot commented Jun 12, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@types/luxon@3.4.2 None 0 120 kB types

View full report↗︎

@jpuri jpuri requested a review from digiwand June 13, 2024 06:10
…ask-extension into siwe_sign_message_section
@metamaskbot
Copy link
Collaborator

Builds ready [9e42c01]
Page Load Metrics (49 ± 3 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint64908073
domContentLoaded9221242
load42664963
domInteractive9221242
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 4.42 KiB (0.06%)
  • common: 159 Bytes (0.00%)

@jpuri jpuri merged commit 0fd5f5e into develop Jun 13, 2024
74 checks passed
@jpuri jpuri deleted the siwe_sign_message_section branch June 13, 2024 13:40
@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2024
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jun 13, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
confirmation-redesign release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-confirmations Push issues to confirmations team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Redesign Signature SIWE create message section
6 participants