From 6bf60b6e88fa1f8da8320477735af36069788449 Mon Sep 17 00:00:00 2001 From: mihaisc Date: Mon, 7 Sep 2020 17:25:31 +0300 Subject: [PATCH] lib update --- example/package-lock.json | 202 +++-------------------- example/package.json | 2 +- example/src/Publish.tsx | 2 +- package-lock.json | 26 ++- package.json | 2 +- src/hooks/usePublish/DataTokenOptions.ts | 5 + src/hooks/usePublish/index.ts | 1 + src/hooks/usePublish/usePublish.ts | 17 +- 8 files changed, 59 insertions(+), 198 deletions(-) create mode 100644 src/hooks/usePublish/DataTokenOptions.ts diff --git a/example/package-lock.json b/example/package-lock.json index a29e2cc..e73a15a 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -1334,9 +1334,9 @@ } }, "@ethersproject/transactions": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.0.3.tgz", - "integrity": "sha512-cqsAAFUQV6iWqfgLL7KCPNfd3pXJPDdYtE6QuBEAIpc7cgbJ7TIDCF/dN+1otfERHJIbjGSNrhh4axKRnSFswg==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.0.4.tgz", + "integrity": "sha512-QvS5CzxmL46D9Y3OlddurYgEIi5mb0eAgrKm5pM074Uz/1qxCYr+Ah12I4hpaciZtCq4Fe12YWZqUFb1vGcH6Q==", "requires": { "@ethersproject/address": "^5.0.3", "@ethersproject/bignumber": "^5.0.6", @@ -1575,26 +1575,26 @@ "integrity": "sha512-gc6bCt3pq9cpk1mYDKfsZhLlaM+8yQDFmOjtmT1KGXRmnTBcvmwCQXMrL5VohFaFi7Iqio3FZtuhYyRaEjikCw==" }, "@oceanprotocol/lib": { - "version": "0.1.17", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.1.17.tgz", - "integrity": "sha512-Efr8BWJ5ngmt09Oj/mE7JF3AXlcQzTXXWzu3C4+mUWt0stnwYzUI5u2wk290N5j/v9e1e+NTl5Ymt9KAw46j4g==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.0.tgz", + "integrity": "sha512-cbEGA2+/oD8srnzXTqX3XUEYyPE2iGVpKOH9jCDG2j2jD+52JQJyQgue4fKA56x/jgtfjnCjZfAvVtXreyNeKw==", "requires": { "@ethereum-navigator/navigator": "^0.5.0", "@oceanprotocol/contracts": "^0.4.1", "decimal.js": "^10.2.0", "fs": "0.0.1-security", - "node-fetch": "^2.6.0", + "node-fetch": "^2.6.1", "save-file": "^2.3.1", "uuid": "^8.3.0", "web3": "^1.2.11", "web3-eth-contract": "^1.2.11", - "whatwg-url": "^8.0.0" + "whatwg-url": "^8.2.2" } }, "@oceanprotocol/react": { "version": "file:..", "requires": { - "@oceanprotocol/lib": "^0.1.17", + "@oceanprotocol/lib": "^0.2.0", "axios": "^0.20.0", "decimal.js": "^10.2.0", "web3": "^1.2.11", @@ -2731,20 +2731,6 @@ } } }, - "@ethereum-navigator/atlas": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/@ethereum-navigator/atlas/-/atlas-0.7.1.tgz", - "integrity": "sha512-YV7tMVwpRcJbc+Kj/Rr0RzNV/2hHBEEM1/tMWDVLB15dGJfoQuRfPJpFt6uq+Ji6s3EkldIt9kZylEeG5ALKAA==" - }, - "@ethereum-navigator/navigator": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@ethereum-navigator/navigator/-/navigator-0.5.2.tgz", - "integrity": "sha512-agSE2xzLxOKKid8QiS4v8jPhnFXW5uSXsICZ4JmS437aCZ8L3SUAy3cDQKikHb2PPZ3AazJO05k8m8i6u77peQ==", - "requires": { - "@ethereum-navigator/atlas": "^0.7.1", - "web3": "^1.2.7" - } - }, "@ethersproject/abi": { "version": "5.0.0-beta.153", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.0.0-beta.153.tgz", @@ -2914,26 +2900,21 @@ "fastq": "^1.6.0" } }, - "@oceanprotocol/contracts": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.4.1.tgz", - "integrity": "sha512-gc6bCt3pq9cpk1mYDKfsZhLlaM+8yQDFmOjtmT1KGXRmnTBcvmwCQXMrL5VohFaFi7Iqio3FZtuhYyRaEjikCw==" - }, "@oceanprotocol/lib": { - "version": "0.1.17", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.1.17.tgz", - "integrity": "sha512-Efr8BWJ5ngmt09Oj/mE7JF3AXlcQzTXXWzu3C4+mUWt0stnwYzUI5u2wk290N5j/v9e1e+NTl5Ymt9KAw46j4g==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.0.tgz", + "integrity": "sha512-cbEGA2+/oD8srnzXTqX3XUEYyPE2iGVpKOH9jCDG2j2jD+52JQJyQgue4fKA56x/jgtfjnCjZfAvVtXreyNeKw==", "requires": { "@ethereum-navigator/navigator": "^0.5.0", "@oceanprotocol/contracts": "^0.4.1", "decimal.js": "^10.2.0", "fs": "0.0.1-security", - "node-fetch": "^2.6.0", + "node-fetch": "^2.6.1", "save-file": "^2.3.1", "uuid": "^8.3.0", "web3": "^1.2.11", "web3-eth-contract": "^1.2.11", - "whatwg-url": "^8.0.0" + "whatwg-url": "^8.2.2" } }, "@octokit/auth-token": { @@ -3559,11 +3540,6 @@ "resolved": "https://registry.npmjs.org/asyncro/-/asyncro-3.0.0.tgz", "integrity": "sha512-nEnWYfrBmA3taTiuiOoZYmgJ/CNrSoQLeLs29SeLcPu60yaw/mHDBHV0iOZ051fTvsTHxpCY+gXibqT9wbQYfg==" }, - "atob-lite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", - "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=" - }, "auto-changelog": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.2.0.tgz", @@ -5004,11 +4980,6 @@ "is-obj": "^2.0.0" } }, - "dtype": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dtype/-/dtype-2.0.0.tgz", - "integrity": "sha1-zQUjI84GFETs0uj1dI9popvihDQ=" - }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -6212,11 +6183,6 @@ "flat-cache": "^2.0.1" } }, - "file-saver": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.2.tgz", - "integrity": "sha512-Wz3c3XQ5xroCxd1G8b7yL0Ehkf0TC9oYC6buPFkNnU9EnaPlifeAFCyCh+iewXTyFRcg0a6j3J7FmJsIhlhBdw==" - }, "filesize": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", @@ -6338,14 +6304,6 @@ "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==" }, - "flatten-vertex-data": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/flatten-vertex-data/-/flatten-vertex-data-1.0.2.tgz", - "integrity": "sha512-BvCBFK2NZqerFTdMDgqfHBwxYWnxeCkwONsw6PvBMcUXqo8U/KDWwmXhqx1x2kLIg7DqIsJfOaJFOmlua3Lxuw==", - "requires": { - "dtype": "^2.0.0" - } - }, "follow-redirects": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", @@ -6376,11 +6334,6 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, - "fs": { - "version": "0.0.1-security", - "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", - "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=" - }, "fs-extra": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", @@ -7025,21 +6978,6 @@ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" }, - "is-base64": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-base64/-/is-base64-0.1.0.tgz", - "integrity": "sha512-WRRyllsGXJM7ZN7gPTCCQ/6wNPTRDwiWdPK66l5sJzcU/oOzcIcRRf0Rux8bkpox/1yjt0F6VJRsQOIG2qz5sg==" - }, - "is-blob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-blob/-/is-blob-1.0.0.tgz", - "integrity": "sha1-o9fZb+HD/wZex84nwsIea6ksGDI=" - }, - "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" - }, "is-callable": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", @@ -7552,11 +7490,6 @@ "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" - }, "lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -8045,11 +7978,6 @@ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, - "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" - }, "node-gyp-build": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", @@ -10348,19 +10276,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "save-file": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/save-file/-/save-file-2.3.1.tgz", - "integrity": "sha512-VOD2Ojb1/kuj0XbvSXzZ5xr4rRSZD8f+HzKWGztXNp93gBQDj3njFt9HMhmLtnwd7q0BjJkzLXqd8M2+PFS1qg==", - "requires": { - "file-saver": "^2.0.0-rc.4", - "is-blob": "^1.0.0", - "is-buffer": "^2.0.0", - "simple-mime": "^0.1.0", - "to-array-buffer": "^3.2.0", - "write": "^1.0.0" - } - }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", @@ -10570,11 +10485,6 @@ "simple-concat": "^1.0.0" } }, - "simple-mime": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/simple-mime/-/simple-mime-0.1.0.tgz", - "integrity": "sha1-lfUXxPRm18/1YacfydqyWW6p7y4=" - }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -10707,15 +10617,6 @@ "resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz", "integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=" }, - "string-to-arraybuffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-to-arraybuffer/-/string-to-arraybuffer-1.0.2.tgz", - "integrity": "sha512-DaGZidzi93dwjQen5I2osxR9ERS/R7B1PFyufNMnzhj+fmlDQAc1DSDIJVJhgI8Oq221efIMbABUBdPHDRt43Q==", - "requires": { - "atob-lite": "^2.0.0", - "is-base64": "^0.1.0" - } - }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -11088,23 +10989,6 @@ "os-tmpdir": "~1.0.2" } }, - "to-array-buffer": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/to-array-buffer/-/to-array-buffer-3.2.0.tgz", - "integrity": "sha512-zN33mwi0gpL+7xW1ITLfJ48CEj6ZQW0ZAP0MU+2W3kEY0PAIncyuxmD4OqkUVhPAbTP7amq9j/iwvZKYS+lzSQ==", - "requires": { - "flatten-vertex-data": "^1.0.2", - "is-blob": "^2.0.1", - "string-to-arraybuffer": "^1.0.0" - }, - "dependencies": { - "is-blob": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-blob/-/is-blob-2.1.0.tgz", - "integrity": "sha512-SZ/fTft5eUhQM6oF/ZaASFDEdbFVe89Imltn9uZr03wdKMcWNVYSMjQPFtg05QuNkt5l5c135ElvXEQG0rk4tw==" - } - } - }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -11137,14 +11021,6 @@ "punycode": "^2.1.1" } }, - "tr46": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.0.2.tgz", - "integrity": "sha512-3n1qG+/5kg+jrbTzwAykB5yRYtQCTqOGKq5U5PE3b0a1/mzo6snDhjGS0zJVJunO0NrT3Dg1MLy5TjWP/UJppg==", - "requires": { - "punycode": "^2.1.1" - } - }, "tsconfig-paths": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", @@ -11428,11 +11304,6 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, - "uuid": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", - "integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==" - }, "v8-compile-cache": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", @@ -11831,11 +11702,6 @@ "tslib": "^1.10.0" } }, - "webidl-conversions": { - "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", "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.31.tgz", @@ -11848,16 +11714,6 @@ "yaeti": "^0.0.6" } }, - "whatwg-url": { - "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": "^6.1.0" - } - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -12031,24 +11887,6 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, - "write": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", - "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", - "requires": { - "mkdirp": "^0.5.1" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "requires": { - "minimist": "^1.2.5" - } - } - } - }, "write-file-atomic": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", @@ -19589,9 +19427,9 @@ "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "node-forge": { "version": "0.9.0", @@ -25192,9 +25030,9 @@ "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" }, "whatwg-url": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.2.1.tgz", - "integrity": "sha512-ZmVCr6nfBeaMxEHALLEGy0LszYjpJqf6PVNQUQ1qd9Et+q7Jpygd4rGGDXgHjD8e99yLFseD69msHDM4YwPZ4A==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-PcVnO6NiewhkmzV0qn7A+UZ9Xx4maNTI+O+TShmfE4pqjoCMwUMjkvoNhNHPTvgR7QH9Xt3R13iHuWy2sToFxQ==", "requires": { "lodash.sortby": "^4.7.0", "tr46": "^2.0.2", diff --git a/example/package.json b/example/package.json index 9770dba..233b2fb 100644 --- a/example/package.json +++ b/example/package.json @@ -8,7 +8,7 @@ "eject": "react-app-rewired eject" }, "dependencies": { - "@oceanprotocol/lib": "^0.1.17", + "@oceanprotocol/lib": "^0.2.0", "@oceanprotocol/react": "file:../", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/example/src/Publish.tsx b/example/src/Publish.tsx index 2efcd16..c5665a5 100644 --- a/example/src/Publish.tsx +++ b/example/src/Publish.tsx @@ -39,7 +39,7 @@ export function Publish() { liquidityProviderFee: '' } - const ddo = await publish(asset as Metadata, priceOptions, 'access', '', '') + const ddo = await publish(asset as Metadata, priceOptions, 'access') console.log(ddo) setDdo(ddo) } diff --git a/package-lock.json b/package-lock.json index 69611c0..40bf12b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1439,20 +1439,27 @@ "integrity": "sha512-gc6bCt3pq9cpk1mYDKfsZhLlaM+8yQDFmOjtmT1KGXRmnTBcvmwCQXMrL5VohFaFi7Iqio3FZtuhYyRaEjikCw==" }, "@oceanprotocol/lib": { - "version": "0.1.17", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.1.17.tgz", - "integrity": "sha512-Efr8BWJ5ngmt09Oj/mE7JF3AXlcQzTXXWzu3C4+mUWt0stnwYzUI5u2wk290N5j/v9e1e+NTl5Ymt9KAw46j4g==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.0.tgz", + "integrity": "sha512-cbEGA2+/oD8srnzXTqX3XUEYyPE2iGVpKOH9jCDG2j2jD+52JQJyQgue4fKA56x/jgtfjnCjZfAvVtXreyNeKw==", "requires": { "@ethereum-navigator/navigator": "^0.5.0", "@oceanprotocol/contracts": "^0.4.1", "decimal.js": "^10.2.0", "fs": "0.0.1-security", - "node-fetch": "^2.6.0", + "node-fetch": "^2.6.1", "save-file": "^2.3.1", "uuid": "^8.3.0", "web3": "^1.2.11", "web3-eth-contract": "^1.2.11", - "whatwg-url": "^8.0.0" + "whatwg-url": "^8.2.2" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + } } }, "@octokit/auth-token": { @@ -6683,7 +6690,8 @@ "node-fetch": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "dev": true }, "node-gyp-build": { "version": "3.7.0", @@ -10559,9 +10567,9 @@ } }, "whatwg-url": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.2.1.tgz", - "integrity": "sha512-ZmVCr6nfBeaMxEHALLEGy0LszYjpJqf6PVNQUQ1qd9Et+q7Jpygd4rGGDXgHjD8e99yLFseD69msHDM4YwPZ4A==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-PcVnO6NiewhkmzV0qn7A+UZ9Xx4maNTI+O+TShmfE4pqjoCMwUMjkvoNhNHPTvgR7QH9Xt3R13iHuWy2sToFxQ==", "requires": { "lodash.sortby": "^4.7.0", "tr46": "^2.0.2", diff --git a/package.json b/package.json index 37885a5..6b85cbf 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "dist/" ], "dependencies": { - "@oceanprotocol/lib": "^0.1.17", + "@oceanprotocol/lib": "^0.2.0", "axios": "^0.20.0", "decimal.js": "^10.2.0", "web3": "^1.2.11", diff --git a/src/hooks/usePublish/DataTokenOptions.ts b/src/hooks/usePublish/DataTokenOptions.ts new file mode 100644 index 0000000..9bb28fb --- /dev/null +++ b/src/hooks/usePublish/DataTokenOptions.ts @@ -0,0 +1,5 @@ +export interface DataTokenOptions { + cap?: string + name?: string + symbol?: string +} diff --git a/src/hooks/usePublish/index.ts b/src/hooks/usePublish/index.ts index b550b5c..582f913 100644 --- a/src/hooks/usePublish/index.ts +++ b/src/hooks/usePublish/index.ts @@ -1,2 +1,3 @@ export * from './usePublish' export * from './PriceOptions' +export * from './DataTokenOptions' diff --git a/src/hooks/usePublish/usePublish.ts b/src/hooks/usePublish/usePublish.ts index d50dcb0..71b8b34 100644 --- a/src/hooks/usePublish/usePublish.ts +++ b/src/hooks/usePublish/usePublish.ts @@ -9,14 +9,14 @@ import { } from '@oceanprotocol/lib/dist/node/ddo/interfaces/Service' import { PriceOptions } from './PriceOptions' import { publishFeedback } from '../../utils' +import { DataTokenOptions } from '.' interface UsePublish { publish: ( asset: Metadata, priceOptions: PriceOptions, serviceConfigs: ServiceType, - mpAddress: string, - mpFee: string + dataTokenOptions?: DataTokenOptions ) => Promise mint: (tokenAddress: string, tokensToMint: string) => void publishStep?: number @@ -42,6 +42,7 @@ function usePublish(): UsePublish { * @param {Metadata} asset The metadata of the asset. * @param {PriceOptions} priceOptions : number of tokens to mint, datatoken weight , liquidity fee, type : fixed, dynamic * @param {ServiceType} serviceType Desired service type of the asset access or compute + * @param {DataTokenOptions} dataTokenOptions custom name, symbol and cap for datatoken * @param {string} mpAddress The address of the market * @param {string} mpFee The fee of the market * @return {Promise} Returns the newly published ddo @@ -49,7 +50,8 @@ function usePublish(): UsePublish { async function publish( asset: Metadata, priceOptions: PriceOptions, - serviceType: ServiceType + serviceType: ServiceType, + dataTokenOptions?: DataTokenOptions ): Promise { if (status !== ProviderStatus.CONNECTED || !ocean || !account) return setIsLoading(true) @@ -126,7 +128,14 @@ function usePublish(): UsePublish { Logger.log('services created', services) const ddo = await ocean.assets - .create(asset, account, services) + .create( + asset, + account, + services, + dataTokenOptions?.cap, + dataTokenOptions?.name, + dataTokenOptions?.symbol + ) .next(setStep) Logger.log('ddo created', ddo) setStep(7)