1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

add checksum param when fetching fileinfo and checksum aatribute to fileinfo interface

This commit is contained in:
Bogdan Fazakas 2022-07-08 07:42:18 +03:00
parent 869ef38fc3
commit 00f776d540
2 changed files with 9 additions and 2 deletions

View File

@ -36,6 +36,12 @@ export interface FileInfo {
*/ */
method?: string method?: string
/**
* Computed file checksum
* @type {string}
*/
checksum?: string
/** /**
* check if file exists * check if file exists
* @type {boolean} * @type {boolean}

View File

@ -168,8 +168,9 @@ export class Provider {
*/ */
public async checkDidFiles( public async checkDidFiles(
did: string, did: string,
serviceId: number, serviceId: string,
providerUri: string, providerUri: string,
withChecksum: boolean = false,
signal?: AbortSignal signal?: AbortSignal
): Promise<FileInfo[]> { ): Promise<FileInfo[]> {
const providerEndpoints = await this.getEndpoints(providerUri) const providerEndpoints = await this.getEndpoints(providerUri)
@ -177,7 +178,7 @@ export class Provider {
providerUri, providerUri,
providerEndpoints providerEndpoints
) )
const args = { did: did, serviceId: serviceId } const args = { did: did, serviceId: serviceId, checksum: withChecksum }
const files: FileInfo[] = [] const files: FileInfo[] = []
const path = this.getEndpointURL(serviceEndpoints, 'fileinfo') const path = this.getEndpointURL(serviceEndpoints, 'fileinfo')
? this.getEndpointURL(serviceEndpoints, 'fileinfo').urlPath ? this.getEndpointURL(serviceEndpoints, 'fileinfo').urlPath