diff --git a/README.md b/README.md index c5cf0a51..e52245b3 100644 --- a/README.md +++ b/README.md @@ -12,45 +12,74 @@ There are **Primitive Rules** and **Composed Rules** that are created by combini **Composed Rules** return a true or false based on whether any or all of the primitive rules return true. Composed rules can then be combined into higher-level composed rules that implement more complex boolean logic. Because of the recursive definition of the `Rule` enum, calling `validate()` on a top-level composed rule will start at the top and validate at every level, down to the component primitive rules. -## Environment Setup -1. Install Rust from https://rustup.rs/ -2. Install Solana from https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-tool -3. Run `yarn install` to install dependencies +## Getting Started -### Build the program, generate the JS API, and rebuild IDL (using Shank and Solita) -``` -$ yarn build:rust -$ yarn solita -``` +The packages below can be used to interact with Token Authorization Rules (Token Auth Rules) program. -### Build the JS SDK only (must be generated first) -``` -$ yarn build:sdk +### TypeScript +```sh +npm install @metaplex-foundation/mpl-token-auth-rules ``` -### Build the program and generate/build the IDL/SDK/docs -``` -$ yarn build +[See typedoc documentation](https://mpl-token-auth-rules-js-docs.vercel.app/). + +### Rust +```sh +cargo add mpl-token-auth-rules ``` -### Start Amman and run the test script -Run the following command in a separate shell +[See crate documentation](https://docs.rs/mpl-token-auth-rules/latest/mpl_token_auth_rules/). + +## Building + +From the root directory of the repository: + +- Install the required packages: +```sh +pnpm install ``` -$ amman start + +- Build the program: +```sh +pnpm programs:build ``` -Then, run the Amman script +This will create the program binary at `/programs/.bin` + +## Testing + +Token Auth Rules includes three sets of tests: BPF, TypeScript for the JS Client, and Legacy Typescript for the Solita-based JS Client. + +### BPF + +From the root directory of the repository: +```sh +pnpm programs:test ``` -$ yarn amman + +### TypeScript + +From the root directory of the repository: +```sh +pnpm validator ``` -### Build and test the Rust program +This will start a local validator using [Amman](https://github.com/metaplex-foundation/amman). + +After starting the validator, go to the folder `/clients/js` and run: +```sh +pnpm install ``` -$ cd program/ -$ cargo build-bpf -$ cargo test-bpf + +This will install the required packages for the tests. Then, run: +```sh +pnpm build && pnpm test ``` +### Legacy Typescript + +Follow all the same steps as for the TypeScript tests above, including starting the validator in the root directory, but for building and running the tests, navigate to the folder `/clients/js-solita`. + ## CLI The folder `cli` contains a typescript CLI to manage rule set revisions: diff --git a/clients/js-solita/README.md b/clients/js-solita/README.md index 9d2abd24..44a69264 100644 --- a/clients/js-solita/README.md +++ b/clients/js-solita/README.md @@ -4,7 +4,7 @@ This package contains the Metaplex Token Authorization Rules JavaScript SDK. ## How it works -[Program Overview](https://github.com/metaplex-foundation/mpl-token-auth-rules/blob/main/README.md) +[Program Overview](../../README.md) ## Installation @@ -14,7 +14,7 @@ npm install @metaplex-foundation/mpl-token-auth-rules --save ## Developing -See [Environment Setup](https://github.com/metaplex-foundation/mpl-token-auth-rules/blob/main/README.md#environment-setup). +See [Getting Started](../../README.md#getting-started). ## LICENSE