-
Notifications
You must be signed in to change notification settings - Fork 306
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: check UTL verifiedness of tokens before showing spoof warning banner #288
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -31,6 +31,9 @@ export type FullLegacyTokenInfo = { | |||||
readonly tags?: string[], | ||||||
readonly extensions?: TokenExtensions, | ||||||
} | ||||||
export type FullTokenInfo = FullLegacyTokenInfo & { | ||||||
readonly verified: boolean; | ||||||
}; | ||||||
|
||||||
type FullLegacyTokenInfoList = { | ||||||
tokens: FullLegacyTokenInfo[] | ||||||
|
@@ -97,7 +100,7 @@ export async function getFullTokenInfo( | |||||
address: PublicKey, | ||||||
cluster: Cluster, | ||||||
connectionString: string | ||||||
): Promise<FullLegacyTokenInfo | undefined> { | ||||||
): Promise<FullTokenInfo | undefined> { | ||||||
const chainId = getChainId(cluster); | ||||||
if (!chainId) return undefined; | ||||||
|
||||||
|
@@ -107,7 +110,12 @@ export async function getFullTokenInfo( | |||||
]); | ||||||
|
||||||
if (!sdkTokenInfo) { | ||||||
return legacyCdnTokenInfo; | ||||||
return legacyCdnTokenInfo | ||||||
? { | ||||||
...legacyCdnTokenInfo, | ||||||
verified: true, | ||||||
} | ||||||
: undefined; | ||||||
} | ||||||
|
||||||
// Merge the fields, prioritising the sdk ones which are more up to date | ||||||
|
@@ -123,8 +131,9 @@ export async function getFullTokenInfo( | |||||
logoURI: sdkTokenInfo.logoURI ?? undefined, | ||||||
name: sdkTokenInfo.name, | ||||||
symbol: sdkTokenInfo.symbol, | ||||||
tags | ||||||
} | ||||||
tags, | ||||||
verified: !!(legacyCdnTokenInfo || sdkTokenInfo.verified), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means ‘if you're on the legacy token list, or the UTL registry said you're verified, you're verified.’ Is that sound, @mcintyre94? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I missed this PR before! I think this is reasonable, but if the UTL registry contains the same token as unverified maybe that should take precedence? So:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, if I understand correctly, that basically implies that we should do this?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Building a Vercel preview for that now: #289. |
||||||
}; | ||||||
} | ||||||
|
||||||
export async function getTokenInfos( | ||||||
|
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.
@mcintyre94, I'm presuming that everything that comes from the legacy token list CDN can be presumed to be ‘verified.’ Does that make sense?