Skip to content

Commit 8f5308d

Browse files
authored
Merge pull request #100 from macalinao/igm/tester
Support empty symbols for token info fetching
2 parents d84efb7 + 4ed8dee commit 8f5308d

23 files changed

+584
-645
lines changed

.changeset/bright-doors-switch.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@macalinao/token-utils": patch
3+
"@macalinao/gill-extra": patch
4+
"example-dapp": patch
5+
"@macalinao/quarry": patch
6+
"@macalinao/grill": patch
7+
---
8+
9+
Update dependencies

.changeset/dirty-clocks-invent.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@macalinao/token-utils": patch
3+
"@macalinao/gill-extra": patch
4+
"example-dapp": patch
5+
"@macalinao/quarry": patch
6+
"@macalinao/grill": patch
7+
---
8+
9+
Remove unnecessary arguments

.changeset/fruity-groups-thank.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@macalinao/token-utils": patch
3+
"@macalinao/gill-extra": patch
4+
"example-dapp": patch
5+
"@macalinao/grill": patch
6+
---
7+
8+
Fix broken token metadata fetching -- allow for empty symbols

.changeset/smart-keys-play.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@macalinao/gill-extra": patch
3+
---
4+
5+
re-export some addresses of programs

.changeset/swift-zebras-mate.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@macalinao/token-utils": patch
3+
"@macalinao/gill-extra": patch
4+
"example-dapp": patch
5+
"@macalinao/quarry": patch
6+
"@macalinao/grill": patch
7+
---
8+
9+
Update dependencies

