From dcdd40bd2d2e84058b889709f77c08bead14b299 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 18 Aug 2020 12:12:41 +0200 Subject: [PATCH] formatting --- .eslintrc | 90 +++++++++++++++++++------------------- .travis.yml | 2 +- README.md | 19 ++++---- docs/README_simple_flow.md | 27 +++++++----- 4 files changed, 72 insertions(+), 66 deletions(-) diff --git a/.eslintrc b/.eslintrc index dc907e61..7c4dfbbc 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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 + } } diff --git a/.travis.yml b/.travis.yml index bdd83b56..7475809f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ matrix: before_install: - npm install -g npm - + before_script: - git clone https://github.com/oceanprotocol/barge - cd barge diff --git a/README.md b/README.md index ae5ab068..fb333a63 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,16 @@

Ocean-lib

-`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 diff --git a/docs/README_simple_flow.md b/docs/README_simple_flow.md index 8b5c9bb4..b8c9df5c 100644 --- a/docs/README_simple_flow.md +++ b/docs/README_simple_flow.md @@ -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)