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

publishing services prior creating asset

This commit is contained in:
Ahmed Ali 2020-06-29 19:20:29 +02:00
parent 06933aa2fa
commit 5535305c5f
2 changed files with 20 additions and 5 deletions

View File

@ -353,7 +353,7 @@ export class Assets extends Instantiable {
}
public async createAccessServiceAttributes(
consumerAccount: Account,
creator: Account,
dtCost: number,
datePublished: string,
timeout: number = 0
@ -364,7 +364,7 @@ export class Assets extends Instantiable {
serviceEndpoint: this.ocean.provider.getConsumeEndpoint(),
attributes: {
main: {
creator: consumerAccount.getId(),
creator: creator.getId(),
datePublished,
dtCost,
timeout: timeout,

View File

@ -26,7 +26,7 @@ describe('Marketplace flow', () => {
let transactionId
let service1
let service2
let price
let ocean
const marketplaceAllowance = 20
@ -86,10 +86,21 @@ describe('Marketplace flow', () => {
]
}
}
})
it('Alice publishes a dataset', async () => {
ddo = await ocean.assets.create(asset, alice, [], tokenAddress)
price = 10 // in datatoken
const publishedDate = new Date(Date.now()).toISOString().split('.')[0] + 'Z'
const timeout = 0
service1 = await ocean.assets.createAccessServiceAttributes(
alice,
price,
publishedDate,
timeout
)
ddo = await ocean.assets.create(asset, alice, [service1], tokenAddress)
assert(ddo.dataToken === tokenAddress)
})
@ -137,6 +148,10 @@ describe('Marketplace flow', () => {
assert(ddo, await ocean.assets.resolve(ddo.id))
})
it('Marketplace creates access service', async () => {
})
it('Marketplace posts asset for sale', async () => {
//const downloadService = await ocean.assets.getService(ddo.id, 'download')
})