dhiway / cord.js

Cord JS API
Apache License 2.0
34 stars 46 forks source link

Update README #88

Open amarts opened 1 year ago

amarts commented 1 year ago

Description

Make sure README reflects what is in the project, and using README, one is able to complete a demo run. Also it should have links to documentation for further study.

Goals

Expected Outcome

Acceptance Criteria

Following the instructions on the README file, one should be able to set up the dev environment and be able to run the demo script

Implementation Details

NA

Mockups / Wireframes

NA


Product Name

CORD

Organization Name

Dhiway

Domain

Blockchain

Tech Skills Needed

Rust build tool chain

Mentor(s)

@amarts @NiranjanAP

Complexity

Low

Category

Documentation

Sub Category

Beginner friendly

StillAbeginnerr commented 6 months ago

I want to take up the issue, Assign me, please.

amarts commented 6 months ago

@StillAbeginnerr feel free to work on it and while submitting refer to this issue (#88).

StillAbeginnerr commented 6 months ago

Using Github Desktop, I cloned the repository and then first tried with the following.

npm install cord.network/sdk 
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/cord.network/sdk.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

Then The following to get the node modules installed

npm i
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*

npm ERR! A complete log of this run can be found in: C:\Users\Shiva\AppData\Local\npm-cache\_logs\2023-12-15T16_36_57_461Z-debug-0.log

This problem persists. I checked my possible ways to work with it via Chatgpt and Other Tools like Stackoverflow. Need some tips regarding this issue. @amarts

amarts commented 6 months ago

Did you miss the '@'... It's npm install @cord.network/sdk

adi-a11y commented 6 months ago

Using Github Desktop, I cloned the repository and then first tried with the following.

npm install cord.network/sdk 
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/cord.network/sdk.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

Then The following to get the node modules installed

npm i
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*

npm ERR! A complete log of this run can be found in: C:\Users\Shiva\AppData\Local\npm-cache\_logs\2023-12-15T16_36_57_461Z-debug-0.log

This problem persists. I checked my possible ways to work with it via Chatgpt and Other Tools like Stackoverflow. Need some tips regarding this issue. @amarts

@StillAbeginnerr, Can you please try using yarn instead of npm?

StillAbeginnerr commented 6 months ago

Did you miss the '@'... It's npm install @cord.network/sdk

It gives another error

PS C:\Users\Shiva\OneDrive\Pictures\cord.js> npm install @cord.network/sdk
At line:1 char:13
+ npm install @cord.network/sdk
+             ~~~~~
The splatting operator '@' cannot be used to reference variables in an expression. '@cord' can be used only as an argument to a command. To reference variables in 
an expression use '$cord'.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : SplattingNotPermitted
StillAbeginnerr commented 6 months ago

Using Github Desktop, I cloned the repository and then first tried with the following.

npm install cord.network/sdk 
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/cord.network/sdk.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

Then The following to get the node modules installed

npm i
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*

npm ERR! A complete log of this run can be found in: C:\Users\Shiva\AppData\Local\npm-cache\_logs\2023-12-15T16_36_57_461Z-debug-0.log

This problem persists. I checked my possible ways to work with it via Chatgpt and Other Tools like Stackoverflow. Need some tips regarding this issue. @amarts

Can you please try using yarn instead of npm?

PS C:\Users\Shiva\OneDrive\Pictures\cord.js> yarn add @cord.network/sdk
At line:1 char:10
+ yarn add @cord.network/sdk
+          ~~~~~
The splatting operator '@' cannot be used to reference variables in an    
expression. '@cord' can be used only as an argument to a command. To      
reference variables in an expression use '$cord'.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRe  
   cordException
    + FullyQualifiedErrorId : SplattingNotPermitted

PS C:\Users\Shiva\OneDrive\Pictures\cord.js> yarn add cord.network/sdk 
Usage Error: The cord.network/sdk string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?

$ yarn add [--json] [-F,--fixed] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--mode #0] ...
StillAbeginnerr commented 6 months ago

@amarts

amarts commented 6 months ago

Wanting to understand what is that is being tried here.

There are 2 things:

  1. Consume this SDK : this is where one needs to install @cord.network/sdk, this is never done on a github codebase, but on a machine where application is using the SDK (think inside a nodejs app, reactjs app, may be used on GNU/Linux CLI, or in docker.

  2. Develop, and improve the SDK: This is a task for developers, once cloned, you would do npm install and npm run build. make changes to code, and run demo scripts, and make sure your changes work.

As a project we need to cover both in documentation. Ideally README should contain the section 1 part, so it can be used in npmjs package page while publishing. The developer part can be a separate page inside the docs/ which may or may not be having a link from README.

In github desktop, you don't need to handle 'npm install @cord.network/sdk, but can just manage the code, andyarn and yarn build`

StillAbeginnerr commented 6 months ago

okay sir, I understand.

what I did was,

  1. Cloned the repository in my system.
  2. Tried to install the node_modules using npm install
  3. got an error regarding installation of node_modules.
  4. tried npm i @cord.network/sdk.
  5. again got an error.
  6. tried npm i cord.network/sdk.
  7. again got an error.
  8. then tried chatgpt to work upon that but didn't work.
  9. so pasted the issue and error here.
StillAbeginnerr commented 6 months ago

same error with yarn

StillAbeginnerr commented 6 months ago

Wanting to understand what is that is being tried here.

There are 2 things:

  1. Consume this SDK : this is where one needs to install @cord.network/sdk, this is never done on a github codebase, but on a machine where application is using the SDK (think inside a nodejs app, reactjs app, may be used on GNU/Linux CLI, or in docker.
  2. Develop, and improve the SDK: This is a task for developers, once cloned, you would do npm install and npm run build. make changes to code, and run demo scripts, and make sure your changes work.

As a project we need to cover both in documentation. Ideally README should contain the section 1 part, so it can be used in npmjs package page while publishing. The developer part can be a separate page inside the docs/ which may or may not be having a link from README.

In github desktop, you don't need to handle 'npm install @cord.network/sdk, but can just manage the code, andyarn and yarn build`

I managed to work successfully with the first pointer that is consuming the SDK but had received errors in running the demo script and the attached screenshot is here where i utilised the Experiment the SDK methods using the following commands. yarn yarn build npx tsx demo/src/func-test.ts npx tsx demo/src/network-score-test.ts

1 2

the error while I tried to run the demo script:

gitpod /workspace/cord.js (develop) $ npx tsx demo/src/func-test.ts node:internal/modules/cjs/loader:1144 const err = new Error(message); ^

Error: Cannot find module './generateKeypairs' Require stack:

Node.js v20.10.0

StillAbeginnerr commented 6 months ago

@adi-a11y sir could you please my issue?

amarts commented 6 months ago

@StillAbeginnerr try npm install @cord.network/sdk@0.9.3-1develop1, and then run the func-test

The issue of the generate is because of #157 . Also make sure you update to latest of develop branch.

StillAbeginnerr commented 6 months ago

I cloned the Latest develop branch and worked but the same issue persists, I thought that running npx tsx demo/src/func-test.ts would show me some demo but somehow I failed again.

I don't understand why it is not referring to utils/key module to get the required library as per issue 157

I looked in the code to see if I could find why the module is missing using issue #157.

image image image image

StillAbeginnerr commented 6 months ago

@amarts @NiranjanAP

NiranjanAP commented 6 months ago

we'll take a look at this and get back

NiranjanAP commented 6 months ago

Pls make the changes as below, test and create a PR.

diff --git a/demo/src/utils/generateDid.ts b/demo/src/utils/generateDid.ts
index f23517b..ec37b89 100644
--- a/demo/src/utils/generateDid.ts
+++ b/demo/src/utils/generateDid.ts
@@ -1,6 +1,5 @@
 import * as Cord from '@cord.network/sdk'
 import { mnemonicGenerate } from '@polkadot/util-crypto'
-import { generateKeypairs } from './generateKeypairs'

 /**
  * It creates a DID on chain, and returns the mnemonic and DID document
@@ -21,7 +20,7 @@ export async function createDid(
     keyAgreement,
     assertionMethod,
     capabilityDelegation,
-  } = generateKeypairs(mnemonic)
+  } = Cord.Utils.Key.generateKeypairs(mnemonic)
   // Get tx that will create the DID on chain and DID-URI that can be used to resolve the DID Document.
   const didCreationTx = await Cord.Did.getStoreTx(
     {
NiranjanAP commented 6 months ago

@StillAbeginnerr
Along with the above changes to fix the generateKeyPair issue, we have also updated the readme to clarify the sdk installation flow.

StillAbeginnerr commented 5 months ago

@NiranjanAP I have noted that and applied, I am confused what is the result (It seems like the server is connected) I don't know if I need to run something else also, and or now just make a documentation on the whole process.

image

StillAbeginnerr commented 5 months ago

image

StillAbeginnerr commented 5 months ago

@NiranjanAP https://github.com/StillAbeginnerr/cord.js/blob/develop/README.md this is my repository and I have made a few changes for the demo script run.

Do I need to include yarn install @cord.network/sdk@0.9.3-1develop1 because the latest didn't work on my system?

Npm didn't work for me, so should i include it in the readme or not?

NiranjanAP commented 5 months ago

Please run a CORD instance locally then run the demo script. Refer CORD repo Readme to run the CORD instance locally

On Sun, 7 Jan, 2024, 5:59 pm shivam agarwal, @.***> wrote:

@NiranjanAP https://github.com/NiranjanAP https://github.com/StillAbeginnerr/cord.js/blob/develop/README.md this is my repository and I have made a few changes for the demo script run.

Do I need to include yarn install @@.*** because the latest didn't work on my system?

Npm didn't work for me, so should i include it in the readme or not?

— Reply to this email directly, view it on GitHub https://github.com/dhiway/cord.js/issues/88#issuecomment-1880046086, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5JWEYTLRXJZDKJOITKJFDYNKILVAVCNFSM6AAAAAAZVKVSE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBQGA2DMMBYGY . You are receiving this because you were mentioned.Message ID: <dhiway/cord .@.***>

NiranjanAP commented 5 months ago

@NiranjanAP https://github.com/StillAbeginnerr/cord.js/blob/develop/README.md this is my repository and I have made a few changes for the demo script run.

Do I need to include yarn install @cord.network/sdk@0.9.3-1develop1 because the latest didn't work on my system?

Npm didn't work for me, so should i include it in the readme or not?

You install sdk only if you are writing a new app and want to consume the sdk, read the updated readme For just running the demo script, you don't need to install the SDK

StillAbeginnerr commented 5 months ago

Okay i got it, thank you :)

NiranjanAP commented 5 months ago

Once you are able to run CORD instance and test the cordjs demo script. Please update the same in this README as a prerequisite and make a PR. It'll help others trying the same. @StillAbeginnerr

StillAbeginnerr commented 5 months ago

Once you are able to run CORD instance and test the cordjs demo script. Please update the same in this README as a prerequisite and make a PR. It'll help others trying the same. @StillAbeginnerr

I'm on it.

Vishalk91-4 commented 5 months ago

@NiranjanAP, could you just brief the steps to start

I mean running yarn, then yarn run build after that I am facing w2s disconnected error for running npx tsx demo/src/func-test.ts

amarts commented 5 months ago

after that I am facing w2s disconnected error for running npx tsx demo/src/func-test.ts

for 'connecting', you would need CORD instance running. On your machine, you should be running a docker instance of cord, or compiled cord to run these scripts. Check the instructions to run cord project locally.

vilol-04 commented 5 months ago

Can I work on this issue?

StillAbeginnerr commented 5 months ago

I'll make a PR by tomorrow. most of the work is done. had health issues so couldn't work on it. please make me assigned to this issue.

Once you are able to run CORD instance and test the cordjs demo script. Please update the same in this README as a prerequisite and make a PR. It'll help others trying the same. @StillAbeginnerr

I'm on it.

NiranjanAP commented 5 months ago

@StillAbeginnerr since we don't track this regularly, it doesn't make sense to assign if it is not being dedicatedly worked upon. However, once the work is done, feel free to assign to yourself and raise a PR.

VishnuAmit commented 2 months ago

Hey @NiranjanAP . I would like to take this issue. Kindly assign it to me. Thanks

scyther commented 2 months ago

Hi , I beleive PR for this issue has been merged . Tried README.md and was able to run yarn demo-statement

Except .nvmrc didn't get the LTS version of Node ( As node LTS needs to be installed first ). A troubleshoot doc can be helpful mentioning to use nvm install lts/*