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

Merge branch 'main' into fix/logger

This commit is contained in:
Ahmed Ali 2020-10-21 11:05:40 +02:00 committed by GitHub
commit 19b009d8e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 218 additions and 37 deletions

View File

@ -4,8 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [v0.6.6](https://github.com/oceanprotocol/ocean.js/compare/v0.6.5...v0.6.6)
- add datatokeninfo to ddo creation [`#382`](https://github.com/oceanprotocol/ocean.js/pull/382)
- fix getOrderHistory [`#381`](https://github.com/oceanprotocol/ocean.js/pull/381)
- Bump @typescript-eslint/parser from 4.4.1 to 4.5.0 [`#378`](https://github.com/oceanprotocol/ocean.js/pull/378)
- Bump @typescript-eslint/eslint-plugin from 4.4.1 to 4.5.0 [`#379`](https://github.com/oceanprotocol/ocean.js/pull/379)
- fix tests [`efaa3f6`](https://github.com/oceanprotocol/ocean.js/commit/efaa3f6d1d6b425cb9faa1a4d113d9272909cf7e)
#### [v0.6.5](https://github.com/oceanprotocol/ocean.js/compare/v0.6.4...v0.6.5)
> 19 October 2020
- search for pools on-chain [`#375`](https://github.com/oceanprotocol/ocean.js/pull/375)
- Fix/Error-messages [`#367`](https://github.com/oceanprotocol/ocean.js/pull/367)
- Bump @types/chai from 4.2.13 to 4.2.14 [`#369`](https://github.com/oceanprotocol/ocean.js/pull/369)
@ -13,6 +23,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Bump release-it from 14.1.0 to 14.2.0 [`#370`](https://github.com/oceanprotocol/ocean.js/pull/370)
- Bump eslint-config-prettier from 6.12.0 to 6.13.0 [`#371`](https://github.com/oceanprotocol/ocean.js/pull/371)
- handle error messages [`d574782`](https://github.com/oceanprotocol/ocean.js/commit/d574782b14f1d237317c7029ae39bcb07a61226e)
- Release 0.6.5 [`7bed54e`](https://github.com/oceanprotocol/ocean.js/commit/7bed54e0a311ce2f00e5e66923fa5b6527cd5f2c)
- fix lint errors [`3a34c0c`](https://github.com/oceanprotocol/ocean.js/commit/3a34c0c54c42800746d3c04572d5b68bdcd91060)
#### [v0.6.4](https://github.com/oceanprotocol/ocean.js/compare/v0.6.3...v0.6.4)

205
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@oceanprotocol/lib",
"version": "0.6.5",
"version": "0.6.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1535,13 +1535,13 @@
}
},
"@typescript-eslint/eslint-plugin": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.4.1.tgz",
"integrity": "sha512-O+8Utz8pb4OmcA+Nfi5THQnQpHSD2sDUNw9AxNHpuYOo326HZTtG8gsfT+EAYuVrFNaLyNb2QnUNkmTRDskuRA==",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.5.0.tgz",
"integrity": "sha512-mjb/gwNcmDKNt+6mb7Aj/TjKzIJjOPcoCJpjBQC9ZnTRnBt1p4q5dJSSmIqAtsZ/Pff5N+hJlbiPc5bl6QN4OQ==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "4.4.1",
"@typescript-eslint/scope-manager": "4.4.1",
"@typescript-eslint/experimental-utils": "4.5.0",
"@typescript-eslint/scope-manager": "4.5.0",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
@ -1549,6 +1549,32 @@
"tsutils": "^3.17.1"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.5.0.tgz",
"integrity": "sha512-C0cEO0cTMPJ/w4RA/KVe4LFFkkSh9VHoFzKmyaaDWAnPYIEzVCtJ+Un8GZoJhcvq+mPFXEsXa01lcZDHDG6Www==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.5.0",
"@typescript-eslint/visitor-keys": "4.5.0"
}
},
"@typescript-eslint/types": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.5.0.tgz",
"integrity": "sha512-n2uQoXnyWNk0Les9MtF0gCK3JiWd987JQi97dMSxBOzVoLZXCNtxFckVqt1h8xuI1ix01t+iMY4h4rFMj/303g==",
"dev": true
},
"@typescript-eslint/visitor-keys": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.5.0.tgz",
"integrity": "sha512-UHq4FSa55NDZqscRU//O5ROFhHa9Hqn9KWTEvJGTArtTQp5GKv9Zqf6d/Q3YXXcFv4woyBml7fJQlQ+OuqRcHA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.5.0",
"eslint-visitor-keys": "^2.0.0"
}
},
"debug": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
@ -1558,6 +1584,12 @@
"ms": "2.1.2"
}
},
"eslint-visitor-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
"integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==",
"dev": true
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -1573,31 +1605,61 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.4.1.tgz",
"integrity": "sha512-Nt4EVlb1mqExW9cWhpV6pd1a3DkUbX9DeyYsdoeziKOpIJ04S2KMVDO+SEidsXRH/XHDpbzXykKcMTLdTXH6cQ==",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.5.0.tgz",
"integrity": "sha512-bW9IpSAKYvkqDGRZzayBXIgPsj2xmmVHLJ+flGSoN0fF98pGoKFhbunIol0VF2Crka7z984EEhFi623Rl7e6gg==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.4.1",
"@typescript-eslint/types": "4.4.1",
"@typescript-eslint/typescript-estree": "4.4.1",
"@typescript-eslint/scope-manager": "4.5.0",
"@typescript-eslint/types": "4.5.0",
"@typescript-eslint/typescript-estree": "4.5.0",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
}
},
"@typescript-eslint/parser": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.4.1.tgz",
"integrity": "sha512-S0fuX5lDku28Au9REYUsV+hdJpW/rNW0gWlc4SXzF/kdrRaAVX9YCxKpziH7djeWT/HFAjLZcnY7NJD8xTeUEg==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "4.4.1",
"@typescript-eslint/types": "4.4.1",
"@typescript-eslint/typescript-estree": "4.4.1",
"debug": "^4.1.1"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.5.0.tgz",
"integrity": "sha512-C0cEO0cTMPJ/w4RA/KVe4LFFkkSh9VHoFzKmyaaDWAnPYIEzVCtJ+Un8GZoJhcvq+mPFXEsXa01lcZDHDG6Www==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.5.0",
"@typescript-eslint/visitor-keys": "4.5.0"
}
},
"@typescript-eslint/types": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.5.0.tgz",
"integrity": "sha512-n2uQoXnyWNk0Les9MtF0gCK3JiWd987JQi97dMSxBOzVoLZXCNtxFckVqt1h8xuI1ix01t+iMY4h4rFMj/303g==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.5.0.tgz",
"integrity": "sha512-gN1mffq3zwRAjlYWzb5DanarOPdajQwx5MEWkWCk0XvqC8JpafDTeioDoow2L4CA/RkYZu7xEsGZRhqrTsAG8w==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.5.0",
"@typescript-eslint/visitor-keys": "4.5.0",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
}
},
"@typescript-eslint/visitor-keys": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.5.0.tgz",
"integrity": "sha512-UHq4FSa55NDZqscRU//O5ROFhHa9Hqn9KWTEvJGTArtTQp5GKv9Zqf6d/Q3YXXcFv4woyBml7fJQlQ+OuqRcHA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.5.0",
"eslint-visitor-keys": "^2.0.0"
}
},
"debug": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
@ -1607,11 +1669,106 @@
"ms": "2.1.2"
}
},
"eslint-visitor-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
"integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==",
"dev": true
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"semver": {
"version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
"dev": true
}
}
},
"@typescript-eslint/parser": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.5.0.tgz",
"integrity": "sha512-xb+gmyhQcnDWe+5+xxaQk5iCw6KqXd8VQxGiTeELTMoYeRjpocZYYRP1gFVM2C8Yl0SpUvLa1lhprwqZ00w3Iw==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "4.5.0",
"@typescript-eslint/types": "4.5.0",
"@typescript-eslint/typescript-estree": "4.5.0",
"debug": "^4.1.1"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.5.0.tgz",
"integrity": "sha512-C0cEO0cTMPJ/w4RA/KVe4LFFkkSh9VHoFzKmyaaDWAnPYIEzVCtJ+Un8GZoJhcvq+mPFXEsXa01lcZDHDG6Www==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.5.0",
"@typescript-eslint/visitor-keys": "4.5.0"
}
},
"@typescript-eslint/types": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.5.0.tgz",
"integrity": "sha512-n2uQoXnyWNk0Les9MtF0gCK3JiWd987JQi97dMSxBOzVoLZXCNtxFckVqt1h8xuI1ix01t+iMY4h4rFMj/303g==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.5.0.tgz",
"integrity": "sha512-gN1mffq3zwRAjlYWzb5DanarOPdajQwx5MEWkWCk0XvqC8JpafDTeioDoow2L4CA/RkYZu7xEsGZRhqrTsAG8w==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.5.0",
"@typescript-eslint/visitor-keys": "4.5.0",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
}
},
"@typescript-eslint/visitor-keys": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.5.0.tgz",
"integrity": "sha512-UHq4FSa55NDZqscRU//O5ROFhHa9Hqn9KWTEvJGTArtTQp5GKv9Zqf6d/Q3YXXcFv4woyBml7fJQlQ+OuqRcHA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.5.0",
"eslint-visitor-keys": "^2.0.0"
}
},
"debug": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
"dev": true,
"requires": {
"ms": "2.1.2"
}
},
"eslint-visitor-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
"integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==",
"dev": true
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"semver": {
"version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
"dev": true
}
}
},

