Skip to content

Commit bd97dfb

Browse files
authored
fix: update shield claim form errorCode & message (#37865)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Map recently added error code in Shield claim service API. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/37865?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Maps newly added Shield Claims API error codes to UI error handling and adds corresponding English locales. > > - **Shield Claims UI**: > - Update `ui/pages/settings/transaction-shield-tab/types.ts` to include new `SUBMIT_CLAIM_ERROR_CODES` (`E106`, `E205`, `E401–E404`). > - Map new codes in `ui/pages/settings/transaction-shield-tab/claims-form/constants.ts` `ERROR_MESSAGE_MAP`, including affected fields for chain/tx-related errors. > - **Localization**: > - Add i18n strings in `app/_locales/en/messages.json` and `app/_locales/en_GB/messages.json` for new errors: `shieldClaimChainNotSupported`, `shieldClaimSignatureCoverageNotCovered`, `shieldClaimTransactionNotFound`, `shieldClaimTransactionNotFromWalletAddress`, `shieldClaimTransactionNotSuccessful`, `shieldClaimWalletOwnershipValidationFailed`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 94392da. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 00e1006 commit bd97dfb

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

app/_locales/en/messages.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/en_GB/messages.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/pages/settings/transaction-shield-tab/claims-form/constants.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@ export const ERROR_MESSAGE_MAP: Partial<
4848
[SUBMIT_CLAIM_ERROR_CODES.FIELD_REQUIRED]: {
4949
messageKey: 'shieldClaimInvalidRequired',
5050
},
51+
[SUBMIT_CLAIM_ERROR_CODES.SIGNATURE_COVERAGE_NOT_COVERED]: {
52+
messageKey: 'shieldClaimSignatureCoverageNotCovered',
53+
},
54+
[SUBMIT_CLAIM_ERROR_CODES.SIGNATURE_VERIFICATION_FAILED]: {
55+
messageKey: 'shieldClaimWalletOwnershipValidationFailed',
56+
},
57+
[SUBMIT_CLAIM_ERROR_CODES.CHAIN_NOT_SUPPORTED]: {
58+
messageKey: 'shieldClaimChainNotSupported',
59+
field: SUBMIT_CLAIM_FIELDS.CHAIN_ID,
60+
},
61+
[SUBMIT_CLAIM_ERROR_CODES.TRANSACTION_NOT_FOUND]: {
62+
messageKey: 'shieldClaimTransactionNotFound',
63+
field: SUBMIT_CLAIM_FIELDS.IMPACTED_TRANSACTION_HASH,
64+
},
65+
[SUBMIT_CLAIM_ERROR_CODES.TRANSACTION_NOT_FROM_WALLET_ADDRESS]: {
66+
messageKey: 'shieldClaimTransactionNotFromWalletAddress',
67+
field: SUBMIT_CLAIM_FIELDS.IMPACTED_TRANSACTION_HASH,
68+
},
69+
[SUBMIT_CLAIM_ERROR_CODES.TRANSACTION_NOT_SUCCESSFUL]: {
70+
messageKey: 'shieldClaimTransactionNotSuccessful',
71+
field: SUBMIT_CLAIM_FIELDS.IMPACTED_TRANSACTION_HASH,
72+
},
5173
};
5274

5375
// Error codes for fields in the error response

ui/pages/settings/transaction-shield-tab/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ export const SUBMIT_CLAIM_ERROR_CODES = {
4646
SUBMISSION_WINDOW_EXPIRED: 'E103',
4747
TRANSACTION_NOT_COVERED: 'E104',
4848
COVERAGE_VALIDATION_FAILED: 'E105',
49+
SIGNATURE_COVERAGE_NOT_COVERED: 'E106',
4950

5051
// Claims Validation (E200-E299)
5152
CLAIM_VALIDATION_FAILED: 'E201',
5253
MAX_CLAIMS_LIMIT_EXCEEDED: 'E202',
5354
DUPLICATE_CLAIM_EXISTS: 'E203',
5455
INVALID_WALLET_ADDRESSES: 'E204',
56+
SIGNATURE_VERIFICATION_FAILED: 'E205',
5557

5658
// Field Validation Errors (E250-E299)
5759
FIELD_REQUIRED: 'E250',
@@ -69,6 +71,12 @@ export const SUBMIT_CLAIM_ERROR_CODES = {
6971
FILES_SIZE_EXCEEDED: 'E301',
7072
FILES_COUNT_EXCEEDED: 'E302',
7173
INVALID_FILES_TYPE: 'E303',
74+
75+
// Chains (E400-E499)
76+
CHAIN_NOT_SUPPORTED: 'E401',
77+
TRANSACTION_NOT_FOUND: 'E402',
78+
TRANSACTION_NOT_FROM_WALLET_ADDRESS: 'E403',
79+
TRANSACTION_NOT_SUCCESSFUL: 'E404',
7280
} as const;
7381

7482
export type SubmitClaimErrorCode =

0 commit comments

Comments
 (0)