diff --git a/CHANGELOG.md b/CHANGELOG.md index f8659c5c..b9a0a6ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ 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.1.16](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.1.15...v0.1.16) + +> 28 August 2020 + +- fix sharesBalance [`#235`](https://github.com/oceanprotocol/ocean-lib-js/pull/235) +- pool transaction typings [`#234`](https://github.com/oceanprotocol/ocean-lib-js/pull/234) +- Bump @truffle/hdwallet-provider from 1.0.42 to 1.0.43 [`#232`](https://github.com/oceanprotocol/ocean-lib-js/pull/232) +- Bump @types/node from 14.6.0 to 14.6.1 [`#233`](https://github.com/oceanprotocol/ocean-lib-js/pull/233) +- feature/setup-pool [`#230`](https://github.com/oceanprotocol/ocean-lib-js/pull/230) +- Bump ts-node from 8.10.2 to 9.0.0 [`#220`](https://github.com/oceanprotocol/ocean-lib-js/pull/220) +- Bump whatwg-url from 8.1.0 to 8.2.1 [`#225`](https://github.com/oceanprotocol/ocean-lib-js/pull/225) +- Bump @typescript-eslint/eslint-plugin from 3.9.1 to 3.10.1 [`#226`](https://github.com/oceanprotocol/ocean-lib-js/pull/226) +- Bump mocha from 8.1.1 to 8.1.2 [`#229`](https://github.com/oceanprotocol/ocean-lib-js/pull/229) +- Bump prettier from 2.0.5 to 2.1.1 [`#228`](https://github.com/oceanprotocol/ocean-lib-js/pull/228) +- Bump @typescript-eslint/parser from 3.9.1 to 3.10.1 [`#227`](https://github.com/oceanprotocol/ocean-lib-js/pull/227) +- Bump typescript from 3.9.7 to 4.0.2 [`#219`](https://github.com/oceanprotocol/ocean-lib-js/pull/219) +- use solidity setup pool function when creating new pool. [`d47a9f0`](https://github.com/oceanprotocol/ocean-lib-js/commit/d47a9f02a65342a682b904b28100ac376c61d290) +- Fix lint issues. [`5af50c4`](https://github.com/oceanprotocol/ocean-lib-js/commit/5af50c4c9297c2b98124ae609ff61a0c32626958) +- pool typings [`6584023`](https://github.com/oceanprotocol/ocean-lib-js/commit/65840235704bdd9f2e0b07418e65addcc86849ba) + #### [v0.1.15](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.1.14...v0.1.15) > 20 August 2020 @@ -11,7 +31,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - add ocean.pool.totalSupply() [`#218`](https://github.com/oceanprotocol/ocean-lib-js/pull/218) - refactor [`af7964c`](https://github.com/oceanprotocol/ocean-lib-js/commit/af7964ca84394574fb78fece1ca75a6799746fc8) - simplification, make it work [`dee24e8`](https://github.com/oceanprotocol/ocean-lib-js/commit/dee24e87a3081373e055422702cff7633ad95131) -- add totalSupply unit test [`a3e43c1`](https://github.com/oceanprotocol/ocean-lib-js/commit/a3e43c157843907d377b7134a8b9067d3e28f581) +- Release 0.1.15 [`3607f49`](https://github.com/oceanprotocol/ocean-lib-js/commit/3607f49472352c11f14cfb95f5182f9c6254adfe) #### [v0.1.14](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.1.13...v0.1.14) diff --git a/package-lock.json b/package-lock.json index 59001c18..8ed8538f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@oceanprotocol/lib", - "version": "0.1.15", + "version": "0.1.16", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1036,9 +1036,9 @@ } }, "@truffle/hdwallet-provider": { - "version": "1.0.42", - "resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-1.0.42.tgz", - "integrity": "sha512-Q6+Pn6x9oLE0lTk72xC4V7il/UoI2i6dy8kSfh4xjYkE585SO9sc7ndXqX5K+epPolr7UAndEe7Lv6mHjiPmsQ==", + "version": "1.0.43", + "resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-1.0.43.tgz", + "integrity": "sha512-BzHkHh5K096JycwhalAj2lO5ia6K422zegni17d4N2889jxNw7qdC4GhvofbTLpxkVkVFBLP37++x7mCSC7T5w==", "dev": true, "requires": { "@trufflesuite/web3-provider-engine": "15.0.13-1", @@ -1405,9 +1405,9 @@ "dev": true }, "@types/node": { - "version": "14.6.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", - "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" + "version": "14.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.2.tgz", + "integrity": "sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A==" }, "@types/node-fetch": { "version": "2.5.7", @@ -1475,12 +1475,12 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.9.1.tgz", - "integrity": "sha512-XIr+Mfv7i4paEdBf0JFdIl9/tVxyj+rlilWIfZ97Be0lZ7hPvUbS5iHt9Glc8kRI53dsr0PcAEudbf8rO2wGgg==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz", + "integrity": "sha512-PQg0emRtzZFWq6PxBcdxRH3QIQiyFO3WCVpRL3fgj5oQS3CDs3AeAKfv4DxNhzn8ITdNJGJ4D3Qw8eAJf3lXeQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "3.9.1", + "@typescript-eslint/experimental-utils": "3.10.1", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", @@ -1488,6 +1488,50 @@ "tsutils": "^3.17.1" }, "dependencies": { + "@typescript-eslint/experimental-utils": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz", + "integrity": "sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/types": "3.10.1", + "@typescript-eslint/typescript-estree": "3.10.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/types": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.10.1.tgz", + "integrity": "sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz", + "integrity": "sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==", + "dev": true, + "requires": { + "@typescript-eslint/types": "3.10.1", + "@typescript-eslint/visitor-keys": "3.10.1", + "debug": "^4.1.1", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz", + "integrity": "sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -1511,19 +1555,6 @@ } } }, - "@typescript-eslint/experimental-utils": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.1.tgz", - "integrity": "sha512-lkiZ8iBBaYoyEKhCkkw4SAeatXyBq9Ece5bZXdLe1LWBUwTszGbmbiqmQbwWA8cSYDnjWXp9eDbXpf9Sn0hLAg==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/typescript-estree": "3.9.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" - } - }, "@typescript-eslint/parser": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz", @@ -1604,60 +1635,6 @@ } } }, - "@typescript-eslint/types": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.1.tgz", - "integrity": "sha512-15JcTlNQE1BsYy5NBhctnEhEoctjXOjOK+Q+rk8ugC+WXU9rAcS2BYhoh6X4rOaXJEpIYDl+p7ix+A5U0BqPTw==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.1.tgz", - "integrity": "sha512-IqM0gfGxOmIKPhiHW/iyAEXwSVqMmR2wJ9uXHNdFpqVvPaQ3dWg302vW127sBpAiqM9SfHhyS40NKLsoMpN2KA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/visitor-keys": "3.9.1", - "debug": "^4.1.1", - "glob": "^7.1.6", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "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/visitor-keys": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.1.tgz", - "integrity": "sha512-zxdtUjeoSh+prCpogswMwVUJfEFmCOjdzK9rpNjNBfm6EyPt99x3RrJoBOGZO23FCt0WPKUCOL5mb/9D5LjdwQ==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, "abstract-leveldown": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz", @@ -2431,9 +2408,9 @@ } }, "chokidar": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", - "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", + "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", "dev": true, "requires": { "anymatch": "~3.1.1", @@ -2443,7 +2420,7 @@ "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.3.0" + "readdirp": "~3.4.0" }, "dependencies": { "normalize-path": { @@ -6518,64 +6495,12 @@ "dev": true }, "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", "dev": true, "requires": { - "chalk": "^2.4.2" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } + "chalk": "^4.0.0" } }, "loose-envify": { @@ -6600,9 +6525,9 @@ "dev": true }, "lunr": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz", - "integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg==", + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dev": true }, "macos-release": { @@ -6868,23 +6793,23 @@ } }, "mocha": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.1.tgz", - "integrity": "sha512-p7FuGlYH8t7gaiodlFreseLxEmxTgvyG9RgPHODFPySNhwUehu8NIb0vdSt3WFckSneswZ0Un5typYcWElk7HQ==", + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.3.tgz", + "integrity": "sha512-ZbaYib4hT4PpF4bdSO2DohooKXIn4lDeiYqB+vTmCdr6l2woW0b6H3pf5x4sM5nwQMru9RvjjHYWVGltR50ZBw==", "dev": true, "requires": { "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.3.1", - "debug": "3.2.6", + "chokidar": "3.4.2", + "debug": "4.1.1", "diff": "4.0.2", - "escape-string-regexp": "1.0.5", - "find-up": "4.1.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", "glob": "7.1.6", "growl": "1.10.5", "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", + "js-yaml": "3.14.0", + "log-symbols": "4.0.0", "minimatch": "3.0.4", "ms": "2.1.2", "object.assign": "4.1.0", @@ -6901,22 +6826,37 @@ }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { "ms": "^2.1.1" } }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" } }, "ms": { @@ -6925,6 +6865,24 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "p-limit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", + "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, "strip-json-comments": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", @@ -7887,9 +7845,9 @@ "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" }, "prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz", + "integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==", "dev": true }, "prettier-linter-helpers": { @@ -8212,12 +8170,12 @@ } }, "readdirp": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", - "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", + "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", "dev": true, "requires": { - "picomatch": "^2.0.7" + "picomatch": "^2.2.1" } }, "rechoir": { @@ -9496,9 +9454,9 @@ } }, "ts-node": { - "version": "8.10.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", - "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", + "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", "dev": true, "requires": { "arg": "^4.1.0", @@ -9589,21 +9547,21 @@ } }, "typedoc": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.18.0.tgz", - "integrity": "sha512-UgDQwapCGQCCdYhEQzQ+kGutmcedklilgUGf62Vw6RdI29u6FcfAXFQfRTiJEbf16aK3YnkB20ctQK1JusCRbA==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.19.0.tgz", + "integrity": "sha512-Rn68JwgDDYyIWl3HXeSsLZcsvxd2anISjhKu64PvID7RETeS2Iwnc4cH60yqc8/N50Xo1d3MHPGYinCPhMMliQ==", "dev": true, "requires": { "fs-extra": "^9.0.1", "handlebars": "^4.7.6", "highlight.js": "^10.0.0", - "lodash": "^4.17.15", - "lunr": "^2.3.8", + "lodash": "^4.17.20", + "lunr": "^2.3.9", "marked": "^1.1.1", "minimatch": "^3.0.0", "progress": "^2.0.3", "shelljs": "^0.8.4", - "typedoc-default-themes": "^0.10.2" + "typedoc-default-themes": "^0.11.1" }, "dependencies": { "fs-extra": { @@ -9628,6 +9586,12 @@ "universalify": "^1.0.0" } }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, "universalify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", @@ -9637,12 +9601,12 @@ } }, "typedoc-default-themes": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.10.2.tgz", - "integrity": "sha512-zo09yRj+xwLFE3hyhJeVHWRSPuKEIAsFK5r2u47KL/HBKqpwdUSanoaz5L34IKiSATFrjG5ywmIu98hPVMfxZg==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.11.1.tgz", + "integrity": "sha512-1yl8pbhjrLywqGJx9TfT+wzP+ntudPYjgJdpCj+s5ed2etBkqZPOCBMKwpaN9o6pdoFQF195PggqWTLVEkaRQQ==", "dev": true, "requires": { - "lunr": "^2.3.8" + "lunr": "^2.3.9" } }, "typescript": { @@ -10373,9 +10337,9 @@ } }, "webidl-conversions": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz", - "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==" + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", + "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==" }, "websocket": { "version": "1.0.31", @@ -10396,13 +10360,13 @@ "dev": true }, "whatwg-url": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.1.0.tgz", - "integrity": "sha512-vEIkwNi9Hqt4TV9RdnaBPNt+E2Sgmo3gePebCRgZ1R7g6d23+53zCTnuB0amKI4AXq6VM8jj2DUAa0S1vjJxkw==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.2.1.tgz", + "integrity": "sha512-ZmVCr6nfBeaMxEHALLEGy0LszYjpJqf6PVNQUQ1qd9Et+q7Jpygd4rGGDXgHjD8e99yLFseD69msHDM4YwPZ4A==", "requires": { "lodash.sortby": "^4.7.0", "tr46": "^2.0.2", - "webidl-conversions": "^5.0.0" + "webidl-conversions": "^6.1.0" } }, "which": { diff --git a/package.json b/package.json index 6df9d8fe..0911dc85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oceanprotocol/lib", - "version": "0.1.15", + "version": "0.1.16", "description": "JavaScript client library for Ocean Protocol", "main": "./dist/node/lib.js", "typings": "./dist/node/lib.d.ts", @@ -75,9 +75,9 @@ "ora": "^5.0.0", "prettier": "^2.0.5", "source-map-support": "^0.5.19", - "ts-node": "^8.10.2", + "ts-node": "^9.0.0", "ts-node-register": "^1.0.0", - "typedoc": "^0.18.0", + "typedoc": "^0.19.0", "typescript": "^4.0.2" }, "nyc": { diff --git a/src/balancer/OceanPool.ts b/src/balancer/OceanPool.ts index b4ec95cd..804b1be5 100644 --- a/src/balancer/OceanPool.ts +++ b/src/balancer/OceanPool.ts @@ -1,5 +1,6 @@ import Web3 from 'web3' import { AbiItem } from 'web3-utils/types' +import { TransactionReceipt } from 'web3-core' import { Pool } from './Pool' /** @@ -26,9 +27,10 @@ export class OceanPool extends Pool { /** * Create DataToken pool @param {String} account - * @param {String} token Data Token address - * @param {String} amount Data Token amount - * @param {String} weight Data Token weight + * @param {String} token DataToken address + * @param {String} amount DataToken amount + * @param {String} weight DataToken weight + * @param {String} fee Swap fee (as float) * @return {String} */ public async createDTPool( @@ -36,8 +38,7 @@ export class OceanPool extends Pool { token: string, amount: string, weight: string, - fee: string, - finalize = true + fee: string ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') @@ -50,22 +51,33 @@ export class OceanPool extends Pool { const address = await super.createPool(account) const oceanWeight = 10 - parseFloat(weight) const oceanAmount = (parseFloat(amount) * oceanWeight) / parseFloat(weight) - const tokens = [ - { - address: token, - amount: String(amount), - weight: String(weight) - }, - { - address: this.oceanAddress, - amount: String(oceanAmount), - weight: String(oceanWeight) - } - ] this.dtAddress = token - await super.addToPool(account, address, tokens) - await super.setSwapFee(account, address, fee) - if (finalize) await super.finalize(account, address) + + await this.approve( + account, + token, + address, + this.web3.utils.toWei(String(amount)) as any + ) + await this.approve( + account, + this.oceanAddress, + address, + this.web3.utils.toWei(String(oceanAmount)) as any + ) + + await super.setup( + account, + address, + token, + this.web3.utils.toWei(String(amount)), + this.web3.utils.toWei(String(weight)), + this.oceanAddress, + this.web3.utils.toWei(String(oceanAmount)), + this.web3.utils.toWei(String(oceanWeight)), + this.web3.utils.toWei(fee) + ) + return address } @@ -159,7 +171,7 @@ export class OceanPool extends Pool { * @param {String} amount Data Token amount * @param {String} oceanAmount Ocean Token amount expected * @param {String} maxPrice Minimum price to sell - * @return {any} + * @return {TransactionReceipt} */ public async sellDT( account: string, @@ -167,7 +179,7 @@ export class OceanPool extends Pool { amount: string, oceanAmount: string, minPrice: string - ): Promise { + ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') return null @@ -189,13 +201,13 @@ export class OceanPool extends Pool { * @param {String} account * @param {String} poolAddress * @param {String} amount Data Token amount - * @return {any} + * @return {TransactionReceipt} */ public async addDTLiquidity( account: string, poolAddress: string, amount: string - ): Promise { + ): Promise { await this.getDTAddress(account, poolAddress) await super.approve( account, @@ -218,14 +230,14 @@ export class OceanPool extends Pool { * @param {String} account * @param {String} poolAddress * @param {String} amount Data Token amount - * @return {any} + * @return {TransactionReceipt} */ public async removeDTLiquidity( account: string, poolAddress: string, amount: string, maximumPoolShares: string - ): Promise { + ): Promise { await this.getDTAddress(account, poolAddress) // TODO Check balance of PoolShares before doing exit return this.exitswapExternAmountOut( @@ -242,13 +254,13 @@ export class OceanPool extends Pool { * @param {String} account * @param {String} poolAddress * @param {String} amount Ocean Token amount in OCEAN - * @return {any} + * @return {TransactionReceipt} */ public async addOceanLiquidity( account: string, poolAddress: string, amount: string - ): Promise { + ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') return null @@ -274,14 +286,14 @@ export class OceanPool extends Pool { * @param {String} account * @param {String} poolAddress * @param {String} amount Ocean Token amount in OCEAN - * @return {any} + * @return {TransactionReceipt} */ public removeOceanLiquidity( account: string, poolAddress: string, amount: string, maximumPoolShares: string - ): Promise { + ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') return null diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index f57b738e..c2a4d9ba 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -1,5 +1,6 @@ import Web3 from 'web3' import { AbiItem } from 'web3-utils/types' +import { TransactionReceipt } from 'web3-core' import Decimal from 'decimal.js' import jsonpoolABI from '@oceanprotocol/contracts/artifacts/BPool.json' import { PoolFactory } from './PoolFactory' @@ -32,8 +33,54 @@ export class Pool extends PoolFactory { * Creates a new pool */ async createPool(account: string): Promise { - const pooladdress = await super.createPool(account) - return pooladdress + return await super.createPool(account) + } + + /** + * Setup a new pool by setting datatoken, base token, swap fee and + * finalizing the pool to make it public. + * + * @param {String} account ethereum address to use for sending this transaction + * @param {String} poolAddress address of new Balancer Pool + * @param {String} dataToken address of datatoken ERC20 contract + * @param {String} dataTokenAmount in wei + * @param {String} dataTokenWeight in wei + * @param {String} baseToken address of base token ERC20 contract + * @param {String} baseTokenAmount in wei + * @param {String} baseTokenWeight in wei + * @param {String} swapFee in wei + */ + async setup( + account: string, + poolAddress: string, + dataToken: string, + dataTokenAmount: string, + dataTokenWeight: string, + baseToken: string, + baseTokenAmount: string, + baseTokenWeight: string, + swapFee: string + ): Promise { + const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { + from: account + }) + let result = null + try { + result = await pool.methods + .setup( + dataToken, + dataTokenAmount, + dataTokenWeight, + baseToken, + baseTokenAmount, + baseTokenWeight, + swapFee + ) + .send({ from: account, gas: this.GASLIMIT_DEFAULT }) + } catch (e) { + console.error('Pool.setup failed:' + e) + } + return result } /** @@ -95,37 +142,10 @@ export class Pool extends PoolFactory { * @return {String} */ async sharesBalance(account: string, poolAddress: string): Promise { - const minABI = [ - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address' - } - ], - name: 'balanceOf', - outputs: [ - { - name: 'balance', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - } - ] as AbiItem[] - let result = null - try { - const token = new this.web3.eth.Contract(minABI, poolAddress, { - from: account - }) - const balance = await token.methods - .balanceOf(account) - .call({ from: account, gas: this.GASLIMIT_DEFAULT }) + const token = new this.web3.eth.Contract(this.poolABI, poolAddress) + const balance = await token.methods.balanceOf(account).call() result = this.web3.utils.fromWei(balance) } catch (e) { console.error(e) @@ -493,7 +513,7 @@ export class Pool extends PoolFactory { * @param {String} tokenOut * @param {String} minAmountOut will be converted to wei * @param {String} maxPrice will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async swapExactAmountIn( account: string, @@ -503,7 +523,7 @@ export class Pool extends PoolFactory { tokenOut: string, minAmountOut: string, maxPrice: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -533,7 +553,7 @@ export class Pool extends PoolFactory { * @param {String} tokenOut * @param {String} minAmountOut will be converted to wei * @param {String} maxPrice will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async swapExactAmountOut( account: string, @@ -543,7 +563,7 @@ export class Pool extends PoolFactory { tokenOut: string, minAmountOut: string, maxPrice: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -641,7 +661,7 @@ export class Pool extends PoolFactory { * @param {String} tokenIn * @param {String} tokenAmountIn will be converted to wei * @param {String} minPoolAmountOut will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async joinswapExternAmountIn( account: string, @@ -649,7 +669,7 @@ export class Pool extends PoolFactory { tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -675,7 +695,7 @@ export class Pool extends PoolFactory { * @param {String} tokenIn * @param {String} poolAmountOut will be converted to wei * @param {String} maxAmountIn will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async joinswapPoolAmountOut( account: string, @@ -683,7 +703,7 @@ export class Pool extends PoolFactory { tokenIn: string, poolAmountOut: string, maxAmountIn: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -709,7 +729,7 @@ export class Pool extends PoolFactory { * @param {String} tokenOut * @param {String} poolAmountIn will be converted to wei * @param {String} minTokenAmountOut will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async exitswapPoolAmountIn( account: string, @@ -717,7 +737,7 @@ export class Pool extends PoolFactory { tokenOut: string, poolAmountIn: string, minTokenAmountOut: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -743,7 +763,7 @@ export class Pool extends PoolFactory { * @param {String} tokenOut * @param {String} tokenAmountOut will be converted to wei * @param {String} maxPoolAmountIn will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async exitswapExternAmountOut( account: string, @@ -751,7 +771,7 @@ export class Pool extends PoolFactory { tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -776,14 +796,14 @@ export class Pool extends PoolFactory { * @param {String} poolAddress * @param {String} tokenIn * @param {String} tokenOut - * @return {any} + * @return {String} */ async getSpotPrice( account: string, poolAddress: string, tokenIn: string, tokenOut: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) diff --git a/test/unit/balancer/Balancer.test.ts b/test/unit/balancer/Balancer.test.ts index 936f54b6..4d4a6ab5 100644 --- a/test/unit/balancer/Balancer.test.ts +++ b/test/unit/balancer/Balancer.test.ts @@ -111,11 +111,15 @@ describe('Balancer flow', () => { await oceandatatoken.mint(oceanTokenAddress, alice, tokenAmount) }) it('Alice transfers 200 ocean token to Bob', async () => { - const ts = await datatoken.transfer(oceanTokenAddress, bob, transferAmount, alice) + await datatoken.transfer(oceanTokenAddress, bob, transferAmount, alice) }) it('Alice creates a new OceanPool pool', async () => { /// new pool with total DT = 45 , dt weight=90% with swap fee 2% - alicePoolAddress = await Pool.createDTPool(alice, tokenAddress, 45, 9, '0.02') + alicePoolAddress = await Pool.createDTPool(alice, tokenAddress, '45', '9', '0.02') + const s = await Pool.totalSupply(alicePoolAddress) + assert(String(s) === '100', 'totalSupply does not match: ' + s) + const n = await Pool.getNumTokens(alice, alicePoolAddress) + assert(String(n) === '2', 'unexpected num tokens: ' + n) }) it('Get pool information', async () => { const currentTokens = await Pool.getCurrentTokens(alice, alicePoolAddress)