Quasar
References

CLI Reference

Reference for the Quasar command-line interface.

The quasar CLI builds, tests, profiles, and deploys Solana programs. It wraps the Solana/Upstream toolchain and manages IDL generation and sBPF disassembly.

Install

cargo install quasar-cli

Commands

quasar init

Scaffold a new Quasar project.

quasar init [NAME] [OPTIONS]

With a name, uses saved defaults and skips prompts. Without a name, launches an interactive wizard.

FlagDescription
NAMEProject name (becomes crate name and Quasar.toml project name). Use . to scaffold into the current directory.
-y, --yesSkip prompts and use saved defaults
--no-gitSkip git init
--framework <FRAMEWORK>Testing framework: none, mollusk, quasarsvm-rust, quasarsvm-web3js, quasarsvm-kit
--template <TEMPLATE>Project template: minimal (single instruction) or full (state, events, instruction files)
--toolchain <TOOLCHAIN>Build toolchain: solana or upstream

Generates a project with Cargo.toml, Quasar.toml, source files, test scaffolding, program keypair, and git setup. Preferences are saved to ~/.quasar/config.toml.

Examples:

quasar init                        # Interactive wizard
quasar init my-program             # Use saved defaults, no prompts
quasar init . --toolchain upstream # Scaffold into current directory
quasar init my-app --framework mollusk --template full

quasar new instruction

Generate a new instruction handler with auto-incremented discriminator.

quasar new instruction <NAME>
ArgumentDescription
NAMEInstruction name in snake_case (e.g., transfer, create_pool)

This command:

  1. Creates src/instructions/<name>.rs with an Accounts struct and handler method
  2. Adds mod <name>; and pub use <name>::*; to src/instructions/mod.rs
  3. Inserts a new #[instruction(discriminator = N)] entry in src/lib.rs with N set to one more than the highest existing discriminator

Example:

quasar new instruction withdraw

Creates src/instructions/withdraw.rs:

use quasar_lang::prelude::*;

#[derive(Accounts)]
pub struct Withdraw<'info> {
    pub payer: &'info mut Signer,
    pub system_program: &'info Program<System>,
}

impl<'info> Withdraw<'info> {
    #[inline(always)]
    pub fn withdraw(&self) -> Result<(), ProgramError> {
        Ok(())
    }
}

And adds to src/lib.rs:

#[instruction(discriminator = 2)]  // auto-incremented
pub fn withdraw(ctx: Ctx<Withdraw>) -> Result<(), ProgramError> {
    ctx.accounts.withdraw()
}

quasar build

Compile the program. Reads Quasar.toml for the toolchain and generates the IDL before building.

quasar build [OPTIONS]
FlagDescription
--debugEmit debug symbols (required for profiling and source-interleaved dump)
-w, --watchWatch src/ for changes and rebuild automatically
--features <FEATURES>Cargo features to enable (passed through to the build command)

On success, prints the binary size and delta from the previous build:

  Build complete in 1.2s (56.6 KB, -1.2 KB)

Examples:

quasar build                  # Release build
quasar build --debug          # Debug build with symbols
quasar build --watch          # Auto-rebuild on changes
quasar build --features "devnet"

quasar test

Run the test suite. Builds first (unless --no-build), then runs Rust or TypeScript tests based on Quasar.toml.

quasar test [OPTIONS]
FlagDescription
--debugBuild with debug symbols before testing
-f, --filter <PATTERN>Only run tests whose name matches the pattern
-w, --watchWatch src/ for changes and re-run tests automatically
--no-buildSkip the build step (use existing binary)

Test framework behavior:

  • Rust (mollusk, quasarsvm-rust): Runs cargo test and parses output
  • TypeScript (quasarsvm-web3js, quasarsvm-kit): Runs Mocha and parses JSON reporter output

Examples:

quasar test                       # Build and test
quasar test --filter deposit      # Only run tests matching "deposit"
quasar test --watch               # Auto-test on changes
quasar test --no-build            # Skip build, test existing binary
quasar test --debug --filter pda  # Debug build, filtered tests

quasar profile

Measure compute-unit usage by statically walking the sBPF binary's call graph. Runs a debug build automatically if no ELF path is given.

