1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

Merge pull request #617 from oceanprotocol/feature/package-updates

Bump all non-gatsby dependencies / npm v7
This commit is contained in:
Matthias Kretschmann 2021-06-04 14:34:09 +02:00 committed by GitHub
commit fc6f611ac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 48857 additions and 15565 deletions

View File

@ -1,11 +1,12 @@
{ {
"parser": "babel-eslint",
"extends": ["eslint:recommended", "prettier"], "extends": ["eslint:recommended", "prettier"],
"env": { "es6": true, "browser": true, "node": true, "jest": true }, "parserOptions": {
"sourceType": "module",
"ecmaFeatures": { "jsx": true }
},
"env": { "browser": true, "node": true, "es2020": true, "jest": true },
"settings": { "settings": {
"react": { "react": { "version": "detect" }
"version": "detect"
}
}, },
"overrides": [ "overrides": [
{ {
@ -20,9 +21,6 @@
"plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended", "plugin:prettier/recommended",
"prettier/react",
"prettier/standard",
"prettier/@typescript-eslint",
"plugin:react-hooks/recommended" "plugin:react-hooks/recommended"
], ],
"plugins": ["@typescript-eslint", "prettier"], "plugins": ["@typescript-eslint", "prettier"],

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
16

View File

@ -38,6 +38,9 @@ To start local development:
git clone git@github.com:oceanprotocol/market.git git clone git@github.com:oceanprotocol/market.git
cd market cd market
# when using nvm to manage Node.js versions
nvm use
npm install npm install
npm start npm start
``` ```

View File

@ -2,8 +2,7 @@ module.exports = {
client: { client: {
service: { service: {
name: 'ocean', name: 'ocean',
url: url: 'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
// optional disable SSL validation check // optional disable SSL validation check
skipSSLValidation: true skipSSLValidation: true
} }

View File

@ -43,7 +43,7 @@ exports.onCreatePage = async ({ page, actions }) => {
exports.onCreateWebpackConfig = ({ actions }) => { exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({ actions.setWebpackConfig({
node: { node: {
// 'fs' fix for squid.js // 'fs' fix for ocean.js
fs: 'empty' fs: 'empty'
}, },
// fix for 'got'/'swarm-js' dependency // fix for 'got'/'swarm-js' dependency

63807
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,122 +23,112 @@
"postinstall": "husky install" "postinstall": "husky install"
}, },
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.11", "@apollo/client": "^3.3.19",
"@coingecko/cryptoformat": "^0.4.2", "@coingecko/cryptoformat": "^0.4.2",
"@loadable/component": "^5.14.1", "@loadable/component": "^5.15.0",
"@oceanprotocol/art": "^3.0.0", "@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.14.8", "@oceanprotocol/lib": "^0.15.1",
"@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^3.0.3", "@portis/web3": "^4.0.4",
"@sindresorhus/slugify": "^1.0.0", "@sindresorhus/slugify": "^2.1.0",
"@tippyjs/react": "^4.2.0", "@tippyjs/react": "^4.2.5",
"@types/classnames": "^2.2.11", "@walletconnect/web3-provider": "^1.4.1",
"@vercel/node": "^1.8.5",
"@walletconnect/web3-provider": "^1.3.4",
"axios": "^0.21.1", "axios": "^0.21.1",
"chart.js": "^2.9.4", "chart.js": "^2.9.4",
"classnames": "^2.2.6", "classnames": "^2.3.1",
"cross-fetch": "^3.0.6", "cross-fetch": "^3.1.4",
"date-fns": "^2.16.1", "date-fns": "^2.22.1",
"decimal.js": "^10.2.1", "decimal.js": "^10.2.1",
"dom-confetti": "^0.2.2", "dom-confetti": "^0.2.2",
"dotenv": "^8.2.0", "dotenv": "^10.0.0",
"ethereum-address": "0.0.4", "ethereum-address": "0.0.4",
"ethereum-blockies": "github:MyEtherWallet/blockies", "ethereum-blockies": "github:MyEtherWallet/blockies",
"filesize": "^6.1.0", "filesize": "^6.3.0",
"formik": "^2.2.6", "formik": "^2.2.9",
"gatsby": "^2.30.2", "gatsby": "^2.32.13",
"gatsby-image": "^2.9.0", "gatsby-image": "^2.9.0",
"gatsby-plugin-manifest": "^2.10.0", "gatsby-plugin-manifest": "^2.10.0",
"gatsby-plugin-react-helmet": "^3.8.0", "gatsby-plugin-react-helmet": "^3.8.0",
"gatsby-plugin-remove-trailing-slashes": "^2.8.0", "gatsby-plugin-remove-trailing-slashes": "^2.8.0",
"gatsby-plugin-sharp": "^2.12.1", "gatsby-plugin-sharp": "^2.14.4",
"gatsby-plugin-svgr": "^2.1.0", "gatsby-plugin-svgr": "^2.1.0",
"gatsby-plugin-use-dark-mode": "^1.2.0", "gatsby-plugin-use-dark-mode": "^1.3.0",
"gatsby-plugin-webpack-size": "^1.0.0", "gatsby-plugin-webpack-size": "^2.0.1",
"gatsby-source-filesystem": "^2.9.0", "gatsby-source-filesystem": "^2.9.0",
"gatsby-source-graphql": "^2.12.0", "gatsby-source-graphql": "^2.12.0",
"gatsby-transformer-json": "^2.9.0", "gatsby-transformer-json": "^2.9.0",
"gatsby-transformer-remark": "^2.14.0", "gatsby-transformer-remark": "^2.16.1",
"gatsby-transformer-sharp": "^2.10.1", "gatsby-transformer-sharp": "^2.12.1",
"intersection-observer": "^0.12.0", "graphql": "14.7.0",
"is-url-superb": "^5.0.0", "is-url-superb": "^6.0.0",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"lodash.omit": "^4.5.0", "lodash.omit": "^4.5.0",
"query-string": "^6.13.8", "query-string": "^7.0.0",
"react": "^17.0.1", "react": "^17.0.2",
"react-chartjs-2": "^2.11.1", "react-chartjs-2": "^2.11.2",
"react-data-table-component": "^6.11.6", "react-data-table-component": "^6.11.7",
"react-dom": "^17.0.1", "react-dom": "^17.0.2",
"react-dotdotdot": "^1.3.1", "react-dotdotdot": "^1.3.1",
"react-dropzone": "^11.2.4",
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"react-intersection-observer": "^8.31.0", "react-markdown": "^6.0.2",
"react-markdown": "^5.0.3", "react-modal": "^3.14.2",
"react-modal": "^3.12.1", "react-paginate": "^7.1.3",
"react-paginate": "^7.0.0", "react-spring": "^9.2.1",
"react-spring": "^8.0.27", "react-tabs": "^3.2.2",
"react-tabs": "^3.1.2", "react-toastify": "^7.0.4",
"react-toastify": "^6.2.0",
"remove-markdown": "^0.3.0", "remove-markdown": "^0.3.0",
"shortid": "^2.2.16", "shortid": "^2.2.16",
"slugify": "^1.4.6", "slugify": "^1.5.3",
"swr": "^0.3.11", "swr": "^0.5.6",
"use-dark-mode": "^2.3.1", "use-dark-mode": "^2.3.1",
"web3": "^1.3.4", "web3": "^1.3.6",
"web3modal": "^1.9.3", "web3modal": "^1.9.3",
"yup": "^0.32.6" "yup": "^0.32.9"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-typescript": "^7.12.7",
"@storybook/addon-actions": "^6.1.14",
"@storybook/addon-storyshots": "^6.2.8",
"@storybook/react": "^6.2.8",
"@svgr/webpack": "^5.5.0", "@svgr/webpack": "^5.5.0",
"@testing-library/jest-dom": "^5.11.9", "@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.3", "@testing-library/react": "^11.2.7",
"@types/chart.js": "^2.9.29", "@types/chart.js": "^2.9.32",
"@types/jest": "^26.0.20", "@types/classnames": "^2.3.1",
"@types/jest": "^26.0.23",
"@types/loadable__component": "^5.13.1", "@types/loadable__component": "^5.13.1",
"@types/lodash.debounce": "^4.0.3", "@types/lodash.debounce": "^4.0.3",
"@types/lodash.omit": "^4.5.6", "@types/lodash.omit": "^4.5.6",
"@types/node": "^14.14.20", "@types/node": "^15.6.1",
"@types/react": "^17.0.0", "@types/react": "^17.0.8",
"@types/react-helmet": "^6.1.0", "@types/react-helmet": "^6.1.1",
"@types/react-modal": "^3.10.6", "@types/react-modal": "^3.12.0",
"@types/react-paginate": "^6.2.1", "@types/react-paginate": "^7.1.0",
"@types/react-tabs": "^2.3.2", "@types/react-tabs": "^2.3.2",
"@types/remove-markdown": "^0.1.1", "@types/remove-markdown": "^0.3.0",
"@types/shortid": "0.0.29", "@types/shortid": "0.0.29",
"@types/yup": "^0.29.11", "@types/yup": "^0.29.11",
"@typescript-eslint/eslint-plugin": "^4.13.0", "@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.13.0", "@typescript-eslint/parser": "^4.26.0",
"apollo": "^2.32.1", "apollo": "^2.33.4",
"babel-loader": "^8.2.2", "eslint": "^7.27.0",
"babel-preset-react-app": "^10.0.0",
"eslint": "^7.17.0",
"eslint-config-oceanprotocol": "^1.5.0", "eslint-config-oceanprotocol": "^1.5.0",
"eslint-config-prettier": "^7.1.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.22.0", "eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-hooks": "^4.2.0",
"husky": "^5.0.8", "husky": "^6.0.0",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^26.6.3", "jest": "^26.6.3",
"prettier": "^2.2.1", "prettier": "^2.3.0",
"pretty-quick": "^3.1.0", "pretty-quick": "^3.1.0",
"serve": "^11.3.2", "serve": "^11.3.2",
"source-map-explorer": "^2.5.2", "source-map-explorer": "^2.5.2",
"typescript": "^4.1.3" "typescript": "^4.3.2"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/oceanprotocol/market" "url": "https://github.com/oceanprotocol/market"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=14"
}, },
"browserslist": [ "browserslist": [
">0.2%", ">0.2%",

View File

@ -1,5 +1,3 @@
declare module 'intersection-observer'
declare module 'ethereum-blockies' { declare module 'ethereum-blockies' {
export function toDataUrl(address: string): string export function toDataUrl(address: string): string
} }

View File

@ -1,57 +1,57 @@
import React from 'react' // import React from 'react'
import { action } from '@storybook/addon-actions' // // import { action } from '@storybook/addon-actions'
import Button from './Button' // import Button from './Button'
export default { // export default {
title: 'Atoms/Button' // title: 'Atoms/Button'
} // }
export const Default = () => ( // export const Default = () => (
<> // <>
<Button onClick={action('clicked')}>Hello Button</Button> // <Button onClick={action('clicked')}>Hello Button</Button>
<br /> // <br />
<br /> // <br />
<Button size="small" onClick={action('clicked')}> // <Button size="small" onClick={action('clicked')}>
Hello Button // Hello Button
</Button> // </Button>
</> // </>
) // )
export const Primary = () => ( // export const Primary = () => (
<> // <>
<Button style="primary" onClick={action('clicked')}> // <Button style="primary" onClick={action('clicked')}>
Hello Button // Hello Button
</Button> // </Button>
<br /> // <br />
<br /> // <br />
<Button style="primary" size="small" onClick={action('clicked')}> // <Button style="primary" size="small" onClick={action('clicked')}>
Hello Button // Hello Button
</Button> // </Button>
</> // </>
) // )
export const Ghost = () => ( // export const Ghost = () => (
<> // <>
<Button style="ghost" onClick={action('clicked')}> // <Button style="ghost" onClick={action('clicked')}>
Hello Button // Hello Button
</Button> // </Button>
<br /> // <br />
<br /> // <br />
<Button style="ghost" size="small" onClick={action('clicked')}> // <Button style="ghost" size="small" onClick={action('clicked')}>
Hello Button // Hello Button
</Button> // </Button>
</> // </>
) // )
export const Text = () => ( // export const Text = () => (
<> // <>
<Button style="text" onClick={action('clicked')}> // <Button style="text" onClick={action('clicked')}>
Hello Button // Hello Button
</Button> // </Button>
<br /> // <br />
<br /> // <br />
<Button style="text" size="small" onClick={action('clicked')}> // <Button style="text" size="small" onClick={action('clicked')}>
Hello Button // Hello Button
</Button> // </Button>
</> // </>
) // )

View File

@ -107,7 +107,7 @@ export default function InputElement({
case 'assetSelection': case 'assetSelection':
return ( return (
<AssetSelection <AssetSelection
assets={(options as unknown) as AssetSelectionAsset[]} assets={options as unknown as AssetSelectionAsset[]}
{...field} {...field}
{...props} {...props}
/> />
@ -115,7 +115,7 @@ export default function InputElement({
case 'assetSelectionMultiple': case 'assetSelectionMultiple':
return ( return (
<AssetSelection <AssetSelection
assets={(options as unknown) as AssetSelectionAsset[]} assets={options as unknown as AssetSelectionAsset[]}
multiple multiple
disabled={disabled} disabled={disabled}
{...field} {...field}
@ -132,7 +132,7 @@ export default function InputElement({
return ( return (
<BoxSelection <BoxSelection
name={name} name={name}
options={(options as unknown) as BoxSelectionOption[]} options={options as unknown as BoxSelectionOption[]}
{...field} {...field}
{...props} {...props}
/> />

View File

@ -13,10 +13,9 @@ const Markdown = ({
// https://github.com/rexxars/react-markdown/issues/105#issuecomment-351585313 // https://github.com/rexxars/react-markdown/issues/105#issuecomment-351585313
const textCleaned = text?.replace(/\\n/g, '\n ') const textCleaned = text?.replace(/\\n/g, '\n ')
return ( return (
<ReactMarkdown <ReactMarkdown className={`${styles.markdown} ${className}`}>
source={textCleaned} {textCleaned}
className={`${styles.markdown} ${className}`} </ReactMarkdown>
/>
) )
} }

View File

@ -11,13 +11,8 @@ import Web3Feedback from './Feedback'
import styles from './Details.module.css' import styles from './Details.module.css'
export default function Details(): ReactElement { export default function Details(): ReactElement {
const { const { web3Provider, web3ProviderInfo, connect, logout, networkData } =
web3Provider, useWeb3()
web3ProviderInfo,
connect,
logout,
networkData
} = useWeb3()
const { balance, config } = useOcean() const { balance, config } = useOcean()
const { locale } = useUserPreferences() const { locale } = useUserPreferences()

View File

@ -82,10 +82,8 @@ export default function FormStartCompute({
const data = useStaticQuery(contentQuery) const data = useStaticQuery(contentQuery)
const content = data.content.edges[0].node.childPagesJson const content = data.content.edges[0].node.childPagesJson
const { const { isValid, values }: FormikContextType<{ algorithm: string }> =
isValid, useFormikContext()
values
}: FormikContextType<{ algorithm: string }> = useFormikContext()
const { price, ddo } = useAsset() const { price, ddo } = useAsset()
const [totalPrice, setTotalPrice] = useState(price?.value) const [totalPrice, setTotalPrice] = useState(price?.value)

View File

@ -69,15 +69,12 @@ export default function Compute({
const [isPublished, setIsPublished] = useState(false) const [isPublished, setIsPublished] = useState(false)
const [hasPreviousDatasetOrder, setHasPreviousDatasetOrder] = useState(false) const [hasPreviousDatasetOrder, setHasPreviousDatasetOrder] = useState(false)
const [previousDatasetOrderId, setPreviousDatasetOrderId] = useState<string>() const [previousDatasetOrderId, setPreviousDatasetOrderId] = useState<string>()
const [hasPreviousAlgorithmOrder, setHasPreviousAlgorithmOrder] = useState( const [hasPreviousAlgorithmOrder, setHasPreviousAlgorithmOrder] =
false useState(false)
)
const [algorithmDTBalance, setalgorithmDTBalance] = useState<string>() const [algorithmDTBalance, setalgorithmDTBalance] = useState<string>()
const [algorithmPrice, setAlgorithmPrice] = useState<BestPrice>() const [algorithmPrice, setAlgorithmPrice] = useState<BestPrice>()
const [ const [previousAlgorithmOrderId, setPreviousAlgorithmOrderId] =
previousAlgorithmOrderId, useState<string>()
setPreviousAlgorithmOrderId
] = useState<string>()
const [datasetTimeout, setDatasetTimeout] = useState<string>() const [datasetTimeout, setDatasetTimeout] = useState<string>()
const [algorithmTimeout, setAlgorithmTimeout] = useState<string>() const [algorithmTimeout, setAlgorithmTimeout] = useState<string>()

View File

@ -48,12 +48,8 @@ export default function Consume({
const [hasPreviousOrder, setHasPreviousOrder] = useState(false) const [hasPreviousOrder, setHasPreviousOrder] = useState(false)
const [previousOrderId, setPreviousOrderId] = useState<string>() const [previousOrderId, setPreviousOrderId] = useState<string>()
const { isInPurgatory, price, type } = useAsset() const { isInPurgatory, price, type } = useAsset()
const { const { buyDT, pricingStepText, pricingError, pricingIsLoading } =
buyDT, usePricing()
pricingStepText,
pricingError,
pricingIsLoading
} = usePricing()
const { consumeStepText, consume, consumeError } = useConsume() const { consumeStepText, consume, consumeError } = useConsume()
const [isDisabled, setIsDisabled] = useState(true) const [isDisabled, setIsDisabled] = useState(true)
const [hasDatatoken, setHasDatatoken] = useState(false) const [hasDatatoken, setHasDatatoken] = useState(false)

View File

@ -13,10 +13,8 @@ export default function DebugEditCompute({
ddo: DDO ddo: DDO
}): ReactElement { }): ReactElement {
const { ocean } = useOcean() const { ocean } = useOcean()
const [ const [formTransformed, setFormTransformed] =
formTransformed, useState<ServiceComputePrivacy>()
setFormTransformed
] = useState<ServiceComputePrivacy>()
useEffect(() => { useEffect(() => {
if (!ocean) return if (!ocean) return

View File

@ -29,15 +29,12 @@ export default function FormEditComputeDataset({
const { accountId } = useWeb3() const { accountId } = useWeb3()
const { ocean, config } = useOcean() const { ocean, config } = useOcean()
const { ddo } = useAsset() const { ddo } = useAsset()
const { const { isValid, values }: FormikContextType<ComputePrivacyForm> =
isValid, useFormikContext()
values
}: FormikContextType<ComputePrivacyForm> = useFormikContext()
const [allAlgorithms, setAllAlgorithms] = useState<AssetSelectionAsset[]>() const [allAlgorithms, setAllAlgorithms] = useState<AssetSelectionAsset[]>()
const { publisherTrustedAlgorithms } = ddo?.findServiceByType( const { publisherTrustedAlgorithms } =
'compute' ddo?.findServiceByType('compute').attributes.main.privacy
).attributes.main.privacy
async function getAlgorithmList( async function getAlgorithmList(
publisherTrustedAlgorithms: PublisherTrustedAlgorithm[] publisherTrustedAlgorithms: PublisherTrustedAlgorithm[]

View File

@ -48,11 +48,8 @@ export default function Output({
coin: string coin: string
}): ReactElement { }): ReactElement {
const data = useStaticQuery(contentQuery) const data = useStaticQuery(contentQuery)
const { const { help, titleIn, titleOut } =
help, data.content.edges[0].node.childContentJson.pool.add.output
titleIn,
titleOut
} = data.content.edges[0].node.childContentJson.pool.add.output
// Connect with form // Connect with form
const { values }: FormikContextType<FormAddLiquidity> = useFormikContext() const { values }: FormikContextType<FormAddLiquidity> = useFormikContext()

View File

@ -83,10 +83,8 @@ export default function Pool(): ReactElement {
const [totalUserLiquidityInOcean, setTotalUserLiquidityInOcean] = useState(0) const [totalUserLiquidityInOcean, setTotalUserLiquidityInOcean] = useState(0)
const [totalLiquidityInOcean, setTotalLiquidityInOcean] = useState(0) const [totalLiquidityInOcean, setTotalLiquidityInOcean] = useState(0)
const [ const [creatorTotalLiquidityInOcean, setCreatorTotalLiquidityInOcean] =
creatorTotalLiquidityInOcean, useState(0)
setCreatorTotalLiquidityInOcean
] = useState(0)
const [creatorLiquidity, setCreatorLiquidity] = useState<PoolBalance>() const [creatorLiquidity, setCreatorLiquidity] = useState<PoolBalance>()
const [creatorPoolTokens, setCreatorPoolTokens] = useState<string>() const [creatorPoolTokens, setCreatorPoolTokens] = useState<string>()
const [creatorPoolShare, setCreatorPoolShare] = useState<string>() const [creatorPoolShare, setCreatorPoolShare] = useState<string>()

View File

@ -9,10 +9,11 @@ export async function getMaxPercentRemove(
poolAddress poolAddress
) )
const amountMaxPoolShares = await ocean.pool.getPoolSharesRequiredToRemoveOcean( const amountMaxPoolShares =
poolAddress, await ocean.pool.getPoolSharesRequiredToRemoveOcean(
amountMaxOcean poolAddress,
) amountMaxOcean
)
let amountMaxPercent = `${Math.floor( let amountMaxPercent = `${Math.floor(
(Number(amountMaxPoolShares) / Number(poolTokens)) * 100 (Number(amountMaxPoolShares) / Number(poolTokens)) * 100

View File

@ -6,10 +6,8 @@ import styles from './Slippage.module.css'
export default function Slippage(): ReactElement { export default function Slippage(): ReactElement {
// Connect with form // Connect with form
const { const { setFieldValue, values }: FormikContextType<FormTradeData> =
setFieldValue, useFormikContext()
values
}: FormikContextType<FormTradeData> = useFormikContext()
function handleChange(e: ChangeEvent<HTMLSelectElement>) { function handleChange(e: ChangeEvent<HTMLSelectElement>) {
setFieldValue('slippage', e.target.value) setFieldValue('slippage', e.target.value)

View File

@ -8,8 +8,8 @@ export default function MetaFull(): ReactElement {
const { ddo, metadata, isInPurgatory, type } = useAsset() const { ddo, metadata, isInPurgatory, type } = useAsset()
function DockerImage() { function DockerImage() {
const algorithmContainer = ddo.findServiceByType('metadata').attributes.main const algorithmContainer =
.algorithm.container ddo.findServiceByType('metadata').attributes.main.algorithm.container
const { image } = algorithmContainer const { image } = algorithmContainer
const { tag } = algorithmContainer const { tag } = algorithmContainer
return <span>{`${image}:${tag}`}</span> return <span>{`${image}:${tag}`}</span>

View File

@ -25,13 +25,8 @@ export default function FormPricing({
// Connect with form // Connect with form
const { values, setFieldValue, submitForm } = useFormikContext() const { values, setFieldValue, submitForm } = useFormikContext()
const { const { price, oceanAmount, weightOnOcean, weightOnDataToken, type } =
price, values as PriceOptionsMarket
oceanAmount,
weightOnOcean,
weightOnDataToken,
type
} = values as PriceOptionsMarket
// Switch type value upon tab change // Switch type value upon tab change
function handleTabChange(tabName: string) { function handleTabChange(tabName: string) {

View File

@ -57,12 +57,8 @@ export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
const [showPricing, setShowPricing] = useState(false) const [showPricing, setShowPricing] = useState(false)
const [success, setSuccess] = useState<string>() const [success, setSuccess] = useState<string>()
const { const { createPricing, pricingIsLoading, pricingError, pricingStepText } =
createPricing, usePricing()
pricingIsLoading,
pricingError,
pricingStepText
} = usePricing()
const hasFeedback = pricingIsLoading || typeof success !== 'undefined' const hasFeedback = pricingIsLoading || typeof success !== 'undefined'

View File

@ -92,9 +92,8 @@ export default function PublishPage({
.initialValues as MetadataPublishFormDataset)) || .initialValues as MetadataPublishFormDataset)) ||
initialValues initialValues
) )
const [publishType, setPublishType] = useState<MetadataMain['type']>( const [publishType, setPublishType] =
'dataset' useState<MetadataMain['type']>('dataset')
)
const hasFeedback = isLoading || error || success const hasFeedback = isLoading || error || success
const emptyAlgoDT = Object.values(algoInitialValues.dataTokenOptions).every( const emptyAlgoDT = Object.values(algoInitialValues.dataTokenOptions).every(
@ -137,7 +136,7 @@ export default function PublishPage({
) )
const ddo = await publish( const ddo = await publish(
(metadata as unknown) as Metadata, metadata as unknown as Metadata,
serviceType, serviceType,
values.dataTokenOptions, values.dataTokenOptions,
timeout timeout
@ -186,7 +185,7 @@ export default function PublishPage({
Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions) Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions)
const ddo = await publish( const ddo = await publish(
(metadata as unknown) as Metadata, metadata as unknown as Metadata,
values.algorithmPrivacy === true ? 'compute' : 'access', values.algorithmPrivacy === true ? 'compute' : 'access',
values.dataTokenOptions, values.dataTokenOptions,
timeout timeout

View File

@ -47,7 +47,7 @@ button.filter,
margin-bottom: calc(var(--spacer) / 6); margin-bottom: calc(var(--spacer) / 6);
} }
.showClear:hover{ .showClear:hover {
display: inline-flex; display: inline-flex;
color: var(--color-primary); color: var(--color-primary);
} }

View File

@ -36,8 +36,9 @@ export default function FilterPrice({
async function handleSelectedFilter(isSelected: boolean, value: string) { async function handleSelectedFilter(isSelected: boolean, value: string) {
if (isSelected) { if (isSelected) {
if (serviceSelections.length > 1) { if (serviceSelections.length > 1) {
const otherValue = serviceFilterItems.find((p) => p.value !== value) const otherValue = serviceFilterItems.find(
.value (p) => p.value !== value
).value
await applyServiceFilter(otherValue) await applyServiceFilter(otherValue)
setServiceSelections([otherValue]) setServiceSelections([otherValue])
} else { } else {

View File

@ -27,7 +27,8 @@ export const FilterByTypeOptions = {
Data: 'dataset', Data: 'dataset',
Algorithm: 'algorithm' Algorithm: 'algorithm'
} as const } as const
type FilterByTypeOptions = typeof FilterByTypeOptions[keyof typeof FilterByTypeOptions] type FilterByTypeOptions =
typeof FilterByTypeOptions[keyof typeof FilterByTypeOptions]
function addTypeFilterToQuery(sortTerm: string, typeFilter: string): string { function addTypeFilterToQuery(sortTerm: string, typeFilter: string): string {
sortTerm = typeFilter sortTerm = typeFilter

View File

@ -202,13 +202,8 @@ function usePricing(): UsePricing {
if (!ocean || !accountId || !dtSymbol) return if (!ocean || !accountId || !dtSymbol) return
const { const { type, oceanAmount, price, weightOnDataToken, swapFee } =
type, priceOptions
oceanAmount,
price,
weightOnDataToken,
swapFee
} = priceOptions
let { dtAmount } = priceOptions let { dtAmount } = priceOptions
const isPool = type === 'dynamic' const isPool = type === 'dynamic'

View File

@ -69,13 +69,14 @@ function usePublish(): UsePublish {
switch (serviceType) { switch (serviceType) {
case 'access': { case 'access': {
if (!timeout) timeout = 0 if (!timeout) timeout = 0
const accessService = await ocean.assets.createAccessServiceAttributes( const accessService =
account, await ocean.assets.createAccessServiceAttributes(
price, account,
publishedDate, price,
timeout, publishedDate,
providerUri timeout,
) providerUri
)
Logger.log('access service created', accessService) Logger.log('access service created', accessService)
services.push(accessService) services.push(accessService)
break break

View File

@ -2,37 +2,38 @@ import { MetadataPublishFormAlgorithm } from '../@types/MetaData'
import { File as FileMetadata } from '@oceanprotocol/lib' import { File as FileMetadata } from '@oceanprotocol/lib'
import * as Yup from 'yup' import * as Yup from 'yup'
export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> = Yup.object() export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> =
.shape({ Yup.object()
// ---- required fields ---- .shape({
name: Yup.string() // ---- required fields ----
.min(4, (param) => `Title must be at least ${param.min} characters`) name: Yup.string()
.required('Required'), .min(4, (param) => `Title must be at least ${param.min} characters`)
description: Yup.string().min(10).required('Required'), .required('Required'),
files: Yup.array<FileMetadata>().required('Required').nullable(), description: Yup.string().min(10).required('Required'),
timeout: Yup.string().required('Required'), files: Yup.array<FileMetadata>().required('Required').nullable(),
dataTokenOptions: Yup.object() timeout: Yup.string().required('Required'),
.shape({ dataTokenOptions: Yup.object()
name: Yup.string(), .shape({
symbol: Yup.string() name: Yup.string(),
}) symbol: Yup.string()
.required('Required'), })
dockerImage: Yup.string() .required('Required'),
.matches(/node:latest|python:latest|custom image/g, { dockerImage: Yup.string()
excludeEmptyString: true .matches(/node:latest|python:latest|custom image/g, {
}) excludeEmptyString: true
.required('Required'), })
image: Yup.string().required('Required'), .required('Required'),
containerTag: Yup.string().required('Required'), image: Yup.string().required('Required'),
entrypoint: Yup.string().required('Required'), containerTag: Yup.string().required('Required'),
author: Yup.string().required('Required'), entrypoint: Yup.string().required('Required'),
termsAndConditions: Yup.boolean().required('Required'), author: Yup.string().required('Required'),
// ---- optional fields ---- termsAndConditions: Yup.boolean().required('Required'),
algorithmPrivacy: Yup.boolean().nullable(), // ---- optional fields ----
tags: Yup.string().nullable(), algorithmPrivacy: Yup.boolean().nullable(),
links: Yup.array<FileMetadata[]>().nullable() tags: Yup.string().nullable(),
}) links: Yup.array<FileMetadata[]>().nullable()
.defined() })
.defined()
export const initialValues: Partial<MetadataPublishFormAlgorithm> = { export const initialValues: Partial<MetadataPublishFormAlgorithm> = {
name: '', name: '',

View File

@ -6,12 +6,11 @@ export interface ComputePrivacyForm {
publisherTrustedAlgorithms: string[] publisherTrustedAlgorithms: string[]
} }
export const validationSchema: Yup.SchemaOf<ComputePrivacyForm> = Yup.object().shape( export const validationSchema: Yup.SchemaOf<ComputePrivacyForm> =
{ Yup.object().shape({
allowAllPublishedAlgorithms: Yup.boolean().nullable(), allowAllPublishedAlgorithms: Yup.boolean().nullable(),
publisherTrustedAlgorithms: Yup.array().nullable() publisherTrustedAlgorithms: Yup.array().nullable()
} })
)
export function getInitialValues( export function getInitialValues(
compute: ServiceComputePrivacy compute: ServiceComputePrivacy

View File

@ -1,8 +1,8 @@
import { PriceOptionsMarket } from '../@types/MetaData' import { PriceOptionsMarket } from '../@types/MetaData'
import * as Yup from 'yup' import * as Yup from 'yup'
export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> = Yup.object().shape( export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> =
{ Yup.object().shape({
price: Yup.number() price: Yup.number()
.min(1, (param) => `Must be more or equal to ${param.min}`) .min(1, (param) => `Must be more or equal to ${param.min}`)
.required('Required'), .required('Required'),
@ -22,8 +22,7 @@ export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> = Yup.object().s
.max(10, 'Maximum is 10%') .max(10, 'Maximum is 10%')
.required('Required') .required('Required')
.nullable() .nullable()
} })
)
export const initialValues: PriceOptionsMarket = { export const initialValues: PriceOptionsMarket = {
price: 1, price: 1,

View File

@ -2,34 +2,35 @@ import { MetadataPublishFormDataset } from '../@types/MetaData'
import { File as FileMetadata } from '@oceanprotocol/lib' import { File as FileMetadata } from '@oceanprotocol/lib'
import * as Yup from 'yup' import * as Yup from 'yup'
export const validationSchema: Yup.SchemaOf<MetadataPublishFormDataset> = Yup.object() export const validationSchema: Yup.SchemaOf<MetadataPublishFormDataset> =
.shape({ Yup.object()
// ---- required fields ---- .shape({
name: Yup.string() // ---- required fields ----
.min(4, (param) => `Title must be at least ${param.min} characters`) name: Yup.string()
.required('Required'), .min(4, (param) => `Title must be at least ${param.min} characters`)
author: Yup.string().required('Required'), .required('Required'),
dataTokenOptions: Yup.object() author: Yup.string().required('Required'),
.shape({ dataTokenOptions: Yup.object()
name: Yup.string(), .shape({
symbol: Yup.string() name: Yup.string(),
}) symbol: Yup.string()
.required('Required'), })
files: Yup.array<FileMetadata>() .required('Required'),
.required('Enter a valid URL and click "ADD FILE"') files: Yup.array<FileMetadata>()
.nullable(), .required('Enter a valid URL and click "ADD FILE"')
description: Yup.string().min(10).required('Required'), .nullable(),
timeout: Yup.string().required('Required'), description: Yup.string().min(10).required('Required'),
access: Yup.string() timeout: Yup.string().required('Required'),
.matches(/Compute|Download/g, { excludeEmptyString: true }) access: Yup.string()
.required('Required'), .matches(/Compute|Download/g, { excludeEmptyString: true })
termsAndConditions: Yup.boolean().required('Required'), .required('Required'),
termsAndConditions: Yup.boolean().required('Required'),
// ---- optional fields ---- // ---- optional fields ----
tags: Yup.string().nullable(), tags: Yup.string().nullable(),
links: Yup.array<FileMetadata[]>().nullable() links: Yup.array<FileMetadata[]>().nullable()
}) })
.defined() .defined()
export const initialValues: Partial<MetadataPublishFormDataset> = { export const initialValues: Partial<MetadataPublishFormDataset> = {
name: '', name: '',

View File

@ -6,11 +6,8 @@ import { Helmet } from 'react-helmet'
import Button from '../components/atoms/Button' import Button from '../components/atoms/Button'
export default function PageGatsby404(props: PageProps): ReactElement { export default function PageGatsby404(props: PageProps): ReactElement {
const { const { title, description, actions } = (props.data as any).content.edges[0]
title, .node.childPagesJson
description,
actions
} = (props.data as any).content.edges[0].node.childPagesJson
return ( return (
<> <>

View File

@ -122,7 +122,7 @@ function AssetProvider({
// Get metadata from DDO // Get metadata from DDO
const { attributes } = ddo.findServiceByType('metadata') const { attributes } = ddo.findServiceByType('metadata')
setMetadata((attributes as unknown) as MetadataMarket) setMetadata(attributes as unknown as MetadataMarket)
setTitle(attributes?.main.name) setTitle(attributes?.main.name)
setType(attributes.main.type) setType(attributes.main.type)
setOwner(ddo.publicKey[0].owner) setOwner(ddo.publicKey[0].owner)

View File

@ -51,9 +51,8 @@ function OceanProvider({
eth: undefined, eth: undefined,
ocean: undefined ocean: undefined
}) })
const [config, setConfig] = useState<ConfigHelperConfig | Config>( const [config, setConfig] =
initialConfig useState<ConfigHelperConfig | Config>(initialConfig)
)
const [loading, setLoading] = useState<boolean>() const [loading, setLoading] = useState<boolean>()
// ----------------------------------- // -----------------------------------

View File

@ -13,9 +13,10 @@ export async function createTrustedAlgorithmList(
const trustedAlgorithms = [] const trustedAlgorithms = []
for (const selectedAlgorithm of selectedAlgorithms) { for (const selectedAlgorithm of selectedAlgorithms) {
const trustedAlgorithm = await ocean.compute.createPublisherTrustedAlgorithmfromDID( const trustedAlgorithm =
selectedAlgorithm await ocean.compute.createPublisherTrustedAlgorithmfromDID(
) selectedAlgorithm
)
trustedAlgorithms.push(trustedAlgorithm) trustedAlgorithms.push(trustedAlgorithm)
} }
return trustedAlgorithms return trustedAlgorithms

View File

@ -28,9 +28,9 @@ export const computeFeedback: { [key in number]: string } = {
2: '3/3 Access granted. Starting job...' 2: '3/3 Access granted. Starting job...'
} }
export function getCreatePricingPoolFeedback( export function getCreatePricingPoolFeedback(dtSymbol: string): {
dtSymbol: string [key: number]: string
): { [key: number]: string } { } {
return { return {
99: `Minting ${dtSymbol} ...`, 99: `Minting ${dtSymbol} ...`,
0: 'Creating pool ...', 0: 'Creating pool ...',
@ -41,9 +41,9 @@ export function getCreatePricingPoolFeedback(
} }
} }
export function getCreatePricingExchangeFeedback( export function getCreatePricingExchangeFeedback(dtSymbol: string): {
dtSymbol: string [key: number]: string
): { [key: number]: string } { } {
return { return {
99: `Minting ${dtSymbol} ...`, 99: `Minting ${dtSymbol} ...`,
0: 'Creating exchange ...', 0: 'Creating exchange ...',

View File

@ -127,10 +127,8 @@ export async function getPreviousOrders(
id: id, id: id,
account: account account: account
} }
const fetchedPreviousOrders: ApolloQueryResult<AssetPreviousOrder> = await fetchData( const fetchedPreviousOrders: ApolloQueryResult<AssetPreviousOrder> =
PreviousOrderQuery, await fetchData(PreviousOrderQuery, variables)
variables
)
if (fetchedPreviousOrders.data?.tokenOrders?.length === 0) return null if (fetchedPreviousOrders.data?.tokenOrders?.length === 0) return null
if (assetTimeout === '0') { if (assetTimeout === '0') {
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx

View File

@ -5,8 +5,7 @@ const ddo: Partial<DDO> = {
id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757', id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
publicKey: [ publicKey: [
{ {
id: id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
type: 'EthereumECDSAKey', type: 'EthereumECDSAKey',
owner: '0x4D156A2ef69ffdDC55838176C6712C90f60a2285' owner: '0x4D156A2ef69ffdDC55838176C6712C90f60a2285'
} }

View File

@ -2,10 +2,6 @@ import '@testing-library/jest-dom/extend-expect'
import * as Gatsby from 'gatsby' import * as Gatsby from 'gatsby'
import siteMetadata from './__fixtures__/siteMetadata.json' import siteMetadata from './__fixtures__/siteMetadata.json'
if (typeof window.IntersectionObserver === 'undefined') {
import('intersection-observer')
}
import('./__mocks__/matchMedia') import('./__mocks__/matchMedia')
const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery') const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery')

View File

@ -1,14 +1,14 @@
import initStoryshots from '@storybook/addon-storyshots' // import initStoryshots from '@storybook/addon-storyshots'
import { render, wait } from '@testing-library/react' // import { render, wait } from '@testing-library/react'
// Stories are render-tested with @testing-library/react, // // Stories are render-tested with @testing-library/react,
// overwriting default snapshot testing behavior // // overwriting default snapshot testing behavior
initStoryshots({ // initStoryshots({
asyncJest: true, // asyncJest: true,
test: async ({ story, done }) => { // test: async ({ story, done }) => {
const storyElement = story.render() // const storyElement = story.render()
// render the story with @testing-library/react // // render the story with @testing-library/react
render(storyElement) // render(storyElement)
await wait(() => done()) // await wait(() => done())
} // }
}) // })