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
This is mostly the same documentation, just reorganized:
- Add a section for impatient Anchor developers
- Focus on creating IDL and then generating clients from the IDL, without first needing to understand design patterns and architecture.
- Use plainer language, eg 'create Clients' over 'render' etc.
> Wait, wasn't this called Kinobi before? It was! We've renamed this project **Codama**. [Check out this PR](https://github.com/codama-idl/codama/pull/234) for more details.
14
+
> Wait, wasn't this project called Kinobi before? We've [renamed this project to **Codama**](https://github.com/codama-idl/codama/pull/234).
15
15
16
-
Codama is a tool that describes any Solana program in a powerful standardised format known as the Codama IDL. This IDL can then be used to create a variety of utility such as rendering client code for your programs in various languages/frameworks, generating CLIs and providing more information to explorers.
16
+
Codama is a tool that describes any Solana program in a standardised format called a **Codama IDL**.
17
+
18
+
A Codama IDL can be used to:
19
+
20
+
- Create clients for your programs in various languages/frameworks
21
+
- Make CLIs
22
+
- Provide additional information to explorers
17
23
18
24

19
25
20
-
## Nodes and visitors
26
+
## I'm a busy Anchor developer. How do I use Codama?
21
27
22
-
The Codama IDL is designed as a tree of nodes starting with the `RootNode` which contains a `ProgramNode` and additional data such as the Codama version used when the IDL was created. Codama provides over 60 different types of nodes that help describe just about any aspect of your Solana programs. [You can read more about the Codama nodes here](./packages/nodes).
28
+
If you're using [Anchor](https://www.anchor-lang.com/), Codama can be used to create a TypeScript client that works with [Solana Kit](https://github.com/anza-xyz/kit). This combination replaces the traditional `@coral-xyz/anchor` and `@solana/web3.js` packages, and can be used in both TypeScript tests, and the browser.
23
29
24
-

30
+
- The `programClient` created by Codama will be used to create instructions for your Anchor program, and decode your Anchor program's data accounts.
31
+
-[`@solana/kit`](https://github.com/anza-xyz/kit) will be used to connect to the network, send transactions, and do most tasks that aren't specific to your program.
32
+
-[`@solana/react`](https://github.com/anza-xyz/kit/tree/main/packages/react) will be used to connect to Solana wallet apps like Phantom, Solflare, etc. in React.
25
33
26
-
Because everything is designed as a `Node`, we can transform the IDL, aggregate information and output various utility tools using special objects that can traverse node trees known as visitors. [See this documentation to learn more about Codama visitors](./packages/visitors).
34
+
This Codama README shows you how to create the TypeScript client for your Anchor program, but if you're interested in the bigger picture, see QuickNode's video on [Anchor and Solana Kit](https://www.youtube.com/watch?v=2T3DOMv7iR4).
27
35
28
-

There are various ways to extract information from your Solana programs in order to obtain a Codama IDL.
44
+
### Creating a Codama IDL for your Solana Program
33
45
34
-
-**Using Codama macros**. This is not yet available but you will soon have access to a set of Rust macros that help attach IDL information directly within your Rust code. These macros enable Codama IDLs to be generated whenever you build your programs.
35
-
-**From Anchor IDLs**. If you are using [Anchor programs](https://github.com/coral-xyz/anchor) or [Shank macros](https://github.com/metaplex-foundation/shank), then you can get an Anchor IDL from them. You can then use the `@codama/nodes-from-anchor` package to convert that IDL into a Codama IDL as shown in the code snippet below. Note that the Anchor IDL might not offer all the information that Codama can hold and therefore, you may want to transform your Codama IDL to provide additional information. You can learn more about this in the next section.
46
+
There are various ways to get a Codama IDL from your Solana program:
47
+
48
+
-**From an Anchor IDL**. If you are using [Anchor programs](https://github.com/coral-xyz/anchor) or [Shank macros](https://github.com/metaplex-foundation/shank), then you can get an Anchor IDL from them. You can then use the `@codama/nodes-from-anchor` package to convert that IDL into a Codama IDL as shown in the code snippet below. Note that the Anchor IDL might not offer all the information that Codama can hold, and therefore, you may want to transform your Codama IDL to provide additional information. You can learn more about this in the next section.
36
49
37
50
```ts
38
51
import { createFromRoot } from'codama';
@@ -42,41 +55,57 @@ There are various ways to extract information from your Solana programs in order
-**Byhand**. IfyourSolanaprogramcannotbeupdatedtouseCodamamacrosandyoudon't have an Anchor IDL, you can design your Codama IDL manually. We may provide tools such as a Codama Playground to help with that in the future.
>Somefeatures, suchasrenderingCLIs, arenotyetavailable. However, becauseofCodama's design, these features are only [a visitor away](#codama-architecture) from being ready. Feel free to reach out if you'dliketocontributetotheCodamaecosystem!
PerhapsthemostsignificantbenefitofhavingaCodamaIDLfromyourprogramisthatyoucanshareitonchainwiththerestoftheecosystem. Thismeansexplorersmaynowusethisinformationtoprovideabetterexperienceforusersofyourprograms. Additionally, anyonecannowgrabyourCodamaIDL, selecttheportiontheyareinterestedinandbenefitfromthesameecosystemofCodamavisitorstoiterateoverit. Forinstance, anappcoulddecidetograbtheIDLsofallprogramsitdependson, filterouttheaccountsandinstructionstheappdoesn't need, and generate a bespoke client for their app that only contains the functions the app needs.
61
90
62
-
_NotethatsomefeaturessuchasrenderingCLIsarenotyetavailable. However, becausetheCodamaIDLisdesignedasatreeofnodes, thesefeaturesareonlyavisitorawayfrombeingready. Feelfreetoreachoutifyou’dliketocontributetothisCodamaecosystem._
0 commit comments