### Local Development Workflow for JavaScript Client Source: https://github.com/solana-program/system/blob/main/clients/js/README.md Provides a sequence of commands to set up and test the JavaScript client locally. This includes starting a validator, navigating to the client directory, installing dependencies, building the client, and running tests. ```shell # Start the validator. pnpm validator:restart # Go into the client directory and run the tests. cd clients/js pnpm install pnpm build pnpm test ``` -------------------------------- ### Install Dependencies Source: https://github.com/solana-program/system/blob/main/README.md Installs all NPM dependencies required to access the scripts and tools provided by the project template. ```sh pnpm install ``` -------------------------------- ### Start Local Solana Validator Source: https://github.com/solana-program/system/blob/main/README.md Starts the local Solana validator. If a validator is already running, this command will be skipped by default. ```shell pnpm validator:start ``` -------------------------------- ### Run JavaScript Client Tests Source: https://github.com/solana-program/system/blob/main/clients/js/README.md Executes tests for the JavaScript client by starting a local validator if necessary. This command is run from the repository root. ```shell pnpm clients:js:test ``` -------------------------------- ### Build and Test Rust Client Source: https://github.com/solana-program/system/blob/main/clients/rust/README.md This command builds and tests the generated Rust client for the Solana System program. It starts a local validator if one is not running and executes the tests. ```sh pnpm clients:js:test ``` -------------------------------- ### Create Account with Solana System Program Source: https://github.com/solana-program/system/blob/main/interface/README.md Provides a Rust function to create a new Solana account using the System program. It calculates the required rent, constructs the create account instruction, and sends a signed transaction. ```rust use solana_rpc_client::rpc_client::RpcClient; use solana_sdk::{ signature::{Keypair, Signer}, transaction::Transaction, }; use solana_system_interface::instruction; use anyhow::Result; fn create_account( client: &RpcClient, payer: &Keypair, new_account: &Keypair, owning_program: &Pubkey, space: u64, ) -> Result<()> { let rent = client.get_minimum_balance_for_rent_exemption(space.try_into()?)?; let instr = instruction::create_account( &payer.pubkey(), &new_account.pubkey(), rent, space, owning_program, ); let blockhash = client.get_latest_blockhash()?; let tx = Transaction::new_signed_with_payer( &[instr], Some(&payer.pubkey()), &[payer, new_account], blockhash, ); let _sig = client.send_and_confirm_transaction(&tx)?; Ok(()) } ``` -------------------------------- ### Solana System Program Clients Source: https://github.com/solana-program/system/blob/main/README.md Information about the available clients for the Solana System program. Links are provided for further details on each client's usage and features. ```APIDOC JS Client: Description: Client for interacting with the Solana System program using JavaScript. Link: ./clients/js Rust Client: Description: Client for interacting with the Solana System program using Rust. Link: ./clients/rust ``` -------------------------------- ### Add Solana System Interface Dependency Source: https://github.com/solana-program/system/blob/main/interface/README.md Demonstrates how to add the solana-system-interface crate to a Rust project using Cargo, enabling the bincode feature for instruction constructors. ```bash cargo add solana-system-interface --features bincode ``` -------------------------------- ### Transfer Lamports with Solana System Program Source: https://github.com/solana-program/system/blob/main/interface/README.md Illustrates a Rust function for transferring lamports between Solana accounts using the System program. It generates the transfer instruction and submits a signed transaction. ```rust use solana_rpc_client::rpc_client::RpcClient; use solana_pubkey::Pubkey; use solana_sdk::{ signature::{Keypair, Signer}, transaction::Transaction, }; use solana_system_interface::instruction; use anyhow::Result; fn transfer( client: &RpcClient, from: &Keypair, recipient: &Pubkey, lamports: u64, ) -> Result<()> { let instr = instruction::transfer( &from.pubkey(), recipient, lamports, ); let blockhash = client.get_latest_blockhash()?; let tx = Transaction::new_signed_with_payer( &[instr], Some(&from.pubkey()), &[from], blockhash, ); let _sig = client.send_and_confirm_transaction(&tx)?; Ok(()) } ``` -------------------------------- ### Generate Clients Source: https://github.com/solana-program/system/blob/main/README.md Generates clients for the Solana System program. This command is essential for interacting with the program using generated code. ```sh pnpm generate:clients ``` -------------------------------- ### JavaScript Client Linting and Formatting Source: https://github.com/solana-program/system/blob/main/clients/js/README.md Utility scripts for maintaining code quality in the JavaScript client. Includes commands for linting and fixing linting errors, as well as formatting code and fixing formatting issues. ```shell pnpm lint pnpm lint:fix pnpm format pnpm format:fix ``` -------------------------------- ### Restart Local Solana Validator Source: https://github.com/solana-program/system/blob/main/README.md Forces the local Solana validator to restart, even if one is already running. This is useful for ensuring a clean state. ```shell pnpm validator:restart ``` -------------------------------- ### Stop Local Solana Validator Source: https://github.com/solana-program/system/blob/main/README.md Stops the currently running local Solana validator. ```shell pnpm validator:stop ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.