diff --git a/package-lock.json b/package-lock.json index e2010012c..476521174 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1431,17 +1431,396 @@ "dev": true }, "@ethereum-navigator/atlas": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@ethereum-navigator/atlas/-/atlas-0.5.1.tgz", - "integrity": "sha512-ZK8S30ITBolyJaJp0DQNcf8Ish+hPHdJ9otlaIyJUbRXSfzPyPNBeP3NbYG9pxDDrYvfxy/07HH1tUcsRecrIA==" + "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.4.1", - "resolved": "https://registry.npmjs.org/@ethereum-navigator/navigator/-/navigator-0.4.1.tgz", - "integrity": "sha512-wOLlwiJprq6fAJETCM1dG1kft2UxXOSr2qU5ZxCkX0uRqL6mikUTZVAJif9e5HgL+EzVFI4/u03rpoGzljriWw==", + "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.5.1", - "web3": "^1.2.4" + "@ethereum-navigator/atlas": "^0.7.1", + "web3": "^1.2.7" + }, + "dependencies": { + "@types/node": { + "version": "10.17.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", + "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==" + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" + }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" + }, + "swarm-js": { + "version": "0.1.40", + "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.40.tgz", + "integrity": "sha512-yqiOCEoA4/IShXkY3WKwP5PvZhmoOOD8clsKA7EEcRILMkTEYHCQ21HDCAcVpmIxZq4LyZvWeRJ6quIyHk1caA==", + "requires": { + "bluebird": "^3.5.0", + "buffer": "^5.0.5", + "eth-lib": "^0.1.26", + "fs-extra": "^4.0.2", + "got": "^7.1.0", + "mime-types": "^2.1.16", + "mkdirp-promise": "^5.0.1", + "mock-fs": "^4.1.0", + "setimmediate": "^1.0.5", + "tar": "^4.0.2", + "xhr-request": "^1.0.1" + }, + "dependencies": { + "got": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "requires": { + "decompress-response": "^3.2.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-plain-obj": "^1.1.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "p-cancelable": "^0.3.0", + "p-timeout": "^1.1.1", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "url-parse-lax": "^1.0.0", + "url-to-options": "^1.0.1" + } + } + } + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "requires": { + "prepend-http": "^1.0.1" + } + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "web3": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.2.7.tgz", + "integrity": "sha512-jAAJHMfUlTps+jH2li1ckDFEpPrEEriU/ubegSTGRl3KRdNhEqT93+3kd7FHJTn3NgjcyURo2+f7Da1YcZL8Mw==", + "requires": { + "web3-bzz": "1.2.7", + "web3-core": "1.2.7", + "web3-eth": "1.2.7", + "web3-eth-personal": "1.2.7", + "web3-net": "1.2.7", + "web3-shh": "1.2.7", + "web3-utils": "1.2.7" + } + }, + "web3-bzz": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.2.7.tgz", + "integrity": "sha512-iTIWBR+Z+Bn09WprtKm46LmyNOasg2lUn++AjXkBTB8UNxlUybxtza84yl2ETTZUs0zuFzdSSAEgbjhygG+9oA==", + "requires": { + "@types/node": "^10.12.18", + "got": "9.6.0", + "swarm-js": "^0.1.40", + "underscore": "1.9.1" + } + }, + "web3-core": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.2.7.tgz", + "integrity": "sha512-QA0MTae0gXcr3KHe3cQ4x56+Wh43ZKWfMwg1gfCc3NNxPRM1jJ8qudzyptCAUcxUGXWpDG8syLIn1APDz5J8BQ==", + "requires": { + "@types/bn.js": "^4.11.4", + "@types/node": "^12.6.1", + "bignumber.js": "^9.0.0", + "web3-core-helpers": "1.2.7", + "web3-core-method": "1.2.7", + "web3-core-requestmanager": "1.2.7", + "web3-utils": "1.2.7" + }, + "dependencies": { + "@types/node": { + "version": "12.12.39", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz", + "integrity": "sha512-pADGfwnDkr6zagDwEiCVE4yQrv7XDkoeVa4OfA9Ju/zRTk6YNDLGtQbkdL4/56mCQQCs4AhNrBIag6jrp7ZuOg==" + } + } + }, + "web3-core-helpers": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.2.7.tgz", + "integrity": "sha512-bdU++9QATGeCetVrMp8pV97aQtVkN5oLBf/TWu/qumC6jK/YqrvLlBJLdwbz0QveU8zOSap6GCvJbqKvmmbV2A==", + "requires": { + "underscore": "1.9.1", + "web3-eth-iban": "1.2.7", + "web3-utils": "1.2.7" + } + }, + "web3-core-method": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.2.7.tgz", + "integrity": "sha512-e1TI0QUnByDMbQ8QHwnjxfjKw0LIgVRY4TYrlPijET9ebqUJU1HCayn/BHIMpV6LKyR1fQj9EldWyT64wZQXkg==", + "requires": { + "underscore": "1.9.1", + "web3-core-helpers": "1.2.7", + "web3-core-promievent": "1.2.7", + "web3-core-subscriptions": "1.2.7", + "web3-utils": "1.2.7" + } + }, + "web3-core-promievent": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.2.7.tgz", + "integrity": "sha512-jNmsM/czCeMGQqKKwM9/HZVTJVIF96hdMVNN/V9TGvp+EEE7vDhB4pUocDnc/QF9Z/5QFBCVmvNWttlRgZmU0A==", + "requires": { + "eventemitter3": "3.1.2" + } + }, + "web3-core-requestmanager": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.2.7.tgz", + "integrity": "sha512-HJb/txjHixu1dxIebiZQKBoJCaNu4gsh7mq/uj6Z/w6tIHbybL90s/7ADyMED353yyJ2tDWtYJqeMVAR+KtdaA==", + "requires": { + "underscore": "1.9.1", + "web3-core-helpers": "1.2.7", + "web3-providers-http": "1.2.7", + "web3-providers-ipc": "1.2.7", + "web3-providers-ws": "1.2.7" + } + }, + "web3-core-subscriptions": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.2.7.tgz", + "integrity": "sha512-W/CzQYOUawdMDvkgA/fmLsnG5aMpbjrs78LZMbc0MFXLpH3ofqAgO2by4QZrrTShUUTeWS0ZuEkFFL/iFrSObw==", + "requires": { + "eventemitter3": "3.1.2", + "underscore": "1.9.1", + "web3-core-helpers": "1.2.7" + } + }, + "web3-eth": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.2.7.tgz", + "integrity": "sha512-ljLd0oB4IjWkzFGVan4HkYhJXhSXgn9iaSaxdJixKGntZPgWMJfxeA+uLwTrlxrWzhvy4f+39WnT7wCh5e9TGg==", + "requires": { + "underscore": "1.9.1", + "web3-core": "1.2.7", + "web3-core-helpers": "1.2.7", + "web3-core-method": "1.2.7", + "web3-core-subscriptions": "1.2.7", + "web3-eth-abi": "1.2.7", + "web3-eth-accounts": "1.2.7", + "web3-eth-contract": "1.2.7", + "web3-eth-ens": "1.2.7", + "web3-eth-iban": "1.2.7", + "web3-eth-personal": "1.2.7", + "web3-net": "1.2.7", + "web3-utils": "1.2.7" + } + }, + "web3-eth-abi": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.2.7.tgz", + "integrity": "sha512-4FnlT1q+D0XBkxSMXlIb/eG337uQeMaUdtVQ4PZ3XzxqpcoDuMgXm4o+3NRxnWmr4AMm6QKjM+hcC7c0mBKcyg==", + "requires": { + "ethers": "4.0.0-beta.3", + "underscore": "1.9.1", + "web3-utils": "1.2.7" + } + }, + "web3-eth-accounts": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.2.7.tgz", + "integrity": "sha512-AE7QWi/iIQIjXwlAPtlMabm/OPFF0a1PhxT1EiTckpYNP8fYs6jW7lYxEtJPPJIKqfMjoi1xkEqTVR1YZQ88lg==", + "requires": { + "@web3-js/scrypt-shim": "^0.1.0", + "crypto-browserify": "3.12.0", + "eth-lib": "^0.2.8", + "ethereumjs-common": "^1.3.2", + "ethereumjs-tx": "^2.1.1", + "underscore": "1.9.1", + "uuid": "3.3.2", + "web3-core": "1.2.7", + "web3-core-helpers": "1.2.7", + "web3-core-method": "1.2.7", + "web3-utils": "1.2.7" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + } + } + }, + "web3-eth-contract": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.2.7.tgz", + "integrity": "sha512-uW23Y0iL7XroRNbf9fWZ1N6OYhEYTJX8gTuYASuRnpYrISN5QGiQML6pq/NCzqypR1bl5E0fuINZQSK/xefIVw==", + "requires": { + "@types/bn.js": "^4.11.4", + "underscore": "1.9.1", + "web3-core": "1.2.7", + "web3-core-helpers": "1.2.7", + "web3-core-method": "1.2.7", + "web3-core-promievent": "1.2.7", + "web3-core-subscriptions": "1.2.7", + "web3-eth-abi": "1.2.7", + "web3-utils": "1.2.7" + } + }, + "web3-eth-ens": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.2.7.tgz", + "integrity": "sha512-SPRnvUNWQ0CnnTDBteGIJkvFWEizJcAHlVsrFLICwcwFZu+appjX1UOaoGu2h3GXWtc/XZlu7B451Gi+Os2cTg==", + "requires": { + "eth-ens-namehash": "2.0.8", + "underscore": "1.9.1", + "web3-core": "1.2.7", + "web3-core-helpers": "1.2.7", + "web3-core-promievent": "1.2.7", + "web3-eth-abi": "1.2.7", + "web3-eth-contract": "1.2.7", + "web3-utils": "1.2.7" + } + }, + "web3-eth-iban": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.2.7.tgz", + "integrity": "sha512-2NrClz1PoQ3nSJBd+91ylCOVga9qbTxjRofq/oSCoHVAEvz3WZyttx9k5DC+0rWqwJF1h69ufFvdHAAlmN/4lg==", + "requires": { + "bn.js": "4.11.8", + "web3-utils": "1.2.7" + } + }, + "web3-eth-personal": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.2.7.tgz", + "integrity": "sha512-2OAa1Spz0uB29dwCM8+1y0So7E47A4gKznjBEwXIYEcUIsvwT5X7ofFhC2XxyRpqlIWZSQAxRSSJFyupRRXzyw==", + "requires": { + "@types/node": "^12.6.1", + "web3-core": "1.2.7", + "web3-core-helpers": "1.2.7", + "web3-core-method": "1.2.7", + "web3-net": "1.2.7", + "web3-utils": "1.2.7" + }, + "dependencies": { + "@types/node": { + "version": "12.12.39", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz", + "integrity": "sha512-pADGfwnDkr6zagDwEiCVE4yQrv7XDkoeVa4OfA9Ju/zRTk6YNDLGtQbkdL4/56mCQQCs4AhNrBIag6jrp7ZuOg==" + } + } + }, + "web3-net": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.2.7.tgz", + "integrity": "sha512-j9qeZrS1FNyCeA0BfdLojkxOZQz3FKa1DJI+Dw9fEVhZS68vLOFANu2RB96gR9BoPHo5+k5D3NsKOoxt1gw3Gg==", + "requires": { + "web3-core": "1.2.7", + "web3-core-method": "1.2.7", + "web3-utils": "1.2.7" + } + }, + "web3-providers-http": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.2.7.tgz", + "integrity": "sha512-vazGx5onuH/zogrwkUaLFJwFcJ6CckP65VFSHoiV+GTQdkOqgoDIha7StKkslvDz4XJ2FuY/zOZHbtuOYeltXQ==", + "requires": { + "web3-core-helpers": "1.2.7", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.2.7.tgz", + "integrity": "sha512-/zc0y724H2zbkV4UbGGMhsEiLfafjagIzfrsWZnyTZUlSB0OGRmmFm2EkLJAgtXrLiodaHHyXKM0vB8S24bxdA==", + "requires": { + "oboe": "2.1.4", + "underscore": "1.9.1", + "web3-core-helpers": "1.2.7" + } + }, + "web3-providers-ws": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.2.7.tgz", + "integrity": "sha512-b5XzqDpRkNVe6MFs5K6iqOEyjQikHtg3KuU2/ClCDV37hm0WN4xCRVMC0LwegulbDXZej3zT9+1CYzGaGFREzA==", + "requires": { + "@web3-js/websocket": "^1.0.29", + "eventemitter3": "^4.0.0", + "underscore": "1.9.1", + "web3-core-helpers": "1.2.7" + }, + "dependencies": { + "eventemitter3": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", + "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==" + } + } + }, + "web3-shh": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.2.7.tgz", + "integrity": "sha512-f6PAgcpG0ZAo98KqCmeHoDEx5qzm3d5plet18DkT4U6WIeYowKdec8vZaLPRR7c2XreXFJ2gQf45CB7oqR7U/w==", + "requires": { + "web3-core": "1.2.7", + "web3-core-method": "1.2.7", + "web3-core-subscriptions": "1.2.7", + "web3-net": "1.2.7" + } + }, + "web3-utils": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.7.tgz", + "integrity": "sha512-FBh/CPJND+eiPeUF9KVbTyTZtXNWxPWtByBaWS6e2x4ACazPX711EeNaZaChIOGSLGe6se2n7kg6wnawe/MjuQ==", + "requires": { + "bn.js": "4.11.8", + "eth-lib": "0.2.7", + "ethereum-bloom-filters": "^1.0.6", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "underscore": "1.9.1", + "utf8": "3.0.0" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + } + } + } } }, "@istanbuljs/load-nyc-config": { @@ -3449,20 +3828,27 @@ } }, "@oceanprotocol/squid": { - "version": "2.0.0-beta.4", - "resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-2.0.0-beta.4.tgz", - "integrity": "sha512-SZx940zRJxN6HPB2Zsk3OMjkBUBjUiVWRvYFjKNTQqwflOe80ceGxWzKRwxcBvzz/C4TN1zXQAXHIidOR8aPMQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-2.1.1.tgz", + "integrity": "sha512-aoZttkArQ3qKsAHcaQfv6kFLpaSeGFHUSDRdK/MllJ5UFzclkDkBJd4P7XIJ5lS8uXOOBrrvQPxDU8wvf2yyMQ==", "requires": { - "@ethereum-navigator/navigator": "^0.4.1", + "@ethereum-navigator/navigator": "^0.5.0", "@oceanprotocol/keeper-contracts": "^0.13.2", "@oceanprotocol/secret-store-client": "^0.0.15", "bignumber.js": "^9.0.0", "deprecated-decorator": "^0.1.6", "node-fetch": "^2.6.0", "save-file": "^2.3.1", - "uuid": "^3.4.0", - "web3": "^1.2.5", + "uuid": "^7.0.2", + "web3": "^1.2.6", "whatwg-url": "^8.0.0" + }, + "dependencies": { + "uuid": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", + "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==" + } } }, "@reach/router": { @@ -6174,6 +6560,11 @@ "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=" }, + "attr-accept": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-2.1.0.tgz", + "integrity": "sha512-sLzVM3zCCmmDtDNhI0i96k6PUztkotSOXqE4kDGQt/6iDi5M+H0srjeF+QC6jN581l4X/Zq3Zu/tgcErEssavg==" + }, "authereum": { "version": "0.0.4-beta.93", "resolved": "https://registry.npmjs.org/authereum/-/authereum-0.0.4-beta.93.tgz", @@ -12199,6 +12590,14 @@ "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.2.tgz", "integrity": "sha512-Wz3c3XQ5xroCxd1G8b7yL0Ehkf0TC9oYC6buPFkNnU9EnaPlifeAFCyCh+iewXTyFRcg0a6j3J7FmJsIhlhBdw==" }, + "file-selector": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.1.12.tgz", + "integrity": "sha512-Kx7RTzxyQipHuiqyZGf+Nz4vY9R1XGxuQl/hLoJwq+J4avk/9wxxgZyHKtbyIPJmbD4A66DWGYfyykWNpcYutQ==", + "requires": { + "tslib": "^1.9.0" + } + }, "file-system-cache": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/file-system-cache/-/file-system-cache-1.0.5.tgz", @@ -22545,6 +22944,16 @@ "prop-types": "^15.6.0" } }, + "react-dropzone": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-11.0.1.tgz", + "integrity": "sha512-x/6wqRHaR8jsrNiu/boVMIPYuoxb83Vyfv77hO7/3ZRn8Pr+KH5onsCsB8MLBa3zdJl410C5FXPUINbu16XIzw==", + "requires": { + "attr-accept": "^2.0.0", + "file-selector": "^0.1.12", + "prop-types": "^15.7.2" + } + }, "react-error-overlay": { "version": "6.0.6", "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.6.tgz", diff --git a/package.json b/package.json index 8d57e959a..aec09f95a 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@oceanprotocol/react": "0.0.3", - "@oceanprotocol/squid": "2.0.0-beta.4", + "@oceanprotocol/squid": "^2.1.1", "axios": "^0.19.2", "date-fns": "^2.11.0", "dotenv": "^8.2.0", @@ -34,6 +34,7 @@ "react-datepicker": "^2.14.0", "react-dom": "^16.13.1", "react-dotdotdot": "^1.3.1", + "react-dropzone": "^11.0.1", "react-jsonschema-form": "^1.8.1", "react-markdown": "^4.3.1", "react-paginate": "^6.3.2", diff --git a/src/@types/MetaData.d.ts b/src/@types/MetaData.d.ts index 4164d6334..6234f4247 100644 --- a/src/@types/MetaData.d.ts +++ b/src/@types/MetaData.d.ts @@ -16,6 +16,8 @@ export interface Sample { url: string } +export declare type AccessType = 'Download' | 'Compute' + export interface AdditionalInformationDexFreight extends AdditionalInformation { description: string // required for dexFreight categories: [string] // required for dexFreight, lock to one category only @@ -26,9 +28,9 @@ export interface AdditionalInformationDexFreight extends AdditionalInformation { granularity?: Granularity supportName?: string supportEmail?: string + access: AccessType } export interface MetaDataDexFreight extends MetaData { additionalInformation: AdditionalInformationDexFreight - curation: Curation } diff --git a/src/components/atoms/Dropzone.module.css b/src/components/atoms/Dropzone.module.css new file mode 100644 index 000000000..61e156f97 --- /dev/null +++ b/src/components/atoms/Dropzone.module.css @@ -0,0 +1,14 @@ +.dropzone { + padding: 22px; + text-align: center; + color: var(--color-secondary); + border: 2px dashed var(--color-primary); +} +.dragover { + border-color: var(--color-secondary); +} +.disabled { +} + +.error { +} diff --git a/src/components/atoms/Dropzone.stories.tsx b/src/components/atoms/Dropzone.stories.tsx new file mode 100644 index 000000000..1399186bc --- /dev/null +++ b/src/components/atoms/Dropzone.stories.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import Dropzone from './Dropzone' + +export default { + title: 'Atoms/Dropzone' +} + +export const Default = () => null} /> diff --git a/src/components/atoms/Dropzone.tsx b/src/components/atoms/Dropzone.tsx new file mode 100644 index 000000000..aef93205a --- /dev/null +++ b/src/components/atoms/Dropzone.tsx @@ -0,0 +1,68 @@ +import React, { useCallback } from 'react' +import { useDropzone } from 'react-dropzone' +import styles from './Dropzone.module.css' +import { formatBytes } from '../../utils' + +export default function Dropzone({ + handleOnDrop, + disabled, + multiple, + error +}: { + handleOnDrop(files: File[]): void + disabled?: boolean + multiple?: boolean + error?: string +}) { + const onDrop = useCallback(acceptedFiles => handleOnDrop(acceptedFiles), [ + handleOnDrop + ]) + + const { + getRootProps, + getInputProps, + isDragActive, + isDragReject, + acceptedFiles + } = useDropzone({ onDrop }) + + const files = acceptedFiles.map((file: any) => ( +
  • + {file.path} - {formatBytes(file.size, 0)} +
  • + )) + + return ( +
    +
    + {acceptedFiles.length > 0 ? ( + + ) : ( + <> + + + {isDragActive && !isDragReject ? ( + `Drop it like it's hot!` + ) : multiple ? ( + `Drag 'n' drop some files here, or click to select files` + ) : error ? ( +
    {error}
    + ) : ( + `Drag 'n' drop a file here, or click to select a file` + )} + + )} +
    +
    + ) +} diff --git a/src/components/molecules/Web3Feedback/index.stories.tsx b/src/components/molecules/Web3Feedback/index.stories.tsx index 711401f6d..3b4880af0 100644 --- a/src/components/molecules/Web3Feedback/index.stories.tsx +++ b/src/components/molecules/Web3Feedback/index.stories.tsx @@ -1,13 +1,11 @@ import React from 'react' import Web3Feedback from '.' -import { - InjectedProviderStatus, - context, - Web3Context -} from '../../../context/Web3Context' import web3Mock from '../../../../tests/unit/__mocks__/web3' -import web3ProviderMock from '../../../../tests/unit/__mocks__/web3provider' +import web3ProviderMock, { + context +} from '../../../../tests/unit/__mocks__/web3provider' import { Center } from '../../../../.storybook/helpers' +import { InjectedProviderStatus } from '@oceanprotocol/react' export default { title: 'Molecules/Web3Feedback', @@ -18,7 +16,7 @@ export const NoWeb3Browser = () => { const mock = { ...web3ProviderMock, web3: null - } as Web3Context + } as any return ( diff --git a/src/components/organisms/Compute.module.css b/src/components/organisms/Compute.module.css new file mode 100644 index 000000000..f6527cd5e --- /dev/null +++ b/src/components/organisms/Compute.module.css @@ -0,0 +1,37 @@ +.jobButtonWrapper { + margin-top: var(--spacer); +} +.selectType { + width: 100%; + margin-bottom: var(--spacer); +} +.feedback { + width: 100%; + margin-top: var(--spacer); + padding-top: var(--spacer); + border-top: 1px solid var(--color-secondary); +} + +.compute { + display: flex; + flex-wrap: wrap; + padding: calc(var(--spacer) * 1.5); +} +.compute button { + margin-left: var(--spacer); +} +.compute button:first { + margin-left: 0px; +} +.price { + padding-bottom: calc(var(--spacer) * 1.5); +} + +.info { + display: flex; + flex-direction: column; + width: 100%; + padding-top: calc(var(--spacer) * 0.5); + padding-bottom: var(--spacer); + border-top: 1px solid var(--color-secondary); +} diff --git a/src/components/organisms/Compute.stories.tsx b/src/components/organisms/Compute.stories.tsx new file mode 100644 index 000000000..6b50633aa --- /dev/null +++ b/src/components/organisms/Compute.stories.tsx @@ -0,0 +1,22 @@ +import React from 'react' +import Compute from './Compute' +import ddo from '../../../tests/unit/__fixtures__/ddo' +import web3Mock from '../../../tests/unit/__mocks__/web3' +import { DDO } from '@oceanprotocol/squid' +import oceanMock from '../../../tests/unit/__mocks__/ocean-mock' +import { context } from '../../../tests/unit/__mocks__/web3provider' + +export default { + title: 'Organisms/Consumejob', + decorators: [ + (storyFn: () => React.FC) => ( +
    {storyFn()}
    + ) + ] +} + +export const Default = () => ( + + + +) diff --git a/src/components/organisms/Compute.tsx b/src/components/organisms/Compute.tsx new file mode 100644 index 000000000..ca276e89e --- /dev/null +++ b/src/components/organisms/Compute.tsx @@ -0,0 +1,147 @@ +import React, { useState, useEffect } from 'react' +import { DDO, MetaDataAlgorithm, Ocean, DID } from '@oceanprotocol/squid' +import { ServiceMetadata } from '@oceanprotocol/squid/dist/node/ddo/Service' +import { fromWei } from 'web3-utils' +import compareAsBN, { Comparisson } from '../../utils/compareAsBN' +import Loader from '../atoms/Loader' +import { config } from '../../config/ocean' +import Web3Feedback from '../molecules/Web3Feedback' +import Dropzone from '../atoms/Dropzone' +import Price from '../atoms/Price' +import { findServiceByType } from '../../utils' +import { + computeOptions, + useCompute, + readFileContent +} from '@oceanprotocol/react' +import styles from './Consume.module.css' +import Button from '../atoms/Button' + +export default function Compute({ + ddo, + balance, + ocean +}: { + ddo: DDO | null + balance: string | null + ocean: Ocean | null +}) { + if (!ddo) return null + const { compute, computeStep, computeStepText } = useCompute() + const [isJobStarting, setIsJobStarting] = useState(false) + const [step, setStep] = useState(99) + const [error, setError] = useState('') + const [isBalanceSufficient, setIsBalanceSufficient] = useState(false) + + const [computeType, setComputeType] = useState('') + const [computeContainer, setComputeContainer] = useState({ + entrypoint: '', + image: '', + tag: '' + }) + const [algorithmRawCode, setAlgorithmRawCode] = useState('') + const [isPublished, setIsPublished] = useState(false) + const [file, setFile] = useState(null) + + const metadata = findServiceByType(ddo, 'metadata') as ServiceMetadata + const { price } = metadata.attributes.main + + const isFree = price === '0' + + const [isTermsAgreed, setIsTermsAgreed] = useState(false) + const isComputeButtonDisabled = + isJobStarting || + file === null || + computeType === '' || + !ocean || + !isBalanceSufficient || + !isTermsAgreed + + useEffect(() => { + setIsBalanceSufficient( + isFree || + (balance !== null && + compareAsBN(balance, fromWei(price), Comparisson.gte)) + ) + }, [balance]) + + const onDrop = async (files: any) => { + setFile(files[0]) + const fileText = await readFileContent(files[0]) + setAlgorithmRawCode(fileText) + } + + const handleSelectChange = (event: any) => { + const comType = event.target.value + setComputeType(comType) + + const selectedComputeOption = computeOptions.find(x => x.name === comType) + if (selectedComputeOption !== undefined) + setComputeContainer(selectedComputeOption.value) + } + + const startJob = async () => { + try { + if (!ocean) return + setIsJobStarting(true) + setIsPublished(false) + setError('') + // compute(ddo.id, algorithmRawCode, computeContainer) + setIsPublished(true) + setFile(null) + } catch (error) { + setError('Failed to start job!') + console.log(error) + } + setIsJobStarting(false) + } + + function onCheck(event: any) { + console.log(event, event.target.checked) + setIsTermsAgreed(event.target.checked) + } + + return ( +
    + + +
    +
    + {/* handleChange(e)} + required + /> */} +
    +
    + + +
    + +
    + {/* */} +
    + + {isJobStarting && } + {error !== '' &&
    {error}
    } + {isPublished && ( +
    +

    Your job started! Watch the progress in the history page.

    +
    + )} +
    + +
    + +
    +
    + ) +} diff --git a/src/components/organisms/Consume.stories.tsx b/src/components/organisms/Consume.stories.tsx index 96121d2d7..4526ad452 100644 --- a/src/components/organisms/Consume.stories.tsx +++ b/src/components/organisms/Consume.stories.tsx @@ -1,9 +1,9 @@ import React from 'react' -import { context } from '../../context/Web3Context' import Consume from './Consume' import ddo from '../../../tests/unit/__fixtures__/ddo' import web3Mock from '../../../tests/unit/__mocks__/web3' import { DDO } from '@oceanprotocol/squid' +import { context } from '../../../tests/unit/__mocks__/web3provider' export default { title: 'Organisms/Consume', diff --git a/src/components/templates/AssetDetails/index.tsx b/src/components/templates/AssetDetails/index.tsx index 8678cd14e..627fc240c 100644 --- a/src/components/templates/AssetDetails/index.tsx +++ b/src/components/templates/AssetDetails/index.tsx @@ -15,7 +15,7 @@ import RatingAction from './RatingAction' import styles from './index.module.css' import { config } from '../../../config/ocean' import { findServiceByType } from '../../../utils' -import { useMetadata } from '@oceanprotocol/react' +import { useMetadata, useWeb3 } from '@oceanprotocol/react' export declare type AssetDetailsPageProps = { title: string @@ -38,7 +38,8 @@ const AssetDetailsPageMeta = ({ description, copyrightHolder, categories, - tags + tags, + access } = attributes.additionalInformation const { curation } = attributes @@ -47,7 +48,7 @@ const AssetDetailsPageMeta = ({ const [numVotes, setNumVotes] = useState( curation ? curation.numVotes : 0 ) - + const isCompute = access && access === 'Compute' const onVoteUpdate = async () => { const { rating, numVotes } = await getCuration(ddo.id) diff --git a/src/models/Asset.ts b/src/models/Asset.ts index e4af86993..a202cb268 100644 --- a/src/models/Asset.ts +++ b/src/models/Asset.ts @@ -25,7 +25,8 @@ const AssetModel: MetaDataDexFreight = { dateRange: undefined, granularity: undefined, supportName: undefined, - supportEmail: undefined + supportEmail: undefined, + access: 'Download' }, curation: { rating: 0, diff --git a/src/utils/index.ts b/src/utils/index.ts index 605cc630f..66652acc0 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -140,3 +140,12 @@ export function setProperty>( delete objectToBeUpdated[propertyName] } } + +export function formatBytes(a: number, b: number) { + if (a === 0) return '0 Bytes' + const c = 1024 + const d = b || 2 + const e = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + const f = Math.floor(Math.log(a) / Math.log(c)) + return parseFloat((a / Math.pow(c, f)).toFixed(d)) + ' ' + e[f] +} diff --git a/tests/unit/__fixtures__/job.ts b/tests/unit/__fixtures__/job.ts new file mode 100644 index 000000000..352dc6ac7 --- /dev/null +++ b/tests/unit/__fixtures__/job.ts @@ -0,0 +1,20 @@ +import { ComputeJob } from '@oceanprotocol/squid' + +// ComputeJob need to be updated in squid +const job: Partial = { + agreementId: + 'ccc60b8d33ae4986b224551b69f521761171159994474debbb5353f45286e206', + algorithmLogUrl: + 'https://compute-publish.s3.amazonaws.com/605fb38b076844b7a2ee912b229a3f73/data/logs/algorithm.log', + dateCreated: '1585828421.03217', + dateFinished: '1585828541.73514', + jobId: '605fb38b076844b7a2ee912b229a3f7333', + owner: '0x4D156A2ef69ffdDC55838176C6712C90f60a2285', + resultsUrls: [ + 'https://compute-publish.s3.amazonaws.com/605fb38b076844b7a2ee912b229a3f73/data/outputs/output.log' + ], + status: 70, + statusText: 'Job finished' +} + +export default job diff --git a/tests/unit/__mocks__/ocean-mock.ts b/tests/unit/__mocks__/ocean-mock.ts new file mode 100644 index 000000000..98c8b75b2 --- /dev/null +++ b/tests/unit/__mocks__/ocean-mock.ts @@ -0,0 +1,91 @@ +import ddo from '../__fixtures__/ddo' +import job from '../__fixtures__/job' + +const oceanMock = { + accounts: { + list: () => ['xxx', 'xxx'] + }, + aquarius: { + queryMetadata: () => { + return { + results: [] as any[], + totalResults: 1, + totalPages: 1 + } + } + }, + compute: { + status: (account: string) => { + return [job] + } + }, + assets: { + query: () => { + return { + results: [ddo] as any[], + page: 1, + /* eslint-disable @typescript-eslint/camelcase */ + total_pages: 1611, + total_results: 1611 + /* eslint-enable @typescript-eslint/camelcase */ + } + }, + resolve: () => null as any, + order: () => { + return { + next: () => null as any + } + }, + consume: () => null as any, + getFreeWhiteList: () => Promise.resolve([]) + }, + keeper: { + conditions: { + accessSecretStoreCondition: { + getGrantedDidByConsumer: () => { + return { + find: Promise.resolve( + 'did:op:e6fda48e8d814d5d9655645aac3c046cc87528dbc1a9449799e579d7b83d1360' + ) + } + } + } + }, + agreementStoreManager: { + getAgreement: (agreementId: string) => + Promise.resolve({ + did: + 'did:op:e6fda48e8d814d5d9655645aac3c046cc87528dbc1a9449799e579d7b83d1360' + }) + } + }, + versions: { + get: () => + Promise.resolve({ + squid: { + name: 'Squid-js', + status: 'Working' + }, + aquarius: { + name: 'Aquarius', + status: 'Working' + }, + brizo: { + name: 'Brizo', + network: 'Nile', + status: 'Working', + contracts: { + hello: 'hello', + hello2: 'hello2' + } + }, + status: { + ok: true, + network: true, + contracts: true + } + }) + } +} + +export default oceanMock diff --git a/tests/unit/__mocks__/web3provider.ts b/tests/unit/__mocks__/web3provider.ts deleted file mode 100644 index 8ba1e5858..000000000 --- a/tests/unit/__mocks__/web3provider.ts +++ /dev/null @@ -1,22 +0,0 @@ -import web3Mock from './web3' -import React from 'react' -import { Web3ProviderValue } from '@oceanprotocol/react' - -export const context = React.createContext({ - web3: web3Mock, - ethProviderStatus: -1, - account: '0x0000', - balance: '', - chainId: 1, - web3Connect: {} as any, - enable: () => null as any -}) -export default { - web3: web3Mock, - ethProviderStatus: -1, - account: '0x0000', - balance: '', - chainId: 1, - web3Connect: {} as any, - enable: () => null as any -} diff --git a/tests/unit/__mocks__/web3provider.tsx b/tests/unit/__mocks__/web3provider.tsx new file mode 100644 index 000000000..475e035fb --- /dev/null +++ b/tests/unit/__mocks__/web3provider.tsx @@ -0,0 +1,30 @@ +import web3Mock from './web3' +import React, { useContext, createContext } from 'react' +import { Web3ProviderValue } from '@oceanprotocol/react' + +const valueMock = { + web3: web3Mock, + ethProviderStatus: -1, + account: '0x0000', + balance: '', + chainId: 1, + web3Connect: {} as any, + enable: () => null as any +} + +const Web3ContextMock = React.createContext(valueMock) + +// TODO: this will have to be updated to web3modal +function Web3ProviderMock({ children }: { children: any }): any { + return ( + + {children} + + ) +} + +// Helper hook to access the provider values +const useWeb3 = (): Web3ProviderValue => useContext(Web3ContextMock) + +export { Web3ProviderMock, useWeb3 } +export default Web3ProviderMock diff --git a/tests/unit/pages/[did].test.tsx b/tests/unit/pages/[did].test.tsx index 05205c1c3..b27801388 100644 --- a/tests/unit/pages/[did].test.tsx +++ b/tests/unit/pages/[did].test.tsx @@ -3,10 +3,11 @@ import { render } from '@testing-library/react' import AssetDetails, { getMetadata } from '../../../src/pages/asset/[did]' import ddo from '../__fixtures__/ddo' import { findServiceByType } from '../../../src/utils' -import web3ProviderMock, { context } from '../__mocks__/web3provider' + import { MetaDataDexFreight } from '../../../src/@types/MetaData' import { OceanProvider, Config } from '@oceanprotocol/react' import { config } from '../../../src/config/ocean' +import { Web3ProviderMock } from '../__mocks__/web3provider' const { attributes } = findServiceByType(ddo, 'metadata') @@ -15,7 +16,7 @@ jest.mock('web3') describe('AssetDetails', () => { it('renders without crashing', () => { const { container } = render( - + { title="Hello" /> - + ) expect(container.firstChild).toBeInTheDocument() }) diff --git a/tests/unit/pages/publish.test.tsx b/tests/unit/pages/publish.test.tsx index 404896feb..c6e7bfa4a 100644 --- a/tests/unit/pages/publish.test.tsx +++ b/tests/unit/pages/publish.test.tsx @@ -1,18 +1,19 @@ import React from 'react' import { render } from '@testing-library/react' import Publish from '../../../src/pages/publish' -import web3ProviderMock, { context } from '../__mocks__/web3provider' + import { OceanProvider, Config } from '@oceanprotocol/react' import { config } from '../../../src/config/ocean' +import { Web3ProviderMock } from '../__mocks__/web3provider' describe('Home', () => { it('renders without crashing', () => { const { container } = render( - + - + ) expect(container.firstChild).toBeInTheDocument() })