mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
check ddo provider for algo list in start compute
This commit is contained in:
parent
ea2f03d8cd
commit
1beb33d3e1
@ -195,7 +195,9 @@ export default function Compute({
|
|||||||
source.token
|
source.token
|
||||||
)
|
)
|
||||||
setDdoAlgorithmList(gueryResults.results)
|
setDdoAlgorithmList(gueryResults.results)
|
||||||
|
const datasetComputeService = ddo.findServiceByType('compute')
|
||||||
algorithmSelectionList = await transformDDOToAssetSelection(
|
algorithmSelectionList = await transformDDOToAssetSelection(
|
||||||
|
datasetComputeService.serviceEndpoint,
|
||||||
gueryResults.results,
|
gueryResults.results,
|
||||||
config.metadataCacheUri,
|
config.metadataCacheUri,
|
||||||
[]
|
[]
|
||||||
|
@ -107,6 +107,7 @@ export async function getAssetsNames(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function transformDDOToAssetSelection(
|
export async function transformDDOToAssetSelection(
|
||||||
|
datasetProviderEndpoint: string,
|
||||||
ddoList: DDO[],
|
ddoList: DDO[],
|
||||||
metadataCacheUri: string,
|
metadataCacheUri: string,
|
||||||
selectedAlgorithms?: PublisherTrustedAlgorithm[]
|
selectedAlgorithms?: PublisherTrustedAlgorithm[]
|
||||||
@ -115,14 +116,22 @@ export async function transformDDOToAssetSelection(
|
|||||||
const didList: string[] = []
|
const didList: string[] = []
|
||||||
const priceList: PriceList = await getAssetPrices(ddoList)
|
const priceList: PriceList = await getAssetPrices(ddoList)
|
||||||
const symbolList: any = {}
|
const symbolList: any = {}
|
||||||
|
const didProviderEndpointMap: any = {}
|
||||||
for (const ddo of ddoList) {
|
for (const ddo of ddoList) {
|
||||||
didList.push(ddo.id)
|
didList.push(ddo.id)
|
||||||
symbolList[ddo.id] = ddo.dataTokenInfo.symbol
|
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 ddoNames = await getAssetsNames(didList, metadataCacheUri, source.token)
|
||||||
const algorithmList: AssetSelectionAsset[] = []
|
const algorithmList: AssetSelectionAsset[] = []
|
||||||
didList?.forEach((did: string) => {
|
didList?.forEach((did: string) => {
|
||||||
if (priceList[did]) {
|
if (
|
||||||
|
priceList[did] &&
|
||||||
|
(!didProviderEndpointMap[did] ||
|
||||||
|
didProviderEndpointMap[did] === datasetProviderEndpoint)
|
||||||
|
) {
|
||||||
let selected = false
|
let selected = false
|
||||||
selectedAlgorithms?.forEach((algorithm: PublisherTrustedAlgorithm) => {
|
selectedAlgorithms?.forEach((algorithm: PublisherTrustedAlgorithm) => {
|
||||||
if (algorithm.did === did) {
|
if (algorithm.did === did) {
|
||||||
|
Loading…
Reference in New Issue
Block a user