From 205a763d97f16c74fde31c0b9e627bcb7ab9250b Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Thu, 27 Aug 2020 03:33:27 -0700 Subject: [PATCH] fix lint --- src/exchange/FixRateExchange.ts | 4 ++-- src/models/Config.ts | 1 - src/ocean/Ocean.ts | 3 +-- test/FixedPriceContractHandler.ts | 13 ++----------- test/unit/exchanges/FixedPriceExchange.test.ts | 2 +- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/exchange/FixRateExchange.ts b/src/exchange/FixRateExchange.ts index 837a4e10..e90f9d32 100644 --- a/src/exchange/FixRateExchange.ts +++ b/src/exchange/FixRateExchange.ts @@ -1,4 +1,4 @@ -const defaultFixedRateExchangeABI = require('@oceanprotocol/contracts/artifacts/FixedRateExchange.json') +import defaultFixedRateExchangeABI from '@oceanprotocol/contracts/artifacts/FixedRateExchange.json' export interface FixedPricedExchange { exchangeOwner: string @@ -101,7 +101,7 @@ export class OceanFixedRateExchange { if (err) console.log('FixedPriceExchange: ' + err) return estGas }) - + const trxReceipt = await this.contract.methods .swap(exchangeId, this.web3.utils.toWei(String(dataTokenAmount))) .send({ diff --git a/src/models/Config.ts b/src/models/Config.ts index cd40bd43..53dc0297 100644 --- a/src/models/Config.ts +++ b/src/models/Config.ts @@ -68,7 +68,6 @@ export class Config { */ public poolFactoryABI?: any - /** * Pool ABI * @type {string} diff --git a/src/ocean/Ocean.ts b/src/ocean/Ocean.ts index eef02a8d..ad7c7a4a 100644 --- a/src/ocean/Ocean.ts +++ b/src/ocean/Ocean.ts @@ -13,7 +13,7 @@ import { } from '../Instantiable.abstract' import { Compute } from './Compute' import { OceanPool } from '../balancer/OceanPool' -import {OceanFixedRateExchange, FixedPricedExchange} from '../exchange/FixRateExchange' +import { OceanFixedRateExchange, FixedPricedExchange } from '../exchange/FixRateExchange' /** * Main interface for Ocean Protocol. @@ -63,7 +63,6 @@ export class Ocean extends Instantiable { instanceConfig.config.fixedRateExchangeAddress, instanceConfig.config.fixedRateExchangeAddressABI, instanceConfig.config.oceanTokenAddress - ) instance.versions = await Versions.getInstance(instanceConfig) instance.network = new Network() diff --git a/test/FixedPriceContractHandler.ts b/test/FixedPriceContractHandler.ts index ea131bd4..724454a6 100644 --- a/test/FixedPriceContractHandler.ts +++ b/test/FixedPriceContractHandler.ts @@ -9,15 +9,10 @@ export class FixedPricedContractHandler { public contractAddress: string public web3: Web3 - constructor( - contractABI: AbiItem | AbiItem[], - contractBytecode: string, - web3: Web3 - ) { + constructor(contractABI: AbiItem | AbiItem[], contractBytecode: string, web3: Web3) { this.web3 = web3 this.contract = new this.web3.eth.Contract(contractABI) this.contractBytecode = contractBytecode - } public async getAccounts() { @@ -25,11 +20,9 @@ export class FixedPricedContractHandler { } public async deployContracts() { - let estGas - await this.getAccounts() // get est gascost - estGas = await this.contract + const estGas = await this.contract .deploy({ data: this.contractBytecode, arguments: [] @@ -52,7 +45,5 @@ export class FixedPricedContractHandler { .then(function (contract) { return contract.options.address }) - - } } diff --git a/test/unit/exchanges/FixedPriceExchange.test.ts b/test/unit/exchanges/FixedPriceExchange.test.ts index 5acdf021..cf009acb 100644 --- a/test/unit/exchanges/FixedPriceExchange.test.ts +++ b/test/unit/exchanges/FixedPriceExchange.test.ts @@ -11,9 +11,9 @@ import { import Web3 from 'web3' import factory from '@oceanprotocol/contracts/artifacts/DTFactory.json' import datatokensTemplate from '@oceanprotocol/contracts/artifacts/DataTokenTemplate.json' -import FixedRateExchangeContract = require('@oceanprotocol/contracts/artifacts/FixedRateExchange.json') import BigNumber from 'bignumber.js' +import FixedRateExchangeContract = require('@oceanprotocol/contracts/artifacts/FixedRateExchange.json') const web3 = new Web3('http://127.0.0.1:8545') describe('FixedRateExchange flow', () => {