-
Notifications
You must be signed in to change notification settings - Fork 579
feat/improve T22 account page #534
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
Merged
ngundotra
merged 5 commits into
solana-foundation:master
from
hoodieshq:feat/improve-t22-account-page
Apr 10, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d9e8dd7
handle case with 0 extensions for a token
rogaldh ea3f818
WIP
rogaldh f41dd7e
feat: display extensions for other account types
rogaldh 5a14e6e
use ErrorCard
rogaldh fda4e10
Merge branch 'master' into feat/improve-t22-account-page
rogaldh 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| 'use client'; | ||
|
|
||
| import { ParsedAccountRenderer } from '@components/account/ParsedAccountRenderer'; | ||
| import React from 'react'; | ||
| import { ErrorBoundary } from 'react-error-boundary'; | ||
| import { create } from 'superstruct'; | ||
|
|
||
| import { TokenExtensionsCard } from '@/app/components/account/TokenExtensionsCard'; | ||
| import { ErrorCard } from '@/app/components/common/ErrorCard'; | ||
| import { MintAccountInfo, TokenAccountInfo } from '@/app/validators/accounts/token'; | ||
|
|
||
| export type Props = Readonly<{ | ||
| params: { | ||
| address: string; | ||
| }; | ||
| }>; | ||
|
|
||
| function TokenExtensionsEntriesRenderer({ | ||
| account, | ||
| }: React.ComponentProps<React.ComponentProps<typeof ParsedAccountRenderer>['renderComponent']>) { | ||
| const parsedData = account?.data.parsed; | ||
|
|
||
| if (parsedData && parsedData.parsed.type === 'mint') { | ||
| const mintInfo = create(parsedData.parsed.info, MintAccountInfo); | ||
| const address = account.pubkey.toBase58(); | ||
|
|
||
| if (!mintInfo.extensions?.length) return <ErrorCard text="Can not fetch extensions." />; | ||
|
|
||
| return <TokenExtensionsCard address={address} extensions={mintInfo.extensions} />; | ||
| } else if (parsedData && parsedData.parsed.type === 'account') { | ||
| const accountInfo = create(parsedData.parsed.info, TokenAccountInfo); | ||
| const address = accountInfo.mint.toBase58(); | ||
|
|
||
| if (!accountInfo.extensions?.length) return <ErrorCard text="Can not fetch extensions." />; | ||
|
|
||
| return <TokenExtensionsCard address={address} extensions={accountInfo.extensions} />; | ||
| } else { | ||
| // possible cases: | ||
| // - absent parsed data | ||
| // - multisig type of account | ||
| return <ErrorCard text="Can not fetch extensions." />; | ||
| } | ||
| } | ||
|
|
||
| export default function TokenExtensionsEntriesPageClient({ params: { address } }: Props) { | ||
| return ( | ||
| <ErrorBoundary fallback={<ErrorCard text="Can not fetch extensions." />}> | ||
| <ParsedAccountRenderer address={address} renderComponent={TokenExtensionsEntriesRenderer} /> | ||
| </ErrorBoundary> | ||
| ); | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.