@@ -31,8 +31,8 @@ bun run build:watch:packages # Watch mode for packages only
3131
3232# Code Generation
3333bun run codegen # Run code generation for all clients
34- bunx coda generate # Generate client with Coda CLI
35- bunx coda init # Initialize coda.config.mjs
34+ coda generate # Generate client with Coda CLI
35+ coda init # Initialize coda.config.mjs
3636
3737# Code Quality
3838bun run lint # Run biome check + eslint
8888### 4. ** @macalinao/clients-token-metadata **
8989 - Pre-generated client for Metaplex Token Metadata program
9090 - Includes custom PDAs and type definitions
91- - Ready-to-use with ` @solana/web3.js `
91+ - Ready-to-use TypeScript client
9292
9393## How Coda Works
9494
@@ -100,12 +100,15 @@ coda/
100100
101101## Configuration (coda.config.mjs)
102102
103+ ### Single IDL Configuration
104+ For projects with a single program (like [ token-metadata] ( https://github.com/macalinao/coda/tree/master/clients/token-metadata ) ):
105+
103106``` javascript
104107import { defineConfig } from " @macalinao/coda" ;
105108import { addPdasVisitor } from " codama" ;
106109
107110export default defineConfig ({
108- // Optional: Custom paths
111+ // Optional: Custom path for single IDL
109112 idlPath: " ./idls/my_program.json" ,
110113 outputDir: " ./src/generated" ,
111114
@@ -118,6 +121,31 @@ export default defineConfig({
118121});
119122```
120123
124+ ### Multiple IDL Configuration
125+ For projects with multiple programs (like [ quarry] ( https://github.com/macalinao/coda/tree/master/clients/quarry ) ):
126+
127+ ``` javascript
128+ import { defineConfig } from " @macalinao/coda" ;
129+
130+ export default defineConfig ({
131+ // Array of IDL paths for multiple programs
132+ idlPath: [
133+ " ./idls/quarry_mine.json" ,
134+ " ./idls/quarry_mint_wrapper.json" ,
135+ " ./idls/quarry_operator.json" ,
136+ " ./idls/quarry_merge_mine.json" ,
137+ " ./idls/quarry_redeemer.json" ,
138+ " ./idls/quarry_registry.json" ,
139+ ],
140+ outputDir: " ./src/generated" ,
141+
142+ // Optional: Add PDAs and other visitors for each program
143+ visitors: [
144+ // Custom visitors for each program
145+ ]
146+ });
147+ ```
148+
121149## Code Style Guidelines
122150
123151### TypeScript
@@ -207,9 +235,7 @@ Generated clients provide:
207235Example usage:
208236``` typescript
209237import { createTransferInstruction } from " ./generated" ;
210- import { createSolanaRpc } from " @solana/web3.js" ;
211238
212- const rpc = createSolanaRpc (" https://api.mainnet-beta.solana.com" );
213239const instruction = createTransferInstruction ({
214240 source: sourceAddress ,
215241 destination: destAddress ,
@@ -218,6 +244,40 @@ const instruction = createTransferInstruction({
218244});
219245```
220246
247+ ## Documentation Guidelines
248+
249+ ### Writing Good Documentation
250+
251+ When writing documentation for Coda or generated clients:
252+
253+ 1 . ** Command Examples** :
254+ - Always show direct command usage: ` coda generate ` , not ` bunx coda generate ` or ` npx coda `
255+ - Assume users have installed the package globally or are using it directly
256+ - Show the simplest path to success
257+
258+ 2 . ** Code Examples** :
259+ - Provide complete, runnable examples
260+ - Show imports clearly at the top
261+ - Use TypeScript for all examples
262+ - Include types where helpful for clarity
263+
264+ 3 . ** Structure** :
265+ - Start with the most common use case
266+ - Progress from simple to complex
267+ - Link to relevant examples in the repository
268+ - Use clear headings and subheadings
269+
270+ 4 . ** Best Practices** :
271+ - Explain the "why" not just the "how"
272+ - Include error messages users might see
273+ - Provide solutions to common problems
274+ - Keep examples concise but complete
275+
276+ 5 . ** Links and References** :
277+ - Link to example repositories (e.g., token-metadata for single IDL, quarry for multiple IDLs)
278+ - Reference the official Codama documentation where appropriate
279+ - Include links to Anchor documentation for IDL-related topics
280+
221281## Troubleshooting
222282
223283### Common Issues
0 commit comments