1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

react hooks

This commit is contained in:
mihaisc 2020-05-11 19:29:47 +03:00
parent ebd5ba9495
commit fe61e586da
14 changed files with 494 additions and 333 deletions

454
package-lock.json generated
View File

@ -3012,6 +3012,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",
@ -21804,9 +22232,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",
@ -22078,14 +22506,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": {
@ -23204,6 +23643,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"

View File

@ -18,6 +18,7 @@
"storybook:build": "build-storybook -c .storybook -o public/storybook"
},
"dependencies": {
"@oceanprotocol/react": "0.0.3",
"@oceanprotocol/squid": "2.0.0-beta.4",
"axios": "^0.19.2",
"date-fns": "^2.11.0",
@ -29,9 +30,9 @@
"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-jsonschema-form": "^1.8.1",
"react-markdown": "^4.3.1",

View File

@ -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 = {}
@ -105,7 +104,7 @@ export function transformPublishFormToMetadata(
const PublishForm: React.FC<PublishFormProps> = () => {
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,

View File

@ -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()

View File

@ -1,10 +1,8 @@
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 +15,19 @@ 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
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 +70,7 @@ export default function Web3Feedback({
</div>
{!isEthProviderAbsent && (
<div className={styles.walletcontainer}>
<Wallet balanceOcean={balance} />
<Wallet balanceOcean={balanceInOcean} />
</div>
)}
</section>

View File

@ -6,35 +6,26 @@ 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'
import { useWeb3, useOcean, useConsume } from '@oceanprotocol/react'
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...'
}
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,11 +34,11 @@ export default function Consume({ ddo }: { ddo: DDO | undefined }) {
}
return isLoading ? (
<Loader message={feedback[feedbackStep]} isHorizontal />
<Loader message={consumeStepText} isHorizontal />
) : (
<Button
primary
onClick={() => purchaseAsset(new DDO(ddo))}
onClick={() => consume(ddo.id)}
disabled={isDisabled}
>
{isFree ? 'Download' : 'Buy'}

View File

@ -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)
}

View File

@ -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 } from '@oceanprotocol/react'
export declare type AssetDetailsPageProps = {
title: string
@ -41,18 +42,14 @@ const AssetDetailsPageMeta = ({
} = attributes.additionalInformation
const { curation } = attributes
const {getCuration} = useMetadata()
const [rating, setRating] = useState<number>(curation ? curation.rating : 0)
const [numVotes, setNumVotes] = useState<number>(
curation ? curation.numVotes : 0
)
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)

View File

@ -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<Web3Context | undefined>(undefined)

View File

@ -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 | Web3>(null)
const [ethProvider, setEthProvider] = useState<any>(null)
const [ethProviderStatus, setEthProviderStatus] = useState(
InjectedProviderStatus.NOT_AVAILABLE
)
const [web3Connect, setWeb3Connect] = useState<any>(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<null> {
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 <context.Provider value={contextValue}>{children}</context.Provider>
}

View File

@ -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 | Ocean>(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
}
}

View File

@ -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 }
}

View File

@ -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
}

View File

@ -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'
@ -12,6 +11,7 @@ import { toast } from 'react-toastify'
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()
@ -25,6 +25,23 @@ 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 (
<>
<Head>
@ -53,7 +70,10 @@ export default function dexfreightApp({ Component, pageProps }: AppProps) {
/>
<NProgress />
<Web3Provider>
<Component {...pageProps} />
<OceanProvider config={config} >
<Component {...pageProps} />
</OceanProvider>
</Web3Provider>
</>
)