From 00a6d7af63435a9bdf89e397bbb59ed8a34c59cb Mon Sep 17 00:00:00 2001 From: Dimo Dzhurenov Date: Thu, 15 Apr 2021 14:35:29 +0300 Subject: [PATCH 01/32] update the file info UI after URL re-add --- .vscode/launch.json | 15 +++++++++ .../molecules/FormFields/FilesInput/index.tsx | 32 ++++++++++++------- 2 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..c319bb15e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8000", + "webRoot": "${workspaceFolder}" + } + ] +} diff --git a/src/components/molecules/FormFields/FilesInput/index.tsx b/src/components/molecules/FormFields/FilesInput/index.tsx index b99d2a40b..f779b76c5 100644 --- a/src/components/molecules/FormFields/FilesInput/index.tsx +++ b/src/components/molecules/FormFields/FilesInput/index.tsx @@ -15,6 +15,26 @@ export default function FilesInput(props: InputProps): ReactElement { const { config } = useOcean() useEffect(() => { + loadFileInfo() + }, [fileUrl, config.providerUri]) + + async function handleButtonClick(e: React.SyntheticEvent, url: string) { + // hack so the onBlur-triggered validation does not show, + // like when this field is required + helpers.setTouched(false) + + // File example 'https://oceanprotocol.com/tech-whitepaper.pdf' + e.preventDefault() + + // In the case when the user re-add the same URL after it was removed (by accident or intentionally) + if (fileUrl === url) { + loadFileInfo() + } + + setFileUrl(url) + } + + function loadFileInfo() { const source = axios.CancelToken.source() async function validateUrl() { @@ -33,22 +53,12 @@ export default function FilesInput(props: InputProps): ReactElement { setIsLoading(false) } } + fileUrl && validateUrl() return () => { source.cancel() } - }, [fileUrl, config.providerUri]) - - async function handleButtonClick(e: React.SyntheticEvent, url: string) { - // hack so the onBlur-triggered validation does not show, - // like when this field is required - helpers.setTouched(false) - - // File example 'https://oceanprotocol.com/tech-whitepaper.pdf' - e.preventDefault() - - setFileUrl(url) } return ( From f506758bfecc180d7f1c9cb8046a4fd8db328a54 Mon Sep 17 00:00:00 2001 From: Dimo Dzhurenov Date: Thu, 15 Apr 2021 15:07:25 +0300 Subject: [PATCH 02/32] change function position --- .../molecules/FormFields/FilesInput/index.tsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/molecules/FormFields/FilesInput/index.tsx b/src/components/molecules/FormFields/FilesInput/index.tsx index f779b76c5..e4ab3d84c 100644 --- a/src/components/molecules/FormFields/FilesInput/index.tsx +++ b/src/components/molecules/FormFields/FilesInput/index.tsx @@ -14,26 +14,6 @@ export default function FilesInput(props: InputProps): ReactElement { const [fileUrl, setFileUrl] = useState() const { config } = useOcean() - useEffect(() => { - loadFileInfo() - }, [fileUrl, config.providerUri]) - - async function handleButtonClick(e: React.SyntheticEvent, url: string) { - // hack so the onBlur-triggered validation does not show, - // like when this field is required - helpers.setTouched(false) - - // File example 'https://oceanprotocol.com/tech-whitepaper.pdf' - e.preventDefault() - - // In the case when the user re-add the same URL after it was removed (by accident or intentionally) - if (fileUrl === url) { - loadFileInfo() - } - - setFileUrl(url) - } - function loadFileInfo() { const source = axios.CancelToken.source() @@ -61,6 +41,26 @@ export default function FilesInput(props: InputProps): ReactElement { } } + useEffect(() => { + loadFileInfo() + }, [fileUrl, config.providerUri]) + + async function handleButtonClick(e: React.SyntheticEvent, url: string) { + // hack so the onBlur-triggered validation does not show, + // like when this field is required + helpers.setTouched(false) + + // File example 'https://oceanprotocol.com/tech-whitepaper.pdf' + e.preventDefault() + + // In the case when the user re-add the same URL after it was removed (by accident or intentionally) + if (fileUrl === url) { + loadFileInfo() + } + + setFileUrl(url) + } + return ( <> {field?.value && field.value[0] && typeof field.value === 'object' ? ( From 9ecfcda20e1b3d6281776da5d79b4fc0b000ea2c Mon Sep 17 00:00:00 2001 From: Dimo Dzhurenov Date: Thu, 15 Apr 2021 17:33:34 +0300 Subject: [PATCH 03/32] removed launch.json --- .vscode/launch.json | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index c319bb15e..000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "pwa-chrome", - "request": "launch", - "name": "Launch Chrome against localhost", - "url": "http://localhost:8000", - "webRoot": "${workspaceFolder}" - } - ] -} From 16254fd59b057b18b54aa322e4c9075975fe6016 Mon Sep 17 00:00:00 2001 From: Dimo Dzhurenov Date: Thu, 15 Apr 2021 14:35:29 +0300 Subject: [PATCH 04/32] update the file info UI after URL re-add --- .vscode/launch.json | 15 +++++++++ .../molecules/FormFields/FilesInput/index.tsx | 32 ++++++++++++------- 2 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..c319bb15e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8000", + "webRoot": "${workspaceFolder}" + } + ] +} diff --git a/src/components/molecules/FormFields/FilesInput/index.tsx b/src/components/molecules/FormFields/FilesInput/index.tsx index b99d2a40b..f779b76c5 100644 --- a/src/components/molecules/FormFields/FilesInput/index.tsx +++ b/src/components/molecules/FormFields/FilesInput/index.tsx @@ -15,6 +15,26 @@ export default function FilesInput(props: InputProps): ReactElement { const { config } = useOcean() useEffect(() => { + loadFileInfo() + }, [fileUrl, config.providerUri]) + + async function handleButtonClick(e: React.SyntheticEvent, url: string) { + // hack so the onBlur-triggered validation does not show, + // like when this field is required + helpers.setTouched(false) + + // File example 'https://oceanprotocol.com/tech-whitepaper.pdf' + e.preventDefault() + + // In the case when the user re-add the same URL after it was removed (by accident or intentionally) + if (fileUrl === url) { + loadFileInfo() + } + + setFileUrl(url) + } + + function loadFileInfo() { const source = axios.CancelToken.source() async function validateUrl() { @@ -33,22 +53,12 @@ export default function FilesInput(props: InputProps): ReactElement { setIsLoading(false) } } + fileUrl && validateUrl() return () => { source.cancel() } - }, [fileUrl, config.providerUri]) - - async function handleButtonClick(e: React.SyntheticEvent, url: string) { - // hack so the onBlur-triggered validation does not show, - // like when this field is required - helpers.setTouched(false) - - // File example 'https://oceanprotocol.com/tech-whitepaper.pdf' - e.preventDefault() - - setFileUrl(url) } return ( From ab6578e982718b8e1d1cdd8763510ea9f445e859 Mon Sep 17 00:00:00 2001 From: Dimo Dzhurenov Date: Thu, 15 Apr 2021 15:07:25 +0300 Subject: [PATCH 05/32] change function position --- .../molecules/FormFields/FilesInput/index.tsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/molecules/FormFields/FilesInput/index.tsx b/src/components/molecules/FormFields/FilesInput/index.tsx index f779b76c5..e4ab3d84c 100644 --- a/src/components/molecules/FormFields/FilesInput/index.tsx +++ b/src/components/molecules/FormFields/FilesInput/index.tsx @@ -14,26 +14,6 @@ export default function FilesInput(props: InputProps): ReactElement { const [fileUrl, setFileUrl] = useState() const { config } = useOcean() - useEffect(() => { - loadFileInfo() - }, [fileUrl, config.providerUri]) - - async function handleButtonClick(e: React.SyntheticEvent, url: string) { - // hack so the onBlur-triggered validation does not show, - // like when this field is required - helpers.setTouched(false) - - // File example 'https://oceanprotocol.com/tech-whitepaper.pdf' - e.preventDefault() - - // In the case when the user re-add the same URL after it was removed (by accident or intentionally) - if (fileUrl === url) { - loadFileInfo() - } - - setFileUrl(url) - } - function loadFileInfo() { const source = axios.CancelToken.source() @@ -61,6 +41,26 @@ export default function FilesInput(props: InputProps): ReactElement { } } + useEffect(() => { + loadFileInfo() + }, [fileUrl, config.providerUri]) + + async function handleButtonClick(e: React.SyntheticEvent, url: string) { + // hack so the onBlur-triggered validation does not show, + // like when this field is required + helpers.setTouched(false) + + // File example 'https://oceanprotocol.com/tech-whitepaper.pdf' + e.preventDefault() + + // In the case when the user re-add the same URL after it was removed (by accident or intentionally) + if (fileUrl === url) { + loadFileInfo() + } + + setFileUrl(url) + } + return ( <> {field?.value && field.value[0] && typeof field.value === 'object' ? ( From add32088141d8d7296c9b8c64e21388abff43cc0 Mon Sep 17 00:00:00 2001 From: Dimo Dzhurenov Date: Thu, 15 Apr 2021 17:33:34 +0300 Subject: [PATCH 06/32] removed launch.json --- .vscode/launch.json | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index c319bb15e..000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "pwa-chrome", - "request": "launch", - "name": "Launch Chrome against localhost", - "url": "http://localhost:8000", - "webRoot": "${workspaceFolder}" - } - ] -} From 1da7eae35a1bfe24bced84d99089638b772990b5 Mon Sep 17 00:00:00 2001 From: Norbi <37236152+KatunaNorbert@users.noreply.github.com> Date: Fri, 16 Apr 2021 15:26:24 +0300 Subject: [PATCH 07/32] fix (#534) Co-authored-by: Norbi --- src/components/organisms/AssetActions/Pool/Add/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/AssetActions/Pool/Add/index.tsx b/src/components/organisms/AssetActions/Pool/Add/index.tsx index 7af8d4eb6..555f4266f 100644 --- a/src/components/organisms/AssetActions/Pool/Add/index.tsx +++ b/src/components/organisms/AssetActions/Pool/Add/index.tsx @@ -174,7 +174,7 @@ export default function Add({ ) : ( Date: Wed, 21 Apr 2021 16:23:50 +0300 Subject: [PATCH 08/32] Fixing issue with Toast message appearing twice --- src/components/molecules/FormFields/FilesInput/Input.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/FormFields/FilesInput/Input.tsx b/src/components/molecules/FormFields/FilesInput/Input.tsx index 7d4699b60..d676aafee 100644 --- a/src/components/molecules/FormFields/FilesInput/Input.tsx +++ b/src/components/molecules/FormFields/FilesInput/Input.tsx @@ -27,7 +27,7 @@ export default function FileInput({ - {ddo.findServiceByType('compute') && ( + {ddo.findServiceByType('compute') && type === 'dataset' && ( <> | )} + {content.compute.storage} ) } From 52280105759c415c287cf164651ae26530822074 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 28 Apr 2021 20:16:03 +0200 Subject: [PATCH 25/32] temporarily disable custom Docker image check * closes #565 --- src/components/pages/Publish/index.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/pages/Publish/index.tsx b/src/components/pages/Publish/index.tsx index e454268eb..51701a132 100644 --- a/src/components/pages/Publish/index.tsx +++ b/src/components/pages/Publish/index.tsx @@ -173,10 +173,14 @@ export default function PublishPage({ ): Promise { const metadata = transformPublishAlgorithmFormToMetadata(values) const timeout = mapTimeoutStringToSeconds(values.timeout) - const validDockerImage = - values.dockerImage === 'custom image' - ? await validateDockerImage(values.image, values.containerTag) - : true + + // TODO: put back check once #572 is resolved + // https://github.com/oceanprotocol/market/issues/572 + const validDockerImage = true + // const validDockerImage = + // values.dockerImage === 'custom image' + // ? await validateDockerImage(values.image, values.containerTag) + // : true try { if (validDockerImage) { Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions) From 7f5a8e11cc1ad0a1b4b6a83da9070f7919a5a1b6 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 28 Apr 2021 20:20:56 +0200 Subject: [PATCH 26/32] =?UTF-8?q?dataset=20=E2=86=92=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * closes #567 --- src/utils/provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/provider.ts b/src/utils/provider.ts index 88185c470..31889187d 100644 --- a/src/utils/provider.ts +++ b/src/utils/provider.ts @@ -35,7 +35,7 @@ export async function fileinfo( return } else { toast.dismiss() // Remove any existing error message - toast.success('Great! That dataset looks good 🐳', { + toast.success('Great! That file looks good. 🐳', { position: 'bottom-right', autoClose: 5000, hideProgressBar: false, From e3c0fd3d851613ecc2aa390551945c1f574857b9 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 29 Apr 2021 00:26:09 +0200 Subject: [PATCH 27/32] switch visual order of edit compute settings --- content/pages/editComputeDataset.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/pages/editComputeDataset.json b/content/pages/editComputeDataset.json index 17c3c6d50..2a9e4df9c 100644 --- a/content/pages/editComputeDataset.json +++ b/content/pages/editComputeDataset.json @@ -6,13 +6,6 @@ "successAction": "Close", "error": "Updating DDO failed.", "data": [ - { - "name": "allowAllPublishedAlgorithms", - "label": "All Algorithms", - "help": "Allow any published algorithm to run on this data set.", - "type": "checkbox", - "options": ["Allow any published algorithm"] - }, { "name": "publisherTrustedAlgorithms", "label": "Selected Algorithms", @@ -21,6 +14,13 @@ "multiple": true, "options": [], "sortOptions": false + }, + { + "name": "allowAllPublishedAlgorithms", + "label": "All Algorithms", + "help": "Allow any published algorithm to run on this data set.", + "type": "checkbox", + "options": ["Allow any published algorithm"] } ] } From 0a739cbe93cb71ed38d8a7041bb48a56631a1e66 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 29 Apr 2021 15:48:57 +0300 Subject: [PATCH 28/32] Support for Moonbase Alpha (#552) * upgrading to ocean.js 0.14.6 * proper ocean.js update * make all explorer links work * handle new moonbeamalpha config * add moonbase alpha to chain user preferences * more ocean.js v0.14 updates * switch to grid * upgrading ocean.js to 0.14.7 * lock to @oceanprotocol/contracts v0.5.16 Co-authored-by: Matthias Kretschmann --- .env.example | 2 +- package-lock.json | 30 +++++++++---------- package.json | 3 +- .../UserPreferences/Appearance.module.css | 11 ++++--- .../molecules/UserPreferences/Chain.tsx | 7 +++-- .../organisms/AssetActions/Pool/index.tsx | 2 +- .../organisms/AssetContent/MetaMain.tsx | 2 +- src/utils/ocean.ts | 5 +++- 8 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.env.example b/.env.example index d1481767b..cb5c39b35 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ # Default network, possible values: -# "development", "ropsten", "rinkeby", "mainnet", "polygon" +# "development", "ropsten", "rinkeby", "mainnet", "polygon", "moonbeamalpha" GATSBY_NETWORK="rinkeby" #GATSBY_INFURA_PROJECT_ID="xxx" diff --git a/package-lock.json b/package-lock.json index cc1026ce2..f408c5d21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1573,16 +1573,16 @@ } }, "@ethereum-navigator/atlas": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/@ethereum-navigator/atlas/-/atlas-0.7.1.tgz", - "integrity": "sha512-YV7tMVwpRcJbc+Kj/Rr0RzNV/2hHBEEM1/tMWDVLB15dGJfoQuRfPJpFt6uq+Ji6s3EkldIt9kZylEeG5ALKAA==" + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@ethereum-navigator/atlas/-/atlas-0.7.3.tgz", + "integrity": "sha512-kCyV/8wOqSU/gn+H7uSaR/Xc+ZogXrW2QmF5MfZL2+NUS4+y0emlfBphTGwP5bOB0Cg2goJTcI7Y6+0LNcJYzg==" }, "@ethereum-navigator/navigator": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@ethereum-navigator/navigator/-/navigator-0.5.2.tgz", - "integrity": "sha512-agSE2xzLxOKKid8QiS4v8jPhnFXW5uSXsICZ4JmS437aCZ8L3SUAy3cDQKikHb2PPZ3AazJO05k8m8i6u77peQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@ethereum-navigator/navigator/-/navigator-0.5.3.tgz", + "integrity": "sha512-AOhS1EXPrVeWbLvW3fVbw5AZ2mPYXDKOqMojgVz602U/tEjRXAsw/Gwa+oSOssAyU37SNKBaIorEhBiEY+RYdA==", "requires": { - "@ethereum-navigator/atlas": "^0.7.1", + "@ethereum-navigator/atlas": "^0.7.2", "web3": "^1.2.7" } }, @@ -3622,17 +3622,17 @@ "integrity": "sha512-j4PEZSVtKSqxDYMVh/hd5vk088Bg6a6QkrUMTXN9Q6OIFAMfHM235f1AxaakNrEyK0FKMD908KuJEdfFLRn9Hw==" }, "@oceanprotocol/contracts": { - "version": "0.5.15", - "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.5.15.tgz", - "integrity": "sha512-16edzNeO2v5WLW9ClsZ9VvMH1w24fZZutCmDhZWPirCAIdojGWRHraompfICjY1fovDljnZ5MpJpffuQ6kgxOA==" + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.5.16.tgz", + "integrity": "sha512-p7aFIUT8RVoMzdPP7ML8G08BnQ09syywKjOT16hqJm0GmofunEuVffUXbryG4EkQ+qRbf/zeoxSmesi79kQXlA==" }, "@oceanprotocol/lib": { - "version": "0.14.4", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.14.4.tgz", - "integrity": "sha512-f6Wj6FLpYmuFSGtnDw0lex0Vru1tGgvZqtwrdBYtMD+hW6Bn3B51+F/9ACVYAiSRDADrqPTDZiZetT2Ji3QY7Q==", + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.14.7.tgz", + "integrity": "sha512-xnf2XX3VjmsvcNjLi8nwfWryTNT/t/oK+eOttOu5CrOBEm4Ghi98LKT1zX3ZlE4WObUDypaXDIkLuaxCtBVOOg==", "requires": { "@ethereum-navigator/navigator": "^0.5.2", - "@oceanprotocol/contracts": "^0.5.10", + "@oceanprotocol/contracts": "^0.5.16", "@types/crypto-js": "^4.0.1", "cross-fetch": "^3.1.2", "crypto-js": "^4.0.0", @@ -18101,7 +18101,7 @@ } }, "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1ce6a1d64235fabe2aaf827fd606def55693508f", + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1a27c59c15ab1e95ee8e5c4ed6ad814c49cc439e", "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", "requires": { "bn.js": "^4.11.8", diff --git a/package.json b/package.json index 2fb742364..3cc2fcc7a 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "@coingecko/cryptoformat": "^0.4.2", "@loadable/component": "^5.14.1", "@oceanprotocol/art": "^3.0.0", - "@oceanprotocol/lib": "^0.14.4", + "@oceanprotocol/contracts": "0.5.16", + "@oceanprotocol/lib": "^0.14.7", "@oceanprotocol/typographies": "^0.1.0", "@portis/web3": "^3.0.3", "@sindresorhus/slugify": "^1.0.0", diff --git a/src/components/molecules/UserPreferences/Appearance.module.css b/src/components/molecules/UserPreferences/Appearance.module.css index 95f965292..ddfb44ba6 100644 --- a/src/components/molecules/UserPreferences/Appearance.module.css +++ b/src/components/molecules/UserPreferences/Appearance.module.css @@ -1,14 +1,13 @@ .buttons { - display: flex; - justify-content: space-between; + display: grid; + gap: calc(var(--spacer) / 4); + grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr)); padding-bottom: calc(var(--spacer) / 8); } .button { - display: block; - flex: 0 0 48%; - padding: calc(var(--spacer) / 3) calc(var(--spacer) / 2) - calc(var(--spacer) / 4) calc(var(--spacer) / 2) !important; + width: auto; + padding: calc(var(--spacer) / 3) calc(var(--spacer) / 4) !important; border-radius: var(--border-radius); text-transform: none; } diff --git a/src/components/molecules/UserPreferences/Chain.tsx b/src/components/molecules/UserPreferences/Chain.tsx index c32b25d98..6b7780e3b 100644 --- a/src/components/molecules/UserPreferences/Chain.tsx +++ b/src/components/molecules/UserPreferences/Chain.tsx @@ -18,8 +18,9 @@ export default function Chain(): ReactElement { } const chains = [ - { name: 'ETH', oceanConfig: 'mainnet' }, - { name: 'Polygon/Matic', oceanConfig: 'polygon' } + { name: 'ETH', oceanConfig: 'mainnet', label: 'Mainnet' }, + { name: 'Polygon/Matic', oceanConfig: 'polygon', label: 'Mainnet' }, + { name: 'Moonbase Alpha', oceanConfig: 'moonbeamalpha', label: 'Testnet' } ] // TODO: to fully solve https://github.com/oceanprotocol/market/issues/432 @@ -42,7 +43,7 @@ export default function Chain(): ReactElement { onClick={() => connectOcean(button.oceanConfig)} > {button.name} - Mainnet + {button.label} ) })} diff --git a/src/components/organisms/AssetActions/Pool/index.tsx b/src/components/organisms/AssetActions/Pool/index.tsx index 25aa503ff..6619e5d2d 100644 --- a/src/components/organisms/AssetActions/Pool/index.tsx +++ b/src/components/organisms/AssetActions/Pool/index.tsx @@ -252,7 +252,7 @@ export default function Pool(): ReactElement { Date: Tue, 4 May 2021 15:56:47 +0300 Subject: [PATCH 29/32] using BigNumber instead of Number (#570) * using BigNumber instead of Number * remove wrong calculation of ocean ammount Signed-off-by: mihaisc * remove calculateAmountOfOceansRemoved * using decimal.js for remove * bump to ocean.js v0.14.8 Co-authored-by: mihaisc Co-authored-by: Matthias Kretschmann --- package-lock.json | 16 ++++++------- package.json | 3 +-- .../organisms/AssetActions/Pool/Remove.tsx | 24 +++++++++---------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index f408c5d21..b5efdc9a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3627,19 +3627,19 @@ "integrity": "sha512-p7aFIUT8RVoMzdPP7ML8G08BnQ09syywKjOT16hqJm0GmofunEuVffUXbryG4EkQ+qRbf/zeoxSmesi79kQXlA==" }, "@oceanprotocol/lib": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.14.7.tgz", - "integrity": "sha512-xnf2XX3VjmsvcNjLi8nwfWryTNT/t/oK+eOttOu5CrOBEm4Ghi98LKT1zX3ZlE4WObUDypaXDIkLuaxCtBVOOg==", + "version": "0.14.8", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.14.8.tgz", + "integrity": "sha512-eqab5iEgowyIM/LcDDs6xhZo/KToOmVw0betjXLG0+g70zS8R6XL2RHzCpFyutSdf/cH0w/ltPUfR8ZBElIyhQ==", "requires": { "@ethereum-navigator/navigator": "^0.5.2", - "@oceanprotocol/contracts": "^0.5.16", + "@oceanprotocol/contracts": "0.5.16", "@types/crypto-js": "^4.0.1", "cross-fetch": "^3.1.2", "crypto-js": "^4.0.0", "decimal.js": "^10.2.1", "fs": "0.0.1-security", "lzma": "^2.3.2", - "node-abort-controller": "^1.2.0", + "node-abort-controller": "^2.0.0", "save-file": "^2.3.1", "uuid": "^8.3.2", "web3": "^1.3.5", @@ -28882,9 +28882,9 @@ } }, "node-abort-controller": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-1.2.1.tgz", - "integrity": "sha512-79PYeJuj6S9+yOHirR0JBLFOgjB6sQCir10uN6xRx25iD+ZD4ULqgRn3MwWBRaQGB0vEgReJzWwJo42T1R6YbQ==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-2.0.0.tgz", + "integrity": "sha512-L8RfEgjBTHAISTuagw51PprVAqNZoG6KSB6LQ6H1bskMVkFs5E71IyjauLBv3XbuomJlguWF/VnRHdJ1gqiAqA==" }, "node-addon-api": { "version": "2.0.2", diff --git a/package.json b/package.json index 3cc2fcc7a..ac5b5e886 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "@coingecko/cryptoformat": "^0.4.2", "@loadable/component": "^5.14.1", "@oceanprotocol/art": "^3.0.0", - "@oceanprotocol/contracts": "0.5.16", - "@oceanprotocol/lib": "^0.14.7", + "@oceanprotocol/lib": "^0.14.8", "@oceanprotocol/typographies": "^0.1.0", "@portis/web3": "^3.0.3", "@sindresorhus/slugify": "^1.0.0", diff --git a/src/components/organisms/AssetActions/Pool/Remove.tsx b/src/components/organisms/AssetActions/Pool/Remove.tsx index 933efe593..06fe5e732 100644 --- a/src/components/organisms/AssetActions/Pool/Remove.tsx +++ b/src/components/organisms/AssetActions/Pool/Remove.tsx @@ -21,6 +21,7 @@ import UserLiquidity from '../../../atoms/UserLiquidity' import InputElement from '../../../atoms/Input/InputElement' import { useOcean } from '../../../../providers/Ocean' import { useWeb3 } from '../../../../providers/Web3' +import Decimal from 'decimal.js' const contentQuery = graphql` query PoolRemoveQuery { @@ -155,14 +156,6 @@ export default function Remove({ totalPoolTokens ]) - async function calculateAmountOfOceansRemoved(amountPoolShares: string) { - const oceanAmount = await ocean.pool.getOceanRemovedforPoolShares( - poolAddress, - amountPoolShares - ) - setAmountOcean(oceanAmount) - } - useEffect(() => { const minOceanAmount = (Number(amountOcean) * (100 - Number(slippage))) / 100 @@ -177,19 +170,24 @@ export default function Remove({ setAmountPercent(e.target.value) if (!poolTokens) return - const amountPoolShares = (Number(e.target.value) / 100) * Number(poolTokens) + const amountPoolShares = new Decimal(e.target.value) + .dividedBy(100) + .mul(new Decimal(poolTokens)) + .toPrecision(18) // in some cases the returned value contain more than 18 digits which break conversion to wei + setAmountPoolShares(`${amountPoolShares}`) - calculateAmountOfOceansRemoved(`${amountPoolShares}`) } function handleMaxButton(e: ChangeEvent) { e.preventDefault() setAmountPercent(amountMaxPercent) - const amountPoolShares = - (Number(amountMaxPercent) / 100) * Number(poolTokens) + const amountPoolShares = new Decimal(amountMaxPercent) + .dividedBy(100) + .mul(new Decimal(poolTokens)) + .toPrecision(18) + setAmountPoolShares(`${amountPoolShares}`) - calculateAmountOfOceansRemoved(`${amountPoolShares}`) } function handleAdvancedButton(e: FormEvent) { From 6cc268bd3fac39dd6afe25403c7aa964574f5ba8 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 5 May 2021 11:43:09 +0200 Subject: [PATCH 30/32] effect dependency fix (#578) --- src/hooks/useGraphSyncStatus.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hooks/useGraphSyncStatus.ts b/src/hooks/useGraphSyncStatus.ts index a4e151656..acc2036e2 100644 --- a/src/hooks/useGraphSyncStatus.ts +++ b/src/hooks/useGraphSyncStatus.ts @@ -77,6 +77,7 @@ export function useGraphSyncStatus(): UseGraphSyncStatus { // Get and set subgraph block useEffect(() => { if (!config || !config.subgraphUri) return + async function initBlockSubgraph() { setSubgraphLoading(true) const blockGraph = await getBlockSubgraph(config.subgraphUri) @@ -98,7 +99,7 @@ export function useGraphSyncStatus(): UseGraphSyncStatus { return } setIsGraphSynced(true) - }, [blockGraph, blockHead]) + }, [blockGraph, blockHead, web3Loading, subgraphLoading]) return { blockHead, blockGraph, isGraphSynced } } From 96a32242fda3ad2c085f228adaa7f4c1f8fbfb4c Mon Sep 17 00:00:00 2001 From: claudiaHash <49017601+claudiaHash@users.noreply.github.com> Date: Fri, 7 May 2021 10:53:26 +0300 Subject: [PATCH 31/32] hide Web3Feedback for private algorithms (#587) * hide Web3Feedback for private algorithms * correct private algo check * remove redundant check Co-authored-by: claudia.holhos --- src/components/organisms/AssetActions/Compute/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx index 06089e9de..848844239 100644 --- a/src/components/organisms/AssetActions/Compute/index.tsx +++ b/src/components/organisms/AssetActions/Compute/index.tsx @@ -491,7 +491,9 @@ export default function Compute({ action={} /> )} - + {type !== 'algorithm' && ( + + )} ) From f5da6e4b0bd1d901a4dcfef07ee1c31eee48f963 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Mon, 10 May 2021 12:38:24 +0300 Subject: [PATCH 32/32] Issue 560 empty search (#561) * upgrading to ocean.js 0.14.6 * Empty search gives all results * Using ocean.js 13.0 * onBlur empty search when deleting text * making empty search automatic on change * removing console log messages * including the search bar on results page * keeping searchbox visible after an empty search * refactoring If statement --- src/components/molecules/SearchBar.tsx | 22 ++++++++++++++++------ src/pages/search.tsx | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/molecules/SearchBar.tsx b/src/components/molecules/SearchBar.tsx index c3112493d..78e65a95e 100644 --- a/src/components/molecules/SearchBar.tsx +++ b/src/components/molecules/SearchBar.tsx @@ -17,20 +17,30 @@ export default function SearchBar({ filters?: boolean size?: 'small' | 'large' }): ReactElement { - const [value, setValue] = useState(initialValue || '') - - function handleChange(e: ChangeEvent) { - setValue(e.target.value) - } + let [value, setValue] = useState(initialValue || '') async function startSearch(e: FormEvent) { e.preventDefault() - if (value === '') return + if (value === '') value = ' ' const urlEncodedValue = encodeURIComponent(value) const url = await addExistingParamsToUrl(location, 'text') navigate(`${url}&text=${urlEncodedValue}`) } + async function emptySearch() { + const searchParams = new URLSearchParams(window.location.href) + const text = searchParams.get('text') + if (text !== ('' || undefined || null)) { + const url = await addExistingParamsToUrl(location, 'text') + navigate(`${url}&text=%20`) + } + } + + function handleChange(e: ChangeEvent) { + setValue(e.target.value) + e.target.value === '' && emptySearch() + } + return ( diff --git a/src/pages/search.tsx b/src/pages/search.tsx index d6743f445..cd6a5946c 100644 --- a/src/pages/search.tsx +++ b/src/pages/search.tsx @@ -20,7 +20,7 @@ export default function PageGatsbySearch(props: PageProps): ReactElement { ? `Published by ${accountTruncate(owner as string)}` : `${ totalResults !== undefined - ? searchValue + ? searchValue && searchValue !== ' ' ? totalResults === 0 ? 'No results' : totalResults +