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

remove ddo.addChecksum

This commit is contained in:
Matthias Kretschmann 2019-11-12 14:21:29 +01:00
parent b9b63dabe9
commit 75a0de1b2c
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 4 additions and 23 deletions

View File

@ -32,11 +32,7 @@ xdescribe('Consume Asset (Large size)', () => {
...baseMetadata, ...baseMetadata,
main: { main: {
...baseMetadata.main, ...baseMetadata.main,
files: [ files: [{ index: 0, contentType: 'hello/hello', url: 'https://speed.hetzner.de/1GB.bin' }]
{
url: 'https://speed.hetzner.de/1GB.bin'
}
]
} }
} }
}) })

View File

@ -1,6 +1,5 @@
import * as Web3 from 'web3' import * as Web3 from 'web3'
import Web3Provider from '../keeper/Web3Provider' import Web3Provider from '../keeper/Web3Provider'
import LoggerInstance from '../utils/Logger'
import { Ocean } from '../ocean/Ocean' import { Ocean } from '../ocean/Ocean'
import { Authentication } from './Authentication' import { Authentication } from './Authentication'
import { Proof } from './Proof' import { Proof } from './Proof'
@ -129,23 +128,11 @@ export class DDO {
} }
} }
/**
* Generated and adds the checksum.
*/
public addChecksum(): void {
const metadataService = this.findServiceByType('metadata')
if (metadataService.attributes.main.checksum) {
LoggerInstance.log('Checksum already exists')
return
}
metadataService.attributes.main.checksum = this.getChecksum()
}
/** /**
* Generates and adds a proof using personal sing on the DDO. * Generates and adds a proof using personal sing on the DDO.
* @param {Web3} web3 Web3 instance. * @param {Web3} web3 Web3 instance.
* @param {string} publicKey Public key to be used on personal sign. * @param {string} publicKey Public key to be used on personal sign.
* @param {string} password Password if it's requirted. * @param {string} password Password if it's required.
* @return {Promise<Proof>} Proof object. * @return {Promise<Proof>} Proof object.
*/ */
public async addProof(web3: Web3, publicKey: string, password?: string): Promise<void> { public async addProof(web3: Web3, publicKey: string, password?: string): Promise<void> {

View File

@ -159,7 +159,6 @@ export class OceanAssets extends Instantiable {
const conditions = fillConditionsWithDDO(rawConditions, ddo) const conditions = fillConditionsWithDDO(rawConditions, ddo)
serviceAgreementTemplate.conditions = conditions serviceAgreementTemplate.conditions = conditions
ddo.addChecksum()
this.logger.log('Generating proof') this.logger.log('Generating proof')
observer.next(CreateProgressStep.GeneratingProof) observer.next(CreateProgressStep.GeneratingProof)
await ddo.addProof(this.ocean, publisher.getId(), publisher.getPassword()) await ddo.addProof(this.ocean, publisher.getId(), publisher.getPassword())

View File

@ -96,7 +96,7 @@ describe('DDO', () => {
datePublished: '2012-10-10T17:00:000Z', datePublished: '2012-10-10T17:00:000Z',
author: 'Met Office', author: 'Met Office',
license: 'CC-BY', license: 'CC-BY',
price: 10, price: '10',
files: [ files: [
{ {
index: 0, index: 0,
@ -115,8 +115,7 @@ describe('DDO', () => {
index: 2, index: 2,
contentType: '' contentType: ''
} }
], ]
checksum: ''
}, },
curation: { curation: {
rating: 0.93, rating: 0.93,