mirror of
https://github.com/oceanprotocol/react.git
synced 2024-11-23 02:00:27 +01:00
compute fix
This commit is contained in:
parent
0c1724726c
commit
ca2a0ec0d4
@ -3,6 +3,7 @@ import { DID, MetaDataAlgorithm, Logger } from '@oceanprotocol/squid'
|
||||
import { useOcean } from '../../providers'
|
||||
import { ComputeValue } from './ComputeOptions'
|
||||
import { feedback } from './../../utils'
|
||||
import { LoggerInstance } from '@oceanprotocol/squid/dist/node/utils/Logger'
|
||||
interface UseCompute {
|
||||
compute: (
|
||||
did: DID | string,
|
||||
@ -59,15 +60,13 @@ function useCompute(): UseCompute {
|
||||
owner: accountId,
|
||||
secretStoreUri: config.secretStoreUri
|
||||
}
|
||||
Logger.debug('useCompute computeOutput', computeOutput)
|
||||
|
||||
const agreement = await ocean.compute
|
||||
.order(account, did as string)
|
||||
.next((step: number) => {
|
||||
setComputeStep(step)
|
||||
setComputeStepText(computeFeedback[step])
|
||||
})
|
||||
Logger.debug('useCompute agreement', agreement)
|
||||
|
||||
rawAlgorithmMeta.container = computeContainer
|
||||
rawAlgorithmMeta.rawcode = algorithmRawCode
|
||||
setComputeStep(4)
|
||||
|
@ -65,6 +65,7 @@ function useSearch(): UseSearch {
|
||||
const consumed = await ocean.assets.consumerAssets(accountId)
|
||||
const consumedItems = await Promise.all(
|
||||
consumed.map(async (did) => {
|
||||
try {
|
||||
const ddo = await ocean.assets.resolve(did)
|
||||
if (ddo) {
|
||||
// Since we are getting assets from chain there might be
|
||||
@ -73,6 +74,9 @@ function useSearch(): UseSearch {
|
||||
const { serviceEndpoint } = ddo.findServiceByType('metadata')
|
||||
if (serviceEndpoint?.includes(config.aquariusUri)) return ddo
|
||||
}
|
||||
} catch (err) {
|
||||
Logger.error(err)
|
||||
}
|
||||
})
|
||||
)
|
||||
const filteredConsumedItems = consumedItems.filter(
|
||||
@ -87,12 +91,17 @@ function useSearch(): UseSearch {
|
||||
const computeItems = await Promise.all(
|
||||
jobList.map(async (job) => {
|
||||
if (!job) return
|
||||
try {
|
||||
const { did } = await ocean.keeper.agreementStoreManager.getAgreement(
|
||||
job.agreementId
|
||||
)
|
||||
|
||||
const ddo = await ocean.assets.resolve(did)
|
||||
|
||||
if (
|
||||
did ===
|
||||
'0x0000000000000000000000000000000000000000000000000000000000000000'
|
||||
)
|
||||
return
|
||||
if (ddo) {
|
||||
// Since we are getting assets from chain there might be
|
||||
// assets from other marketplaces. So return only those assets
|
||||
@ -102,10 +111,13 @@ function useSearch(): UseSearch {
|
||||
return { job, ddo }
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
Logger.error(err)
|
||||
}
|
||||
})
|
||||
)
|
||||
const filteredComputeItems = computeItems.filter(
|
||||
(value) => typeof value.ddo !== 'undefined'
|
||||
(value) => value !== undefined && typeof value.ddo !== 'undefined'
|
||||
)
|
||||
return filteredComputeItems
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user