create-avalanche-app 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/api.d.ts +34 -0
- package/dist/api.js +12 -0
- package/dist/api.js.map +1 -0
- package/dist/chunk-3YGRLI4R.js +91 -0
- package/dist/chunk-3YGRLI4R.js.map +1 -0
- package/dist/index.js +213 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -0
- package/templates/erc20-token/CLAUDE.md +45 -0
- package/templates/erc20-token/README.md +35 -0
- package/templates/erc20-token/app/globals.css +95 -0
- package/templates/erc20-token/app/layout.tsx +23 -0
- package/templates/erc20-token/app/page.tsx +5 -0
- package/templates/erc20-token/app/providers.tsx +30 -0
- package/templates/erc20-token/components/demo.tsx +178 -0
- package/templates/erc20-token/contracts/foundry.toml +9 -0
- package/templates/erc20-token/contracts/src/AvaKitToken.sol +53 -0
- package/templates/erc20-token/cursor/rules/avakit.mdc +31 -0
- package/templates/erc20-token/env.example +4 -0
- package/templates/erc20-token/gitignore +15 -0
- package/templates/erc20-token/lib/token-artifact.ts +239 -0
- package/templates/erc20-token/llms.txt +29 -0
- package/templates/erc20-token/manifest.json +6 -0
- package/templates/erc20-token/next.config.ts +7 -0
- package/templates/erc20-token/package.json +32 -0
- package/templates/erc20-token/postcss.config.mjs +7 -0
- package/templates/erc20-token/tsconfig.json +23 -0
- package/templates/minimal/CLAUDE.md +37 -0
- package/templates/minimal/README.md +32 -0
- package/templates/minimal/app/globals.css +95 -0
- package/templates/minimal/app/layout.tsx +23 -0
- package/templates/minimal/app/page.tsx +5 -0
- package/templates/minimal/app/providers.tsx +30 -0
- package/templates/minimal/components/demo.tsx +135 -0
- package/templates/minimal/cursor/rules/avakit.mdc +28 -0
- package/templates/minimal/env.example +4 -0
- package/templates/minimal/gitignore +10 -0
- package/templates/minimal/llms.txt +30 -0
- package/templates/minimal/manifest.json +6 -0
- package/templates/minimal/next.config.ts +7 -0
- package/templates/minimal/package.json +32 -0
- package/templates/minimal/postcss.config.mjs +7 -0
- package/templates/minimal/tsconfig.json +23 -0
- package/templates/nft-mint/CLAUDE.md +45 -0
- package/templates/nft-mint/README.md +36 -0
- package/templates/nft-mint/app/globals.css +95 -0
- package/templates/nft-mint/app/layout.tsx +23 -0
- package/templates/nft-mint/app/page.tsx +5 -0
- package/templates/nft-mint/app/providers.tsx +30 -0
- package/templates/nft-mint/components/demo.tsx +176 -0
- package/templates/nft-mint/contracts/foundry.toml +9 -0
- package/templates/nft-mint/contracts/src/AvaKitNFT.sol +57 -0
- package/templates/nft-mint/cursor/rules/avakit.mdc +32 -0
- package/templates/nft-mint/env.example +4 -0
- package/templates/nft-mint/gitignore +15 -0
- package/templates/nft-mint/lib/nft-artifact.ts +164 -0
- package/templates/nft-mint/llms.txt +31 -0
- package/templates/nft-mint/manifest.json +6 -0
- package/templates/nft-mint/next.config.ts +7 -0
- package/templates/nft-mint/package.json +32 -0
- package/templates/nft-mint/postcss.config.mjs +7 -0
- package/templates/nft-mint/tsconfig.json +23 -0
- package/templates/token-gated-app/CLAUDE.md +45 -0
- package/templates/token-gated-app/README.md +38 -0
- package/templates/token-gated-app/app/globals.css +95 -0
- package/templates/token-gated-app/app/layout.tsx +23 -0
- package/templates/token-gated-app/app/page.tsx +5 -0
- package/templates/token-gated-app/app/providers.tsx +30 -0
- package/templates/token-gated-app/components/demo.tsx +161 -0
- package/templates/token-gated-app/contracts/foundry.toml +9 -0
- package/templates/token-gated-app/contracts/src/AvaKitNFT.sol +57 -0
- package/templates/token-gated-app/cursor/rules/avakit.mdc +36 -0
- package/templates/token-gated-app/env.example +4 -0
- package/templates/token-gated-app/gitignore +15 -0
- package/templates/token-gated-app/lib/nft-artifact.ts +164 -0
- package/templates/token-gated-app/llms.txt +33 -0
- package/templates/token-gated-app/manifest.json +6 -0
- package/templates/token-gated-app/next.config.ts +7 -0
- package/templates/token-gated-app/package.json +32 -0
- package/templates/token-gated-app/postcss.config.mjs +7 -0
- package/templates/token-gated-app/tsconfig.json +23 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// Auto-generated from contracts/src/AvaKitToken.sol via `forge build`.
|
|
2
|
+
// Re-generate after editing the contract: cd contracts && forge build, then
|
|
3
|
+
// copy abi + bytecode.object here.
|
|
4
|
+
|
|
5
|
+
import type { Abi, Hex } from "viem";
|
|
6
|
+
|
|
7
|
+
export const abi = [
|
|
8
|
+
{
|
|
9
|
+
"type": "function",
|
|
10
|
+
"name": "allowance",
|
|
11
|
+
"inputs": [
|
|
12
|
+
{
|
|
13
|
+
"name": "",
|
|
14
|
+
"type": "address",
|
|
15
|
+
"internalType": "address"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "",
|
|
19
|
+
"type": "address",
|
|
20
|
+
"internalType": "address"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"outputs": [
|
|
24
|
+
{
|
|
25
|
+
"name": "",
|
|
26
|
+
"type": "uint256",
|
|
27
|
+
"internalType": "uint256"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"stateMutability": "view"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "function",
|
|
34
|
+
"name": "approve",
|
|
35
|
+
"inputs": [
|
|
36
|
+
{
|
|
37
|
+
"name": "spender",
|
|
38
|
+
"type": "address",
|
|
39
|
+
"internalType": "address"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "value",
|
|
43
|
+
"type": "uint256",
|
|
44
|
+
"internalType": "uint256"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"outputs": [
|
|
48
|
+
{
|
|
49
|
+
"name": "",
|
|
50
|
+
"type": "bool",
|
|
51
|
+
"internalType": "bool"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"stateMutability": "nonpayable"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"type": "function",
|
|
58
|
+
"name": "balanceOf",
|
|
59
|
+
"inputs": [
|
|
60
|
+
{
|
|
61
|
+
"name": "",
|
|
62
|
+
"type": "address",
|
|
63
|
+
"internalType": "address"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"outputs": [
|
|
67
|
+
{
|
|
68
|
+
"name": "",
|
|
69
|
+
"type": "uint256",
|
|
70
|
+
"internalType": "uint256"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"stateMutability": "view"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"type": "function",
|
|
77
|
+
"name": "decimals",
|
|
78
|
+
"inputs": [],
|
|
79
|
+
"outputs": [
|
|
80
|
+
{
|
|
81
|
+
"name": "",
|
|
82
|
+
"type": "uint8",
|
|
83
|
+
"internalType": "uint8"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"stateMutability": "view"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"type": "function",
|
|
90
|
+
"name": "mint",
|
|
91
|
+
"inputs": [],
|
|
92
|
+
"outputs": [],
|
|
93
|
+
"stateMutability": "nonpayable"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"type": "function",
|
|
97
|
+
"name": "name",
|
|
98
|
+
"inputs": [],
|
|
99
|
+
"outputs": [
|
|
100
|
+
{
|
|
101
|
+
"name": "",
|
|
102
|
+
"type": "string",
|
|
103
|
+
"internalType": "string"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"stateMutability": "view"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"type": "function",
|
|
110
|
+
"name": "symbol",
|
|
111
|
+
"inputs": [],
|
|
112
|
+
"outputs": [
|
|
113
|
+
{
|
|
114
|
+
"name": "",
|
|
115
|
+
"type": "string",
|
|
116
|
+
"internalType": "string"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"stateMutability": "view"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"type": "function",
|
|
123
|
+
"name": "totalSupply",
|
|
124
|
+
"inputs": [],
|
|
125
|
+
"outputs": [
|
|
126
|
+
{
|
|
127
|
+
"name": "",
|
|
128
|
+
"type": "uint256",
|
|
129
|
+
"internalType": "uint256"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"stateMutability": "view"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"type": "function",
|
|
136
|
+
"name": "transfer",
|
|
137
|
+
"inputs": [
|
|
138
|
+
{
|
|
139
|
+
"name": "to",
|
|
140
|
+
"type": "address",
|
|
141
|
+
"internalType": "address"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "value",
|
|
145
|
+
"type": "uint256",
|
|
146
|
+
"internalType": "uint256"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"outputs": [
|
|
150
|
+
{
|
|
151
|
+
"name": "",
|
|
152
|
+
"type": "bool",
|
|
153
|
+
"internalType": "bool"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"stateMutability": "nonpayable"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"type": "function",
|
|
160
|
+
"name": "transferFrom",
|
|
161
|
+
"inputs": [
|
|
162
|
+
{
|
|
163
|
+
"name": "from",
|
|
164
|
+
"type": "address",
|
|
165
|
+
"internalType": "address"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "to",
|
|
169
|
+
"type": "address",
|
|
170
|
+
"internalType": "address"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "value",
|
|
174
|
+
"type": "uint256",
|
|
175
|
+
"internalType": "uint256"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"outputs": [
|
|
179
|
+
{
|
|
180
|
+
"name": "",
|
|
181
|
+
"type": "bool",
|
|
182
|
+
"internalType": "bool"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"stateMutability": "nonpayable"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"type": "event",
|
|
189
|
+
"name": "Approval",
|
|
190
|
+
"inputs": [
|
|
191
|
+
{
|
|
192
|
+
"name": "owner",
|
|
193
|
+
"type": "address",
|
|
194
|
+
"indexed": true,
|
|
195
|
+
"internalType": "address"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "spender",
|
|
199
|
+
"type": "address",
|
|
200
|
+
"indexed": true,
|
|
201
|
+
"internalType": "address"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"name": "value",
|
|
205
|
+
"type": "uint256",
|
|
206
|
+
"indexed": false,
|
|
207
|
+
"internalType": "uint256"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"anonymous": false
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"type": "event",
|
|
214
|
+
"name": "Transfer",
|
|
215
|
+
"inputs": [
|
|
216
|
+
{
|
|
217
|
+
"name": "from",
|
|
218
|
+
"type": "address",
|
|
219
|
+
"indexed": true,
|
|
220
|
+
"internalType": "address"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "to",
|
|
224
|
+
"type": "address",
|
|
225
|
+
"indexed": true,
|
|
226
|
+
"internalType": "address"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "value",
|
|
230
|
+
"type": "uint256",
|
|
231
|
+
"indexed": false,
|
|
232
|
+
"internalType": "uint256"
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
"anonymous": false
|
|
236
|
+
}
|
|
237
|
+
] as const satisfies Abi;
|
|
238
|
+
|
|
239
|
+
export const bytecode = "0x6080604052348015600e575f5ffd5b5061066f8061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061009b575f3560e01c8063313ce56711610063578063313ce5671461013657806370a082311461015057806395d89b411461016f578063a9059cbb14610191578063dd62ed3e146101a4575f5ffd5b806306fdde031461009f578063095ea7b3146100e05780631249c58b1461010357806318160ddd1461010d57806323b872dd14610123575b5f5ffd5b6100ca6040518060400160405280600c81526020016b20bb30a5b4ba102a37b5b2b760a11b81525081565b6040516100d791906103f4565b60405180910390f35b6100f36100ee366004610444565b6101ce565b60405190151581526020016100d7565b61010b61023a565b005b6101155f5481565b6040519081526020016100d7565b6100f361013136600461046c565b6102b2565b61013e601281565b60405160ff90911681526020016100d7565b61011561015e3660046104a6565b60016020525f908152604090205481565b6100ca604051806040016040528060038152602001621052d560ea1b81525081565b6100f361019f366004610444565b61037e565b6101156101b23660046104c6565b600260209081525f928352604080842090915290825290205481565b335f8181526002602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906102289086815260200190565b60405180910390a35060015b92915050565b5f6102476012600a6105ee565b6102529060646105fc565b9050805f5f8282546102649190610613565b9091555050335f818152600160209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a350565b6001600160a01b0383165f9081526002602090815260408083203384529091528120805483919083906102e6908490610626565b90915550506001600160a01b0384165f9081526001602052604081208054849290610312908490610626565b90915550506001600160a01b038084165f81815260016020526040908190208054860190555190918616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061036c9086815260200190565b60405180910390a35060019392505050565b335f9081526001602052604081208054839190839061039e908490610626565b90915550506001600160a01b0383165f81815260016020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906102289086815260200190565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b038116811461043f575f5ffd5b919050565b5f5f60408385031215610455575f5ffd5b61045e83610429565b946020939093013593505050565b5f5f5f6060848603121561047e575f5ffd5b61048784610429565b925061049560208501610429565b929592945050506040919091013590565b5f602082840312156104b6575f5ffd5b6104bf82610429565b9392505050565b5f5f604083850312156104d7575f5ffd5b6104e083610429565b91506104ee60208401610429565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156105465780850481111561052a5761052a6104f7565b600184161561053857908102905b60019390931c92800261050f565b935093915050565b5f8261055c57506001610234565b8161056857505f610234565b816001811461057e5760028114610588576105a4565b6001915050610234565b60ff841115610599576105996104f7565b50506001821b610234565b5060208310610133831016604e8410600b84101617156105c7575081810a610234565b6105d35f19848461050b565b805f19048211156105e6576105e66104f7565b029392505050565b5f6104bf60ff84168361054e565b8082028115828204841417610234576102346104f7565b80820180821115610234576102346104f7565b81810381811115610234576102346104f756fea26469706673582212203ba8f5901a64d91a7beec3bdc98521ea0a7279a4ebafb699842fb133050e658e64736f6c634300081c0033" as Hex;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# __PROJECT_NAME__
|
|
2
|
+
|
|
3
|
+
> An Avalanche ERC-20 dapp scaffolded with AvaKit. Deploy a token from the browser, mint, and transfer. Next.js + @avakit/react + shadcn/ui + Foundry.
|
|
4
|
+
|
|
5
|
+
## Project map
|
|
6
|
+
|
|
7
|
+
- [contracts/src/AvaKitToken.sol](contracts/src/AvaKitToken.sol): minimal self-contained ERC-20 (AKT, 18 decimals) with a `mint()` faucet.
|
|
8
|
+
- [lib/token-artifact.ts](lib/token-artifact.ts): compiled ABI + bytecode (browser deploy).
|
|
9
|
+
- [components/demo.tsx](components/demo.tsx): deploy → mint → transfer.
|
|
10
|
+
- [CLAUDE.md](CLAUDE.md): agent guide (API, decimals, contract workflow).
|
|
11
|
+
|
|
12
|
+
## Key APIs
|
|
13
|
+
|
|
14
|
+
- Deploy: `useAvaDeploy().deploy({ abi, bytecode })`
|
|
15
|
+
- Mint: `useContract({ address, abi }).write("mint", [])`
|
|
16
|
+
- Transfer: `.write("transfer", [to, parseUnits("10", 18)])`
|
|
17
|
+
- Read: `.read("balanceOf", [address])`, `.read("totalSupply")` — format with `formatUnits(v, 18)`
|
|
18
|
+
|
|
19
|
+
## Recompile
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
cd contracts && forge build
|
|
23
|
+
```
|
|
24
|
+
Then copy abi + bytecode.object from `out/AvaKitToken.sol/AvaKitToken.json` into `lib/token-artifact.ts`.
|
|
25
|
+
|
|
26
|
+
## External docs
|
|
27
|
+
|
|
28
|
+
- Avalanche Builder Hub: https://build.avax.network/llms.txt
|
|
29
|
+
- Fuji faucet: https://core.app/tools/testnet-faucet
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "next dev",
|
|
8
|
+
"build": "next build",
|
|
9
|
+
"start": "next start",
|
|
10
|
+
"typecheck": "tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@avakit/core": "__AVAKIT_DEP__",
|
|
14
|
+
"@avakit/react": "__AVAKIT_DEP__",
|
|
15
|
+
"lucide-react": "1.22.0",
|
|
16
|
+
"next": "16.2.9",
|
|
17
|
+
"next-themes": "0.4.6",
|
|
18
|
+
"react": "19.2.7",
|
|
19
|
+
"react-dom": "19.2.7",
|
|
20
|
+
"viem": "2.54.1"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@tailwindcss/postcss": "4.3.2",
|
|
24
|
+
"@types/node": "26.0.1",
|
|
25
|
+
"@types/react": "19.2.17",
|
|
26
|
+
"@types/react-dom": "19.2.3",
|
|
27
|
+
"postcss": "8.5.16",
|
|
28
|
+
"tailwindcss": "4.3.2",
|
|
29
|
+
"tw-animate-css": "1.4.0",
|
|
30
|
+
"typescript": "6.0.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "preserve",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [{ "name": "next" }],
|
|
17
|
+
"paths": {
|
|
18
|
+
"@/*": ["./*"]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
22
|
+
"exclude": ["node_modules"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# __PROJECT_NAME__ — Avalanche dapp (scaffolded with AvaKit)
|
|
2
|
+
|
|
3
|
+
Operational guide for AI agents (Claude Code / Cursor) working in this project.
|
|
4
|
+
|
|
5
|
+
## Stack
|
|
6
|
+
|
|
7
|
+
Next.js 16 (App Router) · React 19 · `@avakit/react` · `@avakit/core` · viem · shadcn/ui · next-themes
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
- `app/providers.tsx` — `<AvaKitProvider>` (chains + wallet adapters) + `ThemeProvider`
|
|
12
|
+
- `app/layout.tsx` — root layout, fonts, providers
|
|
13
|
+
- `components/demo.tsx` — wallet connect + balance + a sample transaction
|
|
14
|
+
- Wallet/chain config lives in `app/providers.tsx`
|
|
15
|
+
|
|
16
|
+
## Common tasks
|
|
17
|
+
|
|
18
|
+
- **Wallet button:** `<ConnectAvalanche />` (from `@avakit/react`)
|
|
19
|
+
- **Account:** `useAvaAccount()` → `{ address, isConnected }`
|
|
20
|
+
- **Balance:** `useBalance()` → `{ data, isLoading, refetch }`
|
|
21
|
+
- **Active chain:** `useAvaChain()` → `{ chain, chains, setChain }`
|
|
22
|
+
- **Contract read/write:** `useContract({ address, abi })`
|
|
23
|
+
- **Send a tx:** build a viem wallet client with `getWalletClient(chain, provider)` (provider from `useAvaKit()`)
|
|
24
|
+
|
|
25
|
+
## Rules
|
|
26
|
+
|
|
27
|
+
- UI uses **shadcn/ui only**. Components from `@avakit/react` are shadcn-styled; keep that consistency.
|
|
28
|
+
- **Black & white only** for now; dark/light is wired via `next-themes`. Don't add brand colors yet — edit the tokens in `app/globals.css` when you do.
|
|
29
|
+
- Animations: **Framer Motion** or **GSAP** only.
|
|
30
|
+
- Never hardcode RPC URLs or secrets; use the chain config and `.env.local`.
|
|
31
|
+
- Social login needs `NEXT_PUBLIC_WEB3AUTH_CLIENT_ID` in `.env.local` (free, from https://dashboard.web3auth.io). Without it, only the browser wallet shows.
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
- `pnpm dev` — start the dev server (http://localhost:3000)
|
|
36
|
+
- `pnpm build` — production build
|
|
37
|
+
- `pnpm typecheck` — TypeScript check
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# __PROJECT_NAME__
|
|
2
|
+
|
|
3
|
+
An Avalanche dapp scaffolded with [AvaKit](https://github.com/mericcintosun/AvaKit) — social-login onboarding, deploy-ready, black & white with dark/light from day one.
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. (social login, optional) add a free Web3Auth client ID
|
|
9
|
+
cp .env.example .env.local
|
|
10
|
+
# → get one at https://dashboard.web3auth.io (Sapphire Devnet, EVM)
|
|
11
|
+
|
|
12
|
+
# 2. run it
|
|
13
|
+
pnpm dev # http://localhost:3000
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then connect a wallet (social login or Core / MetaMask), read your balance, and send a first transaction on Avalanche Fuji.
|
|
17
|
+
|
|
18
|
+
> Need test AVAX? Use the in-app faucet link or https://core.app/tools/testnet-faucet.
|
|
19
|
+
|
|
20
|
+
## Stack
|
|
21
|
+
|
|
22
|
+
Next.js 16 · `@avakit/react` · `@avakit/core` · viem · shadcn/ui · next-themes
|
|
23
|
+
|
|
24
|
+
## Project layout
|
|
25
|
+
|
|
26
|
+
- `app/providers.tsx` — wallet + chain + theme providers
|
|
27
|
+
- `components/demo.tsx` — connect, balance, transaction
|
|
28
|
+
- `app/globals.css` — shadcn tokens (black & white)
|
|
29
|
+
|
|
30
|
+
## AI-native
|
|
31
|
+
|
|
32
|
+
This project ships with `CLAUDE.md`, `llms.txt`, and `.cursor/rules` so Claude Code / Cursor already understand AvaKit and the project conventions.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
/* Scan @avakit/react's shadcn-style classes from node_modules. */
|
|
5
|
+
@source "../node_modules/@avakit/react/dist";
|
|
6
|
+
|
|
7
|
+
@custom-variant dark (&:is(.dark *));
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Black & white only (oklch chroma 0 = pure grayscale). Dark/light wired from
|
|
11
|
+
* day one via next-themes. Add brand colors later by editing these tokens —
|
|
12
|
+
* components never hardcode colors.
|
|
13
|
+
*/
|
|
14
|
+
:root {
|
|
15
|
+
--radius: 0.625rem;
|
|
16
|
+
--background: oklch(1 0 0);
|
|
17
|
+
--foreground: oklch(0.145 0 0);
|
|
18
|
+
--card: oklch(1 0 0);
|
|
19
|
+
--card-foreground: oklch(0.145 0 0);
|
|
20
|
+
--popover: oklch(1 0 0);
|
|
21
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
22
|
+
--primary: oklch(0.205 0 0);
|
|
23
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
24
|
+
--secondary: oklch(0.97 0 0);
|
|
25
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
26
|
+
--muted: oklch(0.97 0 0);
|
|
27
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
28
|
+
--accent: oklch(0.97 0 0);
|
|
29
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
30
|
+
--destructive: oklch(0.3 0 0);
|
|
31
|
+
--destructive-foreground: oklch(0.985 0 0);
|
|
32
|
+
--border: oklch(0.922 0 0);
|
|
33
|
+
--input: oklch(0.922 0 0);
|
|
34
|
+
--ring: oklch(0.708 0 0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dark {
|
|
38
|
+
--background: oklch(0.145 0 0);
|
|
39
|
+
--foreground: oklch(0.985 0 0);
|
|
40
|
+
--card: oklch(0.205 0 0);
|
|
41
|
+
--card-foreground: oklch(0.985 0 0);
|
|
42
|
+
--popover: oklch(0.205 0 0);
|
|
43
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
44
|
+
--primary: oklch(0.985 0 0);
|
|
45
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
46
|
+
--secondary: oklch(0.269 0 0);
|
|
47
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
48
|
+
--muted: oklch(0.269 0 0);
|
|
49
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
50
|
+
--accent: oklch(0.269 0 0);
|
|
51
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
52
|
+
--destructive: oklch(0.7 0 0);
|
|
53
|
+
--destructive-foreground: oklch(0.205 0 0);
|
|
54
|
+
--border: oklch(1 0 0 / 10%);
|
|
55
|
+
--input: oklch(1 0 0 / 15%);
|
|
56
|
+
--ring: oklch(0.556 0 0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@theme inline {
|
|
60
|
+
--color-background: var(--background);
|
|
61
|
+
--color-foreground: var(--foreground);
|
|
62
|
+
--color-card: var(--card);
|
|
63
|
+
--color-card-foreground: var(--card-foreground);
|
|
64
|
+
--color-popover: var(--popover);
|
|
65
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
66
|
+
--color-primary: var(--primary);
|
|
67
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
68
|
+
--color-secondary: var(--secondary);
|
|
69
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
70
|
+
--color-muted: var(--muted);
|
|
71
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
72
|
+
--color-accent: var(--accent);
|
|
73
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
74
|
+
--color-destructive: var(--destructive);
|
|
75
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
76
|
+
--color-border: var(--border);
|
|
77
|
+
--color-input: var(--input);
|
|
78
|
+
--color-ring: var(--ring);
|
|
79
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
80
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
81
|
+
--radius-lg: var(--radius);
|
|
82
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
83
|
+
--font-sans: var(--font-geist-sans);
|
|
84
|
+
--font-mono: var(--font-geist-mono);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@layer base {
|
|
88
|
+
* {
|
|
89
|
+
border-color: var(--border);
|
|
90
|
+
}
|
|
91
|
+
body {
|
|
92
|
+
background-color: var(--background);
|
|
93
|
+
color: var(--foreground);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import { Geist, Geist_Mono } from "next/font/google";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import { Providers } from "./providers";
|
|
5
|
+
import "./globals.css";
|
|
6
|
+
|
|
7
|
+
const geistSans = Geist({ variable: "--font-geist-sans", subsets: ["latin"] });
|
|
8
|
+
const geistMono = Geist_Mono({ variable: "--font-geist-mono", subsets: ["latin"] });
|
|
9
|
+
|
|
10
|
+
export const metadata: Metadata = {
|
|
11
|
+
title: "__PROJECT_NAME__",
|
|
12
|
+
description: "An Avalanche dapp scaffolded with AvaKit.",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default function RootLayout({ children }: Readonly<{ children: ReactNode }>) {
|
|
16
|
+
return (
|
|
17
|
+
<html lang="en" suppressHydrationWarning>
|
|
18
|
+
<body className={`${geistSans.variable} ${geistMono.variable} font-sans antialiased`}>
|
|
19
|
+
<Providers>{children}</Providers>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { type WalletAdapter, injectedAdapter } from "@avakit/core";
|
|
4
|
+
import { __CHAIN_CONST__ } from "@avakit/core/chains";
|
|
5
|
+
import { web3authAdapter } from "@avakit/core/web3auth";
|
|
6
|
+
import { AvaKitProvider } from "@avakit/react";
|
|
7
|
+
import { ThemeProvider } from "next-themes";
|
|
8
|
+
import { type ReactNode, useMemo } from "react";
|
|
9
|
+
|
|
10
|
+
export function Providers({ children }: { children: ReactNode }) {
|
|
11
|
+
const adapters = useMemo(() => {
|
|
12
|
+
const list: WalletAdapter[] = [];
|
|
13
|
+
// Social login appears only when a Web3Auth client ID is configured.
|
|
14
|
+
const clientId = process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID;
|
|
15
|
+
if (clientId) {
|
|
16
|
+
list.push(web3authAdapter({ clientId }));
|
|
17
|
+
}
|
|
18
|
+
// Injected (Core / MetaMask) is always available.
|
|
19
|
+
list.push(injectedAdapter());
|
|
20
|
+
return list;
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
|
|
25
|
+
<AvaKitProvider chains={[__CHAIN_CONST__]} adapters={adapters}>
|
|
26
|
+
{children}
|
|
27
|
+
</AvaKitProvider>
|
|
28
|
+
</ThemeProvider>
|
|
29
|
+
);
|
|
30
|
+
}
|