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

Fix infinite loading on file info (#1977)

* error handling updates

* use ocean.js pre release 3.1.3-next.1

* bump oceanlib
This commit is contained in:
Bogdan Fazakas 2023-10-18 16:53:33 +03:00 committed by GitHub
parent 0c5a29d654
commit d613f19804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 116 additions and 31 deletions

101
package-lock.json generated
View File

@ -15,7 +15,7 @@
"@coingecko/cryptoformat": "^0.5.4", "@coingecko/cryptoformat": "^0.5.4",
"@loadable/component": "^5.15.2", "@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0", "@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^3.0.4", "@oceanprotocol/lib": "^3.1.3",
"@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/typographies": "^0.1.0",
"@oceanprotocol/use-dark-mode": "^2.4.3", "@oceanprotocol/use-dark-mode": "^2.4.3",
"@orbisclub/orbis-sdk": "^0.4.40", "@orbisclub/orbis-sdk": "^0.4.40",
@ -6077,12 +6077,12 @@
"integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw==" "integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw=="
}, },
"node_modules/@oceanprotocol/lib": { "node_modules/@oceanprotocol/lib": {
"version": "3.0.4", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.0.4.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.3.tgz",
"integrity": "sha512-HG187KtiT6LV8N5RbupcdKMR+6qsYLEmf43H5gnrIjDflachSayc1R629M7FPC29M8RMgqhfCwKLJJN64U+pmw==", "integrity": "sha512-A7LStVhJILhDlaxMQM71cLco3+tyrE6croPG4UTX58lSb7IRuikOgWq0uH78p3sC4si1RBXVsfLprcx0HiZ9Gg==",
"dependencies": { "dependencies": {
"@oceanprotocol/contracts": "^1.1.14", "@oceanprotocol/contracts": "^1.1.14",
"cross-fetch": "^3.1.5", "cross-fetch": "^4.0.0",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"decimal.js": "^10.4.1", "decimal.js": "^10.4.1",
"ethers": "^5.7.2" "ethers": "^5.7.2"
@ -6091,6 +6091,52 @@
"web3": "^1.8.0" "web3": "^1.8.0"
} }
}, },
"node_modules/@oceanprotocol/lib/node_modules/cross-fetch": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",
"integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==",
"dependencies": {
"node-fetch": "^2.6.12"
}
},
"node_modules/@oceanprotocol/lib/node_modules/node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/@oceanprotocol/lib/node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"node_modules/@oceanprotocol/lib/node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"node_modules/@oceanprotocol/lib/node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/@oceanprotocol/typographies": { "node_modules/@oceanprotocol/typographies": {
"version": "0.1.0", "version": "0.1.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/typographies/-/typographies-0.1.0.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/typographies/-/typographies-0.1.0.tgz",
@ -58441,15 +58487,52 @@
"integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw==" "integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw=="
}, },
"@oceanprotocol/lib": { "@oceanprotocol/lib": {
"version": "3.0.4", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.0.4.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.3.tgz",
"integrity": "sha512-HG187KtiT6LV8N5RbupcdKMR+6qsYLEmf43H5gnrIjDflachSayc1R629M7FPC29M8RMgqhfCwKLJJN64U+pmw==", "integrity": "sha512-A7LStVhJILhDlaxMQM71cLco3+tyrE6croPG4UTX58lSb7IRuikOgWq0uH78p3sC4si1RBXVsfLprcx0HiZ9Gg==",
"requires": { "requires": {
"@oceanprotocol/contracts": "^1.1.14", "@oceanprotocol/contracts": "^1.1.14",
"cross-fetch": "^3.1.5", "cross-fetch": "^4.0.0",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"decimal.js": "^10.4.1", "decimal.js": "^10.4.1",
"ethers": "^5.7.2" "ethers": "^5.7.2"
},
"dependencies": {
"cross-fetch": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",
"integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==",
"requires": {
"node-fetch": "^2.6.12"
}
},
"node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"requires": {
"whatwg-url": "^5.0.0"
}
},
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"requires": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
}
} }
}, },
"@oceanprotocol/typographies": { "@oceanprotocol/typographies": {

View File

@ -30,7 +30,7 @@
"@coingecko/cryptoformat": "^0.5.4", "@coingecko/cryptoformat": "^0.5.4",
"@loadable/component": "^5.15.2", "@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0", "@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^3.0.4", "@oceanprotocol/lib": "^3.1.3",
"@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/typographies": "^0.1.0",
"@oceanprotocol/use-dark-mode": "^2.4.3", "@oceanprotocol/use-dark-mode": "^2.4.3",
"@orbisclub/orbis-sdk": "^0.4.40", "@orbisclub/orbis-sdk": "^0.4.40",

View File

@ -193,7 +193,7 @@ export async function getOrderPriceAndFees(
customProviderUrl || asset?.services[0].serviceEndpoint customProviderUrl || asset?.services[0].serviceEndpoint
)) ))
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Initialize Provider] Error:', message) LoggerInstance.error('[Initialize Provider] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -148,7 +148,7 @@ export async function getComputeEnviroment(
if (!computeEnvs[asset.chainId][0]) return null if (!computeEnvs[asset.chainId][0]) return null
return computeEnvs[asset.chainId][0] return computeEnvs[asset.chainId][0]
} catch (e) { } catch (e) {
const message = getErrorMessage(JSON.parse(e.message)) const message = getErrorMessage(e.message)
LoggerInstance.error( LoggerInstance.error(
'[Compute to Data] Fetch compute environment:', '[Compute to Data] Fetch compute environment:',
message message
@ -261,7 +261,7 @@ async function getJobs(
}) })
} }
} catch (err) { } catch (err) {
const message = getErrorMessage(JSON.parse(err.message)) const message = getErrorMessage(err.message)
LoggerInstance.error('[Compute to Data] Error:', message) LoggerInstance.error('[Compute to Data] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -113,7 +113,7 @@ export async function setNftMetadata(
signal signal
) )
} catch (err) { } catch (err) {
const message = getErrorMessage(JSON.parse(err.message)) const message = getErrorMessage(err.message)
LoggerInstance.error('[Encrypt Data] Error:', message) LoggerInstance.error('[Encrypt Data] Error:', message)
toast.error(message) toast.error(message)
} }
@ -155,7 +155,7 @@ export async function setNFTMetadataAndTokenURI(
signal signal
) )
} catch (err) { } catch (err) {
const message = getErrorMessage(JSON.parse(err.message)) const message = getErrorMessage(err.message)
LoggerInstance.error('[Encrypt Data] Error:', message) LoggerInstance.error('[Encrypt Data] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -40,7 +40,7 @@ async function initializeProvider(
) )
return provider return provider
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.log('[Initialize Provider] Error:', message) LoggerInstance.log('[Initialize Provider] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -57,7 +57,7 @@ export async function initializeProviderForCompute(
accountId accountId
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Initialize Provider] Error:', message) LoggerInstance.error('[Initialize Provider] Error:', message)
toast.error(message) toast.error(message)
return null return null
@ -79,7 +79,7 @@ export async function getEncryptedFiles(
) )
return response return response
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Encrypt] Error:', message) LoggerInstance.error('[Provider Encrypt] Error:', message)
toast.error(message) toast.error(message)
} }
@ -100,9 +100,10 @@ export async function getFileDidInfo(
) )
return response return response
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Initialize check file did] Error:', message) LoggerInstance.error('[Initialize check file did] Error:', message)
toast.error(message) toast.error(`[Initialize check file did] Error: ${message}`)
throw new Error(`[Initialize check file did] Error: ${message}`)
} }
} }
@ -137,7 +138,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -154,7 +155,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -173,7 +174,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -193,7 +194,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -213,7 +214,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -242,7 +243,7 @@ export async function downloadFile(
userCustomParameters userCustomParameters
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get download url] Error:', message) LoggerInstance.error('[Provider Get download url] Error:', message)
toast.error(message) toast.error(message)
} }
@ -256,7 +257,7 @@ export async function checkValidProvider(
const response = await ProviderInstance.isValidProvider(providerUrl) const response = await ProviderInstance.isValidProvider(providerUrl)
return response return response
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Check] Error:', message) LoggerInstance.error('[Provider Check] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -76,7 +76,7 @@ export default function CustomProvider(props: InputProps): ReactElement {
// if all good, add provider to formik state // if all good, add provider to formik state
helpers.setValue({ url: field.value.url, valid: isValid, custom: true }) helpers.setValue({ url: field.value.url, valid: isValid, custom: true })
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
setFieldError(`${field.name}.url`, message) setFieldError(`${field.name}.url`, message)
LoggerInstance.error('[Custom Provider]:', message) LoggerInstance.error('[Custom Provider]:', message)
} finally { } finally {

View File

@ -445,7 +445,7 @@ export default function Compute({
setRefetchJobs(!refetchJobs) setRefetchJobs(!refetchJobs)
initPriceAndFees() initPriceAndFees()
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Compute] Error:', message) LoggerInstance.error('[Compute] Error:', message)
setError(message) setError(message)
setRetry(true) setRetry(true)

View File

@ -95,6 +95,7 @@ export default function AssetActions({
setFileIsLoading(false) setFileIsLoading(false)
} catch (error) { } catch (error) {
setFileIsLoading(false)
LoggerInstance.error(error.message) LoggerInstance.error(error.message)
} }
} }

View File

@ -72,7 +72,7 @@ export default function Results({
) )
await downloadFileBrowser(jobResult) await downloadFileBrowser(jobResult)
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get c2d results url] Error:', message) LoggerInstance.error('[Provider Get c2d results url] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -149,7 +149,7 @@ export default function PublishPage({
newAbortController() newAbortController()
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(JSON.parse(error.message)) const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Encrypt] Error:', message) LoggerInstance.error('[Provider Encrypt] Error:', message)
} }