1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

formatting

This commit is contained in:
Matthias Kretschmann 2020-08-18 12:12:41 +02:00
parent ffad644d73
commit dcdd40bd2d
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 72 additions and 66 deletions

View File

@ -1,49 +1,49 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": false
},
"project": [
"./tsconfig.json",
"./test/unit/tsconfig.json",
"./test/integration/tsconfig.json"
]
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": false
},
"extends": [
"oceanprotocol",
"prettier/standard",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint"
"project": [
"./tsconfig.json",
"./test/unit/tsconfig.json",
"./test/integration/tsconfig.json"
]
},
"extends": [
"oceanprotocol",
"prettier/standard",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint"
],
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"@typescript-eslint/member-delimiter-style": [
"error",
{ "multiline": { "delimiter": "none" } }
],
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"@typescript-eslint/member-delimiter-style": [
"error",
{ "multiline": { "delimiter": "none" } }
],
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-object-literal-type-assertion": "off",
"@typescript-eslint/no-parameter-properties": "off",
"no-empty": ["error", { "allowEmptyCatch": true }],
"prefer-destructuring": ["warn"],
"no-dupe-class-members": ["warn"],
"no-useless-constructor": ["warn"],
"dot-notation": 0
},
"env": {
"es6": true,
"browser": true,
"mocha": true
}
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-object-literal-type-assertion": "off",
"@typescript-eslint/no-parameter-properties": "off",
"no-empty": ["error", { "allowEmptyCatch": true }],
"prefer-destructuring": ["warn"],
"no-dupe-class-members": ["warn"],
"no-useless-constructor": ["warn"],
"dot-notation": 0
},
"env": {
"es6": true,
"browser": true,
"mocha": true
}
}

View File

@ -14,7 +14,7 @@ matrix:
before_install:
- npm install -g npm
before_script:
- git clone https://github.com/oceanprotocol/barge
- cd barge

View File

@ -4,15 +4,16 @@
<h1 align="center">Ocean-lib</h1>
`ocean-lib` is a Javascript library to privately & securely publish, exchange,
`ocean-lib` is a Javascript library to privately & securely publish, exchange,
and consume data. With it, you can:
* **Publish** data services: downloadable files, streaming data, or compute-to-data.
Ocean creates a new [ERC20](https://github.com/ethereum/EIPs/blob/7f4f0377730f5fc266824084188cc17cf246932e/EIPS/eip-20.md)
data token for each data service or set of services.
* **Mint** data tokens for the service
* **Consume** data tokens, to access the service
* **Transfer** data tokens to another owner, and **all other ERC20 actions**
using [web3.js](https://web3js.readthedocs.io/en/v1.2.9/web3-eth-contract.html) etc.
- **Publish** data services: downloadable files, streaming data, or compute-to-data.
Ocean creates a new [ERC20](https://github.com/ethereum/EIPs/blob/7f4f0377730f5fc266824084188cc17cf246932e/EIPS/eip-20.md)
data token for each data service or set of services.
- **Mint** data tokens for the service
- **Consume** data tokens, to access the service
- **Transfer** data tokens to another owner, and **all other ERC20 actions**
using [web3.js](https://web3js.readthedocs.io/en/v1.2.9/web3-eth-contract.html) etc.
`ocean-lib` is part of the [Ocean Protocol](https://oceanprotocol.com) toolset.
@ -20,7 +21,7 @@ This is in alpha state and you can expect running into problems. If you run into
## Quick Install
```npm i @oceanprotocol/lib```
`npm i @oceanprotocol/lib`
## Quickstart: Simple Flow

View File

@ -1,11 +1,11 @@
# ocean-lib
`ocean-lib-js` is a Javascript/Typescript library to privately & securely publish, exchange, and consume data. With it, you can:
* **Publish** data services: static data, streaming data, or compute-to-data. Every data service gets its own [ERC20](https://github.com/ethereum/EIPs/blob/7f4f0377730f5fc266824084188cc17cf246932e/EIPS/eip-20.md) token.
* **Mint** data tokens for a given data service
* **Transfer** data tokens to another owner
* **Consume** data tokens, to access the service
- **Publish** data services: static data, streaming data, or compute-to-data. Every data service gets its own [ERC20](https://github.com/ethereum/EIPs/blob/7f4f0377730f5fc266824084188cc17cf246932e/EIPS/eip-20.md) token.
- **Mint** data tokens for a given data service
- **Transfer** data tokens to another owner
- **Consume** data tokens, to access the service
`ocean-lib-js` is part of the [Ocean Protocol](www.oceanprotocol.com) toolset.
@ -14,6 +14,7 @@
```
npm i --save @oceanprotocol/lib
```
# Usage
```
@ -30,6 +31,7 @@ const { Ocean, Logger } = require('@oceanprotocol/lib')
This section describes a flow with the simplest transfer of value, for static data.
Here's the steps.
1. Alice publishes a dataset (= publishes a datatoken contract)
1. Alice mints 100 tokens
1. Alice transfers 1 token to Bob
@ -37,17 +39,18 @@ Here's the steps.
Let's go through each of these in detail.
## 1. Alice publishes a dataset (= publishes a datatoken contract)
For now, you're Alice:) Let's proceed.
Run `ganache-cli` locally:
```bash
ganache-cli
```
Then proceed in with your code:
```javascript
const tokenAmount = 100
const transferAmount = 1
@ -56,10 +59,14 @@ const blob = 'http://localhost:8030/api/v1/provider/services'
const alice = await ocean.accounts.list()[0]
const bob = await ocean.accounts.list()[0]
// create datatoken class
const datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
const datatoken = new DataTokens(
contracts.factoryAddress,
factoryABI,
datatokensABI,
web3
)
// deploy datatoken
const tokenAddress = await datatoken.create(blob, alice)
```
## 2. Alice hosts the dataset
@ -90,10 +97,8 @@ const transactionId = ts['transactionHash']
Now, you are Bob :)
```javascript
const config = new Config()
const config = new Config()
const ocean = await Ocean.getInstance()
await ocean.assets.download(tokenAddress, blob, transactionId, bob)