From 8db0233c177b66e0bb768db4c411a6041b4bc661 Mon Sep 17 00:00:00 2001 From: KevinRohlf <123676073+KevinRohlf@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:36:28 +0100 Subject: [PATCH 1/5] feat: merge accurate-portal --- content/pages/editMetadata.json | 76 +++++++++---- content/price.json | 7 +- content/publish/form.json | 106 ++++++++++++------ content/site.json | 17 +++ src/@utils/aquarius/index.ts | 12 +- src/@utils/ddo.ts | 12 ++ src/@utils/nft.ts | 8 +- src/@utils/subgraph.ts | 21 +++- src/@utils/yup.ts | 1 + .../@shared/AddNetwork/index.module.css | 4 + src/components/@shared/AddNetwork/index.tsx | 6 +- src/components/@shared/AssetTeaser/index.tsx | 4 +- .../InputElement/Credential/index.module.css | 4 + .../InputElement/Credential/index.tsx | 7 +- .../InputElement/FilesInput/index.tsx | 86 +++++++------- .../KeyValueInput/index.module.css | 4 + .../InputElement/MethodInput/index.module.css | 2 +- src/components/@shared/FormInput/index.tsx | 1 + .../@shared/MenuDropdown/index.module.css | 12 ++ .../@shared/NetworkName/index.module.css | 2 +- .../Onboarding/Steps/ImportCustomTokens.tsx | 2 +- .../@shared/Onboarding/Steps/ImportWallet.tsx | 2 +- .../@shared/atoms/Button/index.module.css | 16 ++- src/components/@shared/atoms/Table/_styles.ts | 3 +- .../@shared/atoms/TabsFile/index.tsx | 56 +++++---- .../Compute/PriceOutput.module.css | 4 + .../Asset/Edit/DebugEditMetadata.tsx | 19 +++- src/components/Asset/Edit/EditMetadata.tsx | 8 ++ src/components/Asset/Edit/_constants.ts | 3 +- src/components/Asset/Edit/_types.ts | 9 +- src/components/Asset/Edit/_validation.ts | 2 +- src/components/Header/Menu.module.css | 6 +- src/components/Header/Menu.tsx | 2 + .../{Wallet => NetworkMenu}/AddTokenList.tsx | 0 .../Header/NetworkMenu/Details.module.css | 44 ++++++++ src/components/Header/NetworkMenu/Details.tsx | 43 +++++++ .../Network.module.css | 28 ++++- .../{Wallet => NetworkMenu}/Network.tsx | 6 +- .../Header/NetworkMenu/index.module.css | 4 + src/components/Header/NetworkMenu/index.tsx | 18 +++ .../Automation/Decrypt.module.css | 4 + .../Networks/NetworksList.module.css | 2 + .../UserPreferences/Networks/index.module.css | 2 +- .../Header/Wallet/Account.module.css | 9 +- .../Header/Wallet/Details.module.css | 55 +-------- src/components/Header/Wallet/Details.tsx | 32 +----- src/components/Header/Wallet/index.tsx | 2 - .../Home/TopSales/Account/index.module.css | 3 + src/components/Profile/Header/Stats.tsx | 2 +- .../History/ComputeJobs/Details.module.css | 2 +- .../Profile/History/index.module.css | 4 +- src/components/Publish/Actions/index.tsx | 17 ++- src/components/Publish/Policies/index.tsx | 44 ++++++++ src/components/Publish/Pricing/Fees.tsx | 20 +++- src/components/Publish/Pricing/Fixed.tsx | 8 +- src/components/Publish/Pricing/Price.tsx | 16 ++- src/components/Publish/_constants.tsx | 24 +++- src/components/Publish/_types.ts | 14 ++- src/components/Publish/_utils.ts | 22 +++- src/components/Publish/_validation.ts | 14 ++- src/pages/faucet.tsx | 17 ++- src/stylesGlobal/_variables.css | 5 + 62 files changed, 695 insertions(+), 290 deletions(-) rename src/components/Header/{Wallet => NetworkMenu}/AddTokenList.tsx (100%) create mode 100644 src/components/Header/NetworkMenu/Details.module.css create mode 100644 src/components/Header/NetworkMenu/Details.tsx rename src/components/Header/{Wallet => NetworkMenu}/Network.module.css (54%) rename src/components/Header/{Wallet => NetworkMenu}/Network.tsx (85%) create mode 100644 src/components/Header/NetworkMenu/index.module.css create mode 100644 src/components/Header/NetworkMenu/index.tsx create mode 100644 src/components/Publish/Policies/index.tsx diff --git a/content/pages/editMetadata.json b/content/pages/editMetadata.json index 6b3f3deb5..e5cdac3f9 100644 --- a/content/pages/editMetadata.json +++ b/content/pages/editMetadata.json @@ -7,7 +7,7 @@ { "name": "name", "label": "New Title", - "placeholder": "e.g. Shapes of Desert Plants", + "placeholder": "e.g. Production data of a manufacturing process", "help": "Enter a concise title.", "required": true }, @@ -35,30 +35,20 @@ "type": "tabs", "fields": [ { - "value": "ipfs", - "title": "IPFS", - "label": "CID", - "placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq", - "help": "This CID will be stored encrypted after publishing.", - "computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ", - "prominentHelp": true, - "type": "files", - "required": true - }, - { - "value": "arweave", - "title": "Arweave", - "label": "Transaction ID", - "placeholder": "e.g. DBRCL94j3QqdPaUtt4VWRen8rZfJZBb7Ey40iMpXfhtd", - "help": "This Transaction ID will be stored encrypted after publishing.", + "value": "url", + "title": "URL", + "label": "File", + "placeholder": "e.g. https://file.com/file.json", + "help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**", "computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ", "prominentHelp": true, "type": "files", - "required": true + "required": true, + "methods": false }, { "value": "url", - "title": "URL", + "title": "API", "label": "File", "placeholder": "e.g. https://file.com/file.json", "help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**", @@ -66,6 +56,7 @@ "prominentHelp": true, "type": "files", "required": true, + "methods": true, "innerFields": [ { "value": "headers", @@ -74,6 +65,30 @@ "placeholder_value": "Authorization", "help": "This HEADERS will be stored encrypted after publishing.", "type": "headers", + "required": false + } + ] + }, + { + "value": "saas", + "title": "SaaS", + "label": "Redirect URL", + "placeholder": "e.g. https://delta-dao/the-future-is-now", + "help": "The url the user will be redirected to after buying access to the SaaS.", + "prominentHelp": true, + "type": "saas", + "fieldFormPrefix": "saas", + "required": true, + "methods": false, + "innerFields": [ + { + "value": "paymentMode", + "title": "PaymentMode", + "label": "PaymentMode", + "help": "Choose how the payment mode for your Saas.", + "type": "select", + "selected": "", + "options": ["Subscription", "Pay per use"], "required": true } ] @@ -88,7 +103,6 @@ "prominentHelp": true, "type": "files", "required": true, - "headers": true, "innerFields": [ { "value": "headers", @@ -97,7 +111,7 @@ "placeholder_value": "Authorization", "help": "This HEADERS will be stored encrypted after publishing.", "type": "headers", - "required": true + "required": false }, { "value": "query", @@ -109,6 +123,17 @@ "required": true } ] + }, + { + "value": "ipfs", + "title": "IPFS", + "label": "CID", + "placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq", + "help": "This CID will be stored encrypted after publishing.", + "computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ", + "prominentHelp": true, + "type": "files", + "required": true } ], "sortOptions": false, @@ -140,7 +165,14 @@ "label": "Timeout", "help": "Define how long buyers should be able to download the dataset again after the initial purchase.", "type": "select", - "options": ["Forever", "1 day", "1 week", "1 month", "1 year"], + "options": [ + "Forever", + "1 hour", + "1 day", + "1 week", + "1 month", + "1 year" + ], "sortOptions": false, "required": true }, diff --git a/content/price.json b/content/price.json index 1c741b62c..a7cced126 100644 --- a/content/price.json +++ b/content/price.json @@ -1,11 +1,12 @@ { "create": { "fixed": { - "title": "Fixed", + "title": "Priced", "info": "Set your price for accessing this dataset. The datatoken for this dataset will be worth the entered amount of the selected base token.", "tooltips": { - "communityFee": "Goes to Ocean DAO for teams to improve the tools, build apps, do outreach, and more. A small fraction is used to burn OCEAN. This fee is collected when downloading or using an asset in a compute job.", - "marketplaceFee": "Goes to the marketplace owner that is hosting and providing the marketplace and is collected when downloading or using an asset in a compute job. In Ocean Market, it is treated as network revenue that goes to the Ocean community." + "communityFee": "Goes to the Pontus-X Ecosystem participants to improve the tools, build apps, do outreach, and more. This fee is collected when downloading or using an asset in a compute job.", + "marketplaceFee": "Goes to the marketplace owner that is hosting and providing the marketplace and is collected when downloading or using an asset in a compute job.", + "earningsAfterFees": "The amount of tokens you will receive after the fees are collected." } }, "free": { diff --git a/content/publish/form.json b/content/publish/form.json index 74c8a9436..5e3ac646c 100644 --- a/content/publish/form.json +++ b/content/publish/form.json @@ -6,7 +6,7 @@ "name": "nft", "label": "Data NFT", "type": "nft", - "help": "All metadata is stored on-chain in a newly deployed ERC-721 contract representing this asset, created with this name, symbol, description and image.", + "help": "Data NFTs are unique digital assets that represent the intellectual property of your digital services, enabling flexible licensing arrangements and enhanced control over your valuable business data. Each Data NFT can issue multiple access tokens with customized terms, enabling varied access levels and durations for your digital service.", "required": true }, { @@ -160,7 +160,7 @@ }, { "name": "providerUrl", - "label": "Provider URL", + "label": "Access Controller URL", "type": "providerUrl", "help": "Enter the URL for your custom [provider](https://github.com/oceanprotocol/provider/) or leave as is to use the default one. If you change your provider URL after adding your file, please add & validate your file again.", "placeholder": "e.g. https://provider.oceanprotocol.com/", @@ -173,31 +173,21 @@ "type": "tabs", "fields": [ { - "value": "ipfs", - "title": "IPFS", - "label": "CID", - "placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq", - "help": "This CID will be stored encrypted after publishing.", - "computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ", - "prominentHelp": true, - "type": "files", - "required": true - }, - { - "value": "arweave", - "title": "Arweave", - "label": "Transaction ID", - "placeholder": "e.g. DBRCL94j3QqdPaUtt4VWRen8rZfJZBb7Ey40iMpXfhtd", - "help": "This Transaction ID will be stored encrypted after publishing.", + "value": "url", + "title": "URL", + "label": "File", + "placeholder": "e.g. https://file.com/file.json", + "help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**", "computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ", "prominentHelp": true, "type": "files", - "required": true + "required": true, + "methods": false }, { "value": "url", - "title": "URL", - "label": "File", + "title": "API", + "label": "Endpoint", "placeholder": "e.g. https://file.com/file.json", "help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**", "computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ", @@ -217,6 +207,30 @@ } ] }, + { + "value": "saas", + "title": "SaaS", + "label": "Redirect URL", + "placeholder": "e.g. https://delta-dao/the-future-is-now", + "help": "The url the user will be redirected to after buying access to the Software as a Service offering.", + "prominentHelp": true, + "type": "saas", + "fieldFormPrefix": "metadata.saas", + "required": true, + "methods": false, + "innerFields": [ + { + "value": "paymentMode", + "title": "PaymentMode", + "label": "PaymentMode", + "help": "Choose the payment mode of your Software as a Service offering.", + "type": "select", + "selected": "", + "options": ["Subscription", "Pay per use"], + "required": true + } + ] + }, { "value": "graphql", "title": "Graphql", @@ -247,6 +261,17 @@ "required": true } ] + }, + { + "value": "ipfs", + "title": "IPFS", + "label": "CID", + "placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq", + "help": "This CID will be stored encrypted after publishing.", + "computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ", + "prominentHelp": true, + "type": "files", + "required": true } ], "sortOptions": false, @@ -290,15 +315,7 @@ "disclaimer": "Please do not provide downloadable personal data without the consent of the data subjects.", "disclaimerValues": ["Download"] }, - { - "name": "timeout", - "label": "Timeout", - "help": "Define how long buyers should be able to download the dataset again after the initial purchase.", - "type": "select", - "options": ["Forever", "1 day", "1 week", "1 month", "1 year"], - "sortOptions": false, - "required": true - }, + { "name": "usesConsumerParameters", "label": "User defined parameters", @@ -306,19 +323,40 @@ "type": "checkbox", "options": ["This asset uses user defined parameters"], "required": false + } + ] + }, + "policies": { + "title": "Policies", + "fields": [ + { + "name": "timeout", + "label": "Access Period", + "help": "Define how long buyers should be able to access your offering again after the initial purchase.", + "type": "select", + "options": [ + "Forever", + "1 hour", + "1 day", + "1 week", + "1 month", + "1 year" + ], + "sortOptions": false, + "required": true }, { "name": "allow", - "label": "Allow ETH Address", + "label": "Allow Wallet Address", "placeholder": "e.g. 0xe328aB96B7CbB55A6E1c1054678137bA09780acA", - "help": "Enter an ETH address and click the ADD button to append to the list. Only ETH addresses in the allow list can consume this asset. If the list is empty anyone can download or compute this asset.", + "help": "Enter an wallet address and click the ADD button to append to the list. Only wallet addresses in the allow list can consume this asset. If the list is empty anyone can download or compute this asset. For more information, you can visit the [Pontus-X registry page](https://docs.pontus-x.eu/docs/participants-and-federators/ecosystem-participants).", "type": "credentials" }, { "name": "deny", - "label": "Deny ETH Address", + "label": "Deny Wallet Address", "placeholder": "e.g. 0xe328aB96B7CbB55A6E1c1054678137bA09780acA", - "help": "Enter an ETH address and click the ADD button to append to the list. If an ETH address is in the deny list, download or compute of this asset will be denied for that ETH address.", + "help": "Enter an wallet address and click the ADD button to append to the list. If an wallet address is in the deny list, download or compute of this asset will be denied for that wallet address. For more information, you can visit the [Pontus-X registry page](https://docs.pontus-x.eu/docs/participants-and-federators/ecosystem-participants).", "type": "credentials" } ] diff --git a/content/site.json b/content/site.json index 2ccdd5cee..1e1466550 100644 --- a/content/site.json +++ b/content/site.json @@ -142,6 +142,23 @@ "isLive": false } ] + }, + { + "name": "Resources", + "subItems": [ + { + "name": "Documentation", + "link": "https://docs.pontus-x.eu/" + }, + { + "name": "Landing Page", + "link": "https://www.pontus-x.eu/" + }, + { + "name": "nautilus", + "link": "https://nautilus.delta-dao.com/" + } + ] } ], "announcement": "The Pontus-X Devnet is currently undergoing a scheduled load test. The network remains stable and fully operational during this period.", diff --git a/src/@utils/aquarius/index.ts b/src/@utils/aquarius/index.ts index 35b1d8111..6cc0858b7 100644 --- a/src/@utils/aquarius/index.ts +++ b/src/@utils/aquarius/index.ts @@ -369,13 +369,15 @@ export async function getAlgorithmDatasetsForCompute( const baseQueryParams = { chainIds: [datasetChainId], nestedQuery: { - must: { - match_phrase: { - 'services.compute.publisherTrustedAlgorithms.did': { - query: algorithmId + must: [ + { + match_phrase: { + 'services.compute.publisherTrustedAlgorithms.did': { + query: algorithmId + } } } - } + ] }, sortOptions: { sortBy: SortTermOptions.Created, diff --git a/src/@utils/ddo.ts b/src/@utils/ddo.ts index 3366c8e45..f2fea2be5 100644 --- a/src/@utils/ddo.ts +++ b/src/@utils/ddo.ts @@ -46,6 +46,8 @@ export function mapTimeoutStringToSeconds(timeout: string): number { switch (timeout) { case 'Forever': return 0 + case '1 hour': + return 3600 case '1 day': return 86400 case '1 week': @@ -156,6 +158,16 @@ export function normalizeFile( } as Smartcontract break } + case 'saas': { + fileObj = { + type: 'url', + index: 0, + url: file ? file[0]?.url || file?.url : null, + headers: headersProvider, + method: file.method + } as UrlFile + break + } default: { fileObj = { type: 'url', diff --git a/src/@utils/nft.ts b/src/@utils/nft.ts index b5f23b0db..f63dc0dc3 100644 --- a/src/@utils/nft.ts +++ b/src/@utils/nft.ts @@ -47,10 +47,10 @@ function encodeSvg(svgString: string): string { } const nftMetadataTemplate = { - name: 'GX Data NFT', - symbol: 'GX-NFT', - description: `This NFT represents an asset in Ocean Protocol v4 ecosystems.`, - external_url: 'https://minimal-gaia-x.eu' + name: 'PX Data NFT', + symbol: 'PX-NFT', + description: `Data NFTs are unique digital assets that represent the intellectual property of your digital services.`, + external_url: 'https://portal.pontus-x.eu' } export function generateNftMetadata(): NftMetadata { diff --git a/src/@utils/subgraph.ts b/src/@utils/subgraph.ts index ae51c7728..88ffeb331 100644 --- a/src/@utils/subgraph.ts +++ b/src/@utils/subgraph.ts @@ -5,6 +5,8 @@ import { getOceanConfig } from './ocean' import { OrdersData_orders as OrdersData } from '../@types/subgraph/OrdersData' import { OpcFeesQuery as OpcFeesData } from '../@types/subgraph/OpcFeesQuery' import appConfig from '../../app.config' +import { chains } from '../../chains.config' +import { ethers } from 'ethers' const UserTokenOrders = gql` query OrdersData($user: String!) { @@ -181,12 +183,23 @@ export async function getOpcsApprovedTokens( if (!Object.keys(tokenAddressesEUROe).includes(chainId.toString())) return approvedTokens - return approvedTokens.includes( - (token) => token.address === tokenAddressesEUROe[chainId] + const oceanTokenAddress = chains.find( + (chain) => chain.chainId === chainId + )?.oceanTokenAddress + const approvedTokensWithoutOcean = approvedTokens.filter( + (token) => + ethers.utils.getAddress(token.address) !== + ethers.utils.getAddress(oceanTokenAddress) ) - ? approvedTokens + + return approvedTokensWithoutOcean.includes( + (token) => + ethers.utils.getAddress(token.address) === + ethers.utils.getAddress(tokenAddressesEUROe[chainId]) + ) + ? approvedTokensWithoutOcean : [ - ...approvedTokens, + ...approvedTokensWithoutOcean, { address: tokenAddressesEUROe[chainId], // TODO: revert once decimals changed to 6 on pontus-x diff --git a/src/@utils/yup.ts b/src/@utils/yup.ts index a2d02d51f..cf9792d00 100644 --- a/src/@utils/yup.ts +++ b/src/@utils/yup.ts @@ -16,6 +16,7 @@ export function testLinks(isEdit?: boolean) { validField = true break case 'url': + case 'saas': case 'graphql': validField = isUrl(value?.toString() || '') // if we're in publish, the field must be valid diff --git a/src/components/@shared/AddNetwork/index.module.css b/src/components/@shared/AddNetwork/index.module.css index 4a7348b00..e9f147bd7 100644 --- a/src/components/@shared/AddNetwork/index.module.css +++ b/src/components/@shared/AddNetwork/index.module.css @@ -7,3 +7,7 @@ padding: 1px; fill: var(--color-primary); } + +.networkName { + text-transform: uppercase; +} diff --git a/src/components/@shared/AddNetwork/index.tsx b/src/components/@shared/AddNetwork/index.tsx index 26f44dbd6..bb084b118 100644 --- a/src/components/@shared/AddNetwork/index.tsx +++ b/src/components/@shared/AddNetwork/index.tsx @@ -30,8 +30,10 @@ export default function AddNetwork({ - {'Add '} - {networkName} + {'Connect to '} + + {networkName} + ) diff --git a/src/components/@shared/AssetTeaser/index.tsx b/src/components/@shared/AssetTeaser/index.tsx index 9d0f04656..e8203ad0b 100644 --- a/src/components/@shared/AssetTeaser/index.tsx +++ b/src/components/@shared/AssetTeaser/index.tsx @@ -41,9 +41,9 @@ export default function AssetTeaser({