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:
parent
af7964ca84
commit
dee24e87a3
@ -139,27 +139,11 @@ export class Pool extends PoolFactory {
|
|||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
async totalSupply(poolAddress: string): Promise<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
|
let result = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const token = new this.web3.eth.Contract(minABI, poolAddress)
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
|
||||||
const totalSupply = await token.methods.totalSupply().call()
|
const totalSupply = await pool.methods.totalSupply().call()
|
||||||
result = this.web3.utils.fromWei(totalSupply)
|
result = this.web3.utils.fromWei(totalSupply)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user