-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix: ignore error when getTokenStandardAndDetails fails #28030
fix: ignore error when getTokenStandardAndDetails fails #28030
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [ddb4ae2]
Page Load Metrics (1901 ± 79 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
// prevent infinite stuck loading state | ||
dispatch(hideLoadingIndication()); | ||
throw error; | ||
})), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change wont affect native transfers;
It also wont affect ERC20 transfers because for ERC20 transfers tokenCanBeTreatedAsAnERC20
here should be true
making details
defined and skipping the call to getTokenStandardAndDetails
.
This should only affect NFT assets;
This is throwing because the code detects that there is a missing property which is symbol
in the case of the nfts i have tested with (here) and because the providedDetails
has standard
property it will go into the else and call getTokenStandardAndDetails
. (still not sure why getTokenStandardAndDetails would throw for so many contracts, it might be good to add the contract address and tokenId in the error log)
The code is detecting that the symbol
is missing because the nftDetails symbol
is inside providedDetails.collection
,
but this piece of code
is expecting the symbol inside the providedDetails object;
The properties that it is checking for an NFT are basically "name, symbol, tokenId" i dnt think tokenId can be undefined for an NFT.
Looking at the number of users affected by this; i would expect that most of them had missingProperty
= symbol
Adding sth similar to this;
let missingProperty = STANDARD_TO_REQUIRED_PROPERTIES[ providedDetails.standard ]?.find((property) => { if (providedDetails.collection && property === 'symbol') { return providedDetails.collection[property] === undefined; } return providedDetails[property] === undefined; });
Would make the code go into this if statement
and not make the call to getTokenStandardAndDetails
.
However, the symbol
inside collection is not always defined either, there will be cases where our third party provider did not return it.
In the case; the code will go into else and call getTokenStandardAndDetails
;
For that i have also removed the "throw error"; I don't see why it is necessary to throw when this call fails; I have also tested this and my transactions are going through with the call to getTokenStandardAndDetails failing
3fcf5a6
to
c84f198
Compare
There are other places in codebase that call getTokenStandardAndDetails; all of them are either within a try/catch or called using |
Builds ready [c84f198]
Page Load Metrics (1957 ± 222 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
can you add a unit test for this ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should still log the error that gets caught to make future troubleshooting easier? Do we have a logger setup for this kind of thing?
Otherwise lgtm 👍
…ardAndDetails-fails
…ardAndDetails-fails
…ardAndDetails-fails
Builds ready [eb405c4]
Page Load Metrics (2739 ± 584 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
Fixes Sentry issue when we are not able to determine token contract standard.
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 addthrow new Error('Unable to determine contract standard');
at the start of the fct;Screenshots/Recordings
Before
Screen.Recording.2024-10-23.at.02.24.34.mov
After
Screen.Recording.2024-10-23.at.02.44.38.mov
Pre-merge author checklist
Pre-merge reviewer checklist