Update ocean-lib with 2.7.0 version. (#633)

This commit is contained in:
Maria Carmina 2023-03-23 17:43:36 +02:00 committed by GitHub
parent ec9d7e733f
commit 6a9b342c52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 21 deletions

14
package-lock.json generated
View File

@ -10,7 +10,7 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@oceanprotocol/contracts": "^1.1.12", "@oceanprotocol/contracts": "^1.1.12",
"@oceanprotocol/lib": "^2.6.3", "@oceanprotocol/lib": "^2.7.0",
"cross-fetch": "^3.1.4" "cross-fetch": "^3.1.4"
}, },
"devDependencies": { "devDependencies": {
@ -968,9 +968,9 @@
"integrity": "sha512-kvMLH4nOKvkqsNmob00yqVi2kD9xiYLoobw2ioezOA1p6wRPDFLzZd+w8+NZP2hMDFVITUY4YCdO/dRGKTihOA==" "integrity": "sha512-kvMLH4nOKvkqsNmob00yqVi2kD9xiYLoobw2ioezOA1p6wRPDFLzZd+w8+NZP2hMDFVITUY4YCdO/dRGKTihOA=="
}, },
"node_modules/@oceanprotocol/lib": { "node_modules/@oceanprotocol/lib": {
"version": "2.6.3", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-2.6.3.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-2.7.0.tgz",
"integrity": "sha512-Xzmc/1wogOa7AJnFvqmFMJaS1IV5OzoY2HXH4wGi6wOPL3hrWKPUiY4L+/PXmuIMaLEUm5bCZnpLHBidYrb2vg==", "integrity": "sha512-mSisB8mOVQLg6CJ4Fjp2oa6NAr/zc+yh/2x8fdjSzzZPN23WlmpPkluHeCIKN5rQDqDIGHXCntfyCaVp5hGMnw==",
"dependencies": { "dependencies": {
"@oceanprotocol/contracts": "^1.1.8", "@oceanprotocol/contracts": "^1.1.8",
"bignumber.js": "^9.1.0", "bignumber.js": "^9.1.0",
@ -15102,9 +15102,9 @@
"integrity": "sha512-kvMLH4nOKvkqsNmob00yqVi2kD9xiYLoobw2ioezOA1p6wRPDFLzZd+w8+NZP2hMDFVITUY4YCdO/dRGKTihOA==" "integrity": "sha512-kvMLH4nOKvkqsNmob00yqVi2kD9xiYLoobw2ioezOA1p6wRPDFLzZd+w8+NZP2hMDFVITUY4YCdO/dRGKTihOA=="
}, },
"@oceanprotocol/lib": { "@oceanprotocol/lib": {
"version": "2.6.3", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-2.6.3.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-2.7.0.tgz",
"integrity": "sha512-Xzmc/1wogOa7AJnFvqmFMJaS1IV5OzoY2HXH4wGi6wOPL3hrWKPUiY4L+/PXmuIMaLEUm5bCZnpLHBidYrb2vg==", "integrity": "sha512-mSisB8mOVQLg6CJ4Fjp2oa6NAr/zc+yh/2x8fdjSzzZPN23WlmpPkluHeCIKN5rQDqDIGHXCntfyCaVp5hGMnw==",
"requires": { "requires": {
"@oceanprotocol/contracts": "^1.1.8", "@oceanprotocol/contracts": "^1.1.8",
"bignumber.js": "^9.1.0", "bignumber.js": "^9.1.0",

View File

@ -71,7 +71,7 @@
}, },
"dependencies": { "dependencies": {
"@oceanprotocol/contracts": "^1.1.12", "@oceanprotocol/contracts": "^1.1.12",
"@oceanprotocol/lib": "^2.6.3", "@oceanprotocol/lib": "^2.7.0",
"cross-fetch": "^3.1.4" "cross-fetch": "^3.1.4"
}, },
"repository": { "repository": {

View File

@ -218,17 +218,21 @@ describe('Datatoken tests', async () => {
it('Correct Datatoken fields after updating metadata', async () => { it('Correct Datatoken fields after updating metadata', async () => {
// create the files encrypted string // create the files encrypted string
let providerResponse = await ProviderInstance.encrypt(assetUrl, providerUrl) const chain = await web3.eth.getChainId()
let providerResponse = await ProviderInstance.encrypt(
assetUrl,
chain,
providerUrl
)
ddo.services[0].files = await providerResponse ddo.services[0].files = await providerResponse
ddo.services[0].datatokenAddress = datatokenAddress ddo.services[0].datatokenAddress = datatokenAddress
// update ddo and set the right did // update ddo and set the right did
ddo.nftAddress = erc721Address ddo.nftAddress = erc721Address
const chain = await web3.eth.getChainId()
ddo.id = ddo.id =
'did:op:' + 'did:op:' +
SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10)) SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10))
providerResponse = await ProviderInstance.encrypt(ddo, providerUrl) providerResponse = await ProviderInstance.encrypt(ddo, chain, providerUrl)
const encryptedResponse = await providerResponse const encryptedResponse = await providerResponse
const metadataHash = getHash(JSON.stringify(ddo)) const metadataHash = getHash(JSON.stringify(ddo))
await nft.setMetadata( await nft.setMetadata(

View File

@ -185,18 +185,22 @@ describe('NFT tests', async () => {
}) })
it('Update metadata', async () => { it('Update metadata', async () => {
const chain = await web3.eth.getChainId()
// create the files encrypted string // create the files encrypted string
let providerResponse = await ProviderInstance.encrypt(assetUrl, providerUrl) let providerResponse = await ProviderInstance.encrypt(
assetUrl,
chain,
providerUrl
)
ddo.services[0].files = await providerResponse ddo.services[0].files = await providerResponse
ddo.services[0].datatokenAddress = datatokenAddress ddo.services[0].datatokenAddress = datatokenAddress
// update ddo and set the right did // update ddo and set the right did
ddo.nftAddress = erc721Address ddo.nftAddress = erc721Address
const chain = await web3.eth.getChainId()
ddo.id = ddo.id =
'did:op:' + 'did:op:' +
SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10)) SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10))
providerResponse = await ProviderInstance.encrypt(ddo, providerUrl) providerResponse = await ProviderInstance.encrypt(ddo, chain, providerUrl)
const encryptedResponse = await providerResponse const encryptedResponse = await providerResponse
const metadataHash = getHash(JSON.stringify(ddo)) const metadataHash = getHash(JSON.stringify(ddo))
await nft.setMetadata( await nft.setMetadata(

View File

@ -122,18 +122,22 @@ describe('Simple Publish & consume test', async () => {
const erc721Address = result.events.NFTCreated.returnValues[0] const erc721Address = result.events.NFTCreated.returnValues[0]
datatokenAddress = result.events.TokenCreated.returnValues[0] datatokenAddress = result.events.TokenCreated.returnValues[0]
const chain = await web3.eth.getChainId()
// create the files encrypted string // create the files encrypted string
let providerResponse = await ProviderInstance.encrypt(assetUrl, providerUrl) let providerResponse = await ProviderInstance.encrypt(
assetUrl,
chain,
providerUrl
)
ddo.services[0].files = await providerResponse ddo.services[0].files = await providerResponse
ddo.services[0].datatokenAddress = datatokenAddress ddo.services[0].datatokenAddress = datatokenAddress
// update ddo and set the right did // update ddo and set the right did
ddo.nftAddress = erc721Address ddo.nftAddress = erc721Address
const chain = await web3.eth.getChainId()
ddo.id = ddo.id =
'did:op:' + 'did:op:' +
SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10)) SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10))
providerResponse = await ProviderInstance.encrypt(ddo, providerUrl) providerResponse = await ProviderInstance.encrypt(ddo, chain, providerUrl)
const encryptedResponse = await providerResponse const encryptedResponse = await providerResponse
const metadataHash = getHash(JSON.stringify(ddo)) const metadataHash = getHash(JSON.stringify(ddo))
await nft.setMetadata( await nft.setMetadata(
@ -203,19 +207,22 @@ describe('Simple Publish & consume test', async () => {
initialResult.data.nft.owner.id.toLowerCase() === initialResult.data.nft.owner.id.toLowerCase() ===
publisherAccount.toLowerCase() publisherAccount.toLowerCase()
) )
const chain = await web3.eth.getChainId()
// create the files encrypted string // create the files encrypted string
let providerResponse = await ProviderInstance.encrypt(assetUrl, providerUrl) let providerResponse = await ProviderInstance.encrypt(
assetUrl,
chain,
providerUrl
)
ddo.services[0].files = await providerResponse ddo.services[0].files = await providerResponse
ddo.services[0].datatokenAddress = datatokenAddress ddo.services[0].datatokenAddress = datatokenAddress
// update ddo and set the right did // update ddo and set the right did
ddo.nftAddress = erc721Address ddo.nftAddress = erc721Address
const chain = await web3.eth.getChainId()
ddo.id = ddo.id =
'did:op:' + 'did:op:' +
SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10)) SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10))
providerResponse = await ProviderInstance.encrypt(ddo, providerUrl) providerResponse = await ProviderInstance.encrypt(ddo, chain, providerUrl)
const encryptedResponse = await providerResponse const encryptedResponse = await providerResponse
const metadataHash = getHash(JSON.stringify(ddo)) const metadataHash = getHash(JSON.stringify(ddo))
await nft.setMetadata( await nft.setMetadata(