1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

replaces contentUrls by files on DDO ocean#251

This commit is contained in:
Pedro Gutiérrez 2019-02-06 13:10:24 +01:00 committed by Pedro Gutiérrez
parent 1336773272
commit e88a40dac0
4 changed files with 11 additions and 12 deletions

View File

@ -100,7 +100,7 @@ export class DDO {
this.id,
]
return web3.utils.sha3(values.join("")).substr(0, 32)
return web3.utils.sha3(values.join("")).replace(/^0x([a-f0-9]{32}).+$/i, "$1")
}
/**

View File

@ -100,13 +100,6 @@ export class MetaDataBase {
*/
public workExample?: string
/**
* List of content URLs resolving the Asset files.
* @type {string | string[]}
* @example "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip"
*/
public contentUrls: string | string[]
/**
* Mapping of links for data samples, or links to find out more information.
* Links may be to either a URL or another Asset. We expect marketplaces to
@ -159,7 +152,7 @@ export class MetaDataBase {
* SHA3 hash of concatenated values: [list of all file checksums] + name + author + license + did
* @type {string}
*/
public checksum: string
public checksum?: string
public encryptedFiles?: any
}

View File

@ -68,7 +68,7 @@ export default class OceanAssets {
metadata.base.encryptedFiles = [
await SecretStoreProvider.getSecretStore()
.encryptDocument(did.getId(), metadata.base.contentUrls),
.encryptDocument(did.getId(), metadata.base.files),
]
const template = new Access()
@ -141,6 +141,11 @@ export default class OceanAssets {
},
// Overwrites defaults
...metadata,
// Cleaning not needed information
base: {
...metadata.base,
files: undefined,
},
},
},
],
@ -157,7 +162,8 @@ export default class OceanAssets {
did.getId(),
ddo.getChecksum(),
serviceEndpoint,
publisher.getId())
publisher.getId(),
)
return storedDdo
}

View File

@ -241,7 +241,7 @@ describe("DDO", () => {
const ddo = new DDO(testDDO)
const checksum = ddo.getChecksum()
assert.equal(checksum, "0x15f27a7a3c7b15d2b06dec7347c6b8da168adddd7df51a8ebbbe87b59b80049b")
assert.equal(checksum, "15f27a7a3c7b15d2b06dec7347c6b8da")
})
})