1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Merge pull request #326 from oceanprotocol/feature/bump

bump packages
This commit is contained in:
Matthias Kretschmann 2019-11-07 10:45:46 +01:00 committed by GitHub
commit f3e044ecdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 3080 additions and 1386 deletions

View File

@ -2,7 +2,7 @@ dist: xenial
sudo: required sudo: required
language: node_js language: node_js
node_js: node_js:
- '10' - '11'
services: services:
- docker - docker
@ -22,20 +22,21 @@ before_script:
- git clone https://github.com/oceanprotocol/barge - git clone https://github.com/oceanprotocol/barge
- cd barge - cd barge
- export AQUARIUS_VERSION=v0.3.8 - export AQUARIUS_VERSION=v0.3.8
- export BRIZO_VERSION=v0.4.4 - export BRIZO_VERSION=v0.4.5
- export KEEPER_VERSION=v0.11.1 - export KEEPER_VERSION=v0.12.7
- export EVENTS_HANDLER_VERSION=v0.1.2 - export EVENTS_HANDLER_VERSION=v0.1.2
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260" - export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"
- bash -x start_ocean.sh --no-commons --local-spree-node 2>&1 > start_ocean.log & - rm -rf "${HOME}/.ocean/keeper-contracts/artifacts"
- bash -x start_ocean.sh --no-commons --no-dashboard 2>&1 > start_ocean.log &
- cd .. - cd ..
script: script:
- npm run lint - npm run lint
- ./scripts/keeper.sh
- export ETH_PORT=18545; npm run test:cover - export ETH_PORT=18545; npm run test:cover
- npm run build - npm run build
- npm run doc - npm run doc
- export SEED_WORDS="taxi music thumb unique chat sand crew more leg another off lamp"; npm run integration:cover - ./scripts/keeper.sh
- npm run integration:cover
- npm run report-coverage - npm run report-coverage
after_script: after_script:

View File

