diff --git a/clients/cli/README.md b/clients/cli/README.md index 6c051b464..8075cafaf 100644 --- a/clients/cli/README.md +++ b/clients/cli/README.md @@ -1,6 +1,7 @@ # SPL Token program command-line utility -A basic command-line for creating and using SPL Tokens. See for more details +A basic command-line for creating and using SPL Tokens. See the +[Solana Program Docs](https://www.solana-program.com/docs/token) for more info. ## Build @@ -12,20 +13,11 @@ cargo build ## Testing -The tests require locally built programs for Token, Token-2022, and Associated -Token Account. To build these, you can run: +The tests require a locally built program for Token-2022. To build it, run the +following command from the root directory of this repository: ```sh -BUILD_DEPENDENT_PROGRAMS=1 cargo build -``` - -This method uses the local `build.rs` file, which can be error-prone, so alternatively, -you can build the programs by running the following commands from this directory: - -```sh -cargo build-sbf --manifest-path ../program/Cargo.toml -cargo build-sbf --manifest-path ../program-2022/Cargo.toml -cargo build-sbf --manifest-path ../../associated-token-account/program/Cargo.toml +cargo build-sbf --manifest-path program/Cargo.toml ``` After that, you can run the tests as any other Rust project: @@ -33,10 +25,3 @@ After that, you can run the tests as any other Rust project: ```sh cargo test ``` - -To run it locally you can do it like this: - -```sh -cargo build --manifest-path token/cli/Cargo.toml -target/debug/spl-token -``` diff --git a/clients/cli/build.rs b/clients/cli/build.rs deleted file mode 100644 index c07683ecf..000000000 --- a/clients/cli/build.rs +++ /dev/null @@ -1,79 +0,0 @@ -extern crate walkdir; - -use { - std::{env, path::Path, process::Command}, - walkdir::WalkDir, -}; - -fn rerun_if_changed(directory: &Path) { - let src = directory.join("src"); - let files_in_src: Vec<_> = WalkDir::new(src) - .into_iter() - .map(|entry| entry.unwrap()) - .filter(|entry| { - if !entry.file_type().is_file() { - return false; - } - true - }) - .map(|f| f.path().to_str().unwrap().to_owned()) - .collect(); - - for file in files_in_src { - if !Path::new(&file).is_file() { - panic!("{} is not a file", file); - } - println!("cargo:rerun-if-changed={}", file); - } - let toml = directory.join("Cargo.toml").to_str().unwrap().to_owned(); - println!("cargo:rerun-if-changed={}", toml); -} - -fn build_bpf(program_directory: &Path) { - let toml_file = program_directory.join("Cargo.toml"); - let toml_file = format!("{}", toml_file.display()); - let args = vec!["build-sbf", "--manifest-path", &toml_file]; - let output = Command::new("cargo") - .args(&args) - .output() - .expect("Error running cargo build-sbf"); - if let Ok(output_str) = std::str::from_utf8(&output.stdout) { - let subs = output_str.split('\n'); - for sub in subs { - println!("cargo:warning=(not a warning) {}", sub); - } - } -} - -fn main() { - let is_debug = env::var("DEBUG").map(|v| v == "true").unwrap_or(false); - let build_dependent_programs = env::var("BUILD_DEPENDENT_PROGRAMS") - .map(|v| v != "false" && v != "0") - .unwrap_or(false); - if is_debug && build_dependent_programs { - let cwd = env::current_dir().expect("Unable to get current working directory"); - let spl_token_2022_dir = cwd - .parent() - .expect("Unable to get parent directory of current working dir") - .join("program-2022"); - rerun_if_changed(&spl_token_2022_dir); - let spl_token_dir = cwd - .parent() - .expect("Unable to get parent directory of current working dir") - .join("program"); - rerun_if_changed(&spl_token_dir); - let spl_associated_token_account_dir = cwd - .parent() - .expect("Unable to get parent directory of current working dir") - .parent() - .expect("Unable to get parent directory of current working dir") - .join("associated-token-account") - .join("program"); - rerun_if_changed(&spl_associated_token_account_dir); - - build_bpf(&spl_token_dir); - build_bpf(&spl_token_2022_dir); - build_bpf(&spl_associated_token_account_dir); - } - println!("cargo:rerun-if-changed=build.rs"); -} diff --git a/clients/js-legacy/README.md b/clients/js-legacy/README.md index cc9f8299d..087550ac1 100644 --- a/clients/js-legacy/README.md +++ b/clients/js-legacy/README.md @@ -48,40 +48,37 @@ If you have Node 16+, you can [activate PNPM with Corepack](https://pnpm.io/inst 1. Clone the project: ```shell -git clone https://github.com/solana-labs/solana-program-library.git +git clone https://github.com/solana-program/token-2022.git ``` 2. Navigate to the root of the repository: ```shell -cd solana-program-library +cd token-2022 ``` -3. Install the dependencies: +3. Build the on-chain programs: ```shell -pnpm install +make build-sbf-program +make build-sbf-confidential-elgamal-registry ``` -4. Build the libraries in the repository: +4. Navigate to the SPL Token library: ```shell -pnpm run build +cd clients/js-legacy ``` -5. Navigate to the SPL Token library: +5. Build the libraries in the repository: ```shell -cd token/js -``` - -6. Build the on-chain programs: -```shell -pnpm run test:build-programs +pnpm install +pnpm run build ``` -7. Run the tests: +6. Run the tests: ```shell pnpm run test ``` -8. Run the example: +7. Run the example: ```shell pnpm run example ``` diff --git a/clients/js/README.md b/clients/js/README.md index 2458cf643..3dfaea972 100644 --- a/clients/js/README.md +++ b/clients/js/README.md @@ -4,13 +4,15 @@ A generated JavaScript library for the Token 2022 program. ## Getting started -To build and test your JavaScript client from the root of the repository, you may use the following command. +To build and test your JavaScript client from the root of the repository, you +may use the following command. ```sh -pnpm clients:js:test +make test-js-clients-js ``` -This will start a new local validator, if one is not already running, and run the tests for your JavaScript client. +This will start a new local validator, if one is not already running, and run +the tests for your JavaScript client. ## Available client scripts. @@ -18,8 +20,9 @@ Alternatively, you can go into the client directory and run the tests directly. ```sh # Build your programs and start the validator. -pnpm programs:build -pnpm validator:restart +make build-sbf-program +make build-sbf-confidential-elgamal-registry +make restart-test-validator # Go into the client directory and run the tests. cd clients/js @@ -31,8 +34,6 @@ pnpm test You may also use the following scripts to lint and/or format your JavaScript client. ```sh -pnpm lint -pnpm lint:fix -pnpm format -pnpm format:fix +make lint-js-clients-js +make format-check-js-clients-js ``` diff --git a/clients/rust/README.md b/clients/rust/README.md index 386413367..1c2bcdb40 100644 --- a/clients/rust/README.md +++ b/clients/rust/README.md @@ -4,10 +4,12 @@ A generated Rust library for the Token 2022 program. ## Getting started -To build and test your Rust client from the root of the repository, you may use the following command. +To build and test your Rust client from the root of the repository, you may use +the following commands. ```sh -pnpm clients:js:test +make build-sbf-program +make test-clients-rust ``` -This will start a new local validator, if one is not already running, and run the tests for your Rust client. +This will build the program and run the tests for your Rust client. diff --git a/interface/README.md b/interface/README.md index c0c642e85..b64f61f45 100644 --- a/interface/README.md +++ b/interface/README.md @@ -6,9 +6,5 @@ non-fungible tokens. This crate provides an interface that third parties can utilize to create and use their tokens. -Full documentation is available at [https://www.solana-program.com/docs/token-2022](https://www.solana-program.com/docs/token-2022) - -## Audit - -The repository [README](https://github.com/solana-labs/solana-program-library#audits) -contains information about program audits. +Full documentation is available at the +[Solana Program Docs](https://www.solana-program.com/docs/token-2022). diff --git a/program/README.md b/program/README.md index f56a826a3..46030932f 100644 --- a/program/README.md +++ b/program/README.md @@ -5,9 +5,10 @@ A token program on the Solana blockchain, usable for fungible and non-fungible t This program provides an interface and implementation that third parties can utilize to create and use their tokens. -Full documentation is available at [https://www.solana-program.com/docs/token-2022](https://www.solana-program.com/docs/token-2022) +Full documentation is available at the +[Solana Program Docs](https://www.solana-program.com/docs/token-2022). ## Audit -The repository [README](https://github.com/solana-labs/solana-program-library#audits) -contains information about program audits. +The [security-audits README](https://github.com/anza-xyz/security-audits?tab=readme-ov-file#token-2022) +contains all program audits.