From 3a53a6b4ad0b9948a79e677bafc7d07737257abf Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 19 Sep 2024 15:44:25 +0300 Subject: [PATCH 01/22] Fix ipfs CID. --- package-lock.json | 77 +++++++++++++++++++-- package.json | 1 + test/integration/PublishEditConsume.test.ts | 50 +++++++++---- 3 files changed, 111 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 87b25d160..36f1e5ae7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@oceanprotocol/contracts": "^2.0.3", + "axios": "^1.7.7", "cross-fetch": "^4.0.0", "crypto-js": "^4.1.1", "decimal.js": "^10.4.1", @@ -4363,6 +4364,17 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, + "node_modules/axios": { + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -8512,6 +8524,26 @@ "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -8541,6 +8573,20 @@ "node": "*" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/form-data-encoder": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", @@ -13881,8 +13927,7 @@ "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "node_modules/prr": { "version": "1.0.1", @@ -20779,6 +20824,16 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, + "axios": { + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "requires": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -24022,6 +24077,11 @@ "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", "dev": true }, + "follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==" + }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -24045,6 +24105,16 @@ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "form-data-encoder": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", @@ -27978,8 +28048,7 @@ "proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "prr": { "version": "1.0.1", diff --git a/package.json b/package.json index 0870c151f..0c9213704 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ }, "dependencies": { "@oceanprotocol/contracts": "^2.0.3", + "axios": "^1.7.7", "cross-fetch": "^4.0.0", "crypto-js": "^4.1.1", "decimal.js": "^10.4.1", diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index c140f6076..ac8eb9b06 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -13,6 +13,7 @@ import { } from '../../src' import { Files, Smartcontract } from '../../src/@types' import { createAsset, orderAsset, updateAssetMetadata } from './helpers' +import { axios } from 'axios' let config: Config @@ -72,17 +73,6 @@ const arweaveFile: Files = { ] } -const ifpsFile: Files = { - datatokenAddress: '0x0', - nftAddress: '0x0', - files: [ - { - type: 'ipfs', - hash: 'QmdMBw956S3i2H2ioS9cERrtxoLJuSsfjzCvkqoDgUa2xm' - } - ] -} - const onchainFile: Files = { datatokenAddress: '0x0', nftAddress: '0x0', @@ -146,6 +136,30 @@ function delay(interval: number) { }).timeout(interval + 100) } +function uploadToIpfs(data: any): Promise { + return new Promise((resolve, reject) => { + axios + .post( + 'http://172.15.0.16:5001/api/v0/add', + '--------------------------a28d68b1c872c96f\r\nContent-Disposition: form-data; name="file"; filename="ddo.json"\r\nContent-Type: application/octet-stream\r\n\r\n' + + data + + '\r\n--------------------------a28d68b1c872c96f--\r\n', + { + headers: { + 'Content-Type': + 'multipart/form-data; boundary=------------------------a28d68b1c872c96f' + } + } + ) + .then(function (response: any) { + resolve(response.data.Hash) + }) + .catch(function (error: any) { + reject(error) + }) + }) +} + describe('Publish consume test', async () => { before(async () => { publisherAccount = (await provider.getSigner(0)) as Signer @@ -221,12 +235,22 @@ describe('Publish consume test', async () => { aquarius ) assert(urlAssetId, 'Failed to arwave publish DDO') - + const ipfsCID = await uploadToIpfs(JSON.stringify(assetDdo)) + const ipfsFile: Files = { + datatokenAddress: '0x0', + nftAddress: '0x0', + files: [ + { + type: 'ipfs', + hash: ipfsCID + } + ] + } ipfsAssetId = await createAsset( 'IpfsDatatoken', 'IPFSDT', publisherAccount, - ifpsFile, + ipfsFile, assetDdo, providerUrl, addresses.ERC721Factory, From d57096264f20c1f37f2db4c2280a4bc48e378ad3 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 19 Sep 2024 15:52:45 +0300 Subject: [PATCH 02/22] fix lint --- test/integration/PublishEditConsume.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 3c259a16e..1397b23bf 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -13,7 +13,7 @@ import { } from '../../src' import { Files, Smartcontract } from '../../src/@types' import { createAsset, orderAsset, updateAssetMetadata } from './helpers' -import { axios } from 'axios' +import * as axios from 'axios' let config: Config From 76b3cd43f18589a44af8b259744b5bc32c6daf65 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 19 Sep 2024 15:55:40 +0300 Subject: [PATCH 03/22] tweaks. --- test/integration/PublishEditConsume.test.ts | 683 ++++++++++---------- 1 file changed, 341 insertions(+), 342 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 1397b23bf..631f0bafb 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -13,7 +13,7 @@ import { } from '../../src' import { Files, Smartcontract } from '../../src/@types' import { createAsset, orderAsset, updateAssetMetadata } from './helpers' -import * as axios from 'axios' +import axios from 'axios' let config: Config @@ -225,368 +225,367 @@ describe('Publish consume test', async () => { assert(urlAssetId, 'Failed to publish url DDO') }) - arweaveAssetId = await createAsset( - 'ArwaveDatatoken', - 'ARWAVEDT', - publisherAccount, - arweaveFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(urlAssetId, 'Failed to arwave publish DDO') - const ipfsCID = await uploadToIpfs(JSON.stringify(assetDdo)) - const ipfsFile: Files = { - datatokenAddress: '0x0', - nftAddress: '0x0', - files: [ - { - type: 'ipfs', - hash: ipfsCID - } - ] - } - ipfsAssetId = await createAsset( - 'IpfsDatatoken', - 'IPFSDT', - publisherAccount, - ipfsFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(ipfsAssetId, 'Failed to publish ipfs DDO') - }) - - it('Should publish arwave asset', async () => { - arweaveAssetId = await createAsset( - 'ArweaveDatatoken', - 'ARWEAVEDT', - publisherAccount, - arweaveFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(arweaveAssetId, 'Failed to publish ipfs DDO') - }) - - it('Should publish onchain asset', async () => { - const chainFile: Smartcontract = { - type: 'smartcontract', - address: addresses.Router, - abi: { - inputs: [], - name: 'swapOceanFee', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - }, - chainId: 8996 - } - onchainFile.files[0] = chainFile - onchainAssetId = await createAsset( - 'ChainDatatoken', - 'CHAINDT', - publisherAccount, - onchainFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(onchainAssetId, 'Failed to publish onchain DDO') - }) - - it('Should publish graphql asset', async () => { - grapqlAssetId = await createAsset( - 'GraphDatatoken', - 'GRAPHDT', - publisherAccount, - grapqlFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(grapqlAssetId, 'Failed to publish graphql DDO') - }) - - delay(10000) // let's wait for aquarius to index the assets - - it('Resolve published assets', async () => { - resolvedUrlAssetDdo = await aquarius.waitForAqua(urlAssetId) - assert(resolvedUrlAssetDdo, 'Cannot fetch url DDO from Aquarius') - - resolvedArweaveAssetDdo = await aquarius.waitForAqua(arweaveAssetId) - assert(resolvedArweaveAssetDdo, 'Cannot fetch arwave DDO from Aquarius') + arweaveAssetId = await createAsset( + 'ArwaveDatatoken', + 'ARWAVEDT', + publisherAccount, + arweaveFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(urlAssetId, 'Failed to arwave publish DDO') + const ipfsCID = await uploadToIpfs(JSON.stringify(assetDdo)) + const ipfsFile: Files = { + datatokenAddress: '0x0', + nftAddress: '0x0', + files: [ + { + type: 'ipfs', + hash: ipfsCID + } + ] + } + ipfsAssetId = await createAsset( + 'IpfsDatatoken', + 'IPFSDT', + publisherAccount, + ipfsFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(ipfsAssetId, 'Failed to publish ipfs DDO') +}) - resolvedIpfsAssetDdo = await aquarius.waitForAqua(ipfsAssetId) - assert(resolvedIpfsAssetDdo, 'Cannot fetch ipfs DDO from Aquarius') +it('Should publish arwave asset', async () => { + arweaveAssetId = await createAsset( + 'ArweaveDatatoken', + 'ARWEAVEDT', + publisherAccount, + arweaveFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(arweaveAssetId, 'Failed to publish ipfs DDO') +}) - resolvedOnchainAssetDdo = await aquarius.waitForAqua(onchainAssetId) - assert(resolvedOnchainAssetDdo, 'Cannot fetch onchain DDO from Aquarius') +it('Should publish onchain asset', async () => { + const chainFile: Smartcontract = { + type: 'smartcontract', + address: addresses.Router, + abi: { + inputs: [], + name: 'swapOceanFee', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function' + }, + chainId: 8996 + } + onchainFile.files[0] = chainFile + onchainAssetId = await createAsset( + 'ChainDatatoken', + 'CHAINDT', + publisherAccount, + onchainFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(onchainAssetId, 'Failed to publish onchain DDO') +}) - resolvedGraphqlAssetDdo = await aquarius.waitForAqua(grapqlAssetId) - assert(resolvedGraphqlAssetDdo, 'Cannot fetch graphql DDO from Aquarius') - }) +it('Should publish graphql asset', async () => { + grapqlAssetId = await createAsset( + 'GraphDatatoken', + 'GRAPHDT', + publisherAccount, + grapqlFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(grapqlAssetId, 'Failed to publish graphql DDO') +}) - it('Mint datasets datatokens to publisher', async () => { - datatoken = new Datatoken(publisherAccount, config.chainId) - const urlMintTx = await datatoken.mint( - resolvedUrlAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(urlMintTx, 'Failed minting url datatoken to consumer.') +delay(10000) // let's wait for aquarius to index the assets - const arwaveMintTx = await datatoken.mint( - resolvedArweaveAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(arwaveMintTx, 'Failed minting arwave datatoken to consumer.') +it('Resolve published assets', async () => { + resolvedUrlAssetDdo = await aquarius.waitForAqua(urlAssetId) + assert(resolvedUrlAssetDdo, 'Cannot fetch url DDO from Aquarius') - const ipfsMintTx = await datatoken.mint( - resolvedIpfsAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(ipfsMintTx, 'Failed minting ipfs datatoken to consumer.') + resolvedArweaveAssetDdo = await aquarius.waitForAqua(arweaveAssetId) + assert(resolvedArweaveAssetDdo, 'Cannot fetch arwave DDO from Aquarius') - const onchainMintTx = await datatoken.mint( - resolvedOnchainAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(onchainMintTx, 'Failed minting onchain datatoken to consumer.') + resolvedIpfsAssetDdo = await aquarius.waitForAqua(ipfsAssetId) + assert(resolvedIpfsAssetDdo, 'Cannot fetch ipfs DDO from Aquarius') - const graphqlMintTx = await datatoken.mint( - resolvedGraphqlAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(graphqlMintTx, 'Failed minting graphql datatoken to consumer.') - }) + resolvedOnchainAssetDdo = await aquarius.waitForAqua(onchainAssetId) + assert(resolvedOnchainAssetDdo, 'Cannot fetch onchain DDO from Aquarius') - it('Should order url dataset', async () => { - datatoken = new Datatoken(consumerAccount, config.chainId) - urlOrderTx = await orderAsset( - resolvedUrlAssetDdo.id, - resolvedUrlAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedUrlAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(urlOrderTx, 'Ordering url dataset failed.') - }).timeout(40000) - - it('Should order arweave dataset', async () => { - arwaveOrderTx = await orderAsset( - resolvedArweaveAssetDdo.id, - resolvedArweaveAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedArweaveAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(arwaveOrderTx, 'Ordering arwave dataset failed.') - }).timeout(40000) - - it('Should order ipfs dataset', async () => { - ipfsOrderTx = await orderAsset( - resolvedIpfsAssetDdo.id, - resolvedIpfsAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedIpfsAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') - }).timeout(40000) + resolvedGraphqlAssetDdo = await aquarius.waitForAqua(grapqlAssetId) + assert(resolvedGraphqlAssetDdo, 'Cannot fetch graphql DDO from Aquarius') +}) - it('Should order onchain dataset', async () => { - onchainOrderTx = await orderAsset( - resolvedOnchainAssetDdo.id, - resolvedOnchainAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedOnchainAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(onchainOrderTx, 'Ordering onchain dataset failed.') - }).timeout(40000) +it('Mint datasets datatokens to publisher', async () => { + datatoken = new Datatoken(publisherAccount, config.chainId) + const urlMintTx = await datatoken.mint( + resolvedUrlAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(urlMintTx, 'Failed minting url datatoken to consumer.') + + const arwaveMintTx = await datatoken.mint( + resolvedArweaveAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(arwaveMintTx, 'Failed minting arwave datatoken to consumer.') + + const ipfsMintTx = await datatoken.mint( + resolvedIpfsAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(ipfsMintTx, 'Failed minting ipfs datatoken to consumer.') + + const onchainMintTx = await datatoken.mint( + resolvedOnchainAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(onchainMintTx, 'Failed minting onchain datatoken to consumer.') + + const graphqlMintTx = await datatoken.mint( + resolvedGraphqlAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(graphqlMintTx, 'Failed minting graphql datatoken to consumer.') +}) - it('Should order graphQl dataset', async () => { - grapqlOrderTx = await orderAsset( - resolvedGraphqlAssetDdo.id, - resolvedGraphqlAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedGraphqlAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(grapqlOrderTx, 'Ordering graphql dataset failed.') - }) +it('Should order url dataset', async () => { + datatoken = new Datatoken(consumerAccount, config.chainId) + urlOrderTx = await orderAsset( + resolvedUrlAssetDdo.id, + resolvedUrlAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedUrlAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(urlOrderTx, 'Ordering url dataset failed.') +}).timeout(40000) + +it('Should order arweave dataset', async () => { + arwaveOrderTx = await orderAsset( + resolvedArweaveAssetDdo.id, + resolvedArweaveAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedArweaveAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(arwaveOrderTx, 'Ordering arwave dataset failed.') +}).timeout(40000) + +it('Should order ipfs dataset', async () => { + ipfsOrderTx = await orderAsset( + resolvedIpfsAssetDdo.id, + resolvedIpfsAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedIpfsAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') +}).timeout(40000) + +it('Should order onchain dataset', async () => { + onchainOrderTx = await orderAsset( + resolvedOnchainAssetDdo.id, + resolvedOnchainAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedOnchainAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(onchainOrderTx, 'Ordering onchain dataset failed.') +}).timeout(40000) + +it('Should order graphQl dataset', async () => { + grapqlOrderTx = await orderAsset( + resolvedGraphqlAssetDdo.id, + resolvedGraphqlAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedGraphqlAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(grapqlOrderTx, 'Ordering graphql dataset failed.') +}) - it('Should download the datasets files', async () => { - const urlDownloadUrl = await ProviderInstance.getDownloadUrl( - resolvedUrlAssetDdo.id, - resolvedUrlAssetDdo.services[0].id, - 0, - urlOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(urlDownloadUrl, 'Provider getDownloadUrl failed for url dataset') - try { - await downloadFile(urlDownloadUrl) - } catch (e) { - assert.fail(`Download url dataset failed: ${e}`) - } - const arwaveDownloadURL = await ProviderInstance.getDownloadUrl( - resolvedArweaveAssetDdo.id, - resolvedArweaveAssetDdo.services[0].id, - 0, - arwaveOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(arwaveDownloadURL, 'Provider getDownloadUrl failed for arwave dataset') - try { - await downloadFile(arwaveDownloadURL) - } catch (e) { - assert.fail(`Download arwave dataset failed: ${e}`) - } - const ipfsDownloadURL = await ProviderInstance.getDownloadUrl( - resolvedIpfsAssetDdo.id, - resolvedIpfsAssetDdo.services[0].id, - 0, - ipfsOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(ipfsDownloadURL, 'Provider getDownloadUrl failed for ipfs dataset') - try { - await downloadFile(ipfsDownloadURL) - } catch (e) { - assert.fail(`Download ipfs dataset failed ${e}`) - } - const onchainDownloadURL = await ProviderInstance.getDownloadUrl( - resolvedOnchainAssetDdo.id, - resolvedOnchainAssetDdo.services[0].id, - 0, - onchainOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(onchainDownloadURL, 'Provider getDownloadUrl failed for onchain dataset') - try { - await downloadFile(onchainDownloadURL) - } catch (e) { - assert.fail(`Download onchain dataset failed ${e}`) - } - const graphqlDownloadURL = await ProviderInstance.getDownloadUrl( - resolvedGraphqlAssetDdo.id, - resolvedGraphqlAssetDdo.services[0].id, - 0, - grapqlOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(graphqlDownloadURL, 'Provider getDownloadUrl failed for graphql dataset') - try { - await downloadFile(graphqlDownloadURL) - } catch (e) { - assert.fail(`Download graphql dataset failed ${e}`) - } - }) +it('Should download the datasets files', async () => { + const urlDownloadUrl = await ProviderInstance.getDownloadUrl( + resolvedUrlAssetDdo.id, + resolvedUrlAssetDdo.services[0].id, + 0, + urlOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(urlDownloadUrl, 'Provider getDownloadUrl failed for url dataset') + try { + await downloadFile(urlDownloadUrl) + } catch (e) { + assert.fail(`Download url dataset failed: ${e}`) + } + const arwaveDownloadURL = await ProviderInstance.getDownloadUrl( + resolvedArweaveAssetDdo.id, + resolvedArweaveAssetDdo.services[0].id, + 0, + arwaveOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(arwaveDownloadURL, 'Provider getDownloadUrl failed for arwave dataset') + try { + await downloadFile(arwaveDownloadURL) + } catch (e) { + assert.fail(`Download arwave dataset failed: ${e}`) + } + const ipfsDownloadURL = await ProviderInstance.getDownloadUrl( + resolvedIpfsAssetDdo.id, + resolvedIpfsAssetDdo.services[0].id, + 0, + ipfsOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(ipfsDownloadURL, 'Provider getDownloadUrl failed for ipfs dataset') + try { + await downloadFile(ipfsDownloadURL) + } catch (e) { + assert.fail(`Download ipfs dataset failed ${e}`) + } + const onchainDownloadURL = await ProviderInstance.getDownloadUrl( + resolvedOnchainAssetDdo.id, + resolvedOnchainAssetDdo.services[0].id, + 0, + onchainOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(onchainDownloadURL, 'Provider getDownloadUrl failed for onchain dataset') + try { + await downloadFile(onchainDownloadURL) + } catch (e) { + assert.fail(`Download onchain dataset failed ${e}`) + } + const graphqlDownloadURL = await ProviderInstance.getDownloadUrl( + resolvedGraphqlAssetDdo.id, + resolvedGraphqlAssetDdo.services[0].id, + 0, + grapqlOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(graphqlDownloadURL, 'Provider getDownloadUrl failed for graphql dataset') + try { + await downloadFile(graphqlDownloadURL) + } catch (e) { + assert.fail(`Download graphql dataset failed ${e}`) + } +}) - it('Should update url dataset', async () => { - resolvedUrlAssetDdo.metadata.name = 'updated url asset name' - const updateUrlTx = await updateAssetMetadata( - publisherAccount, - resolvedUrlAssetDdo, - providerUrl, - aquarius - ) - assert(updateUrlTx, 'Failed to update url asset metadata') - }) +it('Should update url dataset', async () => { + resolvedUrlAssetDdo.metadata.name = 'updated url asset name' + const updateUrlTx = await updateAssetMetadata( + publisherAccount, + resolvedUrlAssetDdo, + providerUrl, + aquarius + ) + assert(updateUrlTx, 'Failed to update url asset metadata') +}) - it('Should update arweave dataset', async () => { - resolvedArweaveAssetDdo.metadata.name = 'updated arwave asset name' - const updateArwaveTx = await updateAssetMetadata( - publisherAccount, - resolvedArweaveAssetDdo, - providerUrl, - aquarius - ) - assert(updateArwaveTx, 'Failed to update arwave asset metadata') - }) +it('Should update arweave dataset', async () => { + resolvedArweaveAssetDdo.metadata.name = 'updated arwave asset name' + const updateArwaveTx = await updateAssetMetadata( + publisherAccount, + resolvedArweaveAssetDdo, + providerUrl, + aquarius + ) + assert(updateArwaveTx, 'Failed to update arwave asset metadata') +}) - it('Should update ipfs dataset', async () => { - resolvedIpfsAssetDdo.metadata.name = 'updated ipfs asset name' - const updateIpfsTx = await updateAssetMetadata( - publisherAccount, - resolvedIpfsAssetDdo, - providerUrl, - aquarius - ) - assert(updateIpfsTx, 'Failed to update ipfs asset metadata') - }) +it('Should update ipfs dataset', async () => { + resolvedIpfsAssetDdo.metadata.name = 'updated ipfs asset name' + const updateIpfsTx = await updateAssetMetadata( + publisherAccount, + resolvedIpfsAssetDdo, + providerUrl, + aquarius + ) + assert(updateIpfsTx, 'Failed to update ipfs asset metadata') +}) - it('Should update onchain dataset', async () => { - resolvedOnchainAssetDdo.metadata.name = 'updated onchain asset name' - const updateOnchainTx = await updateAssetMetadata( - publisherAccount, - resolvedOnchainAssetDdo, - providerUrl, - aquarius - ) - assert(updateOnchainTx, 'Failed to update ipfs asset metadata') - }) +it('Should update onchain dataset', async () => { + resolvedOnchainAssetDdo.metadata.name = 'updated onchain asset name' + const updateOnchainTx = await updateAssetMetadata( + publisherAccount, + resolvedOnchainAssetDdo, + providerUrl, + aquarius + ) + assert(updateOnchainTx, 'Failed to update ipfs asset metadata') +}) - it('Should update graphql dataset', async () => { - resolvedGraphqlAssetDdo.metadata.name = 'updated graphql asset name' - const updateGraphqlTx = await updateAssetMetadata( - publisherAccount, - resolvedGraphqlAssetDdo, - providerUrl, - aquarius - ) - assert(updateGraphqlTx, 'Failed to update graphql asset metadata') - }) +it('Should update graphql dataset', async () => { + resolvedGraphqlAssetDdo.metadata.name = 'updated graphql asset name' + const updateGraphqlTx = await updateAssetMetadata( + publisherAccount, + resolvedGraphqlAssetDdo, + providerUrl, + aquarius + ) + assert(updateGraphqlTx, 'Failed to update graphql asset metadata') +}) - delay(10000) // let's wait for aquarius to index the updated ddo's +delay(10000) // let's wait for aquarius to index the updated ddo's - it('Should resolve updated datasets', async () => { - resolvedUrlAssetDdoAfterUpdate = await aquarius.waitForAqua(urlAssetId) - assert(resolvedUrlAssetDdoAfterUpdate, 'Cannot fetch url DDO from Aquarius') +it('Should resolve updated datasets', async () => { + resolvedUrlAssetDdoAfterUpdate = await aquarius.waitForAqua(urlAssetId) + assert(resolvedUrlAssetDdoAfterUpdate, 'Cannot fetch url DDO from Aquarius') - resolvedArweaveAssetDdoAfterUpdate = await aquarius.waitForAqua(arweaveAssetId) - assert(resolvedArweaveAssetDdoAfterUpdate, 'Cannot fetch arwave DDO from Aquarius') + resolvedArweaveAssetDdoAfterUpdate = await aquarius.waitForAqua(arweaveAssetId) + assert(resolvedArweaveAssetDdoAfterUpdate, 'Cannot fetch arwave DDO from Aquarius') - resolvedIpfsAssetDdoAfterUpdate = await aquarius.waitForAqua(ipfsAssetId) - assert(resolvedIpfsAssetDdoAfterUpdate, 'Cannot fetch ipfs DDO from Aquarius') + resolvedIpfsAssetDdoAfterUpdate = await aquarius.waitForAqua(ipfsAssetId) + assert(resolvedIpfsAssetDdoAfterUpdate, 'Cannot fetch ipfs DDO from Aquarius') - resolvedOnchainAssetDdoAfterUpdate = await aquarius.waitForAqua(onchainAssetId) - assert(resolvedOnchainAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius') + resolvedOnchainAssetDdoAfterUpdate = await aquarius.waitForAqua(onchainAssetId) + assert(resolvedOnchainAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius') - resolvedGraphqlAssetDdoAfterUpdate = await aquarius.waitForAqua(grapqlAssetId) - assert(resolvedGraphqlAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius') - }) + resolvedGraphqlAssetDdoAfterUpdate = await aquarius.waitForAqua(grapqlAssetId) + assert(resolvedGraphqlAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius') }) From 2d5f578e71a0b9b860f9cd85ca00f338f63ab0f5 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 19 Sep 2024 16:02:51 +0300 Subject: [PATCH 04/22] Upgrade Github actions. --- .github/workflows/ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce32863f0..226b01576 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,11 +16,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: '20' - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: @@ -35,11 +35,11 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: '20' - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: @@ -71,7 +71,7 @@ jobs: ls -la "$HOME/.ocean/ocean-contracts/artifacts/" - run: npm run build:metadata - run: npm run test:unit:cover - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: coverage path: coverage/ @@ -81,11 +81,11 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: '20' - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: @@ -143,7 +143,7 @@ jobs: run: docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1 && docker logs ocean_computetodata_1 if: ${{ failure() }} - name: Upload coverage - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: coverage path: coverage/ @@ -159,11 +159,11 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: @@ -180,7 +180,7 @@ jobs: if: ${{ success() && github.actor != 'dependabot[bot]' }} steps: - uses: actions/checkout@v3 - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: coverage @@ -197,7 +197,7 @@ jobs: needs: [test_unit, test_integration] steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: '20' @@ -222,7 +222,7 @@ jobs: # needs: [test_unit, test_integration] # steps: # - uses: actions/checkout@v3 - # - uses: actions/setup-node@v2 + # - uses: actions/setup-node@v4 # with: # node-version: '16' From 1377c722bba151d0190aeab5ee25ff5f5d9004bc Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Mon, 23 Sep 2024 13:17:01 +0300 Subject: [PATCH 05/22] fix graphql asset url. --- test/integration/PublishEditConsume.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 631f0bafb..64767123f 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -85,7 +85,7 @@ const grapqlFile: Files = { files: [ { type: 'graphql', - url: 'https://v4.subgraph.sepolia.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph', + url: 'https://v4.subgraph.sepolia.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql', query: `" query{ nfts(orderBy: createdTimestamp,orderDirection:desc){ From e8893833dfc02c6621c9ffb2ff30465c293a2cd2 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Mon, 23 Sep 2024 13:57:56 +0300 Subject: [PATCH 06/22] Fix cov. --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 226b01576..1f05b223a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,7 +73,7 @@ jobs: - run: npm run test:unit:cover - uses: actions/upload-artifact@v4 with: - name: coverage + name: coverage-unit path: coverage/ test_integration: @@ -145,7 +145,7 @@ jobs: - name: Upload coverage uses: actions/upload-artifact@v4 with: - name: coverage + name: coverage-integration path: coverage/ build: @@ -182,7 +182,10 @@ jobs: - uses: actions/checkout@v3 - uses: actions/download-artifact@v4 with: - name: coverage + name: coverage-unit + - uses: actions/download-artifact@v4 + with: + name: coverage-integration - uses: paambaati/codeclimate-action@v2.7.5 env: From 0b59175a45f09daa28408fa9d75fcdbed1f4a43b Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Mon, 23 Sep 2024 19:16:18 +0300 Subject: [PATCH 07/22] remove duplicate test. --- test/integration/PublishEditConsume.test.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 64767123f..7a263d034 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -235,7 +235,7 @@ describe('Publish consume test', async () => { addresses.ERC721Factory, aquarius ) - assert(urlAssetId, 'Failed to arwave publish DDO') + assert(arweaveAssetId, 'Failed to arwave publish DDO') const ipfsCID = await uploadToIpfs(JSON.stringify(assetDdo)) const ipfsFile: Files = { datatokenAddress: '0x0', @@ -260,20 +260,6 @@ describe('Publish consume test', async () => { assert(ipfsAssetId, 'Failed to publish ipfs DDO') }) -it('Should publish arwave asset', async () => { - arweaveAssetId = await createAsset( - 'ArweaveDatatoken', - 'ARWEAVEDT', - publisherAccount, - arweaveFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(arweaveAssetId, 'Failed to publish ipfs DDO') -}) - it('Should publish onchain asset', async () => { const chainFile: Smartcontract = { type: 'smartcontract', From 4efc4600042cfea82f071217e4309f4bd5184e5d Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Tue, 24 Sep 2024 16:39:30 +0300 Subject: [PATCH 08/22] Surround by it block. --- test/integration/PublishEditConsume.test.ts | 657 ++++++++++---------- 1 file changed, 330 insertions(+), 327 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 7a263d034..d1c911dca 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -224,354 +224,357 @@ describe('Publish consume test', async () => { ) assert(urlAssetId, 'Failed to publish url DDO') }) + it('Should publish arweave asset', async () => { + arweaveAssetId = await createAsset( + 'ArwaveDatatoken', + 'ARWAVEDT', + publisherAccount, + arweaveFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(arweaveAssetId, 'Failed to arwave publish DDO') + }) + it('Should publish arweave asset', async () => { + const ipfsCID = await uploadToIpfs(JSON.stringify(assetDdo)) + const ipfsFile: Files = { + datatokenAddress: '0x0', + nftAddress: '0x0', + files: [ + { + type: 'ipfs', + hash: ipfsCID + } + ] + } + ipfsAssetId = await createAsset( + 'IpfsDatatoken', + 'IPFSDT', + publisherAccount, + ipfsFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(ipfsAssetId, 'Failed to publish ipfs DDO') + }) - arweaveAssetId = await createAsset( - 'ArwaveDatatoken', - 'ARWAVEDT', - publisherAccount, - arweaveFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(arweaveAssetId, 'Failed to arwave publish DDO') - const ipfsCID = await uploadToIpfs(JSON.stringify(assetDdo)) - const ipfsFile: Files = { - datatokenAddress: '0x0', - nftAddress: '0x0', - files: [ - { - type: 'ipfs', - hash: ipfsCID - } - ] - } - ipfsAssetId = await createAsset( - 'IpfsDatatoken', - 'IPFSDT', - publisherAccount, - ipfsFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(ipfsAssetId, 'Failed to publish ipfs DDO') -}) + it('Should publish onchain asset', async () => { + const chainFile: Smartcontract = { + type: 'smartcontract', + address: addresses.Router, + abi: { + inputs: [], + name: 'swapOceanFee', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function' + }, + chainId: 8996 + } + onchainFile.files[0] = chainFile + onchainAssetId = await createAsset( + 'ChainDatatoken', + 'CHAINDT', + publisherAccount, + onchainFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(onchainAssetId, 'Failed to publish onchain DDO') + }) -it('Should publish onchain asset', async () => { - const chainFile: Smartcontract = { - type: 'smartcontract', - address: addresses.Router, - abi: { - inputs: [], - name: 'swapOceanFee', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - }, - chainId: 8996 - } - onchainFile.files[0] = chainFile - onchainAssetId = await createAsset( - 'ChainDatatoken', - 'CHAINDT', - publisherAccount, - onchainFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(onchainAssetId, 'Failed to publish onchain DDO') -}) + it('Should publish graphql asset', async () => { + grapqlAssetId = await createAsset( + 'GraphDatatoken', + 'GRAPHDT', + publisherAccount, + grapqlFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(grapqlAssetId, 'Failed to publish graphql DDO') + }) -it('Should publish graphql asset', async () => { - grapqlAssetId = await createAsset( - 'GraphDatatoken', - 'GRAPHDT', - publisherAccount, - grapqlFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(grapqlAssetId, 'Failed to publish graphql DDO') -}) + delay(10000) // let's wait for aquarius to index the assets -delay(10000) // let's wait for aquarius to index the assets + it('Resolve published assets', async () => { + resolvedUrlAssetDdo = await aquarius.waitForAqua(urlAssetId) + assert(resolvedUrlAssetDdo, 'Cannot fetch url DDO from Aquarius') -it('Resolve published assets', async () => { - resolvedUrlAssetDdo = await aquarius.waitForAqua(urlAssetId) - assert(resolvedUrlAssetDdo, 'Cannot fetch url DDO from Aquarius') + resolvedArweaveAssetDdo = await aquarius.waitForAqua(arweaveAssetId) + assert(resolvedArweaveAssetDdo, 'Cannot fetch arwave DDO from Aquarius') - resolvedArweaveAssetDdo = await aquarius.waitForAqua(arweaveAssetId) - assert(resolvedArweaveAssetDdo, 'Cannot fetch arwave DDO from Aquarius') + resolvedIpfsAssetDdo = await aquarius.waitForAqua(ipfsAssetId) + assert(resolvedIpfsAssetDdo, 'Cannot fetch ipfs DDO from Aquarius') - resolvedIpfsAssetDdo = await aquarius.waitForAqua(ipfsAssetId) - assert(resolvedIpfsAssetDdo, 'Cannot fetch ipfs DDO from Aquarius') + resolvedOnchainAssetDdo = await aquarius.waitForAqua(onchainAssetId) + assert(resolvedOnchainAssetDdo, 'Cannot fetch onchain DDO from Aquarius') - resolvedOnchainAssetDdo = await aquarius.waitForAqua(onchainAssetId) - assert(resolvedOnchainAssetDdo, 'Cannot fetch onchain DDO from Aquarius') + resolvedGraphqlAssetDdo = await aquarius.waitForAqua(grapqlAssetId) + assert(resolvedGraphqlAssetDdo, 'Cannot fetch graphql DDO from Aquarius') + }) - resolvedGraphqlAssetDdo = await aquarius.waitForAqua(grapqlAssetId) - assert(resolvedGraphqlAssetDdo, 'Cannot fetch graphql DDO from Aquarius') -}) + it('Mint datasets datatokens to publisher', async () => { + datatoken = new Datatoken(publisherAccount, config.chainId) + const urlMintTx = await datatoken.mint( + resolvedUrlAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(urlMintTx, 'Failed minting url datatoken to consumer.') -it('Mint datasets datatokens to publisher', async () => { - datatoken = new Datatoken(publisherAccount, config.chainId) - const urlMintTx = await datatoken.mint( - resolvedUrlAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(urlMintTx, 'Failed minting url datatoken to consumer.') - - const arwaveMintTx = await datatoken.mint( - resolvedArweaveAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(arwaveMintTx, 'Failed minting arwave datatoken to consumer.') - - const ipfsMintTx = await datatoken.mint( - resolvedIpfsAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(ipfsMintTx, 'Failed minting ipfs datatoken to consumer.') - - const onchainMintTx = await datatoken.mint( - resolvedOnchainAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(onchainMintTx, 'Failed minting onchain datatoken to consumer.') - - const graphqlMintTx = await datatoken.mint( - resolvedGraphqlAssetDdo.services[0].datatokenAddress, - await publisherAccount.getAddress(), - '10', - await consumerAccount.getAddress() - ) - assert(graphqlMintTx, 'Failed minting graphql datatoken to consumer.') -}) + const arwaveMintTx = await datatoken.mint( + resolvedArweaveAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(arwaveMintTx, 'Failed minting arwave datatoken to consumer.') -it('Should order url dataset', async () => { - datatoken = new Datatoken(consumerAccount, config.chainId) - urlOrderTx = await orderAsset( - resolvedUrlAssetDdo.id, - resolvedUrlAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedUrlAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(urlOrderTx, 'Ordering url dataset failed.') -}).timeout(40000) - -it('Should order arweave dataset', async () => { - arwaveOrderTx = await orderAsset( - resolvedArweaveAssetDdo.id, - resolvedArweaveAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedArweaveAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(arwaveOrderTx, 'Ordering arwave dataset failed.') -}).timeout(40000) - -it('Should order ipfs dataset', async () => { - ipfsOrderTx = await orderAsset( - resolvedIpfsAssetDdo.id, - resolvedIpfsAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedIpfsAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') -}).timeout(40000) - -it('Should order onchain dataset', async () => { - onchainOrderTx = await orderAsset( - resolvedOnchainAssetDdo.id, - resolvedOnchainAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedOnchainAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(onchainOrderTx, 'Ordering onchain dataset failed.') -}).timeout(40000) - -it('Should order graphQl dataset', async () => { - grapqlOrderTx = await orderAsset( - resolvedGraphqlAssetDdo.id, - resolvedGraphqlAssetDdo.services[0].datatokenAddress, - await consumerAccount.getAddress(), - resolvedGraphqlAssetDdo.services[0].id, - 0, - datatoken, - providerUrl - ) - assert(grapqlOrderTx, 'Ordering graphql dataset failed.') -}) + const ipfsMintTx = await datatoken.mint( + resolvedIpfsAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(ipfsMintTx, 'Failed minting ipfs datatoken to consumer.') -it('Should download the datasets files', async () => { - const urlDownloadUrl = await ProviderInstance.getDownloadUrl( - resolvedUrlAssetDdo.id, - resolvedUrlAssetDdo.services[0].id, - 0, - urlOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(urlDownloadUrl, 'Provider getDownloadUrl failed for url dataset') - try { - await downloadFile(urlDownloadUrl) - } catch (e) { - assert.fail(`Download url dataset failed: ${e}`) - } - const arwaveDownloadURL = await ProviderInstance.getDownloadUrl( - resolvedArweaveAssetDdo.id, - resolvedArweaveAssetDdo.services[0].id, - 0, - arwaveOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(arwaveDownloadURL, 'Provider getDownloadUrl failed for arwave dataset') - try { - await downloadFile(arwaveDownloadURL) - } catch (e) { - assert.fail(`Download arwave dataset failed: ${e}`) - } - const ipfsDownloadURL = await ProviderInstance.getDownloadUrl( - resolvedIpfsAssetDdo.id, - resolvedIpfsAssetDdo.services[0].id, - 0, - ipfsOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(ipfsDownloadURL, 'Provider getDownloadUrl failed for ipfs dataset') - try { - await downloadFile(ipfsDownloadURL) - } catch (e) { - assert.fail(`Download ipfs dataset failed ${e}`) - } - const onchainDownloadURL = await ProviderInstance.getDownloadUrl( - resolvedOnchainAssetDdo.id, - resolvedOnchainAssetDdo.services[0].id, - 0, - onchainOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(onchainDownloadURL, 'Provider getDownloadUrl failed for onchain dataset') - try { - await downloadFile(onchainDownloadURL) - } catch (e) { - assert.fail(`Download onchain dataset failed ${e}`) - } - const graphqlDownloadURL = await ProviderInstance.getDownloadUrl( - resolvedGraphqlAssetDdo.id, - resolvedGraphqlAssetDdo.services[0].id, - 0, - grapqlOrderTx.transactionHash, - providerUrl, - consumerAccount - ) - assert(graphqlDownloadURL, 'Provider getDownloadUrl failed for graphql dataset') - try { - await downloadFile(graphqlDownloadURL) - } catch (e) { - assert.fail(`Download graphql dataset failed ${e}`) - } -}) + const onchainMintTx = await datatoken.mint( + resolvedOnchainAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(onchainMintTx, 'Failed minting onchain datatoken to consumer.') -it('Should update url dataset', async () => { - resolvedUrlAssetDdo.metadata.name = 'updated url asset name' - const updateUrlTx = await updateAssetMetadata( - publisherAccount, - resolvedUrlAssetDdo, - providerUrl, - aquarius - ) - assert(updateUrlTx, 'Failed to update url asset metadata') -}) + const graphqlMintTx = await datatoken.mint( + resolvedGraphqlAssetDdo.services[0].datatokenAddress, + await publisherAccount.getAddress(), + '10', + await consumerAccount.getAddress() + ) + assert(graphqlMintTx, 'Failed minting graphql datatoken to consumer.') + }) -it('Should update arweave dataset', async () => { - resolvedArweaveAssetDdo.metadata.name = 'updated arwave asset name' - const updateArwaveTx = await updateAssetMetadata( - publisherAccount, - resolvedArweaveAssetDdo, - providerUrl, - aquarius - ) - assert(updateArwaveTx, 'Failed to update arwave asset metadata') -}) + it('Should order url dataset', async () => { + datatoken = new Datatoken(consumerAccount, config.chainId) + urlOrderTx = await orderAsset( + resolvedUrlAssetDdo.id, + resolvedUrlAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedUrlAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(urlOrderTx, 'Ordering url dataset failed.') + }).timeout(40000) -it('Should update ipfs dataset', async () => { - resolvedIpfsAssetDdo.metadata.name = 'updated ipfs asset name' - const updateIpfsTx = await updateAssetMetadata( - publisherAccount, - resolvedIpfsAssetDdo, - providerUrl, - aquarius - ) - assert(updateIpfsTx, 'Failed to update ipfs asset metadata') -}) + it('Should order arweave dataset', async () => { + arwaveOrderTx = await orderAsset( + resolvedArweaveAssetDdo.id, + resolvedArweaveAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedArweaveAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(arwaveOrderTx, 'Ordering arwave dataset failed.') + }).timeout(40000) -it('Should update onchain dataset', async () => { - resolvedOnchainAssetDdo.metadata.name = 'updated onchain asset name' - const updateOnchainTx = await updateAssetMetadata( - publisherAccount, - resolvedOnchainAssetDdo, - providerUrl, - aquarius - ) - assert(updateOnchainTx, 'Failed to update ipfs asset metadata') -}) + it('Should order ipfs dataset', async () => { + ipfsOrderTx = await orderAsset( + resolvedIpfsAssetDdo.id, + resolvedIpfsAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedIpfsAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') + }).timeout(40000) -it('Should update graphql dataset', async () => { - resolvedGraphqlAssetDdo.metadata.name = 'updated graphql asset name' - const updateGraphqlTx = await updateAssetMetadata( - publisherAccount, - resolvedGraphqlAssetDdo, - providerUrl, - aquarius - ) - assert(updateGraphqlTx, 'Failed to update graphql asset metadata') -}) + it('Should order onchain dataset', async () => { + onchainOrderTx = await orderAsset( + resolvedOnchainAssetDdo.id, + resolvedOnchainAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedOnchainAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(onchainOrderTx, 'Ordering onchain dataset failed.') + }).timeout(40000) + + it('Should order graphQl dataset', async () => { + grapqlOrderTx = await orderAsset( + resolvedGraphqlAssetDdo.id, + resolvedGraphqlAssetDdo.services[0].datatokenAddress, + await consumerAccount.getAddress(), + resolvedGraphqlAssetDdo.services[0].id, + 0, + datatoken, + providerUrl + ) + assert(grapqlOrderTx, 'Ordering graphql dataset failed.') + }) + + it('Should download the datasets files', async () => { + const urlDownloadUrl = await ProviderInstance.getDownloadUrl( + resolvedUrlAssetDdo.id, + resolvedUrlAssetDdo.services[0].id, + 0, + urlOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(urlDownloadUrl, 'Provider getDownloadUrl failed for url dataset') + try { + await downloadFile(urlDownloadUrl) + } catch (e) { + assert.fail(`Download url dataset failed: ${e}`) + } + const arwaveDownloadURL = await ProviderInstance.getDownloadUrl( + resolvedArweaveAssetDdo.id, + resolvedArweaveAssetDdo.services[0].id, + 0, + arwaveOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(arwaveDownloadURL, 'Provider getDownloadUrl failed for arwave dataset') + try { + await downloadFile(arwaveDownloadURL) + } catch (e) { + assert.fail(`Download arwave dataset failed: ${e}`) + } + const ipfsDownloadURL = await ProviderInstance.getDownloadUrl( + resolvedIpfsAssetDdo.id, + resolvedIpfsAssetDdo.services[0].id, + 0, + ipfsOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(ipfsDownloadURL, 'Provider getDownloadUrl failed for ipfs dataset') + try { + await downloadFile(ipfsDownloadURL) + } catch (e) { + assert.fail(`Download ipfs dataset failed ${e}`) + } + const onchainDownloadURL = await ProviderInstance.getDownloadUrl( + resolvedOnchainAssetDdo.id, + resolvedOnchainAssetDdo.services[0].id, + 0, + onchainOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(onchainDownloadURL, 'Provider getDownloadUrl failed for onchain dataset') + try { + await downloadFile(onchainDownloadURL) + } catch (e) { + assert.fail(`Download onchain dataset failed ${e}`) + } + const graphqlDownloadURL = await ProviderInstance.getDownloadUrl( + resolvedGraphqlAssetDdo.id, + resolvedGraphqlAssetDdo.services[0].id, + 0, + grapqlOrderTx.transactionHash, + providerUrl, + consumerAccount + ) + assert(graphqlDownloadURL, 'Provider getDownloadUrl failed for graphql dataset') + try { + await downloadFile(graphqlDownloadURL) + } catch (e) { + assert.fail(`Download graphql dataset failed ${e}`) + } + }) + + it('Should update url dataset', async () => { + resolvedUrlAssetDdo.metadata.name = 'updated url asset name' + const updateUrlTx = await updateAssetMetadata( + publisherAccount, + resolvedUrlAssetDdo, + providerUrl, + aquarius + ) + assert(updateUrlTx, 'Failed to update url asset metadata') + }) + + it('Should update arweave dataset', async () => { + resolvedArweaveAssetDdo.metadata.name = 'updated arwave asset name' + const updateArwaveTx = await updateAssetMetadata( + publisherAccount, + resolvedArweaveAssetDdo, + providerUrl, + aquarius + ) + assert(updateArwaveTx, 'Failed to update arwave asset metadata') + }) + + it('Should update ipfs dataset', async () => { + resolvedIpfsAssetDdo.metadata.name = 'updated ipfs asset name' + const updateIpfsTx = await updateAssetMetadata( + publisherAccount, + resolvedIpfsAssetDdo, + providerUrl, + aquarius + ) + assert(updateIpfsTx, 'Failed to update ipfs asset metadata') + }) -delay(10000) // let's wait for aquarius to index the updated ddo's + it('Should update onchain dataset', async () => { + resolvedOnchainAssetDdo.metadata.name = 'updated onchain asset name' + const updateOnchainTx = await updateAssetMetadata( + publisherAccount, + resolvedOnchainAssetDdo, + providerUrl, + aquarius + ) + assert(updateOnchainTx, 'Failed to update ipfs asset metadata') + }) -it('Should resolve updated datasets', async () => { - resolvedUrlAssetDdoAfterUpdate = await aquarius.waitForAqua(urlAssetId) - assert(resolvedUrlAssetDdoAfterUpdate, 'Cannot fetch url DDO from Aquarius') + it('Should update graphql dataset', async () => { + resolvedGraphqlAssetDdo.metadata.name = 'updated graphql asset name' + const updateGraphqlTx = await updateAssetMetadata( + publisherAccount, + resolvedGraphqlAssetDdo, + providerUrl, + aquarius + ) + assert(updateGraphqlTx, 'Failed to update graphql asset metadata') + }) - resolvedArweaveAssetDdoAfterUpdate = await aquarius.waitForAqua(arweaveAssetId) - assert(resolvedArweaveAssetDdoAfterUpdate, 'Cannot fetch arwave DDO from Aquarius') + delay(10000) // let's wait for aquarius to index the updated ddo's - resolvedIpfsAssetDdoAfterUpdate = await aquarius.waitForAqua(ipfsAssetId) - assert(resolvedIpfsAssetDdoAfterUpdate, 'Cannot fetch ipfs DDO from Aquarius') + it('Should resolve updated datasets', async () => { + resolvedUrlAssetDdoAfterUpdate = await aquarius.waitForAqua(urlAssetId) + assert(resolvedUrlAssetDdoAfterUpdate, 'Cannot fetch url DDO from Aquarius') - resolvedOnchainAssetDdoAfterUpdate = await aquarius.waitForAqua(onchainAssetId) - assert(resolvedOnchainAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius') + resolvedArweaveAssetDdoAfterUpdate = await aquarius.waitForAqua(arweaveAssetId) + assert(resolvedArweaveAssetDdoAfterUpdate, 'Cannot fetch arwave DDO from Aquarius') - resolvedGraphqlAssetDdoAfterUpdate = await aquarius.waitForAqua(grapqlAssetId) - assert(resolvedGraphqlAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius') + resolvedIpfsAssetDdoAfterUpdate = await aquarius.waitForAqua(ipfsAssetId) + assert(resolvedIpfsAssetDdoAfterUpdate, 'Cannot fetch ipfs DDO from Aquarius') + + resolvedOnchainAssetDdoAfterUpdate = await aquarius.waitForAqua(onchainAssetId) + assert(resolvedOnchainAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius') + + resolvedGraphqlAssetDdoAfterUpdate = await aquarius.waitForAqua(grapqlAssetId) + assert(resolvedGraphqlAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius') + }) }) From 19ae7ca3a3b2cdca60489ae08ad3ba30e6e89cc2 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Wed, 25 Sep 2024 12:05:50 +0300 Subject: [PATCH 09/22] debug log. --- test/integration/PublishEditConsume.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index d1c911dca..be6cfecb0 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -152,6 +152,7 @@ function uploadToIpfs(data: any): Promise { } ) .then(function (response: any) { + console.log('hash: ', response.data.Hash) resolve(response.data.Hash) }) .catch(function (error: any) { From 0d1612419aad8743724b5b2dc672be989dc56cfb Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Wed, 25 Sep 2024 12:12:05 +0300 Subject: [PATCH 10/22] added docker logs only for ipfs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b62ae126..933cca032 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,7 +140,7 @@ jobs: env: PROVIDER_URL: 'http://172.15.0.4:8030' - name: docker logs - run: docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1 && docker logs ocean_computetodata_1 + run: docker logs ocean-ipfs-1 if: ${{ failure() }} - name: Upload coverage uses: actions/upload-artifact@v4 From 3e56c047fc0269d0cc0fb61dbe8f965804da32fb Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Wed, 25 Sep 2024 12:38:22 +0300 Subject: [PATCH 11/22] increase timeout. --- test/integration/PublishEditConsume.test.ts | 2 +- test/integration/helpers.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index be6cfecb0..292a7a6a4 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -404,7 +404,7 @@ describe('Publish consume test', async () => { providerUrl ) assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') - }).timeout(40000) + }).timeout(70000) it('Should order onchain dataset', async () => { onchainOrderTx = await orderAsset( diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index e3e097c81..b2b09f463 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -200,6 +200,7 @@ export async function orderAsset( 0, providerFees ) + console.log(tx) const orderTx = await tx.wait() const orderStartedTx = getEventFromTx(orderTx, 'OrderStarted') return orderStartedTx From e363eadd575a41d3ba2ec96d4ed2347673a1d405 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Wed, 25 Sep 2024 15:56:37 +0300 Subject: [PATCH 12/22] debug log. --- test/integration/helpers.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index b2b09f463..f42ecb143 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -182,6 +182,8 @@ export async function orderAsset( providerUrl ) + console.log(initializeData) + const providerFees: ProviderFees = { providerFeeAddress: initializeData.providerFee.providerFeeAddress, providerFeeToken: initializeData.providerFee.providerFeeToken, @@ -200,7 +202,6 @@ export async function orderAsset( 0, providerFees ) - console.log(tx) const orderTx = await tx.wait() const orderStartedTx = getEventFromTx(orderTx, 'OrderStarted') return orderStartedTx From 676c328af44e1f617556aef0355bd2cf92c43854 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Wed, 25 Sep 2024 22:49:00 +0300 Subject: [PATCH 13/22] Changed to ipfs cluster. --- test/integration/PublishEditConsume.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 292a7a6a4..c25cc2800 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -140,7 +140,7 @@ function uploadToIpfs(data: any): Promise { return new Promise((resolve, reject) => { axios .post( - 'http://172.15.0.16:5001/api/v0/add', + 'https://ipfs.oceanprotocol.com/ipfs/api/v0/add', '--------------------------a28d68b1c872c96f\r\nContent-Disposition: form-data; name="file"; filename="ddo.json"\r\nContent-Type: application/octet-stream\r\n\r\n' + data + '\r\n--------------------------a28d68b1c872c96f--\r\n', From b1f2c6801c973ee0dd5e7fddb62846c3145876bc Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Wed, 25 Sep 2024 23:00:30 +0300 Subject: [PATCH 14/22] roll back. --- test/integration/PublishEditConsume.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index c25cc2800..292a7a6a4 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -140,7 +140,7 @@ function uploadToIpfs(data: any): Promise { return new Promise((resolve, reject) => { axios .post( - 'https://ipfs.oceanprotocol.com/ipfs/api/v0/add', + 'http://172.15.0.16:5001/api/v0/add', '--------------------------a28d68b1c872c96f\r\nContent-Disposition: form-data; name="file"; filename="ddo.json"\r\nContent-Type: application/octet-stream\r\n\r\n' + data + '\r\n--------------------------a28d68b1c872c96f--\r\n', From 53d17a2106c040260f2168ec61a143bb02085e47 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 26 Sep 2024 07:44:41 +0300 Subject: [PATCH 15/22] put in the same test with arweave. --- test/integration/PublishEditConsume.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 292a7a6a4..397742fff 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -391,9 +391,7 @@ describe('Publish consume test', async () => { providerUrl ) assert(arwaveOrderTx, 'Ordering arwave dataset failed.') - }).timeout(40000) - - it('Should order ipfs dataset', async () => { + setTimeout(() => {}, 100) ipfsOrderTx = await orderAsset( resolvedIpfsAssetDdo.id, resolvedIpfsAssetDdo.services[0].datatokenAddress, @@ -404,7 +402,11 @@ describe('Publish consume test', async () => { providerUrl ) assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') - }).timeout(70000) + }).timeout(50000) + + // it('Should order ipfs dataset', async () => { + + // }).timeout(70000) it('Should order onchain dataset', async () => { onchainOrderTx = await orderAsset( From abcbedda4175b4aa8cba1d63292a0b6a0b063cd3 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 26 Sep 2024 08:00:42 +0300 Subject: [PATCH 16/22] debug. --- test/integration/PublishEditConsume.test.ts | 11 +++++------ test/integration/helpers.ts | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 397742fff..bba73017f 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -391,7 +391,10 @@ describe('Publish consume test', async () => { providerUrl ) assert(arwaveOrderTx, 'Ordering arwave dataset failed.') - setTimeout(() => {}, 100) + }).timeout(40000) + + it('Should order ipfs dataset', async () => { + console.log(resolvedIpfsAssetDdo) ipfsOrderTx = await orderAsset( resolvedIpfsAssetDdo.id, resolvedIpfsAssetDdo.services[0].datatokenAddress, @@ -402,11 +405,7 @@ describe('Publish consume test', async () => { providerUrl ) assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') - }).timeout(50000) - - // it('Should order ipfs dataset', async () => { - - // }).timeout(70000) + }).timeout(40000) it('Should order onchain dataset', async () => { onchainOrderTx = await orderAsset( diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index f42ecb143..1e08bebba 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -174,6 +174,7 @@ export async function orderAsset( datatoken: Datatoken, providerUrl: string ) { + console.log(did) const initializeData = await ProviderInstance.initialize( did, serviceId, @@ -182,8 +183,6 @@ export async function orderAsset( providerUrl ) - console.log(initializeData) - const providerFees: ProviderFees = { providerFeeAddress: initializeData.providerFee.providerFeeAddress, providerFeeToken: initializeData.providerFee.providerFeeToken, From 7093fdc4cb2057871b885cb22ffb8eb093cd37f0 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 26 Sep 2024 08:15:11 +0300 Subject: [PATCH 17/22] Log initialize url. --- src/services/Provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/Provider.ts b/src/services/Provider.ts index ae00cea12..e588c1908 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -372,7 +372,7 @@ export class Provider { let initializeUrl = this.getEndpointURL(serviceEndpoints, 'initialize') ? this.getEndpointURL(serviceEndpoints, 'initialize').urlPath : null - + console.log(initializeUrl) if (!initializeUrl) return null initializeUrl += `?documentId=${did}` initializeUrl += `&serviceId=${serviceId}` From d0a4b74ff38c7f1cecec111c867045f6a193d3b2 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 26 Sep 2024 08:16:22 +0300 Subject: [PATCH 18/22] logs. --- src/services/Provider.ts | 1 + test/integration/PublishEditConsume.test.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/Provider.ts b/src/services/Provider.ts index e588c1908..672ce1183 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -389,6 +389,7 @@ export class Provider { headers: { 'Content-Type': 'application/json' }, signal }) + console.log(response) } catch (e) { LoggerInstance.error('Provider initialized failed: ') LoggerInstance.error(e) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index bba73017f..be6cfecb0 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -394,7 +394,6 @@ describe('Publish consume test', async () => { }).timeout(40000) it('Should order ipfs dataset', async () => { - console.log(resolvedIpfsAssetDdo) ipfsOrderTx = await orderAsset( resolvedIpfsAssetDdo.id, resolvedIpfsAssetDdo.services[0].datatokenAddress, From 8314d4dd1c8a9954ebfcf99a9f48b3a862433d6f Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Thu, 26 Sep 2024 09:05:36 +0300 Subject: [PATCH 19/22] tweak condition. --- src/services/Provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/Provider.ts b/src/services/Provider.ts index 672ce1183..0ff35fda1 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -395,7 +395,7 @@ export class Provider { LoggerInstance.error(e) throw new Error(`Provider initialize failed url: ${initializeUrl} `) } - if (response?.ok) { + if (response?.status === 200) { const results: ProviderInitialize = await response.json() return results } From a405b0a6aea5286ab5498966bcc69ce1ea2dbc3e Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Fri, 27 Sep 2024 11:58:54 +0300 Subject: [PATCH 20/22] changed cid with the one from cluster. --- test/integration/PublishEditConsume.test.ts | 47 +++++---------------- 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index be6cfecb0..c656eace5 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -73,6 +73,17 @@ const arweaveFile: Files = { ] } +const ipfsFile: Files = { + datatokenAddress: '0x0', + nftAddress: '0x0', + files: [ + { + type: 'ipfs', + hash: 'QmRhsp7eghZtW4PktPC2wAHdKoy2LiF1n6UXMKmAhqQJUA' + } + ] +} + const onchainFile: Files = { datatokenAddress: '0x0', nftAddress: '0x0', @@ -136,31 +147,6 @@ function delay(interval: number) { }).timeout(interval + 100) } -function uploadToIpfs(data: any): Promise { - return new Promise((resolve, reject) => { - axios - .post( - 'http://172.15.0.16:5001/api/v0/add', - '--------------------------a28d68b1c872c96f\r\nContent-Disposition: form-data; name="file"; filename="ddo.json"\r\nContent-Type: application/octet-stream\r\n\r\n' + - data + - '\r\n--------------------------a28d68b1c872c96f--\r\n', - { - headers: { - 'Content-Type': - 'multipart/form-data; boundary=------------------------a28d68b1c872c96f' - } - } - ) - .then(function (response: any) { - console.log('hash: ', response.data.Hash) - resolve(response.data.Hash) - }) - .catch(function (error: any) { - reject(error) - }) - }) -} - describe('Publish consume test', async () => { before(async () => { publisherAccount = (await provider.getSigner(0)) as Signer @@ -239,17 +225,6 @@ describe('Publish consume test', async () => { assert(arweaveAssetId, 'Failed to arwave publish DDO') }) it('Should publish arweave asset', async () => { - const ipfsCID = await uploadToIpfs(JSON.stringify(assetDdo)) - const ipfsFile: Files = { - datatokenAddress: '0x0', - nftAddress: '0x0', - files: [ - { - type: 'ipfs', - hash: ipfsCID - } - ] - } ipfsAssetId = await createAsset( 'IpfsDatatoken', 'IPFSDT', From f02e42801942c23117446ee2834172c8d7271e42 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Mon, 30 Sep 2024 11:54:30 +0300 Subject: [PATCH 21/22] Rename test. Added back uploading in ipfs. --- test/integration/PublishEditConsume.test.ts | 49 ++++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index c656eace5..1c7b99571 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -73,17 +73,6 @@ const arweaveFile: Files = { ] } -const ipfsFile: Files = { - datatokenAddress: '0x0', - nftAddress: '0x0', - files: [ - { - type: 'ipfs', - hash: 'QmRhsp7eghZtW4PktPC2wAHdKoy2LiF1n6UXMKmAhqQJUA' - } - ] -} - const onchainFile: Files = { datatokenAddress: '0x0', nftAddress: '0x0', @@ -147,6 +136,31 @@ function delay(interval: number) { }).timeout(interval + 100) } +function uploadToIpfs(data: any): Promise { + return new Promise((resolve, reject) => { + axios + .post( + 'http://172.15.0.16:5001/api/v0/add', + '--------------------------a28d68b1c872c96f\r\nContent-Disposition: form-data; name="file"; filename="ddo.json"\r\nContent-Type: application/octet-stream\r\n\r\n' + + data + + '\r\n--------------------------a28d68b1c872c96f--\r\n', + { + headers: { + 'Content-Type': + 'multipart/form-data; boundary=------------------------a28d68b1c872c96f' + } + } + ) + .then(function (response: any) { + console.log('hash: ', response.data.Hash) + resolve(response.data.Hash) + }) + .catch(function (error: any) { + reject(error) + }) + }) +} + describe('Publish consume test', async () => { before(async () => { publisherAccount = (await provider.getSigner(0)) as Signer @@ -224,7 +238,18 @@ describe('Publish consume test', async () => { ) assert(arweaveAssetId, 'Failed to arwave publish DDO') }) - it('Should publish arweave asset', async () => { + it('Should publish ipfs asset', async () => { + const ipfsCID = await uploadToIpfs(JSON.stringify(assetDdo)) + const ipfsFile: Files = { + datatokenAddress: '0x0', + nftAddress: '0x0', + files: [ + { + type: 'ipfs', + hash: ipfsCID + } + ] + } ipfsAssetId = await createAsset( 'IpfsDatatoken', 'IPFSDT', From a690f6d12fac3c02c10aee6b9d763149c808b207 Mon Sep 17 00:00:00 2001 From: mariacarmina Date: Tue, 8 Oct 2024 15:23:51 +0300 Subject: [PATCH 22/22] Fix review. --- .github/workflows/ci.yml | 2 +- package-lock.json | 77 ++------------------- package.json | 1 - src/services/Provider.ts | 3 +- test/integration/PublishEditConsume.test.ts | 27 ++++---- test/integration/helpers.ts | 1 - 6 files changed, 18 insertions(+), 93 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 933cca032..2b62ae126 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,7 +140,7 @@ jobs: env: PROVIDER_URL: 'http://172.15.0.4:8030' - name: docker logs - run: docker logs ocean-ipfs-1 + run: docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1 && docker logs ocean_computetodata_1 if: ${{ failure() }} - name: Upload coverage uses: actions/upload-artifact@v4 diff --git a/package-lock.json b/package-lock.json index b9c40035c..f5381bb1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "3.3.3", "license": "Apache-2.0", "dependencies": { - "axios": "^1.7.7", "@oasisprotocol/sapphire-paratime": "^1.3.2", "@oceanprotocol/contracts": "^2.2.0", "cross-fetch": "^4.0.0", @@ -4500,17 +4499,6 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, - "node_modules/axios": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", - "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -8679,26 +8667,6 @@ "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", "dev": true }, - "node_modules/follow-redirects": { - "version": "1.15.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", - "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "license": "MIT", - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -8728,20 +8696,6 @@ "node": "*" } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/form-data-encoder": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", @@ -14083,7 +14037,8 @@ "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true }, "node_modules/prr": { "version": "1.0.1", @@ -21063,16 +21018,6 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, - "axios": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", - "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", - "requires": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -24329,11 +24274,6 @@ "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", "dev": true }, - "follow-redirects": { - "version": "1.15.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", - "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==" - }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -24357,16 +24297,6 @@ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, "form-data-encoder": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", @@ -28300,7 +28230,8 @@ "proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true }, "prr": { "version": "1.0.1", diff --git a/package.json b/package.json index 43f2907f1..b8e0e1ce1 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,6 @@ "web3": "^1.8.0" }, "dependencies": { - "axios": "^1.7.7", "@oasisprotocol/sapphire-paratime": "^1.3.2", "@oceanprotocol/contracts": "^2.2.0", "cross-fetch": "^4.0.0", diff --git a/src/services/Provider.ts b/src/services/Provider.ts index 0ff35fda1..e8232cccb 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -372,7 +372,7 @@ export class Provider { let initializeUrl = this.getEndpointURL(serviceEndpoints, 'initialize') ? this.getEndpointURL(serviceEndpoints, 'initialize').urlPath : null - console.log(initializeUrl) + if (!initializeUrl) return null initializeUrl += `?documentId=${did}` initializeUrl += `&serviceId=${serviceId}` @@ -389,7 +389,6 @@ export class Provider { headers: { 'Content-Type': 'application/json' }, signal }) - console.log(response) } catch (e) { LoggerInstance.error('Provider initialized failed: ') LoggerInstance.error(e) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 1f40b6655..8e6e66c27 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -13,7 +13,6 @@ import { } from '../../src' import { Files, Smartcontract } from '../../src/@types' import { createAsset, orderAsset, updateAssetMetadata } from './helpers' -import axios from 'axios' let config: Config @@ -138,22 +137,20 @@ function delay(interval: number) { function uploadToIpfs(data: any): Promise { return new Promise((resolve, reject) => { - axios - .post( - 'http://172.15.0.16:5001/api/v0/add', + fetch('http://172.15.0.16:5001/api/v0/add', { + method: 'POST', + headers: { + 'Content-Type': + 'multipart/form-data; boundary=------------------------a28d68b1c872c96f' + }, + body: '--------------------------a28d68b1c872c96f\r\nContent-Disposition: form-data; name="file"; filename="ddo.json"\r\nContent-Type: application/octet-stream\r\n\r\n' + - data + - '\r\n--------------------------a28d68b1c872c96f--\r\n', - { - headers: { - 'Content-Type': - 'multipart/form-data; boundary=------------------------a28d68b1c872c96f' - } - } - ) + data + + '\r\n--------------------------a28d68b1c872c96f--\r\n' + }) .then(function (response: any) { - console.log('hash: ', response.data.Hash) - resolve(response.data.Hash) + const resp = response.json() + resolve(resp.Hash) }) .catch(function (error: any) { reject(error) diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index 1e08bebba..e3e097c81 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -174,7 +174,6 @@ export async function orderAsset( datatoken: Datatoken, providerUrl: string ) { - console.log(did) const initializeData = await ProviderInstance.initialize( did, serviceId,