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

remove everything we do not expose in our live market

This commit is contained in:
Matthias Kretschmann 2021-10-18 13:02:36 +01:00
parent 18fec31c09
commit 1d4917817a
Signed by: m
GPG Key ID: 606EEEF3C479A91F
26 changed files with 208 additions and 567 deletions

View File

@ -11,17 +11,7 @@
# Toggle pricing options presented during price creation # Toggle pricing options presented during price creation
#GATSBY_ALLOW_FIXED_PRICING="true" #GATSBY_ALLOW_FIXED_PRICING="true"
#GATSBY_ALLOW_DYNAMIC_PRICING="true" #GATSBY_ALLOW_DYNAMIC_PRICING="true"
#GATSBY_ALLOW_FREE_PRICING="false" #GATSBY_ALLOW_FREE_PRICING="true"
# Define RBAC server URL to implement permission based restrictions
#GATSBY_RBAC_URL="http://localhost:3000"
# Enables another asset editing button holder further advanced settings
#GATSBY_ALLOW_ADVANCED_SETTINGS="true"
#GATSBY_ALLOW_ADVANCED_PUBLISH_SETTINGS="true"
# Allow/Deny Lists
#GATSBY_CREDENTIAL_TYPE="address"
# Privacy Preference Center # Privacy Preference Center
#GATSBY_PRIVACY_PREFERENCE_CENTER="true" #GATSBY_PRIVACY_PREFERENCE_CENTER="true"

View File

