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