Skip to content

Commit f7f631a

Browse files
committed
fix: fix
1 parent aa8cbab commit f7f631a

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/commands.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ export class Commands {
372372
const { services: servicesAlgo, metadata: metadataAlgo, version: versionAlgo } = ddoAlgoInstance.getDDOFields();
373373
const algoServiceIdInput = args[8] as string | undefined;
374374
let chosenAlgoServiceId = servicesAlgo[0].id;
375+
let chosenAlgoService = servicesAlgo[0];
375376
if (typeof algoServiceIdInput === 'string' && algoServiceIdInput.trim().length > 0) {
376377
const expectedAlgoServiceId = algoServiceIdInput.trim();
377378
const matchAlgoSvc = servicesAlgo.find((s: any) => s.id === expectedAlgoServiceId);
@@ -383,11 +384,28 @@ export class Commands {
383384
return;
384385
}
385386
chosenAlgoServiceId = expectedAlgoServiceId;
387+
chosenAlgoService = matchAlgoSvc;
388+
}
389+
let algoFilesChecksum: string | undefined;
390+
try {
391+
const algoFileChecks = await ProviderInstance.checkDidFiles(
392+
algoDdo.id,
393+
chosenAlgoServiceId,
394+
chosenAlgoService?.serviceEndpoint || providerURI,
395+
true
396+
);
397+
algoFilesChecksum = algoFileChecks?.[0]?.checksum;
398+
} catch (e) {
399+
console.error("Error checking algorithm files: ", e);
400+
return;
386401
}
387402
const algo: ComputeAlgorithm = {
388403
documentId: algoDdo.id,
389404
serviceId: chosenAlgoServiceId,
390-
meta: metadataAlgo.algorithm,
405+
meta: {
406+
...metadataAlgo.algorithm,
407+
filesChecksum: algoFilesChecksum
408+
} as any,
391409
};
392410

393411
const assetAlgo: {

0 commit comments

Comments
 (0)