You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Account caching and batched loading for React-based Solana applications, inspired by [@saberhq/sail](https://github.com/saber-hq/sail) but built for@solana/kit.
This example demonstrates how to use the Mast library with DataLoader integration for efficient Solana blockchain interactions.
3
+
A modern Solana application demonstrating the Grill toolkit's capabilities for efficient blockchain interactions with automatic account batching and caching.
4
+
5
+
## Overview
6
+
7
+
This example showcases how to build a Solana dApp using:
8
+
-**Grill** - React provider for automatic account batching with DataLoader
9
+
-**Gill** - Modern Solana client library
10
+
-**React Query** - Powerful data fetching and caching
11
+
-**Tailwind CSS v4** - Utility-first styling with shadcn/ui components
12
+
-**TanStack Router** - Type-safe routing
4
13
5
14
## Features
6
15
7
-
-**SolanaClientProvider**: Uses gill's `createSolanaClient` for RPC connections
8
-
-**MastProvider**: Provides a DataLoader for batched account fetching
9
-
-**Wallet Integration**: Supports Phantom, Solflare, and Backpack wallets
10
-
-**UI Components**: Built with Tailwind CSS v4 and shadcn components
11
-
-**React Query**: Integrated for data fetching and caching
16
+
- 🚀 **Automatic Account Batching** - Multiple account requests are automatically batched into single RPC calls
17
+
- 💾 **Smart Caching** - React Query integration for intelligent data caching
18
+
- 🔐 **Wallet Integration** - Support for all major Solana wallets via @solana/wallet-adapter
19
+
- 🎨 **Modern UI** - Beautiful interface with dark mode support
20
+
- ⚡ **Fast Development** - Vite + Bun for lightning-fast builds
21
+
22
+
## Getting Started
12
23
13
-
## Running the Example
24
+
### Prerequisites
25
+
-[Bun](https://bun.sh) v1.2.19 or higher
26
+
- Node.js 18+ (for compatibility)
27
+
28
+
### Installation
14
29
15
30
```bash
16
31
# From the monorepo root
@@ -22,35 +37,153 @@ cd apps/example-dapp
22
37
bun run dev
23
38
```
24
39
25
-
## Key Components
40
+
Open [http://localhost:5173](http://localhost:5173) to view the app.
41
+
42
+
## Architecture
43
+
44
+
### Provider Setup
45
+
46
+
The app uses a carefully orchestrated provider hierarchy in `App.tsx`:
47
+
48
+
```tsx
49
+
QueryClientProvider// React Query for caching
50
+
→ SolanaProvider// Gill client for RPC
51
+
→ ConnectionProvider// Wallet adapter connection
52
+
→ WalletProvider// Wallet management
53
+
→ WalletModalProvider
54
+
→ GrillProvider// Account batching with DataLoader
Creates a DataLoader instance for batching account fetches. When multiple components request account data simultaneously, these requests are automatically batched into efficient RPC calls.
61
+
62
+
#### SimpleDashboard
63
+
Demonstrates core functionality:
64
+
- Wallet connection and balance display
65
+
- Account data fetching with automatic batching
66
+
- Direct RPC calls using the gill client
67
+
- Real-time balance updates
68
+
69
+
## Usage Examples
70
+
71
+
### Fetching Account Data
72
+
73
+
```typescript
74
+
import { useAccount } from"@macalinao/grill";
75
+
76
+
function MyComponent() {
77
+
// Automatically batched with other account requests
0 commit comments