diff --git a/package-lock.json b/package-lock.json index 9978cd5d4..20c1e0af6 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": { @@ -3017,6 +3396,434 @@ "resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.13.2.tgz", "integrity": "sha512-915dcnzCHEuvsmRKqVj0RxHT3T386lSJh8WREe4dsnrXHsi1ULNYxX0Ts/cvalv6bRL+aqyaZ6gN3l3nkfwEDg==" }, + "@oceanprotocol/react": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.3.tgz", + "integrity": "sha512-oC/IYQlQDlMDcmF85yvwxLaC3Am8bYoka1bivtfW/LM3bxtm0Z5y0VZtjuigBNmZf7mXXuATVNQjamN9W5VO3A==", + "requires": { + "@oceanprotocol/squid": "^2.1.1", + "axios": "^0.19.2", + "react": "^16.13.1", + "web3connect": "^1.0.0-beta.33" + }, + "dependencies": { + "@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" + }, + "dependencies": { + "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" + } + } + } + }, + "@oceanprotocol/squid": { + "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.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": "^7.0.2", + "web3": "^1.2.6", + "whatwg-url": "^8.0.0" + } + }, + "@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": "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==" + }, + "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.38", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.38.tgz", + "integrity": "sha512-75eLjX0pFuTcUXnnWmALMzzkYorjND0ezNEycaKesbUBg9eGZp4GHPuDmkRc4mQQvIpe29zrzATNRA6hkYqwmA==" + } + } + }, + "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" + } + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + } + } + }, + "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.38", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.38.tgz", + "integrity": "sha512-75eLjX0pFuTcUXnnWmALMzzkYorjND0ezNEycaKesbUBg9eGZp4GHPuDmkRc4mQQvIpe29zrzATNRA6hkYqwmA==" + } + } + }, + "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.3", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.3.tgz", + "integrity": "sha512-HyaFeyfTa18nYjft59vEPsvuq6ZVcrCC1rBw6Fx8ZV9NcuUITBNCnTOyr0tHHkkHn//d+lzhsL1YybgtLQ7lng==" + } + } + }, + "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" + } + } + } + } + } + }, "@oceanprotocol/secret-store-client": { "version": "0.0.15", "resolved": "https://registry.npmjs.org/@oceanprotocol/secret-store-client/-/secret-store-client-0.0.15.tgz", @@ -3026,20 +3833,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==" + } } }, "@oceanprotocol/typographies": { @@ -5756,6 +6570,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", @@ -11762,6 +12581,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", @@ -21776,9 +22603,9 @@ } }, "react": { - "version": "16.12.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.12.0.tgz", - "integrity": "sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA==", + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react/-/react-16.13.1.tgz", + "integrity": "sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==", "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -22050,14 +22877,25 @@ } }, "react-dom": { - "version": "16.12.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.12.0.tgz", - "integrity": "sha512-LMxFfAGrcS3kETtQaCkTKjMiifahaMySFDn71fZUNpPHZQEzmk/GiAeIT8JSOrHB23fnuCOMruL2a8NYlw+8Gw==", + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.13.1.tgz", + "integrity": "sha512-81PIMmVLnCNLO/fFOQxdQkvEq/+Hfpv24XNJfpyZhTRfO0QcmQIF/PgCa1zCOj2w1hrn12MFLyaJ/G0+Mxtfag==", "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "scheduler": "^0.18.0" + "scheduler": "^0.19.1" + }, + "dependencies": { + "scheduler": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", + "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + } } }, "react-dotdotdot": { @@ -22078,6 +22916,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", @@ -23176,6 +24024,7 @@ "version": "0.18.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.18.0.tgz", "integrity": "sha512-agTSHR1Nbfi6ulI0kYNK0203joW2Y5W4po4l+v03tOoiJKpTBbxpNhWDvqc/4IcOw+KLmSiQLTasZ4cab2/UWQ==", + "dev": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" diff --git a/package.json b/package.json index 106b8bbe1..ca478b2ce 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,9 @@ "storybook:build": "build-storybook -c .storybook -o public/storybook" }, "dependencies": { + "@oceanprotocol/react": "0.0.3", + "@oceanprotocol/squid": "^2.1.1", "@oceanprotocol/art": "^2.2.0", - "@oceanprotocol/squid": "2.0.0-beta.4", "@oceanprotocol/typographies": "^0.1.0", "axios": "^0.19.2", "date-fns": "^2.11.0", @@ -31,10 +32,11 @@ "next-svgr": "^0.0.2", "nprogress": "^0.2.0", "numeral": "^2.0.6", - "react": "^16.12.0", + "react": "^16.13.1", "react-datepicker": "^2.14.0", - "react-dom": "^16.12.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/PublishForm/PublishForm.tsx b/src/components/molecules/PublishForm/PublishForm.tsx index 774c42000..830da541f 100644 --- a/src/components/molecules/PublishForm/PublishForm.tsx +++ b/src/components/molecules/PublishForm/PublishForm.tsx @@ -8,8 +8,6 @@ import { } from '../../../models/PublishForm' import useStoredValue from '../../../hooks/useStoredValue' import { MetaDataDexFreight } from '../../../@types/MetaData' -import useOcean from '../../../hooks/useOcean' -import useWeb3 from '../../../hooks/useWeb3' import { File, MetaData } from '@oceanprotocol/squid' import { isBrowser, toStringNoMS } from '../../../utils' import { toast } from 'react-toastify' @@ -17,6 +15,7 @@ import { useRouter } from 'next/router' import styles from './PublishForm.module.css' import utils from 'web3-utils' import AssetModel from '../../../models/Asset' +import { useWeb3, useOcean } from '@oceanprotocol/react' declare type PublishFormProps = {} @@ -84,9 +83,7 @@ export function transformPublishFormToMetadata( supportEmail }, // ------- curation ------- - curation: { - ...AssetModel.curation - } + curation: AssetModel.curation } if (dateRange) { @@ -105,7 +102,7 @@ export function transformPublishFormToMetadata( const PublishForm: React.FC = () => { const [buttonDisabled, setButtonDisabled] = useState(false) const { web3, web3Connect } = useWeb3() - const { ocean } = useOcean(web3) + const { ocean } = useOcean() const router = useRouter() const [data, updateData] = useStoredValue( PUBLISH_FORM_LOCAL_STORAGE_KEY, diff --git a/src/components/molecules/Web3Feedback/Wallet.tsx b/src/components/molecules/Web3Feedback/Wallet.tsx index 67860691d..7c68baac9 100644 --- a/src/components/molecules/Web3Feedback/Wallet.tsx +++ b/src/components/molecules/Web3Feedback/Wallet.tsx @@ -1,8 +1,8 @@ import React from 'react' import styles from './Wallet.module.css' import Button from '../../atoms/Button' -import useWeb3 from '../../../hooks/useWeb3' import { formatNumber } from '../../../utils' +import { useWeb3 } from '@oceanprotocol/react' const Wallet = ({ balanceOcean }: { balanceOcean: string }) => { const { account, balance, web3Connect } = useWeb3() 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/molecules/Web3Feedback/index.tsx b/src/components/molecules/Web3Feedback/index.tsx index e61142a04..5fd223867 100644 --- a/src/components/molecules/Web3Feedback/index.tsx +++ b/src/components/molecules/Web3Feedback/index.tsx @@ -1,10 +1,13 @@ import React from 'react' -import useOcean, { OceanConnectionStatus } from '../../../hooks/useOcean' -import { InjectedProviderStatus } from '../../../context/Web3Context' import Status from '../../atoms/Status' import Wallet from './Wallet' import styles from './index.module.css' -import useWeb3 from '../../../hooks/useWeb3' +import { + useWeb3, + useOcean, + InjectedProviderStatus, + OceanConnectionStatus +} from '@oceanprotocol/react' export declare type Web3Error = { status: 'error' | 'warning' | 'success' @@ -17,20 +20,18 @@ export default function Web3Feedback({ }: { isBalanceInsufficient?: boolean }) { - const { web3, ethProviderStatus } = useWeb3() - const { oceanConnectionStatus, balance } = useOcean(web3) - + const { ethProviderStatus } = useWeb3() + const { status, balanceInOcean } = useOcean() const isEthProviderAbsent = ethProviderStatus === InjectedProviderStatus.NOT_AVAILABLE const isEthProviderDisconnected = ethProviderStatus === InjectedProviderStatus.NOT_CONNECTED - const isOceanDisconnected = - oceanConnectionStatus === OceanConnectionStatus.NOT_CONNECTED + const isOceanDisconnected = status === OceanConnectionStatus.NOT_CONNECTED const isOceanConnectionError = - oceanConnectionStatus === OceanConnectionStatus.OCEAN_CONNECTION_ERROR + status === OceanConnectionStatus.OCEAN_CONNECTION_ERROR const hasSuccess = ethProviderStatus === InjectedProviderStatus.CONNECTED && - oceanConnectionStatus === OceanConnectionStatus.CONNECTED + status === OceanConnectionStatus.CONNECTED const state = isEthProviderAbsent ? 'error' @@ -73,7 +74,7 @@ export default function Web3Feedback({ {!isEthProviderAbsent && (
    - +
    )} 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/organisms/Consume.tsx b/src/components/organisms/Consume.tsx index 14eebc0fa..955644843 100644 --- a/src/components/organisms/Consume.tsx +++ b/src/components/organisms/Consume.tsx @@ -6,35 +6,25 @@ import compareAsBN, { Comparisson } from '../../utils/compareAsBN' import Button from '../atoms/Button' import File from '../atoms/File' import Price from '../atoms/Price' -import usePurchase from '../../hooks/usePurchase' import { MetaDataDexFreight } from '../../@types/MetaData' import Web3Feedback from '../molecules/Web3Feedback' -import useOcean from '../../hooks/useOcean' -import useWeb3 from '../../hooks/useWeb3' import styles from './Consume.module.css' import Loader from '../atoms/Loader' - -export const feedback: { [key in number]: string } = { - 99: 'Decrypting file URL...', - 0: '1/3 Asking for agreement signature...', - 1: '1/3 Agreement initialized.', - 2: '2/3 Asking for two payment confirmations...', - 3: '2/3 Payment confirmed. Requesting access...', - 4: '3/3 Access granted. Consuming file...' -} +import { useWeb3, useOcean, useConsume } from '@oceanprotocol/react' export default function Consume({ ddo }: { ddo: DDO | undefined }) { if (!ddo) return null const { web3 } = useWeb3() - const { ocean, balance } = useOcean(web3) - const { purchaseAsset, isLoading, feedbackStep } = usePurchase() + const { ocean, balanceInOcean } = useOcean() + const { consume, consumeStepText, isLoading } = useConsume() const { attributes } = findServiceByType(ddo, 'metadata') const { price } = attributes.main const file = (attributes as MetaDataDexFreight).main.files[0] const isFree = price === '0' const isBalanceSufficient = - isFree || compareAsBN(balance, Web3.utils.fromWei(price), Comparisson.gte) + isFree || + compareAsBN(balanceInOcean, Web3.utils.fromWei(price), Comparisson.gte) const isDisabled = !ocean || !isBalanceSufficient || isLoading const PurchaseButton = () => { @@ -43,13 +33,9 @@ export default function Consume({ ddo }: { ddo: DDO | undefined }) { } return isLoading ? ( - + ) : ( - ) diff --git a/src/components/templates/AssetDetails/RatingAction.tsx b/src/components/templates/AssetDetails/RatingAction.tsx index f79a92a9d..fce02d567 100644 --- a/src/components/templates/AssetDetails/RatingAction.tsx +++ b/src/components/templates/AssetDetails/RatingAction.tsx @@ -1,12 +1,12 @@ import React, { useState, useEffect } from 'react' import { toast } from 'react-toastify' -import useWeb3 from '../../../hooks/useWeb3' import Rating from '../../atoms/Rating' import rateAsset from '../../../utils/rateAsset' import { DID } from '@oceanprotocol/squid' import styles from './RatingAction.module.css' import getAssetRating from '../../../utils/getAssetRating' import Loader from '../../atoms/Loader' +import { useWeb3 } from '@oceanprotocol/react' export default function RatingAction({ did, onVote @@ -20,6 +20,7 @@ export default function RatingAction({ useEffect(() => { async function getOwnRating() { + if (!account) return const currentRating = await getAssetRating(did, account) currentRating && setRating(currentRating.vote) } diff --git a/src/components/templates/AssetDetails/index.tsx b/src/components/templates/AssetDetails/index.tsx index 0dd291b08..627fc240c 100644 --- a/src/components/templates/AssetDetails/index.tsx +++ b/src/components/templates/AssetDetails/index.tsx @@ -15,6 +15,7 @@ import RatingAction from './RatingAction' import styles from './index.module.css' import { config } from '../../../config/ocean' import { findServiceByType } from '../../../utils' +import { useMetadata, useWeb3 } from '@oceanprotocol/react' export declare type AssetDetailsPageProps = { title: string @@ -37,22 +38,19 @@ const AssetDetailsPageMeta = ({ description, copyrightHolder, categories, - tags + tags, + access } = attributes.additionalInformation const { curation } = attributes + const { getCuration } = useMetadata() const [rating, setRating] = useState(curation ? curation.rating : 0) const [numVotes, setNumVotes] = useState( curation ? curation.numVotes : 0 ) - + const isCompute = access && access === 'Compute' const onVoteUpdate = async () => { - const aquarius = new Aquarius(config.aquariusUri as string, Logger) - const newDdo = await aquarius.retrieveDDO(ddo.id) - if (!newDdo) return - console.log(newDdo) - const { attributes } = findServiceByType(newDdo, 'metadata') - const { rating, numVotes } = (attributes as MetaDataDexFreight).curation + const { rating, numVotes } = await getCuration(ddo.id) setRating(rating) setNumVotes(numVotes) diff --git a/src/context/Web3Context.tsx b/src/context/Web3Context.tsx deleted file mode 100644 index ae3d28ea3..000000000 --- a/src/context/Web3Context.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react' -import Web3 from 'web3' -import Core from 'web3connect/lib/core' - -export enum InjectedProviderStatus { - NOT_AVAILABLE = -1, - NOT_CONNECTED = 0, - CONNECTED = 1 -} - -export interface Web3Context { - web3: null | Web3 - web3Connect: Core - ethProviderStatus: InjectedProviderStatus - account: string - balance: string -} - -export const context = React.createContext(undefined) diff --git a/src/context/Web3Provider.tsx b/src/context/Web3Provider.tsx deleted file mode 100644 index c4606ac00..000000000 --- a/src/context/Web3Provider.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import React, { useState, useEffect } from 'react' -import Web3Connect from 'web3connect' -import Web3 from 'web3' -import { context, InjectedProviderStatus } from './Web3Context' -import getFromFaucet from '../utils/getFromFaucet' - -export default function Web3Provider({ children }: { children: any }) { - const [web3, setWeb3] = useState(null) - const [ethProvider, setEthProvider] = useState(null) - const [ethProviderStatus, setEthProviderStatus] = useState( - InjectedProviderStatus.NOT_AVAILABLE - ) - const [web3Connect, setWeb3Connect] = useState(null) - const [account, setAccount] = useState('') - const [balance, setBalance] = useState('') - - function init(networkId?: string | number) { - const instance = new Web3Connect.Core({ - network: `${networkId}`, - providerOptions: {} - }) - setWeb3Connect(instance) - - if (Web3Connect.checkInjectedProviders().injectedAvailable) { - setEthProviderStatus(InjectedProviderStatus.NOT_CONNECTED) - } - } - - // On mount setup Web3Connect instance & check for injected provider - useEffect(() => { - init() - }, []) - - async function getAccount(web3: Web3) { - const accounts = await web3.eth.getAccounts() - return accounts[0] - } - - async function getBalance(web3: Web3, address: string) { - const balance = await web3.eth.getBalance(address) - return Web3.utils.fromWei(balance) - } - - // - // Listen for provider, account & network changes - // and react to it - // - const handleConnect = async (provider: any) => { - console.debug("Handling 'connect' event with payload", provider) - setEthProvider(provider) - setEthProviderStatus(InjectedProviderStatus.CONNECTED) - - const web3 = new Web3(provider) - setWeb3(web3) - - const account = await getAccount(web3) - setAccount(account) - - const balance = await getBalance(web3, account) - setBalance(balance) - } - - const handleAccountsChanged = async (accounts: string[]) => { - console.debug("Handling 'accountsChanged' event with payload", accounts) - if (accounts.length > 0) { - setAccount(accounts[0]) - - if (web3) { - const balance = await getBalance(web3, accounts[0]) - setBalance(balance) - } - } - } - - const handleNetworkChanged = async (networkId: string | number) => { - console.debug("Handling 'networkChanged' event with payload", networkId) - ethProvider.autoRefreshOnNetworkChange = false - init(networkId) - handleConnect(ethProvider) - } - - // - // Setup event listeners. - // Web3Connect only supports a 'connect', 'error', and 'close' event, - // so we use the injected provider events to handle the rest. - // - useEffect(() => { - web3Connect && web3Connect.on('connect', handleConnect) - - if (ethProvider) { - ethProvider.on('accountsChanged', handleAccountsChanged) - ethProvider.on('networkChanged', handleNetworkChanged) - - return () => { - ethProvider.removeListener('accountsChanged', handleAccountsChanged) - ethProvider.removeListener('networkChanged', handleNetworkChanged) - } - } - }, [web3, web3Connect, ethProvider]) - - // - // Automatically request ETH from Faucet - // - useEffect(() => { - async function getEth(): Promise { - if (!account || !balance) return null - - const hasEnough = Number(balance) > 0 - if (hasEnough) return null - - await getFromFaucet(account) - return null - } - getEth() - }, [account, balance]) - - const contextValue = { - web3, - web3Connect, - ethProviderStatus, - account, - balance - } - - return {children} -} diff --git a/src/hooks/useOcean.tsx b/src/hooks/useOcean.tsx deleted file mode 100644 index a05830621..000000000 --- a/src/hooks/useOcean.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { useState, useEffect } from 'react' -import Web3 from 'web3' -import { Ocean } from '@oceanprotocol/squid' -import { config, CHAIN_IDS, OceanConfig } from '../config/ocean' - -export enum OceanConnectionStatus { - OCEAN_CONNECTION_ERROR = -1, - NOT_CONNECTED = 0, - CONNECTED = 1 -} - -export default function useOcean(web3: null | Web3) { - const [ocean, setOcean] = useState(null) - const [oceanConnectionStatus, setOceanConnectionStatus] = useState( - OceanConnectionStatus.NOT_CONNECTED - ) - const [account, setAccount] = useState('') - const [balance, setBalance] = useState('') - - useEffect(() => { - async function init() { - // @FIXME: the effect assumes that this verification will run once when - // web3 is available, but Metamask might stop reloading the page on - // network change (the reload behavior can even be disabled): - // https://github.com/MetaMask/metamask-extension/issues/3599 - // https://metamask.github.io/metamask-docs/API_Reference/Ethereum_Provider - if (!web3) return - - const chainId = await web3.eth.getChainId() - - if (CHAIN_IDS.indexOf(chainId) < 0) { - console.error('Network/chainId not supported.') - setOceanConnectionStatus(OceanConnectionStatus.NOT_CONNECTED) - return - } - - console.debug('Connecting to Ocean...') - // TODO: quick jest/storybook fix - // should be removed once we know how to mock Ocean in Jest - if (!web3.currentProvider) return - - const oceanInstance = await Ocean.getInstance({ - web3Provider: web3.currentProvider, - ...config - } as OceanConfig) - console.debug('Ocean instance ready.') - setOcean(oceanInstance) - setOceanConnectionStatus(OceanConnectionStatus.CONNECTED) - - const oceanAccounts = await oceanInstance.accounts.list() - oceanAccounts && setAccount(oceanAccounts[0].getId()) - const balance = await oceanAccounts[0].getOceanBalance() - setBalance(`${balance}`) - } - - try { - init() - } catch (error) { - console.error(error.message) - setOceanConnectionStatus(OceanConnectionStatus.OCEAN_CONNECTION_ERROR) - throw error.message - } - }, [web3]) - - useEffect(() => { - async function debug() { - if (!ocean) return - console.debug( - `Ocean instance initiated with:\n ${JSON.stringify(config, null, 2)}` - ) - console.debug(await ocean.versions.get()) - } - debug() - }, [ocean]) - - return { - ocean, - account, - balance, - oceanConnectionStatus - } -} diff --git a/src/hooks/usePurchase.tsx b/src/hooks/usePurchase.tsx deleted file mode 100644 index ce6b4a625..000000000 --- a/src/hooks/usePurchase.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { useState } from 'react' -import { Logger, DDO } from '@oceanprotocol/squid' -import useOcean from './useOcean' -import useWeb3 from './useWeb3' - -/** - * Consume/purchase asset hook. - */ -export default function usePurchaseAsset() { - const { web3 } = useWeb3() - const { ocean } = useOcean(web3) - const [error, setError] = useState(null) - const [isLoading, setIsLoading] = useState(false) - const [feedbackStep, setFeedbackStep] = useState(99) - - const purchaseAsset = async (ddo: DDO) => { - if (!ocean) return - - setIsLoading(true) - - try { - const account = (await ocean.accounts.list())[0] - const agreements = await ocean.keeper.conditions.accessSecretStoreCondition.getGrantedDidByConsumer( - account.getId() - ) - const agreement = agreements.find((el: any) => el.did === ddo.id) - const agreementId = agreement - ? agreement.agreementId - : await ocean.assets - .order(ddo.id, account) - .next(step => setFeedbackStep(step)) - - // manually add another step here for better UX - setFeedbackStep(4) - const path = await ocean.assets.consume(agreementId, ddo.id, account, '') - Logger.log('path', path) - } catch (error) { - setError(error) - Logger.error('error', error.message) - } finally { - setIsLoading(false) - } - } - - return { purchaseAsset, isLoading, feedbackStep, error } -} diff --git a/src/hooks/useWeb3.tsx b/src/hooks/useWeb3.tsx deleted file mode 100644 index f1efda374..000000000 --- a/src/hooks/useWeb3.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { useContext } from 'react' -import { context, Web3Context } from '../context/Web3Context' - -export default function useWeb3() { - const web3Context = useContext(context) - - if (web3Context === null) { - throw new Error('useWeb3Context must be used in children of Web3Provider') - } - - return web3Context as Web3Context -} 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/pages/_app.tsx b/src/pages/_app.tsx index 115f8ff0e..d290116b7 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -3,7 +3,6 @@ import { AppProps } from 'next/app' import Head from 'next/head' import { DefaultSeo } from 'next-seo' import { useRouter } from 'next/router' -import Web3Provider from '../context/Web3Provider' import NProgress from '../components/atoms/NProgress' import { title, description, url } from '../../site.config' import { toast } from 'react-toastify' @@ -13,6 +12,7 @@ import '@oceanprotocol/typographies/css/ocean-typo.css' import 'react-toastify/dist/ReactToastify.css' import '../styles/global.css' import '../components/atoms/NProgress.css' +import { Web3Provider, OceanProvider } from '@oceanprotocol/react' export default function dexfreightApp({ Component, pageProps }: AppProps) { const { asPath } = useRouter() @@ -26,6 +26,24 @@ export default function dexfreightApp({ Component, pageProps }: AppProps) { require('../styles/datepicker.css') } + const config = { + nodeUri: process.env.NODE_URI || 'https://pacific.oceanprotocol.com', + aquariusUri: + process.env.AQUARIUS_URI || + 'https://aquarius.pacific.dexfreight.dev-ocean.com', + brizoUri: + process.env.BRIZO_URI || 'https://brizo.pacific.dexfreight.dev-ocean.com', + brizoAddress: + process.env.BRIZO_ADDRESS || '0xeD792C5FcC8bF3322a6ba89A6e51eF0B6fB3C530', + secretStoreUri: + process.env.SECRET_STORE_URI || 'https://secret-store.oceanprotocol.com', + faucetUri: process.env.FAUCET_URI || 'https://faucet.oceanprotocol.com', + ratingUri: + process.env.RATING_URI || + 'https://rating.pacific.dexfreight.dev-ocean.com', + verbose: 3 + } + return ( <> @@ -54,7 +72,9 @@ export default function dexfreightApp({ Component, pageProps }: AppProps) { /> - + + + ) 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 5ff2cfd58..000000000 --- a/tests/unit/__mocks__/web3provider.ts +++ /dev/null @@ -1,9 +0,0 @@ -import web3Mock from './web3' - -export default { - web3: web3Mock, - ethProviderStatus: -1, - account: '0x0000', - balance: '', - web3Connect: {} as any -} diff --git a/tests/unit/__mocks__/web3provider.tsx b/tests/unit/__mocks__/web3provider.tsx new file mode 100644 index 000000000..8ba1e5858 --- /dev/null +++ b/tests/unit/__mocks__/web3provider.tsx @@ -0,0 +1,22 @@ +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/context/Web3Provider.test.tsx b/tests/unit/context/Web3Provider.test.tsx index 4407646b0..3c5119ad7 100644 --- a/tests/unit/context/Web3Provider.test.tsx +++ b/tests/unit/context/Web3Provider.test.tsx @@ -1,6 +1,6 @@ import React from 'react' import { render } from '@testing-library/react' -import Web3Provider from '../../../src/context/Web3Provider' +import { Web3Provider } from '@oceanprotocol/react' describe('Web3Provider', () => { it('renders without crashing', () => { diff --git a/tests/unit/pages/[did].test.tsx b/tests/unit/pages/[did].test.tsx index 1a208e8da..13670cfa5 100644 --- a/tests/unit/pages/[did].test.tsx +++ b/tests/unit/pages/[did].test.tsx @@ -3,8 +3,7 @@ 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 { context } from '../../../src/context/Web3Context' -import web3ProviderMock from '../__mocks__/web3provider' +import web3ProviderMock, { context } from '../__mocks__/web3provider' import { MetaDataDexFreight } from '../../../src/@types/MetaData' const { attributes } = findServiceByType(ddo, 'metadata') diff --git a/tests/unit/pages/publish.test.tsx b/tests/unit/pages/publish.test.tsx index 3610e714d..c986ee7a6 100644 --- a/tests/unit/pages/publish.test.tsx +++ b/tests/unit/pages/publish.test.tsx @@ -1,8 +1,7 @@ import React from 'react' import { render } from '@testing-library/react' import Publish from '../../../src/pages/publish' -import web3ProviderMock from '../__mocks__/web3provider' -import { context } from '../../../src/context/Web3Context' +import web3ProviderMock, { context } from '../__mocks__/web3provider' describe('Home', () => { it('renders without crashing', () => {