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

fix ABI typings

This commit is contained in:
Matthias Kretschmann 2020-08-19 13:23:28 +02:00
parent bb04309f72
commit ad0922d7a5
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import Web3 from 'web3'
import { AbiItem } from 'web3-utils/types'
import Decimal from 'decimal.js'
import * as jsonpoolABI from '@oceanprotocol/contracts/artifacts/SPool.json'
import jsonpoolABI from '@oceanprotocol/contracts/artifacts/SPool.json'
import { PoolFactory } from './PoolFactory'
/**
@ -25,7 +25,7 @@ export class Pool extends PoolFactory {
) {
super(web3, factoryABI, factoryAddress, gaslimit)
if (poolABI) this.poolABI = poolABI
else this.poolABI = jsonpoolABI.abi
else this.poolABI = jsonpoolABI.abi as AbiItem[]
}
/**
@ -73,7 +73,7 @@ export class Pool extends PoolFactory {
stateMutability: 'nonpayable',
type: 'function'
}
]
] as AbiItem[]
const token = new this.web3.eth.Contract(minABI, tokenAddress, {
from: account
})
@ -115,7 +115,7 @@ export class Pool extends PoolFactory {
stateMutability: 'view',
type: 'function'
}
]
] as AbiItem[]
const token = new this.web3.eth.Contract(minABI, poolAddress, {
from: account
})
@ -155,7 +155,7 @@ export class Pool extends PoolFactory {
account,
token.address,
poolAddress,
this.web3.utils.toWei(token.amount)
this.web3.utils.toWei(token.amount) as any
)
await pool.methods
.bind(

View File

@ -1,6 +1,6 @@
import Web3 from 'web3'
import { AbiItem } from 'web3-utils/types'
import * as jsonFactoryABI from '@oceanprotocol/contracts/artifacts/SFactory.json'
import jsonFactoryABI from '@oceanprotocol/contracts/artifacts/SFactory.json'
export class PoolFactory {
public GASLIMIT_DEFAULT = 5000000
@ -17,7 +17,7 @@ export class PoolFactory {
this.web3 = web3
if (factoryABI) this.factoryABI = factoryABI
else this.factoryABI = jsonFactoryABI.abi
else this.factoryABI = jsonFactoryABI.abi as AbiItem[]
if (factoryAddress) {
this.factoryAddress = factoryAddress
}

View File

@ -28,8 +28,8 @@ export class DataTokens {
web3: Web3
) {
this.factoryAddress = factoryAddress
this.factoryABI = factoryABI || defaultFactoryABI.abi
this.datatokensABI = datatokensABI || defaultDatatokensABI.abi
this.factoryABI = factoryABI || (defaultFactoryABI.abi as AbiItem[])
this.datatokensABI = datatokensABI || (defaultDatatokensABI.abi as AbiItem[])
this.web3 = web3
}