mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
lots of ABI typings
This commit is contained in:
parent
7cf85f6392
commit
bbd465992b
@ -39,7 +39,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ethereum-navigator/navigator": "^0.5.0",
|
"@ethereum-navigator/navigator": "^0.5.0",
|
||||||
"@oceanprotocol/contracts": "^0.3.4",
|
"@oceanprotocol/contracts": "^0.3.4",
|
||||||
"bignumber.js": "^9.0.0",
|
|
||||||
"decimal.js": "^10.2.0",
|
"decimal.js": "^10.2.0",
|
||||||
"fs": "0.0.1-security",
|
"fs": "0.0.1-security",
|
||||||
"node-fetch": "^2.6.0",
|
"node-fetch": "^2.6.0",
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
|
import { AbiItem } from 'web3-utils/types'
|
||||||
import { Pool } from './Pool'
|
import { Pool } from './Pool'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ocean Pools submodule exposed under ocean.pool
|
||||||
|
*/
|
||||||
export class OceanPool extends Pool {
|
export class OceanPool extends Pool {
|
||||||
public oceanAddress: string = null
|
public oceanAddress: string = null
|
||||||
public dtAddress: string = null
|
public dtAddress: string = null
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
web3: Web3,
|
web3: Web3,
|
||||||
FactoryABI: any = null,
|
factoryABI: AbiItem | AbiItem[] = null,
|
||||||
PoolABI: any = null,
|
poolABI: AbiItem | AbiItem[] = null,
|
||||||
factoryAddress: string = null,
|
factoryAddress: string = null,
|
||||||
oceanAddress: string = null,
|
oceanAddress: string = null,
|
||||||
gaslimit?: number
|
gaslimit?: number
|
||||||
) {
|
) {
|
||||||
super(web3, FactoryABI, PoolABI, factoryAddress, gaslimit)
|
super(web3, factoryABI, poolABI, factoryAddress, gaslimit)
|
||||||
if (oceanAddress) {
|
if (oceanAddress) {
|
||||||
this.oceanAddress = oceanAddress
|
this.oceanAddress = oceanAddress
|
||||||
}
|
}
|
||||||
@ -76,6 +80,7 @@ export class OceanPool extends Pool {
|
|||||||
const tokens = await this.getCurrentTokens(account, poolAddress)
|
const tokens = await this.getCurrentTokens(account, poolAddress)
|
||||||
let token
|
let token
|
||||||
for (token of tokens) {
|
for (token of tokens) {
|
||||||
|
// TODO: Potential timing attack, left side: true
|
||||||
if (token !== this.oceanAddress) this.dtAddress = token
|
if (token !== this.oceanAddress) this.dtAddress = token
|
||||||
}
|
}
|
||||||
return this.dtAddress
|
return this.dtAddress
|
||||||
@ -314,7 +319,7 @@ export class OceanPool extends Pool {
|
|||||||
*/
|
*/
|
||||||
public async searchPoolforDT(account: string, dtAddress: string): Promise<string[]> {
|
public async searchPoolforDT(account: string, dtAddress: string): Promise<string[]> {
|
||||||
const result: string[] = []
|
const result: string[] = []
|
||||||
const factory = new this.web3.eth.Contract(this.FactoryABI, this.factoryAddress, {
|
const factory = new this.web3.eth.Contract(this.factoryABI, this.factoryAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
const events = await factory.getPastEvents('SPoolRegistered', {
|
const events = await factory.getPastEvents('SPoolRegistered', {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
|
import { AbiItem } from 'web3-utils/types'
|
||||||
import Decimal from 'decimal.js'
|
import Decimal from 'decimal.js'
|
||||||
import * as jsonPoolABI from '@oceanprotocol/contracts/artifacts/SPool.json'
|
import * as jsonpoolABI from '@oceanprotocol/contracts/artifacts/SPool.json'
|
||||||
import { PoolFactory } from './PoolFactory'
|
import { PoolFactory } from './PoolFactory'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,18 +14,18 @@ export interface TokensToAdd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Pool extends PoolFactory {
|
export class Pool extends PoolFactory {
|
||||||
private PoolABI: any
|
private poolABI: AbiItem | AbiItem[]
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
web3: Web3,
|
web3: Web3,
|
||||||
FactoryABI: any = null,
|
factoryABI: AbiItem | AbiItem[] = null,
|
||||||
PoolABI: any = null,
|
poolABI: AbiItem | AbiItem[] = null,
|
||||||
factoryAddress: string = null,
|
factoryAddress: string = null,
|
||||||
gaslimit?: number
|
gaslimit?: number
|
||||||
) {
|
) {
|
||||||
super(web3, FactoryABI, factoryAddress, gaslimit)
|
super(web3, factoryABI, factoryAddress, gaslimit)
|
||||||
if (PoolABI) this.PoolABI = PoolABI
|
if (poolABI) this.poolABI = poolABI
|
||||||
else this.PoolABI = jsonPoolABI.abi
|
else this.poolABI = jsonpoolABI.abi
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,7 +143,7 @@ export class Pool extends PoolFactory {
|
|||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
tokens: TokensToAdd[]
|
tokens: TokensToAdd[]
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -176,7 +177,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} fee (will be converted to wei)
|
* @param {String} fee (will be converted to wei)
|
||||||
*/
|
*/
|
||||||
async setSwapFee(account: string, poolAddress: string, fee: string): Promise<any> {
|
async setSwapFee(account: string, poolAddress: string, fee: string): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -196,7 +197,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
*/
|
*/
|
||||||
async finalize(account: string, poolAddress: string): Promise<any> {
|
async finalize(account: string, poolAddress: string): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -216,7 +217,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
*/
|
*/
|
||||||
async getNumTokens(account: string, poolAddress: string): Promise<any> {
|
async getNumTokens(account: string, poolAddress: string): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -235,7 +236,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @return {String[]}
|
* @return {String[]}
|
||||||
*/
|
*/
|
||||||
async getCurrentTokens(account: string, poolAddress: string): Promise<string[]> {
|
async getCurrentTokens(account: string, poolAddress: string): Promise<string[]> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -254,7 +255,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @return {String[]}
|
* @return {String[]}
|
||||||
*/
|
*/
|
||||||
async getFinalTokens(account: string, poolAddress: string): Promise<string[]> {
|
async getFinalTokens(account: string, poolAddress: string): Promise<string[]> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -273,7 +274,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
async getController(account: string, poolAddress: string): Promise<string> {
|
async getController(account: string, poolAddress: string): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -297,7 +298,7 @@ export class Pool extends PoolFactory {
|
|||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
controllerAddress: string
|
controllerAddress: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -319,7 +320,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
async isBound(account: string, poolAddress: string, token: string): Promise<boolean> {
|
async isBound(account: string, poolAddress: string, token: string): Promise<boolean> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -339,7 +340,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
async getReserve(account: string, poolAddress: string, token: string): Promise<string> {
|
async getReserve(account: string, poolAddress: string, token: string): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let amount = null
|
let amount = null
|
||||||
@ -359,7 +360,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
async isFinalized(account: string, poolAddress: string): Promise<boolean> {
|
async isFinalized(account: string, poolAddress: string): Promise<boolean> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -378,7 +379,7 @@ export class Pool extends PoolFactory {
|
|||||||
* @return {String} Swap fee in wei
|
* @return {String} Swap fee in wei
|
||||||
*/
|
*/
|
||||||
async getSwapFee(account: string, poolAddress: string): Promise<string> {
|
async getSwapFee(account: string, poolAddress: string): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let fee = null
|
let fee = null
|
||||||
@ -403,7 +404,7 @@ export class Pool extends PoolFactory {
|
|||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
token: string
|
token: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let weight = null
|
let weight = null
|
||||||
@ -428,7 +429,7 @@ export class Pool extends PoolFactory {
|
|||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
token: string
|
token: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let weight = null
|
let weight = null
|
||||||
@ -451,7 +452,7 @@ export class Pool extends PoolFactory {
|
|||||||
account: string,
|
account: string,
|
||||||
poolAddress: string
|
poolAddress: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let weight = null
|
let weight = null
|
||||||
@ -484,7 +485,7 @@ export class Pool extends PoolFactory {
|
|||||||
minAmountOut: string,
|
minAmountOut: string,
|
||||||
maxPrice: string
|
maxPrice: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -524,7 +525,7 @@ export class Pool extends PoolFactory {
|
|||||||
minAmountOut: string,
|
minAmountOut: string,
|
||||||
maxPrice: string
|
maxPrice: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -558,7 +559,7 @@ export class Pool extends PoolFactory {
|
|||||||
poolAmountOut: string,
|
poolAmountOut: string,
|
||||||
maxAmountsIn: string[]
|
maxAmountsIn: string[]
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
const weiMaxAmountsIn = []
|
const weiMaxAmountsIn = []
|
||||||
@ -595,7 +596,7 @@ export class Pool extends PoolFactory {
|
|||||||
poolAmountIn: string,
|
poolAmountIn: string,
|
||||||
minAmountsOut: string
|
minAmountsOut: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
const weiMinAmountsOut = []
|
const weiMinAmountsOut = []
|
||||||
@ -630,7 +631,7 @@ export class Pool extends PoolFactory {
|
|||||||
tokenAmountIn: string,
|
tokenAmountIn: string,
|
||||||
minPoolAmountOut: string
|
minPoolAmountOut: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -664,7 +665,7 @@ export class Pool extends PoolFactory {
|
|||||||
poolAmountOut: string,
|
poolAmountOut: string,
|
||||||
maxAmountIn: string
|
maxAmountIn: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -698,7 +699,7 @@ export class Pool extends PoolFactory {
|
|||||||
poolAmountIn: string,
|
poolAmountIn: string,
|
||||||
minTokenAmountOut: string
|
minTokenAmountOut: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -732,7 +733,7 @@ export class Pool extends PoolFactory {
|
|||||||
tokenAmountOut: string,
|
tokenAmountOut: string,
|
||||||
maxPoolAmountIn: string
|
maxPoolAmountIn: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let result = null
|
let result = null
|
||||||
@ -764,7 +765,7 @@ export class Pool extends PoolFactory {
|
|||||||
tokenIn: string,
|
tokenIn: string,
|
||||||
tokenOut: string
|
tokenOut: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let price = null
|
let price = null
|
||||||
@ -791,7 +792,7 @@ export class Pool extends PoolFactory {
|
|||||||
tokenIn: string,
|
tokenIn: string,
|
||||||
tokenOut: string
|
tokenOut: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const pool = new this.web3.eth.Contract(this.PoolABI, poolAddress, {
|
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
let price = null
|
let price = null
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
|
import { AbiItem } from 'web3-utils/types'
|
||||||
import * as jsonFactoryABI from '@oceanprotocol/contracts/artifacts/SFactory.json'
|
import * as jsonFactoryABI from '@oceanprotocol/contracts/artifacts/SFactory.json'
|
||||||
|
|
||||||
export class PoolFactory {
|
export class PoolFactory {
|
||||||
public GASLIMIT_DEFAULT = 5000000
|
public GASLIMIT_DEFAULT = 5000000
|
||||||
public web3: any = null
|
public web3: Web3 = null
|
||||||
public FactoryABI: any
|
public factoryABI: AbiItem | AbiItem[]
|
||||||
public factoryAddress: any
|
public factoryAddress: string
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
web3: Web3,
|
web3: Web3,
|
||||||
FactoryABI: any = null,
|
factoryABI: AbiItem | AbiItem[] = null,
|
||||||
factoryAddress: string = null,
|
factoryAddress: string = null,
|
||||||
gaslimit?: number
|
gaslimit?: number
|
||||||
) {
|
) {
|
||||||
this.web3 = web3
|
this.web3 = web3
|
||||||
|
|
||||||
if (FactoryABI) this.FactoryABI = FactoryABI
|
if (factoryABI) this.factoryABI = factoryABI
|
||||||
else this.FactoryABI = jsonFactoryABI.abi
|
else this.factoryABI = jsonFactoryABI.abi
|
||||||
if (factoryAddress) {
|
if (factoryAddress) {
|
||||||
this.factoryAddress = factoryAddress
|
this.factoryAddress = factoryAddress
|
||||||
}
|
}
|
||||||
@ -37,7 +38,7 @@ export class PoolFactory {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const factory = new this.web3.eth.Contract(this.FactoryABI, this.factoryAddress, {
|
const factory = new this.web3.eth.Contract(this.factoryABI, this.factoryAddress, {
|
||||||
from: account
|
from: account
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
const defaultFactoryABI = require('@oceanprotocol/contracts/artifacts/DTFactory.json')
|
import Web3 from 'web3'
|
||||||
const defaultDatatokensABI = require('@oceanprotocol/contracts/artifacts/DataTokenTemplate.json')
|
import { AbiItem } from 'web3-utils/types'
|
||||||
|
|
||||||
|
import defaultFactoryABI from '@oceanprotocol/contracts/artifacts/DTFactory.json'
|
||||||
|
import defaultDatatokensABI from '@oceanprotocol/contracts/artifacts/DataTokenTemplate.json'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a interface to DataTokens
|
* Provides a interface to DataTokens
|
||||||
*/
|
*/
|
||||||
export class DataTokens {
|
export class DataTokens {
|
||||||
public factoryAddress: string
|
public factoryAddress: string
|
||||||
public factoryABI: any
|
public factoryABI: AbiItem | AbiItem[]
|
||||||
public datatokensABI: any
|
public datatokensABI: AbiItem | AbiItem[]
|
||||||
public web3: any
|
public web3: Web3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate DataTokens (independently of Ocean).
|
* Instantiate DataTokens (independently of Ocean).
|
||||||
@ -18,7 +21,12 @@ export class DataTokens {
|
|||||||
* @param {any} web3
|
* @param {any} web3
|
||||||
|
|
||||||
*/
|
*/
|
||||||
constructor(factoryAddress: string, factoryABI: any, datatokensABI: any, web3: any) {
|
constructor(
|
||||||
|
factoryAddress: string,
|
||||||
|
factoryABI: AbiItem | AbiItem[],
|
||||||
|
datatokensABI: AbiItem | AbiItem[],
|
||||||
|
web3: Web3
|
||||||
|
) {
|
||||||
this.factoryAddress = factoryAddress
|
this.factoryAddress = factoryAddress
|
||||||
this.factoryABI = factoryABI || defaultFactoryABI.abi
|
this.factoryABI = factoryABI || defaultFactoryABI.abi
|
||||||
this.datatokensABI = datatokensABI || defaultDatatokensABI.abi
|
this.datatokensABI = datatokensABI || defaultDatatokensABI.abi
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import BigNumber from 'bignumber.js'
|
|
||||||
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,18 +1,12 @@
|
|||||||
import { Accounts } from './Accounts'
|
import { Accounts } from './Accounts'
|
||||||
|
|
||||||
import { Assets } from './Assets'
|
import { Assets } from './Assets'
|
||||||
|
|
||||||
// import { Compute } from './Compute'
|
|
||||||
|
|
||||||
import { Versions } from './Versions'
|
import { Versions } from './Versions'
|
||||||
import { OceanUtils } from './utils/Utils'
|
import { OceanUtils } from './utils/Utils'
|
||||||
|
|
||||||
import { MetadataStore } from '../metadatastore/MetadataStore'
|
import { MetadataStore } from '../metadatastore/MetadataStore'
|
||||||
import { Provider } from '../provider/Provider'
|
import { Provider } from '../provider/Provider'
|
||||||
import { DataTokens } from '../datatokens/Datatokens'
|
import { DataTokens } from '../datatokens/Datatokens'
|
||||||
import { Network } from '../datatokens/Network'
|
import { Network } from '../datatokens/Network'
|
||||||
import { Config } from '../models/Config'
|
import { Config } from '../models/Config'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Instantiable,
|
Instantiable,
|
||||||
generateIntantiableConfigFromConfig
|
generateIntantiableConfigFromConfig
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import Web3 from 'web3'
|
||||||
|
import { AbiItem } from 'web3-utils/types'
|
||||||
import { Contract } from 'web3-eth-contract'
|
import { Contract } from 'web3-eth-contract'
|
||||||
|
|
||||||
export class BalancerContractHandler {
|
export class BalancerContractHandler {
|
||||||
@ -8,14 +10,14 @@ export class BalancerContractHandler {
|
|||||||
public factoryBytecode: string
|
public factoryBytecode: string
|
||||||
public factoryAddress: string
|
public factoryAddress: string
|
||||||
public poolAddress: string
|
public poolAddress: string
|
||||||
public web3: any
|
public web3: Web3
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
factoryABI: Contract,
|
factoryABI: AbiItem | AbiItem[],
|
||||||
factoryBytecode: string,
|
factoryBytecode: string,
|
||||||
poolABI: Contract,
|
poolABI: AbiItem | AbiItem[],
|
||||||
poolBytecode: string,
|
poolBytecode: string,
|
||||||
web3: any
|
web3: Web3
|
||||||
) {
|
) {
|
||||||
this.web3 = web3
|
this.web3 = web3
|
||||||
this.factory = new this.web3.eth.Contract(factoryABI)
|
this.factory = new this.web3.eth.Contract(factoryABI)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
import Web3 from 'web3'
|
||||||
import { Contract } from 'web3-eth-contract'
|
import { Contract } from 'web3-eth-contract'
|
||||||
|
import { AbiItem } from 'web3-utils/types'
|
||||||
|
|
||||||
export class TestContractHandler {
|
export class TestContractHandler {
|
||||||
public factory: Contract
|
public factory: Contract
|
||||||
@ -8,14 +10,14 @@ export class TestContractHandler {
|
|||||||
public factoryBytecode: string
|
public factoryBytecode: string
|
||||||
public factoryAddress: string
|
public factoryAddress: string
|
||||||
public templateAddress: string
|
public templateAddress: string
|
||||||
public web3: any
|
public web3: Web3
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
factoryABI: Contract,
|
factoryABI: AbiItem | AbiItem[],
|
||||||
datatokensABI: Contract,
|
datatokensABI: AbiItem | AbiItem[],
|
||||||
templateBytecode: string,
|
templateBytecode: string,
|
||||||
factoryBytecode: string,
|
factoryBytecode: string,
|
||||||
web3: any
|
web3: Web3
|
||||||
) {
|
) {
|
||||||
this.web3 = web3
|
this.web3 = web3
|
||||||
this.factory = new this.web3.eth.Contract(factoryABI)
|
this.factory = new this.web3.eth.Contract(factoryABI)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user