Skip to content

Commit 50f45ce

Browse files
authored
Merge pull request #12 from macalinao/igm/zod-solana
Add Zod validators for Solana types
2 parents cc25665 + 26af4d0 commit 50f45ce

File tree

19 files changed

+781
-7
lines changed

19 files changed

+781
-7
lines changed

.changeset/itchy-wolves-film.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@macalinao/zod-solana": patch
3+
"example-dapp": patch
4+
"@macalinao/grill": patch
5+
---
6+
7+
Add address validator for Zod

apps/example-dapp/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"preview": "vite preview"
1919
},
2020
"dependencies": {
21+
"@hookform/resolvers": "^5.2.1",
2122
"@macalinao/grill": "workspace:*",
2223
"@macalinao/wallet-adapter-compat": "workspace:*",
2324
"@radix-ui/react-dialog": "^1.1.14",
@@ -43,8 +44,10 @@
4344
"lucide-react": "^0.539.0",
4445
"react": "catalog:",
4546
"react-dom": "catalog:",
47+
"react-hook-form": "^7.62.0",
4648
"sonner": "^2.0.7",
47-
"tailwind-merge": "^3.3.1"
49+
"tailwind-merge": "^3.3.1",
50+
"zod": "^4.0.17"
4851
},
4952
"devDependencies": {
5053
"@eslint/js": "^9.33.0",

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 { Coins, LayoutDashboard } from "lucide-react";
2+
import { ArrowRight, Coins, LayoutDashboard } from "lucide-react";
33
import type * as React from "react";
44
import {
55
Sidebar,
@@ -33,6 +33,11 @@ const exampleNavItems: ExampleNavItem[] = [
3333
href: "/examples/dashboard",
3434
icon: LayoutDashboard,
3535
},
36+
{
37+
title: "Transfer SOL",
38+
href: "/examples/transfer-sol",
39+
icon: ArrowRight,
40+
},
3641
{
3742
title: "Wrapped SOL",
3843
href: "/examples/wrapped-sol",

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ 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"
1515
import { Route as ExamplesWrappedSolRouteImport } from "./routes/examples/wrapped-sol.tsx"
16+
import { Route as ExamplesTransferSolRouteImport } from "./routes/examples/transfer-sol.tsx"
1617
import { Route as ExamplesDashboardRouteImport } from "./routes/examples/dashboard.tsx"
1718

1819
const ExamplesRoute = ExamplesRouteImport.update({
@@ -35,6 +36,11 @@ const ExamplesWrappedSolRoute = ExamplesWrappedSolRouteImport.update({
3536
path: "/wrapped-sol",
3637
getParentRoute: () => ExamplesRoute,
3738
} as any)
39+
const ExamplesTransferSolRoute = ExamplesTransferSolRouteImport.update({
40+
id: "/transfer-sol",
41+
path: "/transfer-sol",
42+
getParentRoute: () => ExamplesRoute,
43+
} as any)
3844
const ExamplesDashboardRoute = ExamplesDashboardRouteImport.update({
3945
id: "/dashboard",
4046
path: "/dashboard",
@@ -45,12 +51,14 @@ export interface FileRoutesByFullPath {
4551
"/": typeof IndexRoute
4652
"/examples": typeof ExamplesRouteWithChildren
4753
"/examples/dashboard": typeof ExamplesDashboardRoute
54+
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
4855
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
4956
"/examples/": typeof ExamplesIndexRoute
5057
}
5158
export interface FileRoutesByTo {
5259
"/": typeof IndexRoute
5360
"/examples/dashboard": typeof ExamplesDashboardRoute
61+
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
5462
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
5563
"/examples": typeof ExamplesIndexRoute
5664
}
@@ -59,6 +67,7 @@ export interface FileRoutesById {
5967
"/": typeof IndexRoute
6068
"/examples": typeof ExamplesRouteWithChildren
6169
"/examples/dashboard": typeof ExamplesDashboardRoute
70+
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
6271
"/examples/wrapped-sol": typeof ExamplesWrappedSolRoute
6372
"/examples/": typeof ExamplesIndexRoute
6473
}
@@ -68,15 +77,22 @@ export interface FileRouteTypes {
6877
| "/"
6978
| "/examples"
7079
| "/examples/dashboard"
80+
| "/examples/transfer-sol"
7181
| "/examples/wrapped-sol"
7282
| "/examples/"
7383
fileRoutesByTo: FileRoutesByTo
74-
to: "/" | "/examples/dashboard" | "/examples/wrapped-sol" | "/examples"
84+
to:
85+
| "/"
86+
| "/examples/dashboard"
87+
| "/examples/transfer-sol"
88+
| "/examples/wrapped-sol"
89+
| "/examples"
7590
id:
7691
| "__root__"
7792
| "/"
7893
| "/examples"
7994
| "/examples/dashboard"
95+
| "/examples/transfer-sol"
8096
| "/examples/wrapped-sol"
8197
| "/examples/"
8298
fileRoutesById: FileRoutesById
@@ -116,6 +132,13 @@ declare module "@tanstack/react-router" {
116132
preLoaderRoute: typeof ExamplesWrappedSolRouteImport
117133
parentRoute: typeof ExamplesRoute
118134
}
135+
"/examples/transfer-sol": {
136+
id: "/examples/transfer-sol"
137+
path: "/transfer-sol"
138+
fullPath: "/examples/transfer-sol"
139+
preLoaderRoute: typeof ExamplesTransferSolRouteImport
140+
parentRoute: typeof ExamplesRoute
141+
}
119142
"/examples/dashboard": {
120143
id: "/examples/dashboard"
121144
path: "/dashboard"
@@ -128,12 +151,14 @@ declare module "@tanstack/react-router" {
128151

129152
interface ExamplesRouteChildren {
130153
ExamplesDashboardRoute: typeof ExamplesDashboardRoute
154+
ExamplesTransferSolRoute: typeof ExamplesTransferSolRoute
131155
ExamplesWrappedSolRoute: typeof ExamplesWrappedSolRoute
132156
ExamplesIndexRoute: typeof ExamplesIndexRoute
133157
}
134158

135159
const ExamplesRouteChildren: ExamplesRouteChildren = {
136160
ExamplesDashboardRoute: ExamplesDashboardRoute,
161+
ExamplesTransferSolRoute: ExamplesTransferSolRoute,
137162
ExamplesWrappedSolRoute: ExamplesWrappedSolRoute,
138163
ExamplesIndexRoute: ExamplesIndexRoute,
139164
}

0 commit comments

Comments
 (0)