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

fixed ocean allowance param and some lint errors

This commit is contained in:
Bogdan Fazakas 2021-01-08 14:03:59 +02:00
parent a5a55b19a1
commit 742436dbac
2 changed files with 6 additions and 8 deletions

View File

@ -119,9 +119,8 @@ export class OceanPool extends Pool {
const oceanWeight = 10 - parseFloat(dtWeight) const oceanWeight = 10 - parseFloat(dtWeight)
this.dtAddress = dtAddress this.dtAddress = dtAddress
let txid let txid
let dtAllowance const dtAllowance = await this.allowance(dtAddress, account, address)
dtAllowance = await this.allowance(dtAddress, account, address) if (dtAllowance < dtAmount) {
if (dtAllowance < dtAmount){
observer.next(PoolCreateProgressStep.ApprovingDatatoken) observer.next(PoolCreateProgressStep.ApprovingDatatoken)
txid = await this.approve( txid = await this.approve(
account, account,
@ -132,11 +131,10 @@ export class OceanPool extends Pool {
if (!txid) { if (!txid) {
this.logger.error('ERROR: Failed to call approve DT token') this.logger.error('ERROR: Failed to call approve DT token')
return null return null
} }
} }
let oceanAllowance const oceanAllowance = await this.allowance(this.oceanAddress, account, address)
oceanAllowance = await this.allowance(dtAddress, account, address) if (oceanAllowance < oceanAmount) {
if (oceanAllowance < oceanAmount){
observer.next(PoolCreateProgressStep.ApprovingOcean) observer.next(PoolCreateProgressStep.ApprovingOcean)
txid = await this.approve( txid = await this.approve(
account, account,

View File

@ -119,7 +119,7 @@ export class Pool extends PoolFactory {
owner: string, owner: string,
spender: string spender: string
): Promise<string> { ): Promise<string> {
const tokenAbi = (defaultDatatokensABI.abi as AbiItem[]) const tokenAbi = defaultDatatokensABI.abi as AbiItem[]
const datatoken = new this.web3.eth.Contract(tokenAbi, tokenAdress, { const datatoken = new this.web3.eth.Contract(tokenAbi, tokenAdress, {
from: spender from: spender
}) })