mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
remove updateDDO function
This commit is contained in:
parent
b29ac25de1
commit
4cbbcbbb84
@ -215,40 +215,6 @@ export class Aquarius {
|
||||
return this.retrieveDDO(undefined, metadataServiceEndpoint)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a DDO.
|
||||
* @param {DID | string} did DID of the asset to update.
|
||||
* @param {DDO} newDdo New DDO of the asset.
|
||||
* @return {Promise<DDO>} Updated DDO of the asset.
|
||||
*/
|
||||
public async updateDDO(did: DID | string, newDdo: DDO): Promise<DDO> {
|
||||
did = did && DID.parse(did)
|
||||
const fullUrl = `${this.url}${apiPath}/${did.getDid()}`
|
||||
const result = await this.fetch
|
||||
.put(fullUrl, DDO.serialize(newDdo))
|
||||
.then((response: any) => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
this.logger.log(
|
||||
'updateDDO failed:',
|
||||
response.status,
|
||||
response.statusText,
|
||||
did
|
||||
)
|
||||
return null as DDO
|
||||
})
|
||||
.then((response: DDO) => {
|
||||
return new DDO(response) as DDO
|
||||
})
|
||||
.catch(error => {
|
||||
this.logger.error('Error updating metadata: ', error)
|
||||
return null as DDO
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer ownership of a DDO
|
||||
* @param {DID | string} did DID of the asset to update.
|
||||
|
Loading…
Reference in New Issue
Block a user