@ -102,11 +102,12 @@ npm start
### Unit Tests ### Unit Tests
For unit tests, running [`ganache-cli`](https://github.com/trufflesuite/ganache-cli) is required before starting the tests: For unit tests, running [`ganache-cli`](https://github.com/trufflesuite/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 Barge:
```bash ```bash
npm i -g ganache-cli npm i -g ganache-cli
ganache-cli ganache-cli --port 18545
export ETH_PORT=18545
``` ```
To start unit tests, run: To start unit tests, run:

View File

@ -1,4 +1,4 @@
import * as HDWalletProvider from 'truffle-hdwallet-provider' import HDWalletProvider from '@truffle/hdwallet-provider'
import { Config } from '../src' import { Config } from '../src'
const configJson: Config = { const configJson: Config = {

View File

@ -1,9 +1,6 @@
import { assert } from 'chai' import { assert } from 'chai'
import { config } from '../config' import { config } from '../config'
import { getMetadata } from '../utils' import { getMetadata } from '../utils'
import { Ocean, Account } from '../../src' // @oceanprotocol/squid import { Ocean, Account } from '../../src' // @oceanprotocol/squid
describe('Asset Owners', () => { describe('Asset Owners', () => {
@ -25,15 +22,14 @@ describe('Asset Owners', () => {
} }
}) })
it('should be set correctly the owner of an asset', async () => { it('should set the owner of an asset', async () => {
const ddo = await ocean.assets.create(metadata as any, account1) const ddo = await ocean.assets.create(metadata as any, account1)
const owner = await ocean.assets.owner(ddo.id) const owner = await ocean.assets.owner(ddo.id)
assert.equal(owner, account1.getId()) assert.equal(owner, account1.getId())
}) })
it('should be set correctly the provider of an asset', async () => { it('should set the provider of an asset', async () => {
const ddo = await ocean.assets.create(metadata as any, account1) const ddo = await ocean.assets.create(metadata as any, account1)
const isProvider = await ocean.keeper.didRegistry.isDIDProvider( const isProvider = await ocean.keeper.didRegistry.isDIDProvider(
@ -61,7 +57,7 @@ describe('Asset Owners', () => {
assert.equal(finalLength - initialLength, 1) assert.equal(finalLength - initialLength, 1)
}) })
it('should get the assets that can be consumer by a user', async () => { it('should get the assets that can be consumed by a user', async () => {
const { length: initialLength } = await ocean.assets.consumerAssets( const { length: initialLength } = await ocean.assets.consumerAssets(
account2.getId() account2.getId()
) )

View File

@ -17,7 +17,7 @@ describe('Signature', () => {
;[consumer] = await ocean.accounts.list() ;[consumer] = await ocean.accounts.list()
}) })
it('should generate the correct signature', async () => { it('hashServiceAgreement should generate the correct signature', () => {
const templateId = `0x${'f'.repeat(40)}` const templateId = `0x${'f'.repeat(40)}`
const agreementId = `0x${'e'.repeat(64)}` const agreementId = `0x${'e'.repeat(64)}`
@ -25,7 +25,7 @@ describe('Signature', () => {
const lockId = `0x${'b'.repeat(64)}` const lockId = `0x${'b'.repeat(64)}`
const escrowId = `0x${'c'.repeat(64)}` const escrowId = `0x${'c'.repeat(64)}`
const hash = await ocean.utils.agreements.hashServiceAgreement( const hash = ocean.utils.agreements.hashServiceAgreement(
templateId, templateId,
agreementId, agreementId,
[accessId, lockId, escrowId], [accessId, lockId, escrowId],
@ -36,11 +36,11 @@ describe('Signature', () => {
assert.equal( assert.equal(
hash, hash,
'0x67901517c18a3d23e05806fff7f04235cc8ae3b1f82345b8bfb3e4b02b5800c7', '0x67901517c18a3d23e05806fff7f04235cc8ae3b1f82345b8bfb3e4b02b5800c7',
'The signatuere is not correct.' 'The signature is not correct.'
) )
}) })
it('should generate the correct signature', async () => { it('signServiceAgreement should generate the correct signature', async () => {
const { templates } = ocean.keeper const { templates } = ocean.keeper
const did = `did:op:${'c'.repeat(64)}` const did = `did:op:${'c'.repeat(64)}`
@ -86,8 +86,8 @@ describe('Signature', () => {
assert.equal( assert.equal(
signature, signature,
'0x3aa8a1c48b8e582d694bbd4ba3a29fde573b78da9720dc48baeb831b2163e1fa6e10e983882ebf8a00f4124de2505136354fd146934053f0d58bba4eced5f8d000', '0x3aa8a1c48b8e582d694bbd4ba3a29fde573b78da9720dc48baeb831b2163e1fa6e10e983882ebf8a00f4124de2505136354fd146934053f0d58bba4eced5f8d01b',
'The signatuere is not correct.' 'The signature is not correct.'
) )
}) })
}) })

View File

@ -2,6 +2,7 @@
"compilerOptions": { "compilerOptions": {
"resolveJsonModule": true, "resolveJsonModule": true,
"lib": ["es6", "es7", "dom"], "lib": ["es6", "es7", "dom"],
"noUnusedLocals": true "noUnusedLocals": true,
"esModuleInterop": true
} }
} }

View File

@ -7,11 +7,11 @@
"dependencies": [ "dependencies": [
{ {
"name": "keeper-contracts", "name": "keeper-contracts",
"version": "~0.11.1" "version": "~0.12.7"
}, },
{ {
"name": "brizo", "name": "brizo",
"version": "~0.4.2" "version": "~0.4.5"
}, },
{ {
"name": "aquarius", "name": "aquarius",

4312
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -52,47 +52,47 @@
"web3": "^1.2.0" "web3": "^1.2.0"
}, },
"dependencies": { "dependencies": {
"@oceanprotocol/keeper-contracts": "^0.12.4", "@oceanprotocol/keeper-contracts": "^0.12.7",
"@oceanprotocol/secret-store-client": "0.0.15", "@oceanprotocol/secret-store-client": "^0.0.15",
"bignumber.js": "^9.0.0", "bignumber.js": "^9.0.0",
"deprecated-decorator": "^0.1.6", "deprecated-decorator": "^0.1.6",
"node-fetch": "^2.6.0", "node-fetch": "^2.6.0",
"save-file": "^2.3.1", "save-file": "^2.3.1",
"uuid": "^3.3.3", "uuid": "^3.3.3",
"web3": "1.2.1", "web3": "1.2.1",
"whatwg-url": "^7.0.0" "whatwg-url": "^7.1.0"
}, },
"devDependencies": { "devDependencies": {
"@release-it/bumper": "^1.0.3", "@release-it/bumper": "^1.0.5",
"@types/chai": "^4.2.2", "@truffle/hdwallet-provider": "^1.0.23",
"@types/chai": "^4.2.4",
"@types/chai-spies": "^1.0.1", "@types/chai-spies": "^1.0.1",
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
"@types/node": "^12.7.5", "@types/node": "^12.12.5",
"@types/node-fetch": "^2.5.0", "@types/node-fetch": "^2.5.3",
"@typescript-eslint/eslint-plugin": "^2.2.0", "@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.2.0", "@typescript-eslint/parser": "^2.6.0",
"auto-changelog": "^1.16.1", "auto-changelog": "^1.16.2",
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-spies": "^1.0.0", "chai-spies": "^1.0.0",
"cross-env": "^6.0.0", "cross-env": "^6.0.3",
"eslint": "^6.3.0", "eslint": "^6.6.0",
"eslint-config-oceanprotocol": "^1.5.0", "eslint-config-oceanprotocol": "^1.5.0",
"eslint-config-prettier": "^6.3.0", "eslint-config-prettier": "^6.5.0",
"eslint-plugin-prettier": "^3.1.0", "eslint-plugin-prettier": "^3.1.1",
"lcov-result-merger": "^3.1.0", "lcov-result-merger": "^3.1.0",
"mocha": "^6.2.0", "mocha": "^6.2.2",
"mock-local-storage": "^1.1.8", "mock-local-storage": "^1.1.8",
"nyc": "^14.1.1", "nyc": "^14.1.1",
"ora": "^4.0.0", "ora": "^4.0.2",
"prettier": "^1.18.2", "prettier": "^1.18.2",
"source-map-support": "^0.5.13", "source-map-support": "^0.5.16",
"truffle-hdwallet-provider": "^1.0.17", "ts-node": "^8.4.1",
"ts-node": "^8.3.0",
"typedoc": "^0.15.0", "typedoc": "^0.15.0",
"typescript": "^3.6.3", "typescript": "^3.6.4",
"uglifyjs-webpack-plugin": "^2.2.0", "uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.40.1", "webpack": "^4.41.2",
"webpack-cli": "^3.3.8", "webpack-cli": "^3.3.10",
"webpack-merge": "^4.2.2" "webpack-merge": "^4.2.2"
}, },
"nyc": { "nyc": {
@ -122,7 +122,8 @@
"@release-it/bumper": { "@release-it/bumper": {
"out": [ "out": [
"package.json", "package.json",
"package-lock.json" "package-lock.json",
"dist/squid-js.json"
] ]
} }
}, },

View File

@ -1,4 +1,4 @@
import * as Web3 from 'web3' import Web3 from 'web3'
import Config from './models/Config' import Config from './models/Config'
import { Logger, LoggerInstance, LogLevel } from './utils' import { Logger, LoggerInstance, LogLevel } from './utils'
import Web3Provider from './keeper/Web3Provider' import Web3Provider from './keeper/Web3Provider'

View File

@ -1,4 +1,4 @@
import * as Web3 from 'web3' import Web3 from 'web3'
import Web3Provider from '../keeper/Web3Provider' import Web3Provider from '../keeper/Web3Provider'
import LoggerInstance from '../utils/Logger' import LoggerInstance from '../utils/Logger'
import { Ocean } from '../ocean/Ocean' import { Ocean } from '../ocean/Ocean'

View File

@ -20,7 +20,7 @@ export class ContractEvent {
public subscribe( public subscribe(
callback: (events: any[]) => void callback: (events: any[]) => void
): ContractEventSubscription { ): ContractEventSubscription {
const onEvent = async blockNumber => { const onEvent = async (blockNumber: number) => {
const events = await this.contract.getEventData(this.eventName, { const events = await this.contract.getEventData(this.eventName, {
filter: this.filter, filter: this.filter,
fromBlock: blockNumber, fromBlock: blockNumber,

View File

@ -1,4 +1,4 @@
import * as Web3 from 'web3' import Web3 from 'web3'
import Config from '../models/Config' import Config from '../models/Config'
export default class Web3Provider { export default class Web3Provider {

View File

@ -24,7 +24,7 @@ export class SignatureUtils extends Instantiable {
this.logger.warn('Error on personal sign.') this.logger.warn('Error on personal sign.')
this.logger.warn(e) this.logger.warn(e)
try { try {
return await this.web3.eth.sign(text, publicKey, password) return await this.web3.eth.sign(text, publicKey)
} catch (e2) { } catch (e2) {
this.logger.error('Error on sign.') this.logger.error('Error on sign.')
this.logger.error(e2) this.logger.error(e2)

View File

@ -1,4 +1,4 @@
import * as assert from 'assert' import assert from 'assert'
import * as squid from '../src/squid' import * as squid from '../src/squid'
describe('Squid', () => { describe('Squid', () => {

View File

@ -1,6 +1,5 @@
import { assert, spy, use } from 'chai' import { assert, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import { Ocean } from '../../src/ocean/Ocean' import { Ocean } from '../../src/ocean/Ocean'
import { Aquarius, SearchQuery } from '../../src/aquarius/Aquarius' import { Aquarius, SearchQuery } from '../../src/aquarius/Aquarius'
import { DDO } from '../../src/ddo/DDO' import { DDO } from '../../src/ddo/DDO'

View File

@ -5,7 +5,7 @@ LoggerInstance.setLevel(LogLevel.Error)
export default { export default {
aquariusUri: 'http://localhost:5000', aquariusUri: 'http://localhost:5000',
brizoUri: 'http://localhost:3000', brizoUri: 'http://localhost:8030',
nodeUri: `http://localhost:${process.env.ETH_PORT || 8545}`, nodeUri: `http://localhost:${process.env.ETH_PORT || 8545}`,
parityUri: 'http://localhost:9545', parityUri: 'http://localhost:9545',
secretStoreUri: 'http://localhost:12001', secretStoreUri: 'http://localhost:12001',

View File

@ -1,6 +1,6 @@
import { assert, expect, spy, use } from 'chai' import { assert, expect, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import * as Web3 from 'web3' import Web3 from 'web3'
import { DDO } from '../../src/ddo/DDO' import { DDO } from '../../src/ddo/DDO'
import { Service } from '../../src/ddo/Service' import { Service } from '../../src/ddo/Service'
@ -177,7 +177,7 @@ describe('DDO', () => {
beforeEach(async () => { beforeEach(async () => {
await TestContractHandler.prepareContracts() await TestContractHandler.prepareContracts()
ocean = await Ocean.getInstance(config) ocean = await Ocean.getInstance(config)
web3 = (ocean as any).web3 ;({ web3 } = ocean as any)
}) })
afterEach(() => { afterEach(() => {

View File

@ -22,7 +22,7 @@ describe('ContractEvent', () => {
}) })
describe('#subscribe()', () => { describe('#subscribe()', () => {
it('should listen the events', async () => { it('should be able to listen to events', async () => {
const event = eventHandler.getEvent( const event = eventHandler.getEvent(
ocean.keeper.token, ocean.keeper.token,
'Transfer', 'Transfer',
@ -55,7 +55,7 @@ describe('ContractEvent', () => {
}) })
describe('#once()', () => { describe('#once()', () => {
it('should listen only once', async () => { it('should listen to event only once', async () => {
const to = account const to = account
const event = eventHandler.getEvent( const event = eventHandler.getEvent(
ocean.keeper.token, ocean.keeper.token,
@ -65,7 +65,7 @@ describe('ContractEvent', () => {
let canBeRejected = false let canBeRejected = false
const waitUntilEvent = new Promise((resolve, reject) => { const waitUntilEvent = new Promise((resolve, reject) => {
event.once(events => { event.once(() => {
if (canBeRejected) { if (canBeRejected) {
reject(new Error('')) reject(new Error(''))
} }

View File

@ -1,5 +1,5 @@
import { assert, expect, spy, use } from 'chai' import { assert, expect, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import { EventHandler } from '../../src/keeper/EventHandler' import { EventHandler } from '../../src/keeper/EventHandler'
import { Ocean } from '../../src/ocean/Ocean' import { Ocean } from '../../src/ocean/Ocean'
import config from '../config' import config from '../config'

View File

@ -1,4 +1,4 @@
import * as assert from 'assert' import assert from 'assert'
import DID from '../../src/ocean/DID' import DID from '../../src/ocean/DID'
describe('DID', () => { describe('DID', () => {

View File

@ -1,5 +1,5 @@
import { assert, spy, use } from 'chai' import { assert, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import { SearchQuery } from '../../src/aquarius/Aquarius' import { SearchQuery } from '../../src/aquarius/Aquarius'
import Account from '../../src/ocean/Account' import Account from '../../src/ocean/Account'
@ -25,7 +25,7 @@ describe('Ocean', () => {
}) })
describe('#getInstance()', () => { describe('#getInstance()', () => {
it('should get an instance of cean', async () => { it('should get an instance of Ocean', async () => {
const oceanInstance: Ocean = await Ocean.getInstance(config) const oceanInstance: Ocean = await Ocean.getInstance(config)
assert(oceanInstance) assert(oceanInstance)

View File

@ -1,5 +1,5 @@
import { assert, spy, use } from 'chai' import { assert, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import config from '../config' import config from '../config'
import Account from '../../src/ocean/Account' import Account from '../../src/ocean/Account'

View File

@ -1,5 +1,5 @@
import { assert, expect, spy, use } from 'chai' import { assert, expect, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import config from '../config' import config from '../config'
import Account from '../../src/ocean/Account' import Account from '../../src/ocean/Account'

View File

@ -1,5 +1,5 @@
import { assert, expect, spy, use } from 'chai' import { assert, expect, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import Account from '../../src/ocean/Account' import Account from '../../src/ocean/Account'
import { Ocean } from '../../src/ocean/Ocean' import { Ocean } from '../../src/ocean/Ocean'

View File

@ -1,5 +1,5 @@
import { assert, expect, spy, use } from 'chai' import { assert, expect, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import config from '../../config' import config from '../../config'

View File

@ -1,10 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"resolveJsonModule": true, "resolveJsonModule": true,
"lib": [ "lib": ["es6", "es7"],
"es6", "noUnusedLocals": true,
"es7" "esModuleInterop": true
],
"noUnusedLocals": true
} }
} }

View File

@ -1,5 +1,5 @@
import { assert, expect, spy, use } from 'chai' import { assert, expect, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import { SubscribableObserver } from '../../src/utils/SubscribableObserver' import { SubscribableObserver } from '../../src/utils/SubscribableObserver'

View File

@ -1,5 +1,5 @@
import { assert, expect, spy, use } from 'chai' import { assert, expect, spy, use } from 'chai'
import * as spies from 'chai-spies' import spies from 'chai-spies'
import { SubscribablePromise } from '../../src/utils/SubscribablePromise' import { SubscribablePromise } from '../../src/utils/SubscribablePromise'

View File

@ -6,6 +6,7 @@
"declaration": true, "declaration": true,
"module": "commonjs", "module": "commonjs",
"target": "es5", "target": "es5",
"esModuleInterop": true,
"noImplicitAny": false, "noImplicitAny": false,
"removeComments": true, "removeComments": true,
"experimentalDecorators": true, "experimentalDecorators": true,