1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00
🦑 JavaScript client library for Ocean Protocol
Go to file
2019-04-10 15:54:43 +02:00
.github Standardize contrib guidelines across public repos 2018-11-30 15:34:50 +01:00
integration Fix environment issues on Travis. 2019-04-09 16:57:16 +02:00
plugins webpack package builder 2018-11-26 15:55:09 +01:00
scripts Be able to download a specific file of an asset. 2019-04-04 10:08:03 +02:00
src lint fixes 2019-04-10 12:30:17 +02:00
test Use the new Aquarius response type. 2019-04-05 16:11:04 +02:00
.bumpversion.cfg Bump version 0.5.2 -> 0.5.3. 2019-04-09 18:00:39 +02:00
.editorconfig included .editorconfig #66 2019-01-07 17:40:04 +01:00
.gitignore Revert "workaround: installing custom truffle-hdwallet-provider" 2019-02-13 12:00:11 +01:00
.npmignore added doc script 2018-10-10 11:46:02 +02:00
.travis.yml Fix environment issues on Travis. 2019-04-09 16:57:16 +02:00
bumpversion.sh added bumpversion 2018-11-06 11:46:40 +01:00
CHANGELOG.md Bump version 0.5.2 -> 0.5.3. 2019-04-09 18:00:39 +02:00
library.json Fix environment issues on Travis. 2019-04-09 16:57:16 +02:00
LICENSE Initial commit 2018-08-20 15:42:24 +02:00
package-lock.json Upgrade dependencies. 2019-04-10 11:23:47 +02:00
package.json Upgrade dependencies. 2019-04-10 11:23:47 +02:00
README.md formatting, fix tuna link 2019-02-11 16:43:17 +01:00
SQUID_INTERFACE.md correct link 2019-02-11 16:43:17 +01:00
tsconfig.json Add consume support for browsers. 2019-04-09 16:57:16 +02:00
tslint.json Fix linter errors. 2019-03-18 13:37:49 +01:00
webpack.common.js Add consume support for browsers. 2019-04-09 16:57:16 +02:00
webpack.config.js webpack package builder 2018-11-26 15:55:09 +01:00
webpack.development.js webpack package builder 2018-11-26 15:55:09 +01:00
webpack.parts.js use compiled typescript instead of ts-loader to generate minified versions 2018-11-28 12:12:58 +01:00
webpack.production.js webpack package builder 2018-11-26 15:55:09 +01:00

banner

squid-js

🦑 JavaScript client library for Ocean Protocol oceanprotocol.com

npm Travis (.com) GitHub contributors Codacy Badge js oceanprotocol Greenkeeper badge


🐲🦑 THERE BE DRAGONS AND SQUIDS. This is in alpha state and you can expect running into problems. If you run into them, please open up a new issue. 🦑🐲



Get started

Start by adding the package to your dependencies:

npm i @oceanprotocol/squid --save

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

// ES6
import { Ocean, Logger } from '@oceanprotocol/squid'

// ES2015
const { Ocean, Logger } = require('@oceanprotocol/squid')

You can then connect to a running Keeper & Aquarius instance, e.g.:

const ocean: Ocean = await Ocean.getInstance({
    // the node of the blockchain to connect to, could also be infura
    nodeUri: "http://localhost:8545",
    // the uri of aquarius
    aquariusUri: "http://localhost:5000",
    // the uri of brizo
    brizoUri: "http://localhost:8030",
    // the uri to the parity node you want to use for encryption and decryption
    parityUri: "http://localhost:9545",
    // the uri of the secret store that holds the keys
    secretStoreUri: "http://localhost:12001",
    // the threshold of nodes from the secre store that have to agree to the decrypt
    threshold: 0,
    // the password for the account (in the local parity node) used to sign messages for secret store
    password: "you password",
    // the address of the account (in the local parity node) used to sign messages for secret store
    address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
})

Examples

Documentation

Docs: squid-js API Reference →

Alternatively, you can generate the raw TypeDoc documentation locally by running:

# will output to ./doc folder
npm run doc

Development

To start development you need to:

npm i
npm start

Testing

To start unit tests you need to:

ganache-cli &
npm run test

or to watch for changes

ganache-cli &
npm run test:watch

to create code coverage

ganache-cli &
npm run test:cover

This will start a watcher for changes of the code.

ganache-cli can be installed following this instructions.

Production build

npm run build

npm releases

For a new patch release, execute on the machine where you're logged into your npm account:

./bumpversion path

git tag with the latest version and git push

License

Copyright 2018 Ocean Protocol Foundation Ltd.

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.