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:
commit
fc6f611ac0
14
.eslintrc
14
.eslintrc
@ -1,11 +1,12 @@
|
||||
{
|
||||
"parser": "babel-eslint",
|
||||
"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": {
|
||||
"react": {
|
||||
"version": "detect"
|
||||
}
|
||||
"react": { "version": "detect" }
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
@ -20,9 +21,6 @@
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:prettier/recommended",
|
||||
"prettier/react",
|
||||
"prettier/standard",
|
||||
"prettier/@typescript-eslint",
|
||||
"plugin:react-hooks/recommended"
|
||||
],
|
||||
"plugins": ["@typescript-eslint", "prettier"],
|
||||
|
@ -38,6 +38,9 @@ To start local development:
|
||||
git clone git@github.com:oceanprotocol/market.git
|
||||
cd market
|
||||
|
||||
# when using nvm to manage Node.js versions
|
||||
nvm use
|
||||
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
@ -2,8 +2,7 @@ module.exports = {
|
||||
client: {
|
||||
service: {
|
||||
name: 'ocean',
|
||||
url:
|
||||
'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
|
||||
url: 'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
|
||||
// optional disable SSL validation check
|
||||
skipSSLValidation: true
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ exports.onCreatePage = async ({ page, actions }) => {
|
||||
exports.onCreateWebpackConfig = ({ actions }) => {
|
||||
actions.setWebpackConfig({
|
||||
node: {
|
||||
// 'fs' fix for squid.js
|
||||
// 'fs' fix for ocean.js
|
||||
fs: 'empty'
|
||||
},
|
||||
// fix for 'got'/'swarm-js' dependency
|
||||
|
63807
package-lock.json
generated
63807
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
126
package.json
126
package.json
@ -23,122 +23,112 @@
|
||||
"postinstall": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.3.11",
|
||||
"@apollo/client": "^3.3.19",
|
||||
"@coingecko/cryptoformat": "^0.4.2",
|
||||
"@loadable/component": "^5.14.1",
|
||||
"@loadable/component": "^5.15.0",
|
||||
"@oceanprotocol/art": "^3.0.0",
|
||||
"@oceanprotocol/lib": "^0.14.8",
|
||||
"@oceanprotocol/lib": "^0.15.1",
|
||||
"@oceanprotocol/typographies": "^0.1.0",
|
||||
"@portis/web3": "^3.0.3",
|
||||
"@sindresorhus/slugify": "^1.0.0",
|
||||
"@tippyjs/react": "^4.2.0",
|
||||
"@types/classnames": "^2.2.11",
|
||||
"@vercel/node": "^1.8.5",
|
||||
"@walletconnect/web3-provider": "^1.3.4",
|
||||
"@portis/web3": "^4.0.4",
|
||||
"@sindresorhus/slugify": "^2.1.0",
|
||||
"@tippyjs/react": "^4.2.5",
|
||||
"@walletconnect/web3-provider": "^1.4.1",
|
||||
"axios": "^0.21.1",
|
||||
"chart.js": "^2.9.4",
|
||||
"classnames": "^2.2.6",
|
||||
"cross-fetch": "^3.0.6",
|
||||
"date-fns": "^2.16.1",
|
||||
"classnames": "^2.3.1",
|
||||
"cross-fetch": "^3.1.4",
|
||||
"date-fns": "^2.22.1",
|
||||
"decimal.js": "^10.2.1",
|
||||
"dom-confetti": "^0.2.2",
|
||||
"dotenv": "^8.2.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"ethereum-address": "0.0.4",
|
||||
"ethereum-blockies": "github:MyEtherWallet/blockies",
|
||||
"filesize": "^6.1.0",
|
||||
"formik": "^2.2.6",
|
||||
"gatsby": "^2.30.2",
|
||||
"filesize": "^6.3.0",
|
||||
"formik": "^2.2.9",
|
||||
"gatsby": "^2.32.13",
|
||||
"gatsby-image": "^2.9.0",
|
||||
"gatsby-plugin-manifest": "^2.10.0",
|
||||
"gatsby-plugin-react-helmet": "^3.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-use-dark-mode": "^1.2.0",
|
||||
"gatsby-plugin-webpack-size": "^1.0.0",
|
||||
"gatsby-plugin-use-dark-mode": "^1.3.0",
|
||||
"gatsby-plugin-webpack-size": "^2.0.1",
|
||||
"gatsby-source-filesystem": "^2.9.0",
|
||||
"gatsby-source-graphql": "^2.12.0",
|
||||
"gatsby-transformer-json": "^2.9.0",
|
||||
"gatsby-transformer-remark": "^2.14.0",
|
||||
"gatsby-transformer-sharp": "^2.10.1",
|
||||
"intersection-observer": "^0.12.0",
|
||||
"is-url-superb": "^5.0.0",
|
||||
"gatsby-transformer-remark": "^2.16.1",
|
||||
"gatsby-transformer-sharp": "^2.12.1",
|
||||
"graphql": "14.7.0",
|
||||
"is-url-superb": "^6.0.0",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.omit": "^4.5.0",
|
||||
"query-string": "^6.13.8",
|
||||
"react": "^17.0.1",
|
||||
"react-chartjs-2": "^2.11.1",
|
||||
"react-data-table-component": "^6.11.6",
|
||||
"react-dom": "^17.0.1",
|
||||
"query-string": "^7.0.0",
|
||||
"react": "^17.0.2",
|
||||
"react-chartjs-2": "^2.11.2",
|
||||
"react-data-table-component": "^6.11.7",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-dotdotdot": "^1.3.1",
|
||||
"react-dropzone": "^11.2.4",
|
||||
"react-helmet": "^6.1.0",
|
||||
"react-intersection-observer": "^8.31.0",
|
||||
"react-markdown": "^5.0.3",
|
||||
"react-modal": "^3.12.1",
|
||||
"react-paginate": "^7.0.0",
|
||||
"react-spring": "^8.0.27",
|
||||
"react-tabs": "^3.1.2",
|
||||
"react-toastify": "^6.2.0",
|
||||
"react-markdown": "^6.0.2",
|
||||
"react-modal": "^3.14.2",
|
||||
"react-paginate": "^7.1.3",
|
||||
"react-spring": "^9.2.1",
|
||||
"react-tabs": "^3.2.2",
|
||||
"react-toastify": "^7.0.4",
|
||||
"remove-markdown": "^0.3.0",
|
||||
"shortid": "^2.2.16",
|
||||
"slugify": "^1.4.6",
|
||||
"swr": "^0.3.11",
|
||||
"slugify": "^1.5.3",
|
||||
"swr": "^0.5.6",
|
||||
"use-dark-mode": "^2.3.1",
|
||||
"web3": "^1.3.4",
|
||||
"web3": "^1.3.6",
|
||||
"web3modal": "^1.9.3",
|
||||
"yup": "^0.32.6"
|
||||
"yup": "^0.32.9"
|
||||
},
|
||||
"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",
|
||||
"@testing-library/jest-dom": "^5.11.9",
|
||||
"@testing-library/react": "^11.2.3",
|
||||
"@types/chart.js": "^2.9.29",
|
||||
"@types/jest": "^26.0.20",
|
||||
"@testing-library/jest-dom": "^5.12.0",
|
||||
"@testing-library/react": "^11.2.7",
|
||||
"@types/chart.js": "^2.9.32",
|
||||
"@types/classnames": "^2.3.1",
|
||||
"@types/jest": "^26.0.23",
|
||||
"@types/loadable__component": "^5.13.1",
|
||||
"@types/lodash.debounce": "^4.0.3",
|
||||
"@types/lodash.omit": "^4.5.6",
|
||||
"@types/node": "^14.14.20",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-helmet": "^6.1.0",
|
||||
"@types/react-modal": "^3.10.6",
|
||||
"@types/react-paginate": "^6.2.1",
|
||||
"@types/node": "^15.6.1",
|
||||
"@types/react": "^17.0.8",
|
||||
"@types/react-helmet": "^6.1.1",
|
||||
"@types/react-modal": "^3.12.0",
|
||||
"@types/react-paginate": "^7.1.0",
|
||||
"@types/react-tabs": "^2.3.2",
|
||||
"@types/remove-markdown": "^0.1.1",
|
||||
"@types/remove-markdown": "^0.3.0",
|
||||
"@types/shortid": "0.0.29",
|
||||
"@types/yup": "^0.29.11",
|
||||
"@typescript-eslint/eslint-plugin": "^4.13.0",
|
||||
"@typescript-eslint/parser": "^4.13.0",
|
||||
"apollo": "^2.32.1",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-preset-react-app": "^10.0.0",
|
||||
"eslint": "^7.17.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.26.0",
|
||||
"@typescript-eslint/parser": "^4.26.0",
|
||||
"apollo": "^2.33.4",
|
||||
"eslint": "^7.27.0",
|
||||
"eslint-config-oceanprotocol": "^1.5.0",
|
||||
"eslint-config-prettier": "^7.1.0",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-react": "^7.22.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"eslint-plugin-react": "^7.24.0",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"husky": "^5.0.8",
|
||||
"husky": "^6.0.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^26.6.3",
|
||||
"prettier": "^2.2.1",
|
||||
"prettier": "^2.3.0",
|
||||
"pretty-quick": "^3.1.0",
|
||||
"serve": "^11.3.2",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"typescript": "^4.1.3"
|
||||
"typescript": "^4.3.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/oceanprotocol/market"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=14"
|
||||
},
|
||||
"browserslist": [
|
||||
">0.2%",
|
||||
|
2
src/@types/node_modules.d.ts
vendored
2
src/@types/node_modules.d.ts
vendored
@ -1,5 +1,3 @@
|
||||
declare module 'intersection-observer'
|
||||
|
||||
declare module 'ethereum-blockies' {
|
||||
export function toDataUrl(address: string): string
|
||||
}
|
||||
|
@ -1,57 +1,57 @@
|
||||
import React from 'react'
|
||||
import { action } from '@storybook/addon-actions'
|
||||
import Button from './Button'
|
||||
// import React from 'react'
|
||||
// // import { action } from '@storybook/addon-actions'
|
||||
// import Button from './Button'
|
||||
|
||||
export default {
|
||||
title: 'Atoms/Button'
|
||||
}
|
||||
// export default {
|
||||
// title: 'Atoms/Button'
|
||||
// }
|
||||
|
||||
export const Default = () => (
|
||||
<>
|
||||
<Button onClick={action('clicked')}>Hello Button</Button>
|
||||
<br />
|
||||
<br />
|
||||
<Button size="small" onClick={action('clicked')}>
|
||||
Hello Button
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
// export const Default = () => (
|
||||
// <>
|
||||
// <Button onClick={action('clicked')}>Hello Button</Button>
|
||||
// <br />
|
||||
// <br />
|
||||
// <Button size="small" onClick={action('clicked')}>
|
||||
// Hello Button
|
||||
// </Button>
|
||||
// </>
|
||||
// )
|
||||
|
||||
export const Primary = () => (
|
||||
<>
|
||||
<Button style="primary" onClick={action('clicked')}>
|
||||
Hello Button
|
||||
</Button>
|
||||
<br />
|
||||
<br />
|
||||
<Button style="primary" size="small" onClick={action('clicked')}>
|
||||
Hello Button
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
// export const Primary = () => (
|
||||
// <>
|
||||
// <Button style="primary" onClick={action('clicked')}>
|
||||
// Hello Button
|
||||
// </Button>
|
||||
// <br />
|
||||
// <br />
|
||||
// <Button style="primary" size="small" onClick={action('clicked')}>
|
||||
// Hello Button
|
||||
// </Button>
|
||||
// </>
|
||||
// )
|
||||
|
||||
export const Ghost = () => (
|
||||
<>
|
||||
<Button style="ghost" onClick={action('clicked')}>
|
||||
Hello Button
|
||||
</Button>
|
||||
<br />
|
||||
<br />
|
||||
<Button style="ghost" size="small" onClick={action('clicked')}>
|
||||
Hello Button
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
// export const Ghost = () => (
|
||||
// <>
|
||||
// <Button style="ghost" onClick={action('clicked')}>
|
||||
// Hello Button
|
||||
// </Button>
|
||||
// <br />
|
||||
// <br />
|
||||
// <Button style="ghost" size="small" onClick={action('clicked')}>
|
||||
// Hello Button
|
||||
// </Button>
|
||||
// </>
|
||||
// )
|
||||
|
||||
export const Text = () => (
|
||||
<>
|
||||
<Button style="text" onClick={action('clicked')}>
|
||||
Hello Button
|
||||
</Button>
|
||||
<br />
|
||||
<br />
|
||||
<Button style="text" size="small" onClick={action('clicked')}>
|
||||
Hello Button
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
// export const Text = () => (
|
||||
// <>
|
||||
// <Button style="text" onClick={action('clicked')}>
|
||||
// Hello Button
|
||||
// </Button>
|
||||
// <br />
|
||||
// <br />
|
||||
// <Button style="text" size="small" onClick={action('clicked')}>
|
||||
// Hello Button
|
||||
// </Button>
|
||||
// </>
|
||||
// )
|
||||
|
@ -107,7 +107,7 @@ export default function InputElement({
|
||||
case 'assetSelection':
|
||||
return (
|
||||
<AssetSelection
|
||||
assets={(options as unknown) as AssetSelectionAsset[]}
|
||||
assets={options as unknown as AssetSelectionAsset[]}
|
||||
{...field}
|
||||
{...props}
|
||||
/>
|
||||
@ -115,7 +115,7 @@ export default function InputElement({
|
||||
case 'assetSelectionMultiple':
|
||||
return (
|
||||
<AssetSelection
|
||||
assets={(options as unknown) as AssetSelectionAsset[]}
|
||||
assets={options as unknown as AssetSelectionAsset[]}
|
||||
multiple
|
||||
disabled={disabled}
|
||||
{...field}
|
||||
@ -132,7 +132,7 @@ export default function InputElement({
|
||||
return (
|
||||
<BoxSelection
|
||||
name={name}
|
||||
options={(options as unknown) as BoxSelectionOption[]}
|
||||
options={options as unknown as BoxSelectionOption[]}
|
||||
{...field}
|
||||
{...props}
|
||||
/>
|
||||
|
@ -13,10 +13,9 @@ const Markdown = ({
|
||||
// https://github.com/rexxars/react-markdown/issues/105#issuecomment-351585313
|
||||
const textCleaned = text?.replace(/\\n/g, '\n ')
|
||||
return (
|
||||
<ReactMarkdown
|
||||
source={textCleaned}
|
||||
className={`${styles.markdown} ${className}`}
|
||||
/>
|
||||
<ReactMarkdown className={`${styles.markdown} ${className}`}>
|
||||
{textCleaned}
|
||||
</ReactMarkdown>
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -11,13 +11,8 @@ import Web3Feedback from './Feedback'
|
||||
import styles from './Details.module.css'
|
||||
|
||||
export default function Details(): ReactElement {
|
||||
const {
|
||||
web3Provider,
|
||||
web3ProviderInfo,
|
||||
connect,
|
||||
logout,
|
||||
networkData
|
||||
} = useWeb3()
|
||||
const { web3Provider, web3ProviderInfo, connect, logout, networkData } =
|
||||
useWeb3()
|
||||
const { balance, config } = useOcean()
|
||||
const { locale } = useUserPreferences()
|
||||
|
||||
|
@ -82,10 +82,8 @@ export default function FormStartCompute({
|
||||
const data = useStaticQuery(contentQuery)
|
||||
const content = data.content.edges[0].node.childPagesJson
|
||||
|
||||
const {
|
||||
isValid,
|
||||
values
|
||||
}: FormikContextType<{ algorithm: string }> = useFormikContext()
|
||||
const { isValid, values }: FormikContextType<{ algorithm: string }> =
|
||||
useFormikContext()
|
||||
const { price, ddo } = useAsset()
|
||||
const [totalPrice, setTotalPrice] = useState(price?.value)
|
||||
|
||||
|
@ -69,15 +69,12 @@ export default function Compute({
|
||||
const [isPublished, setIsPublished] = useState(false)
|
||||
const [hasPreviousDatasetOrder, setHasPreviousDatasetOrder] = useState(false)
|
||||
const [previousDatasetOrderId, setPreviousDatasetOrderId] = useState<string>()
|
||||
const [hasPreviousAlgorithmOrder, setHasPreviousAlgorithmOrder] = useState(
|
||||
false
|
||||
)
|
||||
const [hasPreviousAlgorithmOrder, setHasPreviousAlgorithmOrder] =
|
||||
useState(false)
|
||||
const [algorithmDTBalance, setalgorithmDTBalance] = useState<string>()
|
||||
const [algorithmPrice, setAlgorithmPrice] = useState<BestPrice>()
|
||||
const [
|
||||
previousAlgorithmOrderId,
|
||||
setPreviousAlgorithmOrderId
|
||||
] = useState<string>()
|
||||
const [previousAlgorithmOrderId, setPreviousAlgorithmOrderId] =
|
||||
useState<string>()
|
||||
const [datasetTimeout, setDatasetTimeout] = useState<string>()
|
||||
const [algorithmTimeout, setAlgorithmTimeout] = useState<string>()
|
||||
|
||||
|
@ -48,12 +48,8 @@ export default function Consume({
|
||||
const [hasPreviousOrder, setHasPreviousOrder] = useState(false)
|
||||
const [previousOrderId, setPreviousOrderId] = useState<string>()
|
||||
const { isInPurgatory, price, type } = useAsset()
|
||||
const {
|
||||
buyDT,
|
||||
pricingStepText,
|
||||
pricingError,
|
||||
pricingIsLoading
|
||||
} = usePricing()
|
||||
const { buyDT, pricingStepText, pricingError, pricingIsLoading } =
|
||||
usePricing()
|
||||
const { consumeStepText, consume, consumeError } = useConsume()
|
||||
const [isDisabled, setIsDisabled] = useState(true)
|
||||
const [hasDatatoken, setHasDatatoken] = useState(false)
|
||||
|
@ -13,10 +13,8 @@ export default function DebugEditCompute({
|
||||
ddo: DDO
|
||||
}): ReactElement {
|
||||
const { ocean } = useOcean()
|
||||
const [
|
||||
formTransformed,
|
||||
setFormTransformed
|
||||
] = useState<ServiceComputePrivacy>()
|
||||
const [formTransformed, setFormTransformed] =
|
||||
useState<ServiceComputePrivacy>()
|
||||
|
||||
useEffect(() => {
|
||||
if (!ocean) return
|
||||
|
@ -29,15 +29,12 @@ export default function FormEditComputeDataset({
|
||||
const { accountId } = useWeb3()
|
||||
const { ocean, config } = useOcean()
|
||||
const { ddo } = useAsset()
|
||||
const {
|
||||
isValid,
|
||||
values
|
||||
}: FormikContextType<ComputePrivacyForm> = useFormikContext()
|
||||
const { isValid, values }: FormikContextType<ComputePrivacyForm> =
|
||||
useFormikContext()
|
||||
const [allAlgorithms, setAllAlgorithms] = useState<AssetSelectionAsset[]>()
|
||||
|
||||
const { publisherTrustedAlgorithms } = ddo?.findServiceByType(
|
||||
'compute'
|
||||
).attributes.main.privacy
|
||||
const { publisherTrustedAlgorithms } =
|
||||
ddo?.findServiceByType('compute').attributes.main.privacy
|
||||
|
||||
async function getAlgorithmList(
|
||||
publisherTrustedAlgorithms: PublisherTrustedAlgorithm[]
|
||||
|
@ -48,11 +48,8 @@ export default function Output({
|
||||
coin: string
|
||||
}): ReactElement {
|
||||
const data = useStaticQuery(contentQuery)
|
||||
const {
|
||||
help,
|
||||
titleIn,
|
||||
titleOut
|
||||
} = data.content.edges[0].node.childContentJson.pool.add.output
|
||||
const { help, titleIn, titleOut } =
|
||||
data.content.edges[0].node.childContentJson.pool.add.output
|
||||
|
||||
// Connect with form
|
||||
const { values }: FormikContextType<FormAddLiquidity> = useFormikContext()
|
||||
|
@ -83,10 +83,8 @@ export default function Pool(): ReactElement {
|
||||
const [totalUserLiquidityInOcean, setTotalUserLiquidityInOcean] = useState(0)
|
||||
const [totalLiquidityInOcean, setTotalLiquidityInOcean] = useState(0)
|
||||
|
||||
const [
|
||||
creatorTotalLiquidityInOcean,
|
||||
setCreatorTotalLiquidityInOcean
|
||||
] = useState(0)
|
||||
const [creatorTotalLiquidityInOcean, setCreatorTotalLiquidityInOcean] =
|
||||
useState(0)
|
||||
const [creatorLiquidity, setCreatorLiquidity] = useState<PoolBalance>()
|
||||
const [creatorPoolTokens, setCreatorPoolTokens] = useState<string>()
|
||||
const [creatorPoolShare, setCreatorPoolShare] = useState<string>()
|
||||
|
@ -9,10 +9,11 @@ export async function getMaxPercentRemove(
|
||||
poolAddress
|
||||
)
|
||||
|
||||
const amountMaxPoolShares = await ocean.pool.getPoolSharesRequiredToRemoveOcean(
|
||||
poolAddress,
|
||||
amountMaxOcean
|
||||
)
|
||||
const amountMaxPoolShares =
|
||||
await ocean.pool.getPoolSharesRequiredToRemoveOcean(
|
||||
poolAddress,
|
||||
amountMaxOcean
|
||||
)
|
||||
|
||||
let amountMaxPercent = `${Math.floor(
|
||||
(Number(amountMaxPoolShares) / Number(poolTokens)) * 100
|
||||
|
@ -6,10 +6,8 @@ import styles from './Slippage.module.css'
|
||||
|
||||
export default function Slippage(): ReactElement {
|
||||
// Connect with form
|
||||
const {
|
||||
setFieldValue,
|
||||
values
|
||||
}: FormikContextType<FormTradeData> = useFormikContext()
|
||||
const { setFieldValue, values }: FormikContextType<FormTradeData> =
|
||||
useFormikContext()
|
||||
|
||||
function handleChange(e: ChangeEvent<HTMLSelectElement>) {
|
||||
setFieldValue('slippage', e.target.value)
|
||||
|
@ -8,8 +8,8 @@ export default function MetaFull(): ReactElement {
|
||||
const { ddo, metadata, isInPurgatory, type } = useAsset()
|
||||
|
||||
function DockerImage() {
|
||||
const algorithmContainer = ddo.findServiceByType('metadata').attributes.main
|
||||
.algorithm.container
|
||||
const algorithmContainer =
|
||||
ddo.findServiceByType('metadata').attributes.main.algorithm.container
|
||||
const { image } = algorithmContainer
|
||||
const { tag } = algorithmContainer
|
||||
return <span>{`${image}:${tag}`}</span>
|
||||
|
@ -25,13 +25,8 @@ export default function FormPricing({
|
||||
|
||||
// Connect with form
|
||||
const { values, setFieldValue, submitForm } = useFormikContext()
|
||||
const {
|
||||
price,
|
||||
oceanAmount,
|
||||
weightOnOcean,
|
||||
weightOnDataToken,
|
||||
type
|
||||
} = values as PriceOptionsMarket
|
||||
const { price, oceanAmount, weightOnOcean, weightOnDataToken, type } =
|
||||
values as PriceOptionsMarket
|
||||
|
||||
// Switch type value upon tab change
|
||||
function handleTabChange(tabName: string) {
|
||||
|
@ -57,12 +57,8 @@ export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
|
||||
const [showPricing, setShowPricing] = useState(false)
|
||||
const [success, setSuccess] = useState<string>()
|
||||
|
||||
const {
|
||||
createPricing,
|
||||
pricingIsLoading,
|
||||
pricingError,
|
||||
pricingStepText
|
||||
} = usePricing()
|
||||
const { createPricing, pricingIsLoading, pricingError, pricingStepText } =
|
||||
usePricing()
|
||||
|
||||
const hasFeedback = pricingIsLoading || typeof success !== 'undefined'
|
||||
|
||||
|
@ -92,9 +92,8 @@ export default function PublishPage({
|
||||
.initialValues as MetadataPublishFormDataset)) ||
|
||||
initialValues
|
||||
)
|
||||
const [publishType, setPublishType] = useState<MetadataMain['type']>(
|
||||
'dataset'
|
||||
)
|
||||
const [publishType, setPublishType] =
|
||||
useState<MetadataMain['type']>('dataset')
|
||||
const hasFeedback = isLoading || error || success
|
||||
|
||||
const emptyAlgoDT = Object.values(algoInitialValues.dataTokenOptions).every(
|
||||
@ -137,7 +136,7 @@ export default function PublishPage({
|
||||
)
|
||||
|
||||
const ddo = await publish(
|
||||
(metadata as unknown) as Metadata,
|
||||
metadata as unknown as Metadata,
|
||||
serviceType,
|
||||
values.dataTokenOptions,
|
||||
timeout
|
||||
@ -186,7 +185,7 @@ export default function PublishPage({
|
||||
Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions)
|
||||
|
||||
const ddo = await publish(
|
||||
(metadata as unknown) as Metadata,
|
||||
metadata as unknown as Metadata,
|
||||
values.algorithmPrivacy === true ? 'compute' : 'access',
|
||||
values.dataTokenOptions,
|
||||
timeout
|
||||
|
@ -47,7 +47,7 @@ button.filter,
|
||||
margin-bottom: calc(var(--spacer) / 6);
|
||||
}
|
||||
|
||||
.showClear:hover{
|
||||
.showClear:hover {
|
||||
display: inline-flex;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
@ -36,8 +36,9 @@ export default function FilterPrice({
|
||||
async function handleSelectedFilter(isSelected: boolean, value: string) {
|
||||
if (isSelected) {
|
||||
if (serviceSelections.length > 1) {
|
||||
const otherValue = serviceFilterItems.find((p) => p.value !== value)
|
||||
.value
|
||||
const otherValue = serviceFilterItems.find(
|
||||
(p) => p.value !== value
|
||||
).value
|
||||
await applyServiceFilter(otherValue)
|
||||
setServiceSelections([otherValue])
|
||||
} else {
|
||||
|
@ -27,7 +27,8 @@ export const FilterByTypeOptions = {
|
||||
Data: 'dataset',
|
||||
Algorithm: 'algorithm'
|
||||
} as const
|
||||
type FilterByTypeOptions = typeof FilterByTypeOptions[keyof typeof FilterByTypeOptions]
|
||||
type FilterByTypeOptions =
|
||||
typeof FilterByTypeOptions[keyof typeof FilterByTypeOptions]
|
||||
|
||||
function addTypeFilterToQuery(sortTerm: string, typeFilter: string): string {
|
||||
sortTerm = typeFilter
|
||||
|
@ -202,13 +202,8 @@ function usePricing(): UsePricing {
|
||||
|
||||
if (!ocean || !accountId || !dtSymbol) return
|
||||
|
||||
const {
|
||||
type,
|
||||
oceanAmount,
|
||||
price,
|
||||
weightOnDataToken,
|
||||
swapFee
|
||||
} = priceOptions
|
||||
const { type, oceanAmount, price, weightOnDataToken, swapFee } =
|
||||
priceOptions
|
||||
|
||||
let { dtAmount } = priceOptions
|
||||
const isPool = type === 'dynamic'
|
||||
|
@ -69,13 +69,14 @@ function usePublish(): UsePublish {
|
||||
switch (serviceType) {
|
||||
case 'access': {
|
||||
if (!timeout) timeout = 0
|
||||
const accessService = await ocean.assets.createAccessServiceAttributes(
|
||||
account,
|
||||
price,
|
||||
publishedDate,
|
||||
timeout,
|
||||
providerUri
|
||||
)
|
||||
const accessService =
|
||||
await ocean.assets.createAccessServiceAttributes(
|
||||
account,
|
||||
price,
|
||||
publishedDate,
|
||||
timeout,
|
||||
providerUri
|
||||
)
|
||||
Logger.log('access service created', accessService)
|
||||
services.push(accessService)
|
||||
break
|
||||
|
@ -2,37 +2,38 @@ import { MetadataPublishFormAlgorithm } from '../@types/MetaData'
|
||||
import { File as FileMetadata } from '@oceanprotocol/lib'
|
||||
import * as Yup from 'yup'
|
||||
|
||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> = Yup.object()
|
||||
.shape({
|
||||
// ---- required fields ----
|
||||
name: Yup.string()
|
||||
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
||||
.required('Required'),
|
||||
description: Yup.string().min(10).required('Required'),
|
||||
files: Yup.array<FileMetadata>().required('Required').nullable(),
|
||||
timeout: Yup.string().required('Required'),
|
||||
dataTokenOptions: Yup.object()
|
||||
.shape({
|
||||
name: Yup.string(),
|
||||
symbol: Yup.string()
|
||||
})
|
||||
.required('Required'),
|
||||
dockerImage: Yup.string()
|
||||
.matches(/node:latest|python:latest|custom image/g, {
|
||||
excludeEmptyString: true
|
||||
})
|
||||
.required('Required'),
|
||||
image: Yup.string().required('Required'),
|
||||
containerTag: Yup.string().required('Required'),
|
||||
entrypoint: Yup.string().required('Required'),
|
||||
author: Yup.string().required('Required'),
|
||||
termsAndConditions: Yup.boolean().required('Required'),
|
||||
// ---- optional fields ----
|
||||
algorithmPrivacy: Yup.boolean().nullable(),
|
||||
tags: Yup.string().nullable(),
|
||||
links: Yup.array<FileMetadata[]>().nullable()
|
||||
})
|
||||
.defined()
|
||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> =
|
||||
Yup.object()
|
||||
.shape({
|
||||
// ---- required fields ----
|
||||
name: Yup.string()
|
||||
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
||||
.required('Required'),
|
||||
description: Yup.string().min(10).required('Required'),
|
||||
files: Yup.array<FileMetadata>().required('Required').nullable(),
|
||||
timeout: Yup.string().required('Required'),
|
||||
dataTokenOptions: Yup.object()
|
||||
.shape({
|
||||
name: Yup.string(),
|
||||
symbol: Yup.string()
|
||||
})
|
||||
.required('Required'),
|
||||
dockerImage: Yup.string()
|
||||
.matches(/node:latest|python:latest|custom image/g, {
|
||||
excludeEmptyString: true
|
||||
})
|
||||
.required('Required'),
|
||||
image: Yup.string().required('Required'),
|
||||
containerTag: Yup.string().required('Required'),
|
||||
entrypoint: Yup.string().required('Required'),
|
||||
author: Yup.string().required('Required'),
|
||||
termsAndConditions: Yup.boolean().required('Required'),
|
||||
// ---- optional fields ----
|
||||
algorithmPrivacy: Yup.boolean().nullable(),
|
||||
tags: Yup.string().nullable(),
|
||||
links: Yup.array<FileMetadata[]>().nullable()
|
||||
})
|
||||
.defined()
|
||||
|
||||
export const initialValues: Partial<MetadataPublishFormAlgorithm> = {
|
||||
name: '',
|
||||
|
@ -6,12 +6,11 @@ export interface ComputePrivacyForm {
|
||||
publisherTrustedAlgorithms: string[]
|
||||
}
|
||||
|
||||
export const validationSchema: Yup.SchemaOf<ComputePrivacyForm> = Yup.object().shape(
|
||||
{
|
||||
export const validationSchema: Yup.SchemaOf<ComputePrivacyForm> =
|
||||
Yup.object().shape({
|
||||
allowAllPublishedAlgorithms: Yup.boolean().nullable(),
|
||||
publisherTrustedAlgorithms: Yup.array().nullable()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
export function getInitialValues(
|
||||
compute: ServiceComputePrivacy
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { PriceOptionsMarket } from '../@types/MetaData'
|
||||
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()
|
||||
.min(1, (param) => `Must be more or equal to ${param.min}`)
|
||||
.required('Required'),
|
||||
@ -22,8 +22,7 @@ export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> = Yup.object().s
|
||||
.max(10, 'Maximum is 10%')
|
||||
.required('Required')
|
||||
.nullable()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
export const initialValues: PriceOptionsMarket = {
|
||||
price: 1,
|
||||
|
@ -2,34 +2,35 @@ import { MetadataPublishFormDataset } from '../@types/MetaData'
|
||||
import { File as FileMetadata } from '@oceanprotocol/lib'
|
||||
import * as Yup from 'yup'
|
||||
|
||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormDataset> = Yup.object()
|
||||
.shape({
|
||||
// ---- required fields ----
|
||||
name: Yup.string()
|
||||
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
||||
.required('Required'),
|
||||
author: Yup.string().required('Required'),
|
||||
dataTokenOptions: Yup.object()
|
||||
.shape({
|
||||
name: Yup.string(),
|
||||
symbol: Yup.string()
|
||||
})
|
||||
.required('Required'),
|
||||
files: Yup.array<FileMetadata>()
|
||||
.required('Enter a valid URL and click "ADD FILE"')
|
||||
.nullable(),
|
||||
description: Yup.string().min(10).required('Required'),
|
||||
timeout: Yup.string().required('Required'),
|
||||
access: Yup.string()
|
||||
.matches(/Compute|Download/g, { excludeEmptyString: true })
|
||||
.required('Required'),
|
||||
termsAndConditions: Yup.boolean().required('Required'),
|
||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormDataset> =
|
||||
Yup.object()
|
||||
.shape({
|
||||
// ---- required fields ----
|
||||
name: Yup.string()
|
||||
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
||||
.required('Required'),
|
||||
author: Yup.string().required('Required'),
|
||||
dataTokenOptions: Yup.object()
|
||||
.shape({
|
||||
name: Yup.string(),
|
||||
symbol: Yup.string()
|
||||
})
|
||||
.required('Required'),
|
||||
files: Yup.array<FileMetadata>()
|
||||
.required('Enter a valid URL and click "ADD FILE"')
|
||||
.nullable(),
|
||||
description: Yup.string().min(10).required('Required'),
|
||||
timeout: Yup.string().required('Required'),
|
||||
access: Yup.string()
|
||||
.matches(/Compute|Download/g, { excludeEmptyString: true })
|
||||
.required('Required'),
|
||||
termsAndConditions: Yup.boolean().required('Required'),
|
||||
|
||||
// ---- optional fields ----
|
||||
tags: Yup.string().nullable(),
|
||||
links: Yup.array<FileMetadata[]>().nullable()
|
||||
})
|
||||
.defined()
|
||||
// ---- optional fields ----
|
||||
tags: Yup.string().nullable(),
|
||||
links: Yup.array<FileMetadata[]>().nullable()
|
||||
})
|
||||
.defined()
|
||||
|
||||
export const initialValues: Partial<MetadataPublishFormDataset> = {
|
||||
name: '',
|
||||
|
@ -6,11 +6,8 @@ import { Helmet } from 'react-helmet'
|
||||
import Button from '../components/atoms/Button'
|
||||
|
||||
export default function PageGatsby404(props: PageProps): ReactElement {
|
||||
const {
|
||||
title,
|
||||
description,
|
||||
actions
|
||||
} = (props.data as any).content.edges[0].node.childPagesJson
|
||||
const { title, description, actions } = (props.data as any).content.edges[0]
|
||||
.node.childPagesJson
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -122,7 +122,7 @@ function AssetProvider({
|
||||
|
||||
// Get metadata from DDO
|
||||
const { attributes } = ddo.findServiceByType('metadata')
|
||||
setMetadata((attributes as unknown) as MetadataMarket)
|
||||
setMetadata(attributes as unknown as MetadataMarket)
|
||||
setTitle(attributes?.main.name)
|
||||
setType(attributes.main.type)
|
||||
setOwner(ddo.publicKey[0].owner)
|
||||
|
@ -51,9 +51,8 @@ function OceanProvider({
|
||||
eth: undefined,
|
||||
ocean: undefined
|
||||
})
|
||||
const [config, setConfig] = useState<ConfigHelperConfig | Config>(
|
||||
initialConfig
|
||||
)
|
||||
const [config, setConfig] =
|
||||
useState<ConfigHelperConfig | Config>(initialConfig)
|
||||
const [loading, setLoading] = useState<boolean>()
|
||||
|
||||
// -----------------------------------
|
||||
|
@ -13,9 +13,10 @@ export async function createTrustedAlgorithmList(
|
||||
const trustedAlgorithms = []
|
||||
|
||||
for (const selectedAlgorithm of selectedAlgorithms) {
|
||||
const trustedAlgorithm = await ocean.compute.createPublisherTrustedAlgorithmfromDID(
|
||||
selectedAlgorithm
|
||||
)
|
||||
const trustedAlgorithm =
|
||||
await ocean.compute.createPublisherTrustedAlgorithmfromDID(
|
||||
selectedAlgorithm
|
||||
)
|
||||
trustedAlgorithms.push(trustedAlgorithm)
|
||||
}
|
||||
return trustedAlgorithms
|
||||
|
@ -28,9 +28,9 @@ export const computeFeedback: { [key in number]: string } = {
|
||||
2: '3/3 Access granted. Starting job...'
|
||||
}
|
||||
|
||||
export function getCreatePricingPoolFeedback(
|
||||
dtSymbol: string
|
||||
): { [key: number]: string } {
|
||||
export function getCreatePricingPoolFeedback(dtSymbol: string): {
|
||||
[key: number]: string
|
||||
} {
|
||||
return {
|
||||
99: `Minting ${dtSymbol} ...`,
|
||||
0: 'Creating pool ...',
|
||||
@ -41,9 +41,9 @@ export function getCreatePricingPoolFeedback(
|
||||
}
|
||||
}
|
||||
|
||||
export function getCreatePricingExchangeFeedback(
|
||||
dtSymbol: string
|
||||
): { [key: number]: string } {
|
||||
export function getCreatePricingExchangeFeedback(dtSymbol: string): {
|
||||
[key: number]: string
|
||||
} {
|
||||
return {
|
||||
99: `Minting ${dtSymbol} ...`,
|
||||
0: 'Creating exchange ...',
|
||||
|
@ -127,10 +127,8 @@ export async function getPreviousOrders(
|
||||
id: id,
|
||||
account: account
|
||||
}
|
||||
const fetchedPreviousOrders: ApolloQueryResult<AssetPreviousOrder> = await fetchData(
|
||||
PreviousOrderQuery,
|
||||
variables
|
||||
)
|
||||
const fetchedPreviousOrders: ApolloQueryResult<AssetPreviousOrder> =
|
||||
await fetchData(PreviousOrderQuery, variables)
|
||||
if (fetchedPreviousOrders.data?.tokenOrders?.length === 0) return null
|
||||
if (assetTimeout === '0') {
|
||||
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
|
||||
|
@ -5,8 +5,7 @@ const ddo: Partial<DDO> = {
|
||||
id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
||||
publicKey: [
|
||||
{
|
||||
id:
|
||||
'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
||||
id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
||||
type: 'EthereumECDSAKey',
|
||||
owner: '0x4D156A2ef69ffdDC55838176C6712C90f60a2285'
|
||||
}
|
||||
|
@ -2,10 +2,6 @@ import '@testing-library/jest-dom/extend-expect'
|
||||
import * as Gatsby from 'gatsby'
|
||||
import siteMetadata from './__fixtures__/siteMetadata.json'
|
||||
|
||||
if (typeof window.IntersectionObserver === 'undefined') {
|
||||
import('intersection-observer')
|
||||
}
|
||||
|
||||
import('./__mocks__/matchMedia')
|
||||
|
||||
const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery')
|
||||
|
@ -1,14 +1,14 @@
|
||||
import initStoryshots from '@storybook/addon-storyshots'
|
||||
import { render, wait } from '@testing-library/react'
|
||||
// import initStoryshots from '@storybook/addon-storyshots'
|
||||
// import { render, wait } from '@testing-library/react'
|
||||
|
||||
// Stories are render-tested with @testing-library/react,
|
||||
// overwriting default snapshot testing behavior
|
||||
initStoryshots({
|
||||
asyncJest: true,
|
||||
test: async ({ story, done }) => {
|
||||
const storyElement = story.render()
|
||||
// render the story with @testing-library/react
|
||||
render(storyElement)
|
||||
await wait(() => done())
|
||||
}
|
||||
})
|
||||
// // Stories are render-tested with @testing-library/react,
|
||||
// // overwriting default snapshot testing behavior
|
||||
// initStoryshots({
|
||||
// asyncJest: true,
|
||||
// test: async ({ story, done }) => {
|
||||
// const storyElement = story.render()
|
||||
// // render the story with @testing-library/react
|
||||
// render(storyElement)
|
||||
// await wait(() => done())
|
||||
// }
|
||||
// })
|
||||
|
Loading…
Reference in New Issue
Block a user