mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge pull request #1585 from oceanprotocol/feature/file-checksum-strategy
Update files checksum logic
This commit is contained in:
commit
5c04ae6534
16
package-lock.json
generated
16
package-lock.json
generated
@ -13,7 +13,7 @@
|
|||||||
"@coingecko/cryptoformat": "^0.5.4",
|
"@coingecko/cryptoformat": "^0.5.4",
|
||||||
"@loadable/component": "^5.15.2",
|
"@loadable/component": "^5.15.2",
|
||||||
"@oceanprotocol/art": "^3.2.0",
|
"@oceanprotocol/art": "^3.2.0",
|
||||||
"@oceanprotocol/lib": "^1.1.5",
|
"@oceanprotocol/lib": "^1.1.6",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@tippyjs/react": "^4.2.6",
|
"@tippyjs/react": "^4.2.6",
|
||||||
"@urql/exchange-refocus": "^0.2.5",
|
"@urql/exchange-refocus": "^0.2.5",
|
||||||
@ -4598,9 +4598,9 @@
|
|||||||
"integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw=="
|
"integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw=="
|
||||||
},
|
},
|
||||||
"node_modules/@oceanprotocol/lib": {
|
"node_modules/@oceanprotocol/lib": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.6.tgz",
|
||||||
"integrity": "sha512-quc2SGAr8G1v664ll3eOystA2v94OQleW6KGKhVWEPXDldnNAAhlG/QTi86XWRU9HmncGE7OghC5am+9DRGWcQ==",
|
"integrity": "sha512-n1ync5LYBjJDg9Znq61zajnkeXFeFGOU8dN2LCeewArljCOdfYW/SEgQtiLALQb1dgqsYSjMHym40O2jPTUxoQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oceanprotocol/contracts": "^1.0.0",
|
"@oceanprotocol/contracts": "^1.0.0",
|
||||||
"bignumber.js": "^9.0.2",
|
"bignumber.js": "^9.0.2",
|
||||||
@ -46660,16 +46660,15 @@
|
|||||||
"integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw=="
|
"integrity": "sha512-rDCIooe1WHipLejuGhx2Wv/88SB7bWrN3+XHCWxXyPKTmmSQsgxKZPPzbIVBQ0ESChQZqGSBBJyqErqwwW4eBw=="
|
||||||
},
|
},
|
||||||
"@oceanprotocol/lib": {
|
"@oceanprotocol/lib": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-1.1.6.tgz",
|
||||||
"integrity": "sha512-quc2SGAr8G1v664ll3eOystA2v94OQleW6KGKhVWEPXDldnNAAhlG/QTi86XWRU9HmncGE7OghC5am+9DRGWcQ==",
|
"integrity": "sha512-n1ync5LYBjJDg9Znq61zajnkeXFeFGOU8dN2LCeewArljCOdfYW/SEgQtiLALQb1dgqsYSjMHym40O2jPTUxoQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@oceanprotocol/contracts": "^1.0.0",
|
"@oceanprotocol/contracts": "^1.0.0",
|
||||||
"bignumber.js": "^9.0.2",
|
"bignumber.js": "^9.0.2",
|
||||||
"cross-fetch": "^3.1.5",
|
"cross-fetch": "^3.1.5",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"decimal.js": "^10.3.1",
|
"decimal.js": "^10.3.1",
|
||||||
"web3": "^1.7.4",
|
|
||||||
"web3-core": "^1.7.1",
|
"web3-core": "^1.7.1",
|
||||||
"web3-eth-contract": "^1.7.1"
|
"web3-eth-contract": "^1.7.1"
|
||||||
}
|
}
|
||||||
@ -46721,7 +46720,6 @@
|
|||||||
"integrity": "sha512-rmVKYEsKzurfRU0xJz+iHelbi1LGlihIWZ7Qvmb/CBz1EkhL7nOkW4SVXmG2dA5Ce0si2gr88i6q4eBOMRNJ1w==",
|
"integrity": "sha512-rmVKYEsKzurfRU0xJz+iHelbi1LGlihIWZ7Qvmb/CBz1EkhL7nOkW4SVXmG2dA5Ce0si2gr88i6q4eBOMRNJ1w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@oclif/config": "^1.18.2",
|
|
||||||
"@oclif/errors": "^1.3.5",
|
"@oclif/errors": "^1.3.5",
|
||||||
"@oclif/help": "^1.0.1",
|
"@oclif/help": "^1.0.1",
|
||||||
"@oclif/parser": "^3.8.6",
|
"@oclif/parser": "^3.8.6",
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"@coingecko/cryptoformat": "^0.5.4",
|
"@coingecko/cryptoformat": "^0.5.4",
|
||||||
"@loadable/component": "^5.15.2",
|
"@loadable/component": "^5.15.2",
|
||||||
"@oceanprotocol/art": "^3.2.0",
|
"@oceanprotocol/art": "^3.2.0",
|
||||||
"@oceanprotocol/lib": "^1.1.5",
|
"@oceanprotocol/lib": "^1.1.6",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@tippyjs/react": "^4.2.6",
|
"@tippyjs/react": "^4.2.6",
|
||||||
"@urql/exchange-refocus": "^0.2.5",
|
"@urql/exchange-refocus": "^0.2.5",
|
||||||
|
@ -26,6 +26,7 @@ import { AssetSelectionAsset } from '@shared/FormFields/AssetSelection'
|
|||||||
import { transformAssetToAssetSelection } from './assetConvertor'
|
import { transformAssetToAssetSelection } from './assetConvertor'
|
||||||
import { AssetExtended } from 'src/@types/AssetExtended'
|
import { AssetExtended } from 'src/@types/AssetExtended'
|
||||||
import { ComputeEditForm } from 'src/components/Asset/Edit/_types'
|
import { ComputeEditForm } from 'src/components/Asset/Edit/_types'
|
||||||
|
import { getFileDidInfo } from './provider'
|
||||||
|
|
||||||
const getComputeOrders = gql`
|
const getComputeOrders = gql`
|
||||||
query ComputeOrders($user: String!) {
|
query ComputeOrders($user: String!) {
|
||||||
@ -352,12 +353,18 @@ export async function createTrustedAlgorithmList(
|
|||||||
tag: selectedAlgorithm.metadata.algorithm.container.tag,
|
tag: selectedAlgorithm.metadata.algorithm.container.tag,
|
||||||
checksum: selectedAlgorithm.metadata.algorithm.container.checksum
|
checksum: selectedAlgorithm.metadata.algorithm.container.checksum
|
||||||
}
|
}
|
||||||
|
const filesChecksum = await getFileDidInfo(
|
||||||
|
selectedAlgorithm?.id,
|
||||||
|
selectedAlgorithm?.services?.[0].id,
|
||||||
|
selectedAlgorithm?.services?.[0]?.serviceEndpoint,
|
||||||
|
true
|
||||||
|
)
|
||||||
const trustedAlgorithm = {
|
const trustedAlgorithm = {
|
||||||
did: selectedAlgorithm.id,
|
did: selectedAlgorithm.id,
|
||||||
containerSectionChecksum: getHash(
|
containerSectionChecksum: getHash(
|
||||||
JSON.stringify(sanitizedAlgorithmContainer)
|
JSON.stringify(sanitizedAlgorithmContainer)
|
||||||
),
|
),
|
||||||
filesChecksum: getHash(selectedAlgorithm.services[0].files)
|
filesChecksum: filesChecksum?.[0]?.checksum
|
||||||
}
|
}
|
||||||
trustedAlgorithms.push(trustedAlgorithm)
|
trustedAlgorithms.push(trustedAlgorithm)
|
||||||
}
|
}
|
||||||
|
@ -67,13 +67,15 @@ export async function getEncryptedFiles(
|
|||||||
export async function getFileDidInfo(
|
export async function getFileDidInfo(
|
||||||
did: string,
|
did: string,
|
||||||
serviceId: string,
|
serviceId: string,
|
||||||
providerUrl: string
|
providerUrl: string,
|
||||||
|
withChecksum = false
|
||||||
): Promise<FileInfo[]> {
|
): Promise<FileInfo[]> {
|
||||||
try {
|
try {
|
||||||
const response = await ProviderInstance.checkDidFiles(
|
const response = await ProviderInstance.checkDidFiles(
|
||||||
did,
|
did,
|
||||||
serviceId as any, // TODO: why does ocean.js want a number here?
|
serviceId,
|
||||||
providerUrl
|
providerUrl,
|
||||||
|
withChecksum
|
||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user