diff --git a/src/ocean/Assets.ts b/src/ocean/Assets.ts index f5b22be5..caa217c7 100644 --- a/src/ocean/Assets.ts +++ b/src/ocean/Assets.ts @@ -598,11 +598,13 @@ export class Assets extends Instantiable { const address = account.getId().toLowerCase() const { datatokens } = this.ocean const topic1 = '0x000000000000000000000000' + address.substring(2) + const topic0 = datatokens.getStartOrderEventSignature() const events = await this.web3.eth.getPastLogs({ - topics: [[datatokens.getStartOrderEventSignature(), null, topic1]], + topics: [topic0, null, topic1], fromBlock: fromBlock || 0, toBlock: 'latest' }) + for (let i = 0; i < events.length; i++) { const order: Order = { dtAddress: events[i].address, diff --git a/test/integration/Marketplaceflow.test.ts b/test/integration/Marketplaceflow.test.ts index bef949b7..a3ccfd91 100644 --- a/test/integration/Marketplaceflow.test.ts +++ b/test/integration/Marketplaceflow.test.ts @@ -252,8 +252,12 @@ describe('Marketplace flow', () => { ddo = await ocean.assets.create(asset, alice, [service1]) assert.equal(ddo, null) }) - it('Alice gets hers order History', async () => { - const history = await ocean.assets.getOrderHistory(alice) + it('Bob should get his order History', async () => { + const history = await ocean.assets.getOrderHistory(bob) assert(history.length > 0) }) + it('Alice should not get any order History', async () => { + const history = await ocean.assets.getOrderHistory(alice) + assert(history.length === 0) + }) })