From 39f68603bca9c5fcd4123c8f97c4aaddd0ab75d8 Mon Sep 17 00:00:00 2001 From: cpl121 <100352899+cpl121@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:55:07 +0100 Subject: [PATCH] chore(sdk): improve npm documentation (#4205) * 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 --- apps/explorer/README.md | 2 +- apps/wallet-dashboard/README.md | 2 +- apps/wallet-dashboard/package.json | 2 +- apps/wallet/README.md | 2 +- bridge/evm/README.md | 2 +- dapps/kiosk-cli/index.js | 6 ++--- sdk/bcs/README.md | 4 ++++ sdk/create-dapp/README.md | 4 ++++ sdk/dapp-kit/README.md | 4 ++++ sdk/graphql-transport/README.md | 4 ++++ sdk/kiosk/README.md | 37 ++++++++++++++++++++++++++++-- sdk/ledgerjs-hw-app-iota/README.md | 4 ++++ sdk/typescript/README.md | 6 ++++- sdk/wallet-standard/README.md | 4 ++++ 14 files changed, 72 insertions(+), 11 deletions(-) diff --git a/apps/explorer/README.md b/apps/explorer/README.md index db68127e02e..bf0a1f7d657 100644 --- a/apps/explorer/README.md +++ b/apps/explorer/README.md @@ -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: diff --git a/apps/wallet-dashboard/README.md b/apps/wallet-dashboard/README.md index 570655b24cf..dcbab76f343 100644 --- a/apps/wallet-dashboard/README.md +++ b/apps/wallet-dashboard/README.md @@ -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: diff --git a/apps/wallet-dashboard/package.json b/apps/wallet-dashboard/package.json index 44066a00ef1..3cf781bca2f 100644 --- a/apps/wallet-dashboard/package.json +++ b/apps/wallet-dashboard/package.json @@ -12,7 +12,7 @@ "test": "jest" }, "engines": { - "node": ">= v18.17.0" + "node": ">= 20" }, "dependencies": { "@growthbook/growthbook": "^1.0.0", diff --git a/apps/wallet/README.md b/apps/wallet/README.md index 83b8ce4ed3a..2bdfd81afdc 100644 --- a/apps/wallet/README.md +++ b/apps/wallet/README.md @@ -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: diff --git a/bridge/evm/README.md b/bridge/evm/README.md index c295d1473f4..12ac65b3337 100644 --- a/bridge/evm/README.md +++ b/bridge/evm/README.md @@ -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 diff --git a/dapps/kiosk-cli/index.js b/dapps/kiosk-cli/index.js index aff1f965b12..b86a4d698b1 100644 --- a/dapps/kiosk-cli/index.js +++ b/dapps/kiosk-cli/index.js @@ -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'; @@ -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, }); /** diff --git a/sdk/bcs/README.md b/sdk/bcs/README.md index 617dcc0e9d6..fce39264c3f 100644 --- a/sdk/bcs/README.md +++ b/sdk/bcs/README.md @@ -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.` diff --git a/sdk/create-dapp/README.md b/sdk/create-dapp/README.md index 43655d7126c..5cda509fd84 100644 --- a/sdk/create-dapp/README.md +++ b/sdk/create-dapp/README.md @@ -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: diff --git a/sdk/dapp-kit/README.md b/sdk/dapp-kit/README.md index 8ee45dda9a2..b7c36ca127d 100644 --- a/sdk/dapp-kit/README.md +++ b/sdk/dapp-kit/README.md @@ -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. diff --git a/sdk/graphql-transport/README.md b/sdk/graphql-transport/README.md index 5674f0bf48f..fb320e192f1 100644 --- a/sdk/graphql-transport/README.md +++ b/sdk/graphql-transport/README.md @@ -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. diff --git a/sdk/kiosk/README.md b/sdk/kiosk/README.md index 5c76569cb4c..519630aa6dd 100644 --- a/sdk/kiosk/README.md +++ b/sdk/kiosk/README.md @@ -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). diff --git a/sdk/ledgerjs-hw-app-iota/README.md b/sdk/ledgerjs-hw-app-iota/README.md index 3297361f3dd..cc52d55ffdb 100644 --- a/sdk/ledgerjs-hw-app-iota/README.md +++ b/sdk/ledgerjs-hw-app-iota/README.md @@ -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). diff --git a/sdk/typescript/README.md b/sdk/typescript/README.md index 619edbb58c2..3bc7758c018 100644 --- a/sdk/typescript/README.md +++ b/sdk/typescript/README.md @@ -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 @@ -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 diff --git a/sdk/wallet-standard/README.md b/sdk/wallet-standard/README.md index 83b89e24ea2..3cba4242ec1 100644 --- a/sdk/wallet-standard/README.md +++ b/sdk/wallet-standard/README.md @@ -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/).