mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
update filechecksum logic
This commit is contained in:
parent
f8bbda0594
commit
3d541e7038
@ -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)
|
||||
}
|
||||
|
@ -67,13 +67,15 @@ export async function getEncryptedFiles(
|
||||
export async function getFileDidInfo(
|
||||
did: string,
|
||||
serviceId: string,
|
||||
providerUrl: string
|
||||
providerUrl: string,
|
||||
withChecksum: boolean = false
|
||||
): Promise<FileInfo[]> {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user