Skip to content

Commit 73a3245

Browse files
committed
doc: update README, add instruction for pre-commit hook
1 parent 2ec2ace commit 73a3245

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Process specific updates:
2626
Collect and report on pipeline performance and operational data.
2727

2828
Our premade metrics crates assist with common use cases:
29+
2930
| Crate Name | Description | Ease of Setup |
3031
| --------------------------- | ----------------------------------------------------------------------------- | ------------- |
3132
| `carbon-log-metrics` | Logs useful program info to the terminal | Easy |
@@ -93,7 +94,7 @@ sudo mv carbon-cli-macos-amd64 /usr/local/bin/carbon-cli
9394

9495
##### Windows
9596

96-
1. Download the latest release from https://github.com/sevenlabs-hq/carbon/releases/latest/download/carbon-cli-windows-amd64.exe
97+
1. Download the latest release from <https://github.com/sevenlabs-hq/carbon/releases/latest/download/carbon-cli-windows-amd64.exe>
9798
2. Rename the downloaded file to `carbon-cli.exe`
9899
3. Move the file to a directory in your PATH
99100

@@ -106,7 +107,7 @@ cargo install --git https://github.com/sevenlabs-hq/carbon.git carbon-cli
106107
#### CLI Usage
107108

108109
```sh
109-
$ carbon-cli parse [OPTIONS] --idl <IDL> --output <OUTPUT>
110+
carbon-cli parse [OPTIONS] --idl <IDL> --output <OUTPUT>
110111
```
111112

112113
#### Options
@@ -126,7 +127,7 @@ $ carbon-cli parse [OPTIONS] --idl <IDL> --output <OUTPUT>
126127
1. To generate a decoder from an Anchor IDL file:
127128

128129
```sh
129-
$ carbon-cli parse --idl my_program.json --output ./src/decoders
130+
carbon-cli parse --idl my_program.json --output ./src/decoders
130131
```
131132

132133
or with interactive mode:
@@ -138,29 +139,29 @@ This will parse the my_program.json Anchor IDL file and generate the correspondi
138139
2. To generate a decoder from an Anchor PDA IDL, specify a program address (Meteora DLMM program in this case):
139140

140141
```sh
141-
$ carbon-cli parse --idl LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo -u mainnet-beta --output ./src/decoders
142+
carbon-cli parse --idl LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo -u mainnet-beta --output ./src/decoders
142143
```
143144

144145
This will fetch Meteora DLMM program's IDL from chain and generate the corresponding decoder code in the ./src/decoders directory.
145146

146147
3. To generate a decoder from a Codama IDL:
147148

148149
```sh
149-
$ carbon-cli parse --idl my_program_codama.json --output ./src/decoders --standard codama
150+
carbon-cli parse --idl my_program_codama.json --output ./src/decoders --standard codama
150151
```
151152

152153
This will parse the my_program_codama.json Codama IDL file and generate the corresponding decoder code in the ./src/decoders directory.
153154

154155
**Note**: in order to parse CPI Events for a provided Codama IDL, add `--event-hints` option with comma-separated names of corresponding defined Codama types:
155156

156157
```sh
157-
$ carbon-cli parse --idl my_program_codama.json --output ./src/decoders --standard codama --event-hints event1,event2,event3
158+
carbon-cli parse --idl my_program_codama.json --output ./src/decoders --standard codama --event-hints event1,event2,event3
158159
```
159160

160161
##### Scaffold Project
161162

162163
```sh
163-
$ carbon-cli scaffold --name degen-paradize --output ./desired-folder --decoders pumpfun,moonshot,raydium-amm-v4 --data-source yellowstone-grpc
164+
carbon-cli scaffold --name degen-paradize --output ./desired-folder --decoders pumpfun,moonshot,raydium-amm-v4 --data-source yellowstone-grpc
164165
```
165166

166167
or with interactive mode:
@@ -192,6 +193,7 @@ impl Processor for MyAccountProcessor {
192193
### Implementing a Datasource
193194

194195
For most use cases, we recommend choosing from one of our datasource crates:
196+
195197
| Crate Name | Description | Affordability | Ease of Setup |
196198
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------- | --------------------------- | ------------- |
197199
| `carbon-block-subscribe` | Uses `blockSubscribe` with Solana WS JSON RPC to listen to real-time on-chain transactions | Cheap (just RPC) | Easy |
@@ -277,6 +279,19 @@ Decoders for most popular Solana programs are published and maintained:
277279
| `carbon-virtuals-decoder` | Virtuals Program Decoder | 5U3EU2ubXtK84QcRjWVmYt9RaDyA8gKxdUrPFXmZyaki |
278280
| `carbon-zeta-decoder` | Zeta Program Decoder | ZETAxsqBRek56DhiGXrn75yj2NHU3aYUnxvHXpkf3aD |
279281

282+
## Pre-commit hooks
283+
284+
To activate the pre-commit hook, run `./.pre-commit.sh` once.
285+
This will cause the following rules to be registered and called at the next `git commit`.
286+
287+
The following checks will be performed:
288+
289+
- fmt: Checks code formatting using `cargo fmt --check`.
290+
- clippy: Runs `clippy` on the codebase to catch potential issues.
291+
- typos: Uses the `typos` tool to check for typos in specific directories.
292+
- cargo_sort: Utilizes `cargo-sort` to ensure Cargo.toml files are sorted correctly.
293+
- machete: Checks for unused Cargo dependencies using `cargo-machete`.
294+
280295
## Test
281296

282297
```sh

0 commit comments

Comments
 (0)