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

Merge branch 'main' into feature/1400-shared-components-stories

This commit is contained in:
EnzoVezzaro 2022-06-22 10:10:48 -04:00 committed by GitHub
commit f460ba7e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 105 additions and 208 deletions

View File

@ -1,4 +1,3 @@
#NEXT_PUBLIC_INFURA_PROJECT_ID="xxx" #NEXT_PUBLIC_INFURA_PROJECT_ID="xxx"
#NEXT_PUBLIC_MARKET_FEE_ADDRESS="0xxx" #NEXT_PUBLIC_MARKET_FEE_ADDRESS="0xxx"
#NEXT_PUBLIC_PUBLISHER_MARKET_ORDER_FEE="1" #NEXT_PUBLIC_PUBLISHER_MARKET_ORDER_FEE="1"
@ -8,11 +7,6 @@
#NEXT_PUBLIC_CONSUME_MARKET_POOL_SWAP_FEE="1" #NEXT_PUBLIC_CONSUME_MARKET_POOL_SWAP_FEE="1"
#NEXT_PUBLIC_CONSUME_MARKET_FIXED_SWAP_FEE="1" #NEXT_PUBLIC_CONSUME_MARKET_FIXED_SWAP_FEE="1"
#NEXT_PUBLIC_PORTIS_ID="xxx"
# #
# ADVANCED SETTINGS # ADVANCED SETTINGS
# #

View File

@ -17,7 +17,6 @@ jobs:
- run: npm run build - run: npm run build
env: env:
NEXT_PUBLIC_INFURA_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_INFURA_PROJECT_ID }} NEXT_PUBLIC_INFURA_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_INFURA_PROJECT_ID }}
NEXT_PUBLIC_PORTIS_ID: ${{ secrets.NEXT_PUBLIC_PORTIS_ID }}
- run: npm run deploy:s3 - run: npm run deploy:s3
env: env:

View File

@ -75,9 +75,6 @@ module.exports = {
storageKey: 'oceanDarkMode' storageKey: 'oceanDarkMode'
}, },
// Wallets
portisId: process.env.NEXT_PUBLIC_PORTIS_ID || 'xxx',
// Used to show or hide the fixed, dynamic or free price options // Used to show or hide the fixed, dynamic or free price options
// tab to publishers during the price creation. // tab to publishers during the price creation.
allowFixedPricing: process.env.NEXT_PUBLIC_ALLOW_FIXED_PRICING || 'true', allowFixedPricing: process.env.NEXT_PUBLIC_ALLOW_FIXED_PRICING || 'true',

View File

@ -30,13 +30,22 @@
"required": true "required": true
}, },
{ {
"name": "links", "name": "files",
"label": "Sample file", "label": "New file",
"placeholder": "e.g. https://file.com/samplefile.json", "placeholder": "e.g. https://file.com/file.json",
"help": "Please provide a URL to a sample of your data set file. This file should reveal the data structure of your data set, e.g. by including the header and one line of a CSV file. This file URL will be publicly available after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**", "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.** For a compute data set, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. Leaving this field empty will not remove the current value.",
"prominentHelp": true, "prominentHelp": true,
"type": "files" "type": "files"
}, },
{
"name": "links",
"label": "New sample file",
"placeholder": "e.g. https://file.com/samplefile.json",
"help": "Please provide a URL to a sample of your data set file. This file should reveal the data structure of your data set, e.g. by including the header and one line of a CSV file. This file URL will be publicly available after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.** Leaving this field empty will not remove the current value.",
"prominentHelp": true,
"type": "files"
},
{ {
"name": "timeout", "name": "timeout",
"label": "Timeout", "label": "Timeout",

View File

@ -14,7 +14,7 @@
"link": "/profile" "link": "/profile"
} }
], ],
"announcement": "Data NFTs, One-Sided Staking and more. [Explore OceanONDA V4](https://blog.oceanprotocol.com/oceanonda-v4-production-has-arrived-cb4fe8faaf39).", "announcement": "Data NFTs, One-Sided Staking and more.",
"warning": { "warning": {
"ctd": "Compute-to-Data is still in a testing phase, please use it only on test networks." "ctd": "Compute-to-Data is still in a testing phase, please use it only on test networks."
} }

