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

CU-8678g5b7w - Create an article on neo website explaining how to use… #3

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

luc10921
Copy link

@luc10921 luc10921 commented Nov 7, 2023

… cpm for TS offchain sdk generation with neon-dappkit and wcsdk

@luc10921 luc10921 requested a review from melanke November 7, 2023 17:47
@luc10921 luc10921 self-assigned this Nov 7, 2023
Copy link

@melanke melanke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First review iteration

Copy link

@melanke melanke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second iteration

We recommend using [vite](https://vitejs.dev/guide/) to create your project from a template. You just need to run `npm create vite@latest` and select the prompts to generate your project. After creating your project, it's time to start using CPM to automate the off-chain SDK generation.

## 2. Using CPM
It's pretty easy to use CPM to add an off-chain SDK to your TypeScript project. After installing CPM, you can run it with a `cpm.yaml` or you could directly use the command prompt. In this tutorial, we will be using the easiest one to maintain.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It's pretty easy to use CPM to add an off-chain SDK to your TypeScript project. After installing CPM, you can run it with a `cpm.yaml` or you could directly use the command prompt. In this tutorial, we will be using the easiest one to maintain.
It's pretty easy to use CPM to add an off-chain SDK to your TypeScript project. After installing CPM you can generate a single SDK directly from the command prompt or setup a configuration file that will be processed and allows for generating multiple SDKs at the same time. In this tutorial, we will be using the easiest one to maintain.

The reason for my suggestion is that in the original text

you can run it with a cpm.yaml

cpm.yaml is mentioned for the first time in the article without having explained what it is. Not everybody might know that this is the configuration file.

## 2. Using CPM
It's pretty easy to use CPM to add an off-chain SDK to your TypeScript project. After installing CPM, you can run it with a `cpm.yaml` or you could directly use the command prompt. In this tutorial, we will be using the easiest one to maintain.

We need to generate a default `cpm.yaml` file by running `cpm init` on the terminal, it should create a file that is getting the [Props](https://github.com/CityOfZion/props) smart contract. While it is a useful contract, it's probably not the one you want, in this article, let's suppose we want to easily invoke functions from the [Neo Token contract](https://dora.coz.io/contract/neo3/mainnet/0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We need to generate a default `cpm.yaml` file by running `cpm init` on the terminal, it should create a file that is getting the [Props](https://github.com/CityOfZion/props) smart contract. While it is a useful contract, it's probably not the one you want, in this article, let's suppose we want to easily invoke functions from the [Neo Token contract](https://dora.coz.io/contract/neo3/mainnet/0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5).
We need to generate a configuration file by running `cpm init` on the terminal. This creates a `cpm.yaml` file that by default gets the [Props](https://github.com/CityOfZion/props) smart contract. While it is a useful contract, it's probably not the one you want, in this article, let's suppose we want to easily invoke functions from the [Neo Token contract](https://dora.coz.io/contract/neo3/mainnet/0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5).

Slightly modified to use stronger wording on the creation. Instead of assuming it might fail to create the file, we assume it will always be successful.


We need to generate a default `cpm.yaml` file by running `cpm init` on the terminal, it should create a file that is getting the [Props](https://github.com/CityOfZion/props) smart contract. While it is a useful contract, it's probably not the one you want, in this article, let's suppose we want to easily invoke functions from the [Neo Token contract](https://dora.coz.io/contract/neo3/mainnet/0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5).

The `cpm.yaml` is divided into 4 different sections that will be tweaked to generate the desired SDK:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `cpm.yaml` is divided into 4 different sections that will be tweaked to generate the desired SDK:
The configuration file is divided into 4 different sections that will be tweaked to generate the desired SDK:


The `cpm.yaml` is divided into 4 different sections that will be tweaked to generate the desired SDK:
- `defaults`: will indicate that we want to generate an off-chain TypeScript SDK inside the `src` folder and that we don't want to download the NEF and manifest;
- `contracts`: will have the Neo Token contract that we want to generate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `contracts`: will have the Neo Token contract that we want to generate;
- `contracts`: will have the Neo Token contract that we want to generate an SDK for;

@melanke
Copy link

melanke commented Nov 29, 2023

[RESOLVED]
Also, Apsit mentioned this on Discord:

I recommend adding slug field in the frontmatter so you would get a permanent URL without having a date in it.

see example here https://raw.githubusercontent.com/neo-project/neo-dev-portal/dev/tutorials/2023-10-17-neow3j-nep17/index.md

… cpm for TS offchain sdk generation with neon-dappkit and wcsdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants