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

simplification, make it work

This commit is contained in:
Matthias Kretschmann 2020-08-20 17:54:16 +02:00
parent af7964ca84
commit dee24e87a3
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -139,27 +139,11 @@ export class Pool extends PoolFactory {
* @return {String}
*/
async totalSupply(poolAddress: string): Promise<string> {
const minABI = [
{
constant: true,
name: 'totalSupply',
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)
const totalSupply = await token.methods.totalSupply().call()
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
const totalSupply = await pool.methods.totalSupply().call()
result = this.web3.utils.fromWei(totalSupply)
} catch (e) {
console.error(e)