@ -26,10 +26,14 @@
- [⬆️ Deployment](#-deployment) - [⬆️ Deployment](#-deployment)
- [💖 Contributing](#-contributing) - [💖 Contributing](#-contributing)
- [🍴 Forking](#-forking) - [🍴 Forking](#-forking)
- [💻 Advanced Features](#-advanced-features) - [💰 Pricing Options](#-pricing-options)
- [Dynamic Pricing](#dynamic-pricing)
- [Fixed Pricing](#fixed-pricing)
- [Free Pricing](#free-pricing)
- [✅ GDPR Compliance](#-gdpr-compliance) - [✅ GDPR Compliance](#-gdpr-compliance)
- [Multi-Language Privacy Policies](#multi-language-privacy-policies) - [Multi-Language Privacy Policies](#multi-language-privacy-policies)
- [Privacy Preference Center](#privacy-preference-center) - [Privacy Preference Center](#privacy-preference-center)
- [Privacy Preference Center Styling](#privacy-preference-center-styling)
- [🏛 License](#-license) - [🏛 License](#-license)
## 🏄 Get Started ## 🏄 Get Started
@ -377,15 +381,21 @@ Additionally, we would also advise that your retain the text saying "Powered by
Everything else is made open according to the apache2 license. We look forward to seeing your data marketplace! Everything else is made open according to the apache2 license. We look forward to seeing your data marketplace!
## 💻 Advanced Features ## 💰 Pricing Options
Ocean Market also includes a number of advanced features that are suitable for an enterprise data market, such as: ### Dynamic Pricing
- Role based access control To allow publishers to set pricing as "Dynamic" you need to add the following environmental variable to your .env file: `GATSBY_ALLOW_DYNAMIC_PRICING="true"` (default).
- Allow and deny lists
- Free pricing
[See our seperate guide on advanced features](docs/advancedSettings.md) ### Fixed Pricing
To allow publishers to set pricing as "Fixed" you need to add the following environmental variable to your .env file: `GATSBY_ALLOW_FIXED_PRICING="true"` (default).
### Free Pricing
To allow publishers to set pricing as "Free" you need to add the following environmental variable to your .env file: `GATSBY_ALLOW_FREE_PRICING="true"` (default).
This allocates the datatokens to the [dispenser contract](https://github.com/oceanprotocol/contracts/blob/main/contracts/dispenser/Dispenser.sol) which dispenses data tokens to users for free. Publishers in your market will now be able to offer their datasets to users for free (excluding gas costs).
## ✅ GDPR Compliance ## ✅ GDPR Compliance
@ -428,7 +438,7 @@ cookies.map((cookie) => {
}) })
``` ```
#### Privacy Preference Centre Styling #### Privacy Preference Center Styling
The privacy preference centre has two styling options `default` and `small`. The default view shows all of the customization options on a full-height side banner. When the `small` setting is used, a much smaller banner is shown which only reveals all of the customization options when the user clicks "Customize". The privacy preference centre has two styling options `default` and `small`. The default view shows all of the customization options on a full-height side banner. When the `small` setting is used, a much smaller banner is shown which only reveals all of the customization options when the user clicks "Customize".

View File

@ -15,8 +15,6 @@ module.exports = {
// List of all supported chainIds. Used to populate the Chains user preferences list. // List of all supported chainIds. Used to populate the Chains user preferences list.
chainIdsSupported: [1, 3, 4, 137, 80001, 1287, 56, 2021000, 1285, 246], chainIdsSupported: [1, 3, 4, 137, 80001, 1287, 56, 2021000, 1285, 246],
rbacUrl: process.env.GATSBY_RBAC_URL || '',
infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx', infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx',
// The ETH address the marketplace fee will be sent to. // The ETH address the marketplace fee will be sent to.
@ -56,13 +54,7 @@ module.exports = {
// tab to publishers during the price creation. // tab to publishers during the price creation.
allowFixedPricing: process.env.GATSBY_ALLOW_FIXED_PRICING || 'true', allowFixedPricing: process.env.GATSBY_ALLOW_FIXED_PRICING || 'true',
allowDynamicPricing: process.env.GATSBY_ALLOW_DYNAMIC_PRICING || 'true', allowDynamicPricing: process.env.GATSBY_ALLOW_DYNAMIC_PRICING || 'true',
allowFreePricing: process.env.GATSBY_ALLOW_FREE_PRICING || 'false', allowFreePricing: process.env.GATSBY_ALLOW_FREE_PRICING || 'true',
// Used to show or hide advanced settings button in asset details page
allowAdvancedSettings: process.env.GATSBY_ALLOW_ADVANCED_SETTINGS || 'false',
allowAdvancedPublishSettings:
process.env.GATSBY_ALLOW_ADVANCED_PUBLISH_SETTINGS || 'false',
credentialType: process.env.GATSBY_CREDENTIAL_TYPE || 'address',
// Set the default privacy policy to initially display // Set the default privacy policy to initially display
// this should be the slug of your default policy markdown file // this should be the slug of your default policy markdown file

View File

@ -1,29 +0,0 @@
# Advanced Settings
**Table of Contents**
- [Role based Access Control](#rbac-settings)
- [Allow and Deny lists](#allow-and-deny-list-settings)
- [Free Pricing](#free-pricing-settings)
## RBAC settings
- Setup and host the Ocean role based access control (RBAC) server. Follow the instructions in the [RBAC repository](https://github.com/oceanprotocol/RBAC-Server)
- The RBAC server can store roles in [Keycloak](https://www.keycloak.org/) or a json file.
- In your .env file, set the value of the `GATSBY_RBAC_URL` environmental variable to the URL of the Ocean RBAC server that you have hosted, e.g. `GATSBY_RBAC_URL= "http://localhost:3000"`
- Users of your marketplace will now require the correct role ("user", "consumer", "publisher") to access features in your marketplace. The market will check the role that has been allocated to the user based on the address that they have connected to the market with.
- The following features have been wrapped in the `Permission` component and will be restricted once the `GATSBY_RBAC_URL` has been defined:
- Viewing or searching datasets requires the user to have permission to `browse`
- Purchasing or trading a datatoken, or adding liquidity to a pool require the user to have permission to `consume`
- Publishing a dataset requires the user to have permission to `publish`
- You can change the permission restrictions by either removing the `Permission` component or passing in a different eventType prop e.g. `<Permission eventType="browse">`.
## Allow and Deny List Settings
- To enable allow and deny lists you need to add the following environmental variable to your .env file: `GATSBY_ALLOW_ADVANCED_SETTINGS="true"`
- Publishers in your market will now have the ability to restrict who can consume their datasets.
## Free Pricing Settings
- To allow publishers to set pricing as "Free" you need to add the following environmental variable to your .env file: `GATSBY_ALLOW_FREE_PRICING="true"`
- This allocates the datatokens to the [dispenser contract](https://github.com/oceanprotocol/contracts/blob/main/contracts/dispenser/Dispenser.sol) which dispenses data tokens to users for free. Publishers in your market will now be able to offer their datasets to users for free (excluding gas costs).

214
package-lock.json generated
View File

@ -19,7 +19,7 @@
"@sindresorhus/slugify": "^2.1.0", "@sindresorhus/slugify": "^2.1.0",
"@tippyjs/react": "^4.2.5", "@tippyjs/react": "^4.2.5",
"@urql/introspection": "^0.3.0", "@urql/introspection": "^0.3.0",
"@walletconnect/web3-provider": "^1.6.5", "@walletconnect/web3-provider": "^1.6.6",
"axios": "^0.23.0", "axios": "^0.23.0",
"chart.js": "^2.9.4", "chart.js": "^2.9.4",
"classnames": "^2.3.1", "classnames": "^2.3.1",
@ -12411,36 +12411,36 @@
} }
}, },
"node_modules/@walletconnect/browser-utils": { "node_modules/@walletconnect/browser-utils": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/browser-utils/-/browser-utils-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/browser-utils/-/browser-utils-1.6.6.tgz",
"integrity": "sha512-HLTysmlCkc2HN2OS6ewMG0v8E9oY2h9zNaDHe0BLN3ZxnsoMCVzkJxy7ryaXCemVdapmr6HgHFexGJoMbWaC4w==", "integrity": "sha512-E29xSHU7Akd4jaPehWVGx7ct+SsUzZbxcGc0fz+Pw6/j4Gh5tlfYZ9XuVixuYI4WPdQ2CmOraj8RrVOu5vba4w==",
"dependencies": { "dependencies": {
"@walletconnect/safe-json": "1.0.0", "@walletconnect/safe-json": "1.0.0",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/window-getters": "1.0.0", "@walletconnect/window-getters": "1.0.0",
"@walletconnect/window-metadata": "1.0.0", "@walletconnect/window-metadata": "1.0.0",
"detect-browser": "5.2.0" "detect-browser": "5.2.0"
} }
}, },
"node_modules/@walletconnect/client": { "node_modules/@walletconnect/client": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/client/-/client-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/client/-/client-1.6.6.tgz",
"integrity": "sha512-dRq1D3NEGwM2I3CpiwFsWy1rrdMKCMSfDUu3rCCXUE4zInx+pyq7IEFjYiSjtOEZzjRlUTqYwhjnYIezQZgh4w==", "integrity": "sha512-DDOrxagSmXCciIEr16hTf4gWZ7PG7GXribYTfOOsjtODLtPEODEEYj/AsmEALjh3ZBG4bN35Vj0F/ZA1D+90GQ==",
"dependencies": { "dependencies": {
"@walletconnect/core": "^1.6.5", "@walletconnect/core": "^1.6.6",
"@walletconnect/iso-crypto": "^1.6.5", "@walletconnect/iso-crypto": "^1.6.6",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5" "@walletconnect/utils": "^1.6.6"
} }
}, },
"node_modules/@walletconnect/core": { "node_modules/@walletconnect/core": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-1.6.6.tgz",
"integrity": "sha512-mmMTP8nZunjSCAy0ckafvt/JcdzcuSZPaAybqgKwx2rC9cc/3XWrdNsfiKMt8AFoQF87jGHem3905eFZYTqLXw==", "integrity": "sha512-pSftIVPY6mYz2koZPBEYmeFeAjVf2MSnRHOM6+vx+iAsUEcfMZHkgeXX6GtM6Fjza+zSZu1qnmdgURVXpmKwtQ==",
"dependencies": { "dependencies": {
"@walletconnect/socket-transport": "^1.6.5", "@walletconnect/socket-transport": "^1.6.6",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5" "@walletconnect/utils": "^1.6.6"
} }
}, },
"node_modules/@walletconnect/crypto": { "node_modules/@walletconnect/crypto": {
@ -12470,24 +12470,24 @@
"integrity": "sha512-4BwqyWy6KpSvkocSaV7WR3BlZfrxLbJSLkg+j7Gl6pTDE+U55lLhJvQaMuDVazXYxcjBsG09k7UlH7cGiUI5vQ==" "integrity": "sha512-4BwqyWy6KpSvkocSaV7WR3BlZfrxLbJSLkg+j7Gl6pTDE+U55lLhJvQaMuDVazXYxcjBsG09k7UlH7cGiUI5vQ=="
}, },
"node_modules/@walletconnect/http-connection": { "node_modules/@walletconnect/http-connection": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/http-connection/-/http-connection-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/http-connection/-/http-connection-1.6.6.tgz",
"integrity": "sha512-5kr6wZ3DnqaBiwkeA9iKdawvIb3bIJNf8WA8X89YHE5KOzbkAsymjniZWs8asdl9Y9+8ZHJMPXtylyrkpT8wXA==", "integrity": "sha512-V0UEnvMQPYBpD+8LAbuxN+i0dWVVfZ8XtmJymsBh2KyHLgKyHSsT5RwSCst132JGDV4/JP4HrHCs5t8KqSfEPw==",
"dependencies": { "dependencies": {
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5", "@walletconnect/utils": "^1.6.6",
"eventemitter3": "4.0.7", "eventemitter3": "4.0.7",
"xhr2-cookies": "1.1.0" "xhr2-cookies": "1.1.0"
} }
}, },
"node_modules/@walletconnect/iso-crypto": { "node_modules/@walletconnect/iso-crypto": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/iso-crypto/-/iso-crypto-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/iso-crypto/-/iso-crypto-1.6.6.tgz",
"integrity": "sha512-145VRX1+gudhHrnT2s81lLW/BEu3QgFMMRCrkxx9Tsl5JiLGcGbWkMxAl8zjGTMqnHeuQngyjvY1mO+3z27a7A==", "integrity": "sha512-wRYgKvd8K3A9FVLn2c0cDh4+9OUHkqibKtwQJTJsz+ibPGgd+n5j1/FjnzDDRGb9T1+TtlwYF3ZswKyys3diVQ==",
"dependencies": { "dependencies": {
"@walletconnect/crypto": "^1.0.1", "@walletconnect/crypto": "^1.0.1",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5" "@walletconnect/utils": "^1.6.6"
} }
}, },
"node_modules/@walletconnect/jsonrpc-types": { "node_modules/@walletconnect/jsonrpc-types": {
@ -12514,13 +12514,13 @@
"deprecated": "Deprecated in favor of dynamic registry available from: https://github.com/walletconnect/walletconnect-registry" "deprecated": "Deprecated in favor of dynamic registry available from: https://github.com/walletconnect/walletconnect-registry"
}, },
"node_modules/@walletconnect/qrcode-modal": { "node_modules/@walletconnect/qrcode-modal": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/qrcode-modal/-/qrcode-modal-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/qrcode-modal/-/qrcode-modal-1.6.6.tgz",
"integrity": "sha512-XII/Pm7zS5pRxrakURuhbWO+SfwgOuLuvOBk/hr1ATK/y7R5p19P62mCSUrvSxHXca27IX1tZJRe9D161R0WgQ==", "integrity": "sha512-wZorjpOIm6OhXKNvyH1YtpxfCUVcnuJxS8YbUeKWckGjS3tDPqUTbXWPlzFdMpNBrpY3j0B2XjLgVVQ2aUDX0w==",
"dependencies": { "dependencies": {
"@walletconnect/browser-utils": "^1.6.5", "@walletconnect/browser-utils": "^1.6.6",
"@walletconnect/mobile-registry": "^1.4.0", "@walletconnect/mobile-registry": "^1.4.0",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"copy-to-clipboard": "^3.3.1", "copy-to-clipboard": "^3.3.1",
"preact": "10.4.1", "preact": "10.4.1",
"qrcode": "1.4.4" "qrcode": "1.4.4"
@ -12542,29 +12542,29 @@
"integrity": "sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg==" "integrity": "sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg=="
}, },
"node_modules/@walletconnect/socket-transport": { "node_modules/@walletconnect/socket-transport": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/socket-transport/-/socket-transport-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/socket-transport/-/socket-transport-1.6.6.tgz",
"integrity": "sha512-FRlgBr3EIxD3du5l/tuK6jdiva85YeRG+iZmo/RPnlVw4opy74WXb5JdCK9jXLcBEoDiY9Hz4j69aqnht6gIDQ==", "integrity": "sha512-mugCEoeKTx75ogb5ROg/+LA3yGTsuRNcrYgrApceo7WNU9Z4dG8l6ycMPqrrFcODcrasq3NmXVWUYDv/CvrzSw==",
"dependencies": { "dependencies": {
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5", "@walletconnect/utils": "^1.6.6",
"ws": "7.5.3" "ws": "7.5.3"
} }
}, },
"node_modules/@walletconnect/types": { "node_modules/@walletconnect/types": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.6.6.tgz",
"integrity": "sha512-S9DsODI35PbIDuOSkIiF8SzTstqCqX/4+kV7n18vyukEFPlpSSHwZMwJUfzo9yJ0pqsqLNZta+jvb88gJRuAaA==" "integrity": "sha512-op77cxexOmQQN36XB1sYouNTlBRV0Rup/2NYK8A1ffdwXa3a6HLHHdhBM7I/I9BVmRXoZ4+XoOnPKGGrYtlS3g=="
}, },
"node_modules/@walletconnect/utils": { "node_modules/@walletconnect/utils": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.6.6.tgz",
"integrity": "sha512-QB5rn/1s0PKVitAQ2/mgWbay2XfN21y3ob+5g6IhxtJRW31bbMoZw5YfO6s4ixLaZZez5LNQXstvQAclRzB7jQ==", "integrity": "sha512-s2X/cVXiMDSEoWV6i7HPMbP1obXlzP7KLMrBo9OMabiJKnQEh6HSZ39WLswB2PHnl8Hp1Sr4BdRvhM5kCcYWRw==",
"dependencies": { "dependencies": {
"@walletconnect/browser-utils": "^1.6.5", "@walletconnect/browser-utils": "^1.6.6",
"@walletconnect/encoding": "^1.0.0", "@walletconnect/encoding": "^1.0.0",
"@walletconnect/jsonrpc-utils": "^1.0.0", "@walletconnect/jsonrpc-utils": "^1.0.0",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"bn.js": "4.11.8", "bn.js": "4.11.8",
"js-sha3": "0.8.0", "js-sha3": "0.8.0",
"query-string": "6.13.5" "query-string": "6.13.5"
@ -12587,15 +12587,15 @@
} }
}, },
"node_modules/@walletconnect/web3-provider": { "node_modules/@walletconnect/web3-provider": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/web3-provider/-/web3-provider-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/web3-provider/-/web3-provider-1.6.6.tgz",
"integrity": "sha512-SeC7+1saHxvFn2wjt/3F0sTkDemHDNDbMkdZ3jtA7vjEw91Q0CmaYIuZk2UxyVM+tC1jL1l4yci/sgaFeAcXpQ==", "integrity": "sha512-8z4r9JCE0lKuZmVCPSdYnX114ckQ+oMfr9D8osRBtdyhvN9elwITMloUJfACDRelcuet94yEbXuDobQeBDDkkw==",
"dependencies": { "dependencies": {
"@walletconnect/client": "^1.6.5", "@walletconnect/client": "^1.6.6",
"@walletconnect/http-connection": "^1.6.5", "@walletconnect/http-connection": "^1.6.6",
"@walletconnect/qrcode-modal": "^1.6.5", "@walletconnect/qrcode-modal": "^1.6.6",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5", "@walletconnect/utils": "^1.6.6",
"web3-provider-engine": "16.0.1" "web3-provider-engine": "16.0.1"
} }
}, },
@ -69541,36 +69541,36 @@
"requires": {} "requires": {}
}, },
"@walletconnect/browser-utils": { "@walletconnect/browser-utils": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/browser-utils/-/browser-utils-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/browser-utils/-/browser-utils-1.6.6.tgz",
"integrity": "sha512-HLTysmlCkc2HN2OS6ewMG0v8E9oY2h9zNaDHe0BLN3ZxnsoMCVzkJxy7ryaXCemVdapmr6HgHFexGJoMbWaC4w==", "integrity": "sha512-E29xSHU7Akd4jaPehWVGx7ct+SsUzZbxcGc0fz+Pw6/j4Gh5tlfYZ9XuVixuYI4WPdQ2CmOraj8RrVOu5vba4w==",
"requires": { "requires": {
"@walletconnect/safe-json": "1.0.0", "@walletconnect/safe-json": "1.0.0",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/window-getters": "1.0.0", "@walletconnect/window-getters": "1.0.0",
"@walletconnect/window-metadata": "1.0.0", "@walletconnect/window-metadata": "1.0.0",
"detect-browser": "5.2.0" "detect-browser": "5.2.0"
} }
}, },
"@walletconnect/client": { "@walletconnect/client": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/client/-/client-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/client/-/client-1.6.6.tgz",
"integrity": "sha512-dRq1D3NEGwM2I3CpiwFsWy1rrdMKCMSfDUu3rCCXUE4zInx+pyq7IEFjYiSjtOEZzjRlUTqYwhjnYIezQZgh4w==", "integrity": "sha512-DDOrxagSmXCciIEr16hTf4gWZ7PG7GXribYTfOOsjtODLtPEODEEYj/AsmEALjh3ZBG4bN35Vj0F/ZA1D+90GQ==",
"requires": { "requires": {
"@walletconnect/core": "^1.6.5", "@walletconnect/core": "^1.6.6",
"@walletconnect/iso-crypto": "^1.6.5", "@walletconnect/iso-crypto": "^1.6.6",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5" "@walletconnect/utils": "^1.6.6"
} }
}, },
"@walletconnect/core": { "@walletconnect/core": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-1.6.6.tgz",
"integrity": "sha512-mmMTP8nZunjSCAy0ckafvt/JcdzcuSZPaAybqgKwx2rC9cc/3XWrdNsfiKMt8AFoQF87jGHem3905eFZYTqLXw==", "integrity": "sha512-pSftIVPY6mYz2koZPBEYmeFeAjVf2MSnRHOM6+vx+iAsUEcfMZHkgeXX6GtM6Fjza+zSZu1qnmdgURVXpmKwtQ==",
"requires": { "requires": {
"@walletconnect/socket-transport": "^1.6.5", "@walletconnect/socket-transport": "^1.6.6",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5" "@walletconnect/utils": "^1.6.6"
} }
}, },
"@walletconnect/crypto": { "@walletconnect/crypto": {
@ -69600,24 +69600,24 @@
"integrity": "sha512-4BwqyWy6KpSvkocSaV7WR3BlZfrxLbJSLkg+j7Gl6pTDE+U55lLhJvQaMuDVazXYxcjBsG09k7UlH7cGiUI5vQ==" "integrity": "sha512-4BwqyWy6KpSvkocSaV7WR3BlZfrxLbJSLkg+j7Gl6pTDE+U55lLhJvQaMuDVazXYxcjBsG09k7UlH7cGiUI5vQ=="
}, },
"@walletconnect/http-connection": { "@walletconnect/http-connection": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/http-connection/-/http-connection-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/http-connection/-/http-connection-1.6.6.tgz",
"integrity": "sha512-5kr6wZ3DnqaBiwkeA9iKdawvIb3bIJNf8WA8X89YHE5KOzbkAsymjniZWs8asdl9Y9+8ZHJMPXtylyrkpT8wXA==", "integrity": "sha512-V0UEnvMQPYBpD+8LAbuxN+i0dWVVfZ8XtmJymsBh2KyHLgKyHSsT5RwSCst132JGDV4/JP4HrHCs5t8KqSfEPw==",
"requires": { "requires": {
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5", "@walletconnect/utils": "^1.6.6",
"eventemitter3": "4.0.7", "eventemitter3": "4.0.7",
"xhr2-cookies": "1.1.0" "xhr2-cookies": "1.1.0"
} }
}, },
"@walletconnect/iso-crypto": { "@walletconnect/iso-crypto": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/iso-crypto/-/iso-crypto-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/iso-crypto/-/iso-crypto-1.6.6.tgz",
"integrity": "sha512-145VRX1+gudhHrnT2s81lLW/BEu3QgFMMRCrkxx9Tsl5JiLGcGbWkMxAl8zjGTMqnHeuQngyjvY1mO+3z27a7A==", "integrity": "sha512-wRYgKvd8K3A9FVLn2c0cDh4+9OUHkqibKtwQJTJsz+ibPGgd+n5j1/FjnzDDRGb9T1+TtlwYF3ZswKyys3diVQ==",
"requires": { "requires": {
"@walletconnect/crypto": "^1.0.1", "@walletconnect/crypto": "^1.0.1",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5" "@walletconnect/utils": "^1.6.6"
} }
}, },
"@walletconnect/jsonrpc-types": { "@walletconnect/jsonrpc-types": {
@ -69643,13 +69643,13 @@
"integrity": "sha512-ZtKRio4uCZ1JUF7LIdecmZt7FOLnX72RPSY7aUVu7mj7CSfxDwUn6gBuK6WGtH+NZCldBqDl5DenI5fFSvkKYw==" "integrity": "sha512-ZtKRio4uCZ1JUF7LIdecmZt7FOLnX72RPSY7aUVu7mj7CSfxDwUn6gBuK6WGtH+NZCldBqDl5DenI5fFSvkKYw=="
}, },
"@walletconnect/qrcode-modal": { "@walletconnect/qrcode-modal": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/qrcode-modal/-/qrcode-modal-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/qrcode-modal/-/qrcode-modal-1.6.6.tgz",
"integrity": "sha512-XII/Pm7zS5pRxrakURuhbWO+SfwgOuLuvOBk/hr1ATK/y7R5p19P62mCSUrvSxHXca27IX1tZJRe9D161R0WgQ==", "integrity": "sha512-wZorjpOIm6OhXKNvyH1YtpxfCUVcnuJxS8YbUeKWckGjS3tDPqUTbXWPlzFdMpNBrpY3j0B2XjLgVVQ2aUDX0w==",
"requires": { "requires": {
"@walletconnect/browser-utils": "^1.6.5", "@walletconnect/browser-utils": "^1.6.6",
"@walletconnect/mobile-registry": "^1.4.0", "@walletconnect/mobile-registry": "^1.4.0",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"copy-to-clipboard": "^3.3.1", "copy-to-clipboard": "^3.3.1",
"preact": "10.4.1", "preact": "10.4.1",
"qrcode": "1.4.4" "qrcode": "1.4.4"
@ -69671,29 +69671,29 @@
"integrity": "sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg==" "integrity": "sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg=="
}, },
"@walletconnect/socket-transport": { "@walletconnect/socket-transport": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/socket-transport/-/socket-transport-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/socket-transport/-/socket-transport-1.6.6.tgz",
"integrity": "sha512-FRlgBr3EIxD3du5l/tuK6jdiva85YeRG+iZmo/RPnlVw4opy74WXb5JdCK9jXLcBEoDiY9Hz4j69aqnht6gIDQ==", "integrity": "sha512-mugCEoeKTx75ogb5ROg/+LA3yGTsuRNcrYgrApceo7WNU9Z4dG8l6ycMPqrrFcODcrasq3NmXVWUYDv/CvrzSw==",
"requires": { "requires": {
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5", "@walletconnect/utils": "^1.6.6",
"ws": "7.5.3" "ws": "7.5.3"
} }
}, },
"@walletconnect/types": { "@walletconnect/types": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.6.6.tgz",
"integrity": "sha512-S9DsODI35PbIDuOSkIiF8SzTstqCqX/4+kV7n18vyukEFPlpSSHwZMwJUfzo9yJ0pqsqLNZta+jvb88gJRuAaA==" "integrity": "sha512-op77cxexOmQQN36XB1sYouNTlBRV0Rup/2NYK8A1ffdwXa3a6HLHHdhBM7I/I9BVmRXoZ4+XoOnPKGGrYtlS3g=="
}, },
"@walletconnect/utils": { "@walletconnect/utils": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.6.6.tgz",
"integrity": "sha512-QB5rn/1s0PKVitAQ2/mgWbay2XfN21y3ob+5g6IhxtJRW31bbMoZw5YfO6s4ixLaZZez5LNQXstvQAclRzB7jQ==", "integrity": "sha512-s2X/cVXiMDSEoWV6i7HPMbP1obXlzP7KLMrBo9OMabiJKnQEh6HSZ39WLswB2PHnl8Hp1Sr4BdRvhM5kCcYWRw==",
"requires": { "requires": {
"@walletconnect/browser-utils": "^1.6.5", "@walletconnect/browser-utils": "^1.6.6",
"@walletconnect/encoding": "^1.0.0", "@walletconnect/encoding": "^1.0.0",
"@walletconnect/jsonrpc-utils": "^1.0.0", "@walletconnect/jsonrpc-utils": "^1.0.0",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"bn.js": "4.11.8", "bn.js": "4.11.8",
"js-sha3": "0.8.0", "js-sha3": "0.8.0",
"query-string": "6.13.5" "query-string": "6.13.5"
@ -69712,15 +69712,15 @@
} }
}, },
"@walletconnect/web3-provider": { "@walletconnect/web3-provider": {
"version": "1.6.5", "version": "1.6.6",
"resolved": "https://registry.npmjs.org/@walletconnect/web3-provider/-/web3-provider-1.6.5.tgz", "resolved": "https://registry.npmjs.org/@walletconnect/web3-provider/-/web3-provider-1.6.6.tgz",
"integrity": "sha512-SeC7+1saHxvFn2wjt/3F0sTkDemHDNDbMkdZ3jtA7vjEw91Q0CmaYIuZk2UxyVM+tC1jL1l4yci/sgaFeAcXpQ==", "integrity": "sha512-8z4r9JCE0lKuZmVCPSdYnX114ckQ+oMfr9D8osRBtdyhvN9elwITMloUJfACDRelcuet94yEbXuDobQeBDDkkw==",
"requires": { "requires": {
"@walletconnect/client": "^1.6.5", "@walletconnect/client": "^1.6.6",
"@walletconnect/http-connection": "^1.6.5", "@walletconnect/http-connection": "^1.6.6",
"@walletconnect/qrcode-modal": "^1.6.5", "@walletconnect/qrcode-modal": "^1.6.6",
"@walletconnect/types": "^1.6.5", "@walletconnect/types": "^1.6.6",
"@walletconnect/utils": "^1.6.5", "@walletconnect/utils": "^1.6.6",
"web3-provider-engine": "16.0.1" "web3-provider-engine": "16.0.1"
} }
}, },