View File

@ -1,6 +1,6 @@
{
"name": "@oceanprotocol/lib",
"version": "0.6.5",
"version": "0.6.6",
"description": "JavaScript client library for Ocean Protocol",
"main": "./dist/node/lib.js",
"typings": "./dist/node/lib.d.ts",

View File

@ -3,9 +3,9 @@ export interface DataTokenInfo {
name: string
symbol: string
blob: string
decimals: number
totalSupply: number
cap: number
minter: string
minterBalance: number
decimals?: number
totalSupply?: number
cap?: number
minter?: string
minterBalance?: number
}

View File

@ -12,6 +12,7 @@ import BigNumber from 'bignumber.js'
import { Provider } from '../provider/Provider'
import { isAddress } from 'web3-utils'
import { MetadataMain } from '../ddo/interfaces'
import { DataTokens } from '../lib'
export enum CreateProgressStep {
CreatingDataToken,
@ -86,13 +87,12 @@ export class Assets extends Instantiable {
if (services.length === 0) {
this.logger.log('You have no services. Are you sure about this?')
}
const { datatokens } = this.ocean
if (!dtAddress) {
this.logger.log('Creating datatoken')
observer.next(CreateProgressStep.CreatingDataToken)
const metadataCacheUri = this.ocean.metadatacache.getURI()
const jsonBlob = { t: 1, url: metadataCacheUri }
const { datatokens } = this.ocean
dtAddress = await datatokens.create(
JSON.stringify(jsonBlob),
@ -187,6 +187,13 @@ export class Assets extends Instantiable {
})) as Service[]
})
await ddo.addProof(this.ocean, publisher.getId())
ddo.dataTokenInfo = {
name: await datatokens.getName(dtAddress),
symbol: await datatokens.getSymbol(dtAddress),
address: dtAddress,
blob: await datatokens.getBlob(dtAddress),
cap: parseFloat(await datatokens.getCap(dtAddress))
}
this.logger.log('Storing DDO')
observer.next(CreateProgressStep.StoringDdo)
// const storedDdo = await this.ocean.metadatacache.storeDDO(ddo)
@ -598,11 +605,13 @@ export class Assets extends Instantiable {
const address = account.getId().toLowerCase()
const { datatokens } = this.ocean
const topic1 = '0x000000000000000000000000' + address.substring(2)
const topic0 = datatokens.getStartOrderEventSignature()
const events = await this.web3.eth.getPastLogs({
topics: [[datatokens.getStartOrderEventSignature(), null, topic1]],
topics: [topic0, null, topic1],
fromBlock: fromBlock || 0,
toBlock: 'latest'
})
for (let i = 0; i < events.length; i++) {
const order: Order = {
dtAddress: events[i].address,

View File

@ -254,8 +254,12 @@ describe('Marketplace flow', () => {
ddo = await ocean.assets.create(asset, alice, [service1])
assert.equal(ddo, null)
})
it('Alice gets hers order History', async () => {
const history = await ocean.assets.getOrderHistory(alice)
it('Bob should get his order History', async () => {
const history = await ocean.assets.getOrderHistory(bob)
assert(history.length > 0)
})
it('Alice should not get any order History', async () => {
const history = await ocean.assets.getOrderHistory(alice)
assert(history.length === 0)
})
})