Skip to content

Commit

Permalink
chore(sdk): improve npm documentation (#4205)
Browse files Browse the repository at this point in the history
* feat(sdk): add a bit of context to readmes of TS SDK

* feat(sdk): remove the migration part in the readme of the kiosk

* docs: update node version to 20

* docs: update node version to 20

* docs(sdk): improve the kiosk readme by adding instalation script

* docs(sdk): improve titles

* fix(sdk): improve Note text in all sdk readmes

* fix(sdk): improve Note text and Setup section in the readme

* fix(sdk): modify on by in

* fix(sdk): improve ts code in kiosk readme

* fix(sdk): dprint format

* docs(sdk): improve the text of the readmes

* fix: update node version in package.json of the wallet-dashboard

* fix: update Network type
  • Loading branch information
cpl121 authored Dec 4, 2024
1 parent e0e63a1 commit cedefa7
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apps/explorer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Set Up

**Requirements**: Node 18.0.0 or later.
**Requirements**: Node 20.0.0 or later.

Dependencies are managed using [`pnpm`](https://pnpm.io/). You can start by installing dependencies in the root of the iota repository:

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Set Up

**Requirements**: Node 18.17.0 or later.
**Requirements**: Node 20.0.0 or later.

Dependencies are managed using [`pnpm`](https://pnpm.io/). You can start by installing dependencies in the root of the repository:

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "jest"
},
"engines": {
"node": ">= v18.17.0"
"node": ">= 20"
},
"dependencies": {
"@growthbook/growthbook": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A Chrome extension wallet for [IOTA](https://iota.org).

# Set Up

**Requirements**: 18.0.0 or later.
**Requirements**: 20.0.0 or later.

Dependencies are managed using [`pnpm`](https://pnpm.io/). You can start by installing dependencies in the root of the iota repository:

Expand Down
2 changes: 1 addition & 1 deletion bridge/evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This project leverages [Foundry](https://github.com/foundry-rs/foundry) to manag
Duplicate rename the `.env.example` file to `.env`. You'll need accounts and api keys for **Infura** and **Etherscan** as well as the necessary RPC URLs. Be sure to add the required values in your newly created `.env` file.

> **Note**
> The OZ foundry upgrades library uses node to verify upgrade safety. Make sure you have node version 18.17 or higher as well as npm version 10.4 or higher installed.
> The OZ foundry upgrades library uses node to verify upgrade safety. Make sure you have node version 20.0.0 or higher as well as npm version 10.4 or higher installed.
#### Dependencies

Expand Down
6 changes: 3 additions & 3 deletions dapps/kiosk-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
import { bcs } from '@iota/iota-sdk/bcs';
import { program } from 'commander';
import { KIOSK_LISTING, KioskClient, KioskTransaction } from '@iota/kiosk';
import { IotaClient, getFullnodeUrl } from '@iota/iota-sdk/client';
import { IotaClient, getFullnodeUrl, Network } from '@iota/iota-sdk/client';
import { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519';
import { Transaction } from '@iota/iota-sdk/transactions';

Expand All @@ -45,11 +45,11 @@ import { Transaction } from '@iota/iota-sdk/transactions';
const KNOWN_TYPES = {};

/** JsonRpcProvider for the Testnet */
const client = new IotaClient({ url: getFullnodeUrl('testnet') });
const client = new IotaClient({ url: getFullnodeUrl(Network.Testnet) });

const kioskClient = new KioskClient({
client,
network: 'testnet',
network: Network.Testnet,
});

/**
Expand Down
4 changes: 4 additions & 0 deletions sdk/bcs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# BCS - Binary Canonical Serialization

`@iota/bcs` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.

> **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
This small and lightweight library implements
[Binary Canonical Serialization (BCS)](https://github.com/zefchain/bcs) in TypeScript, making BCS
available in both Browser and NodeJS environments in a type-safe way.`
Expand Down
4 changes: 4 additions & 0 deletions sdk/create-dapp/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @iota/create-dapp

`@iota/create-dapp` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.

> **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
`@iota/create-dapp` is a CLI tool that helps you to create a new dApp project.

You can get started quickly by running the following command:
Expand Down
4 changes: 4 additions & 0 deletions sdk/dapp-kit/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# IOTA dApp Kit

`@iota/dapp-kit` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.

> **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
The IOTA dApp Kit is a set of React components, hooks, and utilities that make it easy to build a
dApp for the IOTA ecosystem. It provides hooks and components for querying data from the IOTA
blockchain, and connecting to IOTA wallets.
Expand Down
4 changes: 4 additions & 0 deletions sdk/graphql-transport/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# `@iota/graphql-transport`

`@iota/graphql-transport` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.

> **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
This package provides a `IotaTransport` that enables `IotaClient` to make requests using the RPC 2.0
(GraphQL) API instead of the JSON RPC API.

Expand Down
37 changes: 35 additions & 2 deletions sdk/kiosk/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,41 @@
# Kiosk SDK

`@iota/kiosk` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.

> **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
This Kiosk SDK library provides different utilities to interact/create/manage a
[Kiosk](https://github.com/iotaledger/iota/tree/main/kiosk).
[Kiosk](https://github.com/iotaledger/iota/tree/develop/kiosk).

[You can read the documentation and see examples by clicking here.](https://docs.iota.org/references/ts-sdk/kiosk)

[If you are migrating from `0.6.x`, you can follow these instructions](https://docs.iota.org/references/ts-sdk/kiosk/from-v1)
## Install

To use the Kiosk SDK in your project, run the following command in your project root:

```sh npm2yarn
npm i @iota/kiosk @iota/iota-sdk
```

To use the Kiosk SDK, you must create a [KioskClient](https://docs.iota.org/references/ts-sdk/kiosk/kiosk-client/introduction) instance.

## Setup

You can follow this example to create a KioskClient.

```typescript
import { KioskClient } from '@iota/kiosk';
import { getFullnodeUrl, IotaClient, Network } from '@iota/iota-sdk/client';

// We need a IOTA Client. You can re-use the IotaClient of your project
// (it's not recommended to create a new one).
const client = new IotaClient({ url: getFullnodeUrl(Network.Testnet) });

// Now we can use it to create a kiosk Client.
const kioskClient = new KioskClient({
client,
network: Network.Testnet,
});
```

You can read the KioskClient documentation to query kiosk data [here](https://docs.iota.org/references/ts-sdk/kiosk/kiosk-client/querying).
4 changes: 4 additions & 0 deletions sdk/ledgerjs-hw-app-iota/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

# ledgerjs-hw-app-iota

`@iota/ledgerjs-hw-app-iota` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.

> **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
[Ledger Hardware Wallet](https://www.ledger.com/) JavaScript bindings for [IOTA](https://iota.org/),
based on [LedgerJS](https://github.com/LedgerHQ/ledgerjs).

Expand Down
6 changes: 5 additions & 1 deletion sdk/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ For more complete docs, visit the

# IOTA TypeScript SDK

`@iota/iota-sdk` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.

> **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
This is the IOTA TypeScript SDK built on the IOTA
[JSON RPC API](https://github.com/iotaledger/iota/blob/main/docs/content/references/iota-api.mdx).
It provides utility classes and functions for applications to sign transactions and interact with
Expand Down Expand Up @@ -91,7 +95,7 @@ npx vitest txn-builder.test.ts
Troubleshooting:

If you see errors like `ECONNRESET or "socket hang up"`, run `node -v` to make sure your node
version is `v18.x.x`. Refer to this
version is `v20.x.x`. Refer to this
[guide](https://blog.logrocket.com/how-switch-node-js-versions-nvm/) to switch node version.

Some more follow up here is if you used homebrew to install node, there could be multiple paths to
Expand Down
4 changes: 4 additions & 0 deletions sdk/wallet-standard/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# `@iota/wallet-standard`

`@iota/wallet-standard` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.

> **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
A suite of standard utilities for implementing wallets and libraries based on the
[Wallet Standard](https://github.com/wallet-standard/wallet-standard/).

Expand Down

0 comments on commit cedefa7

Please sign in to comment.