1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-26 03:06:49 +02:00

check ddo provider for algo list in start compute

This commit is contained in:
Bogdan Fazakas 2021-04-14 20:11:29 +03:00
parent ea2f03d8cd
commit 1beb33d3e1
2 changed files with 12 additions and 1 deletions

View File

@ -195,7 +195,9 @@ export default function Compute({
source.token
)
setDdoAlgorithmList(gueryResults.results)
const datasetComputeService = ddo.findServiceByType('compute')
algorithmSelectionList = await transformDDOToAssetSelection(
datasetComputeService.serviceEndpoint,
gueryResults.results,
config.metadataCacheUri,
[]

View File

@ -107,6 +107,7 @@ export async function getAssetsNames(
}
export async function transformDDOToAssetSelection(
datasetProviderEndpoint: string,
ddoList: DDO[],
metadataCacheUri: string,
selectedAlgorithms?: PublisherTrustedAlgorithm[]
@ -115,14 +116,22 @@ export async function transformDDOToAssetSelection(
const didList: string[] = []
const priceList: PriceList = await getAssetPrices(ddoList)
const symbolList: any = {}
const didProviderEndpointMap: any = {}
for (const ddo of ddoList) {
didList.push(ddo.id)
symbolList[ddo.id] = ddo.dataTokenInfo.symbol
const algoComputeService = ddo.findServiceByType('compute')
algoComputeService?.serviceEndpoint &&
(didProviderEndpointMap[ddo.id] = algoComputeService?.serviceEndpoint)
}
const ddoNames = await getAssetsNames(didList, metadataCacheUri, source.token)
const algorithmList: AssetSelectionAsset[] = []
didList?.forEach((did: string) => {
if (priceList[did]) {
if (
priceList[did] &&
(!didProviderEndpointMap[did] ||
didProviderEndpointMap[did] === datasetProviderEndpoint)
) {
let selected = false
selectedAlgorithms?.forEach((algorithm: PublisherTrustedAlgorithm) => {
if (algorithm.did === did) {