Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Documentation for Avail SDK Usage #705

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 43 additions & 13 deletions avail-js/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Avail SDK documentation / examples

This directory contains documentation and examples related to the opinionated SDK and additional functionalities provided by the `avail-js-sdk`.
The following scripts have been tested with `ts-node v10.9.2 node v20.11.1 (npm v10.2.4)`.

## Requirements

- Node.js: v20.11.1 or higher
- npm: v10.2.4 or higher
- ts-node: v10.9.2 or higher

## Running Examples in the Docs Directory

Expand All @@ -19,25 +24,50 @@ npm i -g ts-node
npm install
```

3. Ensure you're running a local Avail node. You can do this with the following command from the root directory:
3. Start a local Avail node. You have two options:

```bash
cargo build --release
./target/release/avail-node --dev
```
a. Build and run from source:
```bash
cargo build --release
./target/release/avail-node --dev
```

You can also take the latest release from [Github](https://github.com/availproject/avail/releases)
b. Download and run the latest release:
- Download from [Github Releases](https://github.com/availproject/avail/releases)
- Extract and run the binary:
```bash
./avail-node --dev
```

4. To run any example script from the docs/extrinsics folder, use the following command format, replacing NAME_OF_THE_FILE with the actual file name you want to run:
4. Run example scripts:

```bash
# General format
ts-node ./docs/extrinsics/NAME_OF_THE_FILE.ts
```

For example, to run the staking_nominate.ts script:

```bash
# Example
ts-node ./docs/extrinsics/staking_nominate.ts
```

This will execute the chosen example script, showcasing how to interact with the Avail network using the avail-js-sdk.
## Available Examples

The following examples are available in the `docs/extrinsics` directory:

- `staking_nominate.ts` - Demonstrates staking and nomination
- `session.ts` - Session management examples
- `multisig.ts` - Multi-signature transaction examples
- `nomination_pools.ts` - Nomination pool interactions
- `da.ts` - Data Availability examples

Each example demonstrates how to interact with different aspects of the Avail network using the avail-js-sdk.

## Troubleshooting

If you encounter any issues:

1. Ensure your Node.js version matches the requirements
2. Clear the node_modules folder and run `npm install` again
3. Check that your local Avail node is running and accessible
4. Verify your network connectivity

For more detailed information, visit the [Avail Documentation](https://docs.availproject.org/)