apps/example-dapp/biome.jsonc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
2+
"root": false,
3+
"$schema": "https://biomejs.dev/schemas/2.2.7/schema.json",
34
"extends": "//",
45
"linter": {
56
"domains": {

apps/example-dapp/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,24 @@
3434
"@radix-ui/react-separator": "^1.1.7",
3535
"@radix-ui/react-slot": "^1.2.3",
3636
"@radix-ui/react-tooltip": "^1.2.8",
37-
"@solana-program/system": "^0.8.1",
38-
"@solana-program/token": "^0.6.0",
39-
"@solana-program/token-2022": "^0.5.0",
37+
"@solana-program/system": "^0.9.0",
38+
"@solana-program/token": "^0.7.0",
39+
"@solana-program/token-2022": "^0.6.0",
4040
"@solana/kit": "catalog:",
4141
"@solana/spl-token": "^0.4.14",
4242
"@solana/wallet-adapter-react": "catalog:",
4343
"@solana/wallet-adapter-react-ui": "^0.9.39",
4444
"@solana/wallet-adapter-wallets": "^0.19.37",
45-
"@tailwindcss/vite": "^4.1.14",
45+
"@tailwindcss/vite": "^4.1.16",
4646
"@tanstack/react-query": "catalog:",
47-
"@tanstack/react-router": "^1.132.47",
47+
"@tanstack/react-router": "^1.133.22",
4848
"class-variance-authority": "^0.7.1",
4949
"clsx": "^2.1.1",
5050
"gill": "catalog:",
51-
"lucide-react": "^0.542.0",
51+
"lucide-react": "^0.546.0",
5252
"react": "catalog:",
5353
"react-dom": "catalog:",
54-
"react-hook-form": "^7.64.0",
54+
"react-hook-form": "^7.65.0",
5555
"sonner": "^2.0.7",
5656
"tailwind-merge": "^3.3.1",
5757
"zod": "^4.1.12"
@@ -60,25 +60,25 @@
6060
"@macalinao/grill": "workspace:^"
6161
},
6262
"devDependencies": {
63-
"@eslint/js": "^9.37.0",
63+
"@eslint/js": "^9.38.0",
6464
"@macalinao/eslint-config": "catalog:",
6565
"@macalinao/grill": "workspace:^",
6666
"@macalinao/tsconfig": "catalog:",
6767
"@tanstack/react-query-devtools": "^5.90.2",
68-
"@tanstack/react-router-devtools": "^1.132.50",
69-
"@tanstack/router-plugin": "^1.132.47",
68+
"@tanstack/react-router-devtools": "^1.133.22",
69+
"@tanstack/router-plugin": "^1.133.22",
7070
"@types/react": "catalog:",
7171
"@types/react-dom": "catalog:",
7272
"@vitejs/plugin-react": "^5.0.4",
7373
"eslint": "catalog:",
7474
"eslint-plugin-react-hooks": "^5.2.0",
75-
"eslint-plugin-react-refresh": "^0.4.23",
75+
"eslint-plugin-react-refresh": "^0.4.24",
7676
"globals": "^16.4.0",
77-
"tailwindcss": "^4.1.14",
77+
"tailwindcss": "^4.1.16",
7878
"tw-animate-css": "^1.4.0",
7979
"typescript": "catalog:",
80-
"typescript-eslint": "^8.46.0",
81-
"vite": "^7.1.9",
80+
"typescript-eslint": "^8.46.2",
81+
"vite": "^7.1.12",
8282
"vite-plugin-node-polyfills": "^0.24.0",
8383
"vite-tsconfig-paths": "^5.1.4"
8484
},

apps/example-dapp/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ declare module "@tanstack/react-router" {
3434

3535
import "@solana/wallet-adapter-react-ui/styles.css";
3636

37+
console.log(import.meta.env);
38+
3739
const endpoint =
3840
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
3941
import.meta.env.VITE_SOLANA_RPC_URL || getPublicSolanaRpcUrl("mainnet-beta");

apps/example-dapp/src/routeTree.gen.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Route as rootRouteImport } from "./routes/__root.tsx"
1212
import { Route as ExamplesRouteImport } from "./routes/examples.tsx"
1313
import { Route as IndexRouteImport } from "./routes/index.tsx"
1414
import { Route as ExamplesIndexRouteImport } from "./routes/examples/index.tsx"
15+
import { Route as TokenInfoTokenMintRouteImport } from "./routes/token-info.$tokenMint.tsx"
1516
import { Route as ExamplesWrappedSolRouteImport } from "./routes/examples/wrapped-sol.tsx"
1617
import { Route as ExamplesTransferSolRouteImport } from "./routes/examples/transfer-sol.tsx"
1718
import { Route as ExamplesTokensRouteImport } from "./routes/examples/tokens.tsx"
@@ -35,6 +36,11 @@ const ExamplesIndexRoute = ExamplesIndexRouteImport.update({
3536
path: "/",
3637
getParentRoute: () => ExamplesRoute,
3738
} as any)
39+
const TokenInfoTokenMintRoute = TokenInfoTokenMintRouteImport.update({
40+
id: "/token-info/$tokenMint",
41+
path: "/token-info/$tokenMint",
42+
getParentRoute: () => rootRouteImport,
43+
} as any)
3844
const ExamplesWrappedSolRoute = ExamplesWrappedSolRouteImport.update({
3945
id: "/wrapped-sol",
4046
path: "/wrapped-sol",
@@ -81,6 +87,7 @@ export interface FileRoutesByFullPath {
8187
"/examples/tokens": typeof ExamplesTokensRoute
8288
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
8389
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
90+
"/token-info/$tokenMint": typeof TokenInfoTokenMintRoute
8491
"/examples/": typeof ExamplesIndexRoute
8592
}
8693
export interface FileRoutesByTo {
@@ -92,6 +99,7 @@ export interface FileRoutesByTo {
9299
"/examples/tokens": typeof ExamplesTokensRoute
93100
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
94101
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
102+
"/token-info/$tokenMint": typeof TokenInfoTokenMintRoute
95103
"/examples": typeof ExamplesIndexRoute
96104
}
97105
export interface FileRoutesById {
@@ -105,6 +113,7 @@ export interface FileRoutesById {
105113
"/examples/tokens": typeof ExamplesTokensRoute
106114
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
107115
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
116+
"/token-info/$tokenMint": typeof TokenInfoTokenMintRoute
108117
"/examples/": typeof ExamplesIndexRoute
109118
}
110119
export interface FileRouteTypes {
@@ -119,6 +128,7 @@ export interface FileRouteTypes {
119128
| "/examples/tokens"
120129
| "/examples/transfer-sol"
121130
| "/examples/wrapped-sol"
131+
| "/token-info/$tokenMint"
122132
| "/examples/"
123133
fileRoutesByTo: FileRoutesByTo
124134
to:
@@ -130,6 +140,7 @@ export interface FileRouteTypes {
130140
| "/examples/tokens"
131141
| "/examples/transfer-sol"
132142
| "/examples/wrapped-sol"
143+
| "/token-info/$tokenMint"
133144
| "/examples"
134145
id:
135146
| "__root__"
@@ -142,12 +153,14 @@ export interface FileRouteTypes {
142153
| "/examples/tokens"
143154
| "/examples/transfer-sol"
144155
| "/examples/wrapped-sol"
156+
| "/token-info/$tokenMint"
145157
| "/examples/"
146158
fileRoutesById: FileRoutesById
147159
}
148160
export interface RootRouteChildren {
149161
IndexRoute: typeof IndexRoute
150162
ExamplesRoute: typeof ExamplesRouteWithChildren
163+
TokenInfoTokenMintRoute: typeof TokenInfoTokenMintRoute
151164
}
152165

153166
declare module "@tanstack/react-router" {
@@ -173,6 +186,13 @@ declare module "@tanstack/react-router" {
173186
preLoaderRoute: typeof ExamplesIndexRouteImport
174187
parentRoute: typeof ExamplesRoute
175188
}
189+
"/token-info/$tokenMint": {
190+
id: "/token-info/$tokenMint"
191+
path: "/token-info/$tokenMint"
192+
fullPath: "/token-info/$tokenMint"
193+
preLoaderRoute: typeof TokenInfoTokenMintRouteImport
194+
parentRoute: typeof rootRouteImport
195+
}
176196
"/examples/wrapped-sol": {
177197
id: "/examples/wrapped-sol"
178198
path: "/wrapped-sol"
@@ -254,6 +274,7 @@ const ExamplesRouteWithChildren = ExamplesRoute._addFileChildren(
254274
const rootRouteChildren: RootRouteChildren = {
255275
IndexRoute: IndexRoute,
256276
ExamplesRoute: ExamplesRouteWithChildren,
277+
TokenInfoTokenMintRoute: TokenInfoTokenMintRoute,
257278
}
258279
export const routeTree = rootRouteImport
259280
._addFileChildren(rootRouteChildren)
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { useTokenInfo } from "@macalinao/grill";
2+
import { address } from "@solana/kit";
3+
import { createFileRoute } from "@tanstack/react-router";
4+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
5+
6+
function TokenInfoPage() {
7+
const { tokenMint } = Route.useParams();
8+
9+
const {
10+
data: tokenInfo,
11+
isLoading,
12+
error,
13+
} = useTokenInfo({
14+
mint: tokenMint ? address(tokenMint) : null,
15+
});
16+
17+
if (isLoading) {
18+
return (
19+
<div className="container mx-auto p-6">
20+
<h1 className="text-2xl font-bold mb-6">Token Information</h1>
21+
<div>Loading token information...</div>
22+
</div>
23+
);
24+
}
25+
26+
if (error) {
27+
return (
28+
<div className="container mx-auto p-6">
29+
<h1 className="text-2xl font-bold mb-6">Token Information</h1>
30+
<div className="text-red-500">Error loading token: {error.message}</div>
31+
</div>
32+
);
33+
}
34+
35+
if (!tokenInfo) {
36+
return (
37+
<div className="container mx-auto p-6">
38+
<h1 className="text-2xl font-bold mb-6">Token Information</h1>
39+
<div>No token information found for mint: {tokenMint}</div>
40+
</div>
41+
);
42+
}
43+
44+
return (
45+
<div className="container mx-auto p-6">
46+
<h1 className="text-2xl font-bold mb-6">Token Information</h1>
47+
48+
<Card>
49+
<CardHeader>
50+
<CardTitle className="flex items-center gap-3">
51+
{tokenInfo.iconURL && (
52+
<img
53+
src={tokenInfo.iconURL}
54+
alt={`${tokenInfo.symbol} icon`}
55+
className="w-8 h-8 rounded-full"
56+
/>
57+
)}
58+
{tokenInfo.name} ({tokenInfo.symbol})
59+
</CardTitle>
60+
</CardHeader>
61+
<CardContent className="space-y-4">
62+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
63+
<div>
64+
<h3 className="font-semibold text-sm text-gray-600">Name</h3>
65+
<p className="text-lg">{tokenInfo.name}</p>
66+
</div>
67+
68+
<div>
69+
<h3 className="font-semibold text-sm text-gray-600">Symbol</h3>
70+
<p className="text-lg">{tokenInfo.symbol}</p>
71+
</div>
72+
73+
<div>
74+
<h3 className="font-semibold text-sm text-gray-600">Decimals</h3>
75+
<p className="text-lg">{tokenInfo.decimals}</p>
76+
</div>
77+
78+
<div>
79+
<h3 className="font-semibold text-sm text-gray-600">
80+
Mint Address
81+
</h3>
82+
<p className="text-sm font-mono rounded break-all">
83+
{tokenInfo.mint}
84+
</p>
85+
</div>
86+
87+
{tokenInfo.iconURL && (
88+
<div className="md:col-span-2">
89+
<h3 className="font-semibold text-sm text-gray-600">
90+
Icon URL
91+
</h3>
92+
<p className="text-sm font-mono rounded break-all">
93+
{tokenInfo.iconURL}
94+
</p>
95+
</div>
96+
)}
97+
</div>
98+
</CardContent>
99+
</Card>
100+
</div>
101+
);
102+
}
103+
104+
export const Route = createFileRoute("/token-info/$tokenMint")({
105+
component: TokenInfoPage,
106+
});

0 commit comments

Comments
 (0)