-
Notifications
You must be signed in to change notification settings - Fork 5
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
md file #179
base: tutorials
Are you sure you want to change the base?
md file #179
Changes from 5 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
fabriziogianni7 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Nevermined SDK Tutorial | ||
|
||
## Overview | ||
|
||
This tutorial demonstrates a basic example of using the Nevermined SDK to interact with the Nevermined network. The provided code, written in TypeScript, initializes the SDK, configures it, and retrieves information about SDK versions. | ||
|
||
## Prerequisites | ||
|
||
Ensure you have the following installed: | ||
|
||
- Node.js | ||
- yarn (Node Package Manager) | ||
|
||
## Setup | ||
|
||
1. Install the Nevermined SDK package: | ||
|
||
``` | ||
yarn && yarn add @nevermined-io/sdk | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
2. Create a TypeScript file (e.g., main.ts) and paste the following code: | ||
```ts | ||
import { Nevermined, NeverminedOptions } from '@nevermined-io/sdk' | ||
|
||
const main = async () => { | ||
const config: NeverminedOptions = { | ||
// The web3 endpoint of the blockchain network to connect to, could be an Infura endpoint, Quicknode, or any other web3 provider | ||
web3ProviderUri: 'https://goerli-rollup.arbitrum.io/rpc', | ||
// The url of the marketplace api if you connect to one. It could be your own service if you run a Marketplace API | ||
marketplaceUri: 'https://marketplace-api.goerli.nevermined.app', | ||
// The url to a Nevermined node. It could be your own if you run a Nevermined Node | ||
neverminedNodeUri: 'https://node.goerli.nevermined.app', | ||
// The public address of the above Node | ||
neverminedNodeAddress: '0x5838B5512cF9f12FE9f2beccB20eb47211F9B0bc', | ||
// The url to access the nevermined subgraphs required to query for on-chain events | ||
graphHttpUri: 'https://api.thegraph.com/subgraphs/name/nevermined-io/public', | ||
// Folder where are copied the ABIs of the Nevermined Smart Contracts | ||
artifactsFolder: './artifacts', | ||
} | ||
|
||
const sdk = await Nevermined.getInstance(config) | ||
console.log(await sdk.utils.versions.get()) | ||
} | ||
|
||
main().then(() => process.exit(0)) | ||
``` | ||
|
||
3. From the root folder run: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe some explanation of what artifacts are and why they are needed would be nice There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put " This will create an "artifacts" folder and download in it the Nevermined smart contract artifacts." |
||
``` | ||
mkdir artifacts && cd artifacts && wget -c https://artifacts.nevermined.network/421613/public/contracts_v3.5.2.tar.gz && tar -xzvf contracts_v3.5.2.tar.gz | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this for the sake of simplicity? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it did not work in the other way |
||
``` | ||
This will create an "artifacts" folder and download in it the Nevermined smart contract artifacts. | ||
|
||
## Running the Code | ||
Execute the following command to run the TypeScript file: | ||
|
||
yarn start | ||
|
||
|
||
This will initialize the Nevermined SDK, configure it with the specified options, and output information about SDK versions. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the root package.json for the entire documentation. any reason why we are doing this?