From 31f554c11da1bbb3432ba8cfae4213e5035121ef Mon Sep 17 00:00:00 2001 From: AdriGeorge Date: Thu, 13 Aug 2026 09:47:38 +0300 Subject: [PATCH 1/2] fix: update downalod --- package-lock.json | 39 ++-------- package.json | 2 +- src/commands.ts | 152 ++++++++++++++++++++++++++++++++++---- src/policyServerHelper.ts | 17 ++++- 4 files changed, 161 insertions(+), 49 deletions(-) diff --git a/package-lock.json b/package-lock.json index 13bf7dc6..9a2cb226 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@oasisprotocol/sapphire-paratime": "^1.3.2", "@oceanprotocol/contracts": "^2.5.0", "@oceanprotocol/ddo-js": "^0.3.0", - "@oceanprotocol/lib": "^8.0.6", + "@oceanprotocol/lib": "^8.6.2", "axios": "^1.11.0", "commander": "^13.1.0", "cross-fetch": "^3.1.5", @@ -3185,35 +3185,27 @@ } }, "node_modules/@oceanprotocol/lib": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-8.1.0.tgz", - "integrity": "sha512-LDh7RLrBwBypacAA99+x3+Ti3eKs2FRptE+90S2KnIDqBTOgEoR6iQHjjw47AGm23YBgNF7f0W2vocfhYnfkqA==", + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-8.6.2.tgz", + "integrity": "sha512-xpdNyY7TwtBXP4fyqceEvPXMuKT+qZ2awNWHgXmJlfXaUPKzX8u2BrbOoJcBXUiHF46leMmhh4sEYltAErWsUQ==", "license": "Apache-2.0", "dependencies": { "@oasisprotocol/sapphire-paratime": "^1.3.2", "@oceanprotocol/ddo-js": "^0.3.0", "bignumber.js": "^9.3.1", - "cross-fetch": "^4.0.0", "crypto-js": "^4.1.1", "decimal.js": "^10.4.1", "eciesjs": "^0.4.5", "ethers": "^6.15.0", - "form-data": "^2.3.3", "jsonwebtoken": "^9.0.2" }, + "engines": { + "node": ">=18" + }, "peerDependencies": { "web3": "^1.8.0" } }, - "node_modules/@oceanprotocol/lib/node_modules/cross-fetch": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.1.0.tgz", - "integrity": "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==", - "license": "MIT", - "dependencies": { - "node-fetch": "^2.7.0" - } - }, "node_modules/@rdfjs/data-model": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@rdfjs/data-model/-/data-model-2.1.1.tgz", @@ -8095,23 +8087,6 @@ "node": "*" } }, - "node_modules/form-data": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.5.tgz", - "integrity": "sha512-jqdObeR2rxZZbPSGL+3VckHMYtu+f9//KXBsVny6JSX/pa38Fy+bGjuG8eW/H6USNQWhLi8Num++cU2yOCNz4A==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "es-set-tostringtag": "^2.1.0", - "hasown": "^2.0.2", - "mime-types": "^2.1.35", - "safe-buffer": "^5.2.1" - }, - "engines": { - "node": ">= 0.12" - } - }, "node_modules/form-data-encoder": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", diff --git a/package.json b/package.json index 9fa78750..d6d72f16 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@oasisprotocol/sapphire-paratime": "^1.3.2", "@oceanprotocol/contracts": "^2.5.0", "@oceanprotocol/ddo-js": "^0.3.0", - "@oceanprotocol/lib": "^8.0.6", + "@oceanprotocol/lib": "^8.6.2", "axios": "^1.11.0", "commander": "^13.1.0", "cross-fetch": "^3.1.5", diff --git a/src/commands.ts b/src/commands.ts index abf8a529..a29b5d71 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -29,12 +29,14 @@ import { getTokenDecimals, AccesslistFactory, AccessListContract, + ProviderInitialize, } from "@oceanprotocol/lib"; import { Asset, DDOManager } from '@oceanprotocol/ddo-js'; import { Signer, ethers, getAddress } from "ethers"; import { interactiveFlow } from "./interactiveFlow.js"; import { publishAsset } from "./publishAsset.js"; import chalk from 'chalk'; +import axios from "axios"; import { getPolicyServerOBJ, getPolicyServerOBJs } from "./policyServerHelper.js"; export class Commands { @@ -68,6 +70,93 @@ export class Commands { }); } + private async initializeProvider( + asset: Asset, + serviceId: string, + accountId: string, + providerUrl: string + ): Promise { + if (process.env.SSI_WALLET_API?.trim()) { + const command = { + documentId: asset.id, + serviceId, + consumerAddress: accountId, + policyServer: { + sessionId: "", + successRedirectUri: "", + errorRedirectUri: "", + responseRedirectUri: "", + presentationDefinitionUri: "", + }, + }; + + const initializePs = await ProviderInstance.initializePSVerification( + providerUrl, + command + ); + + if (!initializePs?.success) { + throw new Error( + `Provider initialization failed: ${initializePs?.error || "Policy Server verification failed"}` + ); + } + } + + if (!/^https?:\/\//i.test(providerUrl)) { + return ProviderInstance.initialize( + asset.id, + serviceId, + 0, + accountId, + providerUrl + ); + } + + try { + const endpointsResponse = await axios.get(providerUrl); + const initializeRoute = endpointsResponse.data?.serviceEndpoints?.initialize?.[1]; + if (!initializeRoute) { + throw new Error("Provider initialize endpoint not found"); + } + + const initializeUrl = `${providerUrl.replace(/\/+$/, "")}/${String( + initializeRoute + ).replace(/^\/+/, "")}`; + const response = await axios.get(initializeUrl, { + params: { + documentId: asset.id, + serviceId, + fileIndex: 0, + consumerAddress: accountId, + }, + headers: { "Content-Type": "application/json" }, + }); + + return response.data; + } catch (error: unknown) { + if (axios.isAxiosError(error) && error.response?.data) { + const responseData: unknown = error.response.data; + let message: string; + + if (typeof responseData === "string") { + message = responseData; + } else if (typeof responseData === "object") { + const data = responseData as { error?: unknown; message?: unknown }; + const providerMessage = data.error ?? data.message; + message = + typeof providerMessage === "string" + ? providerMessage + : JSON.stringify(responseData); + } else { + message = String(responseData); + } + + throw new Error(message.replace(/^Error:\s*/i, "")); + } + throw error; + } + } + // commands public async publish(args: string[]) { console.log("start publishing"); @@ -216,26 +305,62 @@ export class Commands { const ddoInstance = DDOManager.getDDOClass(dataDdo); const { services, version } = ddoInstance.getDDOFields(); const serviceId = args[3] ? args[3] : services[0].id; - let policyServer = null - try { - if (version >= '5.0.0') { - policyServer = await getPolicyServerOBJ(dataDdo, serviceId, this.signer, this.oceanNodeUrl); + const service = services.find((item) => item.id === serviceId); + if (!service) { + console.error(`Service ID "${serviceId}" not found in DDO ${did}.`); + return; + } + + let policyServer = null; + + const majorVersion = Number.parseInt(version?.split(".")[0], 10); + if (majorVersion >= 5) { + try { + await this.initializeProvider( + dataDdo, + serviceId, + await this.signer.getAddress(), + service.serviceEndpoint || this.oceanNodeUrl + ); + } catch (error: unknown) { + const message = error instanceof Error ? error.message : String(error); + console.error("Error initializing Provider:", message); + return; + } + + try { + policyServer = await getPolicyServerOBJ( + dataDdo, + serviceId, + this.signer, + this.oceanNodeUrl + ); + } catch (error: unknown) { + const message = error instanceof Error ? error.message : String(error); + console.error("Error getting Policy Server Object:", message); + return; } - } catch (error) { - throw new Error('Error getting Policy Server Object: ' + error.message) } const datatoken = new Datatoken( this.signer, this.config.chainId, this.config ); - const tx = await orderAsset( - dataDdo, - this.signer, - this.config, - datatoken, - this.oceanNodeUrl - ); + let tx; + try { + tx = await orderAsset( + dataDdo, + this.signer, + this.config, + datatoken, + this.oceanNodeUrl + ); + } catch (error: unknown) { + const message = error instanceof Error ? error.message : String(error); + console.error("Error ordering asset:", message); + return; + } + if (!tx) { console.error( @@ -245,7 +370,6 @@ export class Commands { } const orderTx = await tx.wait(); - const downloadResult = await ProviderInstance.getDownloadUrl( dataDdo.id, serviceId, diff --git a/src/policyServerHelper.ts b/src/policyServerHelper.ts index 7127adbc..606a4941 100644 --- a/src/policyServerHelper.ts +++ b/src/policyServerHelper.ts @@ -1,5 +1,5 @@ import { Asset } from "@oceanprotocol/ddo-js" -import { PolicyServerActions, PolicyServerGetPdAction, PolicyServerInitiateAction, PolicyServerInitiateActionData, PolicyServerInitiateComputeActionData, PolicyServerPresentationDefinition, SsiVerifiableCredential, SsiWalletDid, SsiWalletSession } from "./policyServerInterfaces" +import { PolicyServerActions, PolicyServerGetPdAction, PolicyServerInitiateAction, PolicyServerInitiateActionData, PolicyServerInitiateComputeActionData, PolicyServerPresentationDefinition, SsiVerifiableCredential, SsiWalletDid, SsiWalletSession } from "./policyServerInterfaces.js" import axios from "axios" import { Signer } from "ethers" @@ -250,8 +250,15 @@ export async function getPolicyServerOBJ( serviceId: string, signer: Signer, providerUrl: string -): Promise { +): Promise { try { + const statusResponse = await axios.post(`${providerUrl}/directCommand`, { + command: 'status' + }) + if (statusResponse.data?.isPSConfigured !== true) { + return null + } + const accountId = await signer.getAddress() const presentationResult = await requestCredentialPresentation( ddo, @@ -382,6 +389,9 @@ export async function getPolicyServerOBJs( signer, providerUrl ) + if (!result) { + return null + } results.push({ ...result, documentId: ddo.documentId, @@ -400,6 +410,9 @@ export async function getPolicyServerOBJs( signer, providerUrl ) + if (!algoResult) { + return null + } results.push({ ...algoResult, documentId: algo.documentId, From 73fab51b9d99bfe79a4db5c39673b7e92350460e Mon Sep 17 00:00:00 2001 From: AdriGeorge Date: Thu, 13 Aug 2026 10:05:09 +0300 Subject: [PATCH 2/2] fix: lint --- src/commands.ts | 272 ++++++++++++++++++++++++------------------------ 1 file changed, 136 insertions(+), 136 deletions(-) diff --git a/src/commands.ts b/src/commands.ts index 9ed9453e..b21e3924 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -173,15 +173,15 @@ export class Commands { } const encryptDDO = args[2] === "false" ? false : true; try { - const ddoInstance = DDOManager.getDDOClass(asset); - const { indexedMetadata } = ddoInstance.getAssetFields(); - const { services } = ddoInstance.getDDOFields(); + const ddoInstance = DDOManager.getDDOClass(asset); + const { indexedMetadata } = ddoInstance.getAssetFields(); + const { services } = ddoInstance.getDDOFields(); // add some more checks const urlAssetId = await createAssetUtil( - indexedMetadata.nft.name, - indexedMetadata.nft.symbol, + indexedMetadata.nft.name, + indexedMetadata.nft.symbol, this.signer, - (services[0].files as any).files ?? services[0].files, + (services[0].files as any).files ?? services[0].files, asset, this.oceanNodeUrl, this.config, @@ -208,14 +208,14 @@ export class Commands { const encryptDDO = args[2] === "false" ? false : true; // add some more checks try { - const ddoInstance = DDOManager.getDDOClass(algoAsset); - const { indexedMetadata } = ddoInstance.getAssetFields(); - const { services } = ddoInstance.getDDOFields(); + const ddoInstance = DDOManager.getDDOClass(algoAsset); + const { indexedMetadata } = ddoInstance.getAssetFields(); + const { services } = ddoInstance.getDDOFields(); const algoDid = await createAssetUtil( - indexedMetadata.nft.name, - indexedMetadata.nft.symbol, + indexedMetadata.nft.name, + indexedMetadata.nft.symbol, this.signer, - (services[0].files as any).files ?? services[0].files, + (services[0].files as any).files ?? services[0].files, algoAsset, this.oceanNodeUrl, this.config, @@ -283,16 +283,16 @@ export class Commands { if (!resolvedDDO) { console.error( "Error fetching Asset with DID: " + - args[1] + - ". Does this asset exists?" + args[1] + + ". Does this asset exists?" ); } else console.log(util.inspect(resolvedDDO, false, null, true)); } public async download(args: string[]) { - const did = args[1]; + const did = args[1]; const dataDdo = await this.aquarius.waitForIndexer( - did, + did, null, null, this.indexingParams.retryInterval, @@ -300,14 +300,14 @@ export class Commands { ); if (!dataDdo) { console.error( - "Error fetching DDO " + did + ". Does this asset exists?" + "Error fetching DDO " + did + ". Does this asset exists?" ); return; } - const ddoInstance = DDOManager.getDDOClass(dataDdo); - const { services, version } = ddoInstance.getDDOFields(); - const serviceId = args[3] ? args[3] : services[0].id; + const ddoInstance = DDOManager.getDDOClass(dataDdo); + const { services, version } = ddoInstance.getDDOFields(); + const serviceId = args[3] ? args[3] : services[0].id; const service = services.find((item) => item.id === serviceId); if (!service) { console.error(`Service ID "${serviceId}" not found in DDO ${did}.`); @@ -362,23 +362,23 @@ export class Commands { return; } - if (!tx) { console.error( - "Error ordering access for " + did + ". Do you have enough tokens?" + "Error ordering access for " + did + ". Do you have enough tokens?" ); return; } const orderTx = await tx.wait(); + const downloadResult = await ProviderInstance.getDownloadUrl( dataDdo.id, - serviceId, + serviceId, 0, orderTx.hash, this.oceanNodeUrl, - this.signer, - policyServer + this.signer, + policyServer ); try { const destPath = args[2] ? args[2] : "."; @@ -539,20 +539,20 @@ export class Commands { if (!maxJobDuration) { console.error( "Error initializing Provider for the compute job using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because maxJobDuration was not provided." + args[1] + + " and algorithm DID " + + args[2] + + " because maxJobDuration was not provided." ); return; } if (maxJobDuration < 0) { console.error( "Error initializing Provider for the compute job using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because maxJobDuration is less than 0. It should be in seconds." + args[1] + + " and algorithm DID " + + args[2] + + " because maxJobDuration is less than 0. It should be in seconds." ); return; } @@ -564,10 +564,10 @@ export class Commands { if (!paymentToken) { console.error( "Error initializing Provider for the compute job using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because paymentToken was not provided." + args[1] + + " and algorithm DID " + + args[2] + + " because paymentToken was not provided." ); return; } @@ -575,13 +575,13 @@ export class Commands { if (!Object.keys(computeEnv.fees).includes(chainId.toString())) { console.error( "Error starting paid compute using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because chainId is not supported by compute environment. " + - args[3] + - ". Supported chain IDs: " + - computeEnv.fees.keys() + args[1] + + " and algorithm DID " + + args[2] + + " because chainId is not supported by compute environment. " + + args[3] + + ". Supported chain IDs: " + + computeEnv.fees.keys() ); return; } @@ -595,11 +595,11 @@ export class Commands { if (found === false) { console.error( "Error initializing Provider for the compute job using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because paymentToken is not supported by this environment " + - args[3] + args[1] + + " and algorithm DID " + + args[2] + + " because paymentToken is not supported by this environment " + + args[3] ); return; } @@ -607,10 +607,10 @@ export class Commands { if (!resources) { console.error( "Error initializing Provider for the compute job using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because resources for compute were not provided." + args[1] + + " and algorithm DID " + + args[2] + + " because resources for compute were not provided." ); return; } @@ -640,9 +640,9 @@ export class Commands { ) { console.error( "Error initializing Provider for the compute job using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + args[1] + + " and algorithm DID " + + args[2] ); return; } @@ -847,8 +847,8 @@ export class Commands { if (!algo.transferTxId) { console.error( "Error ordering compute for algorithm with DID: " + - args[2] + - ". Do you have enough tokens?" + args[2] + + ". Do you have enough tokens?" ); return; } @@ -876,8 +876,8 @@ export class Commands { if (!assets[i].transferTxId) { console.error( "Error ordering dataset with DID: " + - assets[i] + - ". Do you have enough tokens?" + assets[i] + + ". Do you have enough tokens?" ); return; } @@ -887,20 +887,20 @@ export class Commands { if (!maxJobDuration) { console.error( "Error initializing Provider for the compute job using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because maxJobDuration was not provided." + args[1] + + " and algorithm DID " + + args[2] + + " because maxJobDuration was not provided." ); return; } if (maxJobDuration < 0) { console.error( "Error starting paid compute using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because maxJobDuration is less than 0. It should be in seconds." + args[1] + + " and algorithm DID " + + args[2] + + " because maxJobDuration is less than 0. It should be in seconds." ); return; } @@ -913,23 +913,23 @@ export class Commands { if (!paymentToken) { console.error( "Error starting paid compute using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because paymentToken was not provided." + args[1] + + " and algorithm DID " + + args[2] + + " because paymentToken was not provided." ); return; } if (!Object.keys(computeEnv.fees).includes(chainId.toString())) { console.error( "Error starting paid compute using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because chainId is not supported by compute environment. " + - args[3] + - ". Supported chain IDs: " + - computeEnv.fees.keys() + args[1] + + " and algorithm DID " + + args[2] + + " because chainId is not supported by compute environment. " + + args[3] + + ". Supported chain IDs: " + + computeEnv.fees.keys() ); return; } @@ -943,11 +943,11 @@ export class Commands { if (found === false) { console.error( "Error starting paid compute using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because paymentToken is not supported by this environment " + - args[3] + args[1] + + " and algorithm DID " + + args[2] + + " because paymentToken is not supported by this environment " + + args[3] ); return; } @@ -955,10 +955,10 @@ export class Commands { if (!resources) { console.error( "Error starting paid compute using dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because resources for compute were not provided." + args[1] + + " and algorithm DID " + + args[2] + + " because resources for compute were not provided." ); return; } @@ -985,11 +985,11 @@ export class Commands { if (validationEscrow.isValid === false) { console.error( "Error starting compute job dataset DID " + - args[1] + - " and algorithm DID " + - args[2] + - " because escrow funds check failed: " + - validationEscrow.message + args[1] + + " and algorithm DID " + + args[2] + + " because escrow funds check failed: " + + validationEscrow.message ); return; } @@ -1002,16 +1002,16 @@ export class Commands { if (assets.length > 0) { console.log( "Starting compute job on " + - describeAsset(assets[0]) + - " with additional datasets:" + - (!additionalDatasets ? "none" : describeAsset(additionalDatasets[0])) + describeAsset(assets[0]) + + " with additional datasets:" + + (!additionalDatasets ? "none" : describeAsset(additionalDatasets[0])) ); } else { console.log( "Starting compute job on " + - algo.documentId + - " with additional datasets:" + - (!additionalDatasets ? "none" : describeAsset(additionalDatasets[0])) + algo.documentId + + " with additional datasets:" + + (!additionalDatasets ? "none" : describeAsset(additionalDatasets[0])) ); } // All datasets (primary + additional) are already in `assets` per C2D V2 specs; @@ -1311,21 +1311,21 @@ export class Commands { ); return; } - const ddoInstance = DDOManager.getDDOClass(asset); - const { indexedMetadata } = ddoInstance.getAssetFields(); - const { services } = ddoInstance.getDDOFields(); - if (indexedMetadata.nft.owner !== (await this.signer.getAddress())) { + const ddoInstance = DDOManager.getDDOClass(asset); + const { indexedMetadata } = ddoInstance.getAssetFields(); + const { services } = ddoInstance.getDDOFields(); + if (indexedMetadata.nft.owner !== (await this.signer.getAddress())) { console.error( "You are not the owner of this asset, and there for you cannot update it." ); return; } - if (services[0].type !== "compute") { + if (services[0].type !== "compute") { console.error( "Error getting computeService for " + - args[1] + - ". Does this asset has an computeService?" + args[1] + + ". Does this asset has an computeService?" ); return; } @@ -1342,15 +1342,15 @@ export class Commands { ); return; } - const algoInstance = DDOManager.getDDOClass(algoAsset); - const { services: servicesAlgo, metadata: metadataAlgo } = algoInstance.getDDOFields(); + const algoInstance = DDOManager.getDDOClass(algoAsset); + const { services: servicesAlgo, metadata: metadataAlgo } = algoInstance.getDDOFields(); const encryptDDO = args[3] === "false" ? false : true; let filesChecksum; try { filesChecksum = await ProviderInstance.checkDidFiles( algoAsset.id, - servicesAlgo[0].id, - servicesAlgo[0].serviceEndpoint, + servicesAlgo[0].id, + servicesAlgo[0].serviceEndpoint, true ); } catch (e) { @@ -1359,18 +1359,18 @@ export class Commands { } const containerChecksum = - metadataAlgo.algorithm.container.entrypoint + - metadataAlgo.algorithm.container.checksum; + metadataAlgo.algorithm.container.entrypoint + + metadataAlgo.algorithm.container.checksum; const trustedAlgorithm = { did: algoAsset.id, containerSectionChecksum: getHash(containerChecksum), filesChecksum: filesChecksum?.[0]?.checksum, - serviceId: servicesAlgo[0].id, + serviceId: servicesAlgo[0].id, }; - if (!services[0].compute.publisherTrustedAlgorithms) { - services[0].compute.publisherTrustedAlgorithms = []; - } - services[0].compute.publisherTrustedAlgorithms.push(trustedAlgorithm); + if (!services[0].compute.publisherTrustedAlgorithms) { + services[0].compute.publisherTrustedAlgorithms = []; + } + services[0].compute.publisherTrustedAlgorithms.push(trustedAlgorithm); try { const txid = await updateAssetMetadata( this.signer, @@ -1400,51 +1400,51 @@ export class Commands { ); return; } - const ddoInstance = DDOManager.getDDOClass(asset); - const { indexedMetadata } = ddoInstance.getAssetFields(); - const { services } = ddoInstance.getDDOFields(); - if (indexedMetadata.nft.owner !== (await this.signer.getAddress())) { + const ddoInstance = DDOManager.getDDOClass(asset); + const { indexedMetadata } = ddoInstance.getAssetFields(); + const { services } = ddoInstance.getDDOFields(); + if (indexedMetadata.nft.owner !== (await this.signer.getAddress())) { console.error( "You are not the owner of this asset, and there for you cannot update it." ); return; } - if (services[0].type !== "compute") { + if (services[0].type !== "compute") { console.error( "Error getting computeService for " + - args[1] + - ". Does this asset has an computeService?" + args[1] + + ". Does this asset has an computeService?" ); return; } - if ( - !services[0].compute.publisherTrustedAlgorithms || - services[0].compute.publisherTrustedAlgorithms.length === 0 - ) { + if ( + !services[0].compute.publisherTrustedAlgorithms || + services[0].compute.publisherTrustedAlgorithms.length === 0 + ) { console.error( "Asset " + - args[1] + - " has no publisherTrustedAlgorithms list to remove an algorithm from." + args[1] + + " has no publisherTrustedAlgorithms list to remove an algorithm from." ); return; } const encryptDDO = args[3] === "false" ? false : true; const indexToDelete = - services[0].compute.publisherTrustedAlgorithms.findIndex( + services[0].compute.publisherTrustedAlgorithms.findIndex( (item) => item.did === args[2] ); if (indexToDelete !== -1) { - services[0].compute.publisherTrustedAlgorithms.splice( + services[0].compute.publisherTrustedAlgorithms.splice( indexToDelete, 1 ); } else { console.error( " " + - args[2] + - ". is not allowed by the publisher to run on " + - args[1] + args[2] + + ". is not allowed by the publisher to run on " + + args[1] ); return; } @@ -1788,7 +1788,7 @@ export class Commands { console.log(`Transferable: ${transferable}`); console.log(`Owner: ${owner}`); console.log( - `Initial users: ${initialUsers.length > 0 ? initialUsers.join(", ") : "none" + `Initial users: ${initialUsers.length > 0 ? initialUsers.join(", ") : "none" }` );