mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Merge pull request #381 from oceanprotocol/bug/fix_getOrderHistory
fix getOrderHistory
This commit is contained in:
commit
d685cb1f5e
@ -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,
|
||||
|
@ -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)
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user