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

integrate barge

This commit is contained in:
Ahmed Ali 2020-06-26 19:38:52 +02:00
parent a770b45c95
commit a786c83373
6 changed files with 17 additions and 29 deletions

View File

@ -18,11 +18,17 @@ before_install:
before_script:
- ganache-cli > ganache-cli.log &
- git clone https://github.com/oceanprotocol/barge
- cd barge
- git checkout origin/v3
- bash -x start_ocean.sh --no-commons --no-dashboard 2>&1 > start_ocean.log &
- cd ..
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.
@ -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

@ -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

@ -15,4 +15,4 @@ export default {
secretStoreUri: 'http://localhost:12001',
verbose: LogLevel.Error,
web3Provider: web3
} as Config
} as Config