1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

Merge pull request #113 from oceanprotocol/feature/integrate-barge

Feature/integrate barge
This commit is contained in:
Ahmed Ali 2020-06-26 21:42:57 +02:00 committed by GitHub
commit 1addf160eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 38 deletions

View File

@ -18,11 +18,18 @@ before_install:
before_script:
- ganache-cli > ganache-cli.log &
- git clone https://github.com/oceanprotocol/barge
- cd barge
- git checkout v3
- bash -x start_ocean.sh 2>&1 > start_ocean.log &
- cd ..
- sleep 300
script:
- npm run lint
- npm run build
- npm run test:cover
- npm run test:cover
- npm run test:integration
notifications:
email: false

View File

@ -3,7 +3,7 @@ import { Authentication } from './interfaces/Authentication'
import { Proof } from './interfaces/Proof'
import { PublicKey } from './interfaces/PublicKey'
import { Service, ServiceType } from './interfaces/Service'
import Web3Provider from '../datatokens/Web3Provider'
import Web3Provider from '../datatokens/Web3Provider'
/**
* DID Descriptor Object.
* Contains all the data related to an asset.
@ -41,7 +41,7 @@ export class DDO {
public updated: string
public dtAddress: string
public dataToken: string
public publicKey: PublicKey[] = []
@ -106,8 +106,7 @@ export class DDO {
this.id
]
return Web3Provider
.getWeb3()
return Web3Provider.getWeb3()
.utils.sha3(values.join(''))
.replace(/^0x([a-f0-9]{64})(:!.+)?$/i, '0x$1')
}

View File

@ -1,4 +1,4 @@
import { SearchQuery, QueryResult } from '../metadatastore/MetadataStore'
import { SearchQuery } from '../metadatastore/MetadataStore'
import { DDO } from '../ddo/DDO'
import { Metadata } from '../ddo/interfaces/Metadata'
import { Service, ServiceAccess, ServiceComputePrivacy } from '../ddo/interfaces/Service'
@ -99,7 +99,7 @@ export class Assets extends Instantiable {
// create ddo itself
const ddo: DDO = new DDO({
id: did.getDid(),
dtAddress: dtAddress,
dataToken: dtAddress,
authentication: [
{
type: 'RsaSignatureAuthentication2018',
@ -151,7 +151,6 @@ export class Assets extends Instantiable {
index: indexCount++
})) as Service[]
})
this.logger.log('Generating proof')
observer.next(CreateProgressStep.GeneratingProof)
await ddo.addProof(this.ocean, publisher.getId(), publisher.getPassword())

View File

@ -3,7 +3,7 @@ import { DataTokens } from '../../src/datatokens/Datatokens'
import { Ocean } from '../../src/ocean/Ocean'
import config from './config'
// import Accounts from "../../src/ocean/Account"
// import Accounts from "../../src/ocean/Account"
const Web3 = require('web3')
const web3 = new Web3('http://127.0.0.1:8545')
@ -50,11 +50,10 @@ describe('Marketplace flow', () => {
marketplace = (await ocean.accounts.list())[3]
await contracts.deployContracts(owner.getId())
})
it('Alice publishes a datatoken contract', async () => {
datatoken = new DataTokens(
datatoken = new DataTokens(
contracts.factoryAddress,
factory.abi,
datatokensTemplate.abi,
@ -69,29 +68,26 @@ describe('Marketplace flow', () => {
main: {
type: 'dataset',
name: 'test-dataset',
dateCreated:
new Date(Date.now())
.toISOString()
.split('.')[0] + 'Z', // remove milliseconds
dateCreated: new Date(Date.now()).toISOString().split('.')[0] + 'Z', // remove milliseconds
author: 'oceanprotocol-team',
license: 'MIT',
files: [
{
url: 'https://raw.githubusercontent.com/tbertinmahieux/MSongsDB/master/Tasks_Demos/CoverSongs/shs_dataset_test.txt',
url:
'https://raw.githubusercontent.com/tbertinmahieux/MSongsDB/master/Tasks_Demos/CoverSongs/shs_dataset_test.txt',
checksum: 'efb2c764274b745f5fc37f97c6b0e761',
contentLength: '4535431',
contentType: 'text/csv',
encoding: 'UTF-8',
compression: 'zip'
}
]
}
]
}
}
})
it('Alice publishes a dataset', async () => {
ddo = await ocean.assets.create(asset, alice, [], tokenAddress)
})
// it('Alice mints 100 tokens', async () => {

View File

@ -11,10 +11,8 @@ describe('Rinkeby test', () => {
// let contracts
// let datatoken
// let tokenAddress
// const tokenAmount = 100
// const blob = 'http://localhost:8030/api/v1/provider/services'
// describe('#test', () => {
// it('Initialize Ocean contracts v3', async () => {
// contracts = new TestContractHandler(
@ -24,14 +22,11 @@ describe('Rinkeby test', () => {
// factory.bytecode,
// web3
// )
// const privateKey = 'PRIVATE_KEY'
// account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey)
// web3.eth.accounts.wallet.add(account)
// await contracts.deployContracts(account.address)
// })
// it('Publish a dataset', async () => {
// datatoken = new DataTokens(
// contracts.factoryAddress,
@ -39,10 +34,8 @@ describe('Rinkeby test', () => {
// datatokensTemplate.abi,
// web3
// )
// tokenAddress = await datatoken.create(blob, account.address)
// })
// it('Mint 100 tokens', async () => {
// await datatoken.mint(tokenAddress, account.address, tokenAmount)
// })

View File

@ -16,11 +16,9 @@ describe('Simple flow', () => {
// let datatoken
// let tokenAddress
// let transactionId
// const tokenAmount = 100
// const transferAmount = 1
// const blob = 'http://localhost:8030/api/v1/provider/services'
// describe('#test', () => {
// it('Initialize Ocean contracts v3', async () => {
// contracts = new TestContractHandler(
@ -36,7 +34,6 @@ describe('Simple flow', () => {
// bob = contracts.accounts[2]
// await contracts.deployContracts(owner)
// })
// it('Alice publishes a dataset', async () => {
// // Alice creates a Datatoken
// datatoken = new DataTokens(
@ -47,16 +44,13 @@ describe('Simple flow', () => {
// )
// tokenAddress = await datatoken.create(blob, alice)
// })
// it('Alice mints 100 tokens', async () => {
// await datatoken.mint(tokenAddress, alice, tokenAmount)
// })
// it('Alice transfers 1 token to Bob', async () => {
// const ts = await datatoken.transfer(tokenAddress, bob, transferAmount, alice)
// transactionId = ts.transactionHash
// })
// it('Bob consumes dataset', async () => {
// const config = new Config()
// const ocean = await Ocean.getInstance(config)

View File

@ -7,12 +7,9 @@ const Web3 = require('web3')
const web3 = new Web3('http://127.0.0.1:8545')
export default {
// metadataStoreUri: 'http://localhost:5000',
metadataStoreUri: 'https://aquarius.marketplace.dev-ocean.com',
providerUri: 'http://127.0.0.1:8030',
metadataStoreUri: 'http://localhost:5000',
providerUri: 'http://localhost:8030',
nodeUri: `http://localhost:${process.env.ETH_PORT || 8545}`,
parityUri: 'http://localhost:9545',
secretStoreUri: 'http://localhost:12001',
verbose: LogLevel.Error,
web3Provider: web3
} as Config
} as Config