Skip to content

Commit 43b31d8

Browse files
committed
refactor: relocate to mucho
1 parent 07f7df3 commit 43b31d8

34 files changed

+62
-3587
lines changed

README.md

Lines changed: 9 additions & 311 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
# Solana Node CLI
22

3-
This is the `solana`, a command-line tool designed to simplify the development
4-
and testing of Solana blockchain programs. The tool provides an array of
5-
commands to manage Solana Toolkit installations, clone and manage blockchain
6-
fixtures (accounts, programs, etc), and simplifying the experience of running a
7-
local test-validator with all the required state for a consistent development
8-
experience.
9-
10-
**System Requirements:**
11-
12-
- NodeJS (version >= 22)
3+
The Solana Node CLI is meant to be a generic utilitarian helper CLI to
4+
accomplish some basic setup and troubleshooting for Solana development.
135

146
**Usage:**
157

@@ -20,17 +12,14 @@ npx solana --help
2012
This tool is not recommended to be installed as a global npm package on your
2113
system. If installed globally, unexpected behavior may occur.
2214

15+
**System Requirements:**
16+
17+
- NodeJS (version >= 22)
18+
2319
## Commands
2420

2521
- [`install`](#install) - Install and manage the Solana Toolkit's local
2622
development tooling on your system.
27-
- [`clone`](#clone) - Clone accounts and programs (aka fixtures) from any Solana
28-
cluster desired and declared in the `Solana.toml`.
29-
- [`test-validator`](#test-validator) - Run the Solana test-validator on your
30-
local machine, including loading all the cloned fixtures for your repo.
31-
- [`build`](#build) - Build all or a single Solana program in your workspace.
32-
- [`deploy`](#deploy) - Deploy a Solana program in your workspace.
33-
- [`coverage`](#coverage) - Run code coverage tests on a Solana program.
3423

3524
### install
3625

@@ -50,6 +39,9 @@ The Solana Toolkit includes the following tools:
5039
- [Agave CLI tool suite](https://solana.com/docs/intro/installation#install-the-solana-cli) -
5140
the standard tool suite required to build and deploy Solana programs (formerly
5241
known as the "Solana CLI tool suite").
42+
- [Mucho CLI](https://github.com/solana-developers/mucho) - a superset of
43+
popular developer tools within the Solana ecosystem used to simplify the
44+
development and testing of Solana blockchain programs.
5345
- [solana-verify](https://github.com/Ellipsis-Labs/solana-verifiable-build) - A
5446
command line tool to build and verify Solana programs.
5547
- [Anchor and AVM](https://www.anchor-lang.com/docs/installation#installing-using-anchor-version-manager-avm-recommended) -
@@ -60,297 +52,3 @@ The Solana Toolkit includes the following tools:
6052
framework for Solana programs to help you ship secure code.
6153
- [Zest](https://github.com/LimeChain/zest?tab=readme-ov-file) - Code coverage
6254
CLI tool for Solana programs.
63-
64-
### clone
65-
66-
Clone all the fixtures (accounts and programs) utilizing your `Solana.toml`
67-
file.
68-
69-
**Usage:**
70-
71-
```shell
72-
npx solana clone --help
73-
```
74-
75-
The default behavior for fixture cloning is as follows:
76-
77-
- All cloned fixtures are stored in the `fixtures` directory, unless overriden
78-
by your Solana.toml's `settings.accountDir`.
79-
- All fixtures are cloned from Solana's mainnet cluster or the declared
80-
`settings.cluster` in Solana.toml.
81-
- All fixtures are cloned from the same cluster, unless individually overriden.
82-
- If any fixtures already exist, they are skipped from cloning.
83-
- If a Solana account is cloned, the `owner` program will automatically be
84-
cloned from the same cluster, unless the program is explicitly declared in the
85-
Solana.toml.
86-
87-
To override the default cloning behavior for any fixture, declare the desired
88-
override setting in your Solana.toml file. Some of the supported overrides
89-
include:
90-
91-
- `cluster` - Desired cluster to clone the particular fixture from.
92-
- `frequency` - Desired clone frequency when performing the clone operation.
93-
- Each fixture type (account, program, etc) may support other specific
94-
overrides.
95-
96-
See the Solana.toml's [clone configuration](#clone-configuration) for details
97-
about all options.
98-
99-
> The cloned fixtures are recommended to be version controlled via git in order
100-
> to facilitate a consistent local Solana ledger (via
101-
> [`text-validator`](#test-validator)) and therefore reproducible and testable
102-
> blockchain state for anyone with access to the repo.
103-
104-
### build
105-
106-
Build all or a single Solana program in your workspace.
107-
108-
**Usage:**
109-
110-
```shell
111-
npx solana build --help
112-
```
113-
114-
### deploy
115-
116-
Deploy a Solana program in your workspace.
117-
118-
**Usage:**
119-
120-
```shell
121-
npx solana deploy --help
122-
```
123-
124-
The default behavior for deploying is as follows:
125-
126-
- The `deploy` command will default to your Solana CLI declared cluster, unless
127-
overriden with the `-u, --url` flag.
128-
129-
### test-validator
130-
131-
Run the Solana test-validator on your local machine, including loading all the
132-
cloned fixtures for your repo.
133-
134-
**Usage:**
135-
136-
```shell
137-
npx solana test-validator --help
138-
```
139-
140-
> Under the hood, the `test-validator` commands wraps the Agave tool suite's
141-
> `solana-test-validator` command but also helps provide additional quality of
142-
> life improvements for Solana developers. To view the generated
143-
> `solana-test-validator` wrapper command, run
144-
> `npx solana test-validator --output-only`.
145-
146-
The default behavior for running the `test-validator` is as follows:
147-
148-
- If the ledger does not already exist, or when resetting the ledger via the
149-
`--reset` flag, all the currently cloned fixtures will be loaded into the
150-
validator at genesis.
151-
- All programs declared in your Solana.toml's `programs.localnet` declaration
152-
will be loaded into the validator at genesis.
153-
- All loaded programs will have their upgrade authority set to your local
154-
keypair's address (via `settings.keypair`).
155-
156-
### coverage
157-
158-
Run code coverage tests on a Solana program, powered by the
159-
[Zest CLI](https://github.com/LimeChain/zest?tab=readme-ov-file).
160-
161-
**Usage:**
162-
163-
```shell
164-
npx solana coverage --help
165-
```
166-
167-
To pass additional arguments to the Zest CLI, append them at the end of this
168-
tool's command starting with `--`. For example, to run the Zest CLI's help
169-
command:
170-
171-
```shell
172-
npx solana coverage -- --help
173-
```
174-
175-
## Solana.toml
176-
177-
The `Solana.toml` file is a framework agnostic manifest file containing metadata
178-
and configuration settings to enable developers to more easily manage their
179-
Solana program development processes.
180-
181-
The `Solana.toml` file is expected to be stored in the root a repo and committed
182-
to git.
183-
184-
You can find an [example Solana.toml file](./tests/Solana.toml) here.
185-
186-
### `settings` configuration
187-
188-
Declare general defaults and configuration settings for use in various places.
189-
190-
- `cluster` - Desired cluster to clone all fixtures from (if not individually
191-
overriden per fixture). If not defined, defaults to Solana's mainnet.
192-
- Type: `enum`
193-
- Default: `mainnet`
194-
- Values: `mainnet`, `devnet`, or `testnet`
195-
- `accountDir` - Path to store cloned fixtures (accounts and programs)
196-
- Type: `string`
197-
- Default: `fixtures`
198-
- `keypair` - Path to the default local keypair file to use in various places
199-
(i.e. set as the upgrade authority for all cloned programs when running
200-
`test-validator`)
201-
- Type: `string`
202-
- Default: `~/.config/solana/id.json` (same as the Agave CLI tool suite)
203-
204-
```toml
205-
[settings]
206-
accountDir = "fixtures" # default="fixtures"
207-
# accountDir = ".cache/accounts" # default="fixtures"
208-
209-
cluster = "mainnet" # default="mainnet"
210-
# cluster = "devnet"
211-
# cluster = "testnet"
212-
213-
# keypair = "any/local/path" # default="~/.config/solana/id.json"
214-
```
215-
216-
### `programs` configuration
217-
218-
The addresses of the programs in the workspace.
219-
220-
```toml
221-
[programs.localnet]
222-
counter = "AgVqLc7bKvnLL6TQnBMsMAkT18LixiW9isEb21q1HWUR"
223-
[programs.devnet]
224-
counter = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
225-
[programs.testnet]
226-
counter = "BmDHboaj1kBUoinJKKSRqKfMeRKJqQqEbUj1VgzeQe4A"
227-
[programs.mainnet]
228-
counter = "AgVqLc7bKvnLL6TQnBMsMAkT18LixiW9isEb21q1HWUR"
229-
```
230-
231-
These addresses will be used to load programs using the `test-validator` at
232-
genesis.
233-
234-
### `clone` configuration
235-
236-
The Solana.toml's `clone` configuration settings are used to provide a framework
237-
agnostic, consistent, and declarative way to clone data from the Solana
238-
blockchain for use in local development and testing. Including more fine grain
239-
control and quality of life improvements for Solana developers.
240-
241-
The cloned data (accounts, programs, etc) are referred to as "fixtures".
242-
243-
Each fixture type may support specific configuration settings and the following
244-
individual overrides via their Solana.toml declaration:
245-
246-
- `cluster` - Desired cluster to clone the particular fixture from. If not
247-
declared, defaults to [`settings.cluster`](#settings-configuration).
248-
- `frequency` - Desired clone frequency when performing the clone operation.
249-
- Type: `enum`
250-
- Values:
251-
- `cached` - (default) Only clone the fixture if it does not already exist
252-
locally.
253-
- `always` - Every time a clone operation is performed, this specific
254-
fixture will always be forced cloned from the cluster.
255-
256-
#### `clone.account`
257-
258-
To clone any account from a Solana cluster, use the `clone.account.<name>`
259-
declaration.
260-
261-
Cloned accounts are stored as `json` files in the repo's
262-
[`settings.accountDir`](#settings-configuration) directory.
263-
264-
When account cloning occurs, the account's `owner` program will be automatically
265-
cloned from the same cluster and with the frequency. This helps ensure the
266-
cloned/stored account fixture will have the same program that knows its data
267-
structure and enables developers to correctly interact with the account while
268-
running their local test validator.
269-
270-
**Usage:**
271-
272-
```toml filename="Solana.toml"
273-
[clone.account.wallet]
274-
# this is a random wallet account, owned by system program
275-
address = "GQuioVe2yA6KZfstgmirAvugfUZBcdxSi7sHK7JGk3gk"
276-
# override the cluster for a particular account, if not defined: uses `settings.cluster`
277-
cluster = "devnet"
278-
frequency = "always"
279-
280-
[clone.account.bonk]
281-
# BONK mint address
282-
address = "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"
283-
cluster = "mainnet"
284-
285-
[clone.account.tm-rando]
286-
# random metaplex token metadata account
287-
address = "5uZQ4GExZXwwKRNmpxwxTW2ZbHxh8KjDDwKne7Whqm4H"
288-
# this account is owned by: metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s
289-
# and will be auto clone the program without needing to declare it anywhere
290-
```
291-
292-
The example above will clone the 3 accounts from the network(s) and the owner
293-
program for the `5uZQ4GExZXwwKRNmpxwxTW2ZbHxh8KjDDwKne7Whqm4H` account (which
294-
happens to be `metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s`).
295-
296-
#### `clone.program`
297-
298-
To clone any program from a Solana cluster, use the `clone.program.<name>`
299-
declaration.
300-
301-
Cloned accounts are stored as `so` binary files in the repo's
302-
[`settings.accountDir`](#settings-configuration) directory.
303-
304-
```toml filename="Solana.toml"
305-
[clone.program.bubblegum]
306-
address = "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"
307-
cluster = "mainnet"
308-
# if you want to always force clone the account
309-
# frequency = "always"
310-
311-
[clone.program.tm-metadata]
312-
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
313-
# `cluster` is not defined => fallback to `settings.cluster`
314-
# `frequency` is not defined => will only clone if the program binary is missing locally
315-
```
316-
317-
## Anchor Compatibility
318-
319-
This tool may support similar functionality and configuration enabled via the
320-
`Anchor.toml` file. If an Anchor.toml file is detected, this tool will make a
321-
best attempt to process the Anchor.toml file's configuration for functionality
322-
that this tool supports.
323-
324-
The `Solana.toml` settings will normally take priority over the `Anchor.toml`
325-
file's configuration.
326-
327-
The following Anchor.toml configuration settings are supported:
328-
329-
- `[programs.<network>]` - Anchor's CLI requires the program address to be
330-
declared for each respective cluster. This tool will use the Anchor.toml
331-
declared program ids for each program and cluster defined, unless the same
332-
address is declared in the Solana.toml.
333-
- `[[test.validator.clone]]` - The program `address` listed will be cloned using
334-
the Anchor.toml declared `test.validator.url` value as the cluster, unless the
335-
same address is declared in the Solana.toml.
336-
- `[[test.validator.account]]` - The account `address` listed will be cloned
337-
using the Anchor.toml declared `test.validator.url` value as the cluster,
338-
unless the same address is declared in the Solana.toml. No matter the cluster,
339-
the account's `owner` program will automatically be cloned from that same
340-
cluster.
341-
342-
Some general difference between how Anchor may handle similar functionality that
343-
this tool supports include:
344-
345-
- Cloned accounts/programs into the repo - This tool [clones accounts](#clone)
346-
and programs into the repo and expects these fixtures to be committed to git.
347-
Accounts are stored as `.json` files and programs as `.so` binary files.
348-
- Clone cache - Cloned fixtures are cached by default (in the repo), helping to
349-
reduce the load on RPC providers. This also helps developers working on the
350-
same source repository to have a consistent ledger state when performing local
351-
development and testing via [`test-validator`](#test-validator).
352-
- Mix-and-match cloning - This tool allows more
353-
[fine grain control](#cloneaccount) over which cluster any specific
354-
account/program gets cloned from. For example, if you want `account1` to come
355-
from mainnet and `account2` to come from devnet, you can easily accomplish
356-
this via Solana.toml.

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
"@commander-js/extra-typings": "^12.1.0",
3131
"@iarna/toml": "^2.2.5",
3232
"@inquirer/prompts": "^7.0.0",
33-
"@solana/buffer-layout": "^4.0.1",
34-
"@solana/buffer-layout-utils": "^0.2.0",
35-
"@solana/spl-token": "^0.4.9",
36-
"@solana/web3.js": "^1.95.3",
3733
"commander": "^12.1.0",
3834
"dotenv": "^16.4.5",
3935
"inquirer": "^12.0.0",

0 commit comments

Comments
 (0)