diff --git a/debug-ui/lib/util.ts b/debug-ui/lib/util.ts index b29459619..233b5e889 100644 --- a/debug-ui/lib/util.ts +++ b/debug-ui/lib/util.ts @@ -98,10 +98,18 @@ export const checkForToken22 = async ( conn: Connection, mint: PublicKey, ): Promise<boolean> => { + const localStorageKey: string = mint.toBase58() + '-Is22'; + + if (localStorage.getItem(localStorageKey)) { + return localStorage.getItem(localStorageKey)! === 'true'; + } + const acc = await conn.getAccountInfo(mint); if (!acc) { throw new Error('checkForToken22: account does not exist'); } - return acc.owner.toBase58() !== TOKEN_PROGRAM_ID.toBase58(); + const is22: boolean = acc.owner.toBase58() !== TOKEN_PROGRAM_ID.toBase58(); + localStorage.setItem(localStorageKey, is22.toString()); + return is22; };