Skip to content

Commit

Permalink
fix: ignore error when getTokenStandardAndDetails fails (#28030)
Browse files Browse the repository at this point in the history
## **Description**

Fixes Sentry issue when we are not able to determine token contract
standard.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28030?quickstart=1)

## **Related issues**

Fixes: #17287

## **Manual testing steps**

(I was not able to repro with my NFTs but to simulate, we can go to the
core fct `getTokenStandardAndDetails` and add
`throw new Error('Unable to determine contract standard');` at the start
of the fct;

1. Go NFT page
2. Click on any NFT
3. Click Send
4. You should be able to send the NFT

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/2ef39b0e-106a-48a2-a150-82176adaf14c

### **After**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/f0714310-410f-4f51-b7e2-6f0bc4011027




## **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/develop/.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/develop/.github/guidelines/LABELING_GUIDELINES.md)).
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.

---------

Co-authored-by: David Walsh <davidwalsh83@gmail.com>
  • Loading branch information
sahar-fehri and darkwing authored Nov 4, 2024
1 parent 18e81ba commit aaee4e7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ui/ducks/send/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,12 @@ export function updateSendAsset(

let missingProperty = STANDARD_TO_REQUIRED_PROPERTIES[
providedDetails.standard
]?.find((property) => providedDetails[property] === undefined);
]?.find((property) => {
if (providedDetails.collection && property === 'symbol') {
return providedDetails.collection[property] === undefined;
}
return providedDetails[property] === undefined;
});

let details;

Expand Down Expand Up @@ -2652,10 +2657,9 @@ export function updateSendAsset(
providedDetails.address,
sendingAddress,
providedDetails.tokenId,
).catch((error) => {
).catch(() => {
// prevent infinite stuck loading state
dispatch(hideLoadingIndication());
throw error;
})),
};
}
Expand Down

0 comments on commit aaee4e7

Please sign in to comment.