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

Merge pull request #1492 from oceanprotocol/issue-1474-refactoring-restructure-file-location

Issue-#1474: Refactoring (1). Restructure file location
This commit is contained in:
Miquel A. Cabot 2022-06-27 15:19:48 +02:00 committed by GitHub
commit 9c9228c7bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 45 additions and 69 deletions

View File

@ -1,7 +1,7 @@
import Config from '../models/Config'
import { Config } from './Config'
// eslint-disable-next-line import/no-named-default
import { default as DefaultContractsAddresses } from '@oceanprotocol/contracts/addresses/address.json'
import LoggerInstance from './Logger'
import { LoggerInstance } from '../utils'
const configHelperNetworksBase: Config = {
chainId: null,

2
src/config/index.ts Normal file
View File

@ -0,0 +1,2 @@
export * from './Config'
export * from './ConfigHelper'

View File

@ -12,10 +12,9 @@ import {
getPoolCreationParams,
setContractDefaults,
estimateGas,
ZERO_ADDRESS,
ConfigHelper
} from '../utils'
import { Config } from '../models/index.js'
ZERO_ADDRESS
} from '../../utils'
import { Config, ConfigHelper } from '../../config'
import {
ProviderFees,
FreCreationParams,
@ -23,7 +22,7 @@ import {
PoolCreationParams,
DispenserCreationParams,
ConsumeMarketFee
} from '../@types/index.js'
} from '../../@types'
interface Template {
templateAddress: string

8
src/contracts/index.ts Normal file
View File

@ -0,0 +1,8 @@
export * from './factories/NFTFactory'
export * from './pools/Dispenser'
export * from './pools/FixedRateExchange'
export * from './pools/Pool'
export * from './pools/Router'
export * from './pools/SideStaking'
export * from './tokens/Datatoken'
export * from './tokens/NFT'

View File

@ -8,11 +8,10 @@ import {
LoggerInstance as logger,
getFairGasPrice,
setContractDefaults,
estimateGas,
ConfigHelper
estimateGas
} from '../../utils/'
import { Datatoken } from '../../tokens'
import { Config } from '../../models/index.js'
import { Datatoken } from '..'
import { Config, ConfigHelper } from '../../config'
export interface DispenserToken {
active: boolean

View File

@ -10,10 +10,9 @@ import {
amountToUnits,
unitsToAmount,
estimateGas,
ZERO_ADDRESS,
ConfigHelper
ZERO_ADDRESS
} from '../../utils'
import { Config } from '../../models/index.js'
import { Config, ConfigHelper } from '../../config'
import { PriceAndFees } from '../..'
export interface FixedPriceExchange {

View File

@ -8,8 +8,7 @@ import {
unitsToAmount,
amountToUnits,
LoggerInstance,
estimateGas,
ConfigHelper
estimateGas
} from '../../utils'
import BigNumber from 'bignumber.js'
import PoolTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BPool.sol/BPool.json'
@ -21,7 +20,7 @@ import {
AmountsOutMaxFee,
PoolPriceAndFees
} from '../../@types'
import { Config } from '../../models'
import { Config, ConfigHelper } from '../../config'
import {
getMaxAddLiquidity,
getMaxRemoveLiquidity,

View File

@ -3,9 +3,9 @@ import Web3 from 'web3'
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, ConfigHelper, estimateGas } from '../utils'
import { Operation } from '../@types/Router'
import { Config } from '../models/index.js'
import { getFairGasPrice, setContractDefaults, estimateGas } from '../../utils'
import { Operation } from '../../@types/Router'
import { Config, ConfigHelper } from '../../config'
/**
* Provides an interface for FactoryRouter contract

View File

@ -2,15 +2,9 @@ import Web3 from 'web3'
import { AbiItem } from 'web3-utils/types'
import { TransactionReceipt } from 'web3-core'
import { Contract } from 'web3-eth-contract'
import {
LoggerInstance,
getFairGasPrice,
ConfigHelper,
estimateGas,
unitsToAmount
} from '../../utils'
import { LoggerInstance, getFairGasPrice, estimateGas, unitsToAmount } from '../../utils'
import SideStakingTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/ssContracts/SideStaking.sol/SideStaking.json'
import { Config } from '../../models'
import { Config, ConfigHelper } from '../../config'
export class SideStaking {
public ssAbi: AbiItem | AbiItem[]

View File

@ -11,18 +11,17 @@ import {
setContractDefaults,
getFreOrderParams,
estimateGas,
ZERO_ADDRESS,
ConfigHelper
} from '../utils'
ZERO_ADDRESS
} from '../../utils'
import {
ConsumeMarketFee,
FreOrderParams,
FreCreationParams,
ProviderFees,
PublishingMarketFee
} from '../@types'
} from '../../@types'
import { Nft } from './NFT'
import { Config } from '../models/index.js'
import { Config, ConfigHelper } from '../../config'
/**
* ERC20 ROLES

View File

@ -7,13 +7,11 @@ import {
getFairGasPrice,
generateDtName,
setContractDefaults,
estimateGas,
ConfigHelper
} from '../utils'
estimateGas
} from '../../utils'
import { Contract } from 'web3-eth-contract'
import { MetadataProof } from '../../src/@types'
import { Config } from '../models/index.js'
import { MetadataAndTokenURI } from '../@types'
import { MetadataProof, MetadataAndTokenURI } from '../../@types'
import { Config, ConfigHelper } from '../../config'
/**
* ERC721 ROLES

View File

@ -1 +0,0 @@
export * from './NFTFactory'

View File

@ -1,8 +1,5 @@
export * from './aquarius'
export * from './pools'
export * from './tokens'
export * from './factories'
export * from './models'
export * from './utils'
export * from './@types'
export * from './provider'
export * from './services'
export * from './contracts'
export * from './config'
export * from './utils'

View File

@ -1 +0,0 @@
export * from './Config'

View File

@ -1 +0,0 @@
export * from './Pool'

View File

@ -1 +0,0 @@
export * from './Dispenser'

View File

@ -1 +0,0 @@
export * from './FixedRateExchange'

View File

@ -1,5 +0,0 @@
export * from './balancer'
export * from './dispenser'
export * from './fixedRate'
export * from './ssContracts'
export * from './Router'

View File

@ -1 +0,0 @@
export * from './SideStaking'

View File

@ -1 +0,0 @@
export * from './Provider'

View File

@ -1 +1,2 @@
export * from './Aquarius'
export * from './Provider'

View File

@ -1,2 +0,0 @@
export * from './Datatoken'
export * from './NFT'

View File

@ -8,7 +8,7 @@ import {
FreOrderParams,
PoolCreationParams
} from '../@types'
import { Config } from '../models'
import { Config } from '../config'
import { minAbi } from './minAbi'
import LoggerInstance from './Logger'
import { GASLIMIT_DEFAULT, ZERO_ADDRESS } from './Constants'

View File

@ -1,4 +1,4 @@
import wordListDefault from '../data/words.json'
import wordListDefault from './data/words.json'
/**
* Generate new datatoken name & symbol from a word list

View File

@ -2,7 +2,6 @@ export * from './Logger'
export * from './DatatokenName'
export * from './ContractUtils'
export * from './FetchHelper'
export * from './ConfigHelper'
export * from './DdoHelpers'
export * from './Constants'
export * from './SignatureUtils'

View File

@ -1,12 +1,8 @@
import Web3 from 'web3'
import fs from 'fs'
import { homedir } from 'os'
import {
ConfigHelper,
configHelperNetworks,
LoggerInstance,
LogLevel
} from '../src/utils'
import { ConfigHelper, configHelperNetworks } from '../src/config'
import { LoggerInstance, LogLevel } from '../src/utils'
LoggerInstance.setLevel(LogLevel.Error)