Skip to content

Commit 28a6753

Browse files
authored
Merge pull request #33 from macalinao/igm/use-accounts-data
Add useAccounts hook to allow fetching multiple accounts at once with the same decoder
2 parents 0f5159e + 7f6e814 commit 28a6753

File tree

11 files changed

+559
-30
lines changed

11 files changed

+559
-30
lines changed

.changeset/sad-tables-fly.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@macalinao/grill": patch
3+
---
4+
5+
Add useAccounts hook for fetching multiple accounts

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { Link, Outlet, useLocation } from "@tanstack/react-router";
2-
import { ArrowRight, Coins, Database, LayoutDashboard } from "lucide-react";
2+
import {
3+
ArrowRight,
4+
Coins,
5+
Database,
6+
LayoutDashboard,
7+
Zap,
8+
} from "lucide-react";
39
import type * as React from "react";
410
import {
511
Sidebar,
@@ -48,6 +54,11 @@ const exampleNavItems: ExampleNavItem[] = [
4854
href: "/examples/tokens",
4955
icon: Database,
5056
},
57+
{
58+
title: "Batch Accounts",
59+
href: "/examples/batch-accounts",
60+
icon: Zap,
61+
},
5162
];
5263

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

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { Route as ExamplesWrappedSolRouteImport } from "./routes/examples/wrappe
1616
import { Route as ExamplesTransferSolRouteImport } from "./routes/examples/transfer-sol.tsx"
1717
import { Route as ExamplesTokensRouteImport } from "./routes/examples/tokens.tsx"
1818
import { Route as ExamplesDashboardRouteImport } from "./routes/examples/dashboard.tsx"
19+
import { Route as ExamplesBatchAccountsRouteImport } from "./routes/examples/batch-accounts.tsx"
1920

2021
const ExamplesRoute = ExamplesRouteImport.update({
2122
id: "/examples",
@@ -52,10 +53,16 @@ const ExamplesDashboardRoute = ExamplesDashboardRouteImport.update({
5253
path: "/dashboard",
5354
getParentRoute: () => ExamplesRoute,
5455
} as any)
56+
const ExamplesBatchAccountsRoute = ExamplesBatchAccountsRouteImport.update({
57+
id: "/batch-accounts",
58+
path: "/batch-accounts",
59+
getParentRoute: () => ExamplesRoute,
60+
} as any)
5561

5662
export interface FileRoutesByFullPath {
5763
"/": typeof IndexRoute
5864
"/examples": typeof ExamplesRouteWithChildren
65+
"/examples/batch-accounts": typeof ExamplesBatchAccountsRoute
5966
"/examples/dashboard": typeof ExamplesDashboardRoute
6067
"/examples/tokens": typeof ExamplesTokensRoute
6168
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
@@ -64,6 +71,7 @@ export interface FileRoutesByFullPath {
6471
}
6572
export interface FileRoutesByTo {
6673
"/": typeof IndexRoute
74+
"/examples/batch-accounts": typeof ExamplesBatchAccountsRoute
6775
"/examples/dashboard": typeof ExamplesDashboardRoute
6876
"/examples/tokens": typeof ExamplesTokensRoute
6977
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
@@ -74,6 +82,7 @@ export interface FileRoutesById {
7482
__root__: typeof rootRouteImport
7583
"/": typeof IndexRoute
7684
"/examples": typeof ExamplesRouteWithChildren
85+
"/examples/batch-accounts": typeof ExamplesBatchAccountsRoute
7786
"/examples/dashboard": typeof ExamplesDashboardRoute
7887
"/examples/tokens": typeof ExamplesTokensRoute
7988
"/examples/transfer-sol": typeof ExamplesTransferSolRoute
@@ -85,6 +94,7 @@ export interface FileRouteTypes {
8594
fullPaths:
8695
| "/"
8796
| "/examples"
97+
| "/examples/batch-accounts"
8898
| "/examples/dashboard"
8999
| "/examples/tokens"
90100
| "/examples/transfer-sol"
@@ -93,6 +103,7 @@ export interface FileRouteTypes {
93103
fileRoutesByTo: FileRoutesByTo
94104
to:
95105
| "/"
106+
| "/examples/batch-accounts"
96107
| "/examples/dashboard"
97108
| "/examples/tokens"
98109
| "/examples/transfer-sol"
@@ -102,6 +113,7 @@ export interface FileRouteTypes {
102113
| "__root__"
103114
| "/"
104115
| "/examples"
116+
| "/examples/batch-accounts"
105117
| "/examples/dashboard"
106118
| "/examples/tokens"
107119
| "/examples/transfer-sol"
@@ -165,10 +177,18 @@ declare module "@tanstack/react-router" {
165177
preLoaderRoute: typeof ExamplesDashboardRouteImport
166178
parentRoute: typeof ExamplesRoute
167179
}
180+
"/examples/batch-accounts": {
181+
id: "/examples/batch-accounts"
182+
path: "/batch-accounts"
183+
fullPath: "/examples/batch-accounts"
184+
preLoaderRoute: typeof ExamplesBatchAccountsRouteImport
185+
parentRoute: typeof ExamplesRoute
186+
}
168187
}
169188
}
170189

171190
interface ExamplesRouteChildren {
191+
ExamplesBatchAccountsRoute: typeof ExamplesBatchAccountsRoute
172192
ExamplesDashboardRoute: typeof ExamplesDashboardRoute
173193
ExamplesTokensRoute: typeof ExamplesTokensRoute
174194
ExamplesTransferSolRoute: typeof ExamplesTransferSolRoute
@@ -177,6 +197,7 @@ interface ExamplesRouteChildren {
177197
}
178198

179199
const ExamplesRouteChildren: ExamplesRouteChildren = {
200+
ExamplesBatchAccountsRoute: ExamplesBatchAccountsRoute,
180201
ExamplesDashboardRoute: ExamplesDashboardRoute,
181202
ExamplesTokensRoute: ExamplesTokensRoute,
182203
ExamplesTransferSolRoute: ExamplesTransferSolRoute,

0 commit comments

Comments
 (0)