mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
small fixes
This commit is contained in:
parent
323e57e6f4
commit
b07dc6daea
@ -34,6 +34,19 @@ export class OnChainMetadataStore {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Compress DDO using LZMA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public async LZMACompressDDO(ddo: DDO): Promise<any> {
|
||||||
|
const data = DDO.serialize(ddo)
|
||||||
|
const lzma = new LZMA()
|
||||||
|
// see https://github.com/LZMA-JS/LZMA-JS/issues/44
|
||||||
|
lzma.disableEndMark = true
|
||||||
|
let compressed = lzma.compress(data, 9)
|
||||||
|
compressed = this.getHex(compressed)
|
||||||
|
return compressed
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish a new DDO
|
* Publish a new DDO
|
||||||
* @param {String} did
|
* @param {String} did
|
||||||
@ -47,12 +60,7 @@ export class OnChainMetadataStore {
|
|||||||
consumerAccount: string
|
consumerAccount: string
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
let flags = 0
|
let flags = 0
|
||||||
const data = DDO.serialize(ddo)
|
const compressed = this.LZMACompressDDO(ddo)
|
||||||
const lzma = new LZMA()
|
|
||||||
// see https://github.com/LZMA-JS/LZMA-JS/issues/44
|
|
||||||
lzma.disableEndMark = true
|
|
||||||
let compressed = lzma.compress(data, 9)
|
|
||||||
compressed = this.getHex(compressed)
|
|
||||||
flags = flags | 1
|
flags = flags | 1
|
||||||
return this.publishRaw(didZeroX(did), flags, compressed, consumerAccount)
|
return this.publishRaw(didZeroX(did), flags, compressed, consumerAccount)
|
||||||
}
|
}
|
||||||
@ -70,12 +78,7 @@ export class OnChainMetadataStore {
|
|||||||
consumerAccount: string
|
consumerAccount: string
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
let flags = 0
|
let flags = 0
|
||||||
const data = DDO.serialize(ddo)
|
const compressed = this.LZMACompressDDO(ddo)
|
||||||
const lzma = new LZMA()
|
|
||||||
// see https://github.com/LZMA-JS/LZMA-JS/issues/44
|
|
||||||
lzma.disableEndMark = true
|
|
||||||
let compressed = lzma.compress(data, 9)
|
|
||||||
compressed = this.getHex(compressed)
|
|
||||||
flags = flags | 1
|
flags = flags | 1
|
||||||
return this.updateRaw(didZeroX(did), flags, compressed, consumerAccount)
|
return this.updateRaw(didZeroX(did), flags, compressed, consumerAccount)
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ export class Assets extends Instantiable {
|
|||||||
ddo,
|
ddo,
|
||||||
publisher.getId()
|
publisher.getId()
|
||||||
)
|
)
|
||||||
this.logger.log('DDO stored')
|
this.logger.log('DDO stored ' + ddo.id)
|
||||||
observer.next(CreateProgressStep.DdoStored)
|
observer.next(CreateProgressStep.DdoStored)
|
||||||
if (storeTx) return ddo
|
if (storeTx) return ddo
|
||||||
else return null
|
else return null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user