-
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
Merged
sahar-fehri
merged 5 commits into
develop
from
fix/add-catch-send-nft-when-getTokenStandardAndDetails-fails
Nov 4, 2024
+7
−3
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ddb4ae2
fix: ignore error when getTokenStandardAndDetails fails
sahar-fehri c84f198
fix: look for symbol property inside nft.collection
sahar-fehri cfe4dac
Merge branch 'develop' into fix/add-catch-send-nft-when-getTokenStand…
sahar-fehri 05fb186
Merge branch 'develop' into fix/add-catch-send-nft-when-getTokenStand…
darkwing eb405c4
Merge branch 'develop' into fix/add-catch-send-nft-when-getTokenStand…
sahar-fehri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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 betrue
makingdetails
defined and skipping the call togetTokenStandardAndDetails
.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 theprovidedDetails
hasstandard
property it will go into the else and callgetTokenStandardAndDetails
. (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 nftDetailssymbol
is insideprovidedDetails.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