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

Merge pull request #357 from oceanprotocol/feature/pool_sorting_based_on_blockNo

sort polls by blockNumber
This commit is contained in:
Alex Coseru 2020-10-13 16:01:29 +03:00 committed by GitHub
commit 8003bd133f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -782,6 +782,7 @@ export class OceanPool extends Pool {
fromBlock: 0,
toBlock: 'latest'
})
events.sort((a, b) => (a.blockNumber > b.blockNumber ? 1 : -1))
for (let i = 0; i < events.length; i++) {
const constituents = await super.getCurrentTokens(events[i].returnValues[0])
if (constituents.includes(dtAddress)) result.push(events[i].returnValues[0])