mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Merge pull request #429 from oceanprotocol/bug/fix_getPoolSharesByAddress
fix getPoolSharesByAddress
This commit is contained in:
commit
fe5c99fa7f
@ -913,23 +913,25 @@ export class OceanPool extends Pool {
|
|||||||
const factory = new this.web3.eth.Contract(this.factoryABI, this.factoryAddress)
|
const factory = new this.web3.eth.Contract(this.factoryABI, this.factoryAddress)
|
||||||
|
|
||||||
const events = await factory.getPastEvents('BPoolRegistered', {
|
const events = await factory.getPastEvents('BPoolRegistered', {
|
||||||
filter: account ? { registeredBy: account } : {},
|
filter: {},
|
||||||
fromBlock: BPFACTORY_DEPLOY_BLOCK,
|
fromBlock: BPFACTORY_DEPLOY_BLOCK,
|
||||||
toBlock: 'latest'
|
toBlock: 'latest'
|
||||||
})
|
})
|
||||||
|
|
||||||
for (let i = 0; i < events.length; i++) {
|
for (let i = 0; i < events.length; i++) {
|
||||||
const shares = await super.sharesBalance(account, events[i].returnValues[0])
|
const shares = await super.sharesBalance(account, events[i].returnValues[0])
|
||||||
if (shares) {
|
if (parseFloat(shares) > 0) {
|
||||||
const onePool: PoolShare = {
|
const dtAddress = await this.getDTAddress(events[i].returnValues[0])
|
||||||
shares,
|
if (dtAddress) {
|
||||||
poolAddress: events[i].returnValues[0],
|
const onePool: PoolShare = {
|
||||||
did: didPrefixed(didNoZeroX(await this.getDTAddress(events[i].returnValues[0])))
|
shares,
|
||||||
|
poolAddress: events[i].returnValues[0],
|
||||||
|
did: didPrefixed(didNoZeroX(dtAddress))
|
||||||
|
}
|
||||||
|
result.push(onePool)
|
||||||
}
|
}
|
||||||
result.push(onePool)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(result)
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user