3.0.0-rc24 • Published 19 hours ago

@nevermined-io/sdk v3.0.0-rc24

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
19 hours ago

banner

Javascript/Typescript API for Nevermined Data platform

Javascript SDK for connecting with Nevermined Data Platform nevermined.io

CI Build


Table of Contents


Get started

Start by adding the package to your dependencies:

npm i @nevermined-io/sdk

The package exposes Nevermined and Logger which you can import in your code like this:

// ES6
import { Nevermined, Logger } from '@nevermined-io/sdk'

// ES2015
const { Nevermined, Logger } = require('@nevermined-io/sdk')

You can then connect to the Smart Contracts, Metadata API, Nevermined Node instances, e.g.:

const nevermined: Nevermined = await Nevermined.getInstance({
  // the node of the blockchain to connect to, could also be infura
  web3ProviderUri: 'http://localhost:8545',
  // the uri of metadata
  metadataUri: 'http://localhost:5000',
  // the uri of nevermined node
  neverminedNodeUri: 'http://localhost:8030',
  // the uri of faucet
  faucetUri: 'http://localhost:3001',
  // address that node uses
  neverminedNodeAddress: '0x00bd138abd70e2f00903268f3db08f2d25677c9e',
})

Examples

You can see how nevermined-sdk-js is used on:

Documentation

You can generate the raw TypeDoc documentation locally by running:

# will output to ./doc folder
npm run doc

Migration Guide

Instructions on how to migrate between breaking versions:

Development

To start development you need to:

npm i
npm start

Testing

Unit Tests

For unit tests, running ganache-cli is required before starting the tests. It's best to start it on a different port so it doesn't clash with anything running in Nevermined Tools:

npm i -g ganache-cli
ganache-cli --port 18545
export ETH_PORT=18545

To start unit tests, run:

npm test

or to watch for changes:

npm run test:watch

to create code coverage information:

npm run test:cover

Integration Tests

Besides a running ganache-cli instance, a locally running Nevermined network is required. To do so before running the tests, use Nevermined Tools:

git clone https://github.com/nevermined-io/tools
cd tools

./start_nevermined.sh --no-marketplace

In another terminal window, run this script and export the seed phrase:

# copies the contract artifacts once the local Nevermined network is up and running
./scripts/wait-nevermined.sh

# export local accounts seed phrase
export SEED_WORDS="taxi music thumb unique chat sand crew more leg another off lamp"

Once everything is up, run the integration tests:

npm run integration

to generate code coverage information during test, run:

npm run integration:cover

Code Style

For linting and auto-formatting you can use:

# lint all ts with eslint
npm run lint

# auto format all ts with prettier, taking all configs into account
npm run format

Production build

To create a production build:

npm run build

Releases

From a clean main branch you can run any release task doing the following:

  • bumps the project version in package.json, package-lock.json
  • auto-generates and updates the CHANGELOG.md file from commit messages
  • creates a Git tag
  • commits and pushes everything
  • creates a GitHub release with commit messages as description
  • Git tag push will trigger Travis to do a npm release

You can execute the script using arguments to bump the version accordingly:

  • To bump a patch version: npm run release
  • To bump a minor version: npm run release minor
  • To bump a major version: npm run release major

For the GitHub releases steps a GitHub personal access token, exported as GITHUB_TOKEN is required. Setup

Attribution

This library is based in the Ocean Protocol Squid JS library. It keeps the same Apache v2 License and adds some improvements. See NOTICE file.

License

Copyright 2022 Nevermined AG
This product includes software developed at
BigchainDB GmbH and Ocean Protocol (https://www.oceanprotocol.com/)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
3.0.0-rc24

19 hours ago

3.0.0-rc23

23 hours ago

3.0.0-rc22

2 days ago

3.0.0-rc21

2 days ago

3.0.0-rc20

2 days ago

3.0.0-rc19

3 days ago

3.0.0-rc18

3 days ago

3.0.0-rc15

4 days ago

3.0.0-rc14

4 days ago

3.0.0-rc17

4 days ago

3.0.0-rc16

4 days ago

3.0.0-rc11

5 days ago

3.0.0-rc10

5 days ago

3.0.0-rc13

5 days ago

3.0.0-rc12

5 days ago

3.0.0-rc9

8 days ago

3.0.0-rc8

9 days ago

3.0.0-rc7

9 days ago

3.0.0-rc6

10 days ago

3.0.0-rc5

15 days ago

3.0.0-rc4

15 days ago

3.0.0-rc2

17 days ago

3.0.0-rc3

17 days ago

3.0.0-rc1

18 days ago

3.0.0-rc0

19 days ago

2.2.18

26 days ago

2.2.17

30 days ago

2.2.15

1 month ago

2.2.16

1 month ago

2.2.13

1 month ago

2.2.14

1 month ago

2.2.12

1 month ago

2.2.11

1 month ago

2.2.10

1 month ago

2.2.9

2 months ago

2.2.8

2 months ago

2.2.7

2 months ago

2.2.5

2 months ago

2.2.4

2 months ago

2.2.6

2 months ago

2.2.3

2 months ago

2.2.2

2 months ago

2.2.1

2 months ago

2.2.0

2 months ago

2.2.0-rc1

2 months ago

2.1.4

2 months ago

2.1.3

3 months ago

2.1.3-rc0

3 months ago

2.1.2

3 months ago

2.1.1

3 months ago

2.1.0

4 months ago

2.0.8

4 months ago

1.6.3

7 months ago

1.6.2

8 months ago

1.6.1

8 months ago

1.6.0

10 months ago

2.0.3

6 months ago

2.0.2

6 months ago

2.0.5

5 months ago

2.0.4

5 months ago

2.0.7

5 months ago

2.0.6

5 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.6.0-rc1

10 months ago

1.6.0-rc0

10 months ago

2.0.0-rc7

9 months ago

2.0.0-rc6

9 months ago

1.5.4

10 months ago

2.0.0-rc20

6 months ago

2.0.0-rc5

9 months ago

2.0.0-rc4

9 months ago

2.0.0-rc3

9 months ago

2.0.0-rc2

9 months ago

2.0.0-rc1

9 months ago

2.0.0-rc0

9 months ago

2.0.0-rc9

8 months ago

2.0.0-rc8

8 months ago

2.0.0-rc15

7 months ago

2.0.0-rc16

7 months ago

2.0.0-rc17

7 months ago

2.0.0-rc18

6 months ago

2.0.0-rc11

7 months ago

2.0.0-rc12

7 months ago

2.0.0-rc13

7 months ago

2.0.0-rc14

7 months ago

2.0.0-rc10

7 months ago

2.0.0-rc19

6 months ago

1.5.3

10 months ago

1.3.7

12 months ago

1.4.4

11 months ago

1.5.2

10 months ago

1.4.3

11 months ago

1.5.1

10 months ago

1.4.2

11 months ago

1.5.0

10 months ago

1.4.1

11 months ago

1.4.0

11 months ago

1.3.10

12 months ago

1.4.2-rc1

11 months ago

1.3.13

11 months ago

1.3.14

11 months ago

1.3.11

12 months ago

1.4.2-rc0

11 months ago

1.3.12

11 months ago

1.3.15

11 months ago

1.3.16

11 months ago

1.3.9

12 months ago

1.3.8

12 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.4-rc0

1 year ago

1.3.0

1 year ago

1.0.0

1 year ago

1.0.0-rc22

1 year ago

1.0.0-rc21

1 year ago