Skip to content

Commit dbbd147

Browse files
authored
Merge pull request #17 from macalinao/igm/token-info
Add hook for fetching token info from on-chain
2 parents 124c44a + 87c6415 commit dbbd147

File tree

16 files changed

+672
-81
lines changed

16 files changed

+672
-81
lines changed

.changeset/rare-cats-behave.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@macalinao/token-metadata-client": patch
3+
"@macalinao/zod-solana": patch
4+
"@macalinao/grill": patch
5+
---
6+
7+
Add support for token metadata fetching

apps/example-dapp/src/components/layout/examples/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Link, Outlet, useLocation } from "@tanstack/react-router";
2-
import { ArrowRight, Coins, LayoutDashboard } from "lucide-react";
2+
import { ArrowRight, Coins, Database, LayoutDashboard } from "lucide-react";
33
import type * as React from "react";
44
import {
55
Sidebar,
@@ -43,6 +43,11 @@ const exampleNavItems: ExampleNavItem[] = [
4343
href: "/examples/wrapped-sol",
4444
icon: Coins,
4545
},
46+
{
47+
title: "Token Information",
48+
href: "/examples/tokens",
49+
icon: Database,
50+
},
4651
];
4752

4853
export const ExamplesLayout: React.FC<ExamplesLayoutProps> = ({

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

Lines changed: 100 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -8,141 +8,160 @@
88
// You should NOT make any changes in this file as it will be overwritten.
99
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
1010

11-
import { Route as rootRouteImport } from "./routes/__root.tsx"
12-
import { Route as ExamplesRouteImport } from "./routes/examples.tsx"
13-
import { Route as IndexRouteImport } from "./routes/index.tsx"
14-
import { Route as ExamplesIndexRouteImport } from "./routes/examples/index.tsx"
15-
import { Route as ExamplesWrappedSolRouteImport } from "./routes/examples/wrapped-sol.tsx"
16-
import { Route as ExamplesTransferSolRouteImport } from "./routes/examples/transfer-sol.tsx"
17-
import { Route as ExamplesDashboardRouteImport } from "./routes/examples/dashboard.tsx"
11+
import { Route as rootRouteImport } from './routes/__root'
12+
import { Route as ExamplesRouteImport } from './routes/examples'
13+
import { Route as IndexRouteImport } from './routes/index'
14+
import { Route as ExamplesIndexRouteImport } from './routes/examples/index'
15+
import { Route as ExamplesWrappedSolRouteImport } from './routes/examples/wrapped-sol'
16+
import { Route as ExamplesTransferSolRouteImport } from './routes/examples/transfer-sol'
17+
import { Route as ExamplesTokensRouteImport } from './routes/examples/tokens'
18+
import { Route as ExamplesDashboardRouteImport } from './routes/examples/dashboard'
1819

1920
const ExamplesRoute = ExamplesRouteImport.update({
20-
id: "/examples",
21-
path: "/examples",
21+
id: '/examples',
22+
path: '/examples',
2223
getParentRoute: () => rootRouteImport,
2324
} as any)
2425
const IndexRoute = IndexRouteImport.update({
25-
id: "/",
26-
path: "/",
26+
id: '/',
27+
path: '/',
2728
getParentRoute: () => rootRouteImport,
2829
} as any)
2930
const ExamplesIndexRoute = ExamplesIndexRouteImport.update({
30-
id: "/",
31-
path: "/",
31+
id: '/',
32+
path: '/',
3233
getParentRoute: () => ExamplesRoute,
3334
} as any)
3435
const ExamplesWrappedSolRoute = ExamplesWrappedSolRouteImport.update({
35-
id: "/wrapped-sol",
36-
path: "/wrapped-sol",
36+
id: '/wrapped-sol',
37+
path: '/wrapped-sol',
3738
getParentRoute: () => ExamplesRoute,
3839
} as any)
3940
const ExamplesTransferSolRoute = ExamplesTransferSolRouteImport.update({
40-
id: "/transfer-sol",
41-
path: "/transfer-sol",
41+
id: '/transfer-sol',
42+
path: '/transfer-sol',
43+
getParentRoute: () => ExamplesRoute,
44+
} as any)
45+
const ExamplesTokensRoute = ExamplesTokensRouteImport.update({
46+
id: '/tokens',
47+
path: '/tokens',
4248
getParentRoute: () => ExamplesRoute,
4349
} as any)
4450
const ExamplesDashboardRoute = ExamplesDashboardRouteImport.update({
45-
id: "/dashboard",
46-
path: "/dashboard",
51+
id: '/dashboard',
52+
path: '/dashboard',
4753
getParentRoute: () => ExamplesRoute,
4854
} as any)
4955

5056
export interface FileRoutesByFullPath {
51-
"/": typeof IndexRoute
52-
"/examples": typeof ExamplesRouteWithChildren
53-
"/examples/dashboard": typeof ExamplesDashboardRoute
54-
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
55-
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
56-
"/examples/": typeof ExamplesIndexRoute
57+
'/': typeof IndexRoute
58+
'/examples': typeof ExamplesRouteWithChildren
59+
'/examples/dashboard': typeof ExamplesDashboardRoute
60+
'/examples/tokens': typeof ExamplesTokensRoute
61+
'/examples/transfer-sol': typeof ExamplesTransferSolRoute
62+
'/examples/wrapped-sol': typeof ExamplesWrappedSolRoute
63+
'/examples/': typeof ExamplesIndexRoute
5764
}
5865
export interface FileRoutesByTo {
59-
"/": typeof IndexRoute
60-
"/examples/dashboard": typeof ExamplesDashboardRoute
61-
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
62-
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
63-
"/examples": typeof ExamplesIndexRoute
66+
'/': typeof IndexRoute
67+
'/examples/dashboard': typeof ExamplesDashboardRoute
68+
'/examples/tokens': typeof ExamplesTokensRoute
69+
'/examples/transfer-sol': typeof ExamplesTransferSolRoute
70+
'/examples/wrapped-sol': typeof ExamplesWrappedSolRoute
71+
'/examples': typeof ExamplesIndexRoute
6472
}
6573
export interface FileRoutesById {
6674
__root__: typeof rootRouteImport
67-
"/": typeof IndexRoute
68-
"/examples": typeof ExamplesRouteWithChildren
69-
"/examples/dashboard": typeof ExamplesDashboardRoute
70-
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
71-
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
72-
"/examples/": typeof ExamplesIndexRoute
75+
'/': typeof IndexRoute
76+
'/examples': typeof ExamplesRouteWithChildren
77+
'/examples/dashboard': typeof ExamplesDashboardRoute
78+
'/examples/tokens': typeof ExamplesTokensRoute
79+
'/examples/transfer-sol': typeof ExamplesTransferSolRoute
80+
'/examples/wrapped-sol': typeof ExamplesWrappedSolRoute
81+
'/examples/': typeof ExamplesIndexRoute
7382
}
7483
export interface FileRouteTypes {
7584
fileRoutesByFullPath: FileRoutesByFullPath
7685
fullPaths:
77-
| "/"
78-
| "/examples"
79-
| "/examples/dashboard"
80-
| "/examples/transfer-sol"
81-
| "/examples/wrapped-sol"
82-
| "/examples/"
86+
| '/'
87+
| '/examples'
88+
| '/examples/dashboard'
89+
| '/examples/tokens'
90+
| '/examples/transfer-sol'
91+
| '/examples/wrapped-sol'
92+
| '/examples/'
8393
fileRoutesByTo: FileRoutesByTo
8494
to:
85-
| "/"
86-
| "/examples/dashboard"
87-
| "/examples/transfer-sol"
88-
| "/examples/wrapped-sol"
89-
| "/examples"
95+
| '/'
96+
| '/examples/dashboard'
97+
| '/examples/tokens'
98+
| '/examples/transfer-sol'
99+
| '/examples/wrapped-sol'
100+
| '/examples'
90101
id:
91-
| "__root__"
92-
| "/"
93-
| "/examples"
94-
| "/examples/dashboard"
95-
| "/examples/transfer-sol"
96-
| "/examples/wrapped-sol"
97-
| "/examples/"
102+
| '__root__'
103+
| '/'
104+
| '/examples'
105+
| '/examples/dashboard'
106+
| '/examples/tokens'
107+
| '/examples/transfer-sol'
108+
| '/examples/wrapped-sol'
109+
| '/examples/'
98110
fileRoutesById: FileRoutesById
99111
}
100112
export interface RootRouteChildren {
101113
IndexRoute: typeof IndexRoute
102114
ExamplesRoute: typeof ExamplesRouteWithChildren
103115
}
104116

105-
declare module "@tanstack/react-router" {
117+
declare module '@tanstack/react-router' {
106118
interface FileRoutesByPath {
107-
"/examples": {
108-
id: "/examples"
109-
path: "/examples"
110-
fullPath: "/examples"
119+
'/examples': {
120+
id: '/examples'
121+
path: '/examples'
122+
fullPath: '/examples'
111123
preLoaderRoute: typeof ExamplesRouteImport
112124
parentRoute: typeof rootRouteImport
113125
}
114-
"/": {
115-
id: "/"
116-
path: "/"
117-
fullPath: "/"
126+
'/': {
127+
id: '/'
128+
path: '/'
129+
fullPath: '/'
118130
preLoaderRoute: typeof IndexRouteImport
119131
parentRoute: typeof rootRouteImport
120132
}
121-
"/examples/": {
122-
id: "/examples/"
123-
path: "/"
124-
fullPath: "/examples/"
133+
'/examples/': {
134+
id: '/examples/'
135+
path: '/'
136+
fullPath: '/examples/'
125137
preLoaderRoute: typeof ExamplesIndexRouteImport
126138
parentRoute: typeof ExamplesRoute
127139
}
128-
"/examples/wrapped-sol": {
129-
id: "/examples/wrapped-sol"
130-
path: "/wrapped-sol"
131-
fullPath: "/examples/wrapped-sol"
140+
'/examples/wrapped-sol': {
141+
id: '/examples/wrapped-sol'
142+
path: '/wrapped-sol'
143+
fullPath: '/examples/wrapped-sol'
132144
preLoaderRoute: typeof ExamplesWrappedSolRouteImport
133145
parentRoute: typeof ExamplesRoute
134146
}
135-
"/examples/transfer-sol": {
136-
id: "/examples/transfer-sol"
137-
path: "/transfer-sol"
138-
fullPath: "/examples/transfer-sol"
147+
'/examples/transfer-sol': {
148+
id: '/examples/transfer-sol'
149+
path: '/transfer-sol'
150+
fullPath: '/examples/transfer-sol'
139151
preLoaderRoute: typeof ExamplesTransferSolRouteImport
140152
parentRoute: typeof ExamplesRoute
141153
}
142-
"/examples/dashboard": {
143-
id: "/examples/dashboard"
144-
path: "/dashboard"
145-
fullPath: "/examples/dashboard"
154+
'/examples/tokens': {
155+
id: '/examples/tokens'
156+
path: '/tokens'
157+
fullPath: '/examples/tokens'
158+
preLoaderRoute: typeof ExamplesTokensRouteImport
159+
parentRoute: typeof ExamplesRoute
160+
}
161+
'/examples/dashboard': {
162+
id: '/examples/dashboard'
163+
path: '/dashboard'
164+
fullPath: '/examples/dashboard'
146165
preLoaderRoute: typeof ExamplesDashboardRouteImport
147166
parentRoute: typeof ExamplesRoute
148167
}
@@ -151,13 +170,15 @@ declare module "@tanstack/react-router" {
151170

152171
interface ExamplesRouteChildren {
153172
ExamplesDashboardRoute: typeof ExamplesDashboardRoute
173+
ExamplesTokensRoute: typeof ExamplesTokensRoute
154174
ExamplesTransferSolRoute: typeof ExamplesTransferSolRoute
155175
ExamplesWrappedSolRoute: typeof ExamplesWrappedSolRoute
156176
ExamplesIndexRoute: typeof ExamplesIndexRoute
157177
}
158178

159179
const ExamplesRouteChildren: ExamplesRouteChildren = {
160180
ExamplesDashboardRoute: ExamplesDashboardRoute,
181+
ExamplesTokensRoute: ExamplesTokensRoute,
161182
ExamplesTransferSolRoute: ExamplesTransferSolRoute,
162183
ExamplesWrappedSolRoute: ExamplesWrappedSolRoute,
163184
ExamplesIndexRoute: ExamplesIndexRoute,

0 commit comments

Comments
 (0)