diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c806083..50fb1fed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,32 @@ 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.3.2](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.3.1...v0.3.2) + +- Fix asset create [`#320`](https://github.com/oceanprotocol/ocean-lib-js/pull/320) +- Bump decimal.js from 10.2.0 to 10.2.1 [`#317`](https://github.com/oceanprotocol/ocean-lib-js/pull/317) +- Bump @typescript-eslint/eslint-plugin from 4.2.0 to 4.3.0 [`#318`](https://github.com/oceanprotocol/ocean-lib-js/pull/318) +- Bump @typescript-eslint/parser from 4.2.0 to 4.3.0 [`#319`](https://github.com/oceanprotocol/ocean-lib-js/pull/319) +- Bump eslint from 7.9.0 to 7.10.0 [`#314`](https://github.com/oceanprotocol/ocean-lib-js/pull/314) +- Bump eslint-config-prettier from 6.11.0 to 6.12.0 [`#313`](https://github.com/oceanprotocol/ocean-lib-js/pull/313) +- fix test spy [`cde752f`](https://github.com/oceanprotocol/ocean-lib-js/commit/cde752f4ae6927ce5acd680bea27f23325e8de02) +- dt check [`fc534c3`](https://github.com/oceanprotocol/ocean-lib-js/commit/fc534c3ce9d25a20774bdb9f29166d39add840c2) +- incorrect balance check [`d6be9ad`](https://github.com/oceanprotocol/ocean-lib-js/commit/d6be9ad45d6bd598fc604ed1cd7746aa616f6327) + +#### [v0.3.1](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.3.0...v0.3.1) + +> 25 September 2020 + +- replace lzma library [`#311`](https://github.com/oceanprotocol/ocean-lib-js/pull/311) +- refactor getting local contract addresses [`#312`](https://github.com/oceanprotocol/ocean-lib-js/pull/312) +- make it work with lzma-native [`2896a8e`](https://github.com/oceanprotocol/ocean-lib-js/commit/2896a8e24f8469e2590ccdab13c45c8c3a942a8e) +- test lz-string [`7188f33`](https://github.com/oceanprotocol/ocean-lib-js/commit/7188f337076278ea4ca52c9e9401b37d8e035196) +- use limited, compress-only version of lzma.js [`3b8858a`](https://github.com/oceanprotocol/ocean-lib-js/commit/3b8858a201329fc3489b0d72ebfd86e5e0362003) + #### [v0.3.0](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.2.5...v0.3.0) +> 23 September 2020 + - fix getOwnerAssets response [`#308`](https://github.com/oceanprotocol/ocean-lib-js/pull/308) - use dtAddress as did, update metadata contract [`#309`](https://github.com/oceanprotocol/ocean-lib-js/pull/309) - Feature/custom provider [`#288`](https://github.com/oceanprotocol/ocean-lib-js/pull/288) diff --git a/package-lock.json b/package-lock.json index 6042e08a..bdca53cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@oceanprotocol/lib", - "version": "0.3.0", + "version": "0.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -696,12 +696,12 @@ } }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "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.1" + "ms": "2.1.2" } }, "ignore": { @@ -1535,13 +1535,13 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.2.0.tgz", - "integrity": "sha512-zBNRkzvLSwo6y5TG0DVcmshZIYBHKtmzD4N+LYnfTFpzc4bc79o8jNRSb728WV7A4Cegbs+MV5IRAj8BKBgOVQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.3.0.tgz", + "integrity": "sha512-RqEcaHuEKnn3oPFislZ6TNzsBLqpZjN93G69SS+laav/I8w/iGMuMq97P0D2/2/kW4SCebHggqhbcCfbDaaX+g==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.2.0", - "@typescript-eslint/scope-manager": "4.2.0", + "@typescript-eslint/experimental-utils": "4.3.0", + "@typescript-eslint/scope-manager": "4.3.0", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", @@ -1550,28 +1550,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.2.0.tgz", - "integrity": "sha512-Tb402cxxObSxWIVT+PnBp5ruT2V/36yj6gG4C9AjkgRlZpxrLAzWDk3neen6ToMBGeGdxtnfFLoJRUecGz9mYQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.3.0.tgz", + "integrity": "sha512-cTeyP5SCNE8QBRfc+Lgh4Xpzje46kNUhXYfc3pQWmJif92sjrFuHT9hH4rtOkDTo/si9Klw53yIr+djqGZS1ig==", "dev": true, "requires": { - "@typescript-eslint/types": "4.2.0", - "@typescript-eslint/visitor-keys": "4.2.0" + "@typescript-eslint/types": "4.3.0", + "@typescript-eslint/visitor-keys": "4.3.0" } }, "@typescript-eslint/types": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.2.0.tgz", - "integrity": "sha512-xkv5nIsxfI/Di9eVwN+G9reWl7Me9R5jpzmZUch58uQ7g0/hHVuGUbbn4NcxcM5y/R4wuJIIEPKPDb5l4Fdmwg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.3.0.tgz", + "integrity": "sha512-Cx9TpRvlRjOppGsU6Y6KcJnUDOelja2NNCX6AZwtVHRzaJkdytJWMuYiqi8mS35MRNA3cJSwDzXePfmhU6TANw==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.2.0.tgz", - "integrity": "sha512-WIf4BNOlFOH2W+YqGWa6YKLcK/EB3gEj2apCrqLw6mme1RzBy0jtJ9ewJgnrZDB640zfnv8L+/gwGH5sYp/rGw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.3.0.tgz", + "integrity": "sha512-xZxkuR7XLM6RhvLkgv9yYlTcBHnTULzfnw4i6+z2TGBLy9yljAypQaZl9c3zFvy7PNI7fYWyvKYtohyF8au3cw==", "dev": true, "requires": { - "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/types": "4.3.0", "eslint-visitor-keys": "^2.0.0" } }, @@ -1605,43 +1605,43 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.2.0.tgz", - "integrity": "sha512-5BBj6BjgHEndBaQQpUVzRIPERz03LBc0MCQkHwUaH044FJFL08SwWv/sQftk7gf0ShZ2xZysz0LTwCwNt4Xu3w==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.3.0.tgz", + "integrity": "sha512-cmmIK8shn3mxmhpKfzMMywqiEheyfXLV/+yPDnOTvQX/ztngx7Lg/OD26J8gTZfkLKUmaEBxO2jYP3keV7h2OQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.2.0", - "@typescript-eslint/types": "4.2.0", - "@typescript-eslint/typescript-estree": "4.2.0", + "@typescript-eslint/scope-manager": "4.3.0", + "@typescript-eslint/types": "4.3.0", + "@typescript-eslint/typescript-estree": "4.3.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.2.0.tgz", - "integrity": "sha512-Tb402cxxObSxWIVT+PnBp5ruT2V/36yj6gG4C9AjkgRlZpxrLAzWDk3neen6ToMBGeGdxtnfFLoJRUecGz9mYQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.3.0.tgz", + "integrity": "sha512-cTeyP5SCNE8QBRfc+Lgh4Xpzje46kNUhXYfc3pQWmJif92sjrFuHT9hH4rtOkDTo/si9Klw53yIr+djqGZS1ig==", "dev": true, "requires": { - "@typescript-eslint/types": "4.2.0", - "@typescript-eslint/visitor-keys": "4.2.0" + "@typescript-eslint/types": "4.3.0", + "@typescript-eslint/visitor-keys": "4.3.0" } }, "@typescript-eslint/types": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.2.0.tgz", - "integrity": "sha512-xkv5nIsxfI/Di9eVwN+G9reWl7Me9R5jpzmZUch58uQ7g0/hHVuGUbbn4NcxcM5y/R4wuJIIEPKPDb5l4Fdmwg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.3.0.tgz", + "integrity": "sha512-Cx9TpRvlRjOppGsU6Y6KcJnUDOelja2NNCX6AZwtVHRzaJkdytJWMuYiqi8mS35MRNA3cJSwDzXePfmhU6TANw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.2.0.tgz", - "integrity": "sha512-iWDLCB7z4MGkLipduF6EOotdHNtgxuNKnYD54nMS/oitFnsk4S3S/TE/UYXQTra550lHtlv9eGmp+dvN9pUDtA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.3.0.tgz", + "integrity": "sha512-ZAI7xjkl+oFdLV/COEz2tAbQbR3XfgqHEGy0rlUXzfGQic6EBCR4s2+WS3cmTPG69aaZckEucBoTxW9PhzHxxw==", "dev": true, "requires": { - "@typescript-eslint/types": "4.2.0", - "@typescript-eslint/visitor-keys": "4.2.0", + "@typescript-eslint/types": "4.3.0", + "@typescript-eslint/visitor-keys": "4.3.0", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", @@ -1651,12 +1651,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.2.0.tgz", - "integrity": "sha512-WIf4BNOlFOH2W+YqGWa6YKLcK/EB3gEj2apCrqLw6mme1RzBy0jtJ9ewJgnrZDB640zfnv8L+/gwGH5sYp/rGw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.3.0.tgz", + "integrity": "sha512-xZxkuR7XLM6RhvLkgv9yYlTcBHnTULzfnw4i6+z2TGBLy9yljAypQaZl9c3zFvy7PNI7fYWyvKYtohyF8au3cw==", "dev": true, "requires": { - "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/types": "4.3.0", "eslint-visitor-keys": "^2.0.0" } }, @@ -1690,14 +1690,14 @@ } }, "@typescript-eslint/parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.2.0.tgz", - "integrity": "sha512-54jJ6MwkOtowpE48C0QJF9iTz2/NZxfKVJzv1ha5imigzHbNSLN9yvbxFFH1KdlRPQrlR8qxqyOvLHHxd397VA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.3.0.tgz", + "integrity": "sha512-JyfRnd72qRuUwItDZ00JNowsSlpQGeKfl9jxwO0FHK1qQ7FbYdoy5S7P+5wh1ISkT2QyAvr2pc9dAemDxzt75g==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.2.0", - "@typescript-eslint/types": "4.2.0", - "@typescript-eslint/typescript-estree": "4.2.0", + "@typescript-eslint/scope-manager": "4.3.0", + "@typescript-eslint/types": "4.3.0", + "@typescript-eslint/typescript-estree": "4.3.0", "debug": "^4.1.1" }, "dependencies": { @@ -1719,29 +1719,29 @@ } }, "@typescript-eslint/scope-manager": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.2.0.tgz", - "integrity": "sha512-Tb402cxxObSxWIVT+PnBp5ruT2V/36yj6gG4C9AjkgRlZpxrLAzWDk3neen6ToMBGeGdxtnfFLoJRUecGz9mYQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.3.0.tgz", + "integrity": "sha512-cTeyP5SCNE8QBRfc+Lgh4Xpzje46kNUhXYfc3pQWmJif92sjrFuHT9hH4rtOkDTo/si9Klw53yIr+djqGZS1ig==", "dev": true, "requires": { - "@typescript-eslint/types": "4.2.0", - "@typescript-eslint/visitor-keys": "4.2.0" + "@typescript-eslint/types": "4.3.0", + "@typescript-eslint/visitor-keys": "4.3.0" } }, "@typescript-eslint/types": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.2.0.tgz", - "integrity": "sha512-xkv5nIsxfI/Di9eVwN+G9reWl7Me9R5jpzmZUch58uQ7g0/hHVuGUbbn4NcxcM5y/R4wuJIIEPKPDb5l4Fdmwg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.3.0.tgz", + "integrity": "sha512-Cx9TpRvlRjOppGsU6Y6KcJnUDOelja2NNCX6AZwtVHRzaJkdytJWMuYiqi8mS35MRNA3cJSwDzXePfmhU6TANw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.2.0.tgz", - "integrity": "sha512-iWDLCB7z4MGkLipduF6EOotdHNtgxuNKnYD54nMS/oitFnsk4S3S/TE/UYXQTra550lHtlv9eGmp+dvN9pUDtA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.3.0.tgz", + "integrity": "sha512-ZAI7xjkl+oFdLV/COEz2tAbQbR3XfgqHEGy0rlUXzfGQic6EBCR4s2+WS3cmTPG69aaZckEucBoTxW9PhzHxxw==", "dev": true, "requires": { - "@typescript-eslint/types": "4.2.0", - "@typescript-eslint/visitor-keys": "4.2.0", + "@typescript-eslint/types": "4.3.0", + "@typescript-eslint/visitor-keys": "4.3.0", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", @@ -1774,12 +1774,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.2.0.tgz", - "integrity": "sha512-WIf4BNOlFOH2W+YqGWa6YKLcK/EB3gEj2apCrqLw6mme1RzBy0jtJ9ewJgnrZDB640zfnv8L+/gwGH5sYp/rGw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.3.0.tgz", + "integrity": "sha512-xZxkuR7XLM6RhvLkgv9yYlTcBHnTULzfnw4i6+z2TGBLy9yljAypQaZl9c3zFvy7PNI7fYWyvKYtohyF8au3cw==", "dev": true, "requires": { - "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/types": "4.3.0", "eslint-visitor-keys": "^2.0.0" }, "dependencies": { @@ -3113,9 +3113,9 @@ "dev": true }, "decimal.js": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz", - "integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw==" + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", + "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==" }, "decode-uri-component": { "version": "0.2.0", @@ -3582,9 +3582,9 @@ "dev": true }, "eslint": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz", - "integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.10.0.tgz", + "integrity": "sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -3595,7 +3595,7 @@ "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", - "eslint-scope": "^5.1.0", + "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^1.3.0", "espree": "^7.3.0", @@ -3638,12 +3638,22 @@ } }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "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.1" + "ms": "2.1.2" + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" } }, "eslint-visitor-keys": { @@ -3652,6 +3662,23 @@ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -3939,9 +3966,9 @@ } }, "eslint-config-prettier": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", - "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.12.0.tgz", + "integrity": "sha512-9jWPlFlgNwRUYVoujvWTQ1aMO8o6648r+K7qU7K5Jmkbyqav1fuEZC0COYpGBxyiAJb65Ra9hrmFx19xRGwXWw==", "dev": true, "requires": { "get-stdin": "^6.0.0" @@ -10335,9 +10362,9 @@ }, "dependencies": { "@types/node": { - "version": "12.12.59", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.59.tgz", - "integrity": "sha512-D2MISWfv2j17aFBAkMD3lQ97vYpXCkAJMJf0mx2eKHNkzXA6Vo9w7A7BWi9fH8sOH1zeFb7fIhOo22z0TtrSag==" + "version": "12.12.62", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.62.tgz", + "integrity": "sha512-qAfo81CsD7yQIM9mVyh6B/U47li5g7cfpVQEDMfQeF8pSZVwzbhwU3crc0qG4DmpsebpJPR49AKOExQyJ05Cpg==" } } }, diff --git a/package.json b/package.json index a6748457..6a9d651f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oceanprotocol/lib", - "version": "0.3.0", + "version": "0.3.2", "description": "JavaScript client library for Ocean Protocol", "main": "./dist/node/lib.js", "typings": "./dist/node/lib.d.ts", diff --git a/src/metadatastore/OnChainMetaData.ts b/src/metadatastore/OnChainMetaData.ts index aa679eca..57776a13 100644 --- a/src/metadatastore/OnChainMetaData.ts +++ b/src/metadatastore/OnChainMetaData.ts @@ -5,7 +5,10 @@ import { AbiItem } from 'web3-utils/types' import Web3 from 'web3' import defaultDDOContractABI from '@oceanprotocol/contracts/artifacts/Metadata.json' import { didZeroX } from '../utils' -import { LZMA } from 'lzma' + +// Using limited, compress-only version +// See https://github.com/LZMA-JS/LZMA-JS#but-i-dont-want-to-use-web-workers +import { LZMA } from 'lzma/src/lzma-c' /** * Provides an interface with Metadata Store. @@ -34,17 +37,16 @@ export class OnChainMetadataStore { ) } - /** Compress DDO using LZMA - * + /** + * Compress DDO using xz/lzma2 */ - public async LZMACompressDDO(ddo: DDO): Promise { + + public async compressDDO(ddo: DDO): Promise { const data = DDO.serialize(ddo) - const lzma = new LZMA() // see https://github.com/LZMA-JS/LZMA-JS/issues/44 - lzma.disableEndMark = true - let compressed = lzma.compress(data, 9) - compressed = this.getHex(compressed) - return compressed + LZMA.disableEndMark = true + const compressed = LZMA.compress(data, 9) + return this.getHex(compressed) } /** @@ -60,7 +62,7 @@ export class OnChainMetadataStore { consumerAccount: string ): Promise { let flags = 0 - const compressed = await this.LZMACompressDDO(ddo) + const compressed = await this.compressDDO(ddo) flags = flags | 1 return this.publishRaw(didZeroX(did), flags, compressed, consumerAccount) } @@ -78,7 +80,7 @@ export class OnChainMetadataStore { consumerAccount: string ): Promise { let flags = 0 - const compressed = await this.LZMACompressDDO(ddo) + const compressed = await this.compressDDO(ddo) flags = flags | 1 return this.updateRaw(didZeroX(did), flags, compressed, consumerAccount) } @@ -114,7 +116,7 @@ export class OnChainMetadataStore { .send({ from: consumerAccount }) return trxReceipt } catch (e) { - console.error(e) + console.error(e.message) return null } } diff --git a/src/ocean/Assets.ts b/src/ocean/Assets.ts index 3cefca1b..69f0f3e9 100644 --- a/src/ocean/Assets.ts +++ b/src/ocean/Assets.ts @@ -70,18 +70,18 @@ export class Assets extends Instantiable { symbol?: string, providerUri?: string ): SubscribablePromise { - if (!isAddress(dtAddress)) { + if (dtAddress && !isAddress(dtAddress)) { this.logger.error( `Passed Data Token address ${dtAddress} is not valid. Aborting publishing.` ) return null } - this.logger.log('Creating asset') return new SubscribablePromise(async (observer) => { if (services.length === 0) { this.logger.log('You have no services. Are you sure about this?') } + if (!dtAddress) { this.logger.log('Creating datatoken') observer.next(CreateProgressStep.CreatingDataToken) @@ -394,7 +394,7 @@ export class Assets extends Instantiable { /** * Creates an access service * @param {Account} creator - * @param {String} cost number of datatokens needed for this service, expressed in wei + * @param {String} cost number of datatokens needed for this service * @param {String} datePublished * @param {Number} timeout * @return {Promise} service @@ -495,7 +495,7 @@ export class Assets extends Instantiable { await datatokens.balance(providerData.dataToken, consumerAddress) ) const totalCost = new BigNumber(String(providerData.numTokens)) - if (balance.isLessThanOrEqualTo(totalCost)) { + if (balance.isLessThan(totalCost)) { console.error( 'Not enough funds. Needed ' + totalCost.toString() + diff --git a/src/utils/ConfigHelper.ts b/src/utils/ConfigHelper.ts index 68aab390..1b2735db 100644 --- a/src/utils/ConfigHelper.ts +++ b/src/utils/ConfigHelper.ts @@ -1,6 +1,7 @@ import Config from '../models/Config' import { Logger } from '../lib' import fs from 'fs' +import { homedir } from 'os' export declare type ConfigHelperNetworkName = | 'mainnet' @@ -54,37 +55,51 @@ const configs: ConfigHelperConfig[] = [ ] export class ConfigHelper { - /* Load config from env ADDRESS_FILE (generated by ocean-contracts) */ - public loadAddressesFromEnv() { + /* Load contract addresses from env ADDRESS_FILE (generated by ocean-contracts) */ + public getAddressesFromEnv(): Partial { try { - const data = JSON.parse(fs.readFileSync(process.env.ADDRESS_FILE, 'utf8')) - if (data) { - if (data.ganache) { - if (data.ganache.DTFactory) configs[0].factoryAddress = data.ganache.DTFactory - if (data.ganache.BFactory) configs[0].poolFactoryAddress = data.ganache.BFactory - if (data.ganache.FixedRateExchange) - configs[0].fixedRateExchangeAddress = data.ganache.FixedRateExchange - if (data.ganache.Metadata) - configs[0].metadataContractAddress = data.ganache.Metadata - } + const data = JSON.parse( + fs.readFileSync( + process.env.ADDRESS_FILE || + `${homedir}/.ocean/ocean-contracts/artifacts/address.json`, + 'utf8' + ) + ) + + const { DTFactory, BFactory, FixedRateExchange, Metadata } = data?.ganache + + const configAddresses: Partial = { + factoryAddress: DTFactory, + poolFactoryAddress: BFactory, + fixedRateExchangeAddress: FixedRateExchange, + metadataContractAddress: Metadata, + ...(process.env.AQUARIUS_URI && { metadataStoreUri: process.env.AQUARIUS_URI }) } - if (process.env.AQUARIUS_URI) configs[0].metadataStoreUri = process.env.AQUARIUS_URI - } catch (e) {} + + return configAddresses + } catch (e) { + console.error(`Could not load local contract address file: ${e.message}`) + return null + } } public getConfig( network: ConfigHelperNetworkName | ConfigHelperNetworkId, infuraProjectId?: string ): Config { - if (network === 'development') this.loadAddressesFromEnv() const filterBy = typeof network === 'string' ? 'network' : 'chainId' - const config = configs.find((c) => c[filterBy] === network) + let config = configs.find((c) => c[filterBy] === network) if (!config) { Logger.error(`No config found for given network '${network}'`) return null } + if (network === 'development') { + const contractAddressesConfig = this.getAddressesFromEnv() + config = { ...config, ...contractAddressesConfig } + } + const nodeUri = infuraProjectId ? `${config.nodeUri}/${infuraProjectId}` : config.nodeUri diff --git a/test/integration/Marketplaceflow.test.ts b/test/integration/Marketplaceflow.test.ts index d84ee4b0..8a621b58 100644 --- a/test/integration/Marketplaceflow.test.ts +++ b/test/integration/Marketplaceflow.test.ts @@ -1,15 +1,15 @@ -import { AbiItem } from 'web3-utils/types' +import datatokensTemplate from '@oceanprotocol/contracts/artifacts/DataTokenTemplate.json' +import factory from '@oceanprotocol/contracts/artifacts/DTFactory.json' import { assert, spy, use } from 'chai' import spies from 'chai-spies' -import { TestContractHandler } from '../TestContractHandler' +import Web3 from 'web3' +import { AbiItem } from 'web3-utils/types' import { DataTokens } from '../../src/datatokens/Datatokens' +import { Account, EditableMetadata, ServiceAccess, ServiceCommon } from '../../src/lib' import { Ocean } from '../../src/ocean/Ocean' import { ConfigHelper } from '../../src/utils/ConfigHelper' +import { TestContractHandler } from '../TestContractHandler' -import Web3 from 'web3' -import factory from '@oceanprotocol/contracts/artifacts/DTFactory.json' -import datatokensTemplate from '@oceanprotocol/contracts/artifacts/DataTokenTemplate.json' -import { Account, EditableMetadata, ServiceAccess, ServiceCommon } from '../../src/lib' const web3 = new Web3('http://127.0.0.1:8545') function sleep(ms: number) { @@ -248,7 +248,7 @@ describe('Marketplace flow', () => { timeout ) - spy.on(datatoken, 'create', () => null) + spy.on(ocean.datatokens, 'create', () => Promise.resolve(null)) ddo = await ocean.assets.create(asset, alice, [service1]) assert.equal(ddo, null) })