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

fix sharesBalance

fix sharesBalance
This commit is contained in:
Alex Coseru 2020-08-28 19:16:15 +03:00 committed by GitHub
parent b073365a09
commit a9a614f586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,37 +141,10 @@ export class Pool extends PoolFactory {
* @return {String}
*/
async sharesBalance(account: string, poolAddress: string): Promise<string> {
const minABI = [
{
constant: true,
inputs: [
{
name: '_owner',
type: 'address'
}
],
name: 'balanceOf',
outputs: [
{
name: 'balance',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
}
] as AbiItem[]
let result = null
try {
const token = new this.web3.eth.Contract(minABI, poolAddress, {
from: account
})
const balance = await token.methods
.balanceOf(account)
.call({ from: account, gas: this.GASLIMIT_DEFAULT })
const token = new this.web3.eth.Contract(this.poolABI, poolAddress)
const balance = await token.methods.balanceOf(account)
result = this.web3.utils.fromWei(balance)
} catch (e) {
console.error(e)