diff --git a/src/interfaces/DispenserInterface.ts b/src/@types/Dispenser.ts similarity index 100% rename from src/interfaces/DispenserInterface.ts rename to src/@types/Dispenser.ts diff --git a/src/interfaces/Erc20Interface.ts b/src/@types/Erc20.ts similarity index 100% rename from src/interfaces/Erc20Interface.ts rename to src/@types/Erc20.ts diff --git a/src/interfaces/Erc721Interface.ts b/src/@types/Erc721.ts similarity index 85% rename from src/interfaces/Erc721Interface.ts rename to src/@types/Erc721.ts index dbdd99fb..96c15c24 100644 --- a/src/interfaces/Erc721Interface.ts +++ b/src/@types/Erc721.ts @@ -1,4 +1,4 @@ -import { MetadataProof } from '../@types' +import { MetadataProof } from '.' export interface MetadataAndTokenURI { metaDataState: number diff --git a/src/interfaces/FixedRateInterface.ts b/src/@types/FixedPrice.ts similarity index 100% rename from src/interfaces/FixedRateInterface.ts rename to src/@types/FixedPrice.ts diff --git a/src/interfaces/PoolInterface.ts b/src/@types/Pool.ts similarity index 100% rename from src/interfaces/PoolInterface.ts rename to src/@types/Pool.ts diff --git a/src/interfaces/RouterInterface.ts b/src/@types/Router.ts similarity index 100% rename from src/interfaces/RouterInterface.ts rename to src/@types/Router.ts diff --git a/src/@types/index.ts b/src/@types/index.ts index 510da0a5..7e03cb56 100644 --- a/src/@types/index.ts +++ b/src/@types/index.ts @@ -6,3 +6,9 @@ export * from './DDO/Metadata' export * from './FileMetadata' export * from './Compute' export * from './Provider' +export * from './FixedPrice' +export * from './Pool' +export * from './Erc20' +export * from './Erc721' +export * from './Dispenser' +export * from './Router' diff --git a/src/factories/NFTFactory.ts b/src/factories/NFTFactory.ts index a3dbc0f6..d0796efa 100644 --- a/src/factories/NFTFactory.ts +++ b/src/factories/NFTFactory.ts @@ -13,14 +13,14 @@ import { configHelperNetworks, setContractDefaults } from '../utils' +import { Config } from '../models/index.js' import { + ProviderFees, FreCreationParams, Erc20CreateParams, PoolCreationParams, DispenserCreationParams -} from '../interfaces' -import { Config } from '../models/index.js' -import { ProviderFees } from '../@types/index.js' +} from '../@types/index.js' interface Template { templateAddress: string diff --git a/src/index.ts b/src/index.ts index 919a2dab..2f5d9790 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,4 +5,3 @@ export * from './models' export * from './utils' export * from './@types' export * from './provider' -export * from './interfaces' diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts deleted file mode 100644 index 447a29d4..00000000 --- a/src/interfaces/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './FixedRateInterface' -export * from './PoolInterface' -export * from './Erc20Interface' -export * from './DispenserInterface' -export * from './RouterInterface' diff --git a/src/pools/Router.ts b/src/pools/Router.ts index be2ba2a2..a1c6e0dc 100644 --- a/src/pools/Router.ts +++ b/src/pools/Router.ts @@ -4,7 +4,7 @@ import { TransactionReceipt } from 'web3-core' import { AbiItem } from 'web3-utils' import defaultRouter from '@oceanprotocol/contracts/artifacts/contracts/pools/FactoryRouter.sol/FactoryRouter.json' import { getFairGasPrice, setContractDefaults, configHelperNetworks } from '../utils' -import { Operation } from '../interfaces/RouterInterface' +import { Operation } from '../@types/Router' import { Config } from '../models/index.js' /** diff --git a/src/pools/balancer/Pool.ts b/src/pools/balancer/Pool.ts index 45d08eb1..0ab95845 100644 --- a/src/pools/balancer/Pool.ts +++ b/src/pools/balancer/Pool.ts @@ -3,25 +3,23 @@ import { AbiItem } from 'web3-utils/types' import { TransactionReceipt } from 'web3-core' import { Contract } from 'web3-eth-contract' import { - Logger, getFairGasPrice, configHelperNetworks, setContractDefaults, unitsToAmount, - amountToUnits + amountToUnits, + LoggerInstance } from '../../utils' import BigNumber from 'bignumber.js' import PoolTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BPool.sol/BPool.json' import defaultErc20Abi from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json' - import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee -} from '../../interfaces' +} from '../../@types' import { Config } from '../../models' -import { minAbi } from '../../utils/minAbi' const MaxUint256 = '115792089237316195423570985008687907853269984665640564039457584007913129639934' @@ -32,19 +30,12 @@ export class Pool { public poolAbi: AbiItem | AbiItem[] public web3: Web3 public GASLIMIT_DEFAULT = 1000000 - private logger: Logger private config: Config - constructor( - web3: Web3, - logger: Logger, - poolAbi: AbiItem | AbiItem[] = null, - config?: Config - ) { + constructor(web3: Web3, poolAbi: AbiItem | AbiItem[] = null, config?: Config) { if (poolAbi) this.poolAbi = poolAbi else this.poolAbi = PoolTemplate.abi as AbiItem[] this.web3 = web3 - this.logger = logger this.config = config || configHelperNetworks[0] } @@ -64,7 +55,7 @@ export class Pool { const balance = await token.methods.balanceOf(account).call() result = this.web3.utils.fromWei(balance) } catch (e) { - this.logger.error(`ERROR: Failed to get shares of pool : ${e.message}`) + LoggerInstance.error(`ERROR: Failed to get shares of pool : ${e.message}`) } return result } @@ -131,7 +122,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to set pool swap fee: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to set pool swap fee: ${e.message}`) } return result } @@ -150,7 +141,7 @@ export class Pool { try { result = await pool.methods.getNumTokens().call() } catch (e) { - this.logger.error(`ERROR: Failed to get number of tokens: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to get number of tokens: ${e.message}`) } return result } @@ -170,7 +161,9 @@ export class Pool { const result = await pool.methods.totalSupply().call() amount = this.web3.utils.fromWei(result) } catch (e) { - this.logger.error(`ERROR: Failed to get total supply of pool shares: ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to get total supply of pool shares: ${e.message}` + ) } return amount } @@ -189,7 +182,9 @@ export class Pool { try { result = await pool.methods.getCurrentTokens().call() } catch (e) { - this.logger.error(`ERROR: Failed to get tokens composing this pool: ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to get tokens composing this pool: ${e.message}` + ) } return result } @@ -208,7 +203,9 @@ export class Pool { try { result = await pool.methods.getFinalTokens().call() } catch (e) { - this.logger.error(`ERROR: Failed to get the final tokens composing this pool`) + LoggerInstance.error( + `ERROR: Failed to get the final tokens composing this pool ${e.message}` + ) } return result } @@ -227,7 +224,7 @@ export class Pool { try { result = await pool.methods.getController().call() } catch (e) { - this.logger.error(`ERROR: Failed to get pool controller address: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to get pool controller address: ${e.message}`) } return result } @@ -246,7 +243,7 @@ export class Pool { try { result = await pool.methods.getBaseTokenAddress().call() } catch (e) { - this.logger.error(`ERROR: Failed to get baseToken address: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to get baseToken address: ${e.message}`) } return result } @@ -265,7 +262,7 @@ export class Pool { try { result = await pool.methods.getDatatokenAddress().call() } catch (e) { - this.logger.error(`ERROR: Failed to get datatoken address: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to get datatoken address: ${e.message}`) } return result } @@ -284,7 +281,9 @@ export class Pool { try { result = await pool.methods._publishMarketCollector().call() } catch (e) { - this.logger.error(`ERROR: Failed to get marketFeeCollector address: ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to get marketFeeCollector address: ${e.message}` + ) } return result } @@ -303,7 +302,7 @@ export class Pool { try { result = await pool.methods._opcCollector().call() } catch (e) { - this.logger.error(`ERROR: Failed to get OPF Collector address: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to get OPF Collector address: ${e.message}`) } return result } @@ -323,7 +322,7 @@ export class Pool { try { result = await pool.methods.isBound(token).call() } catch (e) { - this.logger.error(`ERROR: Failed to check whether a token \ + LoggerInstance.error(`ERROR: Failed to check whether a token \ bounded to a pool. ${e.message}`) } return result @@ -345,7 +344,7 @@ export class Pool { const result = await pool.methods.getBalance(token).call() amount = await unitsToAmount(this.web3, token, result) } catch (e) { - this.logger.error(`ERROR: Failed to get how many tokens \ + LoggerInstance.error(`ERROR: Failed to get how many tokens \ are in the pool: ${e.message}`) } return amount.toString() @@ -365,7 +364,9 @@ export class Pool { try { result = await pool.methods.isFinalized().call() } catch (e) { - this.logger.error(`ERROR: Failed to check whether pool is finalized: ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to check whether pool is finalized: ${e.message}` + ) } return result } @@ -385,7 +386,7 @@ export class Pool { const result = await pool.methods.getSwapFee().call() fee = this.web3.utils.fromWei(result) } catch (e) { - this.logger.error(`ERROR: Failed to get pool fee: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to get pool fee: ${e.message}`) } return fee } @@ -406,7 +407,9 @@ export class Pool { const result = await pool.methods.getNormalizedWeight(token).call() weight = this.web3.utils.fromWei(result) } catch (e) { - this.logger.error(`ERROR: Failed to get normalized weight of a token: ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to get normalized weight of a token: ${e.message}` + ) } return weight } @@ -427,7 +430,9 @@ export class Pool { const result = await pool.methods.getDenormalizedWeight(token).call() weight = this.web3.utils.fromWei(result) } catch (e) { - this.logger.error('ERROR: Failed to get denormalized weight of a token in pool') + LoggerInstance.error( + `ERROR: Failed to get denormalized weight of a token in pool ${e.message}` + ) } return weight } @@ -447,7 +452,9 @@ export class Pool { const result = await pool.methods.getTotalDenormalizedWeight().call() weight = this.web3.utils.fromWei(result) } catch (e) { - this.logger.error('ERROR: Failed to get total denormalized weight in pool') + LoggerInstance.error( + `ERROR: Failed to get total denormalized weight in pool ${e.message}` + ) } return weight } @@ -468,7 +475,7 @@ export class Pool { const result = await pool.methods.publishMarketFees(token).call() weight = await unitsToAmount(this.web3, token, result) } catch (e) { - this.logger.error(`ERROR: Failed to get market fees for a token: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to get market fees for a token: ${e.message}`) } return weight } @@ -486,7 +493,9 @@ export class Pool { const currentMarketFees = await pool.methods.getCurrentOPCFees().call() return currentMarketFees } catch (e) { - this.logger.error(`ERROR: Failed to get community fees for a token: ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to get community fees for a token: ${e.message}` + ) } } @@ -503,7 +512,9 @@ export class Pool { const currentMarketFees = await pool.methods.getCurrentOPCFees().call() return currentMarketFees } catch (e) { - this.logger.error(`ERROR: Failed to get community fees for a token: ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to get community fees for a token: ${e.message}` + ) } } @@ -523,7 +534,9 @@ export class Pool { const result = await pool.methods.communityFees(token).call() weight = await unitsToAmount(this.web3, token, result) } catch (e) { - this.logger.error(`ERROR: Failed to get community fees for a token: ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to get community fees for a token: ${e.message}` + ) } return weight } @@ -580,7 +593,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to swap exact amount in : ${e.message}`) + LoggerInstance.error(`ERROR: Failed to swap exact amount in : ${e.message}`) } return result } @@ -645,7 +658,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to swap exact amount in : ${e.message}`) + LoggerInstance.error(`ERROR: Failed to swap exact amount in : ${e.message}`) } return result } @@ -716,7 +729,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to swap exact amount in : ${e.message}`) + LoggerInstance.error(`ERROR: Failed to swap exact amount in : ${e.message}`) } return result } @@ -841,7 +854,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to swap exact amount in : ${e.message}`) + LoggerInstance.error(`ERROR: Failed to swap exact amount in : ${e.message}`) } return result @@ -963,7 +976,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to swap exact amount out: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to swap exact amount out: ${e.message}`) } return result } @@ -1047,7 +1060,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to join pool: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to join pool: ${e.message}`) } return result } @@ -1129,7 +1142,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to exit pool: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to exit pool: ${e.message}`) } return result } @@ -1215,7 +1228,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to pay tokens in order to \ + LoggerInstance.error(`ERROR: Failed to pay tokens in order to \ join the pool: ${e.message}`) } return result @@ -1302,7 +1315,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error('ERROR: Failed to join swap pool amount out') + LoggerInstance.error(`ERROR: Failed to join swap pool amount out ${e.message}`) } return result } @@ -1392,7 +1405,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error(`ERROR: Failed to pay pool shares into the pool: ${e.message}`) + LoggerInstance.error(`ERROR: Failed to pay pool shares into the pool: ${e.message}`) } return result } @@ -1477,7 +1490,7 @@ export class Pool { gasPrice: await getFairGasPrice(this.web3, this.config) }) } catch (e) { - this.logger.error('ERROR: Failed to exitswapExternAmountOut') + LoggerInstance.error(`ERROR: Failed to exitswapExternAmountOut ${e.message}`) } return result } @@ -1514,12 +1527,12 @@ export class Pool { try { decimalsTokenIn = await tokenInContract.methods.decimals().call() } catch (e) { - this.logger.error('ERROR: FAILED TO CALL DECIMALS(), USING 18') + LoggerInstance.error(`ERROR: FAILED TO CALL DECIMALS(), USING 18 ${e.message}`) } try { decimalsTokenOut = await tokenOutContract.methods.decimals().call() } catch (e) { - this.logger.error('ERROR: FAILED TO CALL DECIMALS(), USING 18') + LoggerInstance.error(`ERROR: FAILED TO CALL DECIMALS(), USING 18 ${e.message}`) } let price = null @@ -1529,7 +1542,9 @@ export class Pool { .call() price = new BigNumber(price.toString()) } catch (e) { - this.logger.error('ERROR: Failed to get spot price of swapping tokenIn to tokenOut') + LoggerInstance.error( + 'ERROR: Failed to get spot price of swapping tokenIn to tokenOut' + ) } let decimalsDiff @@ -1573,7 +1588,7 @@ export class Pool { .call() amount = await unitsToAmount(this.web3, tokenIn, result) } catch (e) { - this.logger.error('ERROR: Failed to calcInGivenOut') + LoggerInstance.error(`ERROR: Failed to calcInGivenOut ${e.message}`) } return amount } @@ -1606,7 +1621,7 @@ export class Pool { amount = await unitsToAmount(this.web3, tokenOut, result) } catch (e) { - this.logger.error('ERROR: Failed to calcOutGivenIn') + LoggerInstance.error(`ERROR: Failed to calcOutGivenIn ${e.message}`) } return amount } @@ -1632,7 +1647,9 @@ export class Pool { amount = await unitsToAmount(this.web3, poolAddress, result) } catch (e) { - this.logger.error(`ERROR: Failed to calculate PoolOutGivenSingleIn : ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to calculate PoolOutGivenSingleIn : ${e.message}` + ) } return amount } @@ -1656,7 +1673,9 @@ export class Pool { amount = await unitsToAmount(this.web3, tokenIn, result) } catch (e) { - this.logger.error(`ERROR: Failed to calculate SingleInGivenPoolOut : ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to calculate SingleInGivenPoolOut : ${e.message}` + ) } return amount } @@ -1681,7 +1700,7 @@ export class Pool { .call() amount = await unitsToAmount(this.web3, tokenOut, result) } catch (e) { - this.logger.error(`ERROR: Failed to calculate SingleOutGivenPoolIn : ${e}`) + LoggerInstance.error(`ERROR: Failed to calculate SingleOutGivenPoolIn : ${e}`) } return amount } @@ -1707,7 +1726,9 @@ export class Pool { amount = await unitsToAmount(this.web3, poolAddress, result) } catch (e) { - this.logger.error(`ERROR: Failed to calculate PoolInGivenSingleOut : ${e.message}`) + LoggerInstance.error( + `ERROR: Failed to calculate PoolInGivenSingleOut : ${e.message}` + ) } return amount } diff --git a/src/tokens/Datatoken.ts b/src/tokens/Datatoken.ts index dcf19ad8..b14a30b7 100644 --- a/src/tokens/Datatoken.ts +++ b/src/tokens/Datatoken.ts @@ -11,10 +11,10 @@ import { setContractDefaults, configHelperNetworks } from '../utils' -import { FreOrderParams, FreCreationParams } from '../interfaces' +import { FreOrderParams, FreCreationParams, ProviderFees } from '../@types' import { Nft } from './NFT' import { Config } from '../models/index.js' -import { ProviderFees } from '../@types/Provider.js' + /** * ERC20 ROLES */ diff --git a/src/tokens/NFT.ts b/src/tokens/NFT.ts index 7ff7856e..7875c78b 100644 --- a/src/tokens/NFT.ts +++ b/src/tokens/NFT.ts @@ -12,7 +12,7 @@ import { import { Contract } from 'web3-eth-contract' import { MetadataProof } from '../../src/@types' import { Config } from '../models/index.js' -import { MetadataAndTokenURI } from '../interfaces/Erc721Interface' +import { MetadataAndTokenURI } from '../@types' /** * ERC721 ROLES diff --git a/src/utils/ContractUtils.ts b/src/utils/ContractUtils.ts index 9d536abb..544d57ad 100644 --- a/src/utils/ContractUtils.ts +++ b/src/utils/ContractUtils.ts @@ -2,10 +2,10 @@ import Web3 from 'web3' import BigNumber from 'bignumber.js' import { Contract } from 'web3-eth-contract' import { generateDtName } from './DatatokenName' -import { Erc20CreateParams, FreCreationParams, PoolCreationParams } from '../interfaces' +import { Erc20CreateParams, FreCreationParams, PoolCreationParams } from '../@types' import { Config } from '../models' -import { AbiItem } from 'web3-utils/types' import { minAbi } from './minAbi' +import LoggerInstance from './Logger' export function setContractDefaults(contract: Contract, config: Config): Contract { if (config) { @@ -107,7 +107,7 @@ export async function unitsToAmount( BigNumber.config({ EXPONENTIAL_AT: 50 }) return amountFormatted.toString() } catch (e) { - this.logger.error('ERROR: FAILED TO CALL DECIMALS(), USING 18') + LoggerInstance.error(`ERROR: FAILED TO CALL DECIMALS(), USING 18' : ${e.message}`) } } @@ -126,6 +126,6 @@ export async function amountToUnits( BigNumber.config({ EXPONENTIAL_AT: 50 }) return amountFormatted.toString() } catch (e) { - this.logger.error('ERROR: FAILED TO CALL DECIMALS(), USING 18') + LoggerInstance.error(`ERROR: FAILED TO CALL DECIMALS(), USING 18', ${e.message}`) } } diff --git a/test/integration/ComputeFlow.test.ts b/test/integration/ComputeFlow.test.ts index 5e35dbb9..064a6981 100644 --- a/test/integration/ComputeFlow.test.ts +++ b/test/integration/ComputeFlow.test.ts @@ -4,15 +4,13 @@ import Aquarius from '../../src/aquarius/Aquarius' import { assert } from 'chai' import { NftFactory, NftCreateData } from '../../src/factories/index' import { Datatoken } from '../../src/tokens/Datatoken' -import { Erc20CreateParams } from '../../src/interfaces' import { getHash } from '../../src/utils' import { Nft } from '../../src/tokens/NFT' import Web3 from 'web3' import { SHA256 } from 'crypto-js' import { homedir } from 'os' import fs from 'fs' -import console from 'console' -import { ProviderFees } from '../../src/@types' +import { ProviderFees, Erc20CreateParams } from '../../src/@types' const data = JSON.parse( fs.readFileSync( diff --git a/test/integration/PublishFlows.test.ts b/test/integration/PublishFlows.test.ts index 90b32468..d03b6435 100644 --- a/test/integration/PublishFlows.test.ts +++ b/test/integration/PublishFlows.test.ts @@ -3,12 +3,6 @@ import ProviderInstance from '../../src/provider/Provider' import Aquarius from '../../src/aquarius/Aquarius' import { assert } from 'chai' import { NftFactory, NftCreateData } from '../../src/factories/index' -import { - Erc20CreateParams, - PoolCreationParams, - FreCreationParams, - DispenserCreationParams -} from '../../src/interfaces' import { getHash, ZERO_ADDRESS } from '../../src/utils' import { Nft } from '../../src/tokens/NFT' import Web3 from 'web3' @@ -16,7 +10,14 @@ import { SHA256 } from 'crypto-js' import { homedir } from 'os' import fs from 'fs' import { AbiItem } from 'web3-utils' -import { ValidateMetadata, DDO } from '../../src/@types' +import { + ValidateMetadata, + DDO, + Erc20CreateParams, + PoolCreationParams, + FreCreationParams, + DispenserCreationParams +} from '../../src/@types' const data = JSON.parse( fs.readFileSync( diff --git a/test/integration/SimplePublishConsumeFlow.test.ts b/test/integration/SimplePublishConsumeFlow.test.ts index 3538241a..b935a4bd 100644 --- a/test/integration/SimplePublishConsumeFlow.test.ts +++ b/test/integration/SimplePublishConsumeFlow.test.ts @@ -3,7 +3,6 @@ import Aquarius from '../../src/aquarius/Aquarius' import { assert } from 'chai' import { NftFactory, NftCreateData } from '../../src/factories/index' import { Datatoken } from '../../src/tokens/Datatoken' -import { Erc20CreateParams } from '../../src/interfaces' import { getHash } from '../../src/utils' import { Nft } from '../../src/tokens/NFT' import Web3 from 'web3' @@ -11,7 +10,7 @@ import { SHA256 } from 'crypto-js' import { homedir } from 'os' import fs from 'fs' import { downloadFile } from '../../src/utils/FetchHelper' -import { ProviderFees } from '../../src/@types/Provider' +import { ProviderFees, Erc20CreateParams } from '../../src/@types' const data = JSON.parse( fs.readFileSync( diff --git a/test/unit/NftFactory.test.ts b/test/unit/NftFactory.test.ts index 0c5f23cf..ef286752 100644 --- a/test/unit/NftFactory.test.ts +++ b/test/unit/NftFactory.test.ts @@ -12,13 +12,13 @@ import FixedRate from '@oceanprotocol/contracts/artifacts/contracts/pools/fixedR import OPFCommunityFeeCollector from '@oceanprotocol/contracts/artifacts/contracts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json' import PoolTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools//balancer/BPool.sol/BPool.json' import { NftFactory, NftCreateData, TokenOrder } from '../../src/factories/NFTFactory' +import { ZERO_ADDRESS, signHash } from '../../src/utils' import { + ProviderFees, FreCreationParams, Erc20CreateParams, PoolCreationParams -} from '../../src/interfaces' -import { ZERO_ADDRESS, signHash } from '../../src/utils' -import { ProviderFees } from '../../src/@types' +} from '../../src/@types' const web3 = new Web3('http://127.0.0.1:8545') diff --git a/test/unit/pools/Router.test.ts b/test/unit/pools/Router.test.ts index b4cf43e3..c1f7d870 100644 --- a/test/unit/pools/Router.test.ts +++ b/test/unit/pools/Router.test.ts @@ -13,7 +13,7 @@ import OPFCommunityFeeCollector from '@oceanprotocol/contracts/artifacts/contrac import PoolTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BPool.sol/BPool.json' import { NftFactory, NftCreateData } from '../../../src/factories/NFTFactory' import { Router } from '../../../src/pools/Router' -import { Erc20CreateParams, PoolCreationParams, Operation } from '../../../src/interfaces' +import { Erc20CreateParams, PoolCreationParams, Operation } from '../../../src/@types' const { keccak256 } = require('@ethersproject/keccak256') const web3 = new Web3('http://127.0.0.1:8545') diff --git a/test/unit/pools/balancer/Pool.test.ts b/test/unit/pools/balancer/Pool.test.ts index c4c4b473..42ad445d 100644 --- a/test/unit/pools/balancer/Pool.test.ts +++ b/test/unit/pools/balancer/Pool.test.ts @@ -22,7 +22,7 @@ import { TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee -} from '../../../../src/interfaces' +} from '../../../../src/@types' const web3 = new Web3('http://127.0.0.1:8545') describe('Pool unit test', () => { @@ -74,7 +74,7 @@ describe('Pool unit test', () => { await contracts.deployContracts(factoryOwner, FactoryRouter.abi as AbiItem[]) // initialize Pool instance - pool = new Pool(web3, LoggerInstance, PoolTemplate.abi as AbiItem[]) + pool = new Pool(web3, PoolTemplate.abi as AbiItem[]) assert(pool != null) daiContract = new web3.eth.Contract( diff --git a/test/unit/pools/dispenser/Dispenser.test.ts b/test/unit/pools/dispenser/Dispenser.test.ts index 4f27fb7f..ccc393a6 100644 --- a/test/unit/pools/dispenser/Dispenser.test.ts +++ b/test/unit/pools/dispenser/Dispenser.test.ts @@ -14,7 +14,7 @@ import { NftFactory, NftCreateData } from '../../../../src/factories/' import { Datatoken, DispenserParams } from '../../../../src/tokens/' import { Dispenser } from '../../../../src/pools/dispenser/' import { TestContractHandler } from '../../../TestContractHandler' -import { Erc20CreateParams } from '../../../../src/interfaces' +import { Erc20CreateParams } from '../../../../src/@types' const web3 = new Web3('http://127.0.0.1:8545') diff --git a/test/unit/pools/fixedRate/FixedRateExchange.test.ts b/test/unit/pools/fixedRate/FixedRateExchange.test.ts index e2993086..949184fe 100644 --- a/test/unit/pools/fixedRate/FixedRateExchange.test.ts +++ b/test/unit/pools/fixedRate/FixedRateExchange.test.ts @@ -15,7 +15,7 @@ import PoolTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/bal import OPFCollector from '@oceanprotocol/contracts/artifacts/contracts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json' import { NftFactory, NftCreateData } from '../../../../src/factories/NFTFactory' import { FixedRateExchange } from '../../../../src/pools/fixedRate/FixedRateExchange' -import { FreCreationParams, Erc20CreateParams } from '../../../../src/interfaces' +import { FreCreationParams, Erc20CreateParams } from '../../../../src/@types' const web3 = new Web3('http://127.0.0.1:8545') describe('Fixed Rate unit test', () => { diff --git a/test/unit/pools/ssContracts/SideStaking.test.ts b/test/unit/pools/ssContracts/SideStaking.test.ts index 0abdf197..78c36044 100644 --- a/test/unit/pools/ssContracts/SideStaking.test.ts +++ b/test/unit/pools/ssContracts/SideStaking.test.ts @@ -22,7 +22,7 @@ import { TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee -} from '../../../../src/interfaces' +} from '../../../../src/@types' const web3 = new Web3('http://127.0.0.1:8545') describe('SideStaking unit test', () => { @@ -78,7 +78,7 @@ describe('SideStaking unit test', () => { await contracts.deployContracts(factoryOwner, FactoryRouter.abi as AbiItem[]) // initialize Pool instance - pool = new Pool(web3, LoggerInstance, PoolTemplate.abi as AbiItem[]) + pool = new Pool(web3, PoolTemplate.abi as AbiItem[]) assert(pool != null) // sideStaking = new SideStaking(web3, SSContract.abi as AbiItem[]) diff --git a/test/unit/tokens/Datatoken.test.ts b/test/unit/tokens/Datatoken.test.ts index 42cf9d36..1d7066a2 100644 --- a/test/unit/tokens/Datatoken.test.ts +++ b/test/unit/tokens/Datatoken.test.ts @@ -15,9 +15,8 @@ import { TestContractHandler } from '../../TestContractHandler' import { NftFactory, NftCreateData } from '../../../src/factories/NFTFactory' import { Datatoken, Nft, OrderParams, DispenserParams } from '../../../src/tokens' import { AbiItem } from 'web3-utils' -import { FreCreationParams, FreOrderParams } from '../../../src/interfaces' import { ZERO_ADDRESS, signHash } from '../../../src/utils' -import { ProviderFees } from '../../../src/@types/Provider.js' +import { ProviderFees, FreCreationParams, FreOrderParams } from '../../../src/@types/' const web3 = new Web3('http://127.0.0.1:8545') diff --git a/test/unit/tokens/Nft.test.ts b/test/unit/tokens/Nft.test.ts index a614ad5b..c7f61066 100644 --- a/test/unit/tokens/Nft.test.ts +++ b/test/unit/tokens/Nft.test.ts @@ -14,7 +14,7 @@ import { NftFactory, NftCreateData } from '../../../src/factories/NFTFactory' import { Nft } from '../../../src/tokens/NFT' import { AbiItem } from 'web3-utils' import sha256 from 'crypto-js/sha256' -import { MetadataAndTokenURI } from '../../../src/interfaces/Erc721Interface' +import { MetadataAndTokenURI } from '../../../src/@types/Erc721' const web3 = new Web3('http://127.0.0.1:8545')