Overview of LiteSVM
solana-program-test or solana-test-validator. It is available for Rust, TypeScript/JavaScript, and Python (via the solders library).website·Indexed 35 days ago
https://www.anchor-lang.com/A framework for building Solana programs, providing tools for program structure, account constraints, and IDL generation. It includes the Anchor Version Manager (AVM) and supports features like zero-copy deserialization, Cross Program Invocations (CPIs), and integration with Solana's Token Programs. Documentation covers versions from 0.29.0 through 1.2.0.
solana-program-test or solana-test-validator. It is available for Rust, TypeScript/JavaScript, and Python (via the solders library).The Token Extensions Program (Token 2022) allows developers to add optional features to token mints and token accounts via extensions. Most extensions must be enabled during the initial account creation and cannot be added later. However, the following extensions are exceptions and can be added after initialization:
cpi-guardmemo-transfertoken-grouptoken-membertoken-metadataNote that some extensions are mutually exclusive; for example, NonTransferable and TransferFeeConfig cannot be used on the same mint or account due to conflicting behaviors.
anchor fuzz provides coverage-guided fuzzing for Solana programs via Crucible. It generates random action sequences against a program and checks invariants after each action to identify bugs that standard unit tests might miss. Key features include stateful invariant testing, multi-core parallel fuzzing, crash minimization, and LCOV coverage output.Mollusk struct.Account<T> is suitable for small accounts (< 1KB) and dynamic structures (Vec, String), AccountLoader<T> is required for large accounts (up to 10MB) and provides approximately a 90% reduction in CU usage for large data sets.An Associated Token Account (ATA) is a token account with a deterministic address derived as a PDA using the Associated Token Program. This allows any user's token account for a specific mint to be found without needing to store the address separately.
The derivation uses the wallet address, the token program ID, and the mint address. The Associated Token Program acts as a helper that CPIs into the Token or Token Extension Program to create the actual account.
pub fn get_associated_token_address_and_bump_seed_internal(
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
program_id: &Pubkey,
token_program_id: &Pubkey,
) -> (Pubkey, u8) {
Pubkey::find_program_address(
&[
&wallet_address.to_bytes(),
&token_program_id.to_bytes(),
&token_mint_address.to_bytes(),
],
program_id,
)
}anchor-client crate is the official Rust library for interacting with Anchor programs. It allows developers to build program instructions, send transactions, and fetch program accounts. A key feature is the declare_program! macro, which automatically generates dependency-free modules for a program's instructions and accounts based on its IDL (Interface Definition Language) file.[dependencies]
anchor-client = { version = "1.2.0", features = ["async"] }
anchor-lang = "1.2.0"declare_program!() macro allows developers to interact with Anchor programs without adding them as Rust dependencies. It generates a set of Rust modules based on the target program's IDL file, which can be used for both on-chain Cross-Program Invocations (CPI) and off-chain client transactions.Solana provides two primary token programs for managing assets:
--arch and --tools-version flags with the anchor build command to select a specific SBPF architecture and platform-tools version.anchor build --arch <architecture> --tools-version <version>