Skip to content

Commit f93bd8d

Browse files
authored
Merge pull request #37 from macalinao/igm/grill-wt111
2 parents 2fa33ae + e882c7d commit f93bd8d

File tree

19 files changed

+171
-48
lines changed

19 files changed

+171
-48
lines changed

.changeset/common-things-strive.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@macalinao/solana-batch-accounts-loader": patch
3+
"@macalinao/wallet-adapter-compat": patch
4+
"@macalinao/dataloader-es": patch
5+
"@macalinao/token-utils": patch
6+
"@macalinao/zod-solana": patch
7+
"example-dapp": patch
8+
"@macalinao/grill": patch
9+
---
10+
11+
README license updates

.changeset/witty-hotels-throw.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 transaction message encoder helpers

README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,31 @@ A comprehensive toolkit for building Solana applications with React, featuring a
77
## Packages
88

99
### [@macalinao/grill](./packages/grill)
10+
1011
React provider for Solana account management with automatic batching and caching, built on top of gill-react.
1112

1213
```bash
1314
bun add @macalinao/grill gill-react gill
1415
```
1516

1617
### [@macalinao/solana-batch-accounts-loader](./packages/solana-batch-accounts-loader)
18+
1719
DataLoader implementation for batching Solana account fetches.
1820

1921
```bash
2022
bun add @macalinao/solana-batch-accounts-loader
2123
```
2224

2325
### [@macalinao/wallet-adapter-compat](./packages/wallet-adapter-compat)
26+
2427
Compatibility layer between @solana/wallet-adapter and @solana/kit.
2528

2629
```bash
2730
bun add @macalinao/wallet-adapter-compat
2831
```
2932

3033
### [@macalinao/dataloader-es](./packages/dataloader-es)
34+
3135
ES module compatible DataLoader implementation.
3236

3337
```bash
@@ -41,7 +45,10 @@ import { GrillProvider } from "@macalinao/grill";
4145
import { WalletAdapterCompatProvider } from "@macalinao/wallet-adapter-compat";
4246
import { createSolanaClient } from "gill";
4347
import { SolanaProvider } from "gill-react";
44-
import { ConnectionProvider, WalletProvider } from "@solana/wallet-adapter-react";
48+
import {
49+
ConnectionProvider,
50+
WalletProvider,
51+
} from "@solana/wallet-adapter-react";
4552
import { WalletModalProvider } from "@solana/wallet-adapter-react-ui";
4653
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4754
import { Toaster } from "sonner";
@@ -87,17 +94,17 @@ import { useAccount, useAssociatedTokenAccount } from "@macalinao/grill";
8794

8895
function Dashboard() {
8996
// All these requests are batched into 1 RPC call!
90-
const { data: userAccount } = useAccount({
91-
address: userAddress
97+
const { data: userAccount } = useAccount({
98+
address: userAddress,
9299
});
93-
100+
94101
const { data: usdcAccount } = useAssociatedTokenAccount({
95102
mint: USDC_MINT,
96-
owner: userAddress
103+
owner: userAddress,
97104
});
98-
99-
const { data: solAccount } = useAccount({
100-
address: poolAddress
105+
106+
const { data: solAccount } = useAccount({
107+
address: poolAddress,
101108
});
102109
}
103110
```
@@ -112,13 +119,13 @@ import { useSendTX, useKitWallet } from "@macalinao/grill";
112119
function SwapButton() {
113120
const { signer } = useKitWallet();
114121
const sendTX = useSendTX();
115-
122+
116123
const handleSwap = async () => {
117124
const instructions = buildSwapInstructions();
118125
await sendTX("Swap USDC for SOL", instructions);
119126
// Automatic toast notifications for each stage!
120127
};
121-
128+
122129
return <button onClick={handleSwap}>Swap</button>;
123130
}
124131
```
@@ -132,9 +139,9 @@ import { getTokenAccountDecoder } from "@solana-program/token";
132139
function TokenBalance({ tokenAccountAddress }) {
133140
const { data: account } = useAccount({
134141
address: tokenAccountAddress,
135-
decoder: getTokenAccountDecoder()
142+
decoder: getTokenAccountDecoder(),
136143
});
137-
144+
138145
// account.data is fully typed as TokenAccount!
139146
return <div>Balance: {account?.data.amount.toString()}</div>;
140147
}
@@ -163,6 +170,7 @@ Traditional Solana development suffers from the N+1 query problem. Every compone
163170
Grill pairs perfectly with **Coda**, our automated client generation tool for Solana programs. While Grill handles efficient account fetching and transaction management, Coda generates type-safe TypeScript clients from your Anchor IDLs automatically.
164171

165172
Together they provide:
173+
166174
- **Zero boilerplate**: Coda generates the program clients, Grill batches the account fetches
167175
- **End-to-end type safety**: From IDL to UI components
168176
- **Automatic synchronization**: Keep your clients in sync with on-chain programs
@@ -215,8 +223,4 @@ bun run lint
215223
216224
## License
217225
218-
Apache-2.0
219-
220-
## Author
221-
222-
Ian Macalinao <[email protected]>
226+
Copyright (c) 2025 Ian Macalinao. Licensed under the Apache-2.0 License.

apps/example-dapp/README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ A modern Solana application demonstrating the Grill toolkit's capabilities for e
55
## Overview
66

77
This example showcases how to build a Solana dApp using:
8+
89
- **Grill** - React provider for automatic account batching with DataLoader
910
- **Gill** - Modern Solana client library
1011
- **React Query** - Powerful data fetching and caching
@@ -22,6 +23,7 @@ This example showcases how to build a Solana dApp using:
2223
## Getting Started
2324

2425
### Prerequisites
26+
2527
- [Bun](https://bun.sh) v1.2.19 or higher
2628
- Node.js 18+ (for compatibility)
2729

@@ -57,10 +59,13 @@ QueryClientProvider // React Query for caching
5759
### Key Components
5860

5961
#### GrillProvider
62+
6063
Creates a DataLoader instance for batching account fetches. When multiple components request account data simultaneously, these requests are automatically batched into efficient RPC calls.
6164

6265
#### SimpleDashboard
66+
6367
Demonstrates core functionality:
68+
6469
- Wallet connection and balance display
6570
- Account data fetching with automatic batching
6671
- Direct RPC calls using the gill client
@@ -76,10 +81,10 @@ import { useAccount } from "@macalinao/grill";
7681
function MyComponent() {
7782
// Automatically batched with other account requests
7883
const { data: account, isLoading, refetch } = useAccount(publicKey);
79-
84+
8085
if (isLoading) return <div>Loading...</div>;
8186
if (!account) return <div>Account not found</div>;
82-
87+
8388
return (
8489
<div>
8590
<p>Balance: {Number(account.lamports) / 1e9} SOL</p>
@@ -96,11 +101,11 @@ import { useKitWallet } from "@macalinao/grill";
96101

97102
function WalletInfo() {
98103
const { signer, rpc } = useKitWallet();
99-
104+
100105
if (!signer) {
101106
return <div>Please connect your wallet</div>;
102107
}
103-
108+
104109
return <div>Connected: {signer.address}</div>;
105110
}
106111
```
@@ -112,12 +117,12 @@ import { useSolanaClient } from "gill-react";
112117

