Updated jup token fetch to directly load unverified tokens #2403
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.
Created in relation to gib.work request: https://v2.gib.work/tasks/0e250d38-b646-41a6-b5e9-913964701416
The core issue is the lookup for token data is just using jup's strict token list, leaving out metadata for many governance tokens.
I designed three potential fixes:
I decided that ultimately 3 would be the best solution, but this added the additional need of an async call for getTokenInfo(). If the team would prefer I pursue 1 or 2 instead, I will revise my PR.
To resolve this without making major structural changes, I added a new function in tokenPrice.tsx, getTokenInfoAsync(), which works as follows:
This of course also necessitated a new async getTreasuryAccountItemInfoV2Async() in treasuryTools.tsx
These changes together create a simple fallback for tokens not on the strict list to be automatically visible in Realms. I only updated from getTreasuryAccountItemInfoV2 --> getTreasuryAccountItemInfoV2Async on the convertAccountToAsset.tsx file, but the same change can easily be added to other uses of it if it is decided to be implemented.
Also, just to state it, the strict token list are generally accepted tokens, by allowing any token data to be loaded, a bad actor could send a distasteful token to a treasury, then show it as a DAO holding for potentially bad PR. I think this is low probability, and likely would be ignored by web3 people if something like that occurred, but still worthwhile to consider.