diff --git a/package-lock.json b/package-lock.json index 3365b4721..8fa8ca5f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@coingecko/cryptoformat": "^0.5.4", "@loadable/component": "^5.15.2", "@oceanprotocol/art": "^3.2.0", - "@oceanprotocol/lib": "^1.1.5", + "@oceanprotocol/lib": "^1.1.6", "@oceanprotocol/typographies": "^0.1.0", "@tippyjs/react": "^4.2.6", "@urql/exchange-refocus": "^0.2.5", @@ -4598,9 +4598,9 @@ "integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw==" }, "node_modules/@oceanprotocol/lib": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.5.tgz", - "integrity": "sha512-quc2SGAr8G1v664ll3eOystA2v94OQleW6KGKhVWEPXDldnNAAhlG/QTi86XWRU9HmncGE7OghC5am+9DRGWcQ==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.6.tgz", + "integrity": "sha512-n1ync5LYBjJDg9Znq61zajnkeXFeFGOU8dN2LCeewArljCOdfYW/SEgQtiLALQb1dgqsYSjMHym40O2jPTUxoQ==", "dependencies": { "@oceanprotocol/contracts": "^1.0.0", "bignumber.js": "^9.0.2", @@ -46660,16 +46660,15 @@ "integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw==" }, "@oceanprotocol/lib": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.5.tgz", - "integrity": "sha512-quc2SGAr8G1v664ll3eOystA2v94OQleW6KGKhVWEPXDldnNAAhlG/QTi86XWRU9HmncGE7OghC5am+9DRGWcQ==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.6.tgz", + "integrity": "sha512-n1ync5LYBjJDg9Znq61zajnkeXFeFGOU8dN2LCeewArljCOdfYW/SEgQtiLALQb1dgqsYSjMHym40O2jPTUxoQ==", "requires": { "@oceanprotocol/contracts": "^1.0.0", "bignumber.js": "^9.0.2", "cross-fetch": "^3.1.5", "crypto-js": "^4.1.1", "decimal.js": "^10.3.1", - "web3": "^1.7.4", "web3-core": "^1.7.1", "web3-eth-contract": "^1.7.1" } @@ -46721,7 +46720,6 @@ "integrity": "sha512-rmVKYEsKzurfRU0xJz+iHelbi1LGlihIWZ7Qvmb/CBz1EkhL7nOkW4SVXmG2dA5Ce0si2gr88i6q4eBOMRNJ1w==", "dev": true, "requires": { - "@oclif/config": "^1.18.2", "@oclif/errors": "^1.3.5", "@oclif/help": "^1.0.1", "@oclif/parser": "^3.8.6", diff --git a/package.json b/package.json index 004885cde..4c061bf94 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@coingecko/cryptoformat": "^0.5.4", "@loadable/component": "^5.15.2", "@oceanprotocol/art": "^3.2.0", - "@oceanprotocol/lib": "^1.1.5", + "@oceanprotocol/lib": "^1.1.6", "@oceanprotocol/typographies": "^0.1.0", "@tippyjs/react": "^4.2.6", "@urql/exchange-refocus": "^0.2.5", diff --git a/src/@utils/compute.ts b/src/@utils/compute.ts index cc3e48e74..d483f5d6e 100644 --- a/src/@utils/compute.ts +++ b/src/@utils/compute.ts @@ -26,6 +26,7 @@ import { AssetSelectionAsset } from '@shared/FormFields/AssetSelection' import { transformAssetToAssetSelection } from './assetConvertor' import { AssetExtended } from 'src/@types/AssetExtended' import { ComputeEditForm } from 'src/components/Asset/Edit/_types' +import { getFileDidInfo } from './provider' const getComputeOrders = gql` query ComputeOrders($user: String!) { @@ -352,12 +353,18 @@ export async function createTrustedAlgorithmList( tag: selectedAlgorithm.metadata.algorithm.container.tag, checksum: selectedAlgorithm.metadata.algorithm.container.checksum } + const filesChecksum = await getFileDidInfo( + selectedAlgorithm?.id, + selectedAlgorithm?.services?.[0].id, + selectedAlgorithm?.services?.[0]?.serviceEndpoint, + true + ) const trustedAlgorithm = { did: selectedAlgorithm.id, containerSectionChecksum: getHash( JSON.stringify(sanitizedAlgorithmContainer) ), - filesChecksum: getHash(selectedAlgorithm.services[0].files) + filesChecksum: filesChecksum?.[0]?.checksum } trustedAlgorithms.push(trustedAlgorithm) } diff --git a/src/@utils/provider.ts b/src/@utils/provider.ts index 358361bb4..e2691950b 100644 --- a/src/@utils/provider.ts +++ b/src/@utils/provider.ts @@ -67,13 +67,15 @@ export async function getEncryptedFiles( export async function getFileDidInfo( did: string, serviceId: string, - providerUrl: string + providerUrl: string, + withChecksum = false ): Promise { try { const response = await ProviderInstance.checkDidFiles( did, - serviceId as any, // TODO: why does ocean.js want a number here? - providerUrl + serviceId, + providerUrl, + withChecksum ) return response } catch (error) {