113118
function SlotDisplay() {
114119
const { rpc } = useSolanaClient();
115-
120+
116121
const fetchSlot = async () => {
117122
const slot = await rpc.getSlot().send();
118123
console.log("Current slot:", slot);
119124
};
120-
125+
121126
return <button onClick={fetchSlot}>Get Slot</button>;
122127
}
123128
```
@@ -186,4 +191,4 @@ This is an example application demonstrating Grill's capabilities. Feel free to
186191

187192
## License
188193

189-
Apache-2.0
194+
Copyright (c) 2025 Ian Macalinao. Licensed under the Apache-2.0 License.

apps/example-dapp/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
"url": "git+https://github.com/macalinao/grill.git",
1212
"directory": "apps/example-dapp"
1313
},
14+
"keywords": [
15+
"solana",
16+
"dapp",
17+
"example",
18+
"grill",
19+
"ian-macalinao"
20+
],
1421
"scripts": {
1522
"dev": "vite",
1623
"build": "tsc -b && vite build",

packages/dataloader-es/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ Creates a new DataLoader instance.
7979
- `clearAll()`: Clear all cached values
8080
- `prime(key, value)`: Prime the cache with a specific key/value pair
8181

82-
## License
83-
84-
This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
85-
8682
## Credits
8783

8884
This is a TypeScript port of Facebook's [DataLoader](https://github.com/graphql/dataloader). The original implementation and API design are credited to the GraphQL Foundation and Facebook.
85+
86+
## License
87+
88+
Copyright (c) 2025 Ian Macalinao. Licensed under the MIT License.

packages/dataloader-es/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"graphql",
1515
"esm",
1616
"typescript",
17-
"performance"
17+
"performance",
18+
"ian-macalinao"
1819
],
1920
"main": "dist/index.js",
2021
"types": "dist/index.d.ts",

packages/grill/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ This significantly reduces RPC calls and improves performance, especially in dat
202202
- @tanstack/react-query v5
203203
- sonner (for toast notifications)
204204

205-
## License
206-
207-
Apache-2.0 © Ian Macalinao
208-
209205
## Contributing
210206

211207
Contributions are welcome! Please feel free to submit a Pull Request.
212208

213209
## Support
214210

215-
For issues and questions, please visit our [GitHub Issues](https://github.com/macalinao/grill/issues).
211+
For issues and questions, please visit our [GitHub Issues](https://github.com/macalinao/grill/issues).
212+
213+
## License
214+
215+
Copyright (c) 2025 Ian Macalinao. Licensed under the Apache-2.0 License.

packages/grill/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"dataloader",
1414
"batching",
1515
"caching",
16-
"gill"
16+
"gill",
17+
"ian-macalinao"
1718
],
1819
"type": "module",
1920
"sideEffects": false,

packages/grill/src/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export * from "./get-signature-from-bytes.js";
44
export * from "./get-solscan-explorer-link.js";
55
export * from "./poll-confirm-transaction.js";
66
export * from "./refetch-accounts.js";
7+
export * from "./transaction.js";
78
export * from "./types.js";

0 commit comments

Comments
 (0)