129
package-lock.json generated
View File

@ -13,9 +13,8 @@
"@coingecko/cryptoformat": "^0.5.4", "@coingecko/cryptoformat": "^0.5.4",
"@loadable/component": "^5.15.2", "@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0", "@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^1.0.0", "@oceanprotocol/lib": "^1.1.2",
"@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^4.0.7",
"@tippyjs/react": "^4.2.6", "@tippyjs/react": "^4.2.6",
"@urql/exchange-refocus": "^0.2.5", "@urql/exchange-refocus": "^0.2.5",
"@walletconnect/web3-provider": "^1.7.8", "@walletconnect/web3-provider": "^1.7.8",
@ -4589,9 +4588,9 @@
"integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw==" "integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw=="
}, },
"node_modules/@oceanprotocol/lib": { "node_modules/@oceanprotocol/lib": {
"version": "1.0.0", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.2.tgz",
"integrity": "sha512-nJ8MBQZtv4fldTc9m2BlpvirImVOa3V2/ckJH1xGPQ4PZ4k5FZWmOQqM7LOdnwUJje661GT+SewR5MtNj/ewmw==", "integrity": "sha512-7NrD0qhmIKyv3GVkFlX31BdQ17aZU18a6HRogm0kpGK1Ldt9QwgEVQ157JA/lF+gUt4PB95u1OZSxsPUsBMx/g==",
"dependencies": { "dependencies": {
"@oceanprotocol/contracts": "^1.0.0", "@oceanprotocol/contracts": "^1.0.0",
"bignumber.js": "^9.0.2", "bignumber.js": "^9.0.2",
@ -5239,17 +5238,6 @@
"url": "https://opencollective.com/popperjs" "url": "https://opencollective.com/popperjs"
} }
}, },
"node_modules/@portis/web3": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@portis/web3/-/web3-4.1.0.tgz",
"integrity": "sha512-efGssWqrwpYPzQyOupYPpWmjPU/WwcFGoPXzjLbjQ3Z4Z7Q4qqqwkMeE1mwMbxWudFKlHz/VxdpJrDA42Ufqrg==",
"dependencies": {
"ethereumjs-util": "5.2.0",
"penpal": "3.0.7",
"pocket-js-core": "0.0.3",
"web3-provider-engine": "16.0.1"
}
},
"node_modules/@react-spring/animated": { "node_modules/@react-spring/animated": {
"version": "9.4.5", "version": "9.4.5",
"resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.4.5.tgz", "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.4.5.tgz",
@ -33516,11 +33504,6 @@
"node": ">=0.12" "node": ">=0.12"
} }
}, },
"node_modules/penpal": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/penpal/-/penpal-3.0.7.tgz",
"integrity": "sha512-WSXiq5HnEvzvY05SHhaXcsviUmCvh4Ze8AiIZzvmdzaaYAAx4rx8c6Xq6+MaVDG/Nfve3VmGD8HyRP3CkPvPbQ=="
},
"node_modules/performance-now": { "node_modules/performance-now": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
@ -33616,48 +33599,6 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/pocket-js-core": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/pocket-js-core/-/pocket-js-core-0.0.3.tgz",
"integrity": "sha512-OUTEvEVutdjLT6YyldvAlSebpBueUUWg2XKxGNt5u3QqrmLpBOOBmdDnGMNJ+lEwXtko+JqgwFq+HTi4g1QDVg==",
"dependencies": {
"axios": "^0.18.0"
}
},
"node_modules/pocket-js-core/node_modules/axios": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz",
"integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==",
"deprecated": "Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410",
"dependencies": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
}
},
"node_modules/pocket-js-core/node_modules/debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/pocket-js-core/node_modules/follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"dependencies": {
"debug": "=3.1.0"
},
"engines": {
"node": ">=4.0"
}
},
"node_modules/pocket-js-core/node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"node_modules/polished": { "node_modules/polished": {
"version": "4.2.2", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/polished/-/polished-4.2.2.tgz", "resolved": "https://registry.npmjs.org/polished/-/polished-4.2.2.tgz",
@ -44975,9 +44916,9 @@
"integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw==" "integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw=="
}, },
"@oceanprotocol/lib": { "@oceanprotocol/lib": {
"version": "1.0.0", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.2.tgz",
"integrity": "sha512-nJ8MBQZtv4fldTc9m2BlpvirImVOa3V2/ckJH1xGPQ4PZ4k5FZWmOQqM7LOdnwUJje661GT+SewR5MtNj/ewmw==", "integrity": "sha512-7NrD0qhmIKyv3GVkFlX31BdQ17aZU18a6HRogm0kpGK1Ldt9QwgEVQ157JA/lF+gUt4PB95u1OZSxsPUsBMx/g==",
"requires": { "requires": {
"@oceanprotocol/contracts": "^1.0.0", "@oceanprotocol/contracts": "^1.0.0",
"bignumber.js": "^9.0.2", "bignumber.js": "^9.0.2",
@ -45465,17 +45406,6 @@
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.5.tgz", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.5.tgz",
"integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw==" "integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw=="
}, },
"@portis/web3": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@portis/web3/-/web3-4.1.0.tgz",
"integrity": "sha512-efGssWqrwpYPzQyOupYPpWmjPU/WwcFGoPXzjLbjQ3Z4Z7Q4qqqwkMeE1mwMbxWudFKlHz/VxdpJrDA42Ufqrg==",
"requires": {
"ethereumjs-util": "5.2.0",
"penpal": "3.0.7",
"pocket-js-core": "0.0.3",
"web3-provider-engine": "16.0.1"
}
},
"@react-spring/animated": { "@react-spring/animated": {
"version": "9.4.5", "version": "9.4.5",
"resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.4.5.tgz", "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.4.5.tgz",
@ -67519,11 +67449,6 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"penpal": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/penpal/-/penpal-3.0.7.tgz",
"integrity": "sha512-WSXiq5HnEvzvY05SHhaXcsviUmCvh4Ze8AiIZzvmdzaaYAAx4rx8c6Xq6+MaVDG/Nfve3VmGD8HyRP3CkPvPbQ=="
},
"performance-now": { "performance-now": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
@ -67592,46 +67517,6 @@
"ts-pnp": "^1.1.6" "ts-pnp": "^1.1.6"
} }
}, },
"pocket-js-core": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/pocket-js-core/-/pocket-js-core-0.0.3.tgz",
"integrity": "sha512-OUTEvEVutdjLT6YyldvAlSebpBueUUWg2XKxGNt5u3QqrmLpBOOBmdDnGMNJ+lEwXtko+JqgwFq+HTi4g1QDVg==",
"requires": {
"axios": "^0.18.0"
},
"dependencies": {
"axios": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz",
"integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
}
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"polished": { "polished": {
"version": "4.2.2", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/polished/-/polished-4.2.2.tgz", "resolved": "https://registry.npmjs.org/polished/-/polished-4.2.2.tgz",

View File

@ -25,9 +25,8 @@
"@coingecko/cryptoformat": "^0.5.4", "@coingecko/cryptoformat": "^0.5.4",
"@loadable/component": "^5.15.2", "@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0", "@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^1.0.0", "@oceanprotocol/lib": "^1.1.2",
"@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^4.0.7",
"@tippyjs/react": "^4.2.6", "@tippyjs/react": "^4.2.6",
"@urql/exchange-refocus": "^0.2.5", "@urql/exchange-refocus": "^0.2.5",
"@walletconnect/web3-provider": "^1.7.8", "@walletconnect/web3-provider": "^1.7.8",

View File

@ -18,7 +18,6 @@ export interface AppConfig {
consumeMarketPoolSwapFee: string consumeMarketPoolSwapFee: string
consumeMarketFixedSwapFee: string consumeMarketFixedSwapFee: string
currencies: string[] currencies: string[]
portisId: string
allowFixedPricing: string allowFixedPricing: string
allowDynamicPricing: string allowDynamicPricing: string
allowFreePricing: string allowFreePricing: string

View File

@ -9,7 +9,7 @@ import React, {
} from 'react' } from 'react'
import Web3 from 'web3' import Web3 from 'web3'
import Web3Modal, { getProviderInfo, IProviderInfo } from 'web3modal' import Web3Modal, { getProviderInfo, IProviderInfo } from 'web3modal'
import { infuraProjectId as infuraId, portisId } from '../../app.config' import { infuraProjectId as infuraId } from '../../app.config'
import WalletConnectProvider from '@walletconnect/web3-provider' import WalletConnectProvider from '@walletconnect/web3-provider'
import { LoggerInstance } from '@oceanprotocol/lib' import { LoggerInstance } from '@oceanprotocol/lib'
import { isBrowser } from '@utils/index' import { isBrowser } from '@utils/index'
@ -58,12 +58,6 @@ const providerOptions = isBrowser
walletconnect: { walletconnect: {
package: WalletConnectProvider, package: WalletConnectProvider,
options: { infuraId } options: { infuraId }
},
portis: {
package: require('@portis/web3'),
options: {
id: portisId
}
} }
// torus: { // torus: {
// package: require('@toruslabs/torus-embed') // package: require('@toruslabs/torus-embed')

View File

@ -1,6 +1,6 @@
import { import {
downloadFileBrowser, downloadFileBrowser,
FileMetadata, FileInfo,
LoggerInstance, LoggerInstance,
ProviderInstance ProviderInstance
} from '@oceanprotocol/lib' } from '@oceanprotocol/lib'
@ -25,7 +25,7 @@ export async function getFileDidInfo(
did: string, did: string,
serviceId: string, serviceId: string,
providerUrl: string providerUrl: string
): Promise<FileMetadata[]> { ): Promise<FileInfo[]> {
try { try {
const response = await ProviderInstance.checkDidFiles( const response = await ProviderInstance.checkDidFiles(
did, did,
@ -41,7 +41,7 @@ export async function getFileDidInfo(
export async function getFileUrlInfo( export async function getFileUrlInfo(
url: string, url: string,
providerUrl: string providerUrl: string
): Promise<FileMetadata[]> { ): Promise<FileInfo[]> {
try { try {
const response = await ProviderInstance.checkFileUrl(url, providerUrl) const response = await ProviderInstance.checkFileUrl(url, providerUrl)
return response return response

View File

@ -24,10 +24,6 @@
display: inline-block; display: inline-block;
} }
.banner button {
font-size: calc(var(--font-size-small) / 1.1);
}
.text { .text {
font-size: var(--font-size-small); font-size: var(--font-size-small);
font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold);
@ -41,6 +37,13 @@
text-decoration: underline; text-decoration: underline;
} }
.link {
color: inherit;
text-decoration: underline;
text-transform: inherit;
font-size: var(--font-size-small);
}
.text p:last-child { .text p:last-child {
margin-bottom: 0; margin-bottom: 0;
} }

View File

@ -37,7 +37,12 @@ export default function AnnouncementBanner({
<div className={styleClasses}> <div className={styleClasses}>
{text && <Markdown className={styles.text} text={text} />} {text && <Markdown className={styles.text} text={text} />}
{action && ( {action && (
<Button style="text" size="small" onClick={action.handleAction}> <Button
style="text"
size="small"
className={styles.link}
onClick={action.handleAction}
>
{action.name} {action.name}
</Button> </Button>
)} )}

View File

@ -4,7 +4,7 @@ import classNames from 'classnames/bind'
import cleanupContentType from '@utils/cleanupContentType' import cleanupContentType from '@utils/cleanupContentType'
import styles from './index.module.css' import styles from './index.module.css'
import Loader from '@shared/atoms/Loader' import Loader from '@shared/atoms/Loader'
import { FileMetadata } from '@oceanprotocol/lib' import { FileInfo } from '@oceanprotocol/lib'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

View File

@ -2,13 +2,13 @@ import React, { ReactElement } from 'react'
import { prettySize } from './utils' import { prettySize } from './utils'
import cleanupContentType from '@utils/cleanupContentType' import cleanupContentType from '@utils/cleanupContentType'
import styles from './Info.module.css' import styles from './Info.module.css'
import { FileMetadata } from '@oceanprotocol/lib' import { FileInfo as FileInfoData } from '@oceanprotocol/lib'
export default function FileInfo({ export default function FileInfo({
file, file,
handleClose handleClose
}: { }: {
file: FileMetadata file: FileInfoData
handleClose(): void handleClose(): void
}): ReactElement { }): ReactElement {
const contentTypeCleaned = file.contentType const contentTypeCleaned = file.contentType

View File

@ -19,11 +19,26 @@ export default function App({
const { siteContent, appConfig } = useMarketMetadata() const { siteContent, appConfig } = useMarketMetadata()
const { accountId } = useWeb3() const { accountId } = useWeb3()
const { isInPurgatory, purgatoryData } = useAccountPurgatory(accountId) const { isInPurgatory, purgatoryData } = useAccountPurgatory(accountId)
function openInNewTab() {
window
.open(
'https://blog.oceanprotocol.com/how-to-publish-a-data-nft-f58ad2a622a9',
'_blank'
)
.focus()
}
return ( return (
<div className={styles.app}> <div className={styles.app}>
{siteContent?.announcement !== '' && ( {siteContent?.announcement !== '' && (
<AnnouncementBanner text={siteContent?.announcement} /> <AnnouncementBanner
text={siteContent?.announcement}
action={{
name: 'Explore OceanONDA V4.',
style: 'link',
handleAction: openInNewTab
}}
/>
)} )}
<Header /> <Header />

View File

@ -3,7 +3,7 @@ import {
Asset, Asset,
DDO, DDO,
PublisherTrustedAlgorithm, PublisherTrustedAlgorithm,
FileMetadata FileInfo
} from '@oceanprotocol/lib' } from '@oceanprotocol/lib'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import Price from '@shared/Price' import Price from '@shared/Price'
@ -46,7 +46,7 @@ export default function Compute({
ddo: Asset ddo: Asset
accessDetails: AccessDetails accessDetails: AccessDetails
dtBalance: string dtBalance: string
file: FileMetadata file: FileInfo
fileIsLoading?: boolean fileIsLoading?: boolean
isConsumable?: boolean isConsumable?: boolean
consumableFeedback?: string consumableFeedback?: string

View File

@ -7,7 +7,7 @@ import ButtonBuy from '@shared/ButtonBuy'
import { secondsToString } from '@utils/ddo' import { secondsToString } from '@utils/ddo'
import AlgorithmDatasetsListForCompute from './Compute/AlgorithmDatasetsListForCompute' import AlgorithmDatasetsListForCompute from './Compute/AlgorithmDatasetsListForCompute'
import styles from './Download.module.css' import styles from './Download.module.css'
import { FileMetadata, LoggerInstance, ZERO_ADDRESS } from '@oceanprotocol/lib' import { FileInfo, LoggerInstance, ZERO_ADDRESS } from '@oceanprotocol/lib'
import { order } from '@utils/order' import { order } from '@utils/order'
import { AssetExtended } from 'src/@types/AssetExtended' import { AssetExtended } from 'src/@types/AssetExtended'
import { buyDtFromPool } from '@utils/pool' import { buyDtFromPool } from '@utils/pool'
@ -29,7 +29,7 @@ export default function Download({
consumableFeedback consumableFeedback
}: { }: {
asset: AssetExtended asset: AssetExtended
file: FileMetadata file: FileInfo
isBalanceSufficient: boolean isBalanceSufficient: boolean
dtBalance: string dtBalance: string
fileIsLoading?: boolean fileIsLoading?: boolean

View File

@ -1,7 +1,7 @@
import React, { ReactElement, useState, useEffect } from 'react' import React, { ReactElement, useState, useEffect } from 'react'
import Compute from './Compute' import Compute from './Compute'
import Consume from './Download' import Consume from './Download'
import { FileMetadata, LoggerInstance, Datatoken } from '@oceanprotocol/lib' import { FileInfo, LoggerInstance, Datatoken } from '@oceanprotocol/lib'
import Tabs, { TabsItem } from '@shared/atoms/Tabs' import Tabs, { TabsItem } from '@shared/atoms/Tabs'
import { compareAsBN } from '@utils/numbers' import { compareAsBN } from '@utils/numbers'
import Pool from './Pool' import Pool from './Pool'
@ -37,7 +37,7 @@ export default function AssetActions({
const [isBalanceSufficient, setIsBalanceSufficient] = useState<boolean>() const [isBalanceSufficient, setIsBalanceSufficient] = useState<boolean>()
const [dtBalance, setDtBalance] = useState<string>() const [dtBalance, setDtBalance] = useState<string>()
const [fileMetadata, setFileMetadata] = useState<FileMetadata>() const [fileMetadata, setFileMetadata] = useState<FileInfo>()
const [fileIsLoading, setFileIsLoading] = useState<boolean>(false) const [fileIsLoading, setFileIsLoading] = useState<boolean>(false)
const isCompute = Boolean( const isCompute = Boolean(
asset?.services.filter((service) => service.type === 'compute')[0] asset?.services.filter((service) => service.type === 'compute')[0]

View File

@ -24,6 +24,7 @@ import EditFeedback from './EditFeedback'
import { useAsset } from '@context/Asset' import { useAsset } from '@context/Asset'
import { setNftMetadata } from '@utils/nft' import { setNftMetadata } from '@utils/nft'
import { sanitizeUrl } from '@utils/url' import { sanitizeUrl } from '@utils/url'
import { getEncryptedFiles } from '@utils/provider'
export default function Edit({ export default function Edit({
asset asset
@ -64,6 +65,7 @@ export default function Edit({
resetForm: () => void resetForm: () => void
) { ) {
try { try {
let updatedFiles = asset.services[0].files
const linksTransformed = values.links?.length && const linksTransformed = values.links?.length &&
values.links[0].valid && [sanitizeUrl(values.links[0].url)] values.links[0].valid && [sanitizeUrl(values.links[0].url)]
const updatedMetadata: Metadata = { const updatedMetadata: Metadata = {
@ -78,17 +80,43 @@ export default function Edit({
values.price !== asset.accessDetails.price && values.price !== asset.accessDetails.price &&
(await updateFixedPrice(values.price)) (await updateFixedPrice(values.price))
if (values.files[0]?.url) {
const file = {
nftAddress: asset.nftAddress,
datatokenAddress: asset.services[0].datatokenAddress,
files: [
{
type: 'url',
index: 0,
url: values.files[0].url,
method: 'GET'
}
]
}
const filesEncrypted = await getEncryptedFiles(
file,
asset.services[0].serviceEndpoint
)
updatedFiles = filesEncrypted
}
const updatedService: Service = { const updatedService: Service = {
...asset.services[0], ...asset.services[0],
timeout: mapTimeoutStringToSeconds(values.timeout) timeout: mapTimeoutStringToSeconds(values.timeout),
files: updatedFiles
} }
// TODO: remove version update at a later time
const updatedAsset: Asset = { const updatedAsset: Asset = {
...asset, ...(asset as Asset),
version: '4.1.0',
metadata: updatedMetadata, metadata: updatedMetadata,
services: [updatedService] services: [updatedService]
} }
// delete custom helper properties injected in the market so we don't write them on chain
delete (updatedAsset as AssetExtended).accessDetails
delete (updatedAsset as AssetExtended).datatokens
delete (updatedAsset as AssetExtended).stats
const setMetadataTx = await setNftMetadata( const setMetadataTx = await setNftMetadata(
updatedAsset, updatedAsset,
accountId, accountId,

View File

@ -1,9 +1,8 @@
import React, { ChangeEvent, ReactElement, useState } from 'react' import React, { ChangeEvent, ReactElement } from 'react'
import { Field, Form, FormikContextType, useFormikContext } from 'formik' import { Field, Form, FormikContextType, useFormikContext } from 'formik'
import Input, { InputProps } from '@shared/FormInput' import Input, { InputProps } from '@shared/FormInput'
import FormActions from './FormActions' import FormActions from './FormActions'
import styles from './FormEdit.module.css' import styles from './FormEdit.module.css'
import { FormPublishData } from '../../Publish/_types'
import { useAsset } from '@context/Asset' import { useAsset } from '@context/Asset'
import { MetadataEditForm } from './_types' import { MetadataEditForm } from './_types'

View File

@ -1,4 +1,4 @@
import { Metadata, ServiceComputeOptions } from '@oceanprotocol/lib' import { FileInfo, Metadata, ServiceComputeOptions } from '@oceanprotocol/lib'
import { secondsToString } from '@utils/ddo' import { secondsToString } from '@utils/ddo'
import * as Yup from 'yup' import * as Yup from 'yup'
import { MetadataEditForm } from './_types' import { MetadataEditForm } from './_types'
@ -10,6 +10,7 @@ export const validationSchema = Yup.object().shape({
description: Yup.string().required('Required').min(10), description: Yup.string().required('Required').min(10),
price: Yup.number().required('Required'), price: Yup.number().required('Required'),
links: Yup.array<any[]>().nullable(), links: Yup.array<any[]>().nullable(),
files: Yup.array<FileInfo[]>().nullable(),
timeout: Yup.string().required('Required'), timeout: Yup.string().required('Required'),
author: Yup.string().nullable() author: Yup.string().nullable()
}) })
@ -24,6 +25,7 @@ export function getInitialValues(
description: metadata?.description, description: metadata?.description,
price, price,
links: metadata?.links, links: metadata?.links,
files: '',
timeout: secondsToString(timeout), timeout: secondsToString(timeout),
author: metadata?.author author: metadata?.author
} }

View File

@ -6,5 +6,6 @@ export interface MetadataEditForm {
timeout: string timeout: string
price?: string price?: string
links?: string | any[] links?: string | any[]
files: string | any[]
author?: string author?: string
} }

View File

@ -1,4 +1,4 @@
import React, { ChangeEvent, ReactElement, useEffect, useState } from 'react' import React, { ReactElement, useEffect, useState } from 'react'
import { formatCurrency } from '@coingecko/cryptoformat' import { formatCurrency } from '@coingecko/cryptoformat'
import { useUserPreferences } from '@context/UserPreferences' import { useUserPreferences } from '@context/UserPreferences'
import Button from '@shared/atoms/Button' import Button from '@shared/atoms/Button'
@ -7,11 +7,9 @@ import Conversion from '@shared/Price/Conversion'
import { useWeb3 } from '@context/Web3' import { useWeb3 } from '@context/Web3'
import { getOceanConfig } from '@utils/ocean' import { getOceanConfig } from '@utils/ocean'
import styles from './Details.module.css' import styles from './Details.module.css'
import InputElement from '@shared/FormInput/InputElement'
export default function Details(): ReactElement { export default function Details(): ReactElement {
const { const {
web3Provider,
web3ProviderInfo, web3ProviderInfo,
web3Modal, web3Modal,
connect, connect,
@ -27,7 +25,6 @@ export default function Details(): ReactElement {
address: string address: string
symbol: string symbol: string
}>() }>()
const [portisNetwork, setPortisNetwork] = useState<string>()
useEffect(() => { useEffect(() => {
if (!networkId) return if (!networkId) return
@ -45,16 +42,6 @@ export default function Details(): ReactElement {
}) })
}, [networkData, networkId]) }, [networkData, networkId])
// Handle network change for Portis
async function handlePortisNetworkChange(e: ChangeEvent<HTMLSelectElement>) {
setPortisNetwork(e.target.value)
const portisNetworkName = e.target.value.toLowerCase()
await web3Provider._portis.changeNetwork(portisNetworkName)
// TODO: using our connect initializes a new Portis instance,
// which then defaults back to initial network (Mainnet).
// await connect()
}
return ( return (
<div className={styles.details}> <div className={styles.details}>
<ul> <ul>
@ -76,16 +63,6 @@ export default function Details(): ReactElement {
<img className={styles.walletLogo} src={web3ProviderInfo?.logo} /> <img className={styles.walletLogo} src={web3ProviderInfo?.logo} />
{web3ProviderInfo?.name} {web3ProviderInfo?.name}
</span> </span>
{web3ProviderInfo?.name === 'Portis' && (
<InputElement
name="network"
type="select"
options={['Mainnet', 'Ropsten', 'Rinkeby']}
size="mini"
value={portisNetwork}
onChange={handlePortisNetworkChange}
/>
)}
{web3ProviderInfo?.name === 'MetaMask' && ( {web3ProviderInfo?.name === 'MetaMask' && (
<AddToken <AddToken
address={oceanTokenMetadata?.address} address={oceanTokenMetadata?.address}
@ -97,15 +74,6 @@ export default function Details(): ReactElement {
)} )}
</div> </div>
<p> <p>
{web3ProviderInfo?.name === 'Portis' && (
<Button
style="text"
size="small"
onClick={() => web3Provider._portis.showPortis()}
>
Show Portis
</Button>
)}
<Button <Button
style="text" style="text"
size="small" size="small"

View File

@ -3,7 +3,7 @@ import { NftMetadata } from '@utils/nft'
import { ReactElement } from 'react' import { ReactElement } from 'react'
import { PriceOptions } from 'src/@types/Price' import { PriceOptions } from 'src/@types/Price'
interface FileMetadata { interface FileInfo {
url: string url: string
valid?: boolean valid?: boolean
contentLength?: string contentLength?: string
@ -11,8 +11,8 @@ interface FileMetadata {
} }
export interface FormPublishService { export interface FormPublishService {
files: FileMetadata[] files: FileInfo[]
links?: FileMetadata[] links?: FileInfo[]
timeout: string timeout: string
dataTokenOptions: { name: string; symbol: string } dataTokenOptions: { name: string; symbol: string }
access: 'Download' | 'Compute' | string access: 'Download' | 'Compute' | string

View File

@ -146,7 +146,7 @@ export const validationSchema: Yup.SchemaOf<any> = Yup.object().shape({
// .min(4, (param) => `Title must be at least ${param.min} characters`) // .min(4, (param) => `Title must be at least ${param.min} characters`)
// .required('Required'), // .required('Required'),
// description: Yup.string().min(10).required('Required'), // description: Yup.string().min(10).required('Required'),
// files: Yup.array<FileMetadata>().required('Required').nullable(), // files: Yup.array<FileInfo>().required('Required').nullable(),
// timeout: Yup.string().required('Required'), // timeout: Yup.string().required('Required'),
// dataTokenOptions: Yup.object() // dataTokenOptions: Yup.object()
// .shape({ // .shape({
@ -167,6 +167,6 @@ export const validationSchema: Yup.SchemaOf<any> = Yup.object().shape({
// // ---- optional fields ---- // // ---- optional fields ----
// algorithmPrivacy: Yup.boolean().nullable(), // algorithmPrivacy: Yup.boolean().nullable(),
// tags: Yup.string().nullable(), // tags: Yup.string().nullable(),
// links: Yup.array<FileMetadata[]>().nullable() // links: Yup.array<FileInfo[]>().nullable()
// }) // })
// .defined() // .defined()