View File

@ -1,4 +1,5 @@
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/Compute' import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/Compute'
import { OrdersData_tokenOrders_datatokenId as OrdersDatatoken } from './apollo/OrdersData'
// declaring into global scope to be able to use this as // declaring into global scope to be able to use this as
// ambiant types despite the above imports // ambiant types despite the above imports
@ -18,4 +19,17 @@ declare global {
allowAllPublishedAlgorithms: boolean allowAllPublishedAlgorithms: boolean
publisherTrustedAlgorithms: string[] publisherTrustedAlgorithms: string[]
} }
interface TokenOrder {
id: string
serviceId: number
datatokenId: OrdersDatatoken
tx: any
timestamp: number
}
interface ComputeResults {
computeJobs: ComputeJobMetaData[]
isLoaded: boolean
}
} }

View File

@ -1,5 +1,4 @@
import React, { ReactElement, useState, FormEvent, ChangeEvent } from 'react' import React, { ReactElement, useState, FormEvent, ChangeEvent } from 'react'
import { useSiteMetadata } from '@hooks/useSiteMetadata'
import Input from '@shared/Form/Input' import Input from '@shared/Form/Input'
import Button from '@shared/atoms/Button' import Button from '@shared/atoms/Button'
import { Field } from 'formik' import { Field } from 'formik'
@ -12,27 +11,24 @@ export default function AdvancedSettings(prop: {
field: FormFieldProps field: FormFieldProps
) => void ) => void
}): ReactElement { }): ReactElement {
const { appConfig } = useSiteMetadata() const [showAdvancedSettings, setShowAdvancedSettings] =
const [advancedSettings, setAdvancedSettings] = useState<boolean>(false) useState<boolean>(false)
function toggleAdvancedSettings(e: FormEvent<Element>) { function toggleAdvancedSettings(e: FormEvent<Element>) {
e.preventDefault() e.preventDefault()
advancedSettings === true setShowAdvancedSettings(!!showAdvancedSettings)
? setAdvancedSettings(false)
: setAdvancedSettings(true)
} }
return ( return (
<> <>
{appConfig.allowAdvancedPublishSettings === 'true' && ( <Button
<Button className={styles.advancedBtn}
className={styles.advancedBtn} style="text"
style="text" size="small"
size="small" onClick={toggleAdvancedSettings}
onClick={toggleAdvancedSettings} >
> Advanced Settings
Advanced Settings </Button>
</Button> {showAdvancedSettings &&
)}
{advancedSettings === true &&
prop.content.data.map( prop.content.data.map(
(field: FormFieldProps) => (field: FormFieldProps) =>
field.advanced === true && ( field.advanced === true && (

View File

@ -1,72 +0,0 @@
import React, { ReactElement, useEffect, useState } from 'react'
import { useWeb3 } from '@context/Web3'
import rbacRequest from '@utils/rbac'
import Alert from '@shared/atoms/Alert'
import Loader from '@shared/atoms/Loader'
import { useIsMounted } from '@hooks/useIsMounted'
import { useSiteMetadata } from '@hooks/useSiteMetadata'
export default function Permission({
eventType,
children
}: {
eventType: string
children: ReactElement
}): ReactElement {
const { appConfig } = useSiteMetadata()
const url = appConfig?.rbacUrl
const [data, updateData] = useState<boolean | 'ERROR'>()
const [errorMessage, updateError] = useState<string>()
const [messageState, updateMessageState] =
useState<'error' | 'warning' | 'info' | 'success'>()
const { accountId } = useWeb3()
const isMounted = useIsMounted()
useEffect(() => {
if (url === '') return
const controller = new AbortController()
const getData = async () => {
if (accountId === undefined) {
updateError('Please make sure your wallet is connected to proceed.')
updateMessageState('info')
} else {
const data = await rbacRequest(eventType, accountId, controller.signal)
if (!isMounted()) return
updateData(data)
if (data === 'ERROR') {
updateError(
'There was an error verifying your permissions. Please refresh the page or conntact your network administrator'
)
updateMessageState('error')
} else if (data === false) {
updateError(
`Sorry, you don't have permission to ${eventType}. Please make sure you have connected your registered address.`
)
updateMessageState('warning')
} else if (data !== true) {
updateError(
'An unkown error occured. Please conntact your network administrator'
)
updateMessageState('error')
}
}
}
getData()
return () => {
controller.abort()
}
}, [eventType, accountId, url, isMounted])
if (url === '' || data === true) {
return <>{children}</>
}
return (
<>
<Alert text={errorMessage} state={messageState} />
<br />
<Loader />
</>
)
}

View File

@ -8,6 +8,7 @@ import axios from 'axios'
import Add from './Add' import Add from './Add'
import { useWeb3 } from '@context/Web3' import { useWeb3 } from '@context/Web3'
import { getEnsName } from '@utils/ens' import { getEnsName } from '@utils/ens'
import { useIsMounted } from '@hooks/useIsMounted'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)
@ -21,6 +22,7 @@ export default function Publisher({
className?: string className?: string
}): ReactElement { }): ReactElement {
const { accountId } = useWeb3() const { accountId } = useWeb3()
const isMounted = useIsMounted()
const [profile, setProfile] = useState<Profile>() const [profile, setProfile] = useState<Profile>()
const [name, setName] = useState(accountTruncate(account)) const [name, setName] = useState(accountTruncate(account))
const [accountEns, setAccountEns] = useState<string>() const [accountEns, setAccountEns] = useState<string>()
@ -35,7 +37,7 @@ export default function Publisher({
async function getExternalName() { async function getExternalName() {
// ENS // ENS
const accountEns = await getEnsName(account) const accountEns = await getEnsName(account)
if (accountEns) { if (accountEns && isMounted()) {
setAccountEns(accountEns) setAccountEns(accountEns)
setName(accountEns) setName(accountEns)
} }
@ -52,7 +54,7 @@ export default function Publisher({
return () => { return () => {
source.cancel() source.cancel()
} }
}, [account]) }, [account, isMounted])
const styleClasses = cx({ const styleClasses = cx({
publisher: true, publisher: true,

View File

@ -2,7 +2,7 @@ import React, { ReactElement } from 'react'
import { graphql, PageProps, useStaticQuery } from 'gatsby' import { graphql, PageProps, useStaticQuery } from 'gatsby'
import Alert from '@shared/atoms/Alert' import Alert from '@shared/atoms/Alert'
import Footer from './Footer/Footer' import Footer from './Footer/Footer'
import Header from './Header/Header' import Header from './Header'
import Styles from '../global/Styles' import Styles from '../global/Styles'
import { useWeb3 } from '@context/Web3' import { useWeb3 } from '@context/Web3'
import { useSiteMetadata } from '@hooks/useSiteMetadata' import { useSiteMetadata } from '@hooks/useSiteMetadata'

View File

@ -1,170 +0,0 @@
import { Formik } from 'formik'
import React, { ReactElement, useState } from 'react'
import { useAsset } from '@context/Asset'
import { useUserPreferences } from '@context/UserPreferences'
import styles from './index.module.css'
import { Logger, CredentialType, DDO } from '@oceanprotocol/lib'
import { graphql, useStaticQuery } from 'gatsby'
import { useWeb3 } from '@context/Web3'
import { useOcean } from '@context/Ocean'
// import FormAdvancedSettings from './FormAdvancedSettings'
import { useSiteMetadata } from '@hooks/useSiteMetadata'
import { setMinterToDispenser, setMinterToPublisher } from '@utils/freePrice'
import Web3Feedback from '@shared/Web3Feedback'
import { getInitialValues, validationSchema } from './_constants'
import MetadataFeedback from '../../../Publish/MetadataFeedback'
const contentQuery = graphql`
query EditAvanceSettingsQuery {
content: allFile(
filter: { relativePath: { eq: "pages/editAdvancedSettings.json" } }
) {
edges {
node {
childPagesJson {
description
form {
success
successAction
error
data {
name
placeholder
label
help
type
options
}
}
}
}
}
}
}
`
function getDefaultCredentialType(credentialType: string): CredentialType {
switch (credentialType) {
case 'address':
return CredentialType.address
case 'credential3Box':
return CredentialType.credential3Box
default:
return CredentialType.address
}
}
export default function EditAdvancedSettings({
setShowEdit
}: {
setShowEdit: (show: boolean) => void
}): ReactElement {
const data = useStaticQuery(contentQuery)
const content = data.content.edges[0].node.childPagesJson
const { debug } = useUserPreferences()
const { accountId } = useWeb3()
const { ocean } = useOcean()
const { isAssetNetwork, ddo, refreshDdo, price } = useAsset()
const [success, setSuccess] = useState<string>()
const [error, setError] = useState<string>()
const { appConfig } = useSiteMetadata()
const hasFeedback = error || success
const credentialType = getDefaultCredentialType(appConfig.credentialType)
async function handleSubmit(
values: Partial<AdvancedSettingsForm>,
resetForm: () => void
) {
try {
if (price.type === 'free') {
const tx = await setMinterToPublisher(
ocean,
ddo.dataToken,
accountId,
setError
)
if (!tx) return
}
let newDdo: DDO
newDdo = await ocean.assets.updateCredentials(
ddo,
credentialType,
values.allow,
values.deny
)
newDdo = await ocean.assets.editMetadata(newDdo, {
status: {
isOrderDisabled: values.isOrderDisabled
}
})
const storedddo = await ocean.assets.updateMetadata(newDdo, accountId)
if (!storedddo) {
setError(content.form.error)
Logger.error(content.form.error)
return
} else {
if (price.type === 'free') {
const tx = await setMinterToDispenser(
ocean,
ddo.dataToken,
accountId,
setError
)
if (!tx) return
}
setSuccess(content.form.success)
resetForm()
}
} catch (error) {
Logger.error(error.message)
setError(error.message)
}
}
return (
<Formik
initialValues={getInitialValues(ddo, credentialType)}
validationSchema={validationSchema}
onSubmit={async (values, { resetForm }) => {
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
await handleSubmit(values, resetForm)
}}
>
{({ isSubmitting, values }) =>
isSubmitting || hasFeedback ? (
<MetadataFeedback
title="Updating Data Set"
error={error}
success={success}
setError={setError}
successAction={{
name: content.form.successAction,
onClick: async () => {
await refreshDdo()
setShowEdit(false)
}
}}
/>
) : (
<>
<p className={styles.description}>{content.description}</p>
<article className={styles.grid}>
{/* <FormAdvancedSettings
data={content.form.data}
setShowEdit={setShowEdit}
/> */}
</article>
<Web3Feedback isAssetNetwork={isAssetNetwork} />
</>
)
}
</Formik>
)
}

View File

@ -1,5 +1,4 @@
import React, { ReactElement, useState, useEffect } from 'react' import React, { ReactElement, useState, useEffect } from 'react'
import Permission from '@shared/Permission'
import Compute from './Compute' import Compute from './Compute'
import Consume from './Consume' import Consume from './Consume'
import { Logger, File as FileMetadata, DID } from '@oceanprotocol/lib' import { Logger, File as FileMetadata, DID } from '@oceanprotocol/lib'
@ -141,9 +140,7 @@ export default function AssetActions(): ReactElement {
return ( return (
<> <>
<Permission eventType="consume"> <Tabs items={tabs} className={styles.actions} />
<Tabs items={tabs} className={styles.actions} />
</Permission>
<Web3Feedback isAssetNetwork={isAssetNetwork} /> <Web3Feedback isAssetNetwork={isAssetNetwork} />
</> </>
) )

View File

@ -17,7 +17,6 @@ import MetaMain from './MetaMain'
import EditHistory from './EditHistory' import EditHistory from './EditHistory'
import { useWeb3 } from '@context/Web3' import { useWeb3 } from '@context/Web3'
import styles from './index.module.css' import styles from './index.module.css'
import EditAdvancedSettings from '../AssetActions/Edit/EditAdvancedSettings'
import { useSiteMetadata } from '@hooks/useSiteMetadata' import { useSiteMetadata } from '@hooks/useSiteMetadata'
import NetworkName from '@shared/atoms/NetworkName' import NetworkName from '@shared/atoms/NetworkName'
@ -78,17 +77,10 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
setShowEditCompute(true) setShowEditCompute(true)
} }
function handleEditAdvancedSettingsButton() {
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
setShowEditAdvancedSettings(true)
}
return showEdit ? ( return showEdit ? (
<Edit setShowEdit={setShowEdit} isComputeType={isComputeType} /> <Edit setShowEdit={setShowEdit} isComputeType={isComputeType} />
) : showEditCompute ? ( ) : showEditCompute ? (
<EditComputeDataset setShowEdit={setShowEditCompute} /> <EditComputeDataset setShowEdit={setShowEditCompute} />
) : showEditAdvancedSettings ? (
<EditAdvancedSettings setShowEdit={setShowEditAdvancedSettings} />
) : ( ) : (
<> <>
<div className={styles.networkWrap}> <div className={styles.networkWrap}>
@ -127,18 +119,6 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
> >
Edit Metadata Edit Metadata
</Button> </Button>
{appConfig.allowAdvancedSettings === 'true' && (
<>
<span className={styles.separator}>|</span>
<Button
style="text"
size="small"
onClick={handleEditAdvancedSettingsButton}
>
Edit Advanced Settings
</Button>
</>
)}
{ddo.findServiceByType('compute') && type === 'dataset' && ( {ddo.findServiceByType('compute') && type === 'dataset' && (
<> <>
<span className={styles.separator}>|</span> <span className={styles.separator}>|</span>

View File

@ -24,11 +24,10 @@ export default function Details(): ReactElement {
const { locale } = useUserPreferences() const { locale } = useUserPreferences()
const [mainCurrency, setMainCurrency] = useState<string>() const [mainCurrency, setMainCurrency] = useState<string>()
const [oceanTokenMetadata, setOceanTokenMetadata] = const [oceanTokenMetadata, setOceanTokenMetadata] = useState<{
useState<{ address: string
address: string symbol: string
symbol: string }>()
}>()
// const [portisNetwork, setPortisNetwork] = useState<string>() // const [portisNetwork, setPortisNetwork] = useState<string>()
useEffect(() => { useEffect(() => {

View File

@ -1,6 +1,6 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import Menu from './Menu' import Menu from './Menu'
import styles from './Header.module.css' import styles from './index.module.css'
export default function Header(): ReactElement { export default function Header(): ReactElement {
return ( return (

View File

@ -127,20 +127,19 @@ export default function HomePage(): ReactElement {
}, [chainIds]) }, [chainIds])
return ( return (
<Permission eventType="browse"> <>
<> <section className={styles.section}>
<section className={styles.section}> <h3>Bookmarks</h3>
<h3>Bookmarks</h3> <Bookmarks />
<Bookmarks /> </section>
</section>
{queryAndDids && ( {queryAndDids && (
<SectionQueryResult <SectionQueryResult
title="Highest Liquidity" title="Highest Liquidity"
query={queryAndDids[0]} query={queryAndDids[0]}
queryData={queryAndDids[1]} queryData={queryAndDids[1]}
/> />
)} )}
{queryLatest && ( {queryLatest && (
<SectionQueryResult <SectionQueryResult
@ -154,6 +153,7 @@ export default function HomePage(): ReactElement {
/> />
)} )}
</> </>
</Permission>
) )
} }

View File

@ -1,5 +1,4 @@
import React, { ReactElement, useState, useEffect } from 'react' import React, { ReactElement, useState, useEffect } from 'react'
import Permission from '@shared/Permission'
import { Formik, FormikState } from 'formik' import { Formik, FormikState } from 'formik'
import { usePublish } from '@hooks/usePublish' import { usePublish } from '@hooks/usePublish'
import styles from './index.module.css' import styles from './index.module.css'
@ -79,20 +78,18 @@ export default function PublishPage({
} }
return isInPurgatory && purgatoryData ? null : ( return isInPurgatory && purgatoryData ? null : (
<Permission eventType="publish"> <Formik
<Formik initialValues={initialValues}
initialValues={initialValues} initialStatus="empty"
initialStatus="empty" validationSchema={validationSchema}
validationSchema={validationSchema} onSubmit={async (values, { resetForm }) => {
onSubmit={async (values, { resetForm }) => { // kick off publishing
// kick off publishing await handleSubmit(values, resetForm)
await handleSubmit(values, resetForm) }}
}} >
> {({ values }) => {
{({ values }) => { return <>Hello</>
return <>Hello</> }}
}} </Formik>
</Formik>
</Permission>
) )
} }

View File

@ -1,5 +1,4 @@
import React, { ReactElement, useState, useEffect, useCallback } from 'react' import React, { ReactElement, useState, useEffect, useCallback } from 'react'
import Permission from '@shared/Permission'
import AssetList from '@shared/AssetList/AssetList' import AssetList from '@shared/AssetList/AssetList'
import queryString from 'query-string' import queryString from 'query-string'
import Filters from './Filters' import Filters from './Filters'
@ -78,8 +77,7 @@ export default function SearchPage({
}, [parsed, chainIds, newCancelToken, fetchAssets]) }, [parsed, chainIds, newCancelToken, fetchAssets])
return ( return (
<Permission eventType="browse"> <>
<>
<div className={styles.search}> <div className={styles.search}>
<div className={styles.row}> <div className={styles.row}>
<Filters <Filters
@ -108,6 +106,5 @@ export default function SearchPage({
/> />
</div> </div>
</> </>
</Permission>
) )
} }

View File

@ -17,7 +17,6 @@ import { PoolShares_poolShares as PoolShare } from '../@types/apollo/PoolShares'
import { DDO, Logger } from '@oceanprotocol/lib' import { DDO, Logger } from '@oceanprotocol/lib'
import { getDownloadAssets, getPublishedAssets } from '../utils/aquarius' import { getDownloadAssets, getPublishedAssets } from '../utils/aquarius'
import { useSiteMetadata } from '../hooks/useSiteMetadata' import { useSiteMetadata } from '../hooks/useSiteMetadata'
import { Profile } from '../@types/Profile'
import { accountTruncate } from '../utils/web3' import { accountTruncate } from '../utils/web3'
import axios, { CancelToken } from 'axios' import axios, { CancelToken } from 'axios'
import ethereumAddress from 'ethereum-address' import ethereumAddress from 'ethereum-address'

View File

@ -1,10 +1,10 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import fetch from 'cross-fetch'
import { useOcean } from '../context/Ocean' import { useOcean } from '../context/Ocean'
import { useWeb3 } from '../context/Web3' import { useWeb3 } from '../context/Web3'
import { Logger } from '@oceanprotocol/lib' import { Logger } from '@oceanprotocol/lib'
import Web3 from 'web3' import Web3 from 'web3'
import { ConfigHelperConfig } from '@oceanprotocol/lib/dist/node/utils/ConfigHelper' import { ConfigHelperConfig } from '@oceanprotocol/lib/dist/node/utils/ConfigHelper'
import axios, { AxiosResponse } from 'axios'
const blockDifferenceThreshold = 30 const blockDifferenceThreshold = 30
const ethGraphUrl = `https://api.thegraph.com/subgraphs/name/blocklytics/ethereum-blocks` const ethGraphUrl = `https://api.thegraph.com/subgraphs/name/blocklytics/ethereum-blocks`
@ -19,16 +19,15 @@ export interface UseGraphSyncStatus {
blockGraph: number blockGraph: number
} }
async function fetchGraph(url: string, queryBody: string): Promise<Response> { async function fetchGraph(
url: string,
queryBody: string
): Promise<AxiosResponse> {
try { try {
const response = await fetch(url, { const response = await axios.post(url, { ...JSON.parse(queryBody) })
method: 'POST', return response
body: queryBody
})
return await response.json()
} catch (error) { } catch (error) {
console.error('Error parsing json: ' + error.message) Logger.error('Error parsing json: ' + error.message)
} }
} }
@ -36,7 +35,7 @@ async function getBlockHead(config: ConfigHelperConfig) {
// for ETH main, get block from graph fetch // for ETH main, get block from graph fetch
if (config.network === 'mainnet') { if (config.network === 'mainnet') {
const response: any = await fetchGraph(ethGraphUrl, ethGraphQuery) const response: any = await fetchGraph(ethGraphUrl, ethGraphQuery)
return Number(response.data.blocks[0].number) return Number(response?.data?.blocks[0].number)
} }
// for everything else, create new web3 instance with infura // for everything else, create new web3 instance with infura
@ -50,7 +49,7 @@ async function getBlockSubgraph(subgraphUri: string) {
`${subgraphUri}/subgraphs/name/oceanprotocol/ocean-subgraph`, `${subgraphUri}/subgraphs/name/oceanprotocol/ocean-subgraph`,
graphQuery graphQuery
) )
const blockNumberGraph = Number(response.data._meta.block.number) const blockNumberGraph = Number(response?.data?._meta?.block?.number)
return blockNumberGraph return blockNumberGraph
} }

View File

@ -28,12 +28,8 @@ export interface UseSiteMetadata {
allowFixedPricing: string allowFixedPricing: string
allowDynamicPricing: string allowDynamicPricing: string
allowFreePricing: string allowFreePricing: string
allowAdvancedSettings: string
credentialType: string
defaultPrivacyPolicySlug: string defaultPrivacyPolicySlug: string
privacyPreferenceCenter: string privacyPreferenceCenter: string
allowAdvancedPublishSettings: string
rbacUrl: string
darkModeConfig: { darkModeConfig: {
classNameDark: string classNameDark: string
classNameLight: string classNameLight: string

View File

@ -33,12 +33,8 @@ const query = graphql`
allowFixedPricing allowFixedPricing
allowDynamicPricing allowDynamicPricing
allowFreePricing allowFreePricing
allowAdvancedSettings
allowAdvancedPublishSettings
credentialType
defaultPrivacyPolicySlug defaultPrivacyPolicySlug
privacyPreferenceCenter privacyPreferenceCenter
rbacUrl
darkModeConfig { darkModeConfig {
classNameDark classNameDark
classNameLight classNameLight

View File

@ -1,5 +1,4 @@
import React, { ReactElement, useEffect, useState } from 'react' import React, { ReactElement, useEffect, useState } from 'react'
import Permission from '@shared/Permission'
import { PageProps } from 'gatsby' import { PageProps } from 'gatsby'
import PageTemplateAssetDetails from '../../components/Asset' import PageTemplateAssetDetails from '../../components/Asset'
import AssetProvider from '@context/Asset' import AssetProvider from '@context/Asset'
@ -13,12 +12,10 @@ export default function PageGatsbyAssetDetails(props: PageProps): ReactElement {
}, [props.location.pathname]) }, [props.location.pathname])
return ( return (
<Permission eventType="browse"> <AssetProvider asset={did}>
<AssetProvider asset={did}> <OceanProvider>
<OceanProvider> <PageTemplateAssetDetails uri={props.location.pathname} />
<PageTemplateAssetDetails uri={props.location.pathname} /> </OceanProvider>
</OceanProvider> </AssetProvider>
</AssetProvider>
</Permission>
) )
} }

View File

@ -57,19 +57,6 @@ const getComputeOrdersByDatatokenAddress = gql`
} }
` `
interface TokenOrder {
id: string
serviceId: number
datatokenId: OrdersDatatoken
tx: any
timestamp: number
}
interface ComputeResults {
computeJobs: ComputeJobMetaData[]
isLoaded: boolean
}
async function getAssetMetadata( async function getAssetMetadata(
queryDtList: string[], queryDtList: string[],
cancelToken: CancelToken, cancelToken: CancelToken,

View File

@ -1,36 +0,0 @@
import fetch from 'cross-fetch'
import appConfig from '../../app.config'
export default async function rbacRequest(
eventType: string,
address: string,
signal?: AbortSignal
): Promise<boolean | 'ERROR'> {
const url = appConfig.rbacUrl
if (url === '') {
return true
} else {
const data = {
component: 'market',
eventType,
authService: 'address',
credentials: {
address
}
}
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data),
signal: signal
})
return await response.json()
} catch (error) {
console.error('Error parsing json: ' + error.message)
return 'ERROR'
}
}
}