mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge branch 'main' into orbis
This commit is contained in:
commit
f2b14f29d2
13557
package-lock.json
generated
13557
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -74,14 +74,14 @@
|
||||
"yup": "^0.32.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@storybook/addon-essentials": "^6.5.13",
|
||||
"@storybook/addon-essentials": "^6.5.15",
|
||||
"@storybook/builder-webpack5": "^6.5.13",
|
||||
"@storybook/manager-webpack5": "^6.5.13",
|
||||
"@storybook/react": "^6.5.13",
|
||||
"@svgr/webpack": "^6.5.1",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@types/jest": "^29.2.3",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/js-cookie": "^3.0.2",
|
||||
"@types/loadable__component": "^5.13.4",
|
||||
"@types/node": "^18.8.5",
|
||||
@ -106,7 +106,7 @@
|
||||
"husky": "^8.0.2",
|
||||
"jest": "^29.3.1",
|
||||
"jest-environment-jsdom": "^29.3.1",
|
||||
"prettier": "^2.8.0",
|
||||
"prettier": "^2.8.1",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"process": "^0.11.10",
|
||||
"serve": "^14.1.2",
|
||||
|
@ -16,6 +16,7 @@ import { getOceanConfig, getDevelopmentConfig } from '@utils/ocean'
|
||||
import { getAccessDetails } from '@utils/accessDetailsAndPricing'
|
||||
import { useIsMounted } from '@hooks/useIsMounted'
|
||||
import { useMarketMetadata } from './MarketMetadata'
|
||||
import { isValidDid } from '@utils/ddo'
|
||||
|
||||
export interface AssetProviderValue {
|
||||
isInPurgatory: boolean
|
||||
@ -63,6 +64,13 @@ function AssetProvider({
|
||||
const fetchAsset = useCallback(
|
||||
async (token?: CancelToken) => {
|
||||
if (!did) return
|
||||
const isDid = isValidDid(did)
|
||||
|
||||
if (!isDid) {
|
||||
setError(`The url is not for a valid DID`)
|
||||
LoggerInstance.error(`[asset] Not a valid DID`)
|
||||
return
|
||||
}
|
||||
|
||||
LoggerInstance.log('[asset] Fetching asset...')
|
||||
setLoading(true)
|
||||
|
@ -1,5 +1,10 @@
|
||||
import { Asset, DDO, Service } from '@oceanprotocol/lib'
|
||||
|
||||
export function isValidDid(did: string): boolean {
|
||||
const regex = /did:op:[A-Za-z0-9]{64}/
|
||||
return regex.test(did)
|
||||
}
|
||||
|
||||
export function getServiceByName(
|
||||
ddo: Asset | DDO,
|
||||
name: 'access' | 'compute'
|
||||
|
Loading…
Reference in New Issue
Block a user