mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Merge pull request #1493 from oceanprotocol/issue-1474-refactoring-restructure-imports
Issue-#1474: Refactoring (2). Restructure imports
This commit is contained in:
commit
51361030e8
@ -1,4 +1,4 @@
|
||||
import { DDO } from './DDO/DDO'
|
||||
import { DDO } from '.'
|
||||
|
||||
export interface AssetNft {
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Metadata, MetadataAlgorithm } from './DDO/Metadata'
|
||||
import { Metadata, MetadataAlgorithm } from '.'
|
||||
|
||||
export type ComputeResultType =
|
||||
| 'algorithmLog'
|
||||
|
@ -1,7 +1,4 @@
|
||||
import { Service } from './Service'
|
||||
import { Metadata } from './Metadata'
|
||||
import { Credentials } from './Credentials'
|
||||
import { Event } from './Event'
|
||||
import { Service, Metadata, Credentials, Event } from '..'
|
||||
|
||||
/**
|
||||
* DID Descriptor Object.
|
||||
|
@ -1,14 +1,16 @@
|
||||
export * from './DDO/DDO'
|
||||
export * from './Asset'
|
||||
export * from './DDO/Service'
|
||||
export * from './DDO/Credentials'
|
||||
export * from './DDO/DDO'
|
||||
export * from './DDO/Event'
|
||||
export * from './DDO/Metadata'
|
||||
export * from './FileMetadata'
|
||||
export * from './DDO/Service'
|
||||
export * from './Asset'
|
||||
export * from './Compute'
|
||||
export * from './Provider'
|
||||
export * from './FixedPrice'
|
||||
export * from './Pool'
|
||||
export * from './Dispenser'
|
||||
export * from './DownloadResponse'
|
||||
export * from './Erc20'
|
||||
export * from './Erc721'
|
||||
export * from './Dispenser'
|
||||
export * from './FileMetadata'
|
||||
export * from './FixedPrice'
|
||||
export * from './Pool'
|
||||
export * from './Provider'
|
||||
export * from './Router'
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { LogLevel } from '../utils/Logger'
|
||||
import { AbiItem } from 'web3-utils/types'
|
||||
import { LogLevel } from '../utils'
|
||||
|
||||
export class Config {
|
||||
/**
|
||||
@ -195,5 +195,3 @@ export class Config {
|
||||
*/
|
||||
gasFeeMultiplier: number
|
||||
}
|
||||
|
||||
export default Config
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Config } from './Config'
|
||||
// eslint-disable-next-line import/no-named-default
|
||||
import { default as DefaultContractsAddresses } from '@oceanprotocol/contracts/addresses/address.json'
|
||||
import { Config } from '.'
|
||||
import { LoggerInstance } from '../utils'
|
||||
|
||||
const configHelperNetworksBase: Config = {
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
ZERO_ADDRESS
|
||||
} from '../../utils'
|
||||
import { Config, ConfigHelper } from '../../config'
|
||||
import { PriceAndFees } from '../..'
|
||||
import { PriceAndFees } from '../../@types'
|
||||
|
||||
export interface FixedPriceExchange {
|
||||
active: boolean
|
||||
|
@ -2,17 +2,22 @@ import Web3 from 'web3'
|
||||
import { AbiItem } from 'web3-utils/types'
|
||||
import { TransactionReceipt } from 'web3-core'
|
||||
import { Contract } from 'web3-eth-contract'
|
||||
import Decimal from 'decimal.js'
|
||||
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 {
|
||||
getFairGasPrice,
|
||||
setContractDefaults,
|
||||
unitsToAmount,
|
||||
amountToUnits,
|
||||
LoggerInstance,
|
||||
estimateGas
|
||||
estimateGas,
|
||||
getMaxAddLiquidity,
|
||||
getMaxRemoveLiquidity,
|
||||
getMaxSwapExactIn,
|
||||
getMaxSwapExactOut
|
||||
} 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,
|
||||
@ -21,13 +26,7 @@ import {
|
||||
PoolPriceAndFees
|
||||
} from '../../@types'
|
||||
import { Config, ConfigHelper } from '../../config'
|
||||
import {
|
||||
getMaxAddLiquidity,
|
||||
getMaxRemoveLiquidity,
|
||||
getMaxSwapExactIn,
|
||||
getMaxSwapExactOut
|
||||
} from '../../utils/PoolHelpers'
|
||||
import Decimal from 'decimal.js'
|
||||
|
||||
const MaxUint256 =
|
||||
'115792089237316195423570985008687907853269984665640564039457584007913129639934'
|
||||
|
||||
|
@ -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, estimateGas } from '../../utils'
|
||||
import { Operation } from '../../@types/Router'
|
||||
import { Operation } from '../../@types'
|
||||
import { Config, ConfigHelper } from '../../config'
|
||||
|
||||
/**
|
||||
|
@ -2,8 +2,8 @@ import Web3 from 'web3'
|
||||
import { AbiItem } from 'web3-utils/types'
|
||||
import { TransactionReceipt } from 'web3-core'
|
||||
import { Contract } from 'web3-eth-contract'
|
||||
import { LoggerInstance, getFairGasPrice, estimateGas, unitsToAmount } from '../../utils'
|
||||
import SideStakingTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/ssContracts/SideStaking.sol/SideStaking.json'
|
||||
import { LoggerInstance, getFairGasPrice, estimateGas, unitsToAmount } from '../../utils'
|
||||
import { Config, ConfigHelper } from '../../config'
|
||||
|
||||
export class SideStaking {
|
||||
|
@ -1,5 +1,5 @@
|
||||
export * from './@types'
|
||||
export * from './services'
|
||||
export * from './contracts'
|
||||
export * from './config'
|
||||
export * from './contracts'
|
||||
export * from './services'
|
||||
export * from './utils'
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { LoggerInstance, sleep } from '../utils'
|
||||
import { Asset, DDO, ValidateMetadata } from '../@types/'
|
||||
import fetch from 'cross-fetch'
|
||||
import { LoggerInstance, sleep } from '../utils'
|
||||
import { Asset, DDO, ValidateMetadata } from '../@types'
|
||||
|
||||
export class Aquarius {
|
||||
public aquariusURL
|
||||
/**
|
||||
@ -122,5 +123,3 @@ export class Aquarius {
|
||||
return status
|
||||
}
|
||||
}
|
||||
|
||||
export default Aquarius
|
||||
|
@ -1,5 +1,6 @@
|
||||
import Web3 from 'web3'
|
||||
import { LoggerInstance, getData } from '../utils'
|
||||
import fetch from 'cross-fetch'
|
||||
import { LoggerInstance, getData, noZeroX } from '../utils'
|
||||
import {
|
||||
FileMetadata,
|
||||
ComputeJob,
|
||||
@ -9,9 +10,8 @@ import {
|
||||
ComputeEnvironment,
|
||||
ProviderInitialize,
|
||||
ProviderComputeInitializeResults
|
||||
} from '../@types/'
|
||||
import { noZeroX } from '../utils/ConversionTypeHelper'
|
||||
import fetch from 'cross-fetch'
|
||||
} from '../@types'
|
||||
|
||||
export interface HttpCallback {
|
||||
(httpMethod: string, url: string, body: string, header: any): Promise<any>
|
||||
}
|
||||
@ -780,4 +780,3 @@ export class Provider {
|
||||
}
|
||||
|
||||
export const ProviderInstance = new Provider()
|
||||
export default ProviderInstance
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Web3 from 'web3'
|
||||
import BigNumber from 'bignumber.js'
|
||||
import { Contract } from 'web3-eth-contract'
|
||||
import { generateDtName } from './DatatokenName'
|
||||
import {
|
||||
Erc20CreateParams,
|
||||
FreCreationParams,
|
||||
@ -9,9 +8,7 @@ import {
|
||||
PoolCreationParams
|
||||
} from '../@types'
|
||||
import { Config } from '../config'
|
||||
import { minAbi } from './minAbi'
|
||||
import LoggerInstance from './Logger'
|
||||
import { GASLIMIT_DEFAULT, ZERO_ADDRESS } from './Constants'
|
||||
import { generateDtName, minAbi, LoggerInstance, GASLIMIT_DEFAULT, ZERO_ADDRESS } from '.'
|
||||
|
||||
export function setContractDefaults(contract: Contract, config: Config): Contract {
|
||||
if (config) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { LoggerInstance } from './Logger'
|
||||
import { LoggerInstance } from '.'
|
||||
|
||||
export const zeroX = (input: string): string => zeroXTransformer(input, true)
|
||||
export const noZeroX = (input: string): string => zeroXTransformer(input, false)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import sha256 from 'crypto-js/sha256'
|
||||
import Web3 from 'web3'
|
||||
import LoggerInstance from './Logger'
|
||||
import { LoggerInstance } from '.'
|
||||
|
||||
export function generateDid(erc721Address: string, chainId: number): string {
|
||||
erc721Address = Web3.utils.toChecksumAddress(erc721Address)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import fetch from 'cross-fetch'
|
||||
import LoggerInstance from './Logger'
|
||||
import { DownloadResponse } from '../@types/DownloadResponse'
|
||||
import { DownloadResponse } from '../@types'
|
||||
import { LoggerInstance } from '.'
|
||||
|
||||
export async function fetchData(url: string, opts: RequestInit): Promise<Response> {
|
||||
const result = await fetch(url, opts)
|
||||
|
@ -43,4 +43,3 @@ export class Logger {
|
||||
}
|
||||
|
||||
export const LoggerInstance = new Logger()
|
||||
export default LoggerInstance
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Decimal from 'decimal.js'
|
||||
import { Pool } from '..'
|
||||
import { Pool } from '../contracts'
|
||||
|
||||
export function calcMaxExactOut(balance: string): Decimal {
|
||||
return new Decimal(balance).div(2)
|
||||
|
@ -1,5 +1,4 @@
|
||||
import Web3 from 'web3'
|
||||
import { LoggerInstance } from './Logger'
|
||||
|
||||
export async function signHash(web3: Web3, message: string, address: string) {
|
||||
let signedMessage = await web3.eth.sign(message, address)
|
||||
|
@ -1,15 +1,15 @@
|
||||
import Decimal from 'decimal.js'
|
||||
import { Contract } from 'web3-eth-contract'
|
||||
import { TransactionReceipt } from 'web3-core'
|
||||
import Web3 from 'web3'
|
||||
import {
|
||||
amountToUnits,
|
||||
estimateGas,
|
||||
getFairGasPrice,
|
||||
unitsToAmount
|
||||
} from './ContractUtils'
|
||||
import { minAbi } from './minAbi'
|
||||
import LoggerInstance from './Logger'
|
||||
import { TransactionReceipt } from 'web3-core'
|
||||
import Web3 from 'web3'
|
||||
unitsToAmount,
|
||||
minAbi,
|
||||
LoggerInstance
|
||||
} from '.'
|
||||
|
||||
/**
|
||||
* Estimate gas cost for approval function
|
||||
|
@ -1,10 +1,12 @@
|
||||
export * from './Logger'
|
||||
export * from './DatatokenName'
|
||||
export * from './ContractUtils'
|
||||
export * from './FetchHelper'
|
||||
export * from './DdoHelpers'
|
||||
export * from './Constants'
|
||||
export * from './ContractUtils'
|
||||
export * from './ConversionTypeHelper'
|
||||
export * from './DatatokenName'
|
||||
export * from './DdoHelpers'
|
||||
export * from './FetchHelper'
|
||||
export * from './General'
|
||||
export * from './Logger'
|
||||
export * from './minAbi'
|
||||
export * from './PoolHelpers'
|
||||
export * from './SignatureUtils'
|
||||
export * from './TokenUtils'
|
||||
export * from './General'
|
||||
export * from './PoolHelpers'
|
||||
|
Loading…
x
Reference in New Issue
Block a user