mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
refactor
This commit is contained in:
parent
a3e43c1578
commit
af7964ca84
@ -116,16 +116,17 @@ export class Pool extends PoolFactory {
|
|||||||
type: 'function'
|
type: 'function'
|
||||||
}
|
}
|
||||||
] as AbiItem[]
|
] as AbiItem[]
|
||||||
|
|
||||||
|
let result = null
|
||||||
|
|
||||||
|
try {
|
||||||
const token = new this.web3.eth.Contract(minABI, poolAddress, {
|
const token = new this.web3.eth.Contract(minABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
const balance = await token.methods
|
||||||
try {
|
|
||||||
result = this.web3.utils.fromWei(
|
|
||||||
await token.methods
|
|
||||||
.balanceOf(account)
|
.balanceOf(account)
|
||||||
.call({ from: account, gas: this.GASLIMIT_DEFAULT })
|
.call({ from: account, gas: this.GASLIMIT_DEFAULT })
|
||||||
)
|
result = this.web3.utils.fromWei(balance)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
@ -154,12 +155,10 @@ export class Pool extends PoolFactory {
|
|||||||
}
|
}
|
||||||
] as AbiItem[]
|
] as AbiItem[]
|
||||||
|
|
||||||
const token = new this.web3.eth.Contract(minABI, poolAddress)
|
|
||||||
// const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
|
|
||||||
|
|
||||||
let result = null
|
let result = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const token = new this.web3.eth.Contract(minABI, poolAddress)
|
||||||
const totalSupply = await token.methods.totalSupply().call()
|
const totalSupply = await token.methods.totalSupply().call()
|
||||||
result = this.web3.utils.fromWei(totalSupply)
|
result = this.web3.utils.fromWei(totalSupply)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user