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

SDK 2.0 - getting started guides #1487

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 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
7 changes: 7 additions & 0 deletions docs/build/iota-sdk/2.0/docs/_admonitions/_edit_dot_env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

:::info .env

Make sure you copy the `.env.example` file in the examples directory to `.env` and edit any values you see fit before
running the examples.

:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:::warning Safe Password Storage

In a production setup, do not store passwords in the host's environment variables or in the source code. See
our [backup and security recommendations](/introduction/stardust/how_tos/backup_security) for
production setups.

:::
49 changes: 49 additions & 0 deletions docs/build/iota-sdk/2.0/docs/contribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
description: Contribute to the IOTA SDK joining the IOTA Libraries Initiative, contributing to the official GitHub repository or sharing your knowledge on Discord.
tags:
- join
- documentation
- project
- contribute
- discord
- GitHub
---

# Contribute to the IOTA SDK

If you're thinking about contributing to the IOTA SDK project, please consider the following ways to get involved.

## Join the IOTA Libraries Initiative

The [IOTA Libraries Initiative](https://github.com/iota-community/X-Team_IOTA_Libraries) is a collaborative effort aimed
at enhancing the developer experience. You can contribute in the following areas:

- Quality assurance and code review
- Documentation improvements
- Code sample creation

To get started, join the #experience channel on [Discord](https://discord.iota.org).

## Contribute to the Project's GitHub Repository

All of the project's code is open source and hosted on [GitHub](https://github.com/iotaledger/iota-sdk). You can contribute
in the following ways:

- Report any bugs you encounter
- Suggest new features or enhancements
- Contribute to the project's documentation

## Contribute to the Documentation

The project's documentation is also open source and available on GitHub. If you wish to contribute new documentation or
fix any errors, please refer to
the [contribution guidelines](https://github.com/iotaledger/iota-wiki/blob/main/.github/CONTRIBUTING.md).

## Share Your Knowledge

Helping others is a crucial aspect of any open source ecosystem. By sharing your knowledge with the community, you can
provide immense value and potentially inspire others to learn and contribute. Join the ongoing discussions in the
`#libraries` channel on [Discord](https://discord.iota.org).
lucas-tortora marked this conversation as resolved.
Show resolved Hide resolved

Your contributions play a vital role in shaping and improving the project. We appreciate your interest and look forward
to your valuable contributions!
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
image: /img/banner/client_lib_overview.png
description: 'Learn how to connect to the Public Testnet API, explore the network using the Public Testnet Explorer, and obtain test tokens through the Public Testnet Faucet for testing value-based transactions.'
tags:
- Public Testnet
- API
- Public Testnet Explorer
- test tokens
- testnet network
- Testnet tokens
- Public Testnet Faucet
---

# Testnet and Test Tokens

## Connect to the Public Testnet

We recommend you start interacting via the Public Testnet network. The Public Testnet will allow you to safely get
acquainted with the IOTA SDK without the risk of losing any funds if you make a mistake along the way.

You can use this public load-balanced Public Testnet API:

```plaintext
https://api.testnet.shimmer.network
```

## Explore the Network

You can use the [Public Testnet Explorer](https://explorer.shimmer.network/testnet) to view transactions and data stored
in the Tangle.

## Get Test Tokens

You can get Testnet token using the [Public Testnet Faucet](https://faucet.testnet.shimmer.network).
You only need to input a valid Testnet address and the faucet will send you test tokens,
so you can safely develop your application without risking any capital.
134 changes: 134 additions & 0 deletions docs/build/iota-sdk/2.0/docs/getting-started/nodejs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---
image: /img/banner/client_lib_overview.png
description: 'Learn how to get started with the IOTA SDK in Node.js and build applications on the Shimmer network.'
tags:
- node.js
- IOTA SDK
- installation
- client
- wallet
- usage
- how-to guides
- examples
- development
---
import WarningPasswordStorage from '../_admonitions/_warning-password-storage.md';
import EditDotEnv from '../_admonitions/_edit_dot_env.md';

# Getting Started with Node.js

<WarningPasswordStorage />

## Requirements

- One of the following Node.js versions: '16.x', '18.x'


## Install the IOTA SDK

### Install Using a Package Manager

To start using the IOTA SDK in your Node.js project, you can install the IOTA SDK from your package manager of choice:

```bash npm2yarn
npm i @iota/[email protected]
```

### Build the Binding from Source

#### Requirements

If you want to build the IOTA SDK from source, please ensure you have the installed the following:

- A [supported version of Node and Rust](https://github.com/neon-bindings/neon#platform-support).
- Python < 3.11
- Yarn v1

#### Windows

On Windows, you will also need LLVM. Our workflow uses
`https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.1/LLVM-11.0.1-win64.exe`. You may also need to set
an environment variable `RUSTFLAGS` to `-C target-feature=+crt-static`.

:::tip Install LLVM with Chocolatey

If you use [Chocolatey](https://chocolatey.org) you can install LLVM by executing `choco install llvm`

:::

#### Build

You can build the IOTA SDK from source by doing the following:

1. Download the repository to any directory you choose:

```shell
git clone https://github.com/iotaledger/iota-sdk
```

2. Move to the Node.js binding directory:

```shell
cd iota-sdk/bindings/nodejs
```

3. Install the necessary dependencies with either of the following commands:

```bash npm2yarn
npm install
```

4. Build the SDK:


```bash npm2yarn
npm run build
```

This command uses the [cargo-cp-artifact](https://github.com/neon-bindings/cargo-cp-artifact) utility to run the Rust
build and copy the built library into `./build/Release/index.node`.
Prebuild requires that the binary is in `build/Release` as though it was built with node-gyp.

## Usage

### Client

After you [installed the library](#install-the-iota-sdk), you can create a `Client` instance and interface with it.

```typescript reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/client/getting-started.ts#L4-L23
```

### Wallet

After you [installed the library](#installing-the-iota-sdk), you can create a `Wallet` instance and interact with it.

```typescript reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/wallet/getting-started.ts#L4-L60
```

## What's next?

### How-To Guides

Once you have [installed the IOTA SDK](#install-the-iota-sdk), you can start building your application. You can find
usage examples in this Wiki's [how-to guides](../how-tos/introduction.md).

<EditDotEnv />

### More Examples

You can use the provided code [examples](https://github.com/iotaledger/iota-sdk/tree/develop/bindings/nodejs/examples)
to get acquainted with the IOTA SDK. You can use the following commands to run any example:

```bash
cd examples
yarn
yarn run-example ./[example folder]/[example file]
```

- Where `[example file]` is the file name from the `[example folder]`. For example:

```bash
yarn run-example how_tos/client/get-info.ts
```
142 changes: 142 additions & 0 deletions docs/build/iota-sdk/2.0/docs/getting-started/python.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
image: /img/banner/client_lib_overview.png
description: 'Learn how to get started with the IOTA SDK in Python and build applications on the Shimmer network.'
tags:
- python
- IOTA SDK
- installation
- client
- wallet
- usage
- how-to guides
- examples
- API reference
---

import WarningPasswordStorage from '../_admonitions/_warning-password-storage.md';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import EditDotEnv from '../_admonitions/_edit_dot_env.md';

# Getting Started with Python

<WarningPasswordStorage />

## Requirements

- [Python < 3.11](https://www.python.org)
- [pip ^21.x](https://pypi.org/project/pip)
- `Rust` and `Cargo` to compile the binding. Install them [here](https://doc.rust-lang.org/cargo/getting-started/installation.html).

## Install the IOTA SDK

### Install Using a Pip

To start using the IOTA SDK in your Python project, you can use pip to install:

```sh
pip install iota-sdk=2.0.0
```

### Build the Binding from Source

1. Move to the Python bindings directory:

```bash
cd iota-sdk/bindings/python
```

2. (optional) You can run the following commands create a virtual environment and use it:

<Tabs groupId="os" queryString>
<TabItem value="linux" label="Linux">

```bash
python3 -m venv iota_sdk_venv
source iota_sdk_venv/bin/activate
```

</TabItem>
<TabItem value="mac" label="macOS">

```bash
python3 -m venv iota_sdk_venv
source iota_sdk_venv/bin/activate
```

</TabItem>
<TabItem value="windows" label="Windows">

```bash
.\iota_sdk_venv\Scripts\activate
```

</TabItem>
</Tabs>

3. Install the required dependencies and build the wheel by running the following commands:

```bash
pip install -r requirements-dev.txt
pip install .
```

4. (optional) If you want to deactivate the virtual environment, run the following command:

```bash
deactivate
```

## Usage

### Client

After you [installed the library](#install-the-iota-sdk), you can create a `Client` instance and interface with it.

```python reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/client/getting_started.py
```

### Wallet

After you [installed the library](#install-the-iota-sdk), you can create a `Wallet` instance and interact with it.

```python reference
https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/wallet/getting_started.py#L4-L48
```

## What's next?

### How-To Guides

Once you have [installed the IOTA SDK](#install-the-iota-sdk), you can start building your application. You can find
usage examples in this Wiki's [how-to guides](../how-tos/introduction.md).

<EditDotEnv />

### More Examples

You can use the provided code [examples](https://github.com/iotaledger/iota-sdk/tree/develop/bindings/python/examples)
to get acquainted with the IOTA SDK. You can use the following command to run any example:

```bash
python3 example/[example file]
```

- Where `[example file]` is the file name from the example folder. For example:

```bash
python3 examples/client/00_get_info.py
```

### API Reference

You can generate the Python API reference with the following command from this directory:

```bash
pip install pydoc-markdown && pydoc-markdown
```

## API Reference

The IOTA SDK Rust API Reference is in the [crate documentation](https://docs.rs/iota-sdk/latest/iota_sdk/).
Loading
Loading