quasar profile [ELF] [OPTIONS]
FlagDescription
ELFPath to a compiled .so (auto-detected from target/deploy/ if omitted)
--expandShow full terminal output with all functions and bar charts
--diff <PROGRAM>Compare CU cost against an on-chain program by name
--shareUpload the profile as a public GitHub Gist
-w, --watchWatch src/ for changes and re-profile automatically

Tracks results between runs. On the first run, shows the top 5 functions by cost. On subsequent runs, shows deltas:

  my_program  12,345 CU (+42)
     8,000 (+200)   5.0%  Initialize::verify
     4,000 (-158)   3.0%  Deposit::process

  flamegraph  http://127.0.0.1:7777/?program=my_program

A background HTTP server starts automatically for the flamegraph viewer, shutting down after 30 seconds of inactivity.

Examples:

quasar profile                    # Auto-build and profile
quasar profile --expand           # Show all functions
quasar profile --diff my-program  # Compare with on-chain program
quasar profile --share            # Upload as Gist
quasar profile --watch            # Auto-profile on changes
quasar profile target/deploy/my_program.so  # Profile specific ELF

quasar dump

Dump sBPF assembly using llvm-objdump. Auto-detects the ELF from target/deploy/ or target/profile/ if not specified.

quasar dump [ELF] [OPTIONS]
FlagDescription
ELFPath to a compiled .so (auto-detected if omitted)
-f, --function <SYMBOL>Disassemble only the named symbol (demangled name)
-S, --sourceInterleave source code (requires a debug build)

Prints an instruction count summary at the end.

Examples:

quasar dump                              # Full disassembly
quasar dump --function initialize        # Single function
quasar dump --function initialize -S     # With source interleaving
quasar dump target/deploy/my_program.so  # Specific ELF

quasar deploy

Deploy the program to a Solana cluster. Uses the cluster and wallet from your Solana CLI config (solana config get).

quasar deploy [OPTIONS]
FlagDescription
--program-keypair <KEYPAIR>Path to the program keypair (default: target/deploy/<name>-keypair.json)
--upgrade-authority <KEYPAIR>Upgrade authority keypair (default: Solana CLI default keypair)

The program binary is auto-detected from target/deploy/.

Examples:

quasar build && quasar deploy                     # Build and deploy
quasar deploy                                     # Deploy existing binary
quasar deploy --program-keypair ./my-key.json     # Custom program keypair
quasar deploy --upgrade-authority ./authority.json # Custom upgrade authority

quasar clean

Remove build artifacts from target/deploy/, target/profile/, target/idl/, and target/client/.

quasar clean

quasar idl

Generate the IDL for a program crate. Produces JSON, a TypeScript client, and a Rust client module.

quasar idl <PATH>
ArgumentDescription
PATHPath to the program crate directory

Example:

quasar idl .                   # Current directory
quasar idl programs/my-program # Specific program crate

quasar config

Manage global settings in ~/.quasar/config.toml. Running without a subcommand opens an interactive menu.

quasar config [SUBCOMMAND]
SubcommandDescription
get <KEY>Read a single config value
set <KEY> <VALUE>Write a config value
listPrint every config value
resetRestore factory defaults

Available keys:

KeyValid ValuesDefault
defaults.toolchainsolana, upstream(not set)
defaults.frameworknone, mollusk, quasarsvm-rust, quasarsvm-web3js, quasarsvm-kit(not set)
defaults.templateminimal, full(not set)
ui.animationtrue, falsetrue
ui.colortrue, falsetrue
ui.timingtrue, falsetrue

Examples:

quasar config                        # Interactive menu
quasar config list                   # Print all settings
quasar config get ui.animation       # Read a value
quasar config set ui.color false     # Write a value
quasar config set defaults.toolchain solana
quasar config reset                  # Restore factory defaults

quasar completions

Generate shell completions for your shell.

quasar completions <SHELL>
ArgumentDescription
SHELLbash, zsh, fish, elvish, powershell

Examples:

quasar completions bash >> ~/.bashrc
quasar completions zsh >> ~/.zshrc
quasar completions fish > ~/.config/fish/completions/quasar.fish

Global Options

FlagDescription
-h, --helpPrint help
-V, --versionPrint version

Run quasar <command> --help for detailed help on